/* ════════════════════════════════════════
   灵魂匹配 · 像素离散 MBTI 测试
   ════════════════════════════════════════ */

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

:root {
    --bg: #0e0e12;
    --surface: #18181f;
    --surface-2: #222230;
    --text: #edeef0;
    --text-sub: #9ea3ab;
    --text-muted: #55586a;
    --accent: #a78bfa;
    --accent-pink: #f472b6;
    --radius: 16px;
    --radius-sm: 10px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ─── 页面切换 ─── */
.page {
    display: none;
    min-height: 100dvh;
}
.page.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ════════════════════════════════════════
   首页
   ════════════════════════════════════════ */
.start-container {
    text-align: center;
    padding: 40px 24px;
    max-width: 480px;
}
.start-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.start-title {
    font-size: 2.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.start-subtitle {
    font-size: 1.15rem;
    color: var(--text-sub);
    margin-bottom: 24px;
}
.start-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 36px;
}
.btn-start {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-pink));
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.35);
}
.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(167, 139, 250, 0.5);
}
.btn-start:active {
    transform: scale(0.97);
}
.start-meta {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    justify-content: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ════════════════════════════════════════
   答题页
   ════════════════════════════════════════ */
.quiz-container {
    width: 100%;
    max-width: 560px;
    padding: 32px 24px;
}

/* 进度条 */
.quiz-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}
.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-pink));
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(.4, 0, .2, 1);
}
.progress-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    min-width: 48px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* 题目 */
.quiz-question {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 28px;
    min-height: 3em;
}

/* 选项 */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.option-btn {
    width: 100%;
    padding: 18px 22px;
    font-size: 1rem;
    line-height: 1.5;
    text-align: left;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--surface-2);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}
.option-btn:hover {
    border-color: var(--accent);
    background: var(--surface-2);
    transform: translateX(4px);
}
.option-btn:active {
    transform: scale(0.98);
    background: rgba(167, 139, 250, 0.12);
    border-color: var(--accent);
}
.option-btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* 入场动画 */
.animate-in {
    animation: slideUp 0.35s cubic-bezier(.4, 0, .2, 1);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════
   结果页
   ════════════════════════════════════════ */
.result-container {
    width: 100%;
    max-width: 480px;
    padding: 24px 16px 40px;
}
.result-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: scaleIn 0.5s cubic-bezier(.4, 0, .2, 1);
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.result-header {
    padding: 32px 24px 28px;
    text-align: center;
}
.result-mbti {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 4px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
.result-mbti-name {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
}

.result-body {
    padding: 28px 24px 24px;
}
.result-match-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 8px;
}
.result-char-name {
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 4px;
}
.result-char-title {
    text-align: center;
    font-size: 1rem;
    color: var(--text-sub);
    margin-bottom: 4px;
}
.result-series {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.result-desc {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text-sub);
    margin-bottom: 20px;
}

.result-quote {
    font-size: 1.05rem;
    font-style: italic;
    color: var(--text);
    text-align: center;
    padding: 16px 20px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    line-height: 1.6;
}

.result-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 28px;
}
.trait-tag {
    padding: 4px 14px;
    border: 1.5px solid;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
}

/* 维度条 */
.dim-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 600;
}
.dim-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.dim-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 56px;
    white-space: nowrap;
}
.dim-label:first-child { text-align: right; }
.dim-label:last-child { text-align: left; }
.dim-label.dim-active {
    color: var(--text);
    font-weight: 700;
}
.dim-bar {
    flex: 1;
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    overflow: hidden;
}
.dim-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(.4, 0, .2, 1);
}

/* 按钮组 */
.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}
.btn-retry, .btn-share {
    flex: 1;
    padding: 14px 0;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.btn-retry {
    background: var(--surface-2);
    color: var(--text);
}
.btn-retry:hover {
    background: var(--surface);
    outline: 1.5px solid var(--text-muted);
}
.btn-share {
    background: linear-gradient(135deg, var(--accent), var(--accent-pink));
    color: #fff;
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.3);
}
.btn-share:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(167, 139, 250, 0.45);
}

.result-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--surface-2);
    text-align: center;
    font-size: 0.8rem;
    display: flex;
    gap: 8px;
    justify-content: center;
    color: var(--text-muted);
}
.result-footer a {
    color: var(--text-sub);
    text-decoration: none;
}
.result-footer a:hover {
    color: var(--accent);
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: var(--surface-2);
    color: var(--text);
    border-radius: 999px;
    font-size: 0.88rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: all 0.3s;
    z-index: 999;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── 响应式 ─── */
@media (max-width: 480px) {
    .start-title { font-size: 2rem; }
    .quiz-question { font-size: 1.15rem; }
    .option-btn { padding: 15px 18px; font-size: 0.95rem; }
    .result-mbti { font-size: 2.4rem; }
    .result-char-name { font-size: 1.5rem; }
    .result-actions { flex-direction: column; }
}
