/* ===== 基础 ===== */
.hidden { display: none !important; }
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    /* 全局主题色，由 JS 根据果树类型动态设置 */
    --accent: #4F46E5;
    --accent-end: #7C3AED;
    --accent-gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-end) 100%);
    --accent-light: #EEF2FF;
    --accent-lighter: #F5F3FF;
    --accent-rgba: rgba(79,70,229,0.25);
    --card-bg: linear-gradient(180deg, #ffffff 0%, #F0F4FF 100%);
    --card-bg-solid: #FAFBFF;
    --correct: #10B981;
    --correct-light: #D1FAE5;
    --wrong: #EF4444;
    --wrong-light: #FEE2E2;
    --gold: #F59E0B;
    --gold-light: #FEF3C7;
    --text-main: #1E293B;
    --text-sub: #64748B;
    --bg-page: #F0F4FF;
    --border: #E2E8F0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(180deg, #F0F4FF 0%, #E8ECF8 100%);
    color: var(--text-main);
    min-height: 100vh;
}

/* ===== 导航栏 ===== */
.navbar {
    background: var(--accent-gradient);
    color: white;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.nav-brand { font-size: 20px; font-weight: 700; }
.nav-brand-inner { display: flex; align-items: center; gap: 14px; }
.nav-brand-logo {
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, #FDE68A 0%, #F59E0B 50%, #FDE68A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    text-shadow: 0 0 20px rgba(253, 230, 138, 0.3);
}
.nav-brand-logo-side {
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, #FDE68A 0%, #F59E0B 50%, #FDE68A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}
.nav-brand-slogans {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}
.nav-slogan-line {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
}
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-link { color: white; text-decoration: none; font-size: 14px; opacity: 0.9; }
.nav-link:hover { opacity: 1; }
.nav-score { font-size: 14px; }
.bgm-toggle { background: none; border: 1px solid rgba(255,255,255,0.4); border-radius: 8px; padding: 4px 12px; cursor: pointer; color: white; font-size: 14px; transition: all 0.3s; }
.bgm-toggle:hover { background: rgba(255,255,255,0.15); }
.bgm-toggle.active { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.7); box-shadow: 0 0 8px rgba(255,255,255,0.3); }

/* ===== 三科目标签 ===== */
.subject-tabs {
    display: flex;
    gap: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(79,70,229,0.06);
    max-width: 400px;
}
.subject-tabs-right {
    max-width: none;
    margin-bottom: 14px;
    margin-top: 2px;
}
.subject-tab {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.3s;
}
.subject-tabs-right .subject-tab {
    padding: 8px 10px;
    font-size: 14px;
    border-radius: 8px;
}
.subject-tab:hover { color: var(--text-sub); background: #F1F5F9; }
.subject-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px var(--accent-rgba);
}
/* 科目专属颜色 */
.subject-tab[data-subject="chinese"].active { background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%); }
.subject-tab[data-subject="math"].active { background: var(--accent-gradient); }
.subject-tab[data-subject="english"].active { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }

/* ===== 选择器面板 ===== */
.selector-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 50%, #DDD6FE 100%);
    position: relative;
    z-index: 10;
}
.selector-card {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 24px;
    padding: 40px 36px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 24px 80px rgba(79,70,229,0.1);
}
.selector-card h2 { font-size: 24px; margin-bottom: 6px; text-align: center; }
.selector-subtitle { text-align: center; color: var(--text-sub); font-size: 14px; margin-bottom: 28px; }
.selector-steps { display: flex; flex-direction: column; gap: 18px; }
.selector-step label { font-size: 14px; font-weight: 600; color: var(--text-main); margin-bottom: 8px; display: block; }
.selector-options { display: flex; flex-wrap: wrap; gap: 8px; }
.sel-btn {
    padding: 10px 18px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.sel-btn:hover { border-color: var(--accent); color: var(--accent); }
.sel-btn.selected { background: var(--accent-gradient); color: white; border-color: transparent; }
.selector-actions { display: flex; gap: 12px; margin-top: 24px; }
.btn-primary {
    flex: 1; padding: 14px;
    background: var(--accent-gradient);
    color: white; border: none; border-radius: 12px;
    font-size: 16px; font-weight: 600; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px var(--accent-rgba); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
    padding: 14px 20px;
    background: #F1F5F9; color: var(--text-main); border: none;
    border-radius: 12px; font-size: 15px; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
}
.btn-secondary:hover { background: #E2E8F0; }
.selector-summary { margin-top: 16px; padding: 12px; background: rgba(238,242,255,0.6); border-radius: 10px; font-size: 14px; text-align: center; color: var(--text-sub); min-height: 40px; }

/* ===== 主容器 ===== */
.main-container { display: flex; gap: 24px; padding: 20px 24px; max-width: 1200px; margin: 0 auto; }

/* ===== 左侧：智慧树 ===== */
.tree-panel { flex: 1; min-width: 0; min-height: 70vh; }
.tree-canvas-container { height: calc(100% - 60px); min-height: 600px; }
#mindmap-tree { width: 100%; height: 100%; display: block; }
.tree-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.tree-title-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tree-title-group h2 { font-size: 20px; color: var(--text-main); }
.btn-small { padding: 6px 14px; font-size: 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-bg); cursor: pointer; font-family: inherit; }
.btn-small:hover { background: #F1F5F9; }
.tree-selector { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tree-selector select { padding: 6px 12px; border-radius: 8px; border: 1px solid #ddd; font-family: inherit; }
.tree-canvas-container { background: rgba(255,255,255,0.7); border-radius: 16px; box-shadow: 0 4px 20px rgba(79,70,229,0.06); padding: 16px; backdrop-filter: blur(4px); }

/* 果实交互 */
.fruit-group { cursor: pointer; }
.fruit-group:hover > .fruit-shape { stroke-width: 3; }
.fruit-group text { pointer-events: none; }
.fruit-glow { animation: pulseGlow 2s ease infinite; }
@keyframes pulseGlow {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.3; }
}
.fruit-text { font-size: 14px; font-weight: 700; text-anchor: middle; font-family: inherit; text-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.fruit-label { font-size: 11px; text-anchor: middle; fill: var(--text-sub); font-family: inherit; }
.fruit-shape { transition: fill 0.3s, stroke 0.3s, stroke-width 0.2s; }

/* 期中/期末特殊样式 */
.fruit-group[data-type="midterm"] .fruit-shape { stroke: var(--wrong) !important; stroke-width: 3px; }
.fruit-group[data-type="final"] .fruit-shape { stroke: var(--accent-end) !important; stroke-width: 3px; }

/* ===== 图例 ===== */
/* ===== 右侧：信息面板 ===== */
.info-panel { width: 320px; min-width: 320px; }
.unit-detail { background: rgba(255,255,255,0.85); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.5); border-radius: 16px; padding: 24px; box-shadow: 0 4px 20px rgba(79,70,229,0.06); display: none !important; }
.unit-detail.hidden { display: none; }
.unit-detail h3 { font-size: 18px; margin-bottom: 16px; color: var(--text-main); }
.levels-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.level-card {
    padding: 16px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(4px);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.level-card:hover:not(.locked) { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(79,70,229,0.1); }
.level-card.locked { opacity: 0.5; cursor: not-allowed; }
.level-badge { font-size: 28px; margin-bottom: 6px; }
.level-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.level-status { font-size: 13px; color: var(--text-sub); margin-bottom: 4px; }
.level-desc { font-size: 12px; color: #94A3B8; }

.unit-placeholder {
    background: rgba(255,255,255,0.85); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 16px; padding: 40px 24px;
    text-align: center; box-shadow: 0 4px 20px rgba(79,70,229,0.06);
    color: var(--text-sub);
}
.unit-placeholder.guide-visible {
    padding: 20px 16px; text-align: left; color: var(--text-main);
}
.unit-placeholder .placeholder-icon { font-size: 48px; margin-bottom: 12px; }
.unit-placeholder p { font-size: 15px; margin-bottom: 6px; }
.placeholder-sub { font-size: 13px; color: #94A3B8; }

.guide-inline { margin-top: 8px; }
.guide-inline-item { margin-bottom: 12px; }
.guide-inline-item:last-child { margin-bottom: 0; }
.guide-inline-title {
    display: block; font-size: 13px; font-weight: 700; color: var(--accent);
    margin-bottom: 2px;
}
.guide-inline-item p {
    font-size: 12px; color: var(--text-sub); line-height: 1.6; margin: 0;
}

/* ===== 内嵌排行榜 ===== */
.lb-inline-subject-tabs {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 4px; margin-bottom: 8px;
}
.lb-inline-tab {
    padding: 6px 4px; border: 1px solid var(--border); background: var(--card-bg);
    border-radius: 6px; font-size: 11px; font-weight: 600;
    color: var(--text-sub); cursor: pointer; transition: all 0.2s;
}
.lb-inline-tab:hover { border-color: var(--accent); color: var(--accent); }
.lb-inline-tab.active {
    background: var(--accent); color: white; border-color: var(--accent);
}
.lb-inline-list { max-height: 420px; overflow-y: auto; background: rgba(255,255,255,0.6); border-radius: 10px; padding: 8px 4px; }
.lb-inline-header {
    display: flex; align-items: center; gap: 4px; padding: 4px 0;
    border-bottom: 2px solid var(--accent); margin-bottom: 2px;
}
.lb-inline-header .lb-inline-rank { width: 18px; flex-shrink: 0; text-align: center; font-size: 10px; font-weight: 700; color: var(--text-sub); }
.lb-inline-header .lb-inline-name { flex: 1; font-size: 11px; font-weight: 600; color: var(--text-main); }
.lb-inline-header .lb-inline-stat { width: 32px; text-align: center; font-size: 10px; font-weight: 700; }
.lb-inline-item {
    display: flex; align-items: center; gap: 4px; padding: 5px 0;
    border-bottom: 1px solid var(--border); font-size: 12px;
}
.lb-inline-item:last-child { border-bottom: none; }
.lb-inline-rank-num { width: 18px; flex-shrink: 0; text-align: center; font-size: 10px; font-weight: 700; }
.lb-inline-rank-num.gold { color: #FBBF24; }
.lb-inline-rank-num.silver { color: #94A3B8; }
.lb-inline-rank-num.bronze { color: #D97706; }
.lb-inline-name { flex: 1; font-size: 12px; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-inline-stat { width: 32px; text-align: center; font-size: 11px; font-weight: 600; }
.lb-inline-effort { color: var(--accent); }
.lb-inline-score { color: var(--correct); }
.lb-inline-stars { color: var(--gold); }
.lb-star-title {
    color: var(--gold); font-weight: 700;
    text-shadow: 0 0 4px rgba(245,158,11,0.4);
    margin-left: 3px; font-size: 11px;
}

.quick-links { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.quick-btn {
    background: rgba(255,255,255,0.7); backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 12px; padding: 14px 8px;
    text-align: center; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.quick-btn:hover { border-color: var(--accent); background: var(--accent-lighter); }
.quick-btn.disabled-quick { opacity: 0.5; cursor: not-allowed; }
.quick-btn.disabled-quick:hover { border-color: var(--border); background: rgba(255,255,255,0.5); }
.quick-icon { font-size: 22px; display: block; margin-bottom: 4px; }
.quick-btn span:last-child { font-size: 12px; color: var(--text-sub); }

/* ===== 加载动画 ===== */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.loading-overlay.hidden { display: none; }
.loading-box {
    text-align: center;
    padding: 40px;
}
.loading-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    animation: loadingPulse 1.5s ease-in-out infinite;
}
@keyframes loadingPulse {
    0%, 100% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.6; transform: translateY(-2px); }
}
.loading-sub {
    font-size: 14px;
    color: var(--text-sub);
    max-width: 400px;
    margin: 0 auto;
    animation: marqueeScroll 8s linear infinite;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
@keyframes marqueeScroll {
    0% { transform: translateX(100%); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateX(-100%); opacity: 0; }
}

/* ===== 弹窗 ===== */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,0.5); }
.modal-content {
    position: relative; background: var(--card-bg);
    border-radius: 20px; width: 98%; max-width: none;
    max-height: 95vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
}
/* 弹窗内固定新主题色 + 磨砂玻璃背景（不随果树变色） */
.modal-content, .result-content, .mistake-content, .combo-content, .leaderboard-content, .mistake-quiz-content {
    --accent: #4F46E5;
    --accent-end: #7C3AED;
    --accent-gradient: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --accent-light: #EEF2FF;
    --accent-lighter: #F5F3FF;
    --accent-rgba: rgba(79,70,229,0.25);
    --card-bg: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(238,242,255,0.9) 100%);
    --card-bg-solid: rgba(255,255,255,0.95);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #eee; }
.modal-header h3 { font-size: 18px; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-sub); }
.close-btn:hover { color: var(--text-main); }
.btn-accent { background: var(--accent-gradient); color: #fff; border: none; padding: 6px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-rgba); }

/* ===== 闯关确认弹窗 ===== */
.confirm-quiz-content {
    max-width: 340px !important;
    text-align: center;
    padding: 24px 24px 20px;
}
.confirm-quiz-body { margin-bottom: 20px; }
.confirm-quiz-content h3 {
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 12px;
}
.confirm-quiz-content p {
    font-size: 15px;
    color: var(--text-sub);
    line-height: 1.6;
}
.confirm-quiz-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== 答题弹窗 ===== */
.quiz-content { padding: 0; }
.quiz-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px; border-bottom: 1px solid var(--border); position: relative; }
.quiz-header h3 { font-size: 18px; }
.quiz-progress { display: flex; align-items: center; gap: 12px; padding: 12px 24px; }
.quiz-progress .progress-bar { flex: 1; height: 6px; background: #E2E8F0; border-radius: 3px; overflow: hidden; }
.quiz-progress .progress-fill { height: 100%; background: var(--accent-gradient); border-radius: 3px; transition: width 0.3s; }
.quiz-progress span { font-size: 13px; color: var(--text-sub); min-width: 50px; text-align: right; }
.quiz-body { padding: 24px 32px; }
.question-text { font-size: 22px; line-height: 1.8; margin-bottom: 28px; font-weight: 500; }
.options-grid { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px; border: 2px solid var(--border);
    border-radius: 12px; background: var(--card-bg);
    cursor: pointer; transition: all 0.2s;
    text-align: left; font-family: inherit; font-size: 17px;
}
.option-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-lighter); }
.option-btn.selected { border-color: var(--accent); background: var(--accent-light); }
.option-btn.correct { border-color: var(--correct); background: var(--correct-light); }
.option-btn.wrong { border-color: var(--wrong); background: var(--wrong-light); }
.option-btn:disabled { cursor: default; }
.option-label { width: 40px; height: 40px; min-width: 40px; border-radius: 50%; background: #F1F5F9; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.btn-delete-mistake { background: none; border: none; color: #ccc; font-size: 16px; cursor: pointer; padding: 2px 6px; margin-left: auto; }
.btn-delete-mistake:hover { color: var(--wrong); }
.option-btn.selected .option-label { background: var(--accent); color: white; }
.option-btn.correct .option-label { background: var(--correct); color: white; }
.option-btn.wrong .option-label { background: var(--wrong); color: white; }
.option-text { flex: 1; }
.opt-word {
    cursor: pointer;
    border-bottom: 1px dashed #90caf9;
    padding: 0 1px;
    transition: background 0.15s;
}
.opt-word:hover { background: #e3f2fd; border-radius: 2px; }

.feedback-area { margin-top: 16px; padding: 16px; border-radius: 12px; animation: fadeIn 0.3s ease; }
.feedback-area.correct { background: var(--correct-light); }
.feedback-area.wrong { background: var(--wrong-light); }
.feedback-area.hidden { display: none; }
.feedback-icon { font-size: 32px; margin-bottom: 8px; }
.feedback-text { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feedback-area.correct .feedback-text { color: var(--correct); }
.feedback-area.wrong .feedback-text { color: var(--wrong); }
.feedback-analysis { margin-top: 12px; font-size: 14px; color: var(--text-sub); line-height: 1.6; }
.feedback-analysis .analysis-brief { border-radius: 10px; overflow: hidden; border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }

.quiz-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.btn-primary {
    padding: 12px 32px; font-size: 16px; font-weight: 600;
    background: var(--accent-gradient);
    color: white; border: none; border-radius: 12px;
    cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 12px var(--accent-rgba);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px var(--accent-rgba); }
.btn-primary.hidden { display: none; }

/* ===== 题号导航 ===== */
.question-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.q-nav-btn {
    width: 36px; height: 36px; border-radius: 8px;
    border: 2px solid var(--border); background: var(--card-bg-solid); cursor: pointer;
    font-size: 14px; font-weight: 600; color: var(--text-sub);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.q-nav-btn:hover:not(.current) { border-color: var(--accent); color: var(--accent); }
.q-nav-btn.current { border-color: var(--accent); background: var(--accent); color: #fff; }
.q-nav-btn.answered { border-color: #B0B8C4; background: #F1F5F9; color: var(--text-sub); }
.q-nav-btn.current.answered { border-color: var(--accent); background: var(--accent); color: #fff; }
.q-nav-btn.nav-correct { border-color: var(--correct); background: var(--correct-light); color: var(--correct); }
.q-nav-btn.current.nav-correct { border-color: var(--correct); background: var(--correct); color: #fff; }
.q-nav-btn.nav-wrong { border-color: var(--wrong); background: var(--wrong-light); color: var(--wrong); }
.q-nav-btn.current.nav-wrong { border-color: var(--wrong); background: var(--wrong); color: #fff; }
.q-nav-btn.nav-ai { border-color: #f59e0b; background: #fef3c7; color: #d97706; }
.q-nav-btn.current.nav-ai { border-color: var(--accent); background: var(--accent); color: #fff; }

/* ===== 确认区域 ===== */
.confirm-area { margin-top: 16px; text-align: center; animation: fadeIn 0.3s ease; }
.confirm-area.hidden { display: none; }
.btn-confirm {
    padding: 12px 32px; font-size: 16px; font-weight: 600;
    background: var(--accent-gradient);
    color: white; border: none; border-radius: 12px;
    cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 12px var(--accent-rgba);
}
.btn-confirm:hover { transform: translateY(-2px); box-shadow: 0 6px 16px var(--accent-rgba); }
.btn-confirm:active { transform: translateY(0); }

/* ===== AI辅助按钮 ===== */
.ai-help-buttons {
    display: flex; gap: 10px; margin-top: 12px;
}
.ai-help-btn {
    flex: 1; padding: 10px 16px; font-size: 14px; font-weight: 600;
    border: 2px solid transparent; border-radius: 10px;
    cursor: pointer; transition: all 0.2s;
}
#btn-verify-question {
    background: #fff3e0; color: #e65100; border-color: #ffcc80;
}
#btn-verify-question:hover { background: #ffe0b2; border-color: #ff9800; }
#btn-verify-question:disabled { background: #f5f5f5; color: #999; border-color: #ddd; cursor: not-allowed; }
#btn-ai-teach {
    background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7;
}
#btn-ai-teach:hover { background: #c8e6c9; border-color: #66bb6a; }

/* ===== 音效开关 ===== */
.quiz-header-actions { display: flex; align-items: center; gap: 8px; }
.sound-toggle {
    width: 36px; height: 36px; border-radius: 50%;
    border: none; background: #f5f5f5; cursor: pointer;
    font-size: 18px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.sound-toggle:hover { background: #e8e8e8; }
.sound-toggle.muted { opacity: 0.5; }

/* 闯关关闭按钮 */
.quiz-close-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: none; background: #f5f5f5; cursor: pointer;
    font-size: 16px; color: #666; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.quiz-close-btn:hover { background: #ff4444; color: white; }

/* ===== 正确/错误动画 ===== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}
.shake { animation: shake 0.5s ease; }

@keyframes missShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-8px, -4px); }
    20% { transform: translate(8px, 4px); }
    30% { transform: translate(-6px, 2px); }
    40% { transform: translate(6px, -2px); }
    50% { transform: translate(-4px, 4px); }
    60% { transform: translate(4px, -4px); }
    70% { transform: translate(-2px, 2px); }
    80% { transform: translate(2px, -2px); }
    90% { transform: translate(-1px, 1px); }
}
.miss-shake {
    animation: missShake 0.6s ease;
}
.miss-shake::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(239, 68, 68, 0.12);
    border-radius: inherit;
    animation: missFlash 0.3s ease forwards;
    pointer-events: none;
}
@keyframes missFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes pulseCorrect {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}
.pulse-correct { animation: pulseCorrect 0.6s ease; }

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.pop-in { animation: popIn 0.4s ease; }

/* ===== 结果弹窗 ===== */
.result-content { padding: 0; }
.result-header { text-align: center; padding: 24px; border-bottom: 1px solid var(--border); position: relative; }
.result-header h2 { font-size: 22px; }
.result-close-btn {
    position: absolute; top: 16px; right: 16px;
    width: 36px; height: 36px; border-radius: 50%;
    border: none; background: #F1F5F9; cursor: pointer;
    font-size: 16px; color: var(--text-sub); display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.result-close-btn:hover { background: var(--wrong); color: white; }
.result-title-highlight { font-size: 26px; display: block; margin-top: 6px; }
.result-body { padding: 24px; text-align: center; }
.score-display { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin-bottom: 8px; }
.score-number { font-size: 56px; font-weight: 800; color: var(--accent); }
.score-label { font-size: 20px; color: var(--text-sub); }
.stars-display { font-size: 28px; margin-bottom: 16px; }
.result-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 20px; }
.stat-item { text-align: center; }
.stat-item .stat-value { font-size: 24px; font-weight: 700; color: #333; }
.stat-item .stat-label { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* ===== 闯关奖励 ===== */
.result-rewards {
    display: flex; justify-content: center; gap: 32px;
    margin-bottom: 16px; padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent-lighter) 0%, var(--accent-light) 100%);
    border-radius: 12px;
}
.reward-item { text-align: center; }
.reward-item .reward-value {
    font-size: 22px; font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.reward-item .reward-label { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.weak-points { text-align: left; }
.weak-points h4 { font-size: 15px; margin-bottom: 10px; color: var(--text-sub); }
#weak-list { display: flex; flex-wrap: wrap; gap: 8px; }
.weak-tag { padding: 6px 12px; background: #FEF3C7; color: #D97706; border-radius: 16px; font-size: 13px; }
.result-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: center; }

/* ===== 错题闯关弹窗 ===== */
.mistake-quiz-content { padding: 0; }
.mistake-quiz-body { padding: 24px 32px; }
.mistake-quiz-progress { display: flex; align-items: center; gap: 12px; padding: 12px 24px; }
.mistake-quiz-progress .progress-bar { flex: 1; height: 6px; background: #E2E8F0; border-radius: 3px; overflow: hidden; }
.mistake-quiz-progress .progress-fill { height: 100%; background: var(--accent-gradient); border-radius: 3px; transition: width 0.3s; }
.mistake-quiz-progress span { font-size: 13px; color: var(--text-sub); min-width: 50px; text-align: right; }

/* ===== 错题本弹窗 ===== */
.mistake-content { padding: 0; }
.mistake-list { padding: 16px 20px; max-height: 60vh; overflow-y: auto; }
.mistake-modal-header {
    display: flex !important;
    align-items: center;
    justify-content: center !important;
    gap: 16px;
    position: relative;
}
.mistake-modal-header h3 {
    margin-right: auto;
}
.mistake-quiz-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    animation: mistake-quiz-pulse 2s infinite;
}
.mistake-quiz-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}
@keyframes mistake-quiz-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(255, 107, 107, 0.6); }
}
.mistake-item { padding: 16px 0; border-bottom: 1px solid #eee; }
.mistake-item:last-child { border-bottom: none; }
.mistake-item-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.mistake-item-meta { font-size: 12px; color: #888; }
.mistake-item-question { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.mistake-item-answer { display: flex; gap: 16px; margin-bottom: 8px; font-size: 14px; }
.mistake-wrong { color: #e74c3c; }
.mistake-correct { color: #27ae60; }
.mistake-analysis { font-size: 13px; color: #666; line-height: 1.6; }
/* ===== 解析分段卡片 ===== */
.analysis-section { margin-bottom: 10px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.analysis-section-header { padding: 10px 14px !important; font-weight: 700; font-size: 14px !important; border-bottom: 1px solid rgba(0,0,0,0.05); letter-spacing: 0.02em; background: #f5f5f5 !important; color: #333 !important; }
.analysis-section-body { padding: 12px 14px; font-size: 14px; line-height: 1.8; }
/* 各段颜色区分 */
.analysis-title .analysis-section-header { background: linear-gradient(135deg, #e3f2fd, #bbdefb) !important; color: #1565c0 !important; }
.analysis-idea .analysis-section-header { background: linear-gradient(135deg, #fff3e0, #ffe0b2) !important; color: #e65100 !important; }
.analysis-correct .analysis-section-header { background: linear-gradient(135deg, #e8f5e9, #c8e6c9) !important; color: #2e7d32 !important; }
.analysis-error .analysis-section-header { background: linear-gradient(135deg, #ffebee, #ffcdd2) !important; color: #c62828 !important; }
.analysis-knowledge .analysis-section-header { background: linear-gradient(135deg, #f3e5f5, #e1bee7) !important; color: #6a1b9a !important; }
.analysis-similar .analysis-section-header { background: linear-gradient(135deg, #e0f7fa, #b2ebf2) !important; color: #006064 !important; }
.analysis-option .analysis-section-header { background: linear-gradient(135deg, #fce4ec, #f8bbd0) !important; color: #ad1457 !important; }
.analysis-tips .analysis-section-header { background: linear-gradient(135deg, #fff8e1, #ffecb3) !important; color: #f57f17 !important; }
/* body 区域底色 */
.analysis-title .analysis-section-body { background: #fcfcfc; }
.analysis-idea .analysis-section-body { background: #fffbf5; }
.analysis-correct .analysis-section-body { background: #fafff8; }
.analysis-error .analysis-section-body { background: #fffafb; }
.analysis-knowledge .analysis-section-body { background: #fdfaff; }
.analysis-similar .analysis-section-body { background: #fafffe; }
.analysis-option .analysis-section-body { background: #fff5f8; }
.analysis-tips .analysis-section-body { background: #fffdf5; }
.analysis-list { margin: 8px 0 8px 20px; padding-left: 12px; list-style: none; }
.analysis-list li { padding: 4px 0; font-size: 14px; line-height: 1.7; position: relative; padding-left: 8px; }
.analysis-list li::before { content: '•'; position: absolute; left: -12px; color: #667eea; font-weight: 700; }
.analysis-para { margin: 8px 0; line-height: 1.8; font-size: 14px; }
.mistake-pagination { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid #eee; }
.btn-danger { padding: 6px 14px; font-size: 13px; border-radius: 8px; border: 1px solid #e74c3c; background: var(--card-bg-solid); color: #e74c3c; cursor: pointer; font-family: inherit; }
.btn-danger:hover { background: #e74c3c; color: #fff; }

/* ===== 综合闯关弹窗 ===== */
.combo-content { padding: 0; }
.combo-body { padding: 16px 24px; }
.combo-desc { color: #666; font-size: 14px; margin-bottom: 12px; }
.combo-units { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.combo-unit-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; border: 2px solid #e8e8e8;
    border-radius: 10px; cursor: pointer; transition: all 0.2s;
}
.combo-unit-item:hover { border-color: var(--accent); }
.combo-unit-item.selected { border-color: var(--accent); background: var(--accent-light); }
.combo-unit-checkbox { width: 18px; height: 18px; accent-color: var(--accent); }
.combo-unit-name { font-size: 14px; font-weight: 500; }
.combo-unit-level { font-size: 12px; color: #888; }
.combo-info { margin-top: 12px; padding: 10px; background: #f8f9fb; border-radius: 8px; font-size: 13px; color: #666; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; }

/* ===== 排行榜弹窗 ===== */
.leaderboard-content { padding: 0; }
.lb-subject-tabs {
    display: flex; gap: 0; padding: 8px 16px;
    background: var(--card-bg); border-top: 1px solid #f0f0f0;
}
.lb-subject-tab {
    flex: 1; padding: 8px 4px; border: none; background: none;
    border-radius: 6px; font-size: 12px; font-weight: 500;
    color: #888; cursor: pointer; transition: all 0.2s;
}
.lb-subject-tab:hover { color: #555; background: #f5f5f5; }
.lb-subject-tab.active {
    background: var(--accent); color: white; box-shadow: 0 2px 6px var(--accent-rgba);
}
.leaderboard-list { padding: 16px 20px; max-height: 70vh; overflow-y: auto; }
.leaderboard-list-header {
    display: flex; align-items: center; gap: 12px; padding: 8px 0 12px;
    border-bottom: 2px solid var(--accent); margin-bottom: 4px;
}
.leaderboard-list-header .lb-header-rank { width: 28px; flex-shrink: 0; }
.leaderboard-list-header .lb-header-name { flex: 1; font-size: 13px; font-weight: 600; color: #555; }
.leaderboard-list-header .lb-stat {
    width: 48px; text-align: center; font-size: 12px; font-weight: 700;
}
.leaderboard-list-header .lb-effort-label { color: var(--accent); }
.leaderboard-list-header .lb-score-label { color: #2e7d32; }
.leaderboard-list-header .lb-stars-label { color: #f9a825; }
.leaderboard-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-rank {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: bold;
    flex-shrink: 0;
}
.leaderboard-rank.gold { background: #ffd700; color: #8b6914; }
.leaderboard-rank.silver { background: #c0c0c0; color: #555; }
.leaderboard-rank.bronze { background: #cd7f32; color: white; }
.leaderboard-rank.normal { background: #f0f0f0; color: #666; }
.leaderboard-name { flex: 1; font-size: 14px; color: #333; }
.leaderboard-stat {
    width: 48px; text-align: center;
    font-size: 14px; font-weight: bold; flex-shrink: 0;
}
.lb-effort { color: var(--accent); }
.lb-score { color: #2e7d32; }
.lb-stars { color: #f9a825; }

/* ===== 闯关说明弹窗 ===== */
.guide-content { max-width: 520px; }
.guide-body { padding: 16px 24px; max-height: 60vh; overflow-y: auto; }
.guide-item { margin-bottom: 16px; }
.guide-item:last-child { margin-bottom: 0; }
.guide-item-title {
    font-size: 15px; font-weight: 700; color: var(--accent);
    margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #eee;
}
.guide-item-text { font-size: 14px; color: #555; line-height: 1.7; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .main-container { flex-direction: column; padding: 0 !important; }
    .tree-panel { min-height: auto; width: 100% !important; }
    .tree-canvas-container { height: 75vh !important; min-height: unset !important; border-radius: 0; padding: 10px; }
    .info-panel { min-width: auto; width: 100%; padding: 12px 16px; }
    /* 平板/手机端保持与桌面一致的右栏内容 */
    .quiz-content, .result-content, .mistake-content, .combo-content, .leaderboard-content {
        width: 95vw;
        max-height: 85vh;
    }
    .combo-units { grid-template-columns: 1fr; }
    .selector-card { padding: 24px 20px; }
    .subject-tabs { max-width: 100%; }
    .subject-tabs-right { margin-bottom: 12px; }
    /* 增大手机端触控区域 */
    .option-btn { min-height: 48px; padding: 14px 16px; }
    .btn-confirm { min-height: 48px; }
    .ai-help-btn { min-height: 44px; padding: 12px 14px; }
    .btn-primary, .btn-secondary { min-height: 44px; }
    .level-card { min-height: 48px; }
}

/* 横屏平板优化 */
@media (max-width: 900px) and (orientation: landscape) {
    .main-container { flex-direction: row; }
    .tree-panel { width: 65%; min-height: 90vh; }
    .info-panel { width: 35%; min-width: auto; }
    .tree-canvas-container { height: calc(100% - 60px); min-height: unset; }
    .modal-content { max-height: 90vh; width: 90vw; }
}

@media (max-width: 500px) {
    .navbar { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
    .nav-brand { font-size: 16px; }
    .nav-brand-logo { font-size: 16px; }
    .nav-slogan-line { font-size: 10px; }
    .main-container { padding: 0 !important; }
    .tree-header { flex-direction: column; align-items: flex-start; }
    .tree-title-group { flex-wrap: wrap; }
    .levels-grid { gap: 8px; }
    .level-card { padding: 12px; }
    .question-text { font-size: 15px; padding: 12px; }
    .option-btn { padding: 14px 16px; font-size: 14px; min-height: 52px; }
    .score-number { font-size: 48px; }
    .selector-options { gap: 6px; }
    .sel-btn { padding: 8px 12px; font-size: 13px; }
    /* 手机端 AI 按钮纵向排列 */
    .ai-help-buttons { flex-direction: column; }
    /* 确认按钮更大 */
    .btn-confirm { min-height: 52px; font-size: 16px; }
    /* 结果弹窗适配 */
    .result-stats { gap: 12px; }
    .stat-item { min-width: 60px; }
}

/* 超小屏幕（iPhone SE 等） */
@media (max-width: 380px) {
    .question-text { font-size: 14px; padding: 10px; }
    .option-btn { font-size: 13px; padding: 12px 12px; min-height: 48px; }
    .nav-brand { font-size: 14px; }
    .score-number { font-size: 40px; }
}

/* ===== 智慧树悬停同心圆 ===== */
.hover-ring-group { pointer-events: none; }

.hover-ring-bg {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-text-pill {
    font-size: 11px;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    pointer-events: none;
}

@keyframes hoverRingExpand {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.05); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes orbitFadeIn {
    0% { opacity: 0; transform: scale(0.5) rotate(-180deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.hover-ring-group.animate-in {
    animation: hoverRingExpand 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.hover-ring-group.animate-out {
    animation: hoverRingExpand 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) reverse forwards;
}

/* 光环旋转动画 */
@keyframes glowSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hover-glow-ring {
    animation: glowSpin 8s linear infinite;
    transform-origin: center;
}

/* 文字标签入场动画 */
.hover-text-pill {
    animation: orbitFadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

/* 五星全亮提示 */
.all-stars-lit-tip {
    margin: 10px 0 0;
    padding: 10px 16px;
    background: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 8px;
    color: #f57f17;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}
.all-stars-lit-tip.hidden { display: none; }

/* ===== 劲舞团风格答题判定文字 ===== */
@keyframes judgmentAppear {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    30% {
        opacity: 1;
        transform: scale(1.2) translateY(-10px);
    }
    50% {
        transform: scale(1) translateY(0);
    }
    70% {
        opacity: 1;
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-40px);
    }
}

@keyframes judgmentMiss {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }
    20% {
        opacity: 1;
        transform: scale(1.3) translateY(0);
    }
    40% {
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.7) translateY(30px);
    }
}

.judgment-text {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 42px;
    font-weight: 900;
    font-family: 'Arial Black', 'PingFang SC', sans-serif;
    letter-spacing: 3px;
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
    animation: judgmentAppear 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ===== 王者荣耀击杀播报 ===== */
@keyframes killPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2) rotate(-10deg);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3) rotate(3deg);
    }
    40% {
        transform: translate(-50%, -50%) scale(1) rotate(-1deg);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.05) rotate(1deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0);
    }
}

@keyframes killFade {
    0% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8) translateY(-30px); }
}

.kill-broadcast {
    animation: killPulse 0.5s ease-out, killFade 2s ease-out 0.5s forwards;
    pointer-events: none;
    z-index: 9999;
    text-align: center;
    line-height: 1.2;
    font-family: 'Arial Black', 'Impact', sans-serif;
    letter-spacing: 2px;
}
