/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    /* Dark theme (landing) */
    --bg-dark-1: #0e1a13;
    --bg-dark-2: #1a2e22;
    --bg-dark-3: #2d4a38;
    --glow-color: rgba(160, 200, 170, 0.15);

    /* Light theme (test & result) */
    --bg-light: #f2f7f3;
    --card-bg: #ffffff;
    --card-border: #d6e5da;

    /* Accent colors */
    --accent: #3d5a48;
    --accent-dark: #2a3f32;
    --accent-light: #bcdac4;
    --accent-muted: #8aab94;
    --highlight: #7fcf97;

    /* Text */
    --text-primary: #151f18;
    --text-secondary: #3f5648;
    --text-muted: #7a9484;
    --text-on-dark: #e8f0ea;
    --text-on-dark-muted: rgba(232, 240, 234, 0.55);

    /* Misc */
    --selected-bg: #e4f2e8;
    --selected-border: #4a6453;
    --progress-bg: #d3e4d7;
    --progress-fill: #3d5a48;
    --danger: #c0392b;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.1);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    color: var(--text-primary);
    background: var(--bg-light);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===== VIEW SYSTEM ===== */
.view {
    display: none;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.view:not(.active) {
    display: none !important;
}

.view.active {
    display: block;
    opacity: 1;
}

.view.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
    letter-spacing: 0.02em;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: 0 4px 20px rgba(61, 90, 72, 0.35);
}

.btn-outline {
    background: transparent;
    color: var(--text-on-dark);
    border-color: rgba(255,255,255,0.25);
}

.btn-outline:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.45);
}

.btn-primary-dark {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary-dark:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: 0 4px 20px rgba(61, 90, 72, 0.3);
}

.btn-outline-dark {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--card-border);
}

.btn-outline-dark:hover {
    background: var(--selected-bg);
    border-color: var(--accent-muted);
}

/* ===== LANDING PAGE ===== */
#landing {
    background: linear-gradient(155deg, var(--bg-dark-1) 0%, var(--bg-dark-2) 50%, var(--bg-dark-3) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 10vw;
}

.landing-glow {
    position: absolute;
    top: -120px;
    right: -80px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(140, 190, 155, 0.18) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: glowPulse 6s ease-in-out infinite;
}

.landing-glow-2 {
    position: absolute;
    bottom: -60px;
    left: -100px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(140, 190, 155, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: glowPulse 8s ease-in-out infinite reverse;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.08); }
}

.landing-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
}

.landing-eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    color: var(--text-on-dark-muted);
    font-weight: 600;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 30px;
    padding: 6px 18px;
    font-size: 0.85rem;
    color: var(--accent-light);
    font-weight: 500;
    margin-bottom: 32px;
    backdrop-filter: blur(10px);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--highlight);
    display: inline-block;
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(127, 207, 151, 0.4); }
    50%      { opacity: 0.7; box-shadow: 0 0 0 6px rgba(127, 207, 151, 0); }
}

.landing-title {
    font-size: clamp(2.6rem, 7vw, 4.8rem);
    font-weight: 900;
    color: var(--text-on-dark);
    line-height: 1.15;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.landing-title .highlight {
    color: var(--highlight);
    text-shadow: 0 0 40px rgba(127, 207, 151, 0.3);
}

.landing-desc {
    font-size: 1.1rem;
    color: var(--text-on-dark-muted);
    max-width: 480px;
    line-height: 1.7;
    margin-bottom: 40px;
}

.landing-btns {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.landing-footer {
    position: absolute;
    bottom: 28px;
    right: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-on-dark-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 30px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all var(--transition);
    z-index: 2;
}

.landing-footer:hover {
    background: rgba(255,255,255,0.1);
}

/* ===== TEST PAGE ===== */
#test {
    background: var(--bg-light);
    padding: 0 0 100px !important;
    margin-top: 0 !important;
}

.test-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.test-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.test-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.test-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 28px;
}

/* Progress Bar */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 36px;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: var(--progress-bg);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--highlight));
    border-radius: 10px;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    min-width: 50px;
    text-align: right;
}

/* Question Cards */
.question-card {
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    transition: all var(--transition);
    animation: cardSlideIn 0.4s ease forwards;
    opacity: 0;
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.question-card:nth-child(n) {
    animation-delay: calc(var(--index, 0) * 30ms);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.question-number {
    display: inline-flex;
    align-items: center;
    background: var(--selected-bg);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid var(--card-border);
}

.question-dimension {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.question-text {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 18px;
    font-weight: 500;
}

/* Options */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--card-border);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.option-item:hover {
    border-color: var(--accent-muted);
    background: rgba(61, 90, 72, 0.03);
}

.option-item.selected {
    background: var(--selected-bg);
    border-color: var(--selected-border);
}

.option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.option-item.selected .option-radio {
    border-color: var(--accent);
    background: var(--accent);
}

.option-item.selected .option-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--progress-bg);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.option-item.selected .option-label {
    background: var(--accent);
    color: #fff;
}

.option-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Submit Bar */
.submit-bar {
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-top: 30px;
    animation: cardSlideIn 0.4s ease forwards;
}

.submit-hint {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 18px;
}

.submit-btns {
    display: flex;
    gap: 14px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ===== RESULT PAGE ===== */
#result {
    background: var(--bg-light);
    padding: 50px 0 80px;
}

.result-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.result-header {
    display: flex;
    gap: 30px;
    margin-bottom: 36px;
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    padding: 28px;
    align-items: flex-start;
}

.result-type-card {
    width: 280px;
    min-height: 260px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #e8f0ea, #d0e2d5);
    border: 1.5px solid var(--card-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.type-card-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
    background: rgba(255,255,255,0.7);
    padding: 4px 16px;
    border-radius: 20px;
}

.type-card-cn {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.type-card-code {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 16px;
    letter-spacing: 0.05em;
}

.type-card-emoji {
    font-size: 4rem;
    margin-bottom: 12px;
    line-height: 1;
}

.type-card-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.result-type-info {
    flex: 1;
}

.result-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.result-type-name {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.result-match-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--selected-bg);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    margin-bottom: 14px;
}

.result-match-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Result Sections */
.result-section {
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1.5px solid var(--card-border);
}

.result-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.85;
}

/* Radar Chart */
.radar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

#radar-chart {
    max-width: 100%;
    height: auto;
}

/* Dimension Bars */
.dimension-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dim-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dim-bar-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 72px;
    text-align: right;
    flex-shrink: 0;
}

.dim-bar-track {
    flex: 1;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 8px;
    overflow: hidden;
}

.dim-bar-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--accent), var(--highlight));
    transition: width 0.8s ease;
}

.dim-bar-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 32px;
}

/* Disclaimer */
.result-disclaimer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-btns {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 460px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.modal-content h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.modal-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.poster-image {
    width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
}

.modal-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    background: var(--accent-dark);
    color: #fff;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 2000;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
    animation: toastIn 0.35s ease;
    pointer-events: none;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #landing {
        padding: 40px 24px;
        justify-content: center;
    }

    .landing-title {
        font-size: clamp(2rem, 9vw, 3.2rem);
    }

    .landing-btns {
        flex-direction: column;
        gap: 10px;
    }

    .landing-btns .btn {
        width: 100%;
    }

    .landing-footer {
        bottom: 16px;
        right: 16px;
        font-size: 0.78rem;
    }

    .test-container {
        padding: 0 16px;
    }

    .question-card {
        padding: 20px 18px;
    }

    .result-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .result-type-card {
        width: 100%;
        max-width: 320px;
    }

    .result-type-info {
        text-align: center;
    }

    .result-btns {
        flex-direction: column;
    }

    .result-btns .btn {
        width: 100%;
    }

    .submit-btns {
        flex-direction: column;
    }

    .submit-btns .btn {
        width: 100%;
    }

    .dim-bar-name {
        min-width: 56px;
        font-size: 0.72rem;
    }
}

@media (max-width: 400px) {
    .landing-title {
        font-size: 1.8rem;
    }

    .question-text {
        font-size: 0.92rem;
    }

    .option-text {
        font-size: 0.88rem;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-muted);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ===== SELECTION ===== */
::selection {
    background: var(--accent-light);
    color: var(--text-primary);
}

/* ===== PAYWALL PAGE ===== */
#paywall {
    background: linear-gradient(155deg, var(--bg-dark-1) 0%, var(--bg-dark-2) 50%, var(--bg-dark-3) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

#paywall .landing-glow {
    top: -100px;
    right: -100px;
}

.paywall-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 40px 36px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.4s ease;
}

.paywall-lock-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: lockBounce 2s ease-in-out infinite;
}

@keyframes lockBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.paywall-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-on-dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

.paywall-subtitle {
    font-size: 0.9rem;
    color: var(--text-on-dark-muted);
    margin-bottom: 28px;
    line-height: 1.6;
}

.paywall-price-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--highlight);
    color: var(--bg-dark-1);
    font-size: 1.5rem;
    font-weight: 900;
    padding: 10px 28px;
    border-radius: 50px;
    margin-bottom: 28px;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 20px rgba(127, 207, 151, 0.4);
}

.paywall-qr-wrap {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    display: inline-block;
    margin-bottom: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.paywall-qr-wrap img {
    width: 180px;
    height: 180px;
    display: block;
}

.paywall-qr-loading {
    width: 180px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.paywall-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--progress-bg);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.paywall-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-on-dark-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
    min-height: 24px;
}

.paywall-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--highlight);
    animation: dotPulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.paywall-status.error-status { color: #e07070; }
.paywall-status.error-status .status-dot { background: #e07070; animation: none; }

.paywall-hint {
    font-size: 0.8rem;
    color: var(--text-on-dark-muted);
    line-height: 1.5;
}

.paywall-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

/* unlock success flash */
@keyframes unlockFlash {
    0%   { background: rgba(127, 207, 151, 0.3); }
    100% { background: transparent; }
}

.unlock-flash {
    animation: unlockFlash 1s ease;
}

/* ===== RESPONSIVE PAYWALL ===== */
@media (max-width: 480px) {
    .paywall-card {
        padding: 28px 20px;
    }

    .paywall-qr-wrap img {
        width: 150px;
        height: 150px;
    }

    .paywall-qr-loading {
        width: 150px;
        height: 150px;
    }
}
