/* =====================================================================
   在线打字测评系统 · 设计系统 v2「纸墨批改」

   意象来自中文打字教育的日常：作业本的纸、课本的楷体、教师红笔的
   批改。色彩严格按语义使用——靛青是操作、朱红是批改与错误、青磯是
   正确；数字与计时一律等宽字体，呼应键盘。
   签名元素是「光标」：当前输入字格上的朱红闪烁光标，以及教师端
   侧边栏激活项左侧的光标条。
   ===================================================================== */

/* ========== 重置与设计令牌 ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* 纸与墨 */
    --paper: #f5f3ec;            /* 页面底：稿纸暖白 */
    --paper-deep: #ece9df;       /* 深一档纸色 */
    --card: #fffdf7;             /* 卡片纸面 */
    --ink: #252d38;              /* 碳墨正文 */
    --ink-soft: #5c6672;         /* 淡墨次要文字 */
    --ink-faint: #667079;        /* 极淡墨（AA：纸底 4.55:1、卡片 4.96:1） */
    --ink-deep: #1d242e;         /* 深墨（侧边栏/考试栏） */
    --line: #e2ddd0;             /* 纸纹分隔线 */
    --line-strong: #cfc8b6;
    --line-control: #8f8876;     /* 输入框/打字区边界（非文本 3:1 对比度） */

    /* 语义色 */
    --indigo: #2d4b9a;           /* 靛青：链接与主动作 */
    --indigo-deep: #22397a;
    --indigo-wash: #edf0f9;
    --vermilion: #c2401d;        /* 朱红：批改、错误、光标签名 */
    --vermilion-deep: #a33318;
    --vermilion-wash: #faece6;
    --jade: #1e7a5a;             /* 青磯：正确、成功 */
    --jade-deep: #16634a;
    --jade-wash: #e7f3ed;
    --amber: #8a5f00;            /* 琥珀：等待、提醒（amber-wash 上 5.0:1） */
    --amber-wash: #f9f1de;

    /* 字体 */
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-kai: "KaiTi", "STKaiti", "楷体", "Noto Serif SC", serif;
    --font-book: Georgia, "Times New Roman", "Noto Serif SC", serif;
    --font-mono: "Cascadia Mono", "SF Mono", Consolas, ui-monospace, monospace;

    /* 间距与字号 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 24px;
    --text-2xl: 32px;

    /* 形状与阴影 */
    --radius: 8px;
    --radius-lg: 14px;
    --shadow: 0 1px 2px rgba(37,45,56,0.05), 0 4px 14px rgba(37,45,56,0.06);
    --shadow-lift: 0 2px 6px rgba(37,45,56,0.08), 0 14px 36px rgba(37,45,56,0.12);
}

body {
    font-family: var(--font-ui);
    background: var(--paper);
    /* 极淡的稿纸横纹：只在视觉上给纸的质感，不干扰阅读 */
    background-image: repeating-linear-gradient(
        to bottom, transparent 0 31px, rgba(37, 45, 56, 0.012) 31px 32px);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(194, 64, 29, 0.18); }

:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========== 工具类 ========== */
.is-hidden { display: none !important; }
.hidden { display: none !important; }
/* 视觉隐藏但保留给屏幕阅读器（标题、说明、图表文本替代等） */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
.text-center { text-align: center; }
.text-muted { color: var(--ink-soft); }
.mt-2 { margin-top: 20px; }
.timer-danger { color: var(--vermilion) !important; }

/* ========== 容器 ========== */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 22px 56px;
}
@media (min-width: 1500px) {
    .container { max-width: 1180px; }
}

/* ========== 卡片 ========== */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px 26px;
    margin-bottom: 20px;
    /* 卡片常处于 grid/flex 容器中，允许收缩到容器宽度：
       内部的 nowrap 表格与图表交给 .table-responsive / canvas 自行滚动或缩放，
       否则窄屏下卡片会被内容的最小宽度撑破，产生整页横向滚动 */
    min-width: 0;
}
.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 14px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.card-header h2 { border: none; margin: 0; padding: 0; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.88rem;
    color: var(--ink);
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-control);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(45, 75, 154, 0.14);
}
.form-control-sm { padding: 6px 10px; font-size: 0.85rem; width: auto; }
textarea.form-control { resize: vertical; line-height: 1.7; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { color: var(--ink-faint); font-size: 0.8rem; }
.form-status { font-size: 0.85rem; color: var(--ink-soft); }
.form-status.success { color: var(--jade); font-weight: 600; }
.form-status.error { color: var(--vermilion); font-weight: 600; }
.filter-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--indigo); color: #fdfdff; }
.btn-primary:hover:not(:disabled) { background: var(--indigo-deep); }
.btn-success { background: var(--jade); color: #f4fbf8; }
.btn-success:hover:not(:disabled) { background: var(--jade-deep); }
.btn-danger { background: var(--vermilion); color: #fdf6f3; }
.btn-danger:hover:not(:disabled) { background: var(--vermilion-deep); }
.btn-outline {
    background: transparent;
    color: var(--indigo);
    border: 1px solid var(--line-strong);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--indigo);
    background: var(--indigo-wash);
}
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 0.83rem; border-radius: 6px; }

/* ========== 提示与徽章 ========== */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    font-size: 0.9rem;
    border: 1px solid;
}
.alert-error { background: var(--vermilion-wash); color: var(--vermilion-deep); border-color: #f0cdbf; }
.alert-warning { background: var(--amber-wash); color: var(--amber); border-color: #ead9ae; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 5px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.badge-practice { background: var(--indigo-wash); color: var(--indigo-deep); }
.badge-exam { background: var(--vermilion-wash); color: var(--vermilion-deep); }
.badge-waiting { background: var(--paper-deep); color: var(--ink-soft); }
.badge-active { background: var(--jade-wash); color: var(--jade-deep); }
.badge-finished { background: #f0eeff; color: #4c4792; }

/* 语言/难度等小标签 */
.lang-chip, .language-label, .duration-chip, .participant-chip,
.record-count-chip, .connection-chip, .hp-chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.lang-chip.chinese, .language-label.chinese { background: var(--indigo-wash); color: var(--indigo-deep); }
.lang-chip.english, .language-label.english { background: var(--amber-wash); color: var(--amber); }
.duration-chip, .participant-chip, .record-count-chip {
    background: var(--paper-deep);
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}
.connection-chip { background: var(--paper-deep); color: var(--ink-soft); }
.connection-chip.connected { background: var(--jade-wash); color: var(--jade-deep); }
.difficulty-label { font-size: 0.8rem; font-weight: 700; }
.difficulty-label.easy { color: var(--jade); }
.difficulty-label.medium { color: var(--amber); }
.difficulty-label.hard { color: var(--vermilion); }
.readonly-hint { font-size: 0.8rem; color: var(--ink-faint); }
.result-count { font-size: 0.8rem; color: var(--ink-faint); font-weight: 400; margin-left: 6px; }
.filter-summary { font-size: 0.83rem; color: var(--ink-soft); margin-top: 4px; }
.speed-val { font-weight: 700; font-family: var(--font-mono); font-size: 0.95rem; }
.speed-unit { font-size: 0.72rem; color: var(--ink-faint); margin-left: 2px; }
.accuracy-value.good { color: var(--jade); font-weight: 700; }
.accuracy-value.normal { color: var(--ink-soft); }

/* ========== 表格 ========== */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table th {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--line-strong);
}
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: rgba(45, 75, 154, 0.035); }
.muted-time { color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ========== 统计卡片 ========== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-number {
    font-family: var(--font-mono);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.stat-desc { color: var(--ink-soft); font-size: 0.82rem; margin-top: 3px; }

/* 排名徽标 */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.82rem;
    background: var(--paper-deep);
    color: var(--ink-soft);
}
.rank-badge.rank-1 { background: var(--vermilion); color: #fff; }
.rank-badge.rank-2 { background: var(--amber); color: #fff; }
.rank-badge.rank-3 { background: var(--indigo); color: #fff; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
    font-size: 0.86rem;
    color: var(--ink-soft);
    flex-wrap: wrap;
}
.pagination a { border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 12px; }
.pagination a:hover { border-color: var(--indigo); background: var(--indigo-wash); }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 42px 20px; color: var(--ink-soft); }
.empty-glyph { font-size: 2.6rem; margin-bottom: 10px; opacity: 0.75; }
.empty-icon { font-size: 2.2rem; margin-bottom: 10px; opacity: 0.75; }

/* ========== 图表容器 ========== */
/* overflow:hidden：数据为空时 Chart.js 实例被销毁，canvas 退回默认 300×150
   尺寸，会撑破窄屏容器造成文档级横向滚动；裁掉超宽部分不影响正常图表。 */
.chart-container { position: relative; height: 340px; width: 100%; overflow: hidden; }
.chart-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--ink-soft);
    font-size: 0.86rem;
    text-align: center;
}

/* ========== 代码 ========== */
code {
    background: var(--paper-deep);
    color: var(--vermilion-deep);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.86em;
    font-family: var(--font-mono);
}
kbd {
    display: inline-block;
    min-width: 1.7em;
    padding: 2px 7px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 0.82em;
}

/* ================================================================
   学生端 · 顶部导航
   ================================================================ */
.navbar { position: sticky; top: 0; z-index: 50; }
.student-nav {
    background: var(--ink-deep);
    color: #f2f0e9;
    border-bottom: 2px solid var(--vermilion);
}
.nav-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 22px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #f2f0e9;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
/* 品牌前的朱红光标：打字系统的签名记号 */
.nav-brand::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 1.05em;
    margin-right: 9px;
    background: var(--vermilion);
    animation: caretBlink 1.2s steps(1) infinite;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
    color: rgba(242, 240, 233, 0.78);
    padding: 6px 13px;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 500;
}
.nav-links a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}
.nav-links a.active,
.nav-links a.active:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 -2px 0 var(--vermilion);
}
.link-button {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.nav-link-button {
    color: rgba(242, 240, 233, 0.78);
    padding: 6px 13px;
    border-radius: 6px;
    font-size: 0.92rem;
}
.nav-link-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* ================================================================
   学生端 · 登录页
   ================================================================ */
.student-login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}
.student-login-body .container { width: 100%; max-width: 1240px; min-width: 0; padding: 28px; }
.student-login-page {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    width: min(920px, 100%);
    min-height: 540px;
    margin: auto;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 3px 8px rgba(29, 36, 46, 0.03), 0 24px 64px rgba(29, 36, 46, 0.1);
}
.login-intro {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 34px 28px 28px;
    overflow: hidden;
    color: #f8f6ef;
    background-color: #202f44;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 28px 28px;
}
.login-header { text-align: left; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand-mark {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #f8f6ef;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
}
.login-brand-mark svg { width: 26px; height: 26px; }
.login-header h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.06em; line-height: 1.4; }
.login-brand-english {
    display: block;
    margin-top: 3px;
    color: #b9c5d7;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.09em;
}
.login-intro-copy { margin-top: 60px; }
.login-intro-copy p {
    color: #fffdf7;
    font-family: var(--font-kai);
    font-size: 2.1rem;
    line-height: 1.55;
    letter-spacing: 0.05em;
}
.login-intro-copy > span { display: block; margin-top: 14px; color: #c1ccdb; font-size: 0.84rem; }
.login-keyboard { display: grid; gap: 7px; margin: auto 0 30px; transform: rotate(-5deg); }
.login-keyboard-row { display: flex; gap: 5px; }
.login-keyboard-row span {
    display: grid;
    flex: 1;
    place-items: center;
    min-width: 0;
    height: 29px;
    color: #c1ccdb;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 5px;
    box-shadow: 0 2px 0 rgba(8, 17, 29, 0.25);
    font-family: var(--font-mono);
    font-size: 0.58rem;
}
.login-keyboard-row:nth-child(2) { padding: 0 8px; }
.login-keyboard-row:nth-child(2) span:nth-child(4),
.login-keyboard-row:nth-child(2) span:nth-child(7) {
    color: #fff8f3;
    background: var(--vermilion);
    border-color: #d16a4c;
}
.login-keyboard-row:nth-child(3) { padding: 0 18px; }
.login-keyboard-row .login-keyboard-space { height: 21px; margin: 2px 32px 0; }
.login-intro-footer { margin-top: auto; }
.login-exam-caption { display: block; margin-bottom: 10px; color: #c1ccdb; font-size: 0.76rem; }
.login-exam-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 10px 12px;
    color: #f8f6ef;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 9px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    text-align: left;
    transition: background 0.16s, border-color 0.16s;
}
.login-exam-trigger svg { flex: 0 0 auto; width: 17px; height: 17px; }
.login-exam-trigger svg:last-child { margin-left: auto; }
.login-exam-trigger:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.5); }
.login-exam-trigger:focus-visible { outline-color: #fffdf7; }
.login-workspace {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    padding: 38px 42px;
    background: var(--card);
}
.login-panel-heading { flex: 0 0 auto; margin-bottom: 18px; }
.login-panel-heading h2 { font-size: 1.65rem; font-weight: 750; letter-spacing: 0.015em; }
.login-panel-heading p { margin-top: 6px; color: var(--ink-soft); font-size: 0.85rem; }
.login-alert {
    background: var(--vermilion-wash);
    border: 1px solid #f0cdbf;
    color: var(--vermilion-deep);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 14px;
    text-align: center;
}
.login-form-card { margin-bottom: 0; }
.account-login-form .form-group { margin-bottom: 18px; }
.account-login-form .form-control { min-height: 48px; background: #fff; }
.account-login-form .btn { min-height: 46px; margin-top: 4px; }
.exam-join-card {
    flex: 0 0 auto;
    width: 100%;
    padding: 12px;
    margin: 0 0 10px;
    color: var(--ink);
    background: #f8f6ef;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
.exam-join-label { display: block; margin-bottom: 5px; font-size: 0.72rem; font-weight: 600; }
.exam-password-row { display: flex; gap: 6px; }
.exam-password-row input {
    flex: 1;
    min-width: 0;
    padding: 8px 9px;
    color: var(--ink);
    background: #fffdf7;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}
.exam-password-row input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(45, 75, 154, 0.14);
}
.exam-password-row .btn { flex: 0 0 auto; padding: 8px 11px; font-size: 0.78rem; white-space: nowrap; }
.exam-join-error { margin-top: 6px; color: var(--vermilion-deep); font-size: 0.75rem; line-height: 1.5; }

/* 班级登录容器随名单高度居中，窗口不足时仅姓名网格滚动。 */
.class-login-body {
    align-items: center;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}
.class-login-body .container { display: flex; align-items: center; height: 100%; min-height: 0; }
.student-login-page.class-login-page {
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 0;
}
.class-login-page .login-workspace { justify-content: flex-start; padding: 28px 32px 18px; overflow: hidden; }
.class-login-page .login-panel-heading { margin-bottom: 22px; }
.class-login-page > .login-alert { flex: 0 0 auto; }
.class-login-sections { display: flex; flex: 1 1 auto; flex-direction: column; gap: 12px; min-height: 0; }
.class-login-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.class-login-section-head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.class-login-class-heading { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.class-login-section-head h2 { font-size: 1.08rem; font-weight: 700; }
.class-login-kicker { color: var(--ink-soft); font-size: 0.75rem; white-space: nowrap; }
.class-student-count {
    padding: 2px 8px;
    color: var(--indigo);
    background: var(--indigo-wash);
    border-radius: 5px;
    font-size: 0.75rem;
    white-space: nowrap;
}
.student-name-grid {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    grid-auto-rows: 78px;
    align-content: start;
    gap: 10px;
    min-height: 0;
    padding: 2px 7px 2px 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}
.student-name-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 78px;
    padding: 12px 24px 12px 12px;
    color: var(--ink);
    background: #fffefb;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.student-name-card::after {
    content: "";
    position: absolute;
    right: 12px;
    bottom: 0;
    left: 12px;
    height: 2px;
    background: transparent;
    border-radius: 2px;
}
.student-name-card:hover {
    background: var(--indigo-wash);
    border-color: #9baacf;
    box-shadow: 0 4px 12px rgba(45, 75, 154, 0.08);
    transform: translateY(-2px);
}
.student-name-card:hover::after { background: var(--indigo); }
.student-name-card:active { transform: translateY(0); }
.student-card-name {
    max-width: 100%;
    font-family: var(--font-kai);
    font-size: 1.18rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.student-card-action {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 14px;
    height: 14px;
    color: var(--indigo);
    opacity: 0;
    transform: translateX(-3px);
    transition: opacity 0.16s, transform 0.16s;
}
.student-name-card:hover .student-card-action,
.student-name-card:focus-visible .student-card-action { opacity: 1; transform: translateX(0); }
.class-login-empty { padding: 24px 12px; text-align: center; color: var(--ink-soft); }
.class-login-empty strong { color: var(--ink); }
.class-login-empty p { margin-top: 6px; font-size: 0.85rem; }

.class-password-modal { background: rgba(20, 30, 44, 0.62); backdrop-filter: blur(3px); }
.modal-content.class-password-dialog {
    position: relative;
    width: min(400px, calc(100vw - 32px));
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(20, 30, 44, 0.22);
}
.class-password-dialog .modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--ink-soft);
    background: transparent;
    border: none;
    border-radius: 8px;
}
.class-password-dialog .modal-close svg { width: 18px; height: 18px; }
.class-password-dialog .modal-close:hover { color: var(--ink); background: var(--paper); }
.class-password-dialog .modal-header { display: block; padding: 0 40px 0 0; margin-bottom: 16px; border: none; }
.class-password-eyebrow { display: block; color: var(--ink-soft); font-size: 0.75rem; letter-spacing: 0.06em; }
.class-password-dialog .modal-header h2 { margin-top: 4px; font-size: 1.55rem; line-height: 1.4; }
.class-password-hint { margin-bottom: 16px; color: var(--ink-soft); font-size: 0.85rem; }
.class-password-group { margin-bottom: 14px; }
.class-password-field { position: relative; margin-top: 6px; }
.class-password-field-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 19px;
    height: 19px;
    color: var(--ink-soft);
    pointer-events: none;
    transform: translateY(-50%);
}
.class-password-field .form-control { min-height: 50px; padding: 12px 60px 12px 43px; font-size: 1rem; }
.class-password-toggle {
    position: absolute;
    top: 50%;
    right: 3px;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 6px;
    color: var(--indigo);
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.78rem;
    transform: translateY(-50%);
}
.class-password-toggle:hover { background: var(--indigo-wash); }
.class-password-error { margin-top: 6px; color: var(--vermilion-deep); font-size: 0.78rem; line-height: 1.5; }
.class-password-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    font-size: 0.92rem;
}
.class-password-submit svg { width: 18px; height: 18px; }
.class-password-submit.is-loading svg { display: none; }
.class-password-submit.is-loading::before {
    content: "";
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loginButtonSpin 0.9s linear infinite;
}
.class-password-back {
    display: block;
    min-height: 40px;
    margin: 8px auto -4px;
    padding: 6px 12px;
    color: var(--ink-soft);
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}
.class-password-back:hover { color: var(--indigo); background: var(--indigo-wash); }
.modal-open { overflow: hidden; }
@keyframes loginButtonSpin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
    .student-login-page { grid-template-columns: 240px minmax(0, 1fr); }
    .login-intro { padding: 28px 24px 24px; }
    .login-intro-copy p { font-size: 1.85rem; }
    .login-workspace, .class-login-page .login-workspace { padding-right: 24px; padding-left: 24px; }
}
@media (max-width: 700px) {
    .student-login-body .container { padding: 12px; }
    .student-login-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 0; border-radius: 18px; }
    .student-login-page.class-login-page { grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
    .login-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 16px; }
    .login-header { grid-column: 1; grid-row: 2; }
    .login-brand { gap: 9px; }
    .login-brand-mark { width: 36px; height: 36px; border-radius: 9px; }
    .login-brand-mark svg { width: 22px; height: 22px; }
    .login-header h1 { font-size: 1.08rem; }
    .login-brand-english { font-size: 0.49rem; }
    .login-intro-copy, .login-keyboard, .login-exam-caption { display: none; }
    .login-intro-footer { display: contents; }
    .exam-entry { grid-column: 2; grid-row: 2; }
    .exam-join-card { grid-column: 1 / -1; grid-row: 1; margin: 0 0 12px; }
    .login-exam-trigger { width: auto; padding: 9px 10px; font-size: 0.74rem; }
    .login-exam-trigger svg { width: 15px; height: 15px; }
    .login-exam-trigger svg:first-child { display: none; }
    .login-workspace, .class-login-page .login-workspace { justify-content: flex-start; padding: 22px; }
    .class-login-page .login-workspace { padding: 20px 18px 14px; }
    .login-panel-heading { margin-bottom: 16px; }
    .class-login-page .login-panel-heading { margin-bottom: 14px; }
    .login-panel-heading h2 { font-size: 1.4rem; }
    .class-login-section-head { margin-bottom: 12px; padding: 10px 12px; }
    .class-login-class-heading { gap: 8px; }
    .class-login-section-head h2 { font-size: 1rem; }
    .student-name-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); grid-auto-rows: 72px; gap: 9px; padding-right: 5px; }
    .student-name-card { height: 72px; padding: 10px 18px 10px 8px; }
    .student-card-name { font-size: 1.08rem; }
    .student-card-action { right: 7px; bottom: 8px; width: 12px; height: 12px; opacity: 0.65; transform: none; }
    .modal-content.class-password-dialog { padding: 24px 22px 20px; border-radius: 18px; }
}
@media (max-width: 370px) {
    .login-exam-trigger svg:last-child { display: none; }
    .login-workspace, .class-login-page .login-workspace { padding-right: 14px; padding-left: 14px; }
    .student-name-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 700px) and (min-width: 701px) {
    .student-login-body .container { padding-top: 16px; padding-bottom: 16px; }
    .login-intro-copy { margin-top: 28px; }
    .login-intro-copy p { font-size: 1.7rem; }
    .login-keyboard { margin-bottom: 20px; }
    .login-keyboard-row span { height: 24px; }
    .class-login-page .login-panel-heading { margin-bottom: 14px; }
}
@media (max-height: 560px) {
    .class-login-page .login-intro-copy, .class-login-page .login-keyboard,
    .class-login-page .login-panel-heading { display: none; }
}
@media (max-height: 560px) and (min-width: 701px) {
    .modal-content.class-password-dialog {
        display: grid;
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
        gap: 24px;
        width: min(600px, calc(100vw - 32px));
        padding: 24px;
    }
    .class-password-dialog .modal-header { align-self: center; padding: 0; margin-bottom: 0; }
    .class-password-dialog .modal-header h2 { font-size: 1.35rem; }
    .class-password-hint, .class-password-group { margin-bottom: 12px; }
}
@media (hover: none) {
    .student-card-action { opacity: 0.65; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .student-name-card, .student-card-action, .login-exam-trigger { transition: none; }
    .student-name-card:hover { transform: none; }
    .class-password-submit.is-loading::before { animation: none; }
}

/* ================================================================
   学生端 · 测试模式（考试列表）
   ================================================================ */
.exam-list-page { max-width: 760px; margin: 0 auto; }
.exam-list-head { margin-bottom: 20px; }
.exam-list-head h1 { font-size: 1.45rem; font-weight: 800; }
.exam-list-sub { color: var(--ink-soft); font-size: 0.9rem; margin-top: 4px; }
.exam-cards { display: grid; gap: 14px; }
.exam-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--indigo);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 18px 22px;
    transition: box-shadow 0.15s, transform 0.15s;
}
.exam-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.exam-card.is-done { border-left-color: var(--jade); opacity: 0.75; }
.exam-card-title {
    font-size: 1.02rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.exam-card-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--ink-soft);
    font-size: 0.82rem;
    margin-top: 6px;
}
.exam-done-badge {
    color: var(--jade);
    font-weight: 700;
    font-size: 0.92rem;
    white-space: nowrap;
}

/* ================================================================
   学生端 · 打字教程
   ================================================================ */
.tutorials-page,
.tutorial-detail-page { max-width: 1020px; margin: 0 auto; }
.tutorials-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 8px 2px 26px;
}
.tutorials-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--vermilion-deep);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.tutorials-hero h1 { font-size: 1.85rem; font-weight: 800; letter-spacing: 0.02em; }
.tutorials-hero p { margin-top: 7px; color: var(--ink-soft); font-size: 0.9rem; }
.tutorial-total {
    flex: 0 0 184px;
    padding: 17px 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.tutorial-total > span { display: block; color: var(--ink-soft); font-size: 0.75rem; }
.tutorial-total strong { display: block; margin: 2px 0 8px; font-family: var(--font-mono); font-size: 1.65rem; }
.tutorial-total small { color: var(--ink-soft); font-size: 0.74rem; font-weight: 400; }
.tutorial-total progress { width: 100%; }
.tutorial-course-grid progress,
.tutorial-detail-head progress,
.tutorial-total progress {
    display: block;
    height: 5px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--paper-deep);
    color: var(--jade);
    appearance: none;
}
.tutorial-course-grid progress::-webkit-progress-bar,
.tutorial-detail-head progress::-webkit-progress-bar,
.tutorial-total progress::-webkit-progress-bar { background: var(--paper-deep); }
.tutorial-course-grid progress::-webkit-progress-value,
.tutorial-detail-head progress::-webkit-progress-value,
.tutorial-total progress::-webkit-progress-value { background: var(--jade); border-radius: 999px; }
.tutorial-course-grid progress::-moz-progress-bar,
.tutorial-detail-head progress::-moz-progress-bar,
.tutorial-total progress::-moz-progress-bar { background: var(--jade); border-radius: 999px; }
.tutorial-lock-note {
    margin-bottom: 18px;
    padding: 10px 14px;
    background: var(--amber-wash);
    border: 1px solid #ead9ae;
    border-radius: var(--radius);
    color: var(--amber);
    font-size: 0.83rem;
}
.tutorial-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.tutorial-section-head h2 { font-size: 1.04rem; font-weight: 700; }
.tutorial-section-head p { margin-top: 3px; color: var(--ink-soft); font-size: 0.8rem; }
.tutorial-section-head > span { color: var(--ink-soft); font-size: 0.76rem; }
.tutorial-course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tutorial-course-card {
    display: block;
    min-width: 0;
    padding: 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(37, 45, 56, 0.04);
    transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}
a.tutorial-course-card:hover {
    border-color: rgba(45, 75, 154, 0.5);
    box-shadow: var(--shadow-lift);
    text-decoration: none;
    transform: translateY(-2px);
}
.tutorial-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.course-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 68px;
    width: 68px;
    height: 68px;
    border-radius: 12px;
    font-size: 1.75rem;
    font-weight: 700;
    box-shadow: inset 0 -3px 0 rgba(37, 45, 56, 0.06);
}
.course-symbol.keyboard { background: var(--indigo-wash); color: var(--indigo-deep); font-family: var(--font-mono); font-size: 1.35rem; letter-spacing: 0.08em; }
.course-symbol.poetry { background: var(--vermilion-wash); color: var(--vermilion-deep); font-family: var(--font-kai); }
.course-symbol.prose { background: var(--amber-wash); color: var(--amber); font-family: var(--font-kai); }
.course-symbol.english { background: var(--jade-wash); color: var(--jade-deep); font-family: var(--font-book); }
.course-symbol.custom { background: var(--paper-deep); color: var(--indigo-deep); font-family: var(--font-kai); }

.course-category { padding: 3px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-soft); font-size: 0.72rem; }
.tutorial-course-card h2 { margin-top: 18px; font-size: 1.1rem; font-weight: 700; }
.tutorial-course-card > p { min-height: 3.3em; margin-top: 6px; color: var(--ink-soft); font-size: 0.84rem; line-height: 1.7; }
.course-progress-row { display: flex; align-items: center; gap: 10px; margin-top: 19px; }
.course-progress-row progress { flex: 1; min-width: 0; }
.course-progress-row > span { color: var(--ink-soft); font-family: var(--font-mono); font-size: 0.72rem; }
.course-card-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.78rem;
}
.course-action { color: var(--indigo); font-weight: 600; }
.tutorial-course-card.is-locked { background: var(--paper); box-shadow: none; }
.tutorial-course-card.is-locked .course-symbol { opacity: 0.6; box-shadow: none; }
.course-unavailable { color: var(--amber); }
.tutorial-tip { margin-top: 20px; color: var(--ink-soft); font-size: 0.78rem; text-align: center; }

.tutorial-breadcrumb { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; color: var(--ink-soft); font-size: 0.8rem; }
.tutorial-breadcrumb a:hover { text-decoration: none; color: var(--indigo-deep); }
.tutorial-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 26px;
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(37, 45, 56, 0.04);
}
.tutorial-detail-title { display: flex; align-items: center; gap: 18px; min-width: 0; }
.tutorial-detail-title h1 { margin: 2px 0 5px; font-size: 1.4rem; font-weight: 800; }
.tutorial-detail-title p { max-width: 570px; color: var(--ink-soft); font-size: 0.84rem; }
.tutorial-detail-progress { flex: 0 0 130px; text-align: right; }
.tutorial-detail-progress strong { display: block; font-family: var(--font-mono); font-size: 1.6rem; }
.tutorial-detail-progress strong small { color: var(--ink-soft); font-size: 0.85rem; font-weight: 400; }
.tutorial-detail-progress > span { display: block; margin: 0 0 8px; color: var(--ink-soft); font-size: 0.72rem; }
.tutorial-detail-progress progress { width: 100%; }
.tutorial-lesson-list { display: grid; gap: 12px; list-style: none; }
.tutorial-lesson-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tutorial-lesson-card:hover { border-color: rgba(45, 75, 154, 0.5); box-shadow: var(--shadow); text-decoration: none; }
.lesson-number { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; color: var(--ink-soft); }
.lesson-main { display: block; min-width: 0; }
.lesson-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lesson-title-row > strong { font-size: 0.96rem; }
.lesson-complete { padding: 1px 7px; background: var(--jade-wash); border-radius: 4px; color: var(--jade-deep); font-size: 0.68rem; font-weight: 600; }
.lesson-hint { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 0.8rem; }
.lesson-meta { display: flex; gap: 13px; margin-top: 7px; color: var(--ink-soft); font-size: 0.72rem; }
.lesson-meta .difficulty-label { font-size: inherit; }
.lesson-action { align-self: center; color: var(--indigo); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.tutorial-lesson-card.is-completed { border-left: 3px solid var(--jade); }
.tutorial-lesson-card.is-completed .lesson-number { color: var(--jade-deep); }
.tutorial-locked-state .btn { margin-top: 16px; }
.lesson-with-guide { align-items: flex-start; }
.lesson-with-guide .lesson-number { padding-top: 2px; }
.lesson-guide {
    grid-column: 2 / -1;
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.lesson-guide summary {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--indigo);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.lesson-guide summary span { margin-left: auto; color: var(--ink-soft); font-size: 0.7rem; font-weight: 400; }
.lesson-guide-body { margin-top: 12px; padding: 14px; background: var(--paper); border-radius: 8px; }
.lesson-guide-body.has-diagram { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(190px, 1fr); gap: 16px; align-items: start; }
.has-diagram .lesson-keycaps { grid-column: 1 / -1; margin-bottom: 0; }
.lesson-keycaps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lesson-keycaps kbd { min-width: 32px; padding: 6px 9px; background: var(--card); font-size: 0.78rem; }
.lesson-keycaps kbd.is-home { border-color: var(--indigo); background: var(--indigo-wash); color: var(--indigo-deep); }
.lesson-guide-steps { padding-left: 20px; color: var(--ink-soft); font-size: 0.8rem; }
.lesson-guide-steps li + li { margin-top: 6px; }
.lesson-diagram { min-width: 0; }
.lesson-diagram > img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.lesson-diagram figcaption { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; color: var(--ink-soft); font-size: 0.7rem; }
.lesson-diagram-zoom { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; min-height: 32px; font-weight: 600; }
.lesson-diagram-zoom svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.lesson-diagram-zoom:hover { text-decoration: none; color: var(--indigo-deep); }
.lesson-image-dialog { width: min(1120px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lift); }
.lesson-image-dialog::backdrop { background: rgba(29, 36, 46, 0.7); }
.lesson-image-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.lesson-image-dialog-head h2 { font-size: 1rem; }
.lesson-image-close { width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 1.65rem; line-height: 1; cursor: pointer; }
.lesson-image-close:hover { background: var(--paper-deep); }
.lesson-image-dialog-body { overflow: auto; max-height: calc(100dvh - 137px); background: var(--paper); }
.lesson-image-dialog-body img { display: block; width: 100%; height: auto; }
.lesson-image-dialog-hint { padding: 8px 18px; color: var(--ink-soft); font-size: 0.74rem; }
@media (max-width: 760px) {
    .lesson-guide-body.has-diagram { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .lesson-diagram figcaption { font-size: 0.74rem; }
    .lesson-image-dialog-body img { width: 800px; max-width: none; }
}
.lesson-unavailable { color: var(--amber); font-size: 0.76rem; white-space: nowrap; }
.tutorial-lesson-card.is-locked { background: var(--paper); }
.lesson-with-guide .lesson-action:hover { text-decoration: none; }

/* ================================================================
   学生端 · 打字测试页
   ================================================================ */
.test-page { max-width: 1020px; margin: 0 auto; }
.practice-course-context {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 2px 12px;
    color: var(--ink-soft);
    font-size: 0.8rem;
}
.practice-course-context a { font-weight: 600; }
.practice-course-context a:hover { text-decoration: none; color: var(--indigo-deep); }
.practice-course-context > span { padding-left: 10px; border-left: 1px solid var(--line-strong); }

/* 顶部状态条：考试=深墨横幅，练习=纸面卡片 */
.test-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    border-radius: var(--radius-lg);
    padding: 14px 22px;
}
.test-top-bar.exam-mode {
    background: var(--ink-deep);
    color: #f2f0e9;
    box-shadow: var(--shadow);
}
.test-top-bar.practice-mode {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(37, 45, 56, 0.04);
    padding: 18px 22px;
}
.test-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.98rem;
}
.exam-mode .test-info { color: #f2f0e9; }
.practice-mode .test-info { color: var(--ink); }
.practice-student { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.practice-student strong { font-size: 1.02rem; }
.practice-student > span { color: var(--ink-soft); font-size: 0.8rem; font-weight: 400; }
.test-badge {
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}
.test-badge.exam { background: var(--vermilion); color: #fff; }
.test-badge.practice {
    background: var(--indigo-wash);
    color: var(--indigo-deep);
    box-shadow: inset 0 0 0 1px rgba(45, 75, 154, 0.07);
}
.test-badge.lock { background: var(--amber-wash); color: var(--amber); }

.test-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.practice-mode .test-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(84px, 1fr));
    gap: 0;
}
.stat-item { text-align: center; }
.practice-mode .stat-item { padding: 2px 15px; border-left: 1px solid var(--line); }
.practice-mode .stat-item:first-child { border-left: 0; }
.stat-item .stat-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    color: var(--ink-soft);
    margin-bottom: 4px;
    white-space: nowrap;
}
.exam-mode .stat-item .stat-label { color: rgba(242, 240, 233, 0.65); }
.stat-item .stat-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 3px;
    font-family: var(--font-mono);
    font-size: 1.36rem;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}
.practice-mode .stat-item:first-child .stat-value { color: var(--indigo-deep); }
.practice-mode .stat-item:last-child .stat-value { color: var(--jade-deep); }
.exam-mode .stat-item .stat-value { color: #fdfcf8; }
.stat-item .stat-value small {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--ink-soft);
    white-space: nowrap;
}
.exam-mode .stat-item .stat-value small { color: rgba(242, 240, 233, 0.65); }

/* 练习筛选工具栏 */
.practice-toolbar {
    display: flex;
    align-items: center;
    gap: 12px 22px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: rgba(255, 253, 247, 0.8);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 16px;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;  /* 窄屏时组内按钮允许换行，避免顶破容器 */
}
.toolbar-group label,
.toolbar-label {
    margin-right: 3px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
}
.tool-btn {
    min-width: 48px;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 0.83rem;
    font-weight: 600;
    border: 1px solid transparent;
    background: var(--paper-deep);
    color: var(--ink-soft);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.tool-btn:hover {
    text-decoration: none;
    border-color: var(--line-strong);
    background: var(--indigo-wash);
    color: var(--indigo);
}
.tool-btn.active {
    background: var(--indigo);
    border-color: var(--indigo);
    color: #fdfdff;
    box-shadow: 0 2px 5px rgba(45, 75, 154, 0.16);
}
.tool-btn.active:hover { background: var(--indigo-deep); }
.toolbar-text-select { flex: 1; min-width: 220px; }
.tool-select {
    flex: 1;
    width: 200px;
    min-width: 0;
    padding: 6px 28px 6px 10px;
    border-radius: 7px;
    border: 1px solid var(--line-strong);
    font-size: 0.84rem;
    background: #fff;
    color: var(--ink);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    /* 长标题不撑破窄屏工具栏 */
    max-width: 100%;
    text-overflow: ellipsis;
}
.tool-select:hover { border-color: var(--indigo); }
.tool-select:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(45, 75, 154, 0.12);
}

/* 隐藏的单行 input（IME 用）：保持真实可见坐标跟随光标，
   否则浏览器会把输入法候选框回退到左上角。 */
.hidden-typing-input {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1.4em;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    opacity: 0;
    font-size: 1.3rem;
    caret-color: transparent;
    z-index: -1;
}

/* 练习面板：篇目、焦点提示与字格形成一个完整的输入工作区 */
.typing-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(37, 45, 56, 0.04);
    overflow: hidden;
}
.typing-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px 14px;
    border-bottom: 1px solid var(--line);
}
.typing-panel-head > div { min-width: 0; }
.typing-panel-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--ink-soft);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}
.typing-panel-head h2 {
    overflow: hidden;
    font-size: 1.04rem;
    font-weight: 700;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.typing-panel-count {
    flex: 0 0 auto;
    padding: 3px 9px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}
.typing-panel-body { padding: 12px 22px 20px; }

/* 聚焦状态指示药丸 */
.focus-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--paper-deep);
    color: var(--ink-soft);
    font-size: 0.84rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}
.typing-panel .focus-status { margin: 0 0 8px; padding: 0 2px; background: transparent; font-size: 0.78rem; }
.focus-status .focus-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: var(--ink-faint);
    transition: background 0.2s, box-shadow 0.2s;
}
.focus-status.focused { background: var(--indigo-wash); color: var(--indigo-deep); }
.typing-panel .focus-status.focused { background: transparent; }
.focus-status.focused .focus-dot {
    background: var(--jade);
    box-shadow: 0 0 0 3px rgba(30, 122, 90, 0.1);
    animation: dotPulse 1.6s ease-in-out infinite;
}
/* 引擎级错误横幅（如服务端计时启动失败）：可见、可被读屏播报 */
.engine-warning {
    margin: 0 0 8px;
    padding: 8px 12px;
    background: var(--vermilion-wash);
    border: 1px solid var(--vermilion);
    border-radius: var(--radius);
    color: var(--vermilion-deep);
    font-size: 0.82rem;
    line-height: 1.55;
}
.typing-panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 24px;
    border-top: 1px solid var(--line);
    background: rgba(245, 243, 236, 0.5);
    color: var(--ink-soft);
    font-size: 0.74rem;
}
.typing-legend,
.typing-shortcuts { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { display: inline-block; width: 13px; height: 3px; border-radius: 2px; }
.legend-line.correct { background: var(--jade); }
.legend-line.wrong { margin-left: 6px; background: var(--vermilion); }
.typing-shortcuts kbd { padding: 0 5px; background: var(--card); font-size: 0.68rem; }
.pinyin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: pointer;
}
.pinyin-toggle:hover { color: var(--indigo); }
.pinyin-toggle input { width: 15px; height: 15px; accent-color: var(--indigo); cursor: pointer; }
@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(30, 122, 90, 0.1); }
    50% { box-shadow: 0 0 0 5px rgba(30, 122, 90, 0.04); }
}

/* ========== 打字区域（核心）：稿纸字格 ========== */
.typing-zone {
    background: #fffef9;
    border: 1px solid var(--line-control);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 26px 30px;
    font-size: 1.18rem;
    line-height: 1.5;
    min-height: 280px;
    max-height: 58vh;
    overflow-y: auto;
    cursor: text;
    outline: none;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: flex-start;
    gap: 15px 1px;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}
.typing-panel .typing-zone {
    min-height: 280px;
    max-height: 55vh;
    padding: 32px 34px;
    border-color: var(--line);
    border-radius: 9px;
    box-shadow: none;
    font-size: 1.34rem;
    gap: 24px 2px;
}
.typing-panel .typing-zone.show-pinyin { gap: 18px 2px; }
.typing-zone:focus,
.typing-zone.is-focused {
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px rgba(45, 75, 154, 0.13), var(--shadow);
}
.typing-panel .typing-zone:focus,
.typing-panel .typing-zone.is-focused {
    border-color: rgba(45, 75, 154, 0.65);
    box-shadow: 0 0 0 3px rgba(45, 75, 154, 0.08);
}

/* 原文字形：中文用楷体（教材生字的字体），英文用课本衬线 */
.typing-zone.chinese .tcell-src { font-family: var(--font-kai); }
.typing-zone.english .tcell-src { font-family: var(--font-book); }

/* 字格：可选拼音在上，原文居中，实际输入在下 */
.tcell { display: flex; flex-direction: column; align-items: center; position: relative; }
.tcell-src, .tcell-in {
    display: block;
    width: 1em;
    flex: 0 0 1.7em;
    text-align: center;
    line-height: 1.7;
    height: 1.7em;
    overflow: hidden;
    white-space: pre;
}
.tcell-src { color: #48515c; }
.tcell-in {
    color: transparent;
    border-bottom: 2px solid var(--line-strong);
    font-family: var(--font-ui);
    min-width: 1em;
    transition: border-color 0.12s, background 0.12s;
}
.typing-panel .tcell-in { border-bottom-width: 1px; border-bottom-color: var(--line); }
.tcell-pinyin {
    display: none;
    height: 1.5em;
    color: var(--ink-soft);
    font-family: var(--font-ui);
    font-size: 0.44em;
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
}
.typing-zone.show-pinyin .tcell { min-width: 2.8em; }
.typing-zone.show-pinyin .tcell-pinyin { display: block; }
.typing-zone.show-pinyin .tcell-compose { top: 2.36em; }
/* 输入正确：墨色落纸；输入错误：红笔批改 */
.tcell-in.c-correct { color: var(--ink); border-bottom-color: var(--jade); }
.tcell-in.c-wrong {
    color: var(--vermilion-deep);
    background: var(--vermilion-wash);
    border-bottom-color: var(--vermilion);
    border-radius: 3px;
    padding: 0;
    margin: 0;
}
/* 当前光标字格：朱红光标条（签名元素） */
.tcell-in.c-cursor {
    border-bottom: 3px solid var(--vermilion);
    animation: caretBlink 1.05s steps(1) infinite;
}
.tcell-br { display: block; width: 100%; height: 0; }
.tcell-br.c-cursor { border-top: 3px solid var(--vermilion); }

/* 拼音组合预览：叠加在光标字格的输入行上，不挤动版式 */
.tcell-compose {
    position: absolute;
    left: 0;
    top: 1.7em;
    white-space: nowrap;
    color: var(--indigo);
    text-decoration: underline;
    text-underline-offset: 3px;
    background: #fffef9;
    padding: 0 2px;
    z-index: 2;
    border-radius: 3px;
    font-family: var(--font-ui);
    font-size: 0.85em;
}

@keyframes caretBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
@keyframes cursorBlink {
    0%, 100% { border-bottom-color: var(--vermilion); }
    50% { border-bottom-color: transparent; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 底部操作条 */
.test-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 14px;
}
.submit-hint {
    margin-right: auto;
    color: var(--ink-soft);
    font-size: 0.84rem;
}
.practice-actions { margin-top: 16px; }
.practice-actions-note { margin-right: auto; color: var(--ink-soft); font-size: 0.78rem; }
.practice-actions .btn { min-height: 40px; padding: 9px 21px; }
.practice-actions .btn-success:not(:disabled) { box-shadow: 0 2px 5px rgba(30, 122, 90, 0.14); }
.practice-actions .btn-outline { background: var(--card); }
.practice-actions #resetBtn span { display: inline-block; margin-right: 4px; font-size: 1.05rem; line-height: 1; }

/* ========== 成绩弹窗 ========== */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(29, 36, 46, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    padding: 20px;
}
.result-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    border-top: 4px solid var(--jade);
    padding: 32px 36px 28px;
    width: min(560px, 94vw);
    animation: fadeInUp 0.25s ease both;
    text-align: center;
}
.result-card h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: 20px; }
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.result-item {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 8px;
}
.result-label {
    font-size: 0.72rem;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.result-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.result-note {
    min-height: 1.2em;
    margin: -4px 0 14px;
    font-size: 0.86rem;
    color: var(--vermilion);
    font-weight: 600;
}
.result-note:empty { margin: 0; }
.result-actions { display: flex; justify-content: center; gap: 12px; }

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(29, 36, 46, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
    padding: 20px;
}
.modal-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    padding: 24px 28px;
    width: min(480px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    animation: fadeInUp 0.22s ease both;
}
.modal-content.modal-lg { width: min(720px, 94vw); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.modal-header h2 { font-size: 1.08rem; border: none; margin: 0; padding: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--ink-faint);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
.modal-close:hover { color: var(--vermilion); background: var(--vermilion-wash); }

/* ================================================================
   学生端 · 帮助中心
   ================================================================ */
.help-fab {
    position: fixed;
    right: 22px;
    bottom: 26px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--indigo);
    font-size: 1.15rem;
    font-weight: 800;
    font-family: var(--font-mono);
    cursor: pointer;
    box-shadow: var(--shadow-lift);
    transition: transform 0.15s, background 0.15s;
    z-index: 60;
}
.help-fab:hover { transform: translateY(-2px); background: var(--indigo-wash); }
.help-card { width: min(860px, 94vw); }
.help-body { display: flex; gap: 18px; }
.help-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 0 168px;
}
.help-nav-item {
    text-align: left;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.help-nav-item:hover { background: var(--paper-deep); }
.help-nav-item.active {
    background: var(--indigo-wash);
    color: var(--indigo-deep);
    box-shadow: inset 3px 0 0 var(--indigo);
}
.help-panel { flex: 1; min-width: 0; }
.help-section { display: none; }
.help-section.active { display: block; animation: fadeInUp 0.2s ease both; }
.help-section h3 { font-size: 1rem; margin-bottom: 12px; }
.help-illu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--paper);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}
.help-illu-top { margin-top: 16px; }
.help-glyph {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-kai);
    color: var(--ink);
}
.help-keybig {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-bottom-width: 3px;
    border-radius: 7px;
}
.help-arrow { color: var(--ink-faint); font-size: 1.1rem; }
.help-step {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
    font-size: 0.9rem;
}
.help-num {
    flex: 0 0 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--indigo);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-top: 2px;
}
.help-example {
    background: var(--amber-wash);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.86rem;
    color: var(--amber);
}
.help-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-bottom: 12px; }
.help-table th, .help-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.help-sym { font-family: var(--font-kai); font-size: 1.05rem; }

/* ================================================================
   学生端 · 我的记录
   ================================================================ */
.history-page { max-width: 1020px; margin: 0 auto; }

/* 概览卡：头像 + 关键数字 */
.hist-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hist-hero-main { display: flex; align-items: center; gap: 16px; }
.hist-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ink-deep);
    color: #f2f0e9;
    font-family: var(--font-kai);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hist-hero-info h1 { font-size: 1.3rem; font-weight: 800; line-height: 1.3; }
.hist-profile-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.hp-chip {
    background: var(--paper-deep);
    color: var(--ink-soft);
    padding: 2px 9px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
}
.hp-chip-latest { background: var(--indigo-wash); color: var(--indigo-deep); }
.hist-hero-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.hist-hero-stat {
    text-align: center;
    padding: 8px 18px;
    border-left: 1px solid var(--line);
}
.hist-hero-stat:first-child { border-left: none; }
.hs-val {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.hs-val small { font-size: 0.62rem; font-weight: 400; color: var(--ink-faint); }
.hs-label { display: block; font-size: 0.72rem; color: var(--ink-faint); margin-top: 1px; }

.hist-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.hist-section-head h2 { border: none; margin: 0; padding: 0; font-size: 1.02rem; }

/* 切换标签 */
.hist-tabs {
    display: inline-flex;
    background: var(--paper-deep);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.hist-tab {
    border: none;
    background: transparent;
    padding: 5px 15px;
    border-radius: 999px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.hist-tab:hover { color: var(--ink); }
.hist-tab.active { background: var(--card); color: var(--indigo-deep); box-shadow: 0 1px 3px rgba(37,45,56,0.12); }

/* 成就徽章行 */
.achv-count { font-size: 0.82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.achv-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 10px;
}
.achv {
    text-align: center;
    padding: 13px 6px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    transition: transform 0.15s, box-shadow 0.15s;
}
.achv:not(.locked):hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.achv-icon { font-size: 1.5rem; line-height: 1.2; }
.achv-name { font-size: 0.78rem; font-weight: 700; margin-top: 5px; color: var(--ink); }
.achv.locked { opacity: 0.45; filter: grayscale(0.7); }
.achv.locked .achv-name { color: var(--ink-soft); }

.hist-time { font-variant-numeric: tabular-nums; }
.hist-table td { white-space: normal; }

/* ================================================================
   教师端 · 外壳（侧边栏 + 内容）
   ================================================================ */
.teacher-body { display: flex; min-height: 100vh; }
/* 伸缩容器子项统一允许收缩，防止单个宽内容撑破整体布局 */
.dashboard-content-grid > *,
.analytics-grid > *,
.stat-cards > *,
.dashboard-section-head > div,
.hist-hero-main,
.hist-hero-info { min-width: 0; }
.sidebar {
    flex: 0 0 218px;
    background: var(--ink-deep);
    color: #cfd3da;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.sidebar-brand-text strong { color: #f2f0e9; font-size: 0.98rem; letter-spacing: 0.03em; }
.sidebar-brand-text strong::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 0.95em;
    margin-right: 7px;
    background: var(--vermilion);
    animation: caretBlink 1.2s steps(1) infinite;
    vertical-align: -0.1em;
}
.sidebar-brand-text small { font-size: 0.72rem; color: rgba(207, 211, 218, 0.55); }
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 12px;
    overflow-y: auto;
}
/* 激活项：左侧朱红光标条（签名元素） */
.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius);
    color: rgba(207, 211, 218, 0.82);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #f2f0e9;
    text-decoration: none;
}
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 700;
}
.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 2px;
    background: var(--vermilion);
}
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-logout { width: 100%; text-align: left; }
.sidebar-logo { display: none; }
.sidebar-icon { display: none; }

.main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    /* 大屏上放宽内容区并整体居中：1920 宽窗口两侧只留少量纸色边距，
       避免"内容钉死在左侧、右侧大片空白"的不适配观感 */
    max-width: 1560px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 34px 48px;
}
@media (min-width: 1800px) {
    .main-content { padding: 34px 48px 56px; }
}

/* 页头 */
.teacher-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-title-group h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.01em; }
.page-title-group p { color: var(--ink-soft); font-size: 0.87rem; margin-top: 2px; }
.page-header-chip {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--indigo-deep);
    background: var(--indigo-wash);
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.page-title-icon { display: none; }

/* ================================================================
   教师端 · 控制台
   ================================================================ */
.dashboard-page {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.dashboard-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-strong);
}
.dashboard-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--vermilion);
    margin-bottom: 4px;
}
.dashboard-hero h1 { font-size: 1.7rem; font-weight: 800; }
.dashboard-hero p { color: var(--ink-soft); font-size: 0.9rem; margin-top: 3px; }
.quick-action {
    padding: 9px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.quick-action:hover {
    text-decoration: none;
    border-color: var(--indigo);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.quick-action.primary {
    background: var(--indigo);
    border-color: var(--indigo);
    color: #fdfdff;
}
.quick-action.primary:hover { background: var(--indigo-deep); }

.class-session-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 16px 20px;
    border-left: 4px solid var(--vermilion);
}
.class-session-copy { flex: 1 1 260px; min-width: 0; }
.class-session-kicker {
    color: var(--vermilion);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}
.class-session-copy h2 { border: none; margin: 2px 0 0; padding: 0; font-size: 1.05rem; }
.class-session-copy p { color: var(--ink-soft); font-size: 0.84rem; margin-top: 3px; }
.class-session-form {
    display: flex;
    align-items: flex-end;
    flex: 1 1 460px;
    flex-wrap: wrap;
    gap: 8px 10px;
}
.class-session-select { flex: 1 1 240px; min-width: 0; }
.class-session-select label { display: block; font-size: 0.76rem; font-weight: 600; margin-bottom: 3px; }
.class-session-form .form-status { flex-basis: 100%; }
@media (max-width: 640px) {
    .class-session-form .btn { width: 100%; }
}

.dashboard-content-grid {
    flex: 1;
    display: grid;
    gap: 18px;
    align-content: start;
}
.stat-icon { display: none; }
.stat-number.text-live { color: var(--jade); }
.stat-number.text-live::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-radius: 50%;
    background: var(--jade);
    vertical-align: 0.12em;
}

/* 统计卡：左侧语义色条 + 悬浮微抬升；第四张"进行中"为青磯 */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--indigo);
}
.stat-card:nth-child(2)::before { background: var(--amber); }
.stat-card:nth-child(3)::before { background: var(--vermilion); }
.stat-card:nth-child(4)::before { background: var(--jade); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat-number { font-size: 2.1rem; }
.stat-icon { display: none; }
.dashboard-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.dashboard-section-head h2 { margin: 0; font-size: 1.02rem; }
.dashboard-section-head > div { display: flex; align-items: center; gap: 10px; }
.section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--indigo-wash);
    color: var(--indigo-deep);
    font-weight: 800;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    flex: 0 0 30px;
}
.section-icon.live { background: var(--vermilion-wash); color: var(--vermilion); }
.exam-password {
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
    background: var(--vermilion-wash);
    color: var(--vermilion-deep);
}
.dashboard-empty {
    text-align: center;
    min-height: min(420px, 48vh);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* 淡淡的字格底纹：呼应打字区的稿纸意象，让空状态不空 */
    background-image:
        linear-gradient(to right, rgba(37, 45, 56, 0.045) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(37, 45, 56, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
    background-position: center;
}
.dashboard-empty .empty-icon { font-size: 2.6rem; margin-bottom: 12px; }
.dashboard-empty h2 { border: none; font-size: 1.08rem; }
.dashboard-empty p { color: var(--ink-soft); font-size: 0.9rem; margin-top: 4px; }
.dashboard-empty-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }

/* ================================================================
   教师端 · 登录页
   ================================================================ */
.teacher-login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--ink-deep);
}
.teacher-login-wrapper { width: min(380px, 92vw); }
.teacher-login-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    border-top: 4px solid var(--vermilion);
    padding: 30px 30px 26px;
}
.teacher-login-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--vermilion);
    margin-bottom: 4px;
}
.teacher-login-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 20px; }
.teacher-input-shell { position: relative; }
.teacher-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-faint);
    pointer-events: none;
}
.teacher-input-shell .form-control { padding-left: 36px; }
.teacher-login-safe { margin-top: 14px; font-size: 0.8rem; color: var(--ink-faint); text-align: center; }
.teacher-login-back {
    display: block;
    margin-top: 16px;
    text-align: center;
    color: rgba(242, 240, 233, 0.6);
    font-size: 0.84rem;
}
.teacher-login-back:hover { color: #f2f0e9; }
.password-row { position: relative; }
.password-row .form-control { padding-right: 58px; }
.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px 8px;
    font: inherit;
    font-size: 0.8rem;
    color: var(--ink-soft);
    cursor: pointer;
    border-radius: 5px;
}
.password-toggle:hover { color: var(--indigo); background: var(--indigo-wash); }

/* ================================================================
   教师端 · 测试管理
   ================================================================ */
.exam-overview-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.exam-overview-strip > div {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 0.86rem;
}
.exam-overview-strip strong { font-family: var(--font-mono); font-size: 1.05rem; }
.exam-overview-strip small { color: var(--ink-faint); }
.overview-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.overview-dot.waiting { background: var(--ink-faint); }
.overview-dot.active { background: var(--jade); }
.overview-dot.finished { background: var(--vermilion); }

/* ================================================================
   教师端 · 学生管理
   ================================================================ */
.hub-sync-form .form-group { margin-bottom: 10px; }
.hub-sync-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.hub-sync-meta-top { font-size: 0.82rem; color: var(--ink-soft); }
.hub-action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.hub-hint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.student-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.student-filter-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    color: var(--ink-soft);
    font-weight: 600;
}
.student-name-cell { display: flex; align-items: center; gap: 8px; }
.student-mini-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--indigo-wash);
    color: var(--indigo-deep);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-kai);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 26px;
}

/* ================================================================
   教师端 · 文本库
   ================================================================ */
.text-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.text-search-input {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.text-search-input span {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-faint);
    font-size: 1rem;
    pointer-events: none;
}
.text-search-input input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
}
.text-search-input input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(45, 75, 154, 0.14);
}
.text-preview {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.text-editor-form .form-row { grid-template-columns: minmax(0, 1fr) 104px 104px; }
.text-editor-form textarea[name="content"] { min-height: 240px; tab-size: 4; }
.text-editor-form .form-hint { display: block; margin-top: 5px; }

/* ================================================================
   教师端 · 数据分析
   ================================================================ */
.analytics-filter-card { margin-bottom: 18px; }
.analytics-filter-copy { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.analytics-filter-copy h2 { margin: 0; }
.module-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 1rem;
    flex: 0 0 34px;
}
.module-icon.amber { background: var(--amber-wash); }
.analytics-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.analytics-filter-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    color: var(--ink-soft);
    font-weight: 600;
}
.analytics-grid {
    display: grid;
    grid-template-columns: minmax(320px, 5fr) minmax(400px, 7fr);
    gap: 18px;
    margin-bottom: 18px;
}
.analytics-table-state { color: var(--ink-faint); padding: 26px 0; }
.analytics-ranking-summary { min-height: 1.3em; margin-bottom: 8px; }
.export-dialog { width: min(600px, calc(100vw - 32px)); }
.export-dialog-description { margin: -4px 0 20px; color: var(--ink-soft); font-size: 0.84rem; }
.export-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.export-filter-grid label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-soft); font-size: 0.8rem; font-weight: 600; }
.export-filter-grid .form-control { width: 100%; min-width: 0; }
.export-dialog-footer { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.export-dialog-footer .form-status { flex: 1; min-width: 0; }
.settings-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ================================================================
   实时排名大屏
   ================================================================ */
.ranking-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}
.ranking-header h1 { font-size: 1.5rem; font-weight: 800; }
.ranking-page .subtitle { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 18px; }
.live-badge {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--ink-faint);
    background: var(--paper-deep);
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.live-badge.online {
    color: var(--jade-deep);
    background: var(--jade-wash);
}
.ranking-table td, .ranking-table th { padding: 12px 14px; }
.ranking-table .speed-val { font-size: 1.05rem; }
/* 教室投影场景：大画面远距离观看，排名页整体放大 */
@media (min-width: 1280px) {
    .ranking-page .table { font-size: 1.08rem; }
    .ranking-page .table td, .ranking-page .table th { padding: 16px 18px; }
    .ranking-page .table .speed-val { font-size: 1.35rem; }
    .ranking-header h1 { font-size: 1.9rem; }
    .ranking-page .subtitle { font-size: 1rem; }
}
.row-flash { animation: rowFlash 1.6s ease; }
@keyframes rowFlash {
    0% { background: var(--vermilion-wash); }
    100% { background: transparent; }
}

/* ================================================================
   错误页
   ================================================================ */
.error-page-card {
    max-width: 440px;
    margin: 10vh auto;
    text-align: center;
}
.error-code {
    font-family: var(--font-mono);
    font-size: 4.4rem;
    font-weight: 800;
    line-height: 1;
    color: var(--line-strong);
}
.error-page-card h1 { font-size: 1.2rem; margin: 14px 0 6px; }
.error-page-card p { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 20px; }
.error-actions { display: flex; justify-content: center; gap: 12px; }

/* ================================================================
   学生端 · 篇目库、练习面板与账户菜单
   ================================================================ */
.practice-library-page { max-width: 1020px; margin: 0 auto; }
.practice-library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 7px 2px 22px;
}
.practice-library-head h1 { font-size: 1.6rem; font-weight: 800; }
.practice-library-head p { margin-top: 5px; color: var(--ink-soft); font-size: 0.86rem; }
.practice-library-count { color: var(--ink-soft); font-size: 0.8rem; white-space: nowrap; }
.practice-text-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.practice-text-card {
    display: block;
    min-width: 0;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(37, 45, 56, 0.04);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.practice-text-card:hover {
    border-color: rgba(45, 75, 154, 0.5);
    box-shadow: var(--shadow-lift);
    text-decoration: none;
    transform: translateY(-2px);
}
.practice-text-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.practice-text-index { color: var(--ink-soft); font-family: var(--font-mono); font-size: 0.9rem; font-weight: 700; }
.practice-text-labels { display: inline-flex; align-items: center; gap: 8px; }
.practice-text-labels .difficulty-label { font-size: 0.7rem; }
.practice-text-card h2 { margin-top: 14px; font-size: 1.02rem; line-height: 1.5; overflow-wrap: anywhere; }
.practice-text-card > p {
    min-height: 4.9em;
    margin-top: 7px;
    color: var(--ink-soft);
    font-size: 0.79rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.practice-text-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.74rem;
}
.practice-text-action { color: var(--indigo); font-weight: 600; }

.typing-panel-title-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.typing-change { color: var(--indigo); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.typing-change:hover { text-decoration: none; color: var(--indigo-deep); }
.typing-session-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 7px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(245, 243, 236, 0.5);
}
.typing-session-bar .test-stats { flex: 1; min-width: 0; align-items: center; }
.typing-session-bar .stat-item {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
}
.typing-session-bar .stat-item .stat-value { font-size: 1.08rem; line-height: 1.35; }
.typing-session-bar .stat-item .stat-label {
    margin-bottom: 0;
    font-size: 0.65rem;
    line-height: 1.4;
    letter-spacing: 0;
}
.typing-settings { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.typing-reset { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.typing-session-bar .typing-reset { padding-top: 3px; padding-bottom: 3px; line-height: 1.2; }
.typing-reset span { font-size: 1rem; line-height: 1; }

/* 键盘教程练习：实时按键提示可收起，不接管真实输入 */
.key-coach { flex: 0 0 auto; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.key-coach > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; padding: 6px 12px; color: var(--indigo-deep); font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.key-coach-summary-note { color: var(--ink-soft); font-size: 0.7rem; font-weight: 400; }
.key-coach-body { padding: 0 12px 10px; }
.key-coach-readout { display: flex; align-items: center; gap: 20px; }
.key-coach-readout > div { display: inline-flex; align-items: center; gap: 7px; }
.key-coach-label { color: var(--ink-soft); font-size: 0.7rem; }
.key-coach-readout kbd { min-width: 40px; padding: 2px 8px; background: var(--card); color: var(--indigo-deep); text-align: center; font-size: 0.8rem; }
.key-coach-finger { color: var(--ink); font-size: 0.75rem; font-weight: 600; }
.key-coach-status { margin: 5px 0 8px; color: var(--ink-soft); font-size: 0.74rem; }
.key-coach-status[data-tone="correct"] { color: var(--jade-deep); }
.key-coach-status[data-tone="wrong"] { color: var(--vermilion-deep); }
.key-coach-status[data-tone="warning"] { color: var(--amber); }
.key-coach-keyboard { padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-deep); }
.coach-key-row { display: flex; gap: 3px; }
.coach-key-row + .coach-key-row { margin-top: 3px; }
.coach-key { display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; min-width: 0; height: 25px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--card); color: var(--ink-soft); font-family: var(--font-mono); font-size: 0.65rem; line-height: 1; transition: background 0.12s, border-color 0.12s, transform 0.12s; }
.coach-key-w15 { flex-grow: 1.5; }
.coach-key-w175 { flex-grow: 1.75; }
.coach-key-w2 { flex-grow: 2; }
.coach-key-w225 { flex-grow: 2.25; }
.coach-key-w275 { flex-grow: 2.75; }
.coach-key-w9 { flex-grow: 9; }
.coach-key.is-target { border: 2px solid var(--indigo); background: var(--indigo-wash); color: var(--indigo-deep); font-weight: 700; }
.coach-key.is-modifier-target { border: 2px dashed var(--indigo); color: var(--indigo-deep); }
.coach-key.is-pressed { transform: translateY(2px); }
.coach-key.is-correct { border-color: var(--jade-deep); background: var(--jade-wash); color: var(--jade-deep); }
.coach-key.is-wrong { border-color: var(--vermilion); background: var(--vermilion-wash); color: var(--vermilion-deep); }
.coach-key.is-warning { border-color: var(--amber); background: var(--amber-wash); color: var(--amber); }
.key-coach-keyboard.is-numpad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: 4px; width: min(360px, 100%); margin: 0 auto; }
.is-numpad .coach-key { height: 28px; font-size: 0.74rem; }
.is-numpad .coach-key-wide { grid-column: span 2; }
.is-numpad .coach-key-tall { grid-row: span 2; height: auto; }
.key-coach-note { margin-top: 6px; color: var(--ink-soft); font-size: 0.67rem; }
@media (max-width: 640px), (max-height: 700px) {
    .key-coach-keyboard { display: none; }
    .key-coach-body { padding-bottom: 8px; }
    .key-coach-readout { gap: 12px; flex-wrap: wrap; }
    .key-coach-status { margin-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .coach-key { transition: none; }
}

/* 打字页固定在视口内，只有文本区承担内部滚动 */
.typing-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}
.typing-page .student-nav { position: static; flex: 0 0 auto; }
.typing-page > .container {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    padding-top: 20px;
    padding-bottom: 20px;
}
.typing-page .test-page {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}
.typing-page .typing-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.typing-page .typing-panel-head,
.typing-page .typing-session-bar,
.typing-page .typing-panel-foot,
.typing-page .test-top-bar,
.typing-page .test-bottom-bar,
.typing-page .focus-status { flex: 0 0 auto; }
.typing-page .typing-panel-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 14px;
}
.typing-page .typing-panel .typing-zone,
.typing-page .test-page > .typing-zone {
    flex: 1;
    min-height: 0;
    max-height: none;
}

.student-account {
    position: relative;
    flex: 0 0 auto;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(242, 240, 233, 0.14);
}
.student-account-trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #f2f0e9;
    font: inherit;
    font-size: 0.84rem;
    cursor: pointer;
}
.student-account-trigger:hover,
.student-account-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); }
.student-account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--indigo-wash);
    color: var(--indigo-deep);
    font-family: var(--font-kai);
    font-size: 0.85rem;
    font-weight: 700;
}
.student-account-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-account-chevron {
    width: 6px;
    height: 6px;
    margin-left: 1px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.15s;
}
.student-account-trigger[aria-expanded="true"] .student-account-chevron { transform: rotate(225deg); }
.student-account-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 60;
    width: 220px;
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-lift);
    color: var(--ink);
}
.student-account-summary { padding: 8px 10px 11px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.student-account-summary strong { display: block; font-size: 0.88rem; }
.student-account-summary span { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 0.75rem; }
.student-logout {
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--vermilion-deep);
    font: inherit;
    font-size: 0.84rem;
    text-align: left;
    cursor: pointer;
}
.student-logout:hover { background: var(--vermilion-wash); }

/* ================================================================
   响应式
   ================================================================ */
/* 大屏：打字区字号放大，长文本更易读 */
@media (min-width: 1400px) {
    .typing-zone { font-size: 1.32rem; gap: 16px 1px; min-height: 340px; }
    .typing-panel .typing-zone { min-height: 300px; font-size: 1.42rem; gap: 24px 2px; }
    .container { max-width: 1160px; }
    .test-page { max-width: 1120px; }
}

@media (max-width: 1280px) {
    .sidebar { flex-basis: 190px; }
    .sidebar-link { padding: 8px 11px; font-size: 0.88rem; }
    .sidebar-brand { padding: 18px 14px 16px; }
    .main-content { padding: 24px 24px 44px; }
}
@media (max-width: 960px) {
    .analytics-grid { grid-template-columns: 1fr; }
    .two-column { grid-template-columns: 1fr; }
    .teacher-body { flex-direction: column; }
    .practice-mode { align-items: flex-start; }
    .practice-mode .test-stats { width: 100%; }
    .practice-mode .stat-item { padding-right: 8px; padding-left: 8px; }
    .practice-text-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .typing-settings { width: 100%; justify-content: flex-end; }
    /* 顶栏：单行横向滑动，避免导航项折成多行占用首屏 */
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 2px;
        flex-basis: auto;
        padding: 8px 12px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .sidebar::-webkit-scrollbar { display: none; }
    .sidebar-brand { border: none; padding: 0 8px 0 0; flex: 0 0 auto; }
    .sidebar-brand-text small { display: none; }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 0;
        gap: 2px;
        overflow: visible;
    }
    .sidebar-link { padding: 7px 11px; white-space: nowrap; flex: 0 0 auto; }
    .sidebar-link.active::before { top: auto; bottom: 2px; left: 10px; right: 10px; width: auto; height: 3px; }
    .sidebar-footer {
        border: none;
        padding: 0 0 0 10px;
        margin-left: 0;
        flex: 0 0 auto;
    }
    .sidebar-logout { width: auto; }
    .main-content { padding: 20px 16px 44px; min-height: auto; }
    .dashboard-empty { min-height: 300px; }
}
@media (max-width: 640px) {
    .container { padding: 18px 14px 44px; }
    .student-nav .nav-container {
        height: auto;
        min-height: 54px;
        flex-wrap: wrap;
        row-gap: 3px;
        padding: 8px 14px 0;
    }
    .student-nav .nav-brand { order: 1; flex: 0 0 auto; font-size: 0.9rem; }
    .student-account { order: 2; margin-left: auto; padding-left: 8px; }
    .student-account-menu {
        position: fixed;
        top: 94px;
        right: 14px;
        width: min(220px, calc(100vw - 28px));
    }
    .student-nav .nav-links {
        order: 3;
        flex: 0 0 100%;
        min-width: 0;
        gap: 0;
        margin-left: 0;
        padding-bottom: 5px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .student-nav .nav-links a { padding: 6px 9px; font-size: 0.8rem; white-space: nowrap; }
    .practice-library-head { padding-top: 2px; }
    .practice-library-head h1 { font-size: 1.4rem; }
    .practice-text-grid { grid-template-columns: 1fr; }
    .practice-text-card > p { min-height: 0; }
    .typing-session-bar { align-items: stretch; flex-direction: column; padding: 12px 14px; }
    .typing-settings {
        width: 100%;
        justify-content: space-between;
        padding-top: 10px;
        border-top: 1px solid var(--line);
    }
    .tutorials-hero { align-items: flex-start; flex-direction: column; gap: 16px; padding-top: 2px; }
    .tutorials-hero h1 { font-size: 1.55rem; }
    .tutorial-total { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; flex-basis: auto; padding: 12px 16px; }
    .tutorial-total strong { margin: 0; font-size: 1.2rem; }
    .tutorial-total progress { grid-column: 1 / -1; }
    .tutorial-course-grid { grid-template-columns: 1fr; }
    .tutorial-course-card { padding: 18px; }
    .tutorial-course-card > p { min-height: 0; }
    .course-symbol { flex-basis: 56px; width: 56px; height: 56px; font-size: 1.5rem; }
    .course-symbol.keyboard { font-size: 1.1rem; }
    .tutorial-section-head { align-items: flex-start; }
    .tutorial-section-head > span { text-align: right; }
    .tutorial-detail-head { align-items: flex-start; flex-direction: column; gap: 18px; padding: 18px; }
    .tutorial-detail-title { align-items: flex-start; gap: 13px; }
    .tutorial-detail-title h1 { font-size: 1.15rem; }
    .tutorial-detail-progress { width: 100%; flex-basis: auto; text-align: left; }
    .tutorial-detail-progress > span { display: inline; margin-left: 5px; }
    .tutorial-detail-progress progress { margin-top: 7px; }
    .tutorial-lesson-card { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 15px 14px; }
    .lesson-number { font-size: 1rem; }
    .lesson-action { grid-column: 2; justify-self: start; }
    .form-row { grid-template-columns: 1fr; }
    .hist-hero { flex-direction: column; align-items: flex-start; }
    .hist-hero-stat { padding: 8px 14px; }
    .test-stats { gap: 16px; }
    .test-top-bar { justify-content: center; }
    .test-top-bar.practice-mode { padding: 15px 14px; }
    .practice-mode .test-info { width: 100%; }
    .practice-student { gap: 6px; }
    .practice-mode .test-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .practice-mode .stat-item { padding: 12px 3px 0; }
    .typing-session-bar .stat-item { display: block; padding: 0 3px; }
    .practice-mode .stat-item .stat-label { font-size: 0.64rem; letter-spacing: 0; }
    .practice-mode .stat-item .stat-value { font-size: 1rem; gap: 1px; }
    .practice-mode .stat-item .stat-value small { font-size: 0.55rem; }
    .typing-zone { padding: 18px 16px; font-size: 1.05rem; }
    .practice-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 13px; }
    .toolbar-group { flex-wrap: nowrap; }
    .toolbar-group label,
    .toolbar-label { flex: 0 0 32px; margin-right: 3px; }
    .toolbar-group .tool-btn { flex: 1; min-width: 0; padding-right: 8px; padding-left: 8px; }
    .toolbar-text-select { min-width: 0; }
    .tool-select { width: 100%; max-width: 100%; }
    .typing-panel-head { padding: 13px 16px; gap: 10px; }
    .typing-panel-head h2 { font-size: 0.96rem; }
    .typing-panel-count { padding: 2px 7px; font-size: 0.68rem; }
    .typing-panel-body { padding: 10px 12px 14px; }
    .typing-panel .typing-zone { min-height: 220px; max-height: 52vh; padding: 20px 16px; font-size: 1.14rem; gap: 15px 1px; }
    .typing-panel-foot { flex-wrap: wrap; gap: 7px; padding: 10px 16px; }
    .typing-shortcuts { margin-left: auto; }
    .practice-page .container,
    .tutorial-page .container,
    .library-page .container { padding-bottom: 18px; }
    .practice-page .help-fab,
    .tutorial-page .help-fab,
    .library-page .help-fab {
        position: static;
        display: block;
        width: 36px;
        height: 36px;
        margin: 0 14px 18px auto;
        font-size: 1rem;
    }
    .practice-actions { flex-wrap: wrap; gap: 9px; }
    .practice-actions-note { flex: 0 0 100%; text-align: center; }
    .practice-actions .btn { flex: 1; padding-right: 12px; padding-left: 12px; }
    .exam-card { flex-direction: column; align-items: flex-start; }
    .help-body { flex-direction: column; }
    .help-nav {
        flex-direction: row;
        flex: none;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .help-nav-item { white-space: nowrap; }
    .result-card { padding: 24px 18px; }
    .table th, .table td { padding: 8px 10px; font-size: 0.84rem; }
}
@media (max-width: 380px) {
    .practice-mode .stat-item .stat-value { font-size: 0.9rem; }
    .practice-mode .stat-item .stat-value small { display: block; }
    .typing-shortcuts { margin-left: 0; }
}

/* 极矮窗口压缩辅助区域，仍只允许打字内容内部滚动 */
@media (max-height: 520px) {
    .typing-page > .container { padding: 6px 12px; }
    .typing-page .student-nav .nav-container {
        height: 44px;
        min-height: 44px;
        flex-wrap: nowrap;
        padding: 0 12px;
    }
    .typing-page .student-nav .nav-brand { display: none; }
    .typing-page .student-nav .nav-links {
        order: initial;
        flex: 1;
        min-width: 0;
        margin-left: 0;
        padding-bottom: 0;
        overflow-x: auto;
    }
    .typing-page .typing-panel-head { padding: 6px 14px; }
    .typing-page .typing-panel-kicker { display: none; }
    .typing-page .typing-panel-head h2 { font-size: 0.92rem; }
    .typing-page .typing-session-bar { flex-direction: row; align-items: center; padding: 4px 10px; }
    .typing-page .typing-settings { width: auto; padding-top: 0; border-top: 0; }
    .typing-page .typing-panel-body { padding: 6px 10px; }
    .typing-page .typing-panel-foot { display: none; }
    .typing-page .typing-panel .typing-zone,
    .typing-page .test-page > .typing-zone {
        min-height: 0;
        max-height: none;
        padding: 12px 16px;
        font-size: 1rem;
        gap: 12px 1px;
    }
    .typing-page .test-top-bar { gap: 6px; margin-bottom: 6px; padding: 7px 12px; }
    .typing-page .test-bottom-bar { gap: 8px; margin-top: 6px; }
    .typing-page .submit-hint,
    .typing-page .practice-actions-note { display: none; }
    .typing-page .practice-actions .btn { min-height: 32px; padding: 4px 14px; }
}

/* ================================================================
   教师端 · 课堂控制台与稳定工作区
   ================================================================ */
.sidebar-brand:hover { text-decoration: none; }
.sidebar-nav { gap: 6px; padding: 22px 14px; }
.sidebar-link { gap: 12px; padding: 12px; }
.sidebar-link-copy { display: grid; gap: 2px; min-width: 0; }
.sidebar-link-copy strong { font-size: 0.88rem; font-weight: 600; }
.sidebar-link-copy small { color: #aeb7c4; font-size: 0.67rem; line-height: 1.45; }
.sidebar-link.active .sidebar-link-copy small { color: #d2d9e6; }
.sidebar-nav-icon { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-link.active::before { top: 12px; bottom: 12px; }
.sidebar-account { position: relative; min-width: 0; }
.sidebar-account-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: #e4e7ec;
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}
.sidebar-account-trigger:hover, .sidebar-account-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, 0.08); }
.sidebar-account-icon { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.sidebar-account-name { flex: 1; min-width: 0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-chevron { width: 7px; height: 7px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.sidebar-account-trigger[aria-expanded="true"] .sidebar-account-chevron { margin-top: 3px; transform: rotate(225deg); }
.sidebar-account-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 90;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-lift);
}
.sidebar-account-menuitem {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
}
.sidebar-account-menuitem:hover, .sidebar-account-menuitem:focus-visible { background: var(--indigo-wash); color: var(--indigo-deep); }
.sidebar-account-menu .sidebar-menu-logout { color: var(--vermilion-deep); }
.account-security-dialog { width: min(420px, 94vw); }

.class-session-form { display: block; flex: none; min-width: 0; }
.class-session-label { display: block; margin-bottom: 5px; color: var(--ink-soft); font-size: 0.72rem; font-weight: 600; }
.class-session-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.class-session-controls .form-control { flex: 1 1 auto; width: 0; min-width: 0; min-height: 36px; padding: 6px 10px; font-size: 0.83rem; }
.class-session-controls .btn[hidden] { display: none; }
.class-session-form .form-status { display: block; font-size: 0.72rem; line-height: 1.5; }
.class-session-form .form-status:not(:empty) { margin-top: 5px; }
.classroom-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line-strong); }
.classroom-header h1 { font-size: 1.6rem; line-height: 1.35; font-weight: 800; }
.classroom-header p { margin-top: 4px; color: var(--ink-soft); font-size: 0.84rem; }
.classroom-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.classroom-class-switcher { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; flex: 0 1 300px; width: 300px; }
.classroom-class-switcher .class-session-label { margin: 0; white-space: nowrap; }
.classroom-class-switcher .form-status { grid-column: 1 / -1; }
.classroom-grid { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(430px, 7fr); flex: 1; gap: 18px; min-height: 0; margin-bottom: 0; }
.classroom-grid > *, .classroom-exam-main > *, .classroom-exam-foot > * { min-width: 0; }
.classroom-session { display: flex; flex-direction: column; height: 100%; min-height: 0; margin-bottom: 0; overflow-y: auto; }
.classroom-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.classroom-section-head h2 { margin: 4px 0 0; padding: 0; border: 0; font-size: 1.12rem; }
.classroom-section-head p { margin-top: 3px; color: var(--ink-soft); font-size: 0.76rem; }
.classroom-section-head > a { padding-top: 4px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.classroom-phase { display: inline-flex; align-items: center; gap: 5px; color: var(--indigo-deep); font-size: 0.67rem; font-weight: 700; }
.classroom-phase::before { content: ""; width: 3px; height: 11px; border-radius: 1px; background: var(--vermilion); }
.classroom-exam { border: 1px solid var(--line); border-radius: 9px; background: var(--paper); overflow: hidden; }
.classroom-exam.is-active { border-color: #a5c8b9; background: #f5fbf8; }
.classroom-exam + .classroom-exam { margin-top: 10px; }
.classroom-exam-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px; }
.classroom-exam-main h3 { margin-top: 6px; font-size: 0.94rem; line-height: 1.55; overflow-wrap: anywhere; }
.classroom-exam-main p { margin-top: 4px; color: var(--ink-soft); font-size: 0.76rem; }
.classroom-exam-password { flex: 0 0 auto; text-align: right; }
.classroom-exam-password span { display: block; color: var(--ink-soft); font-size: 0.66rem; }
.classroom-exam-password code { display: inline-block; margin-top: 4px; font-size: 0.95rem; white-space: nowrap; }
.classroom-exam-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.72rem; }
.classroom-exam-foot > div { display: flex; gap: 8px; flex-wrap: wrap; }
.classroom-upcoming { margin-top: 20px; }
.classroom-section-head + .classroom-upcoming { margin-top: 0; }
.classroom-upcoming > h3 { margin-bottom: 10px; font-size: 0.82rem; }
.classroom-upcoming > h3 > span { margin-left: 7px; color: var(--ink-soft); font-size: 0.7rem; font-weight: 400; }
.classroom-more { display: inline-block; margin-top: 12px; font-size: 0.75rem; }
.classroom-test-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; padding: 25px 16px 20px; text-align: center; }
.classroom-empty-mark { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 12px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink-soft); font-family: var(--font-book); font-size: 1.5rem; box-shadow: 0 2px 0 var(--line); }
.classroom-test-empty h3 { font-size: 0.92rem; }
.classroom-test-empty p { max-width: 450px; margin: 8px auto 16px; color: var(--ink-soft); font-size: 0.78rem; }
.exam-overview-strip > a { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); font-size: 0.86rem; }
.exam-overview-strip > a:hover { border-color: var(--indigo); text-decoration: none; }
.exam-overview-strip > a.active { border-color: var(--indigo); background: var(--indigo-wash); }
.exam-overview-strip strong { font-family: var(--font-mono); font-size: 1.05rem; }
.exam-overview-strip small { color: var(--ink-soft); }
.exam-list-scope { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 0.7rem; }
.exams-page { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.exams-page > .teacher-page-header, .exams-page > .exam-overview-strip { flex: 0 0 auto; }
.exam-list-card { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; margin-bottom: 0; }
.exam-list-card > .card-header { flex: 0 0 auto; }
.exam-list-card > .table-responsive { flex: 0 1 auto; }
.exam-list-card > .managed-empty-state { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; padding: 24px; }
.exam-list-card > .managed-empty-state .btn { margin-top: 14px; }

@media (max-width: 960px) {
    .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; padding: 10px 14px 0; overflow: visible; }
    .sidebar-brand { grid-column: 1; grid-row: 1; padding: 0 0 8px; }
    .sidebar-nav { grid-column: 1 / -1; grid-row: 3; flex: none; flex-direction: row; gap: 3px; padding: 0 0 8px; overflow-x: auto; scrollbar-width: none; }
    .sidebar-link { padding: 9px 12px; white-space: nowrap; }
    .sidebar-link-copy small { display: none; }
    .sidebar-link-copy strong { font-size: 0.82rem; }
    .sidebar-link.active::before { top: auto; bottom: 2px; left: 10px; right: 10px; width: auto; height: 3px; }
    .sidebar-footer { display: flex; align-items: center; grid-column: 2; grid-row: 1; padding: 0 0 8px; }
    .sidebar-account-trigger { width: auto; min-width: 118px; max-width: 180px; }
    .sidebar-account-menu { position: fixed; top: 52px; right: 14px; bottom: auto; left: auto; width: min(220px, calc(100vw - 28px)); }
    .main-content { padding-top: 18px; }
}
@media (max-width: 640px) {
    .sidebar { padding: 10px 10px 0; }
    .sidebar-brand-text strong { font-size: 0.92rem; }
    .sidebar-link { gap: 7px; padding: 8px 10px; }
    .sidebar-nav-icon { width: 17px; height: 17px; flex-basis: 17px; }
    .class-session-controls .form-control { width: 0; padding: 8px 10px; }
    .class-session-controls .btn { flex: 0 0 auto; }
    .classroom-header { align-items: flex-start; }
    .classroom-header h1 { font-size: 1.35rem; }
    .classroom-header p { font-size: 0.78rem; }
    .classroom-header-actions { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
    .classroom-class-switcher { width: 100%; }
    .quick-action { padding: 9px 12px; text-align: center; }
    .classroom-grid .card { padding: 18px 16px; }
    .classroom-section-head { margin-bottom: 14px; }
    .classroom-exam-main { padding: 13px; }
    .classroom-exam-password { display: flex; align-items: center; gap: 9px; text-align: left; }
    .classroom-exam-password code { margin-top: 0; }
    .classroom-exam-foot { align-items: flex-start; padding: 10px 13px; }
    .teacher-body .btn-sm { min-height: 34px; padding: 6px 12px; }
    .export-dialog-footer { flex-wrap: wrap; }
    .export-dialog-footer .form-status { order: 3; flex-basis: 100%; }
}
@media (max-width: 380px) {
    .sidebar-footer .sidebar-nav-icon { display: none; }
}
.page-context { display: block; margin-bottom: 3px; color: var(--ink-soft); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.05em; }
.page-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.students-page-actions { flex: 0 1 auto; min-width: 0; gap: 8px; }
.hub-status-strip { display: flex; align-items: center; flex: 0 1 auto; gap: 4px 8px; flex-wrap: wrap; margin: 0; color: var(--ink-soft); font-size: 0.74rem; line-height: 1.5; }
.hub-config-dialog { width: min(760px, calc(100vw - 32px)); }
.hub-config-dialog > .hub-status-strip { margin: -6px 0 16px; }
.hub-connection-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hub-config-dialog .hub-sync-actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.hub-action-buttons .btn { white-space: nowrap; }
.hub-sync-form > .form-status { display: block; margin-top: 10px; }
.sync-warning { display: inline-block; color: var(--vermilion-deep); font-weight: 600; }
.exam-form-section { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.exam-form-section legend { width: 100%; margin-bottom: 12px; padding: 0 0 8px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 0.85rem; font-weight: 700; }
.exam-form-section legend span { margin-right: 6px; color: var(--indigo); font-family: var(--font-mono); font-size: 0.72rem; }
.exam-form-section .form-group { margin-bottom: 0; }
.exam-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.exam-form-actions .btn { flex: 0 0 auto; }
@media (max-width: 640px) {
    .page-header-actions { justify-content: flex-start; }
    .students-page-actions { flex-basis: 100%; }
    .text-editor-form .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .text-editor-form .text-title-field { grid-column: 1 / -1; }
    .hub-status-strip { flex-basis: 100%; }
    .modal { padding: 12px; }
    .hub-config-dialog,
    .export-dialog { width: 100%; max-height: calc(100dvh - 24px); padding: 20px 18px; }
    .hub-connection-grid { grid-template-columns: 1fr; gap: 0; }
    .export-filter-grid { grid-template-columns: 1fr; gap: 14px; }
    .hub-config-dialog .hub-sync-actions { align-items: stretch; flex-direction: column; }
    .hub-action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
    .exam-form-actions { align-items: stretch; flex-direction: column; }
}

/* ========== 教师工作区视口与课中练习 ========== */
.teacher-body:has(.dashboard-page),
.teacher-body:has(.analytics-page),
.teacher-body:has(.texts-page) { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.teacher-body:has(.dashboard-page) .main-content,
.teacher-body:has(.analytics-page) .main-content,
.teacher-body:has(.texts-page) .main-content { min-height: 0; overflow: hidden; }
.dashboard-page, .texts-page, .analytics-page { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: auto; scrollbar-width: thin; }
.texts-page > .teacher-page-header,
.analytics-page > .teacher-page-header,
.analytics-filter-card,
.text-library-card > .card-header,
.text-search-bar,
.text-library-card > .filter-summary,
.text-library-card > .pagination { flex: 0 0 auto; }
.text-library-card { display: flex; flex: 1; flex-direction: column; min-height: 0; margin-bottom: 0; }
.text-library-card > .table-responsive { flex: 1; min-height: 0; overflow: auto; }
.text-library-card > .pagination { margin-top: 12px; }
.text-library-card > .text-empty-state { display: flex; flex: 1; flex-direction: column; justify-content: center; min-height: 0; padding: 20px; }
.text-library-card thead th,
.analytics-ranking-card thead th,
.classroom-practice-table thead th { position: sticky; top: 0; z-index: 1; background: var(--card); }
.analytics-filter-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 20px; }
.analytics-filter-copy { margin-bottom: 0; }
.analytics-filter-bar { gap: 10px; }
.analytics-grid { flex: 1; min-height: 240px; margin-bottom: 0; }
.analytics-chart-card, .analytics-ranking-card { display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; }
.analytics-chart-card .chart-container,
.analytics-progress-card .chart-container { flex: 1; min-height: 0; height: auto; }
.analytics-ranking-card > .table-responsive { flex: 1; min-height: 0; overflow: auto; }
.analytics-ranking-card > .pagination { flex: 0 0 auto; margin-top: 10px; }
.analytics-progress-card:not(.is-hidden) { display: flex; flex: 0 0 min(30vh, 270px); flex-direction: column; min-height: 0; margin: 18px 0 0; }
.analytics-page:has(.analytics-progress-card:not(.is-hidden)) .analytics-grid { grid-template-columns: minmax(0, 1fr); }
.classroom-practice { display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; }
.classroom-practice-table { flex: 1; min-height: 0; overflow: auto; }
.classroom-practice-table .table { min-width: 600px; }
.classroom-practice[data-show-class="true"] .classroom-practice-table .table { min-width: 680px; }
.classroom-practice-table th, .classroom-practice-table td { padding: 9px 10px; font-size: 0.79rem; }
.classroom-practice-empty { padding: 30px 12px; color: var(--ink-soft); }
.practice-refresh { color: var(--jade); font-size: 0.72rem; white-space: nowrap; }
.practice-refresh::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; }
.practice-refresh.is-offline { color: var(--vermilion); }
.practice-status { display: inline-block; padding: 2px 7px; border-radius: 999px; background: var(--paper-deep); color: var(--ink-soft); font-size: 0.72rem; white-space: nowrap; }
.practice-status.typing { background: var(--jade-wash); color: var(--jade-deep); }
.practice-status.paused { background: var(--amber-wash); color: var(--amber); }
.practice-status.completed { background: var(--indigo-wash); color: var(--indigo-deep); }
.practice-progress-cell { min-width: 120px; }
.practice-progress-cell > span { display: block; font-size: 0.72rem; white-space: nowrap; }
.practice-progress-cell progress { display: block; width: 100%; height: 4px; margin-top: 5px; accent-color: var(--indigo); }
@media (max-width: 1080px) {
    .classroom-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
    .classroom-session { max-height: none; }
}
@media (max-width: 960px) {
    .analytics-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(150px, 0.8fr) minmax(180px, 1.2fr); }
}
@media (max-width: 640px) {
    .analytics-filter-card { padding: 14px 16px; }
    .analytics-filter-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; width: 100%; gap: 8px; }
    .analytics-filter-bar label { flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
    .analytics-filter-bar label > span { font-size: 0.68rem; white-space: nowrap; }
    .analytics-filter-bar .form-control-sm { width: 100%; min-width: 0; padding: 6px 4px; font-size: 0.76rem; }
    .analytics-filter-bar .btn { align-self: end; padding-right: 9px; padding-left: 9px; }
    .classroom-class-switcher { flex-basis: auto; }
    .classroom-header-actions { align-items: stretch; }
}

/* ========== 动效偏好 ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    /* 光标常亮：保留位置指示但不闪烁 */
    .tcell-in.c-cursor,
    .nav-brand::before,
    .sidebar-brand-text strong::before { animation: none !important; opacity: 1 !important; }
}
