/* ============================================================
   荣格八维认知功能测试 — style.css
   主色: Indigo #6366f1 | 辅色: Slate | 圆角卡片 + 柔和阴影
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-primary: #6366f1;
    --c-primary-light: #818cf8;
    --c-primary-dark: #4f46e5;
    --c-primary-bg: #eef2ff;
    --c-danger: #ef4444;
    --c-danger-light: #fef2f2;
    --c-warning: #f59e0b;
    --c-warning-bg: #fffbeb;
    --c-success: #10b981;
    --c-text: #1f2937;
    --c-text-secondary: #6b7280;
    --c-text-muted: #9ca3af;
    --c-border: #e5e7eb;
    --c-bg: #f8fafc;
    --c-card: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.1);
    --font: 'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans SC',system-ui,-apple-system,sans-serif;
    --transition: .2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 { line-height: 1.35; font-weight: 700; }
h1 { font-size: 1.75rem; margin-bottom: .5rem; }
h2 { font-size: 1.35rem; margin-bottom: .75rem; color: var(--c-text); }
h3 { font-size: 1.15rem; margin-bottom: .5rem; }
p { margin-bottom: .5rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: .35rem; }
a { color: var(--c-primary); text-decoration: none; }

.hidden { display: none !important; }

/* ---- Container ---- */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

/* ---- Logo ---- */
.logo { display: block; margin: 0 auto 20px; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.logo-sm { width: 48px; height: 48px; margin-bottom: 16px; }

/* ---- Screen ---- */
.screen { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: all var(--transition); line-height: 1.4;
    font-family: inherit; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-dark); }

.btn-secondary { background: var(--c-border); color: var(--c-text); }
.btn-secondary:hover:not(:disabled) { background: #d1d5db; }

.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-outline { background: transparent; border: 1.5px solid var(--c-border); color: var(--c-text-secondary); }
.btn-outline:hover { border-color: var(--c-primary-light); color: var(--c-primary); }

.btn-outline-danger { background: transparent; border: 1.5px solid #fca5a5; color: var(--c-danger); }
.btn-outline-danger:hover { background: var(--c-danger-light); }

.btn-ghost { background: transparent; color: var(--c-text-secondary); }
.btn-ghost:hover { color: var(--c-primary); }

.btn-lg { padding: 14px 32px; font-size: 1.05rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }

/* ============================================================
   Index — Version Select
   ============================================================ */
.subtitle { color: var(--c-text-secondary); font-size: .95rem; margin-bottom: 24px; text-align: center; }

.intro-text {
    background: var(--c-card); border-radius: var(--radius); padding: 20px;
    margin-bottom: 28px; box-shadow: var(--shadow-sm); font-size: .93rem;
    color: var(--c-text-secondary); line-height: 1.7;
}
.intro-text p { margin-bottom: .6rem; }
.intro-text ul { list-style: none; padding: 0; }
.intro-text li { padding: 4px 0; }
.note { font-size: .85rem; color: var(--c-text-muted); margin-top: 8px; }

.tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: .78rem; font-weight: 600; margin-right: 4px;
}
.tag-perception { background: #ede9fe; color: #7c3aed; }
.tag-judging { background: #dbeafe; color: #2563eb; }

.version-select { text-align: center; margin-bottom: 24px; }
.version-select h3 { font-weight: 600; color: var(--c-text-secondary); font-size: 1rem; margin-bottom: 16px; }

.version-cards { display: flex; gap: 14px; justify-content: center; }
.version-card {
    flex: 1; max-width: 200px; background: var(--c-card); border: 2px solid var(--c-border);
    border-radius: var(--radius-lg); padding: 24px 16px; cursor: pointer;
    transition: all var(--transition); text-align: center;
}
.version-card:hover { border-color: var(--c-primary-light); box-shadow: var(--shadow); }
.version-card.selected { border-color: var(--c-primary); background: var(--c-primary-bg); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.version-icon { font-size: 2rem; margin-bottom: 8px; }
.version-label { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.version-age { color: var(--c-primary); font-weight: 600; font-size: .9rem; }
.version-desc { color: var(--c-text-muted); font-size: .82rem; margin-top: 2px; }

.home-button-group { text-align: center; margin-top: 16px; }

/* ============================================================
   Consent
   ============================================================ */
.consent-box {
    background: var(--c-card); border-radius: var(--radius); padding: 20px 24px;
    margin-bottom: 24px; box-shadow: var(--shadow-sm); font-size: .93rem; line-height: 1.75;
}
.consent-box ol { padding-left: 1.4rem; }
.consent-box li { margin-bottom: .5rem; }
.consent-minor { font-size: .85rem; color: var(--c-warning); margin-top: 12px; font-weight: 600; }

.test-overview { margin-bottom: 24px; }
.test-overview h3 { font-size: 1rem; color: var(--c-text-secondary); margin-bottom: 12px; }
.module-preview { display: flex; flex-direction: column; gap: 10px; }
.module-preview-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--c-card); border-radius: var(--radius-sm); padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}
.module-num {
    width: 32px; height: 32px; border-radius: 50%; background: var(--c-primary-bg);
    color: var(--c-primary); font-weight: 700; font-size: .9rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.module-preview-title { font-weight: 600; font-size: .95rem; }
.module-preview-desc { font-size: .82rem; color: var(--c-text-muted); }

.consent-actions { text-align: center; }
.consent-checkbox {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 16px; font-size: .93rem; cursor: pointer;
}
.consent-checkbox input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: var(--c-primary); cursor: pointer;
}

/* ============================================================
   Test Page
   ============================================================ */
.test-page { padding-top: 0; }

/* Module Transition */
.transition-content { text-align: center; padding: 60px 20px; }
.transition-icon { font-size: 3rem; margin-bottom: 16px; }
.transition-module-label { margin-bottom: 8px; color: var(--c-text-secondary); font-size: .9rem; }
.transition-part { font-weight: 700; color: var(--c-primary); font-size: 1.1rem; }
.transition-of { color: var(--c-text-muted); }
.transition-intro { color: var(--c-text-secondary); font-size: .93rem; margin: 12px auto 16px; max-width: 420px; line-height: 1.7; }
.transition-meta { color: var(--c-text-muted); font-size: .88rem; margin-bottom: 28px; }
.transition-dot { margin: 0 6px; }

/* Test Header */
.test-header { position: sticky; top: 0; z-index: 10; background: var(--c-bg); padding: 12px 0 8px; }
.test-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.module-indicator { display: flex; align-items: center; gap: 8px; }
.module-badge {
    background: var(--c-primary-bg); color: var(--c-primary); padding: 3px 10px;
    border-radius: 20px; font-size: .8rem; font-weight: 600;
}
.module-progress-text { font-size: .82rem; color: var(--c-text-muted); }
.global-progress-text { font-size: .82rem; color: var(--c-text-muted); font-weight: 600; }

.progress-bar-container { padding: 0; }
.progress-bar-track { height: 4px; background: var(--c-border); border-radius: 2px; overflow: hidden; }
.progress-bar-fill {
    height: 100%; background: linear-gradient(90deg, var(--c-primary-light), var(--c-primary));
    border-radius: 2px; transition: width .4s ease;
}

/* Question Area */
.question-area { padding: 24px 0 16px; min-height: 280px; }
.question-block { animation: fadeIn .3s ease; }
.question-text { font-size: 1.1rem; font-weight: 600; line-height: 1.65; margin-bottom: 28px; text-align: center; }

/* Likert Scale */
.likert-scale { max-width: 420px; margin: 0 auto; }
.likert-labels { display: flex; justify-content: space-between; font-size: .78rem; color: var(--c-text-muted); margin-bottom: 10px; }
.likert-options { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.likert-btn {
    flex: 1; aspect-ratio: 1; max-width: 52px; border: 2px solid var(--c-border);
    border-radius: 50%; background: var(--c-card); font-size: .95rem; font-weight: 600;
    color: var(--c-text-secondary); cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.likert-btn:hover { border-color: var(--c-primary-light); color: var(--c-primary); }
.likert-btn.selected {
    background: var(--c-primary); border-color: var(--c-primary); color: #fff;
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.likert-numbers { display: flex; justify-content: space-between; font-size: .75rem; color: var(--c-text-muted); }
.likert-numbers span { flex: 1; max-width: 52px; text-align: center; }

/* Forced Choice */
.forced-prompt { color: var(--c-text-secondary); font-weight: 500; font-size: 1rem; }
.forced-options { display: flex; flex-direction: column; gap: 14px; }
.forced-option {
    display: flex; align-items: flex-start; gap: 14px;
    background: var(--c-card); border: 2px solid var(--c-border); border-radius: var(--radius);
    padding: 18px 20px; cursor: pointer; transition: all var(--transition); text-align: left;
    font-family: inherit; font-size: .95rem; line-height: 1.6; color: var(--c-text);
}
.forced-option:hover { border-color: var(--c-primary-light); }
.forced-option.selected { border-color: var(--c-primary); background: var(--c-primary-bg); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.forced-label {
    flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
    background: var(--c-border); color: var(--c-text-secondary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .82rem;
}
.forced-option.selected .forced-label { background: var(--c-primary); color: #fff; }
.forced-vs { text-align: center; font-size: .82rem; color: var(--c-text-muted); font-weight: 700; padding: 2px 0; }

/* Test Nav */
.test-nav { display: flex; gap: 12px; justify-content: space-between; padding: 16px 0; }
.test-nav .btn { flex: 1; }

/* Submit Screen */
.submit-content { text-align: center; padding: 48px 20px; }
.submit-icon { font-size: 3rem; margin-bottom: 16px; }
.submit-summary { color: var(--c-text-secondary); margin-bottom: 24px; }
.submit-warnings { background: var(--c-warning-bg); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 20px; text-align: left; }
.warning-text { color: #92400e; font-size: .9rem; }

/* Invalid Screen */
.invalid-content { text-align: center; padding: 48px 20px; }
.invalid-icon { font-size: 3rem; margin-bottom: 16px; }


/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
    background: var(--c-card); border-radius: var(--radius-lg); padding: 28px 24px;
    max-width: 380px; width: 100%; box-shadow: var(--shadow-lg); text-align: center;
}
.modal-box h3 { margin-bottom: 8px; }
.modal-box p { color: var(--c-text-secondary); font-size: .93rem; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-actions .btn { flex: 1; }

/* ============================================================
   Result Page
   ============================================================ */
.result-page h1 { text-align: center; margin-bottom: 8px; }

/* Validity Banner */
.validity-banner {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--c-warning-bg); border: 1px solid #fde68a; border-radius: var(--radius-sm);
    padding: 14px 18px; margin-bottom: 20px; font-size: .9rem; color: #92400e;
}
.validity-icon { font-size: 1.2rem; flex-shrink: 0; }

/* Confidence Badge */
.confidence-badge {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 24px; font-size: .88rem; font-weight: 600;
    margin: 0 auto 24px; width: fit-content;
}
.confidence-high { background: #ecfdf5; color: #065f46; }
.confidence-fairly-high { background: #ecfdf5; color: #065f46; }
.confidence-medium { background: #fefce8; color: #854d0e; }
.confidence-fairly-low { background: #fff7ed; color: #9a3412; }
.confidence-low { background: #ffeaea; color: #b91c1c; }

/* 置信度解释文案 */
.confidence-desc {
    text-align: center;
    font-size: .9rem;
    color: var(--c-text-secondary);
    line-height: 1.7;
    max-width: 480px;
    margin: -8px auto 24px;
    padding: 0 16px;
}

/* Result Section */
.result-section {
    background: var(--c-card); border-radius: var(--radius); padding: 24px 20px;
    margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.result-section h2 { font-size: 1.15rem; }
.section-desc { font-size: .88rem; color: var(--c-text-muted); margin-bottom: 16px; }

/* Radar */
.radar-wrapper {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 8px 0;
    /* 用 aspect-ratio 保证正方形，避免高度塌陷 */
    aspect-ratio: 1 / 1;
    position: relative;
}

/* 雷达图加载中 */
.radar-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.5);
    z-index: 10;
}
.radar-loading-spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(99,102,241,0.2);
    border-top-color: rgba(99,102,241,0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}
.radar-loading span {
    font-size: .85rem; color: #6b7280;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
    .radar-wrapper {
        max-width: 100%;
        padding: 4px 0;
    }
}

/* Score Ranking */
.score-ranking { display: flex; flex-direction: column; gap: 12px; }
.rank-row { display: flex; align-items: flex-start; gap: 12px; }
.rank-position {
    width: 28px; height: 28px; border-radius: 50%; background: var(--c-primary-bg);
    color: var(--c-primary); font-weight: 700; font-size: .82rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.rank-info { flex: 1; min-width: 0; }
.rank-header { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.rank-func { font-weight: 700; font-size: 1rem; }
.rank-name { font-size: .82rem; color: var(--c-text-muted); }
.rank-score { margin-left: auto; font-weight: 700; font-size: .95rem; }
.rank-max { font-weight: 400; font-size: .78rem; color: var(--c-text-muted); }
.rank-bar-track { height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.rank-bar-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }
.rank-auto { font-size: .78rem; color: var(--c-text-muted); margin-top: 4px; letter-spacing: 1px; }

/* Automation */
.automation-chart { display: flex; flex-direction: column; gap: 10px; }
.auto-item { display: grid; grid-template-columns: 32px 1fr 40px auto; align-items: center; gap: 10px; }
.auto-func { font-weight: 700; font-size: .9rem; color: var(--c-text); }
.auto-bar-track { height: 8px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.auto-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.auto-bar-fill.auto-high { background: var(--c-success); }
.auto-bar-fill.auto-mid { background: var(--c-primary-light); }
.auto-bar-fill.auto-low { background: #d1d5db; }
.auto-score { font-size: .82rem; color: var(--c-text-muted); text-align: right; }
.auto-level { font-size: .78rem; font-weight: 600; min-width: 60px; }
.auto-level.auto-high { color: var(--c-success); }
.auto-level.auto-mid { color: var(--c-primary); }
.auto-level.auto-low { color: var(--c-text-muted); }

/* Strength Analysis */
.strength-analysis { display: flex; flex-direction: column; gap: 16px; }
.strength-card { border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 18px; }
.strength-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.strength-role {
    font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
    background: var(--c-primary-bg); color: var(--c-primary);
}
.strength-func { font-weight: 700; font-size: 1.1rem; }
.strength-func-name { font-size: .88rem; color: var(--c-text-muted); }
.strength-desc { font-size: .93rem; color: var(--c-text-secondary); line-height: 1.7; margin-bottom: 12px; }
.strength-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.strength-detail h4 { font-size: .85rem; color: var(--c-text-secondary); margin-bottom: 6px; }
.strength-detail ul { font-size: .85rem; color: var(--c-text-secondary); line-height: 1.65; padding-left: 1.1rem; }
.strength-detail li { margin-bottom: .3rem; }

/* Stress Analysis */
.stress-analysis { }
.stress-mild { color: var(--c-text-secondary); font-size: .93rem; text-align: center; padding: 12px 0; }
.stress-card { border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 18px; }
.stress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stress-badge {
    font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 4px;
    background: #fef3c7; color: #92400e;
}
.stress-intensity { font-size: .82rem; color: var(--c-text-muted); font-weight: 600; }
.stress-behavior { font-size: .95rem; line-height: 1.7; margin-bottom: 14px; color: var(--c-text); }
.stress-tip {
    display: flex; align-items: flex-start; gap: 10px;
    background: #f0fdf4; border-radius: var(--radius-sm); padding: 14px 16px;
}
.stress-tip-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1.5; }
.stress-tip p { font-size: .9rem; color: #166534; line-height: 1.6; margin: 0; }
.stress-care-note {
    margin-top: 14px; padding: 14px 16px; background: var(--c-primary-bg);
    border-radius: var(--radius-sm); font-size: .88rem; color: #3730a3; line-height: 1.65;
}
.stress-care-note p { margin: 0; }

/* Function Hierarchy */
.function-hierarchy { display: flex; flex-direction: column; align-items: center; }
.hier-item {
    display: flex; align-items: flex-start; gap: 14px; width: 100%;
    padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--c-border);
}
.hier-dominant { border-left: 4px solid var(--c-primary); background: var(--c-primary-bg); }
.hier-auxiliary { border-left: 4px solid var(--c-primary-light); }
.hier-tertiary { border-left: 4px solid #d1d5db; }
.hier-inferior { border-left: 4px solid #fca5a5; background: #fef2f2; }
.hier-num {
    width: 28px; height: 28px; border-radius: 50%; background: var(--c-card);
    border: 2px solid var(--c-border); font-weight: 700; font-size: .82rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    color: var(--c-text-secondary);
}
.hier-dominant .hier-num { border-color: var(--c-primary); color: var(--c-primary); background: #fff; }
.hier-body { flex: 1; }
.hier-role { font-size: .78rem; font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .5px; }
.hier-func { font-weight: 700; font-size: 1rem; margin: 2px 0; }
.hier-desc { font-size: .85rem; color: var(--c-text-secondary); }
.hier-connector { text-align: center; padding: 4px 0; color: var(--c-text-muted); font-size: .9rem; }

/* MBTI Section */
.mbti-section { text-align: center; }
.mbti-divider { height: 1px; background: var(--c-border); margin-bottom: 20px; }
.mbti-note { font-size: .9rem; color: var(--c-text-secondary); margin-bottom: 12px; }
.mbti-code {
    font-size: 2.5rem; font-weight: 800; letter-spacing: 6px;
    color: var(--c-primary); margin-bottom: 8px;
}
.mbti-disclaimer { font-size: .82rem; color: var(--c-text-muted); font-style: italic; }

/* Result Footer */
.result-footer {
    background: #f9fafb; border-radius: var(--radius-sm); padding: 18px 20px;
    margin: 8px 0 20px; font-size: .88rem; color: var(--c-text-secondary); line-height: 1.7;
}
.result-footer p { margin: 0; }

/* Action Buttons */
.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.action-buttons .btn { flex: 1; min-width: 120px; }

.no-data { text-align: center; color: var(--c-text-muted); font-size: .9rem; padding: 12px 0; }
/* ============================================================
   History Page
   ============================================================ */
.history-page h1 { text-align: center; margin-bottom: 20px; }

.history-controls {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.history-controls-right { display: flex; align-items: center; gap: 12px; }
.record-count { font-size: .88rem; color: var(--c-text-muted); }

/* History Card */
.history-list { display: flex; flex-direction: column; gap: 14px; }
.history-card {
    background: var(--c-card); border-radius: var(--radius); padding: 18px 20px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--c-border);
    transition: box-shadow var(--transition);
}
.history-card:hover { box-shadow: var(--shadow); }

.history-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.history-type-badge {
    display: inline-block; padding: 4px 12px; border-radius: 6px;
    color: #fff; font-weight: 700; font-size: .88rem; letter-spacing: 1.5px;
}
.history-type-none, .history-type-unknown { background: #9ca3af; }

.history-meta-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-conf {
    font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
}
.conf-high, .badge-high { background: #ecfdf5; color: #065f46; }
.conf-fairly-high, .badge-fairly-high { background: #ecfdf5; color: #065f46; }
.conf-medium, .badge-medium { background: #fefce8; color: #854d0e; }
.conf-fairly-low, .badge-fairly-low { background: #fff7ed; color: #9a3412; }
.conf-low, .badge-low { background: #ffeaea; color: #b91c1c; }
.history-version { font-size: .78rem; color: var(--c-text-muted); background: #f3f4f6; padding: 2px 8px; border-radius: 4px; }
.history-time { font-size: .78rem; color: var(--c-text-muted); }

.history-card-body { margin-bottom: 12px; }
.history-hierarchy { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.history-func-tag {
    display: inline-block; padding: 3px 10px; border-radius: 4px;
    font-size: .82rem; font-weight: 600;
}
.history-func-dom { background: var(--c-primary-bg); color: var(--c-primary); }
.history-func-aux { background: #ede9fe; color: #7c3aed; }
.history-func-ter { background: #f3f4f6; color: var(--c-text-secondary); }
.history-func-inf { background: #fef2f2; color: #dc2626; }
.history-func-arrow { color: var(--c-text-muted); font-size: .78rem; }

.history-top-funcs { margin-bottom: 8px; }
.history-func-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.history-func-name { font-weight: 600; font-size: .82rem; width: 24px; flex-shrink: 0; }
.history-func-bar-track { flex: 1; height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.history-func-bar-fill { height: 100%; background: var(--c-primary-light); border-radius: 3px; transition: width .5s ease; }
.history-func-score { font-size: .78rem; color: var(--c-text-muted); width: 24px; text-align: right; }

.history-duration { font-size: .82rem; color: var(--c-text-muted); }
.history-meta { display: flex; align-items: center; gap: 12px; font-size: .82rem; color: var(--c-text-muted); }
.history-validity-warn, .history-validity-flag { color: #b45309; font-size: .82rem; }
.history-top-functions { font-size: .85rem; color: var(--c-text-secondary); margin-bottom: 6px; }

.history-card-actions { display: flex; gap: 10px; }
.history-card-actions .btn { flex: 1; }

.history-card-left { display: flex; align-items: center; gap: 8px; }
.history-card-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-confidence { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; }

/* Empty State */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon { margin-bottom: 16px; opacity: .5; }
.empty-state h3 { color: var(--c-text-secondary); margin-bottom: 8px; }
.empty-state p { color: var(--c-text-muted); font-size: .93rem; }

/* ============================================================
   Join Channel Button (Fixed)
   ============================================================ */
.join-channel-btn {
    position: fixed; bottom: 20px; right: 20px; z-index: 50;
    background: var(--c-primary); color: #fff; padding: 10px 18px;
    border-radius: 24px; font-size: .88rem; font-weight: 600;
    box-shadow: var(--shadow-lg); transition: all var(--transition);
    text-decoration: none;
}
.join-channel-btn:hover { background: var(--c-primary-dark); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(99,102,241,.25); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px) {
    .container { padding: 16px 14px 72px; }
    h1 { font-size: 1.45rem; }
    .version-cards { flex-direction: column; align-items: center; }
    .version-card { max-width: 100%; }
    .strength-detail { grid-template-columns: 1fr; }
    .auto-item { grid-template-columns: 28px 1fr 36px auto; gap: 6px; }
    .likert-btn { max-width: 44px; }
    .mbti-code { font-size: 2rem; letter-spacing: 4px; }
    .join-channel-btn { bottom: 12px; right: 12px; padding: 8px 14px; font-size: .82rem; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
    body { background: #fff; }
    .container { max-width: 100%; padding: 0; }
    .join-channel-btn, .action-buttons, .test-nav, .test-header { display: none !important; }
    .result-section { box-shadow: none; border: 1px solid #e5e7eb; break-inside: avoid; }
    .confidence-badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ============================================================
Primary Type Card (新 — 置于雷达图之前)
============================================================ */
.primary-type-section { text-align: center; }
.primary-type-card { padding: 8px 0; }
.primary-type-label { font-size: .9rem; color: var(--c-text-secondary); margin-bottom: 8px; }
.primary-type-code {
font-size: 3rem; font-weight: 800; letter-spacing: 8px;
background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
background-clip: text; margin-bottom: 8px;
}
.primary-type-desc {
font-size: .93rem; color: var(--c-text-secondary); line-height: 1.6;
max-width: 420px; margin: 0 auto 14px;
}
.primary-type-probability {
display: flex; align-items: baseline; justify-content: center; gap: 6px;
margin-bottom: 12px;
}
.probability-value { font-size: 1.5rem; font-weight: 800; color: var(--c-primary); }
.probability-label { font-size: .82rem; color: var(--c-text-muted); }
.primary-type-disclaimer { font-size: .82rem; color: var(--c-text-muted); font-style: italic; }

/* ============================================================
Other Types Probability List (新 — 替代原 mbti-section)
============================================================ */
.type-probability-list { display: flex; flex-direction: column; gap: 6px; }
.type-prob-item{
display: grid; grid-template-columns: 28px 56px 1fr 48px;
align-items: center; gap: 10px; padding: 7px 0;
border-bottom: 1px solid #f3f4f6;
}
.type-prob-item:last-child { border-bottom: none; }
.type-prob-primary {
background: var(--c-primary-bg); border-radius: var(--radius-sm);
padding: 10px 12px; border-bottom: none; margin: -2px -4px;
}
.type-prob-rank {
font-size: .78rem; font-weight: 700; color: var(--c-text-muted); text-align: center;
}
.type-prob-primary .type-prob-rank { color: var(--c-primary); }
.type-prob-badge {
padding: 3px 0; border-radius: 4px; color: #fff;
font-weight: 700; font-size: .8rem; text-align: center; letter-spacing: 1px;
}
.type-prob-bar-track {
height: 8px; background: #f3f4f6; border-radius: 4px; overflow: hidden;
}
.type-prob-primary .type-prob-bar-track { background: rgba(99,102,241,.12); }
.type-prob-bar-fill {
height: 100%; border-radius: 4px; transition: width .6s ease;
min-width: 2px;
}
.type-prob-pct {
font-size: .85rem; font-weight: 700; color: var(--c-text); text-align: right;
}
.type-prob-primary .type-prob-pct { color: var(--c-primary); }

/* 概率列表折叠：默认显示前5名，点击展开全部 */
.type-prob-item:nth-child(n+6) { display: none; }
.type-probability-list.expanded .type-prob-item:nth-child(n+6) { display: grid; }

@media (max-width: 480px) {
.primary-type-code { font-size: 2.2rem; letter-spacing: 5px; }
.type-prob-item { grid-template-columns: 24px 48px 1fr 42px; gap: 6px; }
.type-prob-badge { font-size: .75rem; }
}/* Toggle Button for type list */
.type-prob-toggle {
display: flex; align-items: center; justify-content: center;
margin-top: 10px; padding: 8px 0; cursor: pointer;
font-size: .85rem; color: var(--c-text-muted); font-weight: 600;
background: none; border: 1px dashed var(--c-border); border-radius: var(--radius-sm);
width: 100%; transition: all var(--transition); font-family: inherit;
}
.type-prob-toggle:hover { color: var(--c-primary); border-color: var(--c-primary-light); }

/* ============================================================
   Draft Cards — 未完成测试记录
   ============================================================ */
.draft-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .95rem;
    font-weight: 700;
    color: var(--c-warning);
    margin-bottom: 10px;
    padding: 0 2px;
}
.draft-section-icon { font-size: 1.1rem; }

.draft-card {
    border: 1.5px dashed var(--c-warning);
    background: var(--c-warning-bg);
}
.draft-card:hover {
    border-color: #d97706;
}

.draft-badge {
    background: var(--c-warning) !important;
    color: #fff !important;
    font-size: .82rem !important;
    letter-spacing: .5px !important;
}

.draft-progress-info {
    font-size: .88rem;
    color: var(--c-text-secondary);
    margin-bottom: 8px;
}

.draft-progress-track {
    height: 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.draft-progress-fill {
    height: 100%;
    background: var(--c-warning);
    border-radius: 3px;
    transition: width .5s ease;
}

.draft-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
    font-size: .85rem;
    color: var(--c-text-muted);
}
.draft-divider::before,
.draft-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--c-border);
}

/*============================================================"不确定/不知道" 按钮
   ============================================================ */
.likert-dk-wrapper {
    text-align: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--c-border);
}

.likert-dk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border: 1.5px solid var(--c-border);
    border-radius: 20px;
    background: transparent;
    color: var(--c-text-muted);
    font-size: .85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: .5px;
}

.likert-dk-btn:hover {
    border-color: var(--c-text-secondary);
    color: var(--c-text-secondary);
    background: #f9fafb;
}

.likert-dk-btn.selected {
    border-color: var(--c-warning);
    background: var(--c-warning-bg);
    color: #92400e;
    font-weight: 600;
}

/*移动端适配 */
@media (max-width: 480px) {
    .likert-dk-btn {
        padding: 7px 16px;
        font-size: .82rem;
    }
}

/* DK 标注（结果页） */
.rank-dk-tag,
.composite-dk-tag {
    font-size: .72rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: #fefce8;
    color: #854d0e;
    margin-left: 4px;
    white-space: nowrap;
}

.rank-dk-warn {
    background: #fff7ed;
    color: #9a3412;
}

