/* 
* 免疫学交互课�?- 沉浸课堂 样式�?
* 设计原则: 暗黑模式、毛玻璃(Glassmorphism)、赛博朋克风医学蓝、流畅动�?
*/

:root {
    --bg-color: #efeff9; /* Light background */
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(0, 0, 0, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    
    --accent-blue: #1d4ed8;
    --accent-blue-glow: rgba(59, 130, 246, 0.4);
    --accent-indigo: #4338ca;
    
    --success: #10b981;
    --warning: #4338ca;
    --danger: #ef4444;
    
    --font-heading: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
    --font-body: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
    
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
}

/* Glassmorphism 基础�?*/
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 32px 0 rgba(255, 255, 255, 0.4);
}

/* 布局体系
   上层一条横贯全宽的顶栏，下层三栏并排：左导航 / 中白板 / 右对话。
   顶栏原来嵌在 .main-content 里（只占右侧区域的宽度），2026-09-13 提到 .app-shell 下。 */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

.app-container {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    gap: 16px;
}

/* 侧边�?*/
.sidebar {
    width: 260px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    transition: all 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 48px;
    padding-left: 8px;
    background: linear-gradient(135deg, #60a5fa, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    -webkit-text-fill-color: initial;
    color: #60a5fa;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-links li {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-links li:hover {
    background: rgba(30, 41, 59, 0.05);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-links li.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2) 0%, transparent 100%);
    color: var(--accent-blue);
    border-left: 3px solid var(--accent-blue);
}

.user-profile {
    position: relative;
    margin-top: auto;
}

.ix-account-trigger {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.22);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ix-account-trigger:hover,
.ix-account-trigger[aria-expanded="true"] {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.22);
    background: rgba(255, 255, 255, 0.34);
}

.ix-account-avatar {
    display: inline-flex;
    flex-shrink: 0;
}

.ix-account-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-indigo);
}

.ix-account-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.user-info h4,
.ix-account-copy h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .level,
.ix-account-copy .level {
    font-size: 11px;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.ix-account-caret {
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.ix-account-trigger[aria-expanded="true"] .ix-account-caret {
    transform: rotate(180deg);
}

.ix-account-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    z-index: 80;
    display: grid;
    gap: 4px;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 20px 46px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(16px);
}

.ix-account-menu-item {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-height: 38px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #1e293b;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.ix-account-menu-item:hover,
.ix-account-menu-item:focus-visible {
    background: rgba(59, 130, 246, 0.1);
    outline: none;
}

.ix-account-menu-item i {
    color: rgba(71, 85, 105, 0.88);
    font-size: 16px;
}

.ix-account-alert {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.ix-account-menu-divider {
    height: 1px;
    margin: 4px 2px;
    background: rgba(148, 163, 184, 0.24);
}

.ix-account-menu-item-danger {
    color: #dc2626;
}

.ix-account-menu-item-danger i {
    color: #dc2626;
}

/* ── 访客/登录态切换按钮组 ────────────────── */
.ix-guest-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding: 14px 0 0;
}

.ix-guest-actions.hidden {
    display: none !important;
}

.ix-guest-actions-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1.2;
}

.ix-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

/* 访客浏览：主按钮，浅色底，加亮 */
.ix-btn-guest-active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.ix-btn-guest-active:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

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

/* 登录学习：次按钮，极浅 */
.ix-btn-login {
    background: rgba(255, 255, 255, 0.3);
    color: var(--text-secondary);
    border: 1px solid rgba(30, 41, 59, 0.08);
}

.ix-btn-login:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

.ix-guest-actions-right {
    display: flex;
    flex: 1;
}

.ix-visit-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(30, 41, 59, 0.06);
    border-radius: var(--radius-md);
    padding: 8px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.ix-visit-counter:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(59, 130, 246, 0.2);
}

.ix-visit-counter i {
    font-size: 22px;
    color: var(--accent-blue);
    opacity: 0.8;
    margin-bottom: 2px;
}

.ix-visit-counter .visit-count {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.ix-visit-counter .visit-label {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

/* ── 移动端/平板端 top-bar 内访客操作行（桌面端隐藏） ── */
.ix-guest-bar-mobile {
    display: none;
}

.ix-mbtn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.18s ease, background 0.18s ease;
}

.ix-mbtn-guest {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.ix-mbtn-guest:hover {
    background: rgba(59, 130, 246, 0.2);
}

.ix-mbtn-guest:active {
    transform: scale(0.96);
}

.ix-mbtn-login {
    background: rgba(255, 255, 255, 0.4);
    color: var(--text-secondary);
    border: 1px solid rgba(30, 41, 59, 0.1);
}

.ix-mbtn-login:hover {
    background: rgba(255, 255, 255, 0.65);
    color: var(--text-primary);
}

.ix-mbtn-login:active {
    transform: scale(0.96);
}

/* 主内容区 */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.case-detective-view {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    padding-bottom: 4px;
}

.case-detective-view::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 12%, rgba(49, 46, 129, 0.16), transparent 28%),
        radial-gradient(circle at 84% 20%, rgba(56, 189, 248, 0.14), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.8200000000000001), rgba(255, 255, 255, 0.88));
    pointer-events: none;
    z-index: -1;
}

.knowledge-map-view {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    padding-bottom: 4px;
}

.knowledge-map-view::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 16% 14%, rgba(67, 56, 202, 0.14), transparent 24%),
        radial-gradient(circle at 78% 18%, rgba(34, 211, 238, 0.16), transparent 26%),
        radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.88));
    pointer-events: none;
    z-index: -2;
}

.knowledge-map-view::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at 50% 45%, rgba(30, 41, 59, 0.65), transparent 88%);
    pointer-events: none;
    z-index: -1;
}

.lesson-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 252, 243, 0.4);
    border: 1px solid rgba(30, 41, 59, 0.1);
    border-radius: 8px;
    padding: 6px 12px;
}

.lesson-switcher span {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.lesson-switcher select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.lesson-switcher select:focus {
    outline: none;
}

.lesson-switcher select option {
    background: #fffcf3;
    color: #1e293b;
}

.knowledge-section-kicker {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(67, 56, 202, 0.88);
}

.knowledge-map-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
    gap: 16px;
    min-height: 0;
    flex: 1 1 auto;
}

@media (max-width: 1260px) {
    .knowledge-map-grid {
        grid-template-columns: 1fr;
    }

}


.case-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.case-progress-track {
    position: relative;
    flex: 1 1 auto;
    height: 8px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.06);
    overflow: hidden;
}

.case-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(49, 46, 129, 0.95), rgba(59, 130, 246, 0.9));
    box-shadow: 0 0 14px rgba(49, 46, 129, 0.22);
}

.case-progress-meta {
    min-width: 38px;
    text-align: right;
    font-size: 11px;
    font-weight: 800;
    color: #1e293b;
    opacity: 0.72;
}

/* 顶栏（横贯全宽，常驻各模块） */
.top-bar {
    /* 它现在是 .app-shell 这一列的子项，默认 flex-shrink:1 会被下面内容高的模块压扁
       （实测病例侦探里从 72px 塌到 53px）。高度必须锁死。 */
    flex: 0 0 auto;
    height: 72px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: relative;
    z-index: 90;
    overflow: visible;
}

.course-info h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    max-width: min(42vw, 520px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lesson-switcher {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
}

.lesson-switcher span {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lesson-switcher select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid rgba(30, 41, 59, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.lesson-switcher select:hover,
.lesson-switcher select:focus {
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    background: rgba(255, 252, 243, 0.75);
}

.badge {
    display: inline-block;
    background: var(--accent-blue);
    color: #ffffff;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 20px;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.stats {
    display: flex;
    gap: 10px;
    position: relative;
}

.stat-item {
    background: rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-copy {
    min-width: 0;
}

.stat-copy strong,
.stat-copy small {
    display: block;
    white-space: nowrap;
}
.text-yellow { color: var(--warning); }
.text-orange { color: #f97316; }

/* 课堂核心交互�?*/
.classroom-area {
    display: flex;
    gap: 16px;
    flex-grow: 1;
    overflow: hidden;
}

/* 左侧黑板 (60%) */
.blackboard-section {
    flex: 6;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.canvas-header {
    height: 44px;
    background: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--panel-border);
}

.canvas-note-slot {
    display: flex;
    align-items: center;
    min-width: 168px;
}

.tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tools button,
.canvas-fullscreen-exit {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(30, 41, 59, 0.12);
    background: rgba(255, 252, 243, 0.72);
    color: #1e293b;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.tools button {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tools button:hover,
.canvas-fullscreen-exit:hover {
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(252, 238, 225, 0.86);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.28);
}

.tools button:focus-visible,
.canvas-fullscreen-exit:focus-visible {
    outline: 2px solid rgba(30, 41, 59, 0.92);
    outline-offset: 2px;
}

.dots { display: flex; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #4338ca; }
.dot.green { background: #27c93f; }

.assistant-note-anchor {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    border: 1px solid rgba(16, 185, 129, 0.24);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(236, 253, 245, 0.94));
    color: #065f46;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.12);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.assistant-note-anchor:hover {
    transform: translateY(-1px);
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 14px 28px rgba(16, 185, 129, 0.18);
}

.assistant-note-anchor img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.assistant-note-anchor-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    line-height: 1.05;
}

.assistant-note-anchor-copy strong {
    font-size: 12px;
    font-weight: 800;
    color: #064e3b;
}

.assistant-note-anchor-copy small {
    font-size: 10px;
    color: rgba(6, 95, 70, 0.74);
}

.assistant-note-anchor-count {
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    padding: 0 6px;
    background: rgba(6, 95, 70, 0.14);
    color: #065f46;
    font-size: 11px;
    font-weight: 800;
}

.canvas-title {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.visualization-stage {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 28px 24px 224px;
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 30%, rgba(226, 240, 255, 0.9), rgba(245, 250, 255, 0.82) 58%, rgba(250, 253, 255, 0.96) 100%),
        #f7fbff;
}

.guest-learning-promise {
    display: none;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 7px 12px;
    border: 1px solid rgba(14, 165, 233, 0.18);
    border-radius: 13px;
    background: rgba(239, 249, 255, 0.86);
    color: #075985;
}

.guest-learning-promise > i {
    font-size: 19px;
    color: #0284c7;
}

.guest-learning-promise span {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.guest-learning-promise strong {
    font-size: 12px;
}

.guest-learning-promise small {
    margin-top: 3px;
    color: #475569;
    font-size: 9px;
}

body.is-guest .guest-learning-promise {
    display: flex;
}

body.is-guest #coinStatItem,
body.is-guest #streakStatItem {
    display: none;
}

.visualization-stage::before,
.visualization-stage::after {
    content: '';
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.visualization-stage::before {
    width: min(64vmin, 560px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(37, 99, 235, 0.12);
    box-shadow:
        0 0 0 28px rgba(14, 165, 233, 0.035),
        0 0 0 76px rgba(37, 99, 235, 0.025);
}

.visualization-stage::after {
    inset: 0;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
}

.classroom-entry {
    position: absolute;
    z-index: 5;
    width: min(540px, calc(100% - 48px));
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(250, 253, 255, 0.96), rgba(237, 248, 255, 0.92));
    box-shadow:
        0 30px 90px rgba(15, 23, 42, 0.2),
        inset 0 1px rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-align: left;
}

.classroom-entry::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    border-radius: 28px 0 0 28px;
    background: linear-gradient(180deg, #2563eb, #06b6d4, #10b981);
}

.classroom-entry-kicker {
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.classroom-entry h3 {
    /* The entry question is a curated 30-38 character sentence per chapter, so
       this is sized to read as a lead-in question rather than a poster title. */
    max-width: 20em;
    margin: 10px 0 14px;
    color: #0b1f33;
    font-family: var(--font-heading);
    font-size: clamp(19px, 1.45vw, 24px);
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.classroom-entry > p {
    max-width: 42em;
    color: #475569;
    font-size: 14px;
    line-height: 1.7;
}

.classroom-entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
}

.classroom-entry-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(219, 234, 254, 0.76);
    color: #1e3a8a;
    font-size: 11px;
    font-weight: 700;
}

.classroom-entry-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #1d4ed8, #0284c7);
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(37, 99, 235, 0.26);
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.classroom-entry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.34);
}

.classroom-entry-button:focus-visible {
    outline: 3px solid rgba(14, 165, 233, 0.36);
    outline-offset: 3px;
}

.classroom-entry-button:disabled {
    opacity: 0.72;
    cursor: wait;
}

.visualization-stage.is-entry-ready .hologram-effect {
    opacity: 0.46;
    filter: saturate(0.72) brightness(1.08);
}

.whiteboard-static-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
    opacity: 0;
    filter: saturate(0.92) brightness(1.06);
    transform: scale(1.04);
    transition: opacity 0.35s ease;
    z-index: 0;
}

.visualization-stage.is-lecture-active .whiteboard-static-bg {
    opacity: 0.18;
}

.canvas-fullscreen-exit {
    position: absolute;
    top: 18px;
    left: 18px;
    right: auto;
    z-index: 140;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(14px);
}

.canvas-fullscreen-exit i {
    font-size: 15px;
}

/* ============================================
   全息免疫视频�?- Hologram Intro Video
   ============================================ */
.hologram-effect {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f4f9ff;
    z-index: 1;
    pointer-events: none;
}

.hologram-effect::before {
    content: '';
    position: absolute;
    inset: -36px;
    background: url('../assets/animations/home-whiteboard-poster.webp') center center / cover no-repeat;
    filter: blur(26px) saturate(0.95) brightness(1.08);
    opacity: 0.88;
    transform: scale(1.08);
    z-index: 0;
}

/* --- 旧版 CSS 全息动画保留为回退资源样式 --- */
@keyframes pulseExpand {
    0% {
        transform: scale(0.3);
        opacity: 0.8;
        border-color: rgba(96, 165, 250, 0.6);
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.3), inset 0 0 20px rgba(59, 130, 246, 0.1);
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
        border-color: rgba(59, 130, 246, 0);
        box-shadow: 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* --- 轨道�?--- */
@keyframes orbitSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 轨道上的免疫细胞 --- */
/* 抗体 - 紫罗�?(Y�? 外层轨道) */
/* 树突状细�?- 青碧 (星形分枝, 中层轨道) */
/* T细胞 - 宝蓝 (圆形+T�? 内层轨道) */
@keyframes cellPulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.15); filter: brightness(1.3); }
}

/* --- 中心核心 --- */
@keyframes coreGlow {
    0% {
        box-shadow:
            0 0 30px rgba(239, 68, 68, 0.3),
            0 0 60px rgba(239, 68, 68, 0.1),
            inset 0 0 20px rgba(239, 68, 68, 0.15);
        border-color: rgba(248, 113, 113, 0.4);
    }
    100% {
        box-shadow:
            0 0 50px rgba(239, 68, 68, 0.5),
            0 0 100px rgba(239, 68, 68, 0.2),
            inset 0 0 30px rgba(239, 68, 68, 0.25);
        border-color: rgba(248, 113, 113, 0.7);
    }
}

@keyframes labelFlicker {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
    72% { opacity: 0.5; }
    74% { opacity: 1; }
}

/* --- 扫描光束 --- */
@keyframes beamSweep {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 浮动粒子 (抗体/细胞因子) --- */
@keyframes particleDrift {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.4; }
    25% { transform: translate(12px, -18px) scale(1.3); opacity: 1; }
    50% { transform: translate(-8px, -30px) scale(0.8); opacity: 0.6; }
    75% { transform: translate(15px, -10px) scale(1.1); opacity: 0.9; }
}

/* --- 数据流装饰线 --- */
@keyframes dataFlow {
    0% { opacity: 0; transform: translateY(-20px); }
    30% { opacity: 0.7; }
    70% { opacity: 0.7; }
    100% { opacity: 0; transform: translateY(30px); }
}

/* --- HUD 角标 --- */
/* 交互卡片�?*/
.interactive-cards {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    width: 90%;
    justify-content: center;
    z-index: 5;
}

.interactive-cards[data-active-deck-id="figureAtlas"] {
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding: 4px 4px 8px;
}

.interactive-cards[data-active-deck-id="figureAtlas"] .card {
    flex: 0 0 148px;
}

.card {
    background: rgba(255, 252, 243, 0.8);
    border: 1px solid rgba(30, 41, 59, 0.1);
    border-radius: var(--radius-md);
    padding: 14px;
    width: 148px;
    text-align: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    color: inherit;
    font: inherit;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    position: relative;
}

.card:hover {
    transform: translateY(-10px) scale(1.05);
    background: rgba(245, 234, 226, 0.8);
    border-color: rgba(30, 41, 59, 0.2);
    box-shadow: 0 15px 30px rgba(255, 255, 255, 0.5);
}

.card:focus-visible {
    outline: 2px solid rgba(30, 41, 59, 0.9);
    outline-offset: 3px;
}

.card.is-completed {
    border-color: rgba(45, 212, 191, 0.65);
    background: linear-gradient(180deg, rgba(255, 197, 211, 0.78), rgba(255, 252, 243, 0.84));
    box-shadow: 0 14px 34px rgba(8, 145, 178, 0.24);
}

.card.is-locked {
    opacity: 0.52;
    background: rgba(226, 232, 240, 0.4) !important;
    border: 1px dashed rgba(30, 41, 59, 0.22) !important;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none !important;
    transform: none !important;
}

.card.is-locked .card-emblem,
.card.is-locked i,
.card.is-locked h4,
.card.is-locked p {
    filter: grayscale(1) opacity(0.6);
}

.card.is-locked::after {
    content: '锁定';
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.card.is-completed::after {
    content: '已探索';
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.18);
    border: 1px solid rgba(45, 212, 191, 0.4);
    color: #1e293b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.card i {
    font-size: 32px;
    margin-bottom: 8px;
    display: inline-block;
}

.icon-purple { color: #a855f7; text-shadow: 0 0 15px rgba(168, 85, 247, 0.4); filter: drop-shadow(0 0 10px rgba(168,85,247,0.4)); }
.icon-cyan { color: #06b6d4; text-shadow: 0 0 15px rgba(6, 182, 212, 0.4); filter: drop-shadow(0 0 10px rgba(6,182,212,0.4)); }

.pixel-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 12px;
    fill: currentColor;
}

.card-emblem,
.viz-emblem {
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    font-family: var(--font-heading);
    font-weight: 800;
    letter-spacing: 0.04em;
    border: 1px solid rgba(30, 41, 59, 0.12);
}

.card-emblem {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 18px;
}

.viz-emblem {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    padding: 10px;
    font-size: clamp(18px, 1.7vw, 24px);
    line-height: 1;
    text-align: center;
    word-break: break-word;
    box-shadow: 0 18px 40px rgba(255, 252, 243, 0.28);
}

.caption-box {
    position: absolute;
    inset: 28px 24px 210px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(96px, 140px);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "title media"
        "body media";
    align-items: start;
    column-gap: 28px;
    row-gap: 12px;
    min-width: 0;
    overflow: hidden;
    z-index: 3;
    pointer-events: none;
    transition: inset 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), grid-template-columns 0.4s ease;
}

/* 图为主：机制图/流程图占据白板主区域，标题与讲解压在图下。
   原来是左文右图，图片列被限制在 220-300px，教材机制图在这个宽度里看不清细节，
   白板因此更像“配了张缩略图的文字板”，而不是黑板。 */
.caption-box:has(.viz-figure),
.caption-box.has-figure {
    inset: 24px 24px 186px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas:
        "media"
        "title"
        "body";
    column-gap: 0;
    row-gap: 10px;
    align-items: stretch;
    justify-items: center;
    text-align: center;
}

/* 图片按 contain 缩放并居中：换图时白板高度不跳，这是连播多张图时观感稳定的关键。 */
.caption-box.has-figure .viz-figure,
.caption-box:has(.viz-figure) .viz-figure {
    grid-area: media;
    align-self: center;
    justify-self: center;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.caption-box.has-figure h3,
.caption-box:has(.viz-figure) h3 {
    grid-area: title;
    align-self: end;
    text-align: center;
    font-size: clamp(17px, 1.5vw, 25px);
}

.caption-box.has-figure p,
.caption-box:has(.viz-figure) p {
    grid-area: body;
    max-width: min(880px, 100%);
    text-align: center;
    font-size: clamp(13px, 0.95vw, 16px);
    line-height: 1.5;
}

/* 板序标记：让学生知道这是本章第几板，也方便用 ← → 往回翻。 */
.board-step {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 4;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: rgba(30, 41, 59, 0.66);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    pointer-events: none;
}

/* 学生作答后在板上留痕：命中的元素高亮，并带一个 ✓ / ✗ 角标。 */
.board-mark {
    transition: opacity 0.25s ease;
}

.board-mark-correct {
    outline: 2.5px solid #16a34a;
    outline-offset: 2px;
    border-radius: 6px;
}

.board-mark-wrong {
    outline: 2.5px solid #dc2626;
    outline-offset: 2px;
    border-radius: 6px;
    opacity: 0.55;
}

.board-mark-badge {
    position: absolute;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
    pointer-events: none;
}

.board-mark-badge.is-correct { background: #16a34a; }
.board-mark-badge.is-wrong { background: #dc2626; }

/* 小疫笔记打开时保留右侧阅读区，但图文白板不能被压成窄列�?*/
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box {
    inset: 28px 360px 210px 24px;
}

.blackboard-section.has-assistant-note .caption-box {
    inset: 28px 360px 210px 24px;
}

/* 小疫笔记打开时白板变窄，但仍保持图为主，只是整体缩一圈。 */
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.has-figure,
.blackboard-section.has-assistant-note .caption-box.has-figure {
    inset: 22px 360px 192px 24px;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
}

.caption-box h3,
.caption-box p {
    max-width: 100%;
    margin: 0;
    text-shadow: 0 8px 18px rgba(255, 255, 255, 0.45);
}

.caption-box h3 {
    grid-area: title;
    align-self: end;
    font-family: var(--font-heading);
    font-size: clamp(20px, 1.95vw, 30px);
    line-height: 1.18;
    letter-spacing: 0;
    text-wrap: balance;
    overflow-wrap: break-word;
}

.caption-box p {
    grid-area: body;
    max-width: min(760px, 100%);
    font-size: clamp(14px, 1.05vw, 17px);
    line-height: 1.42;
    color: rgba(30, 41, 59, 0.96);
    pointer-events: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.caption-box .viz-emblem,
.caption-box .viz-figure,
.caption-box > img,
.caption-box > svg {
    grid-area: media;
    align-self: center;
    justify-self: center;
}

.caption-box .viz-emblem {
    margin: 0;
}

.caption-box .viz-figure {
    width: min(100%, 360px);
    max-height: 250px;
    object-fit: contain;
    margin: 0;
    align-self: end;
    justify-self: end;
    border-radius: 20px;
    padding: 10px 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.56)),
        radial-gradient(circle at top, rgba(96, 165, 250, 0.08), transparent 58%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 22px 48px rgba(255, 255, 255, 0.42);
}

.caption-box:has(.figure-atlas-image),
.caption-box.figure-atlas-caption {
    inset: 24px 24px 184px;
    grid-template-columns: minmax(220px, 0.34fr) minmax(320px, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "title title"
        "body media";
    align-items: stretch;
    column-gap: 22px;
    row-gap: 12px;
}

.caption-box .figure-atlas-image {
    grid-area: media;
    position: static;
    transform: none;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: 100%;
    align-self: stretch;
    justify-self: stretch;
    object-fit: contain;
    padding: 12px 14px;
}

.whiteboard-history-btn {
    position: absolute;
    top: 50%;
    z-index: 18;
    display: grid;
    place-items: center;
    width: 38px;
    height: 54px;
    border: 1px solid rgba(30, 41, 59, 0.1);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 252, 243, 0.72)),
        radial-gradient(circle at top, rgba(45, 212, 191, 0.16), transparent 58%);
    color: rgba(30, 41, 59, 0.72);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.whiteboard-history-btn i {
    font-size: 24px;
    line-height: 1;
}

.whiteboard-history-prev {
    left: 10px;
}

.whiteboard-history-next {
    right: 10px;
}

.whiteboard-history-btn:hover:not(:disabled),
.whiteboard-history-btn:focus-visible:not(:disabled) {
    color: #0f766e;
    border-color: rgba(20, 184, 166, 0.34);
    transform: translateY(-50%) scale(1.04);
}

.whiteboard-history-btn:focus-visible {
    outline: 2px solid rgba(20, 184, 166, 0.42);
    outline-offset: 2px;
}

.whiteboard-history-btn:disabled {
    opacity: 0.28;
    cursor: default;
    box-shadow: none;
}

.visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box {
    left: 58px;
    right: 58px;
}

.visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box.has-figure,
.visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box.figure-atlas-caption {
    left: 58px;
    right: 58px;
}

.blackboard-section:has(#assistantPopup:not(.hidden)) .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box,
.blackboard-section.has-assistant-note .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box {
    left: 58px;
}

.caption-box.figure-atlas-caption h3,
.caption-box.figure-atlas-caption p {
    max-width: 100%;
}

.caption-box.figure-atlas-caption h3 {
    align-self: end;
    font-size: clamp(22px, 1.9vw, 30px);
    line-height: 1.14;
}

.caption-box.figure-atlas-caption p {
    align-self: stretch;
    overflow: auto;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 252, 243, 0.64);
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) h3,
.blackboard-section.has-assistant-note .caption-box.has-figure h3 {
    font-size: clamp(18px, 1.45vw, 24px);
    line-height: 1.16;
}

.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) p,
.blackboard-section.has-assistant-note .caption-box.has-figure p {
    font-size: clamp(12.5px, 0.9vw, 15px);
    line-height: 1.48;
}

.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) .viz-figure,
.blackboard-section.has-assistant-note .caption-box.has-figure .viz-figure {
    width: min(100%, 250px);
    max-height: 190px;
    padding: 8px 10px;
    border-radius: 18px;
}

.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption,
.blackboard-section.has-assistant-note .caption-box.figure-atlas-caption {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
        "title"
        "body"
        "media";
    row-gap: 10px;
}

.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption p,
.blackboard-section.has-assistant-note .caption-box.figure-atlas-caption p {
    align-self: start;
    max-height: 72px;
}

.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box .figure-atlas-image,
.blackboard-section.has-assistant-note .caption-box .figure-atlas-image {
    width: 100%;
    height: auto;
    max-height: 180px;
}

.blackboard-section:fullscreen,
.blackboard-section.is-fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    background:
        radial-gradient(circle at top, rgba(245, 234, 226, 0.52), transparent 48%),
        linear-gradient(180deg, rgba(255, 255, 249, 0.88), rgba(255, 252, 243, 0.88));
}

body.is-canvas-viewport-maximized {
    overflow: hidden;
}

.blackboard-section.is-viewport-maximized {
    position: fixed;
    inset: 0;
    z-index: 9990;
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    overflow: hidden;
}

.blackboard-section:fullscreen .glass-panel,
.blackboard-section.is-fullscreen .glass-panel {
    backdrop-filter: none;
}

.blackboard-section:fullscreen .canvas-header,
.blackboard-section.is-fullscreen .canvas-header {
    height: 56px;
    padding: 0 20px;
}

.blackboard-section:fullscreen .canvas-title,
.blackboard-section.is-fullscreen .canvas-title {
    font-size: 13px;
    letter-spacing: 0.12em;
}

.blackboard-section:fullscreen .visualization-stage,
.blackboard-section.is-fullscreen .visualization-stage {
    padding: 42px 34px 202px;
}

.blackboard-section:fullscreen .caption-box,
.blackboard-section.is-fullscreen .caption-box {
    inset: 42px 34px 182px;
}

.blackboard-section:fullscreen:has(#assistantPopup:not(.hidden)) .caption-box,
.blackboard-section.is-fullscreen:has(#assistantPopup:not(.hidden)) .caption-box {
    inset: 42px 360px 182px 34px;
}

.blackboard-section:fullscreen .caption-box:has(.viz-figure),
.blackboard-section.is-fullscreen .caption-box:has(.viz-figure),
.blackboard-section:fullscreen .caption-box.has-figure,
.blackboard-section.is-fullscreen .caption-box.has-figure {
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 520px);
    inset: 42px 34px 170px;
    column-gap: 34px;
}

.blackboard-section:fullscreen:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
.blackboard-section.is-fullscreen:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
.blackboard-section:fullscreen:has(#assistantPopup:not(.hidden)) .caption-box.has-figure,
.blackboard-section.is-fullscreen:has(#assistantPopup:not(.hidden)) .caption-box.has-figure {
    inset: 42px 360px 170px 34px;
}

.blackboard-section:fullscreen.has-assistant-note .caption-box.has-figure,
.blackboard-section.is-fullscreen.has-assistant-note .caption-box.has-figure {
    inset: 42px 360px 170px 34px;
}

.blackboard-section:fullscreen .caption-box h3,
.blackboard-section.is-fullscreen .caption-box h3 {
    font-size: clamp(28px, 2.6vw, 46px);
}

.blackboard-section:fullscreen .caption-box p,
.blackboard-section.is-fullscreen .caption-box p {
    font-size: clamp(16px, 1.2vw, 21px);
    max-width: min(860px, 100%);
}

.blackboard-section:fullscreen .caption-box .viz-figure,
.blackboard-section.is-fullscreen .caption-box .viz-figure {
    width: min(100%, 520px);
    max-height: 420px;
    border-radius: 26px;
    padding: 14px 16px;
}

.blackboard-section:fullscreen .caption-box:has(.figure-atlas-image),
.blackboard-section.is-fullscreen .caption-box:has(.figure-atlas-image),
.blackboard-section:fullscreen .caption-box.figure-atlas-caption,
.blackboard-section.is-fullscreen .caption-box.figure-atlas-caption {
    inset: 42px 34px 158px;
    grid-template-columns: minmax(300px, 0.36fr) minmax(520px, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "title title"
        "body media";
    column-gap: 30px;
    row-gap: 16px;
}

.blackboard-section:fullscreen .caption-box .figure-atlas-image,
.blackboard-section.is-fullscreen .caption-box .figure-atlas-image {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
}

.blackboard-section:fullscreen .caption-box.figure-atlas-caption h3,
.blackboard-section:fullscreen .caption-box.figure-atlas-caption p,
.blackboard-section.is-fullscreen .caption-box.figure-atlas-caption h3,
.blackboard-section.is-fullscreen .caption-box.figure-atlas-caption p {
    max-width: 100%;
}

.blackboard-section:fullscreen .caption-box.figure-atlas-caption h3,
.blackboard-section.is-fullscreen .caption-box.figure-atlas-caption h3 {
    font-size: clamp(24px, 2.2vw, 36px);
}

.blackboard-section:fullscreen .interactive-cards,
.blackboard-section.is-fullscreen .interactive-cards {
    width: min(1040px, calc(100% - 76px));
    bottom: 28px;
    gap: 16px;
}

.blackboard-section:fullscreen .whiteboard-history-btn,
.blackboard-section.is-fullscreen .whiteboard-history-btn {
    width: 46px;
    height: 64px;
    border-radius: 16px;
}

.blackboard-section:fullscreen .whiteboard-history-prev,
.blackboard-section.is-fullscreen .whiteboard-history-prev {
    left: 18px;
}

.blackboard-section:fullscreen .whiteboard-history-next,
.blackboard-section.is-fullscreen .whiteboard-history-next {
    right: 18px;
}

.blackboard-section:fullscreen .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box,
.blackboard-section.is-fullscreen .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box {
    left: 82px;
    right: 82px;
}

.blackboard-section:fullscreen .card,
.blackboard-section.is-fullscreen .card {
    width: 164px;
}

.blackboard-section:fullscreen .assistant-popup,
.blackboard-section.is-fullscreen .assistant-popup {
    top: 78px;
    right: 28px;
}

@media (max-width: 1500px) {
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
    .blackboard-section.has-assistant-note .caption-box.has-figure {
        inset: 180px 24px 198px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
        row-gap: 10px;
    }

    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box .figure-atlas-image,
    .blackboard-section.has-assistant-note .caption-box .figure-atlas-image {
        width: 100%;
        height: auto;
        max-height: 150px;
        justify-self: center;
    }

    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption p,
    .blackboard-section.has-assistant-note .caption-box.figure-atlas-caption p {
        align-self: start;
        max-height: 68px;
        padding: 10px 12px;
    }
}

/* 断点从 1200px 收窄到 1024px。
   这一整块是「图为主」版式之前的旧窄屏版式（标题→正文→图，图钉死 260px 靠右），
   里面的选择器带 #assistantPopup，:not(:has()) 让它拿到 ID 级权重，
   于是文件末尾的统一规则压不过它 —— 1025~1200px 的桌面窗口因此一直看到
   260×114 的缩略图，而不是「图为主」。
   本块在 ≤1024 上的取值由**文件末尾**的「白板自适应 · 第 1.5 期」整体接管。 */
@media (max-width: 1024px) {
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
    .blackboard-section.has-assistant-note .caption-box.has-figure {
        inset: 245px 24px 198px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
        row-gap: 10px;
    }

    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) h3,
    .blackboard-section.has-assistant-note .caption-box.has-figure h3 {
        font-size: clamp(18px, 2.2vw, 22px);
        line-height: 1.16;
    }

    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) p,
    .blackboard-section.has-assistant-note .caption-box.has-figure p {
        font-size: clamp(12.5px, 1.4vw, 14px);
        line-height: 1.45;
    }

    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) .viz-figure,
    .blackboard-section.has-assistant-note .caption-box.has-figure .viz-figure {
        width: min(100%, 230px);
        max-height: 136px;
        justify-self: end;
        align-self: start;
    }

    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box:has(.viz-figure),
    .blackboard-section:not(.has-assistant-note) .caption-box.has-figure {
        inset: 28px 24px 198px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
        row-gap: 12px;
    }

    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box:has(.viz-figure) h3,
    .blackboard-section:not(.has-assistant-note) .caption-box.has-figure h3 {
        font-size: clamp(20px, 2.6vw, 26px);
        line-height: 1.16;
    }

    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box:has(.viz-figure) p,
    .blackboard-section:not(.has-assistant-note) .caption-box.has-figure p {
        font-size: clamp(13px, 1.5vw, 15px);
        line-height: 1.48;
    }

    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box:has(.viz-figure) .viz-figure,
    .blackboard-section:not(.has-assistant-note) .caption-box.has-figure .viz-figure {
        width: min(100%, 260px);
        max-height: 170px;
        justify-self: end;
        align-self: start;
    }

    .caption-box.figure-atlas-caption,
    .blackboard-section:not(.has-assistant-note) .caption-box.figure-atlas-caption {
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
    }

    .caption-box.figure-atlas-caption .figure-atlas-image {
        width: 100%;
        height: auto;
        max-height: 220px;
        justify-self: center;
    }
}

.theme-amber {
    color: #fdba74;
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.32);
    box-shadow: 0 0 24px rgba(249, 115, 22, 0.18);
}

.theme-rose {
    color: #fda4af;
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.32);
    box-shadow: 0 0 24px rgba(244, 63, 94, 0.18);
}

.theme-cyan {
    color: #0369a1;
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.32);
    box-shadow: 0 0 24px rgba(6, 182, 212, 0.18);
}

.theme-indigo {
    color: #c4b5fd;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.32);
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.18);
}

.card h4 { font-size: 13px; margin-bottom: 4px; font-weight: 700; }
.card p { font-size: 10.5px; color: var(--text-secondary); line-height: 1.35; }

.hidden { display: none !important; }

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

@keyframes spinFloat {
    0% { transform: rotate(0deg) translateY(0); }
    50% { transform: rotate(180deg) translateY(-6px); }
    100% { transform: rotate(360deg) translateY(0); }
}

@keyframes radarPulse {
    0%, 100% { transform: scale(0.96); opacity: 0.85; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* 右侧对话�?(40%) */
.dialogue-section {
    flex: 4;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.participants-panel {
    height: 92px;
    min-height: 74px;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.45);
}

.participants-panel.is-resizing {
    user-select: none;
}

.participants-strip {
    display: flex;
    gap: 10px;
    padding: 12px 16px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    background: transparent;
    scroll-padding-inline: 16px;
    scrollbar-color: rgba(148, 163, 184, 0.95) rgba(255, 252, 243, 0.75);
    scrollbar-width: auto;
    flex: 1;
}

.participants-strip::-webkit-scrollbar {
    height: 10px;
}

.participants-strip::-webkit-scrollbar-track {
    background: rgba(255, 252, 243, 0.75);
    border-radius: 999px;
}

.participants-strip::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, rgba(147, 197, 253, 0.92), rgba(125, 211, 252, 0.92));
    border-radius: 999px;
    border: 2px solid rgba(255, 252, 243, 0.72);
}

.participants-strip::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, rgba(30, 41, 59, 1), rgba(103, 232, 249, 1));
}

.participants-resizer {
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ns-resize;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.02), rgba(30, 41, 59, 0.05));
    border-top: 1px solid rgba(30, 41, 59, 0.06);
}

.participants-resizer span {
    width: 54px;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.72);
    box-shadow: 0 0 16px rgba(148, 163, 184, 0.18);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.participants-panel.is-resizing .participants-resizer span,
.participants-resizer:hover span {
    background: rgba(30, 41, 59, 0.96);
    box-shadow: 0 0 18px rgba(96, 165, 250, 0.35);
}

.classroom-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(255, 255, 254, 0.78);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.78);
    box-shadow: 0 0 0 6px rgba(148, 163, 184, 0.08);
    flex-shrink: 0;
}

.status-copy {
    min-width: 0;
}

.status-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.status-detail {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.classroom-status-bar[data-tone="idle"] .status-dot {
    background: rgba(148, 163, 184, 0.9);
    box-shadow: 0 0 0 6px rgba(148, 163, 184, 0.1);
}

.classroom-status-bar[data-tone="lecture"] .status-dot {
    background: rgba(96, 165, 250, 0.95);
    box-shadow: 0 0 0 6px rgba(96, 165, 250, 0.14);
}

.classroom-status-bar[data-tone="choice"] .status-dot {
    background: rgba(67, 56, 202, 0.98);
    box-shadow: 0 0 0 6px rgba(67, 56, 202, 0.14);
}

.classroom-status-bar[data-tone="explore"] .status-dot {
    background: rgba(45, 212, 191, 0.98);
    box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.14);
}

.classroom-status-bar[data-tone="success"] .status-dot {
    background: rgba(34, 197, 94, 0.98);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.14);
}

.participant-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 158px;
    max-width: 182px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(30, 41, 59, 0.04);
    position: relative;
    transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
    overflow: hidden;
}

.participant-status {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.22);
    box-shadow: 0 0 0 0 rgba(30, 41, 59, 0);
    flex-shrink: 0;
}

.participant-chip img {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    flex-shrink: 0;
}

.participant-chip.professor {
    border-color: rgba(96, 165, 250, 0.28);
    background: rgba(59, 130, 246, 0.12);
}

.participant-chip.student {
    border-color: rgba(30, 41, 59, 0.1);
}

.participant-chip.is-active {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(59, 130, 246, 0.16);
    box-shadow: 0 12px 30px rgba(255, 252, 243, 0.22);
}

.participant-chip.is-active .participant-status {
    background: #22c55e;
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.12);
    animation: speakerPulse 1.5s ease-in-out infinite;
}

.participant-copy {
    min-width: 0;
    overflow: hidden;
}

.participant-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-role {
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.chat-container {
    flex-grow: 1;
    min-height: 0;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}
.chat-container::-webkit-scrollbar-thumb {
    background: rgba(30, 41, 59, 0.1);
    border-radius: 10px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

.msg-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 12px;
}

.msg-content {
    background: rgba(245, 234, 226, 0.6);
    padding: 14px 18px;
    border-radius: 0 16px 16px 16px;
    font-size: 15px;
    line-height: 1.6;
    color: #1e293b;
    border: 1px solid rgba(30, 41, 59, 0.05);
    max-width: 90%;
}

.msg-name {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}

.msg-name span {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.message.role-professor .msg-content {
    border-color: rgba(96, 165, 250, 0.18);
    box-shadow: 0 10px 28px rgba(255, 252, 243, 0.24);
}

.message.role-student .msg-content {
    background: rgba(236, 226, 216, 0.72);
}

.message.role-student .msg-name {
    color: #9f1239;
}

/* 玩家自己发的消息 */
.message.player {
    flex-direction: row-reverse;
}
.message.player .msg-content {
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.96), rgba(224, 242, 254, 0.94));
    border-radius: 16px 0 16px 16px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.16);
    color: #1e293b;
}

.message.player .msg-name {
    color: #1d4ed8;
}

.message.player .msg-name span {
    color: #334155;
}

/* 系统通知 */
.system-msg {
    justify-content: center;
    width: 100%;
}
.system-msg span {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.4);
    padding: 4px 12px;
    border-radius: 20px;
    color: var(--text-secondary);
}

/* 操作选项�?*/
.action-area {
    padding: 16px 24px;
    background: rgba(255, 252, 243, 0.8);
    border-top: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    flex-shrink: 0;
}

.action-btn {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(30, 41, 59, 0.03);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn:hover {
    background: rgba(30, 41, 59, 0.1);
    border-color: rgba(30, 41, 59, 0.2);
    transform: translateY(-2px);
}

.action-btn.primary {
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.98), rgba(204, 251, 241, 0.94));
    border: 1px solid rgba(37, 99, 235, 0.22);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.14);
    color: #1e3a8a;
    justify-content: center;
    text-align: center;
}

.action-btn.primary:hover {
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.18);
    filter: brightness(1.02);
}

.case-index-panel,
.case-board {
    border-radius: var(--radius-lg);
}

.panel-kicker {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #4338ca;
}

.case-foot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.meta-chip,
.signal-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.meta-chip {
    padding: 8px 12px;
    background: rgba(255, 252, 243, 0.78);
    border: 1px solid rgba(30, 41, 59, 0.08);
    color: #1e293b;
}

.meta-chip-soft {
    background: rgba(14, 165, 233, 0.12);
    color: #1e293b;
    border-color: rgba(14, 165, 233, 0.24);
}

.detective-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(228px, 292px);
    gap: 16px;
    min-height: 0;
    flex: 1 1 auto;
}

.case-index-panel,
.case-board {
    min-height: 0;
    overflow: hidden;
}

.case-index-panel {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: rgba(255, 255, 255, 0.72);
    transition: padding 0.22s ease, width 0.22s ease, background 0.22s ease;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-header-copy {
    min-width: 0;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 {
    font-family: var(--font-heading);
    font-size: 17px;
    margin-top: 3px;
}

.panel-count {
    min-width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(49, 46, 129, 0.18);
    color: #4338ca;
    font-weight: 800;
    border: 1px solid rgba(49, 46, 129, 0.24);
}

.case-index-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 251, 246, 0.86);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.case-index-toggle:hover {
    border-color: rgba(148, 163, 184, 0.34);
    background: rgba(253, 244, 237, 0.88);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(255, 255, 255, 0.24);
}

.case-index-toggle-icon {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid rgba(30, 41, 59, 0.82);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.08), rgba(30, 41, 59, 0.02));
    display: block;
}

.toggle-icon-rail,
.toggle-icon-panel {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    transition: transform 0.18s ease, opacity 0.18s ease, left 0.18s ease, right 0.18s ease;
}

.toggle-icon-rail {
    right: 2px;
    width: 4px;
    background: rgba(30, 41, 59, 0.82);
}

.toggle-icon-panel {
    left: 2px;
    right: 7px;
    background: rgba(30, 41, 59, 0.14);
}

.case-index-toggle.is-collapsed .toggle-icon-rail {
    right: auto;
    left: 2px;
}

.case-index-toggle.is-collapsed .toggle-icon-panel {
    left: 7px;
    right: 2px;
}

.case-index {
    display: flex;
    flex-direction: column;
    gap: 9px;
    overflow-y: auto;
    padding-right: 4px;
}

.case-index::-webkit-scrollbar,
.case-board::-webkit-scrollbar {
    width: 8px;
}

.case-index::-webkit-scrollbar-thumb,
.case-board::-webkit-scrollbar-thumb {
    background: rgba(30, 41, 59, 0.14);
    border-radius: 999px;
}

.case-index-card {
    width: 100%;
    text-align: left;
    border-radius: 18px;
    padding: 12px 12px 10px;
    background: linear-gradient(180deg, rgba(255, 252, 243, 0.78), rgba(255, 255, 255, 0.78));
    border: 1px solid rgba(30, 41, 59, 0.08);
    color: var(--text-primary);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.case-index-card:hover {
    transform: translateY(-3px);
    border-color: rgba(67, 56, 202, 0.24);
    box-shadow: 0 18px 40px rgba(255, 255, 255, 0.24);
}

.case-index-card.is-selected {
    border-color: rgba(67, 56, 202, 0.36);
    box-shadow: 0 0 0 1px rgba(67, 56, 202, 0.16) inset, 0 20px 42px rgba(255, 255, 255, 0.26);
    transform: translateY(-2px);
}

.case-index-card h4 {
    font-size: 15px;
    margin: 8px 0 6px;
    line-height: 1.2;
}

.case-index-card p {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.6;
    min-height: 0;
}

.case-index-top {
    justify-content: space-between;
    align-items: center;
}

.case-index-order {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1e293b;
    opacity: 0.72;
}

.case-index-badge {
    font-size: 11px;
    font-weight: 800;
    color: #4338ca;
    background: rgba(49, 46, 129, 0.12);
    border: 1px solid rgba(49, 46, 129, 0.18);
    padding: 4px 8px;
    border-radius: 999px;
}

.case-board {
    padding: 0;
    background: rgba(255, 255, 255, 0.76);
    overflow-y: auto;
    min-height: 74vh;
}

.case-detail-shell {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.case-detective-view.is-index-collapsed .detective-grid {
    grid-template-columns: minmax(0, 1fr) 94px;
}

.case-detective-view.is-index-collapsed .case-index-panel {
    padding: 14px 10px;
}

.case-detective-view.is-index-collapsed .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.case-detective-view.is-index-collapsed .panel-header-copy h3,
.case-detective-view.is-index-collapsed .panel-header-copy .panel-kicker,
.case-detective-view.is-index-collapsed .case-index-card h4,
.case-detective-view.is-index-collapsed .case-index-card p,
.case-detective-view.is-index-collapsed .case-index-badge,
.case-detective-view.is-index-collapsed .case-progress-meta {
    display: none;
}

.case-detective-view.is-index-collapsed .panel-header-actions {
    flex-direction: column;
    align-items: stretch;
}

.case-detective-view.is-index-collapsed .case-index-toggle {
    width: 100%;
    padding: 0 8px;
    font-size: 11px;
}

.case-detective-view.is-index-collapsed .panel-count {
    width: 100%;
}

.case-detective-view.is-index-collapsed .case-index {
    gap: 8px;
    padding-right: 0;
}

.case-detective-view.is-index-collapsed .case-index-card {
    padding: 12px 8px;
    text-align: center;
}

.case-detective-view.is-index-collapsed .case-index-top {
    justify-content: center;
}

.case-detective-view.is-index-collapsed .case-index-order {
    font-size: 12px;
    letter-spacing: 0.08em;
}

.case-detective-view.is-index-collapsed .case-progress {
    margin-top: 8px;
}

.case-detective-view.is-index-collapsed .case-progress-track {
    width: 100%;
}

.case-board-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.case-board-header h3 {
    font-family: var(--font-heading);
    font-size: clamp(20px, 2vw, 28px);
    line-height: 1.1;
    margin-top: 8px;
}

.stage-rail {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
}

.stage-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    border: 1px solid rgba(30, 41, 59, 0.08);
}

.stage-dot.is-live {
    background: rgba(49, 46, 129, 0.95);
    box-shadow: 0 0 0 6px rgba(49, 46, 129, 0.12);
}

.stage-dot.is-solved {
    background: rgba(16, 185, 129, 0.95);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.1);
}

.stage-dot.is-locked {
    background: rgba(148, 163, 184, 0.35);
}

.case-question-panel {
    border-radius: 22px;
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 252, 243, 0.8), rgba(255, 255, 255, 0.85));
    border: 1px solid rgba(30, 41, 59, 0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.question-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #4338ca;
}

.question-prompt {
    font-size: 18px;
    line-height: 1.65;
    color: #1e293b;
}

.option-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.choice-btn {
    padding: 14px 16px;
    align-items: center;
    gap: 12px;
    text-align: left;
    border-radius: 18px;
    background: rgba(30, 41, 59, 0.04);
    border: 1px solid rgba(30, 41, 59, 0.08);
}

.choice-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(67, 56, 202, 0.24);
}

.choice-btn.is-correct {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(255, 252, 243, 0.76));
    border-color: rgba(16, 185, 129, 0.34);
}

.choice-btn.is-wrong {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(255, 252, 243, 0.76));
    border-color: rgba(239, 68, 68, 0.26);
}

.choice-label {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(67, 56, 202, 0.12);
    color: #4338ca;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.choice-copy {
    flex: 1 1 auto;
    color: #1e293b;
    line-height: 1.5;
    font-size: 14px;
}

.question-helper {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.case-detail-shell.tone-blue,
.case-index-card.tone-blue {
    --case-accent: #60a5fa;
    --case-soft: rgba(96, 165, 250, 0.12);
}
.case-detail-shell.tone-violet,
.case-index-card.tone-violet {
    --case-accent: #a78bfa;
    --case-soft: rgba(167, 139, 250, 0.12);
}
.case-detail-shell.tone-cyan,
.case-index-card.tone-cyan {
    --case-accent: #22d3ee;
    --case-soft: rgba(34, 211, 238, 0.12);
}
.case-detail-shell.tone-teal,
.case-index-card.tone-teal {
    --case-accent: #2dd4bf;
    --case-soft: rgba(45, 212, 191, 0.12);
}
.case-detail-shell.tone-magenta,
.case-index-card.tone-magenta {
    --case-accent: #f472b6;
    --case-soft: rgba(244, 114, 182, 0.12);
}
.case-detail-shell.tone-orange,
.case-index-card.tone-orange {
    --case-accent: #fb923c;
    --case-soft: rgba(251, 146, 60, 0.12);
}
.case-detail-shell.tone-amber,
.case-index-card.tone-amber {
    --case-accent: #4338ca;
    --case-soft: rgba(49, 46, 129, 0.12);
}
.case-detail-shell.tone-green,
.case-index-card.tone-green {
    --case-accent: #34d399;
    --case-soft: rgba(52, 211, 153, 0.12);
}

.case-signal-grid,
.case-foot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.feedback-shell {
    border-radius: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 252, 243, 0.74);
    box-shadow: inset 0 0 0 1px rgba(30, 41, 59, 0.02);
}

.feedback-shell.tone-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(255, 252, 243, 0.78));
    border-color: rgba(16, 185, 129, 0.28);
}

.feedback-shell.tone-warning {
    background: linear-gradient(135deg, rgba(49, 46, 129, 0.16), rgba(255, 252, 243, 0.78));
    border-color: rgba(49, 46, 129, 0.28);
}

.feedback-shell.tone-choice {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(255, 252, 243, 0.78));
    border-color: rgba(59, 130, 246, 0.28);
}

.feedback-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 4px;
}

.stage-solved-text {
    line-height: 1.65;
    color: #1e293b;
    font-size: 13px;
}

.stage-solved-text {
    color: #1e293b;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(16, 185, 129, 0.1);
    margin-bottom: 12px;
}

.signal-panel,
.foot-card {
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 252, 243, 0.74), rgba(255, 255, 255, 0.8));
    border: 1px solid rgba(30, 41, 59, 0.07);
    padding: 16px;
}

.signal-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.signal-chip {
    padding: 10px 12px;
    background: rgba(30, 41, 59, 0.04);
    color: #1e293b;
    border: 1px solid rgba(30, 41, 59, 0.06);
    line-height: 1.4;
}

.mechanism-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.mechanism-steps li {
    display: flex;
    gap: 12px;
    color: #1e293b;
    line-height: 1.6;
}

.mechanism-steps li span {
    min-width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--case-soft, rgba(49, 46, 129, 0.12));
    color: var(--case-accent, #4338ca);
    font-size: 11px;
    font-weight: 800;
}

.case-foot-grid {
    align-items: stretch;
}

.case-replay-panel {
    border-radius: 20px;
    padding: 16px 18px;
    background: rgba(255, 252, 243, 0.72);
    border: 1px solid rgba(30, 41, 59, 0.07);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.case-review-panel {
    border-radius: 20px;
    padding: 16px 18px;
    background: linear-gradient(180deg, rgba(255, 252, 243, 0.78), rgba(255, 255, 255, 0.8200000000000001));
    border: 1px solid rgba(30, 41, 59, 0.07);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.review-panel-head h4 {
    margin-top: 6px;
    font-size: 18px;
    color: #1e293b;
}

.review-toggle-btn {
    width: auto;
    min-width: 126px;
    justify-content: center;
    text-align: center;
}

.review-collapsed-copy {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.7;
}

.review-timeline {
    display: grid;
    gap: 12px;
}

.review-round-card {
    border-radius: 18px;
    padding: 16px;
    background: rgba(30, 41, 59, 0.03);
    border: 1px solid rgba(30, 41, 59, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-round-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.review-round-head h4 {
    flex: 1 1 auto;
    color: #1e293b;
    font-size: 16px;
    line-height: 1.4;
}

.review-round-index {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--case-soft, rgba(49, 46, 129, 0.12));
    color: var(--case-accent, #4338ca);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.review-round-prompt,
.review-copy p {
    color: #1e293b;
    line-height: 1.7;
}

.review-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.review-copy {
    display: grid;
    gap: 8px;
}

.case-replay-panel p {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.replay-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.foot-card p,
.foot-card li {
    color: #1e293b;
    line-height: 1.7;
}

.foot-card ul {
    padding-left: 16px;
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.empty-state {
    padding: 24px;
    color: var(--text-secondary);
}

@media (max-width: 1100px) {
    .detective-grid,
    .case-signal-grid,
    .case-foot-grid {
        grid-template-columns: 1fr;
    }

    .case-index-toggle {
        width: 40px;
    }

    .case-detective-view.is-index-collapsed .detective-grid {
        grid-template-columns: 1fr;
    }

    .case-detective-view.is-index-collapsed .case-index-panel {
        padding: 16px;
    }

    .case-detective-view.is-index-collapsed .panel-header {
        flex-direction: row;
        align-items: flex-start;
    }

    .case-detective-view.is-index-collapsed .panel-header-copy h3,
    .case-detective-view.is-index-collapsed .panel-header-copy .panel-kicker,
    .case-detective-view.is-index-collapsed .case-index-card h4,
    .case-detective-view.is-index-collapsed .case-index-card p,
    .case-detective-view.is-index-collapsed .case-index-badge,
    .case-detective-view.is-index-collapsed .case-progress-meta {
        display: revert;
    }

    .case-detective-view.is-index-collapsed .panel-header-actions {
        flex-direction: row;
        align-items: center;
    }

    .case-detective-view.is-index-collapsed .case-index-card {
        text-align: left;
        padding: 12px 12px 10px;
    }

    .case-detective-view.is-index-collapsed .case-index-top {
        justify-content: space-between;
    }

    .case-board-header {
        flex-direction: column;
    }

    .review-panel-head,
    .review-round-head {
        flex-direction: column;
        align-items: stretch;
    }

    .review-toggle-btn {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .main-content {
        overflow: auto;
    }

.case-detective-view {
        min-height: auto;
    }

    .top-bar {
        height: auto;
        padding: 16px 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .top-bar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .lesson-switcher {
        min-width: 100%;
    }

    .visualization-stage {
        min-height: 640px;
        padding: 22px 16px 232px;
    }

    .caption-box {
        inset: 22px 16px 208px;
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "media"
            "body";
        row-gap: 14px;
    }

    .caption-box:has(.viz-figure),
    .caption-box.has-figure {
        inset: 22px 16px 208px;
        grid-template-columns: 1fr;
    }

.caption-box .viz-emblem,
    .caption-box .viz-figure,
    .caption-box > img,
    .caption-box > svg {
        justify-self: start;
    }

    .interactive-cards {
        left: 12px;
        right: 12px;
        bottom: 16px;
        width: auto;
        transform: none;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .whiteboard-history-btn {
        width: 34px;
        height: 48px;
        border-radius: 12px;
    }

    .whiteboard-history-prev {
        left: 6px;
    }

    .whiteboard-history-next {
        right: 6px;
    }

    .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box,
    .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box.has-figure,
    .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box.figure-atlas-caption {
        left: 46px;
        right: 46px;
    }

    .viz-emblem {
        width: 92px;
        height: 92px;
        border-radius: 24px;
        font-size: 22px;
    }

    .caption-box .viz-figure {
        width: min(100%, 320px);
        max-height: 220px;
        justify-self: start;
        align-self: start;
    }

    .caption-box.figure-atlas-caption {
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
    }

    .caption-box.figure-atlas-caption .figure-atlas-image {
        width: 100%;
        height: auto;
        max-height: 240px;
    }
}

/* 助手浮窗 (小疫) */
.assistant-popup {
    position: absolute;
    top: 60px;
    right: 20px;
    left: auto;
    bottom: auto;
    width: clamp(292px, 31vw, 344px);
    height: 184px;
    background: rgba(16, 185, 129, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 30px rgba(255, 255, 255, 0.4), 0 0 0 1px rgba(16, 185, 129, 0.2) inset;
    overflow: hidden;
    z-index: 100;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.popup-header {
    background: rgba(16, 185, 129, 0.2);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #1e293b;
    color: #064e3b;
}

.popup-header img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

.popup-body {
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #064e3b;
    overflow: hidden;
}

.popup-body strong {
    color: #047857;
}

.assistant-popup-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    align-items: stretch;
    height: calc(100% - 49px);
    min-height: 0;
}

.popup-body {
    min-width: 0;
    min-height: 0;
    padding: 0;
}

.assistant-popup-timeline {
    border-left: 1px solid rgba(16, 185, 129, 0.16);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(236, 253, 245, 0.3));
    padding: 10px 6px;
    min-height: 0;
}

.assistant-note-axis {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    justify-items: center;
}

.assistant-note-axis-track {
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 0;
}

.assistant-note-axis-seq {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: rgba(6, 95, 70, 0.62);
}

.assistant-note-history-range {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    width: 24px;
    height: 72px;
    writing-mode: bt-lr;
    accent-color: #059669;
    cursor: pointer;
}

.assistant-note-axis-meta {
    display: grid;
    place-items: center;
    color: #065f46;
    font-size: 15px;
    line-height: 1;
    font-weight: 800;
}

.assistant-note-viewport {
    position: relative;
    height: 100%;
    overflow: hidden;
    padding: 14px;
}

.assistant-note-rail {
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.assistant-note-card {
    flex: 0 0 auto;
    min-height: 0;
    opacity: 0.58;
    transition: opacity 0.18s ease;
}

.assistant-note-card.is-active {
    opacity: 1;
}

.assistant-note-card-content {
    height: 100%;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
    color: #064e3b;
    padding-right: 4px;
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.assistant-note-card-content strong {
    color: #047857;
}

/* ============================================
   Knowledge Map v2 - Visual Graph Redesign
   ============================================ */
.knowledge-map-view {
    gap: 14px;
}

.knowledge-map-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.8fr);
    gap: 14px;
}

@media (max-width: 1260px) {
    .knowledge-map-grid {
        grid-template-columns: 1fr;
    }

}


/* ============================================
   Knowledge Map v3 - Clean Mindmap Layout
   ============================================ */
.knowledge-map-view {
    gap: 12px;
}

.knowledge-map-view.is-expanded,
.knowledge-map-view:fullscreen {
    position: fixed;
    inset: 10px 12px;
    z-index: 220;
    padding: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.885), rgba(255, 255, 255, 0.89));
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(255, 255, 255, 0.56);
}

.knowledge-map-view:fullscreen {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: auto;
    padding: 18px;
    border-radius: 0;
    box-shadow: none;
}

.knowledge-map-view.is-expanded .knowledge-map-grid,
.knowledge-map-view:fullscreen .knowledge-map-grid {
    grid-template-columns: minmax(0, 1.82fr) 330px;
}

.knowledge-map-grid {
    grid-template-columns: minmax(0, 1.9fr) 320px;
    gap: 12px;
}

.knowledge-stage-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 12px;
    border-radius: 24px;
}

.knowledge-stage-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.knowledge-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.km-tab-btn,
.knowledge-expand-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(30, 41, 59, 0.04);
    color: #1e293b;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.km-tab-btn {
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.km-tab-btn:hover,
.knowledge-expand-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.26);
}

.km-tab-btn.is-active {
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.18), rgba(59, 130, 246, 0.16));
    border-color: rgba(67, 56, 202, 0.32);
    color: #1e293b;
}

.knowledge-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.knowledge-stage-board {
    position: relative;
    flex: 1 1 auto;
    min-height: 690px;
    overflow: auto;
    border-radius: 22px;
    border: 1px solid rgba(30, 41, 59, 0.06);
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 252, 243, 0.85), rgba(255, 255, 255, 0.89)),
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
    background-size: auto, 30px 30px, 30px 30px;
}

.km-board-frame {
    position: relative;
    width: 100%;
    min-height: 500px;
}

.knowledge-map-view.is-expanded .km-board-frame,
.knowledge-map-view:fullscreen .km-board-frame {
    min-height: 500px;
}

.knowledge-map-view:fullscreen .knowledge-stage-board {
    min-height: calc(100vh - 232px);
}

.km-graph-svg,
.km-graph-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.km-graph-svg {
    pointer-events: none;
}

.km-graph-edge {
    fill: none;
    stroke: rgba(148, 163, 184, 0.16);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke 0.18s ease, stroke-width 0.18s ease, opacity 0.18s ease;
}

.km-graph-edge.is-active {
    stroke: rgba(67, 56, 202, 0.7);
    stroke-width: 3.4;
}

.km-node {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    transform: translate(-50%, -50%);
    min-width: 96px;
    max-width: 230px;
    padding: 12px 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 253, 245, 0.8200000000000001), rgba(255, 255, 255, 0.88));
    border: 1px solid rgba(30, 41, 59, 0.08);
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(255, 255, 255, 0.34);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.km-node.is-expandable::after {
    content: '';
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(67, 56, 202, 0.3);
    box-shadow: 0 0 0 4px rgba(67, 56, 202, 0.08);
}

.km-node:hover {
    transform: translate(-50%, -50%) scale(1.03);
    border-color: rgba(96, 165, 250, 0.3);
}

.km-node.is-root {
    min-width: 170px;
    max-width: 250px;
    padding: 18px 20px;
    border-radius: 26px;
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.2), rgba(251, 241, 228, 0.86));
    border-color: rgba(67, 56, 202, 0.34);
}

.km-node.is-active {
    border-color: rgba(67, 56, 202, 0.46);
    box-shadow: 0 16px 36px rgba(255, 255, 255, 0.46), 0 0 0 1px rgba(67, 56, 202, 0.14) inset;
}

.km-node.is-linked:not(.is-active) {
    border-color: rgba(34, 211, 238, 0.26);
}

.km-node.is-branch-open::after {
    background: rgba(67, 56, 202, 0.78);
    box-shadow: 0 0 0 4px rgba(67, 56, 202, 0.14);
}

.km-node span {
    display: block;
    font-size: calc(14px * var(--node-font-scale, 1));
    font-weight: 800;
    line-height: 1.22;
    text-align: center;
    text-wrap: balance;
    word-break: break-word;
}

.km-node.is-root span {
    font-family: var(--font-heading);
    font-size: calc(24px * var(--node-font-scale, 1));
    line-height: 1.02;
}

.km-measure-lab {
    position: absolute;
    left: -99999px;
    top: 0;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* 量卡片用的替身：只抵消定位，宽度约束必须和真卡片一模一样。
   原来这里写了 min-width:0 / max-width:230px，把 .is-root 的 min-width:170px
   和手机上的 max-width:180px 都盖掉了 —— 量出来 64px、画出来 170px，
   根节点就顶到画框外面去了（手机上 4~19px 的裁字都出在这里）。 */
.km-node.is-measuring {
    position: static;
    transform: none;
    width: auto !important;
    min-height: auto !important;
    margin-bottom: 10px;
}

.km-node.is-measuring:hover {
    transform: none;
}

@media (max-width: 1320px) {
    .knowledge-map-grid {
        grid-template-columns: 1fr;
    }

    .knowledge-map-view.is-expanded .knowledge-map-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .knowledge-stage-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .knowledge-tabs {
        width: 100%;
    }

    .km-tab-btn {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ============================================
   Practice Arena - 实战演练
   ============================================ */
.practice-arena-view {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    padding-bottom: 4px;
}

.practice-arena-view::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(56, 189, 248, 0.16), transparent 28%),
        radial-gradient(circle at 84% 16%, rgba(236, 72, 153, 0.11), transparent 24%),
        radial-gradient(circle at 62% 96%, rgba(59, 130, 246, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.87), rgba(255, 255, 255, 0.9));
    pointer-events: none;
    z-index: -2;
}

.practice-arena-view::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: radial-gradient(circle at 50% 40%, rgba(30, 41, 59, 0.62), transparent 88%);
    pointer-events: none;
    z-index: -1;
}

.practice-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.85fr);
    gap: 12px;
    min-height: 0;
    flex: 1 1 auto;
}

.practice-stage-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 12px;
    border-radius: 24px;
}

.practice-stage-board {
    position: relative;
    flex: 1 1 auto;
    min-height: 600px;
    overflow: auto;
    border-radius: 22px;
    border: 1px solid rgba(30, 41, 59, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.9));
    padding: 20px;
    padding-bottom: 92px;
}

.practice-board-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(252, 165, 165, 0.36), transparent 30%),
        radial-gradient(circle at 72% 20%, rgba(196, 181, 253, 0.42), transparent 36%),
        radial-gradient(circle at 36% 76%, rgba(125, 211, 252, 0.34), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.16));
    pointer-events: none;
}

.practice-question-card {
    position: relative;
    z-index: 1;
    max-width: 580px;
    margin: 10px auto;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    box-shadow: 0 18px 42px rgba(255, 255, 255, 0.42);
    padding: 24px;
}

.practice-question-head h3 {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    margin-top: 8px;
}

.practice-question-type {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(67, 56, 202, 0.12);
    border: 1px solid rgba(67, 56, 202, 0.2);
    color: #4338ca;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.practice-question-head p {
    margin-top: 12px;
    color: rgba(30, 41, 59, 0.8);
    line-height: 1.8;
    font-size: 14px;
}

.practice-option-list {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.practice-option {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    text-align: left;
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(255, 255, 255, 0.8);
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    color: #1e293b;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.practice-option:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.32);
}

.practice-option-key {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    color: rgba(30, 41, 59, 0.74);
    background: rgba(148, 163, 184, 0.16);
}

.practice-option-copy {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.practice-option.is-selected {
    border-color: rgba(59, 130, 246, 0.44);
    background: rgba(191, 219, 254, 0.36);
}

.practice-option.is-correct {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(167, 243, 208, 0.34);
}

.practice-option.is-wrong {
    border-color: rgba(239, 68, 68, 0.46);
    background: rgba(254, 202, 202, 0.36);
}

.practice-option.is-muted {
    opacity: 0.7;
}

.practice-question-hint {
    margin-top: 14px;
    color: rgba(71, 85, 105, 0.9);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.practice-inspector-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    padding: 14px;
    border-radius: 24px;
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.9)),
        rgba(255, 252, 243, 0.82);
}

.practice-inspector-kicker {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(67, 56, 202, 0.86);
}

.practice-inspector-shell h3 {
    font-family: var(--font-heading);
    font-size: clamp(28px, 2.2vw, 42px);
    line-height: 1.02;
}

.practice-type-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.practice-type-pill {
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(30, 41, 59, 0.04);
    color: #1e293b;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.practice-type-pill.is-active {
    border-color: rgba(67, 56, 202, 0.28);
    background: rgba(67, 56, 202, 0.12);
    color: #4338ca;
}

.practice-type-pill.is-disabled {
    opacity: 0.52;
}

.practice-explain-card {
    border-radius: 20px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(30, 41, 59, 0.03);
    padding: 14px;
    color: #1e293b;
    line-height: 1.75;
    font-size: 14px;
}

.practice-explain-card.is-correct {
    border-color: rgba(16, 185, 129, 0.32);
    background: rgba(167, 243, 208, 0.24);
}

.practice-explain-card.is-wrong {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(254, 202, 202, 0.24);
}

.practice-explain-result {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.practice-inspector-note {
    color: rgba(71, 85, 105, 0.86);
    font-size: 12px;
    line-height: 1.7;
}

@media (max-width: 1300px) {
    .practice-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .practice-stage-board {
        min-height: 540px;
    }

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

/* Practice Arena Enhancements: mode + question type + navigation */
.practice-mode-tabs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.practice-mode-tab {
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(30, 41, 59, 0.04);
    color: #1e293b;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.practice-mode-tab:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.3);
}

.practice-mode-tab.is-active {
    border-color: rgba(67, 56, 202, 0.32);
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.15), rgba(59, 130, 246, 0.15));
    color: #4338ca;
}

#practiceChapterSwitcher.is-hidden {
    display: none;
}

#practiceExamSwitcher.is-hidden {
    display: none;
}

/* 实战演练的控件住在顶栏（决策 #066）：原来的模式横幅和带「最大化」的题型条
   都拆掉了，模式按钮和章节/试卷下拉排成一行。
   下拉框外面套着带「章节切换」小标签的框（和课堂的「课程切换」同款），
   按钮要和框里的 select 对齐而不是和框对齐：底边让出框的内边距 6px + 边框 1px，
   高度与 select 的 37px 一致。 */
.practice-top-controls {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.practice-top-controls .practice-mode-tabs {
    margin-bottom: 7px;
}

.practice-top-controls .practice-mode-tab {
    min-height: 37px;
}

.practice-board-nav {
    position: sticky;
    bottom: 12px;
    z-index: 3;
    max-width: 580px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
}

.practice-type-pill {
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.practice-type-pill:hover:not(.is-disabled) {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.3);
}

.practice-nav-btn,
.practice-reveal-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(30, 41, 59, 0.04);
    color: #1e293b;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.practice-nav-btn:hover:not(:disabled),
.practice-reveal-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.3);
}

.practice-nav-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.practice-written-actions {
    margin-top: 16px;
}

.practice-reference-card {
    margin-top: 14px;
    border-radius: 16px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.82);
    padding: 14px;
}

.practice-reference-card h4 {
    font-size: 13px;
    margin-top: 0;
    margin-bottom: 6px;
    color: #1e293b;
}

.practice-reference-card h4 + h4 {
    margin-top: 12px;
}

.practice-reference-card p,
.practice-reference-card li {
    white-space: pre-line;
    color: rgba(30, 41, 59, 0.86);
    line-height: 1.75;
    font-size: 13px;
}

.practice-reference-card ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 4px;
}

.practice-explain-card ul {
    margin: 8px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 4px;
}

.practice-point-grid {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.practice-point-card {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    text-align: left;
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(255, 255, 255, 0.8);
    padding: 11px 12px;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.practice-point-card:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.32);
}

.practice-point-card:disabled {
    cursor: default;
}

.practice-point-card .practice-point-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.practice-point-kind {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(30, 41, 59, 0.72);
    background: rgba(148, 163, 184, 0.15);
}

.practice-point-score {
    font-size: 11px;
    font-weight: 800;
    color: rgba(30, 41, 59, 0.74);
}

.practice-point-text {
    font-size: 13px;
    line-height: 1.6;
    color: #1e293b;
}

.practice-point-card.rubric .practice-point-kind {
    color: #0f766e;
    background: rgba(16, 185, 129, 0.14);
}

.practice-point-card.distractor .practice-point-kind {
    color: #b45309;
    background: rgba(245, 158, 11, 0.16);
}

.practice-point-card.is-selected {
    border-color: rgba(59, 130, 246, 0.42);
    background: rgba(191, 219, 254, 0.34);
}

.practice-point-card.rubric.is-correct {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(167, 243, 208, 0.32);
}

.practice-point-card.rubric.is-missed {
    border-color: rgba(239, 68, 68, 0.42);
    background: rgba(254, 226, 226, 0.34);
}

.practice-point-card.distractor.is-wrong {
    border-color: rgba(239, 68, 68, 0.46);
    background: rgba(254, 202, 202, 0.34);
}

.practice-point-card.distractor.is-safe {
    opacity: 0.72;
}

.practice-subjective-summary {
    margin-top: 12px;
    border-radius: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(30, 41, 59, 0.04);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    font-size: 13px;
}

.practice-subjective-summary.mastered {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(167, 243, 208, 0.28);
}

.practice-subjective-summary.basic {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(254, 240, 138, 0.28);
}

.practice-subjective-summary.needs-work {
    border-color: rgba(239, 68, 68, 0.34);
    background: rgba(254, 202, 202, 0.26);
}

.practice-explain-card.is-mastered {
    border-color: rgba(16, 185, 129, 0.36);
    background: rgba(167, 243, 208, 0.24);
}

.practice-explain-card.is-basic {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(254, 240, 138, 0.22);
}

.practice-explain-card.is-needs-work {
    border-color: rgba(239, 68, 68, 0.34);
    background: rgba(254, 202, 202, 0.24);
}

.practice-inspector-block {
    margin-top: 12px;
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.75);
    padding: 11px 12px;
}

.practice-inspector-block h4 {
    margin: 0;
    font-size: 13px;
    color: #1e293b;
}

.practice-inspector-block p {
    white-space: pre-line;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.7;
    color: rgba(30, 41, 59, 0.82);
}

.practice-inspector-block ul {
    margin: 8px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.practice-inspector-block li {
    font-size: 12px;
    color: rgba(30, 41, 59, 0.88);
    line-height: 1.7;
}

.practice-inspector-point-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.practice-inspector-point-head strong {
    font-size: 11px;
    color: #334155;
    white-space: nowrap;
}

.practice-inspector-block small {
    display: block;
    color: rgba(71, 85, 105, 0.86);
    font-size: 11px;
    margin-top: 3px;
}

.practice-empty-line {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(71, 85, 105, 0.8);
}

/* ============================================
   Production layout repair - Vercel shell pass
   ============================================ */
.main-content {
    overflow: auto;
    min-height: 0;
}

.knowledge-map-view,
.practice-arena-view {
    overflow: auto;
    min-height: 0;
    scrollbar-gutter: stable;
}

/* Immersive whiteboard: assistant notes float above content instead of shrinking it. */
.visualization-stage {
    min-height: clamp(520px, calc(100vh - 220px), 760px);
    overflow-y: auto;
    overflow-x: hidden;
    align-content: stretch;
}

.assistant-popup {
    z-index: 160;
    pointer-events: auto;
}

.blackboard-section.has-assistant-note .caption-box,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box {
    inset: 28px 24px 210px;
}

.blackboard-section.has-assistant-note .caption-box.has-figure,
.blackboard-section.has-assistant-note .caption-box:has(.viz-figure),
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.has-figure,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) {
    inset: 28px 24px 190px;
    grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "title title"
        "body media";
    column-gap: 22px;
}

.blackboard-section.has-assistant-note .caption-box.figure-atlas-caption,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption {
    inset: 24px 24px 184px;
    grid-template-columns: minmax(220px, 0.36fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "title title"
        "body media";
    column-gap: 22px;
}

.blackboard-section.has-assistant-note .caption-box.figure-atlas-caption p,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption p {
    max-height: none;
    overflow: auto;
}

.blackboard-section.has-assistant-note .caption-box .figure-atlas-image,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box .figure-atlas-image,
.caption-box.figure-atlas-caption .figure-atlas-image {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
}

.blackboard-section.has-assistant-note .caption-box.has-figure h3,
.blackboard-section.has-assistant-note .caption-box:has(.viz-figure) h3,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.has-figure h3,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) h3 {
    font-size: clamp(20px, 1.8vw, 30px);
}

.blackboard-section.has-assistant-note .caption-box.has-figure p,
.blackboard-section.has-assistant-note .caption-box:has(.viz-figure) p,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.has-figure p,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) p {
    font-size: clamp(13px, 1vw, 17px);
}

.blackboard-section.has-assistant-note .caption-box.has-figure .viz-figure,
.blackboard-section.has-assistant-note .caption-box:has(.viz-figure) .viz-figure,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.has-figure .viz-figure,
.blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) .viz-figure {
    width: min(100%, 360px);
    max-height: 250px;
    justify-self: center;
}

@media (max-width: 1180px) {
    .blackboard-section.has-assistant-note .caption-box.has-figure,
    .blackboard-section.has-assistant-note .caption-box:has(.viz-figure),
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.has-figure,
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
    .blackboard-section.has-assistant-note .caption-box.figure-atlas-caption,
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption,
    .caption-box.figure-atlas-caption {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
    }
}

/* Knowledge map: the mindmap owns the main canvas; explanation never covers it. */
.knowledge-map-view {
    display: flex;
    flex-direction: column;
}

.knowledge-map-grid,
.knowledge-map-view.is-expanded .knowledge-map-grid,
.knowledge-map-view:fullscreen .knowledge-map-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    overflow: visible;
}

.knowledge-stage-board {
    min-height: max(920px, calc(100vh - 120px));
    max-height: none;
    overflow: auto;
}

.knowledge-stage-shell {
    min-height: 1000px;
    flex: 0 0 auto;
    overflow: visible;
}

.knowledge-map-view.is-expanded .knowledge-stage-board,
.knowledge-map-view:fullscreen .knowledge-stage-board {
    min-height: calc(100vh - 230px);
}

.knowledge-map-view.is-expanded .knowledge-stage-shell,
.knowledge-map-view:fullscreen .knowledge-stage-shell {
    min-height: 0;
    height: 100%;
}

@media (min-width: 1500px) {
    .knowledge-map-view.is-expanded .knowledge-map-grid,
    .knowledge-map-view:fullscreen .knowledge-map-grid {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
        align-items: stretch;
        height: calc(100vh - 150px);
    }

}

/* Practice: question and explanation scroll independently; controls stay reachable. */
.practice-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    overflow: visible;
}

.practice-grid {
    flex: 0 0 auto;
    align-items: start;
}

.practice-stage-shell {
    height: auto;
    overflow: visible;
}

.practice-stage-board {
    flex: 0 0 auto;
    min-height: max(500px, calc(100vh - 340px));
    max-height: none;
    overflow: auto;
    padding-bottom: 120px;
}

.practice-question-card,
.practice-board-nav {
    max-width: min(760px, 100%);
}

.practice-board-nav {
    bottom: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.94);
}

.practice-inspector-shell {
    max-height: min(380px, 44vh);
    overflow: auto;
}

/* ============================================
   Learning reward status + practice/whiteboard repair
   ============================================ */
.stat-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.05;
}

.stat-copy strong {
    font-size: 14px;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
}

.stat-copy small {
    color: rgba(71, 85, 105, 0.76);
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.main-content:has(.practice-arena-view:not(.hidden)) {
    overflow: hidden;
}

.practice-arena-view:not(.hidden) {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-gutter: stable;
}

.practice-arena-view:not(.hidden) .practice-grid {
    min-height: auto;
}

@keyframes counterOrbitSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

/* ============================================
   Mobile and tablet responsive shell
   ============================================ */
html,
body {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

:root {
    --mobile-tab-height: 64px;
    --beian-footer-height: 32px;
}

@supports (height: 100dvh) {
    body,
    .app-shell {
        height: 100dvh;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --mobile-tab-height: 72px;
    }
}

@media (max-width: 1024px) {
    /* 顶栏移到 .app-shell 之后，它不再随 .main-content 一起滚动。
       把滚动容器提到 .app-shell：整列（顶栏 + 内容）一起滚，顶栏照旧能滑走，
       不会常驻占掉手机上好不容易腾出来的板面高度。 */
    .app-shell {
        padding: 8px 8px 0;
        gap: 8px;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-container {
        flex-direction: column;
        flex: 0 0 auto;
        min-height: 0;
        padding: 0;
        gap: 8px;
    }

    .main-content {
        width: 100%;
        min-width: 0;
        min-height: 0;
        overflow: visible;
        padding-bottom: calc(var(--mobile-tab-height) + var(--beian-footer-height) + env(safe-area-inset-bottom) + 12px);
    }

    .main-content:has(.practice-arena-view:not(.hidden)) {
        overflow: visible;
    }

    /* 小疫的入口是固定悬浮的，默认停在屏幕右下角；实战演练那条
       「上一题 / 下一题」是 sticky 的，两者会落在同一块地方。
       实测平板竖屏（820×1180）下「下一题」有 41% 压在小疫底下 ——
       学生按下去打开的是小疫，不是下一题，而这是做题时最常按的按钮。
       右侧留出小疫的宽度（约 104px）再加余量，让按钮停在它左边。
       写在 1024 这一档：手机和平板都会用到这条 sticky 导航。 */
    .practice-board-nav {
        padding-right: 132px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        width: 100%;
        height: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
        padding: 0 8px env(safe-area-inset-bottom);
        border-radius: 20px 20px 0 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        gap: 0;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    body.is-fullscreen-active .sidebar,
    body.is-fullscreen-active .user-profile.ix-account,
    body.is-fullscreen-active .top-bar,
    body.is-knowledge-expanded .sidebar,
    body.is-knowledge-expanded .user-profile.ix-account,
    body.is-knowledge-expanded .top-bar {
        display: none;
    }

    .logo {
        display: none;
    }

    .nav-links {
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        gap: 0;
    }

    .nav-links li {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 0;
        border-left: 0 !important;
        border-radius: 12px;
        font-size: 10px;
        text-align: center;
    }

    .nav-links li:hover {
        transform: none;
    }

    .nav-links li.active {
        border-left: 0 !important;
        background: rgba(67, 56, 202, 0.12);
        color: var(--accent-indigo);
    }

    .nav-links li i {
        font-size: 20px;
        line-height: 1;
    }

    .nav-links li span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 10px;
        line-height: 1.15;
    }

    .user-profile.ix-account {
        position: fixed;
        top: calc(10px + env(safe-area-inset-top));
        right: 10px;
        z-index: 260;
        display: block;
        width: 40px;
        height: 40px;
        margin: 0;
        pointer-events: none;
    }

    .ix-account-trigger {
        width: 40px;
        height: 40px;
        justify-content: center;
        padding: 0;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.82);
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
        pointer-events: auto;
    }

    .ix-account-avatar img {
        width: 32px;
        height: 32px;
    }

    .ix-account-copy,
    .ix-account-caret {
        display: none;
    }

    .ix-account-menu {
        position: fixed;
        top: calc(58px + env(safe-area-inset-top));
        right: 10px;
        left: auto;
        bottom: auto;
        width: min(220px, calc(100vw - 20px));
        z-index: 270;
        pointer-events: auto;
    }

    .assistant-popup {
        position: fixed;
        top: calc(58px + env(safe-area-inset-top));
        right: 12px;
        width: min(360px, calc(100vw - 24px));
        height: min(260px, 36dvh);
        z-index: 280;
        pointer-events: auto;
    }

.top-bar {
        padding-right: 58px;
    }

.case-detective-view,
    .knowledge-map-view,
    .practice-arena-view {
        min-width: 0;
        min-height: 0;
    }

    /* ---- hide sidebar guest buttons on mobile/tablet ---- */
    .ix-guest-actions {
        display: none !important;
    }

    /* show top-bar inline mobile guest buttons */
    .ix-guest-bar-mobile:not(.hidden) {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .ix-guest-bar-mobile .ix-mbtn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .action-btn {
        min-height: 44px;
        padding: 16px 18px;
        font-size: 15px;
    }

    .tools button {
        width: 44px;
        height: 44px;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .nav-links li i {
        font-size: 22px;
    }

    .nav-links li span {
        font-size: 11px;
    }

    .top-bar {
        height: auto;
        flex-wrap: wrap;
        padding: 12px 58px 12px 16px;
    }

    .lesson-switcher {
        min-width: auto;
    }

    .blackboard-section {
        flex: 0 0 auto;
        min-height: clamp(520px, 58dvh, 680px);
    }

    .dialogue-section {
        flex: 0 0 auto;
        min-height: 360px;
    }

    .classroom-area {
        flex-direction: column;
        overflow: auto;
        gap: 12px;
    }

    .visualization-stage {
        min-height: clamp(460px, 54dvh, 640px);
        padding-bottom: 150px;
    }

    /* ── Tablet whiteboard caption-box: give figures more room ── */
    .caption-box,
    .caption-box.has-figure,
    .caption-box.figure-atlas-caption {
        inset: 22px 18px 136px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
        row-gap: 12px;
    }

    .caption-box p {
        max-height: min(128px, 18dvh);
        overflow-y: auto;
    }

    .caption-box .viz-figure {
        width: min(100%, 400px);
        max-height: clamp(160px, 26dvh, 300px);
        justify-self: center;
        align-self: start;
    }

    .caption-box.figure-atlas-caption .figure-atlas-image,
    .caption-box .figure-atlas-image {
        width: min(100%, 420px);
        max-width: 100%;
        height: auto;
        max-height: clamp(190px, 30dvh, 340px);
        object-fit: contain;
        justify-self: center;
        align-self: center;
    }

    .interactive-cards {
        bottom: 12px;
    }

    .knowledge-stage-board {
        min-height: 600px;
    }

    .knowledge-stage-shell {
        min-height: auto;
    }
}

/* 手机端才出现的病例档案展开按钮，桌面隐藏 */
.case-index-mobile-toggle {
    display: none;
}

@media (max-width: 767px) {
    /* 内边距归外层：.app-container 现在只负责三栏排布 */
    .app-shell {
        padding: 6px 6px 0;
    }

    .top-bar {
        height: auto;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 58px 10px 12px;
        border-radius: 14px;
    }

    .course-info h2 {
        font-size: 16px;
        line-height: 1.2;
        max-width: calc(100vw - 92px);
    }

    .badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    .top-bar-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .lesson-switcher {
        min-width: 100%;
    }

    .stats {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    body.is-guest .stats {
        flex-wrap: nowrap;
    }

    body.is-guest .guest-learning-promise {
        flex: 1 1 auto;
    }

    .stat-item {
        padding: 6px 10px;
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .stat-copy strong {
        font-size: 12px;
    }

    .stat-copy small {
        font-size: 9px;
    }

    .classroom-area {
        flex-direction: column;
        overflow: auto;
        gap: 10px;
    }

    .blackboard-section {
        flex: 0 0 auto;
        min-height: clamp(360px, 56dvh, 520px);
        border-radius: 14px;
    }

    .dialogue-section {
        flex: 0 0 auto;
        min-height: 260px;
        border-radius: 14px;
    }

    .participants-panel {
        height: 48px;
        min-height: 48px;
        max-height: 48px;
    }

    .participants-strip {
        gap: 6px;
        padding: 6px 10px;
    }

    .participant-chip {
        min-width: 100px;
        max-width: 120px;
        padding: 6px 8px;
    }

    .participants-resizer {
        display: none;
    }

    .visualization-stage {
        min-height: clamp(380px, 54dvh, 520px);
        padding: 16px 12px 126px;
    }

    .classroom-entry {
        top: 16px;
        bottom: 16px;
        width: calc(100% - 24px);
        padding: 20px 18px;
        border-radius: 20px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .classroom-entry::before {
        border-radius: 20px 0 0 20px;
    }

    .classroom-entry h3 {
        max-width: none;
        margin: 8px 0 10px;
        font-size: clamp(17px, 4.4vw, 20px);
        line-height: 1.5;
    }

    .classroom-entry > p {
        font-size: 12px;
        line-height: 1.55;
    }

    .classroom-entry-meta {
        margin: 12px 0;
        gap: 5px;
    }

    .classroom-entry-meta span {
        min-height: 26px;
        padding: 0 8px;
        /* 9px 的中文在手机上基本看不清（这三个是「约 3 分钟 / 分支判断 /
           机制推演」，是学生判断这节要花多久的依据）。11px 仍然放得下。 */
        font-size: 11px;
    }

    .classroom-entry-button {
        width: 100%;
        min-height: 48px;
    }

    .classroom-entry-secondary {
        display: none;
    }

    .caption-box,
    .caption-box.has-figure,
    .caption-box.figure-atlas-caption {
        inset: 14px 12px 116px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
        row-gap: 8px;
        overflow: visible;
    }

    .caption-box h3 {
        font-size: 18px;
        line-height: 1.2;
    }

    .caption-box p {
        font-size: 13px;
        max-height: min(112px, 18dvh);
        overflow-y: auto;
    }

    /* ── Mobile whiteboard figures: vertically centered in the 1fr media area ── */
    .caption-box .viz-figure {
        width: min(100%, 320px);
        max-height: clamp(100px, 22dvh, 220px);
        justify-self: center;
        align-self: center;
    }

    .caption-box.figure-atlas-caption .figure-atlas-image,
    .caption-box .figure-atlas-image {
        width: min(100%, 340px);
        max-width: 100%;
        height: auto;
        max-height: clamp(132px, 26dvh, 240px);
        object-fit: contain;
        justify-self: center;
        align-self: center;
    }

    .interactive-cards {
        left: 12px;
        right: 12px;
        bottom: 10px;
        width: auto;
        transform: none;
        justify-content: flex-start;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .card {
        width: 120px;
        padding: 10px;
    }

    .chat-container {
        padding: 14px;
    }

    .action-area {
        padding: 10px 14px;
    }

    .assistant-popup {
        width: calc(100% - 24px);
        right: 12px;
        top: 50px;
        height: min(240px, 34dvh);
    }

    .assistant-popup-shell {
        grid-template-columns: minmax(0, 1fr) 52px;
    }

    .assistant-note-viewport {
        padding: 12px;
    }

    .assistant-note-history-range {
        height: 96px;
    }

    .knowledge-stage-board {
        min-height: 500px;
    }

    .knowledge-stage-shell {
        min-height: auto;
    }

    .knowledge-stage-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .km-tab-btn {
        flex: 1 1 auto;
        padding: 8px 10px;
        font-size: 11px;
        text-align: center;
    }

    .km-node {
        min-width: 80px;
        max-width: 180px;
        padding: 10px 12px;
    }

    .km-node span {
        font-size: 12px;
    }

    .km-node.is-root span {
        font-size: 18px;
    }

    /* 手机上两个模式按钮和下拉框挤在同一行，省下的高度留给题目。
       下拉框的小标签和外框都去掉：选项本身就写着「第几章 · 章名」/ 试卷名，
       外框的内边距在 390px 宽的屏上只会把章名挤成省略号。 */
    .practice-top-controls {
        width: 100%;
        align-items: center;
        gap: 6px;
    }

    .practice-top-controls .lesson-switcher {
        flex: 1 1 0;
        min-width: 0;
        padding: 0;
        border: 0;
        background: none;
    }

    .practice-top-controls .lesson-switcher span {
        display: none;
    }

    .practice-top-controls .lesson-switcher select {
        width: 100%;
        min-height: 36px;
        padding: 8px 10px;
        text-overflow: ellipsis;
    }

    .practice-top-controls .practice-mode-tabs {
        margin-bottom: 0;
    }

    .practice-top-controls .practice-mode-tab {
        min-height: 36px;
    }

    .practice-stage-shell {
        padding: 8px;
    }

    .practice-stage-board {
        min-height: 400px;
        padding: 12px;
        padding-bottom: 100px;
    }

    .practice-question-card {
        max-width: 100%;
        padding: 16px;
    }

    .practice-board-nav {
        max-width: 100%;
        /* 右边那一格不能省：上面 1024 那档给小疫让出的位置，写成 padding
           简写会把它清回 10px，「下一题」又会被小疫压住。 */
        padding: 10px 132px 10px 10px;
    }

    .practice-inspector-shell {
        max-height: none;
        overflow: visible;
    }

    .practice-option {
        padding: 10px 12px;
    }

.case-board {
        min-height: auto;
    }

    .practice-mode-tabs {
        flex: none;
        gap: 4px;
    }

    .practice-mode-tab {
        padding: 7px 8px;
        font-size: 11px;
    }

    /* Ensure the practice stage board has enough bottom padding above the tab bar */
    .practice-stage-board {
        min-height: 300px;
        padding-bottom: 20px;
    }

    /* ── Fix 2: Knowledge Map ── enable touch scroll on mind map board ── */
    .knowledge-stage-board {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
        min-height: 400px;
    }

    .km-board-frame {
        touch-action: pan-x pan-y;
    }

    .knowledge-stage-shell {
        min-height: 460px;
    }

    /* ── Fix 2b: Knowledge Map expanded/maximized ── mobile-optimized layout ── */
    .knowledge-map-view.is-expanded .knowledge-map-grid,
    .knowledge-map-view:fullscreen .knowledge-map-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .knowledge-map-view.is-expanded .knowledge-stage-shell,
    .knowledge-map-view:fullscreen .knowledge-stage-shell {
        min-height: calc(100dvh - 80px);
    }

    .knowledge-map-view.is-expanded .knowledge-stage-board,
    .knowledge-map-view:fullscreen .knowledge-stage-board {
        height: calc(100dvh - 140px);
        max-height: calc(100dvh - 140px);
        min-height: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    /* Auto-collapse case index panel on mobile */
    .case-index-panel {
        max-height: 0;
        overflow: hidden;
        padding: 0;
        opacity: 0;
        transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    }

    .case-detective-view.is-index-open .case-index-panel {
        max-height: 240px;
        padding: 12px;
        opacity: 1;
        overflow: auto;
    }

    /* Detective grid stacks vertically, case-board gets priority */
    .detective-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* case-board (推理�? takes all remaining space */
    .case-board {
        flex: 1 1 auto;
        overflow: auto;
        min-height: 0;
    }

    /* Add a mobile toggle for showing/hiding case-index */
    .case-index-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        padding: 8px;
        border: 1px solid rgba(30, 41, 59, 0.1);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.72);
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
    }

    .case-index-mobile-toggle i {
        font-size: 16px;
        transition: transform 0.2s ease;
    }

    .case-detective-view.is-index-open .case-index-mobile-toggle i {
        transform: rotate(180deg);
    }
}

@media (max-width: 767px) and (max-height: 700px) {
    .classroom-entry {
        padding: 14px;
    }

    .classroom-entry h3 {
        margin: 6px 0 12px;
        font-size: 17px;
        line-height: 1.45;
    }

    .classroom-entry > p,
    .classroom-entry-meta {
        display: none;
    }

    .classroom-entry-button {
        min-height: 44px;
    }
}

.classroom-starting {
    min-height: 46px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    background: rgba(219, 234, 254, 0.76);
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Desktop non-fullscreen: side-by-side map + inspector ── */
@media (min-width: 1025px) {
    /* Knowledge Map �?always two-column on desktop, matching fullscreen */
    .knowledge-map-grid,
    .knowledge-map-view.is-expanded .knowledge-map-grid,
    .knowledge-map-view:fullscreen .knowledge-map-grid {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
        align-items: stretch;
    }

    .knowledge-stage-shell {
        min-height: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    /* 画布的高度只能由外壳分配，不能自己用 min-height 顶出去。
       外壳是 overflow:hidden，画布一旦比外壳高，超出的那一截连同
       滚动终点一起被裁掉 —— 表现就是「滚动条已经拉到底，最后一行
       卡片还是缺一半」。1440x800 缺 37px，1280x720 缺 117px。
       改成填满外壳，画布自己的 overflow:auto 才真的能滚到底。 */
    .knowledge-stage-board,
    .knowledge-map-view.is-expanded .knowledge-stage-board,
    .knowledge-map-view:fullscreen .knowledge-stage-board {
        min-height: 0;
        height: 100%;
    }

    /* Practice Arena �?always two-column on desktop, matching fullscreen */
    .practice-grid {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
        align-items: stretch;
    }

    .practice-inspector-shell {
        max-height: none;
        height: 100%;
        overflow: auto;
    }

    .practice-stage-shell {
        height: 100%;
        overflow: hidden;
    }
}

/* ── Tablet breakpoint supplements (768�?024 px) ── */
@media (min-width: 768px) and (max-width: 1024px) {

    /* ─── Knowledge Map ─── */
    /* Touch scrolling */
    .knowledge-stage-board {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
        min-height: 500px;
    }

    .km-board-frame {
        touch-action: pan-x pan-y;
    }

    .knowledge-stage-shell {
        min-height: auto;
    }

    /* Inspector: give it proper readable height, not a compressed strip */
.case-board {
        min-height: auto;
    }

    /* Auto-collapse case index panel */
    .case-index-panel {
        max-height: 0;
        overflow: hidden;
        padding: 0;
        opacity: 0;
        transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    }

    .case-detective-view.is-index-open .case-index-panel {
        max-height: 240px;
        padding: 12px;
        opacity: 1;
        overflow: auto;
    }

    .detective-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .case-board {
        flex: 1 1 auto;
        overflow: auto;
        min-height: 0;
    }

    .case-index-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        padding: 8px;
        border: 1px solid rgba(30, 41, 59, 0.1);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.72);
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
    }

    .case-index-mobile-toggle i {
        font-size: 16px;
        transition: transform 0.2s ease;
    }

    .case-detective-view.is-index-open .case-index-mobile-toggle i {
        transform: rotate(180deg);
    }

    /* ─── Practice Arena ─── 顶栏里的模式按钮收小一号 ─── */
    .practice-mode-tabs {
        gap: 4px;
    }

    .practice-mode-tab {
        padding: 7px 10px;
        font-size: 11px;
    }

    .practice-stage-board {
        min-height: 400px;
        padding-bottom: 20px;
    }

    .practice-inspector-shell {
        max-height: none;
        overflow: visible;
    }
}

@media (max-height: 560px) and (pointer: coarse) {
    .top-bar {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .blackboard-section {
        min-height: 280px;
    }

    .dialogue-section {
        min-height: 200px;
    }
}

/* ── Mobile / Tablet fullscreen whiteboard: use full viewport for figures ── */
@media (max-width: 1024px) {
    .blackboard-section:fullscreen .visualization-stage,
    .blackboard-section.is-fullscreen .visualization-stage {
        min-height: 100dvh;
        padding: 14px 12px 130px;
    }

    .blackboard-section:fullscreen .caption-box,
    .blackboard-section.is-fullscreen .caption-box,
    .blackboard-section:fullscreen .caption-box.has-figure,
    .blackboard-section.is-fullscreen .caption-box.has-figure,
    .blackboard-section:fullscreen .caption-box.figure-atlas-caption,
    .blackboard-section.is-fullscreen .caption-box.figure-atlas-caption {
        inset: 14px 12px 120px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "title"
            "body"
            "media";
        overflow: visible;
    }

    .blackboard-section:fullscreen .caption-box p,
    .blackboard-section.is-fullscreen .caption-box p {
        max-height: 80px;
        overflow-y: auto;
    }

    .blackboard-section:fullscreen .caption-box .viz-figure,
    .blackboard-section.is-fullscreen .caption-box .viz-figure {
        width: min(100%, 480px);
        max-height: calc(100dvh - 320px);
        justify-self: center;
        align-self: center;
    }

    .blackboard-section:fullscreen .caption-box .figure-atlas-image,
    .blackboard-section.is-fullscreen .caption-box .figure-atlas-image {
        width: 100%;
        height: auto;
        max-height: calc(100dvh - 300px);
        object-fit: contain;
        justify-self: center;
        align-self: center;
    }

    .blackboard-section:fullscreen .interactive-cards,
    .blackboard-section.is-fullscreen .interactive-cards {
        bottom: 10px;
    }

    .blackboard-section:not(.has-assistant-note) .caption-box.has-figure .viz-figure,
    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box:has(.viz-figure) .viz-figure {
        justify-self: center;
        align-self: center;
    }

    .blackboard-section:not(.has-assistant-note) .caption-box.figure-atlas-caption .figure-atlas-image,
    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box.figure-atlas-caption .figure-atlas-image {
        width: min(100%, 420px);
        max-width: 100%;
        height: auto;
        max-height: clamp(132px, 30dvh, 340px);
        justify-self: center;
        align-self: center;
        object-fit: contain;
    }
}

/* ── Landscape phone: tighter padding, smaller cards ── */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
    .visualization-stage {
        min-height: clamp(260px, 80dvh, 400px);
        padding-bottom: 110px;
    }

    .caption-box,
    .caption-box.has-figure,
    .caption-box.figure-atlas-caption {
        inset: 10px 12px 100px;
        row-gap: 6px;
    }

    .caption-box h3 {
        font-size: 16px;
    }

    .caption-box p {
        font-size: 12px;
        max-height: 40px;
    }

    .caption-box .viz-figure {
        max-height: clamp(80px, 40dvh, 180px);
        align-self: center;
    }

    .caption-box .figure-atlas-image {
        max-height: clamp(90px, 44dvh, 200px);
        align-self: center;
    }

    .interactive-cards {
        bottom: 6px;
    }

    .card {
        width: 100px;
        padding: 8px;
    }
}

/* ── 备案信息 Footer ────────────────── */
.site-beian-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 6px 20px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(30, 41, 59, 0.06);
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

@media (max-width: 1024px) {
    .site-beian-footer {
        bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
        z-index: 190;
    }
}

.beian-team {
    font-weight: 600;
    color: #64748b;
}

.beian-divider {
    display: inline-block;
    width: 1px;
    height: 12px;
    background: rgba(148, 163, 184, 0.4);
    vertical-align: middle;
}

.beian-items {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.beian-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.18s ease;
}

.beian-link:hover {
    color: var(--accent-blue, #1d4ed8);
}

.beian-gongan-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Mobile: footer wraps neatly */
@media (max-width: 640px) {
    :root {
        --beian-footer-height: 52px;
    }

    .site-beian-footer {
        flex-direction: column;
        gap: 2px;
        padding: 6px 12px;
        font-size: 11px;
    }

    .beian-divider {
        display: none;
    }

    .beian-items {
        justify-content: center;
    }
}

@media (hover: none) {
.card:hover,
    .km-node:hover,
    .practice-option:hover,
    .nav-links li:hover {
        transform: none;
    }
}

/* Fix: touch devices (tablets) in desktop-mode - content clipped by overflow:hidden chain */
/* pointer:coarse detects touch devices, max-height:900px excludes large desktop touch monitors */
@media (pointer: coarse) and (max-height: 900px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    .app-shell {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .app-container {
        height: auto;
        min-height: 0;
    }

    .main-content {
        overflow: visible;
        min-height: 0;
    }

    .classroom-area {
        overflow: visible;
        flex-wrap: wrap;
    }

    .blackboard-section {
        min-height: 400px;
    }

    .dialogue-section {
        min-height: 300px;
    }
}

/* 上面那条 `flex-wrap: wrap` 是给**横向**课堂区准备的（平板、手机横屏：
   对话栏换到白板下面一行）。但手机竖屏（≤767px）上 .classroom-area 已经是
   `flex-direction: column` —— **column 容器上的 wrap 不是「换行」而是「换列」**：
   白板 min-height 400px + 对话 300px 超过容器高度，于是两块被排成**并排两列**，
   整页被撑到 520px 宽，而视口只有 390px。ch01 全 25 板横向溢出，改造前就存在，
   一直没被发现是因为走课脚本没开触屏模拟，`pointer: coarse` 这几条根本没被命中。
   column 下必须 nowrap，让两块老老实实上下排、整页纵向滚。 */
@media (pointer: coarse) and (max-height: 900px) and (max-width: 767px) {
    .classroom-area {
        flex-wrap: nowrap;
    }
}

/* Touch device whiteboard fallback background (avoid all-white when video poster fails) */
@media (pointer: coarse) {
    .hologram-effect {
        background: radial-gradient(
            circle at 50% 50%,
            rgba(147, 197, 253, 0.18),
            rgba(199, 210, 254, 0.12) 50%,
            transparent 70%
        );
    }
}

/* ==========================================================================
   Written answer mode + AI grading (practice arena)
   ========================================================================== */

.practice-written-modes {
    display: flex;
    gap: 8px;
    margin: 14px 0 4px;
    flex-wrap: wrap;
}

.practice-written-mode {
    appearance: none;
    -webkit-appearance: none;
    flex: 1 1 180px;
    min-width: 150px;
    text-align: left;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    display: grid;
    gap: 2px;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.practice-written-mode:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.36);
}

.practice-written-mode.is-active {
    border-color: rgba(59, 130, 246, 0.46);
    background: rgba(191, 219, 254, 0.32);
}

.practice-written-mode.is-disabled,
.practice-written-mode:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.practice-written-mode-label {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
}

.practice-written-mode-hint {
    font-size: 11px;
    color: rgba(30, 41, 59, 0.62);
}

.practice-write-panel {
    margin-top: 12px;
}

.practice-write-tip {
    font-size: 12px;
    color: rgba(30, 41, 59, 0.7);
    margin: 0 0 8px;
    line-height: 1.7;
}

.practice-write-input {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 150px;
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.14);
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.85;
    color: #1e293b;
}

.practice-write-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
}

.practice-write-input:disabled {
    opacity: 0.7;
}

.practice-write-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: rgba(30, 41, 59, 0.6);
    margin-top: 6px;
}

.practice-write-error {
    margin: 8px 0 0;
    font-size: 12px;
    color: #b91c1c;
    background: rgba(254, 202, 202, 0.32);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 8px 10px;
    line-height: 1.7;
}

.practice-write-pending {
    margin-left: 10px;
    font-size: 11px;
    color: rgba(30, 41, 59, 0.6);
}

.practice-write-answer-echo {
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(30, 41, 59, 0.03);
    padding: 12px 14px;
}

.practice-write-answer-echo h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: rgba(30, 41, 59, 0.66);
}

.practice-write-answer-echo p {
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: rgba(30, 41, 59, 0.88);
    white-space: pre-wrap;
}

.practice-ai-overall {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.8;
    color: rgba(30, 41, 59, 0.86);
}

.practice-ai-points {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.practice-ai-point {
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.1);
    background: rgba(255, 255, 255, 0.78);
    padding: 10px 12px;
}

.practice-ai-point.is-hit {
    border-color: rgba(16, 185, 129, 0.34);
    background: rgba(167, 243, 208, 0.24);
}

.practice-ai-point.is-partial {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(254, 240, 138, 0.24);
}

.practice-ai-point.is-miss {
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(226, 232, 240, 0.4);
}

.practice-ai-point-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.practice-ai-verdict {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: rgba(30, 41, 59, 0.72);
}

.practice-ai-point-head strong {
    font-size: 12px;
    color: #1e293b;
}

.practice-ai-point-text {
    font-size: 13px;
    line-height: 1.7;
    color: rgba(30, 41, 59, 0.88);
}

.practice-ai-point small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.7;
    color: rgba(30, 41, 59, 0.62);
}

.practice-ai-misconceptions,
.practice-ai-suggestions {
    margin-top: 12px;
    border-radius: 14px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.72);
    padding: 12px 14px;
}

.practice-ai-misconceptions {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(254, 202, 202, 0.2);
}

.practice-ai-misconceptions h4,
.practice-ai-suggestions h4 {
    margin: 0 0 6px;
    font-size: 12px;
    color: #1e293b;
}

.practice-ai-misconceptions ul,
.practice-ai-suggestions ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 4px;
}

.practice-ai-misconceptions li,
.practice-ai-suggestions li {
    font-size: 12px;
    line-height: 1.75;
    color: rgba(30, 41, 59, 0.84);
}

.practice-ai-misconceptions li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    list-style: none;
    margin-left: -18px;
}

@media (max-width: 640px) {
    .practice-written-mode {
        flex: 1 1 100%;
    }

    .practice-write-input {
        min-height: 132px;
        font-size: 13px;
    }

    .practice-write-pending {
        display: block;
        margin: 6px 0 0;
    }
}

/* ===== 小疫 AI 助教（入口 + 对话面板） ===== */
/* 入口按钮在首屏，但 js/assistant.js 首次点击才加载，不影响首屏速度。
   按钮可拖拽，位置存在 localStorage，见 app.js 的 setupLauncherDrag()。 */
.tutor-launcher {
    position: fixed;
    right: 20px;
    bottom: calc(var(--beian-footer-height) + 20px);
    /* 必须高于 .tutor-panel（260）：它是拖动整个小疫的把手，
       万一屏幕太小、面板四边都避不开，也得保证按钮还抓得到。 */
    z-index: 270;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 18px 8px 8px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(243, 244, 255, 0.96));
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08), 0 12px 30px rgba(67, 56, 202, 0.18);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: grab;
    /* 让触屏上的拖动不会变成页面滚动 */
    touch-action: none;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.2s ease;
}

.tutor-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1), 0 16px 38px rgba(67, 56, 202, 0.26);
}

.tutor-launcher:active,
.tutor-launcher.is-dragging {
    cursor: grabbing;
    transform: scale(1.04);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14), 0 20px 44px rgba(67, 56, 202, 0.3);
    transition: none;
}

.tutor-launcher:disabled {
    opacity: 0.6;
    cursor: progress;
}

.tutor-launcher img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.16), rgba(29, 78, 216, 0.12));
    pointer-events: none;
}

.tutor-launcher span {
    pointer-events: none;
}

.tutor-launcher.is-open {
    box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.28), 0 12px 30px rgba(67, 56, 202, 0.24);
}

.tutor-panel {
    position: fixed;
    right: 20px;
    bottom: calc(var(--beian-footer-height) + 82px);
    z-index: 260;
    display: flex;
    flex-direction: column;
    width: min(392px, calc(100vw - 40px));
    height: min(560px, calc(100vh - 160px));
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 249, 255, 0.97));
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06), 0 24px 60px rgba(15, 23, 42, 0.2);
    overflow: hidden;
    animation: tutorRise 0.24s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes tutorRise {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.tutor-panel.hidden {
    display: none;
}

.tutor-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(67, 56, 202, 0.1);
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.06), rgba(29, 78, 216, 0.03));
}

.tutor-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.18), rgba(29, 78, 216, 0.12));
    box-shadow: 0 2px 8px rgba(67, 56, 202, 0.18);
}

.tutor-head-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

.tutor-head-copy strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.tutor-head-copy small {
    font-size: 12px;
    color: var(--text-secondary);
}

.tutor-close {
    border: none;
    background: rgba(15, 23, 42, 0.04);
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: background 0.16s ease, color 0.16s ease;
}

.tutor-close:hover {
    background: rgba(15, 23, 42, 0.1);
    color: var(--text-primary);
}

.tutor-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

.tutor-list::-webkit-scrollbar { width: 6px; }
.tutor-list::-webkit-scrollbar-thumb {
    background: rgba(67, 56, 202, 0.18);
    border-radius: 999px;
}

.tutor-empty {
    margin: auto;
    text-align: center;
    padding: 8px 12px;
}

.tutor-empty img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.16), rgba(29, 78, 216, 0.1));
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(67, 56, 202, 0.16);
}

.tutor-empty p {
    margin: 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.tutor-empty-sub {
    font-size: 12.5px !important;
    font-weight: 400 !important;
    color: var(--text-secondary) !important;
}

.tutor-msg {
    display: flex;
    animation: tutorPop 0.2s ease;
}

@keyframes tutorPop {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.tutor-msg-me {
    justify-content: flex-end;
}

.tutor-bubble {
    max-width: 84%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
}

.tutor-msg-me .tutor-bubble {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-blue));
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.24);
}

.tutor-msg-yi .tutor-bubble {
    background: rgba(67, 56, 202, 0.07);
    border: 1px solid rgba(67, 56, 202, 0.08);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

.tutor-note {
    align-self: center;
    margin: 0;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.09);
    color: var(--danger);
    font-size: 12.5px;
    text-align: center;
}

.tutor-typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 14px;
}

.tutor-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-indigo);
    animation: tutorBlink 1.2s infinite ease-in-out;
}

.tutor-typing span:nth-child(2) { animation-delay: 0.2s; }
.tutor-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tutorBlink {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.tutor-compose {
    display: flex;
    gap: 9px;
    align-items: flex-end;
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(67, 56, 202, 0.08);
}

.tutor-compose textarea {
    flex: 1;
    resize: none;
    border: 1.5px solid rgba(67, 56, 202, 0.14);
    border-radius: 22px;
    padding: 10px 16px;
    /* 16px 防止 iOS 聚焦时自动放大页面 */
    font-size: 16px;
    font-family: var(--font-body);
    line-height: 1.5;
    /* 两行的高度。提示语「想问什么？比如「第三信号在干嘛」」在手机上
       （框宽 220–250px）和电脑上（面板只有 392px 宽）都要占两行，而框
       原本只有一行高 —— 学生打开小疫，第一眼看到的是一句被切一半的话。
       字号不能降（低于 16px，iOS 聚焦时会把整页放大），所以把框撑到两行：
       2 × 16 × 1.5 = 48，加上下内边距 20 和两条 1.5px 的边 = 71，取 72。 */
    min-height: 72px;
    max-height: 120px;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.tutor-compose textarea::placeholder {
    color: rgba(71, 85, 105, 0.55);
}

.tutor-compose textarea:focus {
    outline: none;
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.12);
}

.tutor-compose button {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-blue));
    color: #fff;
    font-size: 19px;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
    transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.16s ease, opacity 0.16s ease;
}

.tutor-compose button:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.38);
}

.tutor-compose button:active:not(:disabled) {
    transform: scale(0.94);
}

.tutor-compose button:disabled {
    background: rgba(100, 116, 139, 0.28);
    box-shadow: none;
    opacity: 0.7;
    cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
    .tutor-launcher,
    .tutor-compose button { transition: none; }
    .tutor-panel,
    .tutor-msg { animation: none; }
    .tutor-typing span { animation: none; opacity: 0.6; }
}

/* 手机/窄屏：入口让开底部导航，面板改为底部抽屉 */
@media (max-width: 1024px) {
    .tutor-launcher {
        right: 14px;
        bottom: calc(var(--mobile-tab-height) + var(--beian-footer-height) + env(safe-area-inset-bottom) + 12px);
        padding: 7px 16px 7px 7px;
        font-size: 13px;
    }

    .tutor-panel {
        right: 0;
        left: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        height: min(74vh, 580px);
        border-radius: 26px 26px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

}

/* ═══════════════════════════════════════════════════════════════════
   白板板书 · 图为主的统一布局（桌面 / 平板 / 手机）

   为什么写在文件末尾：前面 .caption-box 有二十多条规则，其中
   .caption-box.figure-atlas-caption（教材图专用）把布局重新定义成
   「标题占顶、左文右图」，权重与早先的 .has-figure 相同但位置更靠后，
   于是教材图的板一直沿用旧版式——11 张教材图一张都没吃到「图为主」。
   这里统一收口：提高权重 + 放到最后，让所有带图的板走同一套布局。
   ═══════════════════════════════════════════════════════════════════ */

/* 1 · 图文成为一整块居中堆叠：图在上、标题紧随、讲解收尾。
      改用 flex 而不是 grid，是因为 grid 的 1fr 行会把图钉在行中央，
      图与标题之间被撑出一大片空白，看起来像两块板而不是一块。 */
.visualization-stage .caption-box.has-figure,
.visualization-stage .caption-box.figure-atlas-caption,
.blackboard-section .visualization-stage .caption-box.has-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 1.1vh, 16px);
    text-align: center;
    padding: 0;
}

/* 2 · 图按 contain 收缩，最多占板面 68%，剩下的留给标题与讲解，
      保证任意长宽比的教材图都不会把文字挤出板外。 */
.visualization-stage .caption-box.has-figure > .viz-figure,
.visualization-stage .caption-box.figure-atlas-caption > .viz-figure,
.visualization-stage .caption-box .figure-atlas-image {
    flex: 0 1 auto;
    min-height: 0;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 68%;
    object-fit: contain;
    padding: 0;
    margin: 0;
    position: static;
    transform: none;
    align-self: center;
    justify-self: center;
}

/* 3 · 标题与讲解：去掉教材图变体给讲解加的米色底框，
      那个底框是为旧的左文右图版式设计的，居中堆叠下会显得很脏。 */
.visualization-stage .caption-box.has-figure > h3,
.visualization-stage .caption-box.figure-atlas-caption > h3 {
    flex: 0 0 auto;
    align-self: center;
    max-width: min(900px, 100%);
    margin: 0;
    text-align: center;
    font-size: clamp(16px, 1.45vw, 24px);
    line-height: 1.24;
}

.visualization-stage .caption-box.has-figure > p,
.visualization-stage .caption-box.figure-atlas-caption > p {
    flex: 0 0 auto;
    align-self: center;
    max-width: min(860px, 100%);
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    text-align: center;
    font-size: clamp(12.5px, 0.95vw, 16px);
    line-height: 1.5;
    color: rgba(30, 41, 59, 0.88);
}

/* 4 · 小疫笔记展开时同样保持图为主，只是整体让出右侧阅读区。 */
.blackboard-section:has(#assistantPopup:not(.hidden)) .visualization-stage .caption-box.has-figure,
.blackboard-section:has(#assistantPopup:not(.hidden)) .visualization-stage .caption-box.figure-atlas-caption,
.blackboard-section.has-assistant-note .visualization-stage .caption-box.has-figure {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-areas: none;
}

/* 5 · 板序标记：桌面右上角；给标题留出让位，避免长标题顶到角标。 */
.visualization-stage .caption-box .board-step {
    top: 2px;
    right: 4px;
}

/* ── 平板（981px ~ 1200px）：板面变窄，缩一档字号，图可以占得更满 ── */
@media (min-width: 981px) and (max-width: 1200px) {
    .visualization-stage .caption-box.has-figure > .viz-figure,
    .visualization-stage .caption-box .figure-atlas-image {
        max-height: 66%;
    }
    .visualization-stage .caption-box.has-figure > h3 { font-size: 18px; }
    .visualization-stage .caption-box.has-figure > p { font-size: 14px; }
}

/* ── 手机 / 窄屏（≤980px）────────────────────────────────────────
   两处硬伤在这里修：
   (a) 舞台底部预留了 224px 给交互卡片，但多数板根本没有卡片，
       白板被压到只剩两百多像素高，机制图缩成一团看不清。
       没有可见卡片时把这段留白收回来，白板立刻高出一大截。
   (b) 板序角标原来压在标题上，两行字叠在一起。 */
@media (max-width: 980px) {
    /* 卡片是 .visualization-stage 的**兄弟节点**（同为 .blackboard-section 的子元素），
       原来写成 .visualization-stage:not(:has(...)) 永远命中不到卡片，等于无条件回收，
       有卡片的章节板书会压到卡片上。锚点必须提到 .blackboard-section。 */
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))) .visualization-stage {
        padding-bottom: 44px;
    }

    .blackboard-section:not(:has(.interactive-cards:not(.hidden))) .visualization-stage .caption-box.has-figure,
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))) .visualization-stage .caption-box.figure-atlas-caption {
        inset: 34px 14px 16px;
    }

    .visualization-stage .caption-box.has-figure,
    .visualization-stage .caption-box.figure-atlas-caption {
        gap: 8px;
    }

    /* 手机上图是主角，尽量给它高度；标题与讲解压缩到两行以内。 */
    .visualization-stage .caption-box.has-figure > .viz-figure,
    .visualization-stage .caption-box .figure-atlas-image {
        max-height: 72%;
    }

    .visualization-stage .caption-box.has-figure > h3,
    .visualization-stage .caption-box.figure-atlas-caption > h3 {
        font-size: 15px;
        line-height: 1.3;
    }

    .visualization-stage .caption-box.has-figure > p,
    .visualization-stage .caption-box.figure-atlas-caption > p {
        font-size: 12.5px;
        line-height: 1.45;
    }

    /* 角标移到板面左上，并缩小；标题居中不会再被它压住。 */
    .visualization-stage .caption-box .board-step {
        top: 0;
        left: 0;
        right: auto;
        padding: 2px 7px;
        font-size: 10.5px;
    }
}

/* ── 极窄屏（≤430px）：再让一档，保证讲解不被挤掉 ── */
@media (max-width: 430px) {
    .visualization-stage .caption-box.has-figure > .viz-figure,
    .visualization-stage .caption-box .figure-atlas-image {
        max-height: 68%;
    }
    .visualization-stage .caption-box.has-figure > h3 { font-size: 14px; }
    .visualization-stage .caption-box.has-figure > p { font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════
   小疫随堂笔记 · 可缩放
   原来固定 width 292~344px / height 184px，且 .popup-body 是 overflow:hidden，
   笔记一长内容直接被裁掉且无法查看。现在：桌面可拖角自由缩放，触屏可双指缩放，
   头部还有一个一键放大/还原按钮；正文始终可滚动兜底。
   ═══════════════════════════════════════════════════════════════════ */

.assistant-popup {
    resize: both;
    height: 260px;
    min-width: 240px;
    min-height: 150px;
    max-width: min(760px, 92%);
    max-height: 86%;
}

/* 正文兜底可滚动：即使不放大，也不该有内容看不到 */
.assistant-popup .popup-body {
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* 一键放大后铺满白板主区，看整页笔记 */
.assistant-popup.is-expanded {
    width: min(760px, 92%) !important;
    height: 86% !important;
    top: 24px;
    right: 16px;
}

/* 放大/还原按钮 */
.assistant-popup .popup-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: auto;
    margin-right: 4px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.42);
    color: #065f46;
    font-size: 15px;
    cursor: pointer;
}

.assistant-popup .popup-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.72);
}

/* 让原来靠 margin-left:auto 顶到右边的关闭按钮不再抢位置 */
.assistant-popup .popup-header .close-btn {
    margin-left: 0;
}

/* 缩放拖角在深色半透明背景上不明显，画一个可见的角标 */
.assistant-popup::after {
    content: '';
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 11px;
    height: 11px;
    pointer-events: none;
    background:
        linear-gradient(135deg, transparent 0 46%, rgba(6, 95, 70, 0.5) 46% 58%, transparent 58%),
        linear-gradient(135deg, transparent 0 70%, rgba(6, 95, 70, 0.5) 70% 82%, transparent 82%);
}

/* 平板/手机：拖角不好按，默认给足高度，主要靠放大按钮和双指缩放。
   1024px 正是布局把笔记框改成 position:fixed 并挂到 body 的断点，对齐它。 */
@media (max-width: 1024px) {
    .assistant-popup {
        height: 300px;
        max-width: 94%;
        max-height: 80%;
    }
    .assistant-popup.is-expanded {
        width: 94% !important;
        height: 80% !important;
    }
}

/* AI 批改：先给出「AI 读到了什么」，再给分数。
   判分有争议时，学生第一个要排除的就是「AI 根本没读懂我写的」，
   把这句话摆在总评之前，比让他去猜要有用得多。 */
.practice-ai-understanding {
    margin: 10px 0 6px;
    padding: 10px 12px;
    border-left: 3px solid rgba(37, 99, 235, 0.55);
    border-radius: 0 8px 8px 0;
    background: rgba(37, 99, 235, 0.07);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary, #475569);
}

.practice-ai-understanding span {
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #2563eb;
}

/* ═══════════════════════════════════════════════════════════════════
   白板自适应 · 第 1 期（桌面 ≥1025px；对话栏限宽另用 1200px 断点）

   问题：桌面板书字太小。实测 ch01 生成图（viewBox 760×330）在 1920×1080 只画到
   852px 宽（放大 1.12 倍，流程框细注 14px），1512×950 只有 0.92 倍、细注 10.4px。

   根因不是字号写小了，是两处空间被白扔：
   (a) 右侧对话栏按 flex:4 等比放大，1920 上占走 645px，聊天列用不到那么宽；
   (b) 舞台底部常年留 224px 给交互卡片、板书框再留 186px，但白板改造后绝大多数板
       没有卡片（playbook 第 1 节已退役），704px 高的框里图只用掉 371px，
       再被 max-height:68% 二次封顶。

   本段只把这些空间还给图，不动版式、不改任何章节数据：生成图是矢量 SVG，
   位图教材图 width:auto 不会超过原始像素，所以放大不糊、不升采样、不增请求。
   写在文件末尾并提权，是 playbook 第 4 节「坑 #5」定下的做法。
   ═══════════════════════════════════════════════════════════════════ */

/* 1 · 对话栏限宽。用 1200px 断点：1025~1200px 上 flex:4 本来就只有 310~350px，
      再压下限只会把白板挤得更窄（340px 下限时 1100px 实测 509 → 493），这一档维持 6:4。
      min-width:0 不是顺手写的——对话栏默认 min-width:auto，它的最小内容宽度会反向
      顶开 .main-content，把左侧导航从 260px 挤到 187px（1280px 实测）。 */
@media (min-width: 1200px) {
    .dialogue-section {
        flex: 0 1 clamp(300px, 24vw, 460px);
        min-width: 0;
    }
}

@media (min-width: 1025px) {
    /* 2 · 无可见卡片时回收底部留白。卡片是 .visualization-stage 的**兄弟节点**，
          :has() 必须挂在 .blackboard-section 上，挂舞台上永远命中不到。
          有卡片的章节保持原样，板书不会压到卡片上。 */
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))) .visualization-stage {
        padding-bottom: 44px;
    }

    /* 只写 top / bottom：左右要留给白板历史翻页键让位（翻页键可见时两侧推到 58px），
       用 inset 简写会把左右一起盖掉，图会被翻页键压住。 */
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))) .visualization-stage .caption-box.has-figure,
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))) .visualization-stage .caption-box:has(.viz-figure),
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))) .visualization-stage .caption-box.figure-atlas-caption {
        top: 24px;
        bottom: 20px;
    }

    /* 3 · 图按剩余空间双向自适应，取消 68% 硬顶（留白收回后它就成了新瓶颈：
          板面加宽到 1612px 时图仍被卡在 1100px）。width/height 保持 auto：
          SVG 无固有尺寸 → 撑满可用宽度、高度按 viewBox 比例；<img> 有固有尺寸
          → 最多画到原始像素，不会拉糊。1600px 上限避免 4K 上画布显得空旷。 */
    .visualization-stage .caption-box.has-figure > .viz-figure,
    .visualization-stage .caption-box.figure-atlas-caption > .viz-figure,
    .visualization-stage .caption-box .figure-atlas-image {
        width: auto;
        height: auto;
        max-height: 100%;
        max-width: min(100%, 1600px);
    }

    /* 4 · 标题与讲解跟随**板面宽度**而不是视口宽度。原来用 vw，板面变宽时这两行
          纹丝不动（实测始终 24px/16px），图放大了字跟不上，比例会失衡。
          老浏览器不认 cqw → 整条声明作废 → 自动落回上面的 vw 版本，不会白屏。 */
    .blackboard-section {
        container-type: inline-size;
        container-name: board;
    }

    .visualization-stage .caption-box.has-figure > h3,
    .visualization-stage .caption-box.figure-atlas-caption > h3 {
        font-size: clamp(19px, 2.6cqw, 32px);
    }

    .visualization-stage .caption-box.has-figure > p,
    .visualization-stage .caption-box.figure-atlas-caption > p {
        font-size: clamp(14px, 1.7cqw, 20px);
    }

    /* 5 · 小疫笔记展开时的那几条 inset 带 ID 级权重，会把翻页键的让位一起盖掉。
          文件靠前的 `.visualization-stage:has(.whiteboard-history-btn…)` 只有 class 权重，
          压不过它们，于是笔记展开 + 有历史记录时，图会被左右翻页键压住。这里补回。 */
    .blackboard-section:has(#assistantPopup:not(.hidden)) .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box,
    .blackboard-section.has-assistant-note .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box {
        left: 58px;
        right: 58px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   白板自适应 · 第 1.5 期（平板 / 手机，≤1024px）

   第 1 期只放开了桌面，平板与手机上每张生成图仍然是 260×114（放大 0.34 倍）：
   iPad 上看到的机制图比桌面小四倍多。原因和桌面同源，只是被更多层规则压着：

   (a) 图被钉死。`@media (max-width:1024px)` 里那块旧窄屏版式写的是
       `width: min(100%, 260px); max-height: 170px; justify-self: end`，
       教材图另有一条 `min(100%, 420px)`，都跟板面多宽无关。
   (b) 板书框底部仍替**已退役的交互卡片**留着 198px，手机上框高只剩 230px。

   为什么整段写在文件末尾、而不是就地改那块：那块的取值被文件**更靠后**、
   同样带 ID 权重的规则（第 8500 行一带）又盖了一次。就地改只赢一半，
   实测教材图仍停在 420px。收口必须同时满足「权重够」和「位置最后」。

   左右一律不写：两侧要留给白板历史翻页键让位。用 inset 简写会连左右一起盖掉，
   图会被翻页键压住 —— 这一版就是这么踩出来的（平板实测 24 板全部压图）。
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    /* 1 · 笔记展开时不再把板书推到 top:245px。
          ≤1024 上 app.js 会把笔记挪到 <body> 并改成固定定位的浮层
          （relocateAssistantPopupForViewport），它已经不占板面，
          再往下推只是白让出 200 多像素。与桌面「笔记浮在内容之上」保持一致。 */
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
    .blackboard-section.has-assistant-note .caption-box.has-figure,
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption,
    .blackboard-section.has-assistant-note .caption-box.figure-atlas-caption {
        top: 28px;
    }

    /* 2 · 没有可见卡片时收回底部那 198px。手机实测板书框 230px → 414px。 */
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))):has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure),
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))):not(:has(#assistantPopup:not(.hidden))) .caption-box:has(.viz-figure),
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))).has-assistant-note .caption-box.has-figure,
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))):not(.has-assistant-note) .caption-box.has-figure,
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))):has(#assistantPopup:not(.hidden)) .caption-box.figure-atlas-caption,
    .blackboard-section:not(:has(.interactive-cards:not(.hidden))):not(:has(#assistantPopup:not(.hidden))) .caption-box.figure-atlas-caption {
        bottom: 18px;
    }

    /* 3 · 图按板面剩余空间自适应、居中，不再钉死 260/420px。
          width/height 保持 auto：生成图（无固有尺寸的 SVG）撑满可用宽度、高度按
          viewBox 比例；教材图（<img> 有固有尺寸）最多画到原始像素，不会拉糊。
          四种前缀都列出来，是为了逐条压住上面那两处同权重的旧规则。 */
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box:has(.viz-figure) .viz-figure,
    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box:has(.viz-figure) .viz-figure,
    .blackboard-section.has-assistant-note .caption-box.has-figure .viz-figure,
    .blackboard-section:not(.has-assistant-note) .caption-box.has-figure .viz-figure,
    .blackboard-section:has(#assistantPopup:not(.hidden)) .caption-box .figure-atlas-image,
    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .caption-box .figure-atlas-image,
    .blackboard-section.has-assistant-note .caption-box .figure-atlas-image,
    .blackboard-section:not(.has-assistant-note) .caption-box .figure-atlas-image {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        justify-self: center;
        align-self: center;
    }

    /* 4 · 有历史翻页键时两侧要让位，否则图被翻页键压住（平板实测从第 2 板起每块都中）。
          文件里本来就有让位规则，但只有 class 权重，压不过上面那两条带 ID 的 `inset`。
          ≤1024 上笔记已挪到 <body>，`:not(:has(#assistantPopup…))` 恒真，一条就够，
          且它带 ID 权重，能压住那两条 inset 的左右值。

          让多少要看按钮真实几何，**不能照抄 46px**：按钮基准是宽 38px、left/right:10px
          （右边缘 48px），只有 `@media (max-width: 900px)` 才缩到 34px/6px（右边缘 40px）。
          901~1024px 用的仍是基准尺寸，46px 会差 2px —— 这一版就是这么漏过去的。 */
    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box,
    .blackboard-section:has(#assistantPopup:not(.hidden)) .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box {
        left: 58px;
        right: 58px;
    }
}

/* 900px 以下按钮缩到 34px / 6px，让位跟着收回到 46px，把宽度还给图。 */
@media (max-width: 900px) {
    .blackboard-section:not(:has(#assistantPopup:not(.hidden))) .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box,
    .blackboard-section:has(#assistantPopup:not(.hidden)) .visualization-stage:has(.whiteboard-history-btn:not(.hidden)) .caption-box {
        left: 46px;
        right: 46px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   左侧导航可折叠（第 3 期，桌面 ≥1025px）

   学生想把板书看大时，折叠左栏最直接：260px 全部让给白板，
   1920 上板面 1136 → 1332px，图跟着放大约 17%，不需要改任何内容。

   只做左栏。右侧对话栏不折叠 —— 它装着教授与同学的发言（教学正文），
   以及推进课堂的「继续 / 选项」按钮；实测把它 display:none 掉，
   课堂直接卡在第 1 板推不动。

   ≤1024px 不提供折叠：那里左栏已经是底部 Tab 栏，没有可折叠的宽度。
   ═══════════════════════════════════════════════════════════════════ */

/* 按钮自己占一行、右对齐（侧栏本身就是 flex 纵列），不和 logo 抢位置。
   第一版把它绝对定位在右上角、半透明白底配灰图标 —— 面板本来就是白的玻璃拟态，
   学生几乎看不见它。现在用课程主色描边填色 + 「收起 / 展开」文字，一眼能认出是按钮。 */
.sidebar-toggle {
    align-self: flex-end;
    margin-bottom: 10px;
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.38);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.24), rgba(129, 140, 248, 0.18));
    color: #1d4ed8;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.16);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.sidebar-toggle i {
    font-size: 15px;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.34);
    transform: translateY(-1px);
}

.sidebar-toggle:active {
    transform: translateY(0);
}

.sidebar-toggle:focus-visible {
    outline: 2px solid rgba(30, 41, 59, 0.92);
    outline-offset: 2px;
}

/* ── 折叠态：只剩图标条 ───────────────────────────────────────────── */

.sidebar.is-collapsed {
    width: 68px;
    padding: 24px 10px;
}

/* 折叠后只剩图标，居中成一个方块；配色不变，保证在窄条上同样显眼 */
.sidebar.is-collapsed .sidebar-toggle {
    align-self: center;
    justify-content: center;
    gap: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 12px;
    margin-bottom: 14px;
}

.sidebar.is-collapsed .sidebar-toggle i {
    font-size: 18px;
}

.sidebar.is-collapsed .sidebar-toggle-text {
    display: none;
}

.sidebar-toggle + .logo {
    margin-bottom: 32px;
}

.sidebar.is-collapsed .logo {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    margin-bottom: 24px;
    font-size: 26px;
}

.sidebar.is-collapsed .logo span {
    display: none;
}

.sidebar.is-collapsed .nav-links li {
    justify-content: center;
    gap: 0;
    padding: 14px 0;
    font-size: 19px;
}

.sidebar.is-collapsed .nav-links li span {
    display: none;
}

/* 展开态的 hover 会把条目右移 4px，窄栏里会顶出边界 */
.sidebar.is-collapsed .nav-links li:hover {
    transform: none;
}

.sidebar.is-collapsed .nav-links li.active {
    border-left-width: 0;
    transform: none;
}

/* 访客按钮收成两个方块；访问量计数在 68px 里放不下，收起 */
.sidebar.is-collapsed .ix-guest-actions {
    flex-direction: column;
    gap: 8px;
}

.sidebar.is-collapsed .ix-guest-actions-right {
    display: none;
}

.sidebar.is-collapsed .ix-btn {
    padding: 10px 0;
    gap: 0;
    font-size: 0;            /* 只留图标，文字不参与排版 */
}

.sidebar.is-collapsed .ix-btn i {
    font-size: 17px;
}

/* 登录态：只留头像 */
.sidebar.is-collapsed .ix-account-trigger {
    justify-content: center;
    gap: 0;
    padding: 10px 0;
}

.sidebar.is-collapsed .ix-account-copy,
.sidebar.is-collapsed .ix-account-caret {
    display: none;
}

/* 账号菜单原本贴着 260px 宽的侧栏左边缘展开，窄栏下会被挤在屏幕边上 */
.sidebar.is-collapsed .ix-account-menu {
    left: 0;
    min-width: 200px;
}

/* ≤1024px：左栏是底部 Tab 栏，折叠没有意义，按钮与折叠态一起失效 */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: none;
    }

    .sidebar.is-collapsed {
        width: 100%;
        padding: 0 8px env(safe-area-inset-bottom);
    }

    .sidebar.is-collapsed .nav-links li span {
        display: block;
    }
}

/* 首屏内联 CSS 把顶栏右侧与侧栏账号区先设为 visibility:hidden —— 把它们的最终版式
   复刻进内联 CSS 代价太大，而且试过：只复刻一半反而让中间态离最终态更远，
   桌面 CLS 从 0.061 涨到 0.127。不可见元素的位移不计入 CLS，等这份样式表落地再显示，
   就没有「先画错再纠正」那一跳（桌面 0.020 → 0.005）。

   **这两条必须留在完整样式表里**，删掉会导致顶栏右侧和登录按钮永远不显示。
   index.html 里另有一个 3 秒 setTimeout 兜底，防的是这份样式表根本没加载上。
   兜底不能改用 CSS 动画（`animation: … forwards` 延时显示）：实测动画会把这两个元素
   提升为独立合成层，桌面 CLS 反而从 0.005 涨到 0.141。 */
.top-bar-actions,
.user-profile {
    visibility: visible;
}

/* ============================================================
   病例侦探 · 病历卡（阶段 B）
   每个病例开局给出完整患者档案，取代"只给一条线索"的开局。
   规则：只新增，不改动既有选择器；纯静态排版，无动画、无额外请求。
   ============================================================ */
.case-vignette {
    margin: 0 0 18px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid rgba(37, 99, 235, 0.16);
    background: rgba(37, 99, 235, 0.045);
}

.case-vignette > .vignette-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}

.case-vignette > .vignette-head::-webkit-details-marker {
    display: none;
}

/* 自绘箭头，避免依赖图标字体里不一定存在的字形 */
.case-vignette > .vignette-head::after {
    content: '';
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(37, 99, 235, 0.55);
    border-bottom: 2px solid rgba(37, 99, 235, 0.55);
    transform: rotate(45deg) translate(-2px, -2px);
}

.case-vignette[open] > .vignette-head::after {
    transform: rotate(-135deg) translate(-2px, -2px);
}

.case-vignette .vignette-body {
    margin-top: 12px;
}

.case-vignette .vignette-patient {
    font-size: 15px;
    font-weight: 700;
    color: #1d4ed8;
    letter-spacing: 0.01em;
}

.case-vignette .vignette-row {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 12px;
    padding: 7px 0;
    border-top: 1px solid rgba(37, 99, 235, 0.1);
}

.case-vignette .vignette-row:first-of-type {
    border-top: 0;
}

.case-vignette .vignette-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    line-height: 1.75;
}

.case-vignette .vignette-row p {
    margin: 0;
    font-size: 14px;
    line-height: 1.75;
    color: #1e293b;
}

@media (max-width: 720px) {
    .case-vignette {
        padding: 15px 16px;
    }

    .case-vignette .vignette-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .case-vignette .vignette-label {
        color: #1d4ed8;
    }
}

/* ============================================================
   病例侦探 · 即时解析（阶段 C）
   答对答错都当场说明理由，并由学生自己点「继续」推进，
   取代原来 650ms 自动跳转——解析需要时间读完。
   ============================================================ */
.feedback-detail {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.8;
    color: #1e293b;
}

.feedback-aside {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px dashed rgba(30, 41, 59, 0.16);
    font-size: 13px;
    line-height: 1.75;
    color: #475569;
}

.feedback-advance-btn {
    margin-top: 14px;
}

.review-copy p + p {
    margin-top: 8px;
}

/* ============================================================
   病例侦探 · 检查结果面板（阶段 D）
   第 2 轮拆成「先选查什么 → 再看结果判断机制」，
   本面板只在检查题答对后出现。
   ============================================================ */
.workup-result {
    margin: 0 0 16px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(16, 185, 129, 0.26);
    background: rgba(16, 185, 129, 0.07);
}

.workup-result p {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.8;
    color: #1e293b;
}

@media (max-width: 720px) {
    .workup-result {
        padding: 14px 15px;
    }
}

/* ─────────────────────────────────────────────────────────────
   知识地图「主线」：一章一条因果链，蛇形排版，连线上写关系词。
   卡片自带说明，不用点开右栏也能一口气读完整章逻辑。
   ───────────────────────────────────────────────────────────── */
.km-spine-node {
    max-width: none;
    padding: 15px 18px 17px;
    border-radius: 20px;
    text-align: left;
    border-color: rgba(59, 130, 246, 0.2);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.94), rgba(255, 255, 255, 0.96));
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.km-spine-node:hover {
    border-color: rgba(59, 130, 246, 0.42);
}

.km-spine-node.is-active {
    border-color: rgba(67, 56, 202, 0.66);
    box-shadow: 0 16px 34px rgba(67, 56, 202, 0.16);
}

.km-spine-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    font-style: normal;
}

.km-spine-node span {
    display: block;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.36;
    text-align: left;
    color: #0f172a;
}

.km-spine-node em {
    display: block;
    margin-top: 7px;
    font-style: normal;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.72;
    color: rgba(30, 41, 59, 0.74);
    text-align: left;
}

.km-spine-measuring {
    position: static;
    transform: none;
    min-height: auto;
    margin-bottom: 10px;
}

.km-spine-measuring:hover {
    transform: none;
}

.km-board-frame.is-spine .km-graph-edge {
    stroke: rgba(59, 130, 246, 0.34);
    stroke-width: 2.2;
}

.km-board-frame.is-spine .km-graph-edge.is-active {
    stroke: rgba(67, 56, 202, 0.78);
}

.km-arrow-head {
    fill: rgba(59, 130, 246, 0.46);
}

.km-edge-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    fill: rgba(37, 99, 235, 0.92);
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: 4px;
    stroke-linejoin: round;
}

.km-edge-label.is-active {
    fill: #4338ca;
}

@media (max-width: 720px) {
    .km-spine-node {
        padding: 14px 15px 16px;
    }

    .km-spine-node span {
        font-size: 15px;
    }

    .km-spine-node em {
        font-size: 12.5px;
        line-height: 1.68;
    }
}

.km-edge-label-probe {
    display: inline-block;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────────
   知识地图「考点速记」：一句话速记 + 考试速背 + 高频考点，
   内容来自各章 markdown，由 scripts/build-knowledge-exam-data.mjs 生成。
   ───────────────────────────────────────────────────────────── */
.km-exam {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 26px 32px;
    max-width: 900px;
    margin: 0 auto;
}

.km-exam .knowledge-section-kicker {
    margin-bottom: 8px;
}

.km-exam-oneliner {
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.94), rgba(255, 255, 255, 0.96));
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.km-exam-oneliner p {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.78;
    color: #0f172a;
}

.km-exam-quick {
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.86);
}

.km-exam-quick ol {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.km-exam-quick li {
    font-size: 14px;
    line-height: 1.78;
    color: #1e293b;
}

.km-exam-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.km-exam-group {
    padding: 16px 20px 18px;
    border-radius: 18px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.86);
}

.km-exam-group h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
}

.km-exam-group-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
}

.km-exam-group ul {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.km-exam-group li {
    font-size: 14px;
    line-height: 1.82;
    color: rgba(30, 41, 59, 0.9);
}

.km-exam-group strong {
    font-weight: 800;
    color: #0f172a;
}

/* 易混点用警示色单独拎出来——这是最该停下来看的一段 */
.km-exam-group.is-pitfall {
    border-color: rgba(217, 119, 6, 0.28);
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.94), rgba(255, 255, 255, 0.96));
}

.km-exam-group.is-pitfall .km-exam-group-index {
    background: rgba(217, 119, 6, 0.16);
    color: #b45309;
}

.km-exam-group.is-pitfall strong {
    color: #9a3412;
}

.km-tab-btn.km-tab-exam {
    border-color: rgba(217, 119, 6, 0.3);
    color: #b45309;
}

.km-tab-btn.km-tab-exam.is-active {
    background: rgba(217, 119, 6, 0.14);
    border-color: rgba(217, 119, 6, 0.5);
    color: #9a3412;
}

.km-exam-tips {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.km-exam-tips li {
    font-size: 13.5px;
    line-height: 1.78;
    color: rgba(30, 41, 59, 0.82);
}

/* 考点页不画图，画布不需要那个 920px 的最小高度 */
.knowledge-map-view.is-exam .knowledge-stage-board {
    min-height: 0;
}

@media (max-width: 720px) {
    .km-exam {
        padding: 16px 14px 26px;
        gap: 14px;
    }

    .km-exam-oneliner,
    .km-exam-quick,
    .km-exam-group {
        padding: 14px 15px 16px;
    }

    .km-exam-oneliner p {
        font-size: 15px;
    }
}

/* ─────────────────────────────────────────────────────────────
   知识地图·当前节点条：选中节点的标签 + 正文 + 本章其他图里的同一概念。
   正文原来在最右侧那根默认折叠的解释栏里（等于藏着），现在挪到画布正上方。
   ───────────────────────────────────────────────────────────── */
.km-current-bar {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 6px 4px 12px;
}

.km-current-copy {
    flex: 1 1 340px;
    min-width: 0;
    font-size: 13.5px;
    line-height: 1.7;
    /* 正文最多两行：全书 summary 中位 17 字、90% 在 35 字以内，两行装得下；
       极少数超长的截断而不是把画布往下推。 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.km-current-label {
    font-weight: 800;
    color: #0f172a;
}

.km-current-label::after {
    content: '·';
    margin: 0 7px;
    color: rgba(30, 41, 59, 0.3);
    font-weight: 400;
}

.km-current-summary {
    color: rgba(30, 41, 59, 0.72);
}

.km-current-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 0 1 auto;
}

.km-current-links-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: rgba(30, 41, 59, 0.45);
    white-space: nowrap;
}

.km-crosslink-more {
    font-size: 12px;
    color: rgba(30, 41, 59, 0.42);
}

.km-crosslink-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    max-width: 100%;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(16, 185, 129, 0.28);
    background: rgba(236, 253, 245, 0.9);
    color: #065f46;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.km-crosslink-pill em {
    flex: 0 0 auto;
    font-style: normal;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: rgba(6, 95, 70, 0.62);
}

.km-crosslink-pill:hover {
    border-color: rgba(16, 185, 129, 0.55);
    background: rgba(209, 250, 229, 0.95);
    transform: translateY(-1px);
}

/* 贯穿全章的概念，在图上点一个小圆点 */
.km-node.has-cross-links::before {
    content: '';
    position: absolute;
    top: 7px;
    right: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.72);
    box-shadow: 0 0 0 2px rgba(236, 253, 245, 0.9);
}

.km-spine-node.has-cross-links::before {
    top: 10px;
    right: 12px;
}

/* 考点速记页末尾的「怎么用这一章」，原来在右侧解释栏里 */
.km-exam-tips-block {
    padding: 16px 20px 18px;
    border-radius: 18px;
    border: 1px solid rgba(30, 41, 59, 0.08);
    background: rgba(255, 255, 255, 0.72);
}

/* 知识地图只剩一个画布框，栅格一律单列 */
.knowledge-map-view .knowledge-map-grid,
.knowledge-map-view.is-expanded .knowledge-map-grid,
.knowledge-map-view:fullscreen .knowledge-map-grid {
    grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 720px) {
    .km-current-bar {
        padding: 4px 2px 10px;
        gap: 6px 10px;
    }

    .km-current-copy {
        flex-basis: 100%;
        font-size: 13px;
    }

    .km-crosslink-pill {
        padding: 5px 10px;
        font-size: 12.5px;
    }
}