/* ================================
   VARIABLES & RESET
   ================================ */
:root {
    --bg: #F5F0E8;
    --bg-dark: #1C1917;
    --text: #1C1917;
    --text-inv: #F5F0E8;
    --red: #C62828;
    --red-soft: rgba(198, 40, 40, 0.07);
    --gold: #A67C52;
    --gray: #9C9488;
    --gray-light: #DDD7CD;
    --serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
    --sans: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    line-height: 1.6;
}

::selection {
    background: rgba(198, 40, 40, 0.15);
}

#landing ::selection,
#transition ::selection {
    background: rgba(198, 40, 40, 0.35);
    color: var(--text-inv);
}

/* ================================
   SCREEN MANAGEMENT
   ================================ */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0s 0.6s;
    padding: 2rem;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease, visibility 0s;
}

/* ================================
   LANDING (dark theme)
   ================================ */
#landing {
    background: var(--bg-dark);
    background-image: radial-gradient(ellipse at 50% 25%, rgba(198, 40, 40, 0.05) 0%, transparent 70%);
    color: var(--text-inv);
}

.landing-inner {
    text-align: center;
    max-width: 600px;
}

.landing-inner > * {
    opacity: 0;
    animation: fadeUp 0.7s ease forwards;
}
.landing-inner > :nth-child(1) { animation-delay: 0.15s; }
.landing-inner > :nth-child(2) { animation-delay: 0.3s; }
.landing-inner > :nth-child(3) { animation-delay: 0.55s; }
.landing-inner > :nth-child(4) { animation-delay: 0.85s; }
.landing-inner > :nth-child(5) { animation-delay: 1.1s; }
.landing-inner > :nth-child(6) { animation-delay: 1.35s; }

.seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border: 2px solid var(--red);
    border-radius: 3px;
    transform: rotate(-8deg);
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--red);
    line-height: 1.1;
    letter-spacing: 0.15em;
    margin-bottom: 0;
}

.seal-line {
    width: 1.5px;
    height: 36px;
    background: var(--red);
    margin: 0 auto 2rem;
    opacity: 0.35;
}

.landing-title {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(2.2rem, 7vw, 4rem);
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    line-height: 1.25;
}

.landing-desc {
    font-size: 1rem;
    color: rgba(245, 240, 232, 0.5);
    line-height: 2;
    margin-bottom: 3rem;
}

.start-wrap {
    margin-bottom: 0;
}

.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    font-family: var(--sans);
    font-size: 1.05rem;
    color: var(--text-inv);
    cursor: pointer;
    padding: 0.75rem 0;
    border-bottom: 1.5px solid rgba(245, 240, 232, 0.4);
    transition: all 0.3s ease;
    letter-spacing: 0.08em;
}

.start-btn:hover {
    color: var(--red);
    border-bottom-color: var(--red);
    gap: 1.25rem;
}

.start-btn svg {
    transition: transform 0.3s ease;
}

.start-btn:hover svg {
    transform: translateX(4px);
}

.landing-leaders {
    margin-top: 4rem;
    font-size: 0.8rem;
    color: rgba(245, 240, 232, 0.2);
    letter-spacing: 0.35em;
}

/* ================================
   QUIZ
   ================================ */
#quiz {
    background: var(--bg);
    justify-content: flex-start;
    padding: 0;
}

.quiz-top {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 1.5rem 2rem;
    gap: 1.5rem;
    flex-shrink: 0;
}

.progress {
    flex: 1;
    height: 2px;
    background: var(--gray-light);
}

.progress-fill {
    height: 100%;
    background: var(--red);
    transition: width 0.5s ease;
    width: 0%;
    border-radius: 0 1px 1px 0;
}

.question-counter {
    font-size: 0.82rem;
    color: var(--gray);
    font-variant-numeric: tabular-nums;
    min-width: 3.5em;
    text-align: right;
    letter-spacing: 0.05em;
}

#questionArea {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 680px;
    padding: 0 2.5rem 2.5rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.question-text {
    font-family: var(--serif);
    font-size: clamp(1.15rem, 3vw, 1.5rem);
    font-weight: 600;
    line-height: 1.7;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(12px);
    animation: fadeUp 0.5s ease forwards;
}

.options {
    display: flex;
    flex-direction: column;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--gray-light);
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: background 0.2s ease;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUp 0.4s ease forwards;
    animation-delay: var(--delay);
}

.option:first-child {
    border-top: 1px solid var(--gray-light);
}

.option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--red);
    transition: width 0.2s ease;
}

@media (hover: hover) {
    .option:hover {
        background: var(--red-soft);
    }
    .option:hover::before {
        width: 3px;
    }
    .option:hover .option-marker {
        color: var(--red);
    }
}

.option:active {
    background: var(--red-soft);
}

.option.selected {
    background: var(--red-soft);
}

.option.selected::before {
    width: 3px;
}

.option.selected .option-marker {
    color: var(--red);
}

.option-marker {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray);
    transition: color 0.2s ease;
    min-width: 1.2em;
    padding-top: 0.12rem;
}

.option-text {
    line-height: 1.6;
    flex: 1;
}

.option:disabled {
    cursor: default;
}

.option:disabled:not(.selected) {
    opacity: 0.45;
    transition: opacity 0.35s ease;
}

/* ================================
   TRANSITION
   ================================ */
#transition {
    background: var(--bg-dark);
    color: var(--text-inv);
}

.transition-inner {
    text-align: center;
}

.ink-dots {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 2rem;
}

.ink-dot {
    display: block;
    width: 5px;
    height: 5px;
    background: var(--text-inv);
    border-radius: 50%;
    animation: dotPulse 1.2s ease-in-out infinite;
}

.ink-dot:nth-child(2) { animation-delay: 0.2s; }
.ink-dot:nth-child(3) { animation-delay: 0.4s; }

.transition-text {
    font-family: var(--serif);
    font-size: 1rem;
    color: rgba(245, 240, 232, 0.5);
    letter-spacing: 0.2em;
}

/* ================================
   RESULT
   ================================ */
#result {
    background: var(--bg);
    overflow-y: auto;
    justify-content: flex-start;
    padding: 3rem 2rem 4rem;
}

#resultContent {
    max-width: 600px;
    width: 100%;
}

.result-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.result-label {
    font-size: 0.85rem;
    color: var(--gray);
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeUp 0.5s ease 0.2s forwards;
}

.result-name {
    font-family: var(--serif);
    font-size: clamp(2.8rem, 10vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 0.12em;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeUp 0.6s ease 0.4s forwards;
}

.result-years {
    font-size: 0.82rem;
    color: var(--gray);
    margin-bottom: 0.75rem;
    letter-spacing: 0.08em;
    opacity: 0;
    animation: fadeUp 0.5s ease 0.55s forwards;
}

.result-style {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    opacity: 0;
    animation: fadeUp 0.5s ease 0.65s forwards;
}

.result-divider {
    width: 40px;
    height: 2px;
    background: var(--red);
    margin: 0 auto 2.5rem;
    opacity: 0;
    animation: fadeUp 0.5s ease 0.75s forwards;
}

.result-body {
    opacity: 0;
    animation: fadeUp 0.5s ease 0.85s forwards;
}

.result-desc {
    font-size: 0.95rem;
    line-height: 2;
    margin-bottom: 2rem;
    white-space: pre-line;
}

.result-quote {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--red);
    text-align: center;
    padding: 1.5rem 0;
    margin-bottom: 1.5rem;
    border-top: 1px solid var(--gray-light);
    border-bottom: 1px solid var(--gray-light);
    letter-spacing: 0.08em;
}

.result-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 3rem;
    justify-content: center;
}

.trait-tag {
    font-size: 0.78rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--gray-light);
    color: var(--gray);
    letter-spacing: 0.06em;
}

/* Breakdown Chart */
.result-breakdown {
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: fadeUp 0.5s ease 1.05s forwards;
}

.breakdown-title {
    font-family: var(--serif);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--gray);
}

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 0;
}

.breakdown-name {
    font-size: 0.85rem;
    min-width: 3.5em;
    text-align: right;
    letter-spacing: 0.05em;
}

.breakdown-row.top .breakdown-name {
    font-weight: 700;
}

.breakdown-bar-bg {
    flex: 1;
    height: 4px;
    background: var(--gray-light);
    position: relative;
}

.breakdown-bar {
    height: 100%;
    width: 0;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.breakdown-pct {
    font-size: 0.78rem;
    color: var(--gray);
    min-width: 2.8em;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

/* Actions */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    animation: fadeUp 0.5s ease 1.2s forwards;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    font-family: var(--sans);
    font-size: 0.88rem;
    color: var(--gray);
    cursor: pointer;
    padding: 0.5rem 0;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    letter-spacing: 0.06em;
}

.action-btn svg {
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.action-btn:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

.action-btn:hover svg {
    opacity: 1;
}

.result-footnote {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray);
    line-height: 1.8;
    opacity: 0;
    animation: fadeUp 0.5s ease 1.4s forwards;
}

/* ================================
   ANIMATIONS
   ================================ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.6); }
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 640px) {
    .quiz-top {
        padding: 1rem 1.5rem;
    }

    #questionArea {
        padding: 0 1.5rem 1.5rem;
    }

    .option {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        gap: 0.75rem;
    }

    #result {
        padding: 2rem 1.5rem 3rem;
    }

    .landing-leaders {
        font-size: 0.7rem;
        letter-spacing: 0.25em;
    }

    .result-actions {
        gap: 1.5rem;
    }
}

@media (max-width: 380px) {
    .landing-title {
        letter-spacing: 0.05em;
    }

    .question-text {
        margin-bottom: 2rem;
    }
}
