
        :root {
            --bg: #0f172a;
            --panel-bg: #1e293b;
            --border: #334155;
            --text: #e2e8f0;
            --text-secondary: #94a3b8;
            --accent: #3b82f6;
            --accent2: #f59e0b;
            --accent3: #10b981;
            --accent4: #ef4444;
            --accent5: #ec4899;
            --btn-bg: #334155;
            --btn-hover: #475569;
            --sidebar-w: 260px;
        }

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

        body {
            background: var(--bg);
            color: var(--text);
            font-family: 'Times New Roman', 'Microsoft YaHei', 'PingFang SC', serif;
            overflow: hidden;
            height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* 英文字母斜体 */
        .math-var { font-style: italic; }
        .math-fn { font-style: normal; }

        /* ===== 顶部 Header ===== */
        .header {
            background: var(--panel-bg);
            border-bottom: 1px solid var(--border);
            padding: 10px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
            z-index: 10;
        }
        .header-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .header-logo {
            width: 34px;
            height: 34px;
            border-radius: 8px;
            background: linear-gradient(135deg, var(--accent), #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            color: #fff;
        }
        .header h1 {
            font-size: 18px;
            font-weight: 700;
            color: var(--text);
        }
        .header h1 span {
            font-size: 12px;
            color: var(--text-secondary);
            margin-left: 8px;
            font-weight: 400;
            font-style: italic;
        }
        .header-right {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .stat-badge {
            background: rgba(59,130,246,0.1);
            border: 1px solid rgba(59,130,246,0.3);
            border-radius: 14px;
            padding: 4px 14px;
            font-size: 12px;
            color: var(--accent);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .stat-badge i { font-size: 11px; }

        /* ===== 主体布局 ===== */
        .main-wrapper {
            flex: 1;
            display: flex;
            overflow: hidden;
        }

        /* ===== 左侧边栏 ===== */
        .sidebar {
            width: var(--sidebar-w);
            background: var(--panel-bg);
            border-right: 1px solid var(--border);
            overflow-y: auto;
            overflow-x: hidden;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
        }
        .sidebar::-webkit-scrollbar { width: 4px; }
        .sidebar::-webkit-scrollbar-track { background: transparent; }
        .sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
        .sidebar::-webkit-scrollbar-thumb:hover { background: var(--btn-hover); }

        .sidebar-section { border-bottom: 1px solid rgba(51,65,85,0.5); }
        .sidebar-section:last-child { border-bottom: none; }

        /* 分类标题 (可折叠) */
        .sidebar-cat-header {
            display: flex;
            align-items: center;
            padding: 13px 16px;
            cursor: pointer;
            user-select: none;
            transition: all 0.2s;
            gap: 10px;
            position: relative;
        }
        .sidebar-cat-header:hover {
            background: rgba(255,255,255,0.04);
        }
        .sidebar-cat-header .cat-icon {
            font-size: 14px;
            width: 20px;
            text-align: center;
            color: var(--accent);
            flex-shrink: 0;
        }
        .sidebar-cat-header .cat-name {
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
            flex: 1;
        }
        .sidebar-cat-header .cat-count {
            font-size: 11px;
            color: var(--text-secondary);
            background: rgba(255,255,255,0.06);
            padding: 2px 8px;
            border-radius: 10px;
        }
        .sidebar-cat-header .cat-arrow {
            font-size: 10px;
            color: var(--text-secondary);
            transition: transform 0.2s;
        }
        .sidebar-section.open .sidebar-cat-header .cat-arrow {
            transform: rotate(90deg);
        }
        .sidebar-section.open .sidebar-cat-header {
            background: rgba(59,130,246,0.06);
        }

        /* 子项容器 */
        .sidebar-subitems {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }
        .sidebar-section.open .sidebar-subitems {
            max-height: 2000px;
        }

        /* 子项 */
        .sidebar-tool {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 9px 16px 9px 46px;
            cursor: pointer;
            font-size: 13px;
            color: var(--text-secondary);
            transition: all 0.15s;
            text-decoration: none;
            border-left: 2px solid transparent;
            position: relative;
        }
        .sidebar-tool:hover {
            background: rgba(255,255,255,0.05);
            color: var(--text);
        }
        .sidebar-tool.active {
            background: rgba(59,130,246,0.1);
            color: var(--accent);
            border-left-color: var(--accent);
        }
        .sidebar-tool .tool-badge {
            font-size: 10px;
            padding: 1px 6px;
            border-radius: 8px;
            margin-left: auto;
            flex-shrink: 0;
        }
        .badge-new { background: rgba(16,185,129,0.2); color: var(--accent3); }
        .badge-hot { background: rgba(239,68,68,0.2); color: var(--accent4); }

        /* 侧边栏底部 */
        .sidebar-footer {
            margin-top: auto;
            padding: 12px 16px;
            border-top: 1px solid var(--border);
            font-size: 11px;
            color: var(--text-secondary);
            text-align: center;
            font-style: italic;
        }

        /* ===== 右侧内容区 ===== */
        .content-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            min-width: 0;
        }

        /* 内容区顶部标题栏 */
        .content-topbar {
            background: var(--panel-bg);
            border-bottom: 1px solid var(--border);
            padding: 10px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
            min-height: 48px;
        }
        .content-topbar .page-title {
            font-size: 15px;
            color: var(--accent2);
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .content-topbar .page-title i {
            font-size: 14px;
            color: var(--accent);
        }
        .content-topbar .page-title .subtitle {
            font-size: 12px;
            color: var(--text-secondary);
            font-weight: 400;
            font-style: italic;
        }
        .content-topbar .btn-group {
            display: flex;
            gap: 8px;
            align-items: center;
        }



        /* 按钮 - 与 trig-identities.html 一致 */
        .btn {
            background: var(--btn-bg);
            color: var(--text);
            border: 1px solid var(--border);
            padding: 7px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            font-family: 'Times New Roman', 'Microsoft YaHei', 'PingFang SC', serif;
            transition: all 0.2s;
            white-space: nowrap;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .btn:hover { background: var(--btn-hover); border-color: var(--accent); }
        .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
        .btn.accent { background: var(--accent2); border-color: var(--accent2); color: #000; }
        .btn.accent:hover { background: #fbbf24; }
        .btn.home {
            background: var(--accent3);
            border-color: var(--accent3);
            color: #fff;
            text-decoration: none;
        }
        .btn.home:hover { background: #059669; }

        /* iframe 容器 */
        .iframe-container {
            flex: 1;
            background: var(--bg);
            position: relative;
            overflow: hidden;
        }
        .iframe-container iframe {
            width: 100%;
            height: 100%;
            border: none;
        }

        /* ================================================================
           欢迎页 - 桌面 + 移动端全面设计
           ================================================================ */
        .welcome-screen {
            display: flex;
            flex-direction: column;
            height: 100%;
            overflow-y: auto;
            overflow-x: hidden;
        }
        .welcome-screen::-webkit-scrollbar { width: 4px; }
        .welcome-screen::-webkit-scrollbar-track { background: transparent; }
        .welcome-screen::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
        .welcome-inner {
            max-width: 900px;
            margin: 0 auto;
            width: 100%;
            padding: 0 24px;
            box-sizing: border-box;
        }

        /* ---------- Hero ---------- */
        .welcome-hero {
            text-align: center;
            padding: 32px 24px 24px;
            position: relative;
            overflow: hidden;
            border-bottom: 1px solid var(--border);
            margin-bottom: 0;
            flex-shrink: 0;
        }
        .welcome-hero::before {
            content: '';
            position: absolute;
            inset: 0;
            background: radial-gradient(ellipse at 50% 0%, rgba(59,130,246,0.06) 0%, transparent 70%);
            pointer-events: none;
        }
        .welcome-hero-icon {
            font-size: 44px;
            background: linear-gradient(135deg, var(--accent2), #f97316);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 8px;
            position: relative;
            z-index: 1;
        }
        .welcome-hero h2 {
            font-size: 22px;
            color: var(--text);
            font-weight: 700;
            margin: 0 0 6px;
            position: relative;
            z-index: 1;
        }
        .welcome-hero .hero-subtitle {
            color: var(--text-secondary);
            font-size: 13px;
            line-height: 1.6;
            margin: 0 auto;
            position: relative;
            z-index: 1;
            max-width: 520px;
        }
        .welcome-hero .hero-subtitle .highlight {
            color: var(--accent2);
            font-weight: 600;
        }
        /* 浮动符号 */
        .hero-float-symbols {
            position: absolute; inset: 0; pointer-events: none; z-index: 0;
        }
        .hero-float-symbols span {
            position: absolute;
            color: rgba(148,163,184,0.08);
            font-size: 22px;
            font-family: 'Times New Roman', serif;
            font-style: italic;
            animation: floatUpDown 10s ease-in-out infinite;
        }
        .hero-float-symbols span:nth-child(1) { top: 8%; left: 5%; animation-delay: 0s; font-size: 26px; }
        .hero-float-symbols span:nth-child(2) { top: 15%; right: 4%; animation-delay: 1.5s; font-size: 18px; }
        .hero-float-symbols span:nth-child(3) { top: 60%; left: 3%; animation-delay: 3s; font-size: 20px; }
        .hero-float-symbols span:nth-child(4) { top: 55%; right: 6%; animation-delay: 4.5s; font-size: 24px; }
        .hero-float-symbols span:nth-child(5) { top: 12%; left: 48%; animation-delay: 6s; font-size: 16px; }
        .hero-float-symbols span:nth-child(6) { top: 40%; left: 10%; animation-delay: 2s; font-size: 18px; }
        .hero-float-symbols span:nth-child(7) { top: 35%; right: 12%; animation-delay: 5s; font-size: 22px; }
        .hero-float-symbols span:nth-child(8) { top: 70%; left: 35%; animation-delay: 7s; font-size: 14px; }
        @keyframes floatUpDown {
            0%,100% { transform: translateY(0) rotate(0deg); opacity: 0.08; }
            50% { transform: translateY(-10px) rotate(4deg); opacity: 0.14; }
        }

        /* ---------- 统计数字 ---------- */
        .welcome-stats {
            display: flex;
            gap: 0;
            flex-shrink: 0;
            border-bottom: 1px solid var(--border);
        }

        /* AI 拍照解题入口卡片 */
        .ai-entry {
            display: flex;
            align-items: center;
            gap: 14px;
            flex-shrink: 0;
            margin: 14px 0 0;
            padding: 13px 16px;
            text-decoration: none;
            border: 1px solid rgba(59,130,246,0.35);
            border-radius: 12px;
            background: linear-gradient(100deg, rgba(59,130,246,0.14), rgba(139,92,246,0.10));
            transition: .2s;
        }
        .ai-entry:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.18); }
        .ai-entry-ic {
            width: 40px; height: 40px; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
            border-radius: 11px; background: var(--accent); color: #fff; font-size: 17px;
        }
        .ai-entry-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
        .ai-entry-txt b { font-size: 14.5px; color: var(--text); }
        .ai-entry-txt span { font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; }
        .ai-entry-go { margin-left: auto; font-size: 12.5px; color: var(--accent); white-space: nowrap; flex-shrink: 0; }
        .ai-entry-go i { margin-left: 5px; }
        .welcome-stat {
            flex: 1;
            padding: 12px 8px;
            text-align: center;
            cursor: pointer;
            transition: background 0.2s;
            border-right: 1px solid rgba(51,65,85,0.4);
        }
        .welcome-stat:last-child { border-right: none; }
        .welcome-stat:hover { background: rgba(59,130,246,0.06); }
        .welcome-stat .num {
            font-size: 24px;
            font-weight: 700;
            color: var(--accent);
            font-style: italic;
            line-height: 1;
        }
        .welcome-stat .label {
            font-size: 11px;
            color: var(--text-secondary);
            margin-top: 4px;
        }

        /* ---------- 双栏主体 ---------- */
        .welcome-body {
            display: flex;
            gap: 0;
            flex: 1;
            min-height: 0;
            border-bottom: 1px solid var(--border);
        }
        .welcome-body-left {
            flex: 1;
            min-width: 0;
            min-height: 0;
            overflow-y: auto;
            border-right: 1px solid var(--border);
        }
        .welcome-body-left::-webkit-scrollbar { width: 4px; }
        .welcome-body-left::-webkit-scrollbar-track { background: transparent; }
        .welcome-body-left::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
        .welcome-body-right {
            width: 320px;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
        }
        .welcome-section-hd {
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
            padding: 14px 20px 10px;
            display: flex;
            align-items: center;
            gap: 7px;
            border-bottom: 1px solid rgba(51,65,85,0.3);
        }
        .welcome-section-hd i { color: var(--accent); width: 16px; text-align: center; }

        /* 分类卡片网格 - 桌面端 2行×3列 等宽 */
        .welcome-categories {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: auto auto;
            padding: 14px 20px 20px;
            gap: 10px;
        }

        .welcome-cat-card {
            background: var(--panel-bg);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 14px 16px;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
            overflow: hidden;
        }
        .welcome-cat-card:hover {
            border-color: var(--accent);
            box-shadow: 0 4px 16px rgba(0,0,0,0.25);
        }
        .welcome-cat-card .card-icon-row {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 6px;
        }
        .welcome-cat-card .card-icon {
            width: 34px; height: 34px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 15px;
            flex-shrink: 0;
        }
        .card-icon.cat-func { background: rgba(59,130,246,0.15); color: #3b82f6; }
        .card-icon.cat-solid { background: rgba(139,92,246,0.15); color: #8b5cf6; }
        .card-icon.cat-analytic { background: rgba(245,158,11,0.15); color: #f59e0b; }
        .card-icon.cat-vector { background: rgba(16,185,129,0.15); color: #10b981; }
        .card-icon.cat-prob { background: rgba(239,68,68,0.15); color: #ef4444; }
        .card-icon.cat-inquiry { background: rgba(236,72,153,0.15); color: #ec4899; }
        .welcome-cat-card .card-name {
            font-size: 14px; font-weight: 600; color: var(--text);
        }
        .welcome-cat-card .card-desc {
            font-size: 11px; color: var(--text-secondary); line-height: 1.5;
        }
        .welcome-cat-card .card-count {
            display: inline-block;
            margin-top: 6px;
            font-size: 11px;
            color: var(--accent);
            background: rgba(59,130,246,0.1);
            padding: 2px 9px;
            border-radius: 10px;
        }

        /* 精选推荐列表 */
        .welcome-featured {
            flex: 1;
            overflow-y: auto;
            padding: 10px 14px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .welcome-featured::-webkit-scrollbar { width: 3px; }
        .welcome-featured::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
        .welcome-feat-item {
            background: var(--panel-bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 10px 14px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .welcome-feat-item:hover {
            border-color: var(--accent2);
            background: rgba(245,158,11,0.04);
        }
        .welcome-feat-item .feat-icon {
            font-size: 16px; color: var(--accent2);
            width: 22px; text-align: center; flex-shrink: 0;
        }
        .welcome-feat-item .feat-info {
            flex: 1; min-width: 0;
        }
        .welcome-feat-item .feat-name {
            font-size: 12px; color: var(--text); font-weight: 600;
        }
        .welcome-feat-item .feat-desc {
            font-size: 10px; color: var(--text-secondary); margin-top: 1px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .welcome-feat-item .feat-tag {
            font-size: 10px; padding: 1px 7px; border-radius: 8px; flex-shrink: 0;
        }
        .feat-tag.hot { background: rgba(239,68,68,0.15); color: #ef4444; }
        .feat-tag.new { background: rgba(16,185,129,0.15); color: #10b981; }

        /* ---------- 底部 ---------- */
        .welcome-footer {
            flex-shrink: 0;
            padding: 12px 24px;
            text-align: center;
            font-size: 11px;
            color: var(--text-secondary);
            line-height: 1.6;
        }
        .welcome-footer span { color: var(--accent2); }

        /* 汉堡菜单 - 移动端 */
        .menu-toggle {
            display: none;
            background: none;
            border: none;
            color: var(--text);
            cursor: pointer;
            padding: 6px;
            font-size: 20px;
        }

        /* 侧边栏遮罩 */
        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            z-index: 20;
        }
        .sidebar-overlay.show { display: block; }

        /* ===== 响应式 ===== */
        @media (max-width: 768px) {
            /* 全局 */
            .menu-toggle { display: block; }
            .sidebar {
                position: fixed;
                top: 0; left: 0; bottom: 0;
                z-index: 30;
                transform: translateX(-100%);
                transition: transform 0.3s;
                box-shadow: 4px 0 20px rgba(0,0,0,0.5);
            }
            .sidebar.open { transform: translateX(0); }
            .header h1 { font-size: 15px; }
            .header h1 span { display: none; }
            .stat-badge { display: none; }
            .content-topbar { padding: 8px 12px; }
            .content-topbar .page-title { font-size: 13px; }
            .btn { padding: 6px 12px; font-size: 12px; }

            /* 欢迎页 - 移动端 */
            .welcome-inner { padding: 0 12px; }
            .welcome-hero {
                padding: 20px 16px 16px;
            }
            .welcome-hero-icon { font-size: 36px; }
            .welcome-hero h2 { font-size: 18px; }
            .welcome-hero .hero-subtitle {
                font-size: 12px;
                max-width: 100%;
            }
            .welcome-hero .hero-subtitle br { display: none; }
            .hero-float-symbols { display: none; }

            /* 统计条 - 移动端紧凑 */
            .welcome-stats { flex-wrap: wrap; }
            .welcome-stat {
                flex: 1 1 18%;
                min-width: 50px;
                padding: 10px 4px;
                border-bottom: 1px solid rgba(51,65,85,0.4);
            }
            .welcome-stat .num { font-size: 18px; }
            .welcome-stat .label { font-size: 10px; }

            /* 双栏变单栏 */
            .welcome-body {
                flex-direction: column;
            }
            .welcome-body-left {
                border-right: none;
                border-bottom: 1px solid var(--border);
            }
            .welcome-body-right {
                width: 100%;
                max-height: 300px;
            }

            /* 分类卡片 - 移动端 2 列 */
            .welcome-categories {
                grid-template-columns: 1fr 1fr;
                padding: 10px 14px;
                gap: 8px;
            }
            .welcome-cat-card {
                padding: 12px 12px;
            }
            .welcome-cat-card .card-icon {
                width: 28px; height: 28px;
                font-size: 13px; border-radius: 6px;
            }
            .welcome-cat-card .card-name { font-size: 12px; }
            .welcome-cat-card .card-desc {
                font-size: 10px;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                overflow: hidden;
            }

            /* 精选推荐 - 移动端 */
            .welcome-featured { padding: 8px 12px; gap: 4px; }
            .welcome-feat-item { padding: 8px 12px; gap: 8px; }
            .welcome-feat-item .feat-icon { font-size: 14px; width: 18px; }
            .welcome-feat-item .feat-name { font-size: 11px; }
            .welcome-feat-item .feat-desc { font-size: 9px; }

            /* 底部 */
            .welcome-footer { padding: 10px 16px; font-size: 10px; }
        }
        /* 学段切换：初中数学入口（点击进入初中数学动态模型实验室） */
        .stat-badge.subject-link {
            text-decoration: none;
            cursor: pointer;
            transition: all .2s;
        }
        .stat-badge.subject-link:hover {
            background: var(--accent, #3b82f6);
            color: #fff;
            border-color: var(--accent, #3b82f6);
        }

        /* 学段切换器：高中数学 / 初中数学 */
        .subject-switch {
            display: inline-flex;
            align-items: center;
            gap: 2px;
            padding: 3px;
            border-radius: 999px;
            background: rgba(59, 130, 246, .10);
            border: 1px solid rgba(59, 130, 246, .28);
        }
        .subject-switch .sw {
            display: inline-flex;
            align-items: center;
            padding: 5px 13px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 700;
            color: #2563eb;
            text-decoration: none;
            white-space: nowrap;
            line-height: 1.4;
            transition: all .18s;
        }
        .subject-switch .sw:hover {
            background: rgba(59, 130, 246, .18);
        }
        .subject-switch .sw.on {
            background: #3b82f6;
            color: #fff;
            box-shadow: 0 2px 6px rgba(59, 130, 246, .35);
        }
        /* 页面上所有英文字母用「新罗马斜体」（由页尾脚本把英文单词包成 <i class="en">） */
        .en {
            font-family: "Times New Roman", Times, serif;
            font-style: italic;
            font-weight: 600;
        }
        /* 第三个并列系统：AI 拍照解题（橙色，与「学段」区分开） */
        .subject-switch .sw.ai { background: rgba(234, 88, 12, .12); color: #ea580c; }
        .subject-switch .sw.ai:hover { background: rgba(234, 88, 12, .22); }
        .subject-switch .sw.ai i { margin-right: 4px; }
        @media (max-width: 640px) {
            .subject-switch .sw { padding: 4px 9px; font-size: 11px; }
        }
    
        /* 数学排版字体规范（统一补齐） */
        .math-font { font-family: 'Times New Roman', serif; font-style: italic; }
        .math-fn  { font-family: 'Times New Roman', serif; font-style: normal; }
        .math-num { font-family: 'Times New Roman', serif; font-style: normal; }
