/* ============================================================
   MindAI Quiz — 逐题问卷
   ============================================================ */

:root {
    --bg: #0b0b0f;
    --bg-card: #16161c;
    --bg-hover: #1e1e28;
    --border: #2a2a38;
    --text: #e8e8ef;
    --text-dim: #8888a0;
    --text-muted: #5a5a70;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --radius: 14px;
    --radius-sm: 10px;
    --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

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

/* ---- 加载 ---- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-size: 18px;
    color: var(--text-dim);
}

/* ---- 外壳 ---- */
.quiz-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- 进度条 ---- */
.progress-strip {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

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

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

.progress-strip .count {
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    min-width: 56px;
    text-align: right;
}

/* ---- 题目卡片 ---- */
.q-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
    padding: 80px 24px 48px;
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.q-prompt {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
    text-align: center;
    letter-spacing: 0.5px;
}

.q-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.q-option {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 22px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.q-option:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.q-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.q-radio {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.q-option.selected .q-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

.q-text {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
}

/* ---- 结果页 ---- */
.result-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 48px 24px 64px;
    animation: fadeIn 0.5s ease;
}

.result-type-big {
    text-align: center;
    font-size: 72px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a855f7, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.result-name {
    text-align: center;
    font-size: 20px;
    color: var(--text-dim);
    margin-bottom: 32px;
}

.result-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.result-section h3 {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 16px;
}

.stack-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stack-tag {
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
}

.stack-tag:first-child {
    background: var(--accent);
    color: #fff;
}

.score-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-label {
    width: 24px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    text-align: right;
}

.score-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.score-val {
    width: 44px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

.confidence-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 24px;
}

.restart-btn {
    display: block;
    margin: 32px auto 0;
    padding: 14px 48px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.restart-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* ---- 分析区 ---- */
.analysis-section {
    margin-top: 8px;
}

.analysis-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 14px;
    padding: 8px 0;
}

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

.loading-spinner.small {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

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

.analysis-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
}

.analysis-text h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    margin: 24px 0 10px;
}

.analysis-text h3:first-child {
    margin-top: 0;
}

.analysis-text h4 {
    font-size: 15px;
    font-weight: 600;
    color: #a78bfa;
    margin: 20px 0 8px;
}

.analysis-text p {
    margin: 8px 0;
}

.analysis-text ul {
    padding-left: 20px;
    margin: 8px 0;
}

.analysis-text li {
    margin: 6px 0;
    color: var(--text);
}

.analysis-text strong {
    color: #fff;
    font-weight: 600;
}

.analysis-error {
    color: #ef4444;
    font-size: 14px;
    padding: 8px 0;
}

/* ---- 响应式 ---- */
@media (max-width: 640px) {
    .q-card {
        padding: 72px 16px 32px;
    }

    .q-option {
        padding: 16px 16px;
        gap: 12px;
    }

    .q-text {
        font-size: 15px;
    }

    .result-type-big {
        font-size: 52px;
    }

    .result-page {
        padding: 40px 16px 48px;
    }
}