/* ============================================================
   CSS VARIABLES — Palet: Sunny Day / Coral + Sky + Mint
   Primary RGB : 249, 115, 22  (orange-500)
   Accent RGB  : 59,  130, 246 (blue-500)
   Green RGB   : 16,  185, 129 (emerald-500)
============================================================ */
:root {
    --bg: #fff8f3;
    --surface: #fff1e8;
    --card: rgba(255, 255, 255, 0.97);
    --border: rgba(249, 115, 22, 0.15);
    --glow: #f97316;
    --accent: #fb923c;
    --sky: #3b82f6;
    --sky-light: #93c5fd;
    --teal: #0ea5e9;
    --coral: #f43f5e;
    --gold: #f59e0b;
    --gold-light: #fbbf24;
    --red-soft: #ef4444;
    --green-soft: #10b981;
    --text: #1e293b;
    --text-body: #334155;
    --muted: #94a3b8;
    --muted-dark: #64748b;
    --font-display: 'Nunito', sans-serif;
    --font-body: 'DM Sans', sans-serif;
}

/* ============================================================
   RESET & BASE
============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1rem 4rem;
    overflow-x: hidden;
    position: relative;
}

/* ============================================================
   BACKGROUND — Colorful floating blobs (CSS only)
============================================================ */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 75% 55% at 10% 5%, rgba(253, 186, 116, 0.38) 0%, transparent 58%),
        radial-gradient(ellipse 55% 45% at 90% 10%, rgba(147, 197, 253, 0.35) 0%, transparent 52%),
        radial-gradient(ellipse 65% 60% at 80% 88%, rgba(167, 243, 208, 0.32) 0%, transparent 55%),
        radial-gradient(ellipse 50% 45% at 15% 80%, rgba(253, 164, 175, 0.28) 0%, transparent 50%),
        radial-gradient(ellipse 40% 35% at 50% 52%, rgba(254, 215, 170, 0.18) 0%, transparent 60%);
    animation: blobDrift 22s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

/* Polka dot pattern */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle 1.2px at center, rgba(249, 115, 22, 0.1) 0%, transparent 100%);
    background-size: 28px 28px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
}

@keyframes blobDrift {
    0% { transform: scale(1) translate(0, 0); }
    33% { transform: scale(1.03) translate(-8px, 10px); }
    66% { transform: scale(0.98) translate(6px, -8px); }
    100% { transform: scale(1.02) translate(-4px, 5px); }
}

/* ============================================================
   MAIN WRAPPER
============================================================ */
#app {
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================================
   SECTION TRANSITIONS
============================================================ */
.section {
    display: none;
    width: 100%;
}

.section.active {
    display: block;
    animation: sectionIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.section.leaving {
    animation: sectionOut 0.32s ease forwards;
}

@keyframes sectionIn {
    from { opacity: 0; transform: translateY(28px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sectionOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-18px); }
}

/* ============================================================
   CARD
============================================================ */
.card {
    background: var(--card);
    border: 1.5px solid rgba(249, 115, 22, 0.1);
    border-radius: 1.75rem;
    padding: 2.75rem 2.25rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 4px 6px rgba(249, 115, 22, 0.04),
        0 12px 40px rgba(249, 115, 22, 0.07),
        0 30px 80px rgba(59, 130, 246, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
}

/* Rainbow top stripe */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
            #f97316 0%, #fb923c 16%,
            #fbbf24 32%, #34d399 48%,
            #38bdf8 64%, #818cf8 80%,
            #f472b6 100%);
    border-radius: 1.75rem 1.75rem 0 0;
}

/* ============================================================
   TYPOGRAPHY
============================================================ */
.t-display {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
}

.t-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: 1rem;
    color: var(--muted-dark);
}

.t-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.93rem;
    line-height: 1.75;
    color: var(--text-body);
}

.t-label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ============================================================
   DIVIDER
============================================================ */
.rune-divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.5rem 0;
}

.rune-divider::before,
.rune-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    border-radius: 2px;
}

.rune-divider::before {
    background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.3));
}

.rune-divider::after {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.3), transparent);
}

.rune-divider span {
    font-size: 1.1rem;
    opacity: 0.75;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn-main {
    display: block;
    width: 100%;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #ffffff;
    background: linear-gradient(135deg, #f97316 0%, #fb923c 50%, #f59e0b 100%);
    border: none;
    border-radius: 1rem;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow:
        0 4px 16px rgba(249, 115, 22, 0.35),
        0 1px 4px rgba(249, 115, 22, 0.2);
}

.btn-main:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 28px rgba(249, 115, 22, 0.45), 0 2px 8px rgba(249, 115, 22, 0.25);
}

.btn-main:active {
    transform: translateY(0) scale(0.99);
}

.btn-ghost {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted-dark);
    background: transparent;
    border: 1.5px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.85rem 2rem;
    cursor: pointer;
    transition: all 0.22s ease;
}

.btn-ghost:hover {
    background: rgba(249, 115, 22, 0.05);
    border-color: rgba(249, 115, 22, 0.3);
    color: var(--glow);
}

/* ============================================================
   SIGIL
============================================================ */
.sigil {
    width: 90px;
    height: 90px;
    margin-bottom: 1.25rem;
}

/* ============================================================
   INPUTS
============================================================ */
.input-label {
    display: block;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-dark);
    margin-bottom: 0.55rem;
}

.field-input {
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 0.9rem 1.2rem;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    outline: none;
    transition: all 0.22s ease;
    appearance: none;
    -webkit-appearance: none;
}

.field-input:focus {
    border-color: var(--glow);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

select.field-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23f97316' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    padding-right: 2.8rem;
    cursor: pointer;
}

select.field-input option {
    background: #fff;
    color: var(--text);
}

/* Choice cards */
.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.choice-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--muted-dark);
    cursor: pointer;
    transition: all 0.22s ease;
    user-select: none;
}

.choice-card:hover {
    border-color: rgba(249, 115, 22, 0.4);
    background: rgba(249, 115, 22, 0.04);
    color: var(--text);
}

.choice-card.selected {
    border-color: var(--glow);
    background: rgba(249, 115, 22, 0.08);
    color: var(--glow);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* Radio groups */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.radio-option:hover {
    border-color: rgba(249, 115, 22, 0.35);
    background: rgba(249, 115, 22, 0.04);
}

.radio-option.selected {
    border-color: var(--glow);
    background: rgba(249, 115, 22, 0.07);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}

.radio-dot {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.radio-option.selected .radio-dot {
    border-color: var(--glow);
    background: rgba(249, 115, 22, 0.1);
}

.radio-option.selected .radio-dot::after {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--glow);
}

.radio-label {
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--muted-dark);
    transition: color 0.2s ease;
}

.radio-option.selected .radio-label {
    color: var(--text);
    font-weight: 500;
}

.q-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.65rem;
}

.error-msg {
    display: none;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--red-soft);
    margin-top: 0.45rem;
}

/* ============================================================
   STEP INDICATOR
============================================================ */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 1.5rem;
}

.step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.step-dot.active {
    background: var(--glow);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
    width: 22px;
    border-radius: 4px;
}

.step-dot.done {
    background: var(--green-soft);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* ============================================================
   LOADING ORB
============================================================ */
.loading-orb-wrap {
    width: 110px;
    height: 110px;
    margin: 0 auto;
    position: relative;
}

.orb-core {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%,
            rgba(255, 210, 120, 0.95),
            rgba(249, 115, 22, 0.55) 45%,
            rgba(251, 146, 60, 0.2) 70%);
    border: 2px solid rgba(249, 115, 22, 0.3);
    box-shadow:
        0 0 30px rgba(249, 115, 22, 0.45),
        0 0 70px rgba(251, 191, 36, 0.22),
        0 0 120px rgba(249, 115, 22, 0.08);
    animation: orbPulse 2.2s ease-in-out infinite;
    z-index: 2;
}

.orb-core::after {
    content: '⌛';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.3rem;
    filter: opacity(0.65);
}

.orb-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(249, 115, 22, 0.16);
}

.orb-ring-1 {
    inset: -12px;
    animation: ringRotate 4s linear infinite;
}

.orb-ring-2 {
    inset: -26px;
    border-style: dashed;
    border-color: rgba(59, 130, 246, 0.12);
    animation: ringRotate 8s linear infinite reverse;
}

.orb-ring-3 {
    inset: -44px;
    border-color: rgba(16, 185, 129, 0.08);
    animation: ringRotate 14s linear infinite;
}

@keyframes orbPulse {
    0%, 100% { transform: scale(1); }
    50% {
        transform: scale(1.09);
        box-shadow: 0 0 50px rgba(249, 115, 22, 0.6), 0 0 100px rgba(251, 191, 36, 0.28);
    }
}

@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--glow);
    font-size: 1rem;
    min-height: 1.8em;
}

/* ============================================================
   RESULT — Numbers
============================================================ */
.result-num-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 165px;
    margin: 0.25rem 0;
}

.result-big-num {
    font-family: var(--font-display);
    font-size: clamp(5rem, 20vw, 8rem);
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, #f97316 0%, #fb923c 40%, #f59e0b 80%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: numPop 3s ease-in-out infinite;
    position: relative;
    z-index: 3;
}

.res-halo {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(249, 115, 22, 0.1);
}

.res-halo-1 {
    width: 145px;
    height: 145px;
    animation: ringRotate 9s linear infinite;
}

.res-halo-2 {
    width: 192px;
    height: 192px;
    border-style: dashed;
    border-color: rgba(59, 130, 246, 0.07);
    animation: ringRotate 16s linear infinite reverse;
}

@keyframes numPop {
    0%, 100% { filter: drop-shadow(0 4px 18px rgba(249, 115, 22, 0.45)); }
    50% { filter: drop-shadow(0 6px 32px rgba(249, 115, 22, 0.75)) drop-shadow(0 0 55px rgba(251, 191, 36, 0.4)); }
}

.archetype-badge {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
    background: linear-gradient(135deg, #f97316, #f59e0b);
    border-radius: 2rem;
    padding: 0.4rem 1.3rem;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
}

.remaining-block {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.07), rgba(14, 165, 233, 0.07));
    border: 1.5px solid rgba(16, 185, 129, 0.22);
    border-radius: 1.25rem;
    padding: 1.3rem 1.5rem;
    text-align: center;
    margin-bottom: 0.75rem;
}

.remaining-num {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: numPop2 3s ease-in-out infinite;
    display: block;
    line-height: 1.1;
}

@keyframes numPop2 {
    0%, 100% { filter: drop-shadow(0 3px 12px rgba(16, 185, 129, 0.45)); }
    50% { filter: drop-shadow(0 5px 24px rgba(14, 165, 233, 0.65)); }
}

/* Factor chips */
.factor-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin: 0.75rem 0;
}

.factor-chip {
    font-family: var(--font-body);
    font-size: 0.73rem;
    font-weight: 500;
    border-radius: 2rem;
    padding: 0.3rem 0.85rem;
}

.chip-plus {
    background: rgba(16, 185, 129, 0.1);
    border: 1.5px solid rgba(16, 185, 129, 0.3);
    color: #059669;
}

.chip-minus {
    background: rgba(239, 68, 68, 0.09);
    border: 1.5px solid rgba(239, 68, 68, 0.25);
    color: #dc2626;
}

.chip-neutral {
    background: rgba(59, 130, 246, 0.08);
    border: 1.5px solid rgba(59, 130, 246, 0.22);
    color: #2563eb;
}

/* Trait cards */
.trait-block {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.1rem 1.3rem;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.trait-block:hover {
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(249, 115, 22, 0.03);
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.09);
}

.trait-label {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--glow);
    margin-bottom: 0.4rem;
}

.trait-content {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-body);
}

/* Quote */
.quote-block {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.06), rgba(59, 130, 246, 0.04));
    border-left: 3px solid var(--glow);
    border-radius: 0 1rem 1rem 0;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

.quote-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-body);
    line-height: 1.65;
}

/* Bucket list */
.bucket-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.bucket-item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-family: var(--font-body);
    font-size: 0.87rem;
    font-weight: 400;
    color: var(--text-body);
    line-height: 1.6;
}

.bucket-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
    font-size: 0.6rem;
    color: white;
    font-weight: 900;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

/* Life bar */
.life-bar-wrap {
    background: #e2e8f0;
    border-radius: 1rem;
    overflow: hidden;
    height: 10px;
    margin: 0.5rem 0 0.3rem;
}

.life-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f97316, #f59e0b, #34d399);
    border-radius: 1rem;
    transition: width 1.6s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.35);
}

/* Privacy note */
.privacy-note {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
    margin-top: 1rem;
}

/* Notice box */
.notice-box {
    background: rgba(251, 191, 36, 0.1);
    border: 1.5px solid rgba(251, 191, 36, 0.32);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1.75rem;
}

.notice-box p {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: #92400e;
    line-height: 1.55;
}

/* Emoji float animation */
.emoji-float {
    display: inline-block;
    animation: floatUpDown 3s ease-in-out infinite;
}

.emoji-float:nth-child(2) { animation-delay: 0.5s; }
.emoji-float:nth-child(3) { animation-delay: 1s; }

@keyframes floatUpDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(249, 115, 22, 0.2); border-radius: 3px; }

@media (max-width: 420px) {
    .card { padding: 2rem 1.4rem; }
    body { padding: 1.25rem 0.75rem 3rem; }
}
