/* ==========================================================
   青少年编程课程学习系统 - 设计系统
   零外部依赖，纯离线可用
   ========================================================== */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --accent: #06b6d4;
    --accent-light: #ecfeff;
    --warn: #f59e0b;
    --warn-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #10b981;
    --success-light: #ecfdf5;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #fafbfd;
    --border: #e5e9f0;
    --border-strong: #d3d9e4;

    --text: #1a2233;
    --text-2: #5b6577;
    --text-3: #98a2b3;

    --radius: 14px;
    --radius-sm: 9px;
    --radius-lg: 20px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 12px 32px rgba(16, 24, 40, .08);
    --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);

    --nav-h: 62px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
            "Courier New", "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color .18s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cfd6e4; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b3bdcf; background-clip: content-box; }

.container { width: min(1240px, 100% - 40px); margin-inline: auto; }
.container-narrow { width: min(860px, 100% - 40px); margin-inline: auto; }

/* ================= 导航栏 ================= */
.navbar {
    position: sticky; top: 0; z-index: 100;
    height: var(--nav-h);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.navbar .container { height: 100%; display: flex; align-items: center; gap: 26px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text > span:first-child { font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; }
.brand-sub { font-size: 10px; font-weight: 500; color: var(--text-3); letter-spacing: 1.4px; margin-top: 2px; }
.brand-logo {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid; place-items: center;
    color: #fff; font-size: 17px; font-weight: 800;
    box-shadow: 0 3px 10px rgba(79, 70, 229, .32);
}

.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-links a {
    padding: 8px 14px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: 14.5px;
    transition: all .18s;
}
.nav-links a:hover { background: var(--primary-light); color: var(--primary); }
.nav-links a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.nav-right { display: flex; align-items: center; gap: 12px; }

.user-chip {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 13px 5px 5px; border-radius: 100px;
    background: var(--surface-2); border: 1px solid var(--border);
    cursor: pointer; transition: all .18s;
}
.user-chip:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; display: grid; place-items: center;
    font-size: 13px; font-weight: 700; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.user-chip .uname { font-size: 14px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= 按钮 ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: var(--primary); color: #fff;
    font-weight: 600; font-size: 14.5px; cursor: pointer;
    transition: all .18s; white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 70, 229, .28); color: #fff; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); box-shadow: none; }

.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); color: var(--primary-dark); box-shadow: none; }

.btn-sm { padding: 6px 13px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { padding: 13px 30px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239, 68, 68, .3); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; box-shadow: 0 4px 12px rgba(16, 185, 129, .3); }

/* ================= 卡片 ================= */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden;
}
.card-hover { transition: all .22s cubic-bezier(.4, 0, .2, 1); cursor: pointer; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: #d8dfeb; }
.card-head {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--surface);
}
.card-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ================= 徽章 ================= */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 100px;
    font-size: 12px; font-weight: 600; line-height: 1.6;
    background: var(--primary-light); color: var(--primary);
}
.badge-gray { background: #f1f4f9; color: var(--text-2); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-amber { background: var(--warn-light); color: #b45309; }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-cyan { background: var(--accent-light); color: #0e7490; }
.badge-dot::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ================= 表单 ================= */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.form-label .req { color: var(--danger); }
.input, .textarea, .select {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: #fff; transition: all .18s; outline: none;
}
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
.form-hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ================= 首页 ================= */
.hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #06b6d4 100%);
    color: #fff; padding: 76px 0 88px;
}
.hero::before, .hero::after {
    content: ''; position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}
.hero::before { width: 380px; height: 380px; top: -140px; right: -90px; }
.hero::after { width: 260px; height: 260px; bottom: -130px; left: -70px; }
.hero .container { position: relative; z-index: 1; }
.hero-tag {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 15px; border-radius: 100px;
    background: rgba(255, 255, 255, .18); backdrop-filter: blur(6px);
    font-size: 13px; font-weight: 600; margin-bottom: 22px;
}
.hero h1 { font-size: 44px; font-weight: 800; line-height: 1.22; letter-spacing: -.5px; margin-bottom: 18px; }
.hero p { font-size: 17px; opacity: .93; max-width: 620px; margin-bottom: 30px; line-height: 1.75; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn-light {
    background: #fff; color: var(--primary); font-weight: 700;
}
.hero .btn-light:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); color: var(--primary-dark); }
.hero .btn-ghost-light {
    background: rgba(255, 255, 255, .14); color: #fff;
    border: 1.5px solid rgba(255, 255, 255, .45);
}
.hero .btn-ghost-light:hover { background: rgba(255, 255, 255, .24); color: #fff; }

.hero-stats { display: flex; gap: 46px; margin-top: 48px; flex-wrap: wrap; }
.hero-stat .num { font-size: 32px; font-weight: 800; line-height: 1.1; }
.hero-stat .lbl { font-size: 13.5px; opacity: .85; margin-top: 2px; }

.section { padding: 60px 0; }
.section-head { text-align: center; margin-bottom: 38px; }
.section-head h2 { font-size: 29px; font-weight: 800; margin-bottom: 10px; letter-spacing: -.3px; }
.section-head p { color: var(--text-2); font-size: 15.5px; max-width: 620px; margin-inline: auto; }

/* 特性卡 */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.feature {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 26px 22px; box-shadow: var(--shadow);
    transition: all .22s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-icon {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    font-size: 22px; margin-bottom: 15px;
}
.feature h4 { font-size: 16.5px; font-weight: 700; margin-bottom: 8px; }
.feature p { color: var(--text-2); font-size: 14px; line-height: 1.7; }

/* ================= 课程网格 ================= */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin-bottom: 26px; padding: 16px 18px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.chip {
    padding: 7px 16px; border-radius: 100px; border: 1px solid var(--border-strong);
    background: #fff; font-size: 13.5px; font-weight: 600; color: var(--text-2);
    cursor: pointer; transition: all .18s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-bar .search-wrap { flex: 1; min-width: 200px; position: relative; }
.filter-bar .search-wrap .input { padding-left: 38px; }
.filter-bar .search-wrap::before {
    content: '🔍'; position: absolute; left: 13px; top: 50%;
    transform: translateY(-50%); font-size: 13px; opacity: .5;
}

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.course-cover {
    height: 152px; position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid; place-items: center;
}
.course-cover.alt2 { background: linear-gradient(135deg, #10b981, #06b6d4); }
.course-cover.alt3 { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
/* 自定义封面图（教师/机构上传的 LOGO）：覆盖渐变底，居中裁切铺满 */
.course-cover.has-cover {
    background: var(--surface-2) center / cover no-repeat;
}
.course-cover.has-cover::after {
    /* 顶部压一层浅渐变，保证右上角难度徽章在浅色图片上仍可读 */
    content: ''; position: absolute; inset: 0 0 auto 0; height: 56px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0));
}
.course-cover .cover-emoji { font-size: 54px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .2)); }
/* 封面上传预览框（课程设置 / 模板设置弹窗） */
.cover-picker {
    width: 96px; height: 96px; flex: none; border-radius: 10px; overflow: hidden;
    border: 1px solid var(--border); background: var(--surface-2);
    display: grid; place-items: center; font-size: 34px;
    background-size: cover; background-position: center;
}
.course-cover .cover-level {
    position: absolute; top: 12px; right: 12px;
    padding: 4px 11px; border-radius: 100px; font-size: 11.5px; font-weight: 700;
    background: rgba(255, 255, 255, .92); color: var(--text);
}
.course-body { padding: 17px 19px 19px; }
.course-body h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 7px; line-height: 1.45; }
.course-body .sub { font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; min-height: 40px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-meta {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 13px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3);
}
.course-meta .teacher { display: flex; align-items: center; gap: 7px; }

/* ================= 课堂布局 ================= */
.classroom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 320px;
    gap: 14px; padding: 14px;
    height: calc(100vh - var(--nav-h));
    background: #e8ecf4;
}
.classroom.with-roster { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px; }

/* ---- 右侧栏：学生(教师) + 课堂互动 上下分隔，整列可折叠隐藏 ---- */
.side-col {
    display: flex; flex-direction: column; gap: 14px;
    min-height: 0; min-width: 0;
}
.side-col .panel { flex: 1; min-height: 0; }
.side-col .panel-students { flex: 1; }
.side-col .panel-chat { flex: 1.15; }
/* 折叠成 46px 竖条（点击展开） */
.side-col.collapsed { width: 46px; min-width: 46px; }
.side-col.collapsed .panel { display: none; }
.side-col-bar {
    display: none; flex: none;
    align-items: center; justify-content: center;
    width: 100%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    cursor: pointer; overflow: hidden; user-select: none;
    font-size: 19px; font-weight: 800; color: var(--text-3);
}
.side-col.collapsed .side-col-bar {
    /* 与 .panel.collapsed .panel-head 完全对齐：同 padding / 同 gap / 同字重 / 同色 */
    display: flex; flex: 1;
    flex-direction: column; justify-content: flex-start; align-items: center;
    padding: 12px 0 10px; gap: 8px;
    font-size: 12.5px; font-weight: 700; color: var(--text);
}
/* 与 .panel.collapsed .panel-title > span:first-child 对齐 */
.side-col-bar-ic {
    font-size: 19px; letter-spacing: 0; line-height: 1;
    margin-bottom: 4px; flex: none;
}
/* 与 .panel.collapsed .panel-title 对齐（仅少了 min-width，竖条无需） */
.side-col-bar-t {
    writing-mode: vertical-rl; text-orientation: upright;
    font-size: 12.5px; font-weight: 700; letter-spacing: 4px; flex: none;
}
/* 底部展开箭头：与「课堂内容/代码区」竖条底部的 .btn-collapse
   （btn + btn-sm + btn-ghost + btn-collapse）视觉完全一致：
   padding 2px 8px / 15px / 800 / --text-3 + .btn-ghost 的 1px 边框 + .btn-sm 的 8px 圆角；
   margin-top:auto 推到竖条底部。 */
.side-col-bar-ar {
    margin-top: auto; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 8px;
    font-size: 15px; line-height: 1; font-weight: 800;
    color: var(--text-3);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    transition: all .15s;
}
/* hover 与 .btn-ghost:hover + .panel .btn-collapse:hover 组合效果对齐 */
.side-col-bar:hover .side-col-bar-ar {
    color: var(--primary);
    border-color: var(--border-strong);
    background: var(--surface-2);
}
.side-col-bar:hover { background: var(--primary-light); color: var(--primary); }

/* ---- 课堂面板折叠（收起成窄竖条，点击展开） ---- */
.panel .btn-collapse {
    padding: 2px 8px; font-size: 15px; line-height: 1; font-weight: 800;
    color: var(--text-3); flex: none;
}
.panel .btn-collapse:hover { color: var(--primary); }
.panel.collapsed { width: 46px; min-width: 46px; }
.panel.collapsed > *:not(.panel-head) { display: none !important; }
.panel.collapsed .panel-head {
    flex-direction: column; justify-content: flex-start; align-items: center;
    padding: 12px 0 10px; gap: 16px; height: 100%;
    cursor: pointer; border-bottom: none; overflow: hidden;
}
.panel.collapsed .panel-head:hover { background: var(--primary-light); }
.panel.collapsed .panel-title {
    writing-mode: vertical-rl; text-orientation: upright;
    font-size: 12.5px; letter-spacing: 4px; flex: none;
}
.panel.collapsed .panel-title > span:first-child { font-size: 19px; letter-spacing: 0; margin-bottom: 4px; }
.panel.collapsed .panel-tools { margin-top: auto; }
/* 折叠成竖条后只保留「展开/收起」按钮：
   业务按钮（预览/编辑 tabs、PPT、运行、语言徽标、实时同步徽标…）
   在 46px 窄条里既放不下也无意义，一律隐藏，避免残留。 */
.panel.collapsed .panel-tools > *:not(.btn-collapse) { display: none !important; }

.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); display: flex; flex-direction: column;
    overflow: hidden; box-shadow: var(--shadow); min-height: 0;
}
.panel-head {
    padding: 11px 15px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--surface-2); flex: none;
}
.panel-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.panel-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.panel-body { flex: 1; overflow: auto; min-height: 0; }
.panel-body.pad { padding: 18px 22px; }

/* 课堂顶栏 */
.class-bar {
    height: 54px; background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 18px;
}
.class-bar .room-code {
    font-family: var(--mono); font-size: 19px; font-weight: 800;
    letter-spacing: 2.5px; color: var(--primary);
    padding: 3px 12px; background: var(--primary-light); border-radius: 8px;
}
.mode-switch { display: flex; background: #f1f4f9; border-radius: 9px; padding: 3px; gap: 2px; }
.mode-switch button {
    padding: 6px 15px; border: none; background: transparent; border-radius: 7px;
    font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .18s;
}
.mode-switch button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

/* 内容区（教师讲义渲染） */
.doc { font-size: 15px; line-height: 1.85; color: #2a3347; }
.doc h1 { font-size: 25px; font-weight: 800; margin: 0 0 16px; padding-bottom: 11px; border-bottom: 2px solid var(--border); }
.doc h2 { font-size: 19.5px; font-weight: 700; margin: 26px 0 12px; padding-left: 11px; border-left: 4px solid var(--primary); }
.doc h3 { font-size: 16.5px; font-weight: 700; margin: 20px 0 10px; }
.doc p { margin-bottom: 13px; }
.doc ul, .doc ol { margin: 0 0 14px 22px; }
.doc li { margin-bottom: 6px; }
.doc blockquote {
    margin: 14px 0; padding: 12px 16px; border-left: 4px solid var(--warn);
    background: var(--warn-light); border-radius: 0 8px 8px 0; color: #78350f;
}
.doc code:not(pre code) {
    background: #f1f4f9; padding: 2px 6px; border-radius: 5px;
    font-family: var(--mono); font-size: 13px; color: #be185d;
}
.doc pre {
    background: #1e2537; color: #e8ecf5; padding: 15px 17px; border-radius: 10px;
    overflow-x: auto; margin: 14px 0; font-family: var(--mono); font-size: 13.5px; line-height: 1.7;
    white-space: pre; tab-size: 4;   /* 代码缩进原样展示：Tab 按 4 列宽渲染 */
}
/* 讲义代码块：语言标签 + 一键复制 */
.doc .md-code {
    border-radius: 10px; overflow: hidden; margin: 14px 0;
    border: 1px solid #2c3648; background: #1e2537;
}
.doc .md-code-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; background: #1a2030; border-bottom: 1px solid #2c3648;
}
.md-code-lang {
    font-size: 11.5px; font-weight: 700; letter-spacing: .5px; color: #8b97b3;
    text-transform: uppercase;
}
.md-copy {
    font-size: 11.5px; font-weight: 600; color: #cbd5e1; cursor: pointer;
    background: rgba(255, 255, 255, .08); border: none; border-radius: 6px; padding: 3px 10px;
    transition: background .15s, color .15s;
}
.md-copy:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.doc .md-code pre { margin: 0; border-radius: 0; }
.doc table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.doc th { background: var(--surface-2); font-weight: 700; }
/* 分隔线：统一按 class 控制，任何容器（ .doc / 题面 .ex-md / 预览 …）都只画一条细线，
   避免脱离 .doc 后回落到浏览器 UA 默认 inset 边框（上下各一条，看起来像两条横线）。
   标题自带分隔线时不重复叠加一条。 */
hr.md-hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.doc h1 + hr.md-hr, .doc h2 + hr.md-hr, .doc h3 + hr.md-hr,
.ex-md h1 + hr.md-hr, .ex-md h2 + hr.md-hr, .ex-md h3 + hr.md-hr { display: none; }
.doc hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.doc img { border-radius: 8px; margin: 10px 0; }

/* 代码编辑器（零依赖，行号 + 高亮） */
.editor-wrap { position: relative; flex: 1; min-height: 0; display: flex; background: #1e2537; }
.editor-gutter {
    width: 50px; flex: none; background: #1a2030; color: #5c6780;
    font-family: var(--mono); font-size: 13.5px; line-height: 21px;
    padding: 12px 8px 12px 0; text-align: right; user-select: none;
    overflow: hidden; border-right: 1px solid #2c3648;
    white-space: pre;               /* 每个行号独占一行（\n 生效） */
}
.editor-area { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.editor-highlight, .editor-input {
    position: absolute; inset: 0; margin: 0; padding: 12px 16px;
    font-family: var(--mono); font-size: 13.5px; line-height: 21px;
    white-space: pre; overflow: auto; border: none; tab-size: 4;
}
.editor-highlight {
    pointer-events: none; color: #e8ecf5; z-index: 1; background: transparent;
}
/* 叠底层：参考答案半透明垫在代码框最底部（教师端专用）。
   纯本地视觉——不参与编辑、不被 getValue 读到、不触发 onChange（不会广播给学生） */
.editor-ghost {
    position: absolute; inset: 0; margin: 0; padding: 12px 16px;
    font-family: var(--mono); font-size: 13.5px; line-height: 21px;
    white-space: pre; overflow: auto; border: none; tab-size: 4;
    pointer-events: none; z-index: 0; background: transparent;
    color: #8fa3c8; opacity: .42;
}
.editor-ghost::-webkit-scrollbar { display: none; }
.editor-ghost { scrollbar-width: none; }
.editor-ghost code {
    display: block; font: inherit; color: inherit;
    background: transparent; padding: 0; margin: 0;
}
.editor-highlight code {
    /* <code> 显式 block + 继承字体度量，与 textarea 行高/基线完全一致，
       避免 inline baseline 对齐带来的 1-2px 错位 */
    display: block; font: inherit; color: inherit;
    background: transparent; padding: 0; margin: 0;
}
.editor-input {
    z-index: 2; background: transparent; color: transparent;
    caret-color: #fff; resize: none; outline: none;
}
.editor-input::selection { background: rgba(99, 102, 241, .45); }
.editor-input::-webkit-scrollbar { display: none; }
.editor-readonly .editor-input { caret-color: transparent; }
/* 只读观看（学生看教师/他人代码）：显示可拖动的滚动条，方便浏览长代码；
   遮罩不拦鼠标——readOnly 已保证不可编辑，滚动/拖动/选择均放行 */
.editor-readonly .editor-input::-webkit-scrollbar { display: block; }
.editor-readonly .editor-input::-webkit-scrollbar-thumb {
    background: #3a4763; border-radius: 5px; border: 2px solid #1e2537;
}
.editor-readonly .editor-input::-webkit-scrollbar-thumb:hover { background: #4a5a80; }
.editor-readonly .editor-input::-webkit-scrollbar-corner { background: transparent; }
.editor-readonly .editor-input { scrollbar-width: thin; scrollbar-color: #3a4763 transparent; }
.editor-readonly::after {
    content: ''; position: absolute; inset: 0; z-index: 3;
    pointer-events: none;
}

/* 语法高亮 token */
.tok-kw { color: #c792ea; }
.tok-str { color: #c3e88d; }
.tok-num { color: #f78c6c; }
.tok-com { color: #6b7a99; font-style: italic; }
.tok-fn { color: #82aaff; }
.tok-op { color: #89ddff; }
.tok-bk { color: #ffcb6b; }
/* C++ 预处理指令（#include / #define…）：与注释区分开，不斜体 */
.tok-pre { color: #c792ea; }

/* 代码输入诊断：错误/警告波浪线（hover 编辑器时由 JS 显示原因气泡） */
.editor-highlight .diag-err {
    text-decoration: underline wavy #f87171 1.5px;
    text-underline-offset: 3px;
}
.editor-highlight .diag-warn {
    text-decoration: underline wavy #fbbf24 1.5px;
    text-underline-offset: 3px;
}
.editor-tip {
    position: fixed; z-index: 10000; display: none; pointer-events: none;
    background: #101624; border: 1px solid #2c3648; color: #e8ecf5;
    font-size: 12px; line-height: 1.6; padding: 7px 11px;
    border-radius: 8px; max-width: 300px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.editor-tip i {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 6px; vertical-align: 0;
}
.editor-tip .ti-err { background: #f87171; }
.editor-tip .ti-warn { background: #fbbf24; }

/* 学生列表 */
.student-list { padding: 8px; }
.student-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; border-radius: 10px; cursor: pointer; transition: all .16s;
    border: 1px solid transparent;
}
.student-item:hover { background: var(--surface-2); border-color: var(--border); }
.student-item.focused { background: var(--primary-light); border-color: var(--primary); }
.student-item.shared { background: var(--warn-light); border-color: var(--warn); }
.student-item .info { flex: 1; min-width: 0; }
.student-item .nm {
    font-size: 13.5px; font-weight: 600; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.student-item .st { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.student-item .ops { display: flex; gap: 4px; flex: none; }
.student-item .ops button {
    width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font-size: 12px; display: grid; place-items: center;
    transition: all .16s; color: var(--text-2);
}
.student-item .ops button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.student-item .ops button.on { background: var(--warn); color: #fff; border-color: var(--warn); }
.dot-online { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }
.dot-offline { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; flex: none; }

.raised-badge {
    display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10.5px;
    background: var(--warn); color: #fff; font-weight: 700; animation: pulse 1.4s infinite;
}
.muted-badge {
    display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10.5px;
    background: #ef4444; color: #fff; font-weight: 700;
}
/* 教师端「全员禁言」按钮激活态 */
#btnMuteAll.on { background: var(--warn); color: #fff; border-color: var(--warn); }
/* 学生被禁言：聊天输入框置灰 */
#chatInput:disabled, #btnSend:disabled { opacity: .55; cursor: not-allowed; }

/* 学生被禁言时的提示条 */
.mute-hint {
    display: flex; align-items: center; gap: 6px; padding: 8px 12px;
    font-size: 12.5px; color: #ef4444; background: #fef2f2;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}

/* 聊天 */
.chat-list { display: flex; flex-direction: column; gap: 11px; padding: 14px; }
.chat-msg { display: flex; gap: 9px; }
.chat-msg .bubble {
    flex: 1; min-width: 0; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 8px 12px;
}
.chat-msg.own { flex-direction: row-reverse; }
.chat-msg.own .bubble { background: var(--primary-light); border-color: #c7d2fe; border-radius: 12px 4px 12px 12px; }
.chat-msg .who { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 2px; }
.chat-msg .txt { font-size: 13.5px; word-break: break-word; line-height: 1.6; }
.chat-msg.system { justify-content: center; }
.chat-msg.system .bubble {
    background: transparent; border: none; text-align: center;
    font-size: 12.5px; color: var(--text-3); padding: 2px 0;
}
.chat-input { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--border); background: var(--surface); flex: none; }

/* 共享屏幕横幅 */
.share-banner {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    z-index: 200; display: flex; align-items: center; gap: 14px;
    padding: 12px 20px; border-radius: 100px;
    background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff;
    box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600;
    animation: slideUp .3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 同步状态提示 */
.sync-flash {
    position: absolute; top: 8px; right: 12px; z-index: 5;
    padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 700;
    background: rgba(16, 185, 129, .92); color: #fff;
    opacity: 0; transition: opacity .3s; pointer-events: none;
}
.sync-flash.show { opacity: 1; }

/* ================= 表格 ================= */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--surface-2); font-weight: 700; font-size: 13px; color: var(--text-2); }
.table tbody tr:hover { background: var(--surface-2); }
.table td .btn { padding: 4px 10px; font-size: 12.5px; }

/* ================= 空状态 ================= */
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty .ico { font-size: 48px; margin-bottom: 14px; opacity: .55; }
.empty h4 { font-size: 16px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.empty p { font-size: 14px; }

/* ================= 提示 Toast ================= */
.toast-wrap {
    position: fixed; top: 74px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 400px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    background: #fff; border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
    animation: toastIn .28s cubic-bezier(.2, .9, .3, 1.2);
    pointer-events: auto;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.94); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .22s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.94); } }
.toast .ico { font-size: 17px; flex: none; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
.toast.warn { border-left: 4px solid var(--warn); }

/* ================= 弹窗 ================= */
.modal-mask {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(16, 24, 40, .5); backdrop-filter: blur(3px);
    display: grid; place-items: center; padding: 20px;
    animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff; border-radius: var(--radius-lg);
    width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); animation: modalIn .26s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
.modal.wide { width: min(820px, 100%); }
.modal-head {
    padding: 18px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none;
}
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-close {
    width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
    cursor: pointer; font-size: 19px; color: var(--text-3); display: grid; place-items: center;
    transition: all .16s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 22px; overflow: auto; flex: 1; }
.modal-foot {
    padding: 15px 22px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px; flex: none; background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ================= 登录页 ================= */
.auth-page {
    min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-side {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #fff; padding: 60px 56px; display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
}
.auth-side::before {
    content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
    background: rgba(255, 255, 255, .09); top: -120px; right: -140px;
}
.auth-side .brand { color: #fff; margin-bottom: 46px; position: relative; }
.auth-side h2 { font-size: 33px; font-weight: 800; margin-bottom: 16px; line-height: 1.3; position: relative; }
.auth-side p { opacity: .9; font-size: 15.5px; margin-bottom: 32px; position: relative; }
.auth-feature { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; position: relative; }
.auth-feature .ic {
    width: 34px; height: 34px; border-radius: 9px; flex: none;
    background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-size: 16px;
}
.auth-feature .tx { font-size: 14.5px; line-height: 1.6; }
.auth-feature .tx b { display: block; font-weight: 700; margin-bottom: 2px; }

.auth-main { display: grid; place-items: center; padding: 40px 20px; background: var(--bg); }
.auth-box { width: min(400px, 100%); }
.auth-box h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.auth-box .sub { color: var(--text-2); margin-bottom: 26px; font-size: 14.5px; }
.auth-tabs { display: flex; gap: 4px; background: #eef1f7; padding: 4px; border-radius: 11px; margin-bottom: 24px; }
.auth-tabs button {
    flex: 1; padding: 9px; border: none; background: transparent; border-radius: 8px;
    font-weight: 600; font-size: 14.5px; color: var(--text-2); cursor: pointer; transition: all .18s;
}
.auth-tabs button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.demo-accounts {
    margin-top: 20px; padding: 13px 15px; border-radius: var(--radius-sm);
    background: var(--primary-light); border: 1px dashed #c7d2fe; font-size: 13px;
}
.demo-accounts b { display: block; margin-bottom: 6px; color: var(--primary); font-size: 13px; }
.demo-accounts code {
    font-family: var(--mono); background: #fff; padding: 1px 6px;
    border-radius: 4px; font-size: 12.5px; margin-right: 4px;
}
.demo-accounts .row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }

/* ================= 课程详情/学习页 ================= */
.detail-hero {
    background: linear-gradient(135deg, #312e81, #4f46e5 55%, #06b6d4);
    color: #fff; padding: 40px 0 44px;
}
/* 自定义封面做头图：叠一层深色渐变，保证标题/元信息白字在任意图片上都可读 */
.detail-hero.has-cover {
    background: #312e81 center / cover no-repeat;
    position: relative;
}
.detail-hero.has-cover::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(49, 46, 129, .88),
                                rgba(79, 70, 229, .78) 55%, rgba(6, 182, 212, .72));
}
.detail-hero.has-cover .container { position: relative; z-index: 1; }
.detail-hero h1 { font-size: 32px; font-weight: 800; margin-bottom: 10px; line-height: 1.3; }
.detail-hero .sub { opacity: .92; font-size: 16px; margin-bottom: 18px; }
.detail-meta { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; opacity: .92; }
.detail-meta span { display: flex; align-items: center; gap: 6px; }

.learn-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; padding: 26px 0 50px; align-items: start; }
.learn-side { position: sticky; top: calc(var(--nav-h) + 20px); }
.chapter-block { margin-bottom: 6px; }
.chapter-title {
    padding: 9px 14px; font-weight: 700; font-size: 14px; color: var(--text-2);
    background: var(--surface-2); border-radius: 8px; display: flex; justify-content: space-between;
}
.lesson-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border-radius: 8px; cursor: pointer; transition: all .16s; font-size: 14px;
}
.lesson-item:hover { background: var(--primary-light); }
.lesson-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.lesson-item .idx {
    width: 22px; height: 22px; border-radius: 6px; flex: none;
    background: #eef1f7; color: var(--text-2); display: grid; place-items: center;
    font-size: 11.5px; font-weight: 700;
}
.lesson-item.active .idx { background: rgba(255, 255, 255, .25); color: #fff; }
.lesson-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.learn-main .card-head { flex-wrap: wrap; }
.lesson-tabs { display: flex; gap: 3px; }
.lesson-tabs button {
    padding: 7px 15px; border: none; background: transparent; border-radius: 8px;
    font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .16s;
}
.lesson-tabs button.active { background: var(--primary-light); color: var(--primary); }

/* ================= 页脚 ================= */
.footer {
    background: #16203a; color: #94a3b8; padding: 40px 0 24px; margin-top: 40px;
}
.footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 28px; }
.footer h5 { color: #fff; font-size: 15px; margin-bottom: 12px; font-weight: 700; }
.footer p { font-size: 13.5px; line-height: 1.8; }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: 8px; font-size: 13.5px; }
.footer a { color: #94a3b8; }
.footer a:hover { color: #fff; }
.footer .bottom {
    padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 13px; text-align: center;
}
.footer .brand { color: #fff; margin-bottom: 12px; }

/* ================= 连接状态 ================= */
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.conn-dot.on { background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.conn-dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
.conn-dot.wait { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); animation: pulse 1.2s infinite; }

/* ================= 代码区 + 输入/输出区 ================= */
/* 容器：纵向 flex，代码区与 io 区共享 panel 高度 */
.code-and-io {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* 代码/总览 与 输入输出区 之间的可拖拽分隔条 */
.io-splitter {
    flex: none;
    height: 6px;
    cursor: row-resize;
    background: var(--border);
    position: relative;
    transition: background .15s;
    user-select: none;
}
.io-splitter::after {
    /* 中间一个小抓手，提升拖动可发现性 */
    content: '';
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 36px; height: 2px;
    background: rgba(0, 0, 0, .25);
    border-radius: 2px;
}
.io-splitter:hover, .io-splitter.dragging { background: var(--primary); }
.io-splitter:hover::after, .io-splitter.dragging::after { background: rgba(255, 255, 255, .8); }

/* 输入 + 输出 容器：高度由分隔条控制；内部横向分两栏（左输入 / 右输出） */
.io-area {
    flex: none;
    display: flex; flex-direction: row;
    min-height: 80px; max-height: 70vh;
    border-top: 1px solid var(--border);
    background: #fafbfd;
    overflow: hidden;
}

.io-block {
    display: flex; flex-direction: column;
    min-height: 0; overflow: hidden;
}
.io-input-block {
    flex: 0 0 40%;
    min-width: 200px; max-width: 60%;
}
.io-output-block { flex: 1 1 0; min-width: 0; }

/* 输入 / 输出 之间的水平可拖拽分隔条 */
.io-h-splitter {
    flex: none;
    width: 6px;
    cursor: col-resize;
    background: var(--border);
    position: relative;
    transition: background .15s;
    user-select: none;
}
.io-h-splitter::after {
    content: '';
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 2px; height: 36px;
    background: rgba(0, 0, 0, .25);
    border-radius: 2px;
}
.io-h-splitter:hover, .io-h-splitter.dragging { background: var(--primary); }
.io-h-splitter:hover::after, .io-h-splitter.dragging::after { background: rgba(255, 255, 255, .8); }

/* 输入/输出 标题条：紧贴顶部，无空行 */
.io-head {
    flex: none;
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 12.5px; font-weight: 700; color: var(--text-2);
    user-select: none;
}
.io-head-ic { font-size: 13px; }
.io-head-t { flex: none; letter-spacing: .5px; white-space: nowrap; }
.io-head-hint {
    flex: 1; min-width: 0;
    font-size: 11.5px; font-weight: 400; color: var(--text-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 运行结果标题栏右侧：耗时 / 峰值内存（右对齐） */
.io-head-stats {
    flex: 0 1 auto; min-width: 0; margin-left: auto;
    font-size: 11.5px; font-weight: 600; color: var(--text-2);
    font-variant-numeric: tabular-nums; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
/* 有统计时隐藏冗余提示文案，给统计腾出宽度 */
.io-head.io-has-stats .io-head-hint { display: none; }
.io-head-btn {
    flex: none;
    padding: 2px 8px; font-size: 11.5px;
    border: 1px solid var(--border); background: #fff;
    color: var(--text-2); border-radius: 5px; cursor: pointer;
    transition: all .14s;
}
.io-head-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 输入区 */
#inputBox {
    flex: 1 1 auto; min-height: 0;
    width: 100%;
    padding: 8px 12px;
    border: none; outline: none; resize: none;
    background: #fff;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
    color: var(--text);
    box-sizing: border-box;
    tab-size: 4;
    overflow: auto;
}
#inputBox::placeholder { color: #9ca3b0; }

/* 输出区：等宽字体 + 深色底。
   注意：white-space 必须只加在 #outputText 上，不能加在 .io-output 容器上——
   容器在 HTML 里带缩进，pre-wrap 会把源码里的「换行+缩进空格」也渲染出来，
   导致输出内容上下各多出一个空行。 */
.io-output {
    flex: 1 1 auto; min-height: 0;
    overflow: auto;
    padding: 8px 12px;
    background: #1e2537; color: #e8ecf5;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
    white-space: normal;
}
#outputText {
    white-space: pre-wrap;      /* 只有输出内容保留换行与缩进 */
    word-break: break-word;
    overflow-wrap: anywhere;
}
.io-output:empty::before, #outputText:empty::before {
    content: attr(data-empty);
    color: #6b7a99; font-style: italic;
}

/* 拖动时全局禁用文本选择，避免拖动过程中误选 */
.io-splitter.dragging, .io-splitter.dragging * { cursor: row-resize !important; }
body.io-dragging, body.io-dragging * {
    cursor: row-resize !important;
    user-select: none !important;
}

/* ================= 响应式 ================= */
@media (max-width: 980px) {
    /* 单列堆叠：侧栏内 学生/互动 面板自然上下排列 */
    .classroom, .classroom.with-roster, .classroom.with-roster.with-students {
        grid-template-columns: 1fr; height: auto;
    }
    .panel { min-height: 380px; }
    /* 侧栏内面板：解除 flex 高度分配（特异性须覆盖 .side-col .panel 的 min-height:0） */
    .side-col .panel { flex: none; min-height: 380px; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .learn-layout { grid-template-columns: 1fr; }
    .learn-side { position: static; }
    .hero h1 { font-size: 34px; }
    .footer .cols { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 640px) {
    .nav-links { display: none; }
    .hero h1 { font-size: 28px; }
    .hero-stats { gap: 26px; }
    .form-row { grid-template-columns: 1fr; }
    .container { width: calc(100% - 28px); }
}
