:root {
            --primary-color: #3498db;
            --accent-color: #e67e22;
            --success-color: #2ecc71;
            --danger-color: #e74c3c;
            --warning-color: #f39c12;
            --info-color: #9b59b6;
            --text-color: #34495e;
            --text-soft: #5c6b7c;
            --line: #e4e8ee;
            --section-accent: #2ecc71;
            --section-accent-deep: #1f9c55;
            --section-accent-soft: #eafaf1;
            --heading-font: 'JF Open Hun Inn', 'Microsoft YaHei', 'PingFang SC', 'Segoe UI', sans-serif;
            --controls-safe-height: 48px;
        }

        /* ── 页面骨架 ─────────────────────────────── */
        body {
            margin: 0;
            font-family: var(--heading-font);
            color: var(--text-color);
            background: #ffffff;
            overflow: hidden;
            min-height: 100vh;
            min-height: 100dvh;
        }

        /* 底部为固定导航栏预留高度，任何页面内容都不会被遮挡或溢出 */
        #presentation-container {
            width: 100%;
            height: 100vh;
            height: 100dvh;
            position: relative;
            background: #ffffff;
            overflow: hidden;
            box-sizing: border-box;
            padding-bottom: var(--controls-safe-height);
        }

        .slide {
            width: 100%;
            height: 100%;
            display: none;
            opacity: 0;
            visibility: hidden;
            align-items: stretch;
        }

        .slide.active {
            display: flex;
            opacity: 1;
            visibility: visible;
            animation: fadeIn .5s ease-out;
        }

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

        @keyframes fadeInUp {
            from { opacity: 0; transform: translateY(26px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        /* ── 左侧讲解板 ───────────────────────────── */
        .chalkboard {
            width: 50%;
            height: 100%;
            background: #ffffff;
            padding: 40px 48px 48px;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            overflow-y: auto;
            box-sizing: border-box;
            font-size: 17px;
            line-height: 1.9;
            border-right: 1px solid var(--line);
            scrollbar-width: thin;
            scrollbar-color: #ccd4de transparent;
        }
        .chalkboard::-webkit-scrollbar { width: 6px; }
        .chalkboard::-webkit-scrollbar-thumb { background: #ccd4de; border-radius: 3px; }

        .chalkboard h2 { font-size: 25px; color: #1a1a2e; margin: 26px 0 14px; }
        .chalkboard h3 { font-size: 20px; color: #2c3e50; margin: 22px 0 10px; }
        .chalkboard h4 { font-size: 17px; color: #4b5563; margin: 16px 0 8px; }

        .chalkboard > h2:first-child,
        .chalkboard > h3:first-child {
            font-size: 27px;
            color: #1a1a2e;
            margin: 0 0 20px;
            padding-bottom: 14px;
            position: relative;
        }
        .chalkboard > h2:first-child::after,
        .chalkboard > h3:first-child::after {
            content: "";
            position: absolute;
            left: 0;
            bottom: 0;
            width: 46px;
            height: 4px;
            border-radius: 2px;
            background: var(--section-accent);
        }

        .chalkboard p { margin: 10px 0; }
        .chalkboard ul,
        .chalkboard ol { margin: 10px 0; padding-left: 24px; }
        .chalkboard ul { list-style-type: disc; }
        .chalkboard li { margin-bottom: 8px; }
        .chalkboard p,
        .chalkboard li { font-size: 17px; line-height: 1.9; }

        .highlight {
            color: #d35400;
            font-weight: bold;
            background: linear-gradient(transparent 64%, rgba(230, 126, 34, .16) 64%);
            padding: 0 2px;
            border-radius: 2px;
        }

        /* 定义卡片 */
        .math-formula {
            background: #f8f9fb;
            border: 1px solid var(--line);
            border-left: 4px solid var(--section-accent);
            border-radius: 10px;
            padding: 16px 20px;
            margin: 16px 0;
            text-align: center;
            font-size: 1.15rem;
            color: #2c3e50;
            line-height: 1.7;
        }
        .def-name {
            display: inline-block;
            font-size: .82rem;
            font-weight: bold;
            letter-spacing: .18em;
            color: var(--section-accent-deep);
            margin-bottom: 4px;
        }

        /* 承上启下 / 联系提示 */
        .link-note {
            margin-top: 22px;
            padding: 10px 14px 10px 16px;
            border-left: 3px solid var(--section-accent);
            background: var(--section-accent-soft);
            border-radius: 0 8px 8px 0;
            font-size: .95rem;
            color: #3b4a5a;
            line-height: 1.8;
        }
        .link-note b { color: var(--section-accent-deep); }

        /* 防止行内公式把讲解板撑破 */
        .chalkboard mjx-container { max-width: 100%; overflow-x: auto; overflow-y: hidden; }

        /* ── 右侧可视化区 ─────────────────────────── */
        .visualization {
            width: 50%;
            height: 100%;
            background: #fcfdfe;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 26px;
            box-sizing: border-box;
            overflow: hidden;
            position: relative;
        }
        .slide > .visualization:only-child { width: 100%; }
        .visualization.full-width { width: 100%; background: #ffffff; }
        .visualization.white-bg { background: #ffffff; }

        /* viewBox 缩放：SVG 永远完整地待在容器里，不裁剪、不溢出 */
        .visualization > svg {
            width: 100%;
            height: 100%;
            display: block;
            max-width: 100%;
            max-height: 100%;
        }

        svg text { font-family: var(--heading-font); }
        svg .viz-title { font-size: 27px; font-weight: bold; fill: #1a1a2e; }
        svg .viz-sub { font-size: 16px; fill: #5c6b7c; }
        svg .ax-name { font-size: 19px; font-style: italic; fill: #4a5568; font-family: Georgia, 'Times New Roman', serif; }
        svg .tick-label { font-size: 14px; fill: #8a94a3; }
        svg .fn-label { font-size: 18px; font-weight: bold; font-style: italic; font-family: Georgia, 'Times New Roman', serif; }
        svg .readout { font-size: 20px; font-weight: bold; fill: #2c3e50; }
        svg .readout-sub { font-size: 15px; fill: #5c6b7c; }
        svg .node-title { font-size: 20px; font-weight: bold; }
        svg .node-sub { font-size: 14px; }

        /* 可视化区悬浮控件（切换、滑杆） */
        .viz-overlay { position: absolute; z-index: 6; display: flex; gap: 8px; align-items: center; }
        .viz-chips { top: 14px; left: 50%; transform: translateX(-50%); flex-wrap: wrap; justify-content: center; max-width: 94%; }
        .viz-chip {
            border: 1px solid var(--line);
            background: #ffffff;
            color: #475569;
            border-radius: 999px;
            padding: 6px 16px;
            font-family: var(--heading-font);
            font-size: 14px;
            font-weight: 600;
            line-height: 1;
            cursor: pointer;
            box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
            transition: background .2s, color .2s, border-color .2s;
        }
        .viz-chip:hover { border-color: var(--section-accent); color: var(--section-accent-deep); }
        .viz-chip.on { background: var(--section-accent); border-color: var(--section-accent); color: #ffffff; }
        .viz-slider {
            bottom: 14px; left: 50%; transform: translateX(-50%);
            background: rgba(255, 255, 255, .95);
            border: 1px solid var(--line);
            border-radius: 999px;
            padding: 8px 18px;
            box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
            font-size: 14px;
            color: #334155;
            white-space: nowrap;
        }
        .viz-slider input[type=range] { width: 190px; accent-color: var(--section-accent); vertical-align: middle; }
        .viz-slider b { display: inline-block; min-width: 58px; text-align: center; color: var(--section-accent-deep); font-size: 15px; }

        /* ── 章节页 ──────────────────────────────── */
        .chalkboard.section-cover {
            justify-content: center;
            align-items: center;
            text-align: center;
            padding: 60px;
            background:
                radial-gradient(620px 420px at 82% 14%, var(--section-accent-soft), transparent 68%),
                #ffffff;
        }
        .section-cover-inner { max-width: 640px; }
        .section-cover-inner > * { animation: fadeInUp .7s ease-out both; }
        .section-cover-inner > :nth-child(1) { animation-delay: .05s; }
        .section-cover-inner > :nth-child(2) { animation-delay: .18s; }
        .section-cover-inner > :nth-child(3) { animation-delay: .32s; }
        .section-cover-inner > :nth-child(4) { animation-delay: .46s; }
        .section-eyebrow {
            display: inline-flex; align-items: center; gap: 8px;
            padding: 6px 16px; border-radius: 999px;
            border: 1px solid var(--section-accent);
            color: var(--section-accent-deep);
            background: var(--section-accent-soft);
            font-size: 1.05rem; font-weight: bold; letter-spacing: .06em;
        }
        .section-title { font-size: 3.2rem; line-height: 1.2; color: #1a1a2e; margin: 26px 0 10px; }
        .section-subtitle { font-size: 1.35rem; color: var(--text-soft); margin: 0 0 34px; }
        .section-topics { display: flex; flex-direction: column; align-items: center; gap: 14px; }
        .topics-label { font-size: .92rem; font-weight: bold; letter-spacing: .28em; text-indent: .28em; color: var(--text-soft); }
        .topic-chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; padding: 0; }
        .topic-chips li {
            padding: 9px 20px; border-radius: 999px;
            background: var(--section-accent-soft);
            border: 1px solid var(--section-accent);
            color: #1f3247; font-size: 1.08rem; font-weight: bold;
        }

        /* ── 随堂练习页：整页铺开，无左右分栏、无外框 ── */
        .practice {
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            background: #ffffff;
            padding: 30px clamp(26px, 11vw, 170px);
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            scrollbar-width: thin;
            scrollbar-color: #ccd4de transparent;
        }
        .practice::before, .practice::after { content: ''; flex: 1 0 14px; }

        .practice-kicker { display: flex; align-items: baseline; gap: 14px; margin-bottom: 30px; }
        .practice-tag {
            color: var(--section-accent-deep);
            font-weight: bold;
            letter-spacing: .16em;
            font-size: 1rem;
        }
        .practice-topic { color: var(--text-soft); font-size: .95rem; padding-left: 14px; border-left: 2px solid var(--line); }

        .practice-q, .answer-flex { display: flex; gap: 18px; align-items: flex-start; }
        .q-badge, .a-badge {
            flex: 0 0 auto;
            width: 42px; height: 42px;
            border-radius: 12px;
            display: flex; align-items: center; justify-content: center;
            font-weight: bold; font-size: 20px; color: #ffffff;
        }
        .q-badge { background: var(--section-accent); }
        .a-badge { background: #2c3e50; }
        .q-text { font-size: clamp(19px, 2.1vw, 26px); line-height: 1.95; color: #1f2937; margin: 3px 0 0; }
        .q-text .q-sub { display: block; font-size: .78em; color: var(--text-soft); margin-top: 6px; }

        .practice-divider {
            height: 1px; border: 0;
            background: linear-gradient(90deg, var(--section-accent), var(--line) 45%, transparent 92%);
            margin: 36px 0 6px;
        }

        .practice-hintline {
            display: flex; align-items: center; gap: 10px;
            color: #94a3b8; font-size: 1rem;
            margin: 14px 0 4px 60px;
            cursor: pointer; user-select: none;
            animation: hintPulse 2.2s ease-in-out infinite;
        }
        @keyframes hintPulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
        .key-cap {
            display: inline-block;
            padding: 3px 11px;
            border: 1px solid #cbd5e1;
            border-bottom-width: 3px;
            border-radius: 7px;
            background: #f8fafc;
            color: #475569;
            font-weight: bold;
            font-size: .92em;
            line-height: 1.4;
        }

        .practice-answer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .65s cubic-bezier(.22, .8, .26, 1); }
        .practice-answer > .answer-clip { overflow: hidden; min-height: 0; }
        .answer-flex { padding-top: 20px; opacity: 0; transform: translateY(16px); transition: opacity .5s .15s ease, transform .5s .15s ease; }
        .practice.revealed .practice-answer { grid-template-rows: 1fr; }
        .practice.revealed .answer-flex { opacity: 1; transform: none; }
        .practice.revealed .practice-hintline { display: none; }

        .a-body { font-size: clamp(16px, 1.55vw, 20px); line-height: 2.05; color: #334155; margin-top: 4px; min-width: 0; }
        .a-body p { margin: 9px 0; }
        .a-body .a-key { color: var(--section-accent-deep); font-weight: bold; }
        .a-conclusion { margin-top: 14px; font-weight: bold; color: #1f2937; }
        .a-note {
            color: var(--text-soft);
            font-size: .9em;
            line-height: 1.9;
            margin-top: 18px;
            padding-left: 14px;
            border-left: 3px solid var(--section-accent);
        }
        .practice mjx-container { max-width: 100%; overflow-x: auto; overflow-y: hidden; }

        /* ── 进度条与底部导航栏 ───────────────────── */
        .progress-bar-container {
            position: fixed; top: 0; left: 0;
            width: 100%; height: 3px;
            z-index: 1000; background: transparent; pointer-events: none;
        }
        .progress-bar { height: 100%; width: 0%; background: var(--section-accent); transition: width .3s ease-out; }

        .controls {
            position: fixed; left: 0; bottom: 0;
            width: 100vw; height: var(--controls-safe-height);
            display: flex; justify-content: center; align-items: center; gap: 1rem;
            z-index: 1000;
            background: rgba(255, 255, 255, .96);
            border-top: 1px solid var(--line);
            box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
            backdrop-filter: blur(6px);
            padding: 0 .9rem;
            box-sizing: border-box;
        }
        .controls .nav-btn {
            border: none; background: transparent; color: #64748b;
            cursor: pointer; display: flex; align-items: center; gap: .5rem;
            padding: 4px 2px;
            font-family: inherit; font-size: .95rem; font-weight: 600;
            transition: color .2s ease, transform .2s ease;
        }
        .controls .nav-btn:hover { color: var(--section-accent-deep); transform: scale(1.05); }
        .controls .nav-btn:focus-visible,
        .page-jump-btn:focus-visible { outline: 2px solid var(--section-accent); outline-offset: 2px; border-radius: 4px; }
        .controls .nav-btn.at-first,
        .controls .nav-btn.at-last { opacity: .45; }

        .page-indicator { min-width: 96px; color: #334155; font-weight: 700; text-align: center; font-size: 1.05rem; }
        .page-jump { display: flex; align-items: center; gap: .4rem; color: #475569; font-size: .9rem; white-space: nowrap; }
        .page-jump-input {
            width: 4.2rem; height: 1.8rem;
            border: 1px solid #cbd5e1; border-radius: .45rem;
            text-align: center; font-family: inherit; font-weight: 600;
            color: #0f172a; background: #fff;
        }
        .page-jump-input:focus { outline: 2px solid var(--section-accent); border-color: var(--section-accent); }
        .page-jump-btn {
            height: 1.8rem; padding: 0 .55rem;
            border: 1px solid #cbd5e1; border-radius: .45rem;
            background: #f8fafc; color: #334155;
            font-family: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
        }
        .page-jump-btn:hover { border-color: var(--section-accent); color: var(--section-accent-deep); }

        /* ── 弹出式二级菜单（目录 / 实验室） ───────── */
        .lab-submenu {
            position: fixed; top: 12%; left: 50%;
            transform: translateX(-50%);
            z-index: 1100;
            width: 96%; max-width: 1000px; max-height: 78vh;
            overflow: hidden auto;
            background: rgba(255, 255, 255, .97);
            border: 1px solid var(--line);
            border-radius: 16px;
            box-shadow: 0 20px 60px rgba(15, 23, 42, .22);
            backdrop-filter: blur(16px);
        }
        .submenu-content { padding: 24px; position: relative; }
        .submenu-title {
            text-align: center; font-size: 22px; font-weight: bold; color: #2c3e50;
            margin-bottom: 18px; padding-bottom: 10px;
            border-bottom: 2px solid var(--section-accent);
        }
        .submenu-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 14px; max-height: 60vh; overflow-y: auto;
        }
        .submenu-item {
            display: flex; align-items: center;
            padding: 12px 16px;
            background: #f8f9fb;
            border: 1px solid transparent; border-radius: 12px;
            cursor: pointer; transition: all .25s ease;
            font-size: 14px; color: #2c3e50;
        }
        .submenu-item:hover {
            background: var(--section-accent); color: #fff;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(15, 23, 42, .18);
        }
        .submenu-icon { margin-right: 10px; font-size: 16px; }
        .submenu-text { font-weight: 500; }
        .submenu-close {
            position: absolute; top: 12px; right: 16px;
            width: 28px; height: 28px;
            background: var(--danger-color); color: #fff;
            border: none; border-radius: 50%;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            font-size: 16px; font-weight: bold;
            transition: all .25s ease;
        }
        .submenu-close:hover { background: #c0392b; transform: scale(1.1); }

        /* ── 动效偏好 ────────────────────────────── */
        @media (prefers-reduced-motion: reduce) {
            .slide.active,
            .section-cover-inner > *,
            .practice-hintline { animation: none; }
            .controls .nav-btn:hover,
            .submenu-item:hover,
            .submenu-close:hover { transform: none; }
        }

        /* ── 移动端布局 ──────────────────────────── */
        @media (max-width: 960px) {
            :root { --controls-safe-height: 96px; }

            #presentation-container {
                padding-bottom: calc(var(--controls-safe-height) + env(safe-area-inset-bottom, 0px));
            }

            .slide,
            .slide.active { flex-direction: column; min-height: 0; }
            .slide.active { animation: none; }

            .chalkboard {
                width: 100%; flex: 1 1 auto; min-height: 0; height: auto;
                padding: 20px 18px;
                font-size: 14px; line-height: 1.6;
                border-right: none;
                border-bottom: 1px solid var(--line);
                overscroll-behavior: contain;
            }
            .visualization {
                width: 100%;
                flex: 0 0 clamp(230px, 34vh, 320px);
                min-height: clamp(230px, 34vh, 320px);
                height: auto;
                padding: 12px;
            }
            .slide > .visualization:only-child,
            .visualization.full-width { flex: 1 1 auto; min-height: 0; height: 100%; }

            .chalkboard h2 { font-size: 18px; margin: 14px 0 8px; }
            .chalkboard h3 { font-size: 16px; margin: 14px 0 8px; }
            .chalkboard h4 { font-size: 14px; margin: 12px 0 8px; }
            .chalkboard > h2:first-child,
            .chalkboard > h3:first-child { font-size: 19px; margin: 0 0 14px; padding-bottom: 10px; }
            .chalkboard p,
            .chalkboard li { font-size: 13px; margin-bottom: 8px; }
            .math-formula { padding: 12px; margin: 12px 0; font-size: 1rem; }
            .link-note { font-size: .85rem; margin-top: 14px; }

            .chalkboard.section-cover { padding: 26px 18px; }
            .section-title { font-size: 2.1rem; }
            .section-subtitle { font-size: 1.05rem; margin-bottom: 22px; }
            .topic-chips li { padding: 7px 14px; font-size: .95rem; }

            .practice { padding: 22px 20px; }
            .practice-kicker { margin-bottom: 18px; }
            .q-badge, .a-badge { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }
            .practice-q, .answer-flex { gap: 12px; }
            .practice-hintline { margin-left: 46px; font-size: .9rem; }
            .practice-divider { margin: 24px 0 4px; }

            .viz-slider input[type=range] { width: 130px; }

            .controls {
                justify-content: flex-start; gap: .72rem;
                min-height: 56px; height: auto;
                padding: .55rem .85rem calc(.55rem + env(safe-area-inset-bottom, 0px));
                overflow-x: auto; overflow-y: hidden;
            }
            .controls .nav-btn { flex: 0 0 auto; min-width: max-content; gap: .35rem; font-size: .88rem; }
            .controls .nav-ico { font-size: 1rem; line-height: 1; }
            .page-indicator { flex: 0 0 auto; min-width: 4.5rem; font-size: 1rem; }
            .page-jump { flex: 0 0 auto; gap: .3rem; }
            .page-jump-input { width: 3.2rem; height: 34px; }
            .page-jump-btn { height: 34px; padding: 0 .45rem; font-size: .78rem; }

            .lab-submenu { width: 94%; max-height: 75vh; }
            .submenu-content { padding: 16px; }
        }

        @media (max-width: 560px) {
            :root { --controls-safe-height: 88px; }

            .chalkboard { padding: 16px 12px; font-size: 12.5px; line-height: 1.5; }
            .visualization {
                flex-basis: clamp(210px, 28vh, 260px);
                min-height: clamp(210px, 28vh, 260px);
                padding: 8px;
            }
            .chalkboard h2 { font-size: 16px; }
            .chalkboard h3 { font-size: 14px; margin: 10px 0 6px; }
            .chalkboard h4 { font-size: 13px; margin: 10px 0 6px; }
            .chalkboard > h2:first-child,
            .chalkboard > h3:first-child { font-size: 17px; margin-bottom: 10px; padding-bottom: 8px; }
            .chalkboard p,
            .chalkboard li { font-size: 12px; margin-bottom: 6px; line-height: 1.5; }
            .chalkboard ul,
            .chalkboard ol { padding-left: 16px; margin: 8px 0; }
            .math-formula { padding: 10px; margin: 10px 0; font-size: .9rem; border-radius: 6px; }

            .chalkboard.section-cover { padding: 22px 14px; }
            .section-title { font-size: 1.85rem; }
            .section-subtitle { font-size: .95rem; }

            .practice { padding: 18px 14px; }
            .q-text { line-height: 1.8; }
            .a-body { line-height: 1.9; }

            .controls { gap: .5rem; min-height: 52px; padding: .5rem .7rem calc(.5rem + env(safe-area-inset-bottom, 0px)); }
            .controls .nav-btn { gap: 0; font-size: .82rem; }
            .controls .nav-label,
            .page-jump-label { display: none; }
            .controls .nav-ico { font-size: .92rem; }
            .page-indicator { font-size: .92rem; }
            .page-jump { gap: .22rem; }
            .page-jump-input { width: 2.7rem; height: 30px; }
            .page-jump-btn { height: 30px; padding: 0 .3rem; font-size: .68rem; }

            .lab-submenu { width: 96%; max-height: 70vh; border-radius: 12px; }
            .submenu-content { padding: 12px; }
        }
