/* =========================================================
   讲题 · 中考改卷与讲解
   设计基调：纸感、暖色、字大、按钮少 —— 孩子自己用
   ========================================================= */
:root {
  --bg: #f4f1ea;
  --bg-2: #efeae0;
  --surface: #fffdf8;
  --surface-2: #faf6ee;
  --surface-3: #f2ece0;
  --ink: #23201b;
  --ink-2: #4c463d;
  --muted: #857c6d;
  --muted-2: #a89e8d;
  --line: #e4ddd0;
  --line-strong: #d6cdbc;

  --brand: #0f766e;
  --brand-dark: #0b5a55;
  --brand-soft: #ddf2ee;
  --brand-softer: #eef9f6;
  --accent: #c2561f;
  --accent-soft: #fbeee4;
  --danger: #b3403a;
  --danger-soft: #fbeae8;
  --success: #1a7346;
  --success-soft: #e8f5ee;
  --warn: #9a6a12;
  --warn-soft: #fbf2dd;

  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(35, 32, 27, .05);
  --shadow-md: 0 10px 28px rgba(35, 32, 27, .08);
  --shadow-lg: 0 24px 60px rgba(35, 32, 27, .16);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, "Segoe UI", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613; --bg-2: #131210; --surface: #201e1a; --surface-2: #26231e; --surface-3: #2e2a24;
    --ink: #f2eee6; --ink-2: #cfc8bb; --muted: #9d9484; --muted-2: #7d7568;
    --line: #332f28; --line-strong: #423d34;
    --brand: #5fbfa6; --brand-dark: #7ad2ba; --brand-soft: #1e3b34; --brand-softer: #1a2d28;
    --accent: #e0854c; --accent-soft: #33241a;
    --danger: #e8837c; --danger-soft: #33201f;
    --success: #6ec79a; --success-soft: #1b2f26;
    --warn: #d7ab5e; --warn-soft: #2f2819;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(31, 111, 92, .06), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(194, 86, 31, .05), transparent 55%),
    var(--bg);
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ── 顶栏 ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
/* 品牌标记：蜡笔禾手绘 LOGO（assets/logo-labihe.png，已去白底），
   宽高比 964:692，高度定住、宽度自适应。 */
.brand-mark { height: 46px; width: auto; display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-text em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 1px; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a {
  padding: 7px 14px; border-radius: 999px; color: var(--ink-2);
  font-size: 14.5px; transition: .15s;
}
.nav a:hover { background: var(--surface-3); }
.nav a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.who { margin-left: auto; font-size: 13.5px; color: var(--muted); }

/* ── 布局 ─────────────────────────────────────────────── */
.view { max-width: 1080px; margin: 0 auto; padding: 30px 24px 90px; }
.narrow { max-width: 820px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: .5px; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.spacer { flex: 1; }

/* ── 按钮 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer;
  font-size: 15px; font-weight: 500; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.sm { padding: 6px 12px; font-size: 13.5px; }
.btn.lg { padding: 14px 26px; font-size: 17px; }
.btn.block { width: 100%; }

/* ── 卡片 ─────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.card .hint { color: var(--muted); font-size: 13.5px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ── 首页 ─────────────────────────────────────────────── */
/* 2026-11-06 改版：绿块和下面卡片同宽（都吃 .narrow 的 820），
   统计收进绿块底部一条——原来绿块只占左栏 1.35fr，右边比卡片短 340px，视觉上是断的。 */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--brand-dark), var(--brand) 60%, #2c8d80);
  color: #f4fbf8; border-radius: var(--r-xl);
  box-shadow: var(--shadow-md); margin-bottom: 22px;
}
.hero:after {
  content: "讲"; position: absolute; right: -6px; bottom: -56px;
  font-family: var(--serif); font-size: 200px; line-height: 1; color: rgba(255,255,255,.06);
  pointer-events: none;
}
.hero-in { position: relative; z-index: 1; padding: 30px 30px 0; }
.hero h1 { font-size: 27px; margin-bottom: 8px; }
.hero p { margin: 0; color: rgba(244, 251, 248, .82); font-size: 14.5px; max-width: 34em; }
.hero-note { position: relative; z-index: 1; padding: 0 30px; margin: 0 0 16px; font-size: 12.5px; color: rgba(244, 251, 248, .68); }
.hero-note a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.hero-stats {
  position: relative; z-index: 1; display: flex;
  border-top: 1px solid rgba(255,255,255,.16);
}
.hs { flex: 1; padding: 14px 24px 18px; }
.hs:first-child { padding-left: 30px; }
.hs:last-child { padding-right: 30px; }
.hs + .hs { border-left: 1px solid rgba(255,255,255,.16); }
.hs .k { font-size: 12px; color: rgba(244, 251, 248, .66); letter-spacing: .4px; }
.hs .v { font-family: var(--serif); font-size: 25px; font-weight: 700; letter-spacing: .5px; margin-top: 2px; }
.hs .v small { font-size: 12.5px; font-weight: 500; color: rgba(244, 251, 248, .7); font-family: var(--font); }
@media (max-width: 640px) {
  .hero-in { padding: 22px 20px 0; }
  .hero-note { padding: 0 20px; }
  .hs { padding: 12px 12px 14px; }
  .hs:first-child { padding-left: 20px; }
  .hs:last-child { padding-right: 20px; }
  .hs .v { font-size: 21px; }
}

.list { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px;
  border-bottom: 1px dashed var(--line); cursor: pointer;
}
.row-item:last-child { border-bottom: 0; }
.row-item:hover .row-title { color: var(--brand); }
.row-title { font-weight: 600; font-size: 15.5px; }
.row-sub { font-size: 13px; color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-2);
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge.guide-lv {
  background: rgba(100, 84, 156, .12);
  color: #4e3f80;
  border: 1px solid rgba(100, 84, 156, .30);
  transition: background .25s ease, color .25s ease;
}
.score-pill { font-family: var(--serif); font-weight: 700; font-size: 18px; }
.score-pill small { font-size: 12px; color: var(--muted); font-weight: 500; font-family: var(--font); }

/* ── 上传 ─────────────────────────────────────────────── */
.drop {
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: 42px 20px; text-align: center; background: var(--surface-2);
  transition: .2s; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-softer); }
.drop .big { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.drop h3 { font-size: 17px; margin-bottom: 4px; }
.drop p { color: var(--muted); font-size: 13.5px; margin: 0; }
.drop .pick-hint { margin-top: 8px; font-size: 12px; }

/* 按格式上传的按钮（首页和上传页共用） */
.pick-row { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 12px; }
.pick-btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; transition: .15s;
}
.pick-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* 首页「把卷子放进来」 */
.home-drop {
  margin: 18px 0 14px; padding: 22px 18px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--ink); transition: .2s;
}
.home-drop:hover, .home-drop.over { border-color: var(--brand); background: var(--brand-softer); }
.home-drop .hd-icon { font-size: 30px; line-height: 1; }
.home-drop .hd-title { font-size: 16px; font-weight: 600; margin-top: 6px; color: var(--ink); }
.home-drop .hd-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.thumb {
  position: relative; border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; background: var(--surface-3); aspect-ratio: 3/4;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tag {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.92); color: var(--ink); font-size: 11.5px; font-weight: 600;
}
.thumb .tag.answer { background: var(--accent); color: #fff; }
.thumb .tag.sheet { background: var(--brand); color: #fff; }
.thumb .srctag {
  position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 2px 7px;
  border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
}
.thumb .ops {
  position: absolute; inset: auto 0 0 0; display: flex; gap: 4px; padding: 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); opacity: 0; transition: .15s;
}
.thumb:hover .ops { opacity: 1; }
.thumb .ops button {
  flex: 1; border: 0; border-radius: 7px; padding: 4px 0; font-size: 12px;
  background: rgba(255,255,255,.9); cursor: pointer;
}
.thumb .ops .role-sel {
  flex: 1.8; border: 0; border-radius: 7px; padding: 4px 2px; font-size: 12px;
  background: rgba(255,255,255,.95); cursor: pointer; color: var(--ink);
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ── 进度 ─────────────────────────────────────────────── */
.progress-card { text-align: center; padding: 50px 20px; }
.spinner {
  width: 46px; height: 46px; margin: 0 auto 22px; border-radius: 50%;
  border: 4px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.logline { color: var(--muted); font-size: 14px; margin-top: 6px; min-height: 22px; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 18px auto 0; max-width: 380px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s; }

/* ── 判分结果 ─────────────────────────────────────────── */
.result-head {
  display: flex; gap: 26px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 24px 28px; box-shadow: var(--shadow-sm);
}
.big-score { font-family: var(--serif); font-size: 52px; line-height: 1; letter-spacing: 1px; }
.big-score small { font-size: 18px; color: var(--muted); font-family: var(--font); letter-spacing: 0; }
.rate-bar { flex: 1; min-width: 220px; }
.rate-bar .label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.rate-bar .track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rate-bar .track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #3fa283); }

.qcard {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
  border-radius: var(--r-md); padding: 16px 18px; margin-top: 12px;
}
.qcard.ok { border-left-color: var(--success); }
.qcard.half { border-left-color: var(--warn); }
.qcard.bad { border-left-color: var(--danger); }
.qcard.check { box-shadow: 0 0 0 3px var(--warn-soft); }
.qhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qno { font-weight: 700; font-size: 15px; font-family: var(--serif); }
.qtype { font-size: 12px; color: var(--muted); }
.qscore { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.qscore input {
  width: 62px; padding: 4px 8px; border: 1px solid var(--line-strong);
  border-radius: 8px; text-align: center; font-weight: 700; background: var(--surface);
}
.qstem { margin: 10px 0 8px; white-space: pre-wrap; }
.qstem.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
/* 答题卡上的解答、作文可能很长：先折起来，点一下看全文 */
.ans-text { white-space: pre-wrap; }
.ans-text.clamped { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.ans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
@media (max-width: 640px) { .ans-grid { grid-template-columns: 1fr; } }
.ans-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 12px; font-size: 14px; }
.ans-box b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .5px; margin-bottom: 2px; }
.ans-box .wrong { color: var(--danger); }
.ans-box .right { color: var(--success); }
.reason { margin-top: 10px; font-size: 14px; color: var(--ink-2); background: var(--brand-softer); border-radius: var(--r-sm); padding: 9px 12px; }
.reason b { color: var(--brand-dark); }
.knows { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.know { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.qops { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ── 讲题对话 ─────────────────────────────────────────── */
.tutor-wrap { max-width: 860px; margin: 0 auto; padding-bottom: 170px; }
.tutor-head { position: sticky; top: 63px; z-index: 10; background: var(--bg); padding: 10px 0; }
.tutor-top { display: flex; align-items: center; gap: 12px; }
.tutor-top .qno { font-size: 17px; }
/* 大题名：英语卷子好几个大题都从第 1 题开始，光看题号分不清是哪一道 */
.qsec { font-size: 12.5px; color: var(--muted); max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg { display: flex; gap: 10px; margin: 16px 0; }
.msg .av {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; background: var(--surface-3); color: var(--ink-2);
}
.msg.teacher .av { background: var(--brand); color: #fff; }
.msg .bubble {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 16px; max-width: 82%; white-space: pre-wrap; box-shadow: var(--shadow-sm);
}
.msg.student { flex-direction: row-reverse; }
.msg.student .bubble { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.msg.teacher.speaking .bubble { box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-sm); }
/* 声音还在合成、第一个字还没出来：先给一个轻微呼吸的省略号，别让气泡空着 */
.msg .bubble .tts-wait { color: var(--muted); letter-spacing: 2px; animation: ttsPulse 1.1s ease-in-out infinite; }
@keyframes ttsPulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
/* 这题讲到这儿了：给一个明确的收尾，省得孩子还等着老师说下一句 */
.done-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 14px 0 4px; padding: 10px 14px;
  background: var(--brand-soft); border: 1px dashed var(--brand); border-radius: var(--r-md);
}
.done-bar .done-mark { font-weight: 700; color: var(--brand-dark); }
.done-bar .spacer { flex: 1; min-width: 8px; }
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  max-width: 860px; margin: 0 auto; padding: 14px 20px 18px;
  background: linear-gradient(transparent, var(--bg) 26%);
}
.mic {
  width: 62px; height: 62px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 24px; display: grid; place-items: center;
  box-shadow: var(--shadow-md); transition: .18s;
}
.mic.listening { background: var(--accent); animation: pulse 1.4s infinite; }
.mic.thinking { background: var(--muted); }
.mic.speaking { background: var(--ink); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(194,86,31,.45); } 50% { box-shadow: 0 0 0 16px rgba(194,86,31,0); } }
.dock .typebox { flex: 1; min-width: 0; display: flex; gap: 8px; }
.dock #draw-ask, .dock #explain-all { flex: none; white-space: nowrap; }
@media (max-width: 480px) {
  .dock { gap: 8px; padding: 12px 12px 16px; }
  .dock #draw-ask, .dock #explain-all { padding: 9px 11px; font-size: 12.5px; }
  .dock #explain-all .t { display: none; }   /* 手机上只留 📖，别把输入框挤没了 */
  .mic { width: 56px; height: 56px; }
}
.dock input {
  flex: 1; min-width: 0; padding: 11px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); outline: none;
}
.dock input:focus { border-color: var(--brand); }
.status-line { font-size: 13px; color: var(--muted); min-height: 20px; padding: 0 6px; }
.interim { color: var(--muted); font-style: italic; }

/* ── 错题本 / 报告 ─────────────────────────────────────── */
.filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; font-size: 13.5px;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.wrong-item { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.wrong-item:last-child { border-bottom: 0; }
.wrong-stem { white-space: pre-wrap; margin: 6px 0 10px; }
.mastered { opacity: .55; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 42px; margin-bottom: 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 760px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px;
}
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 28px; font-weight: 700; font-family: var(--serif); margin-top: 2px; }
.stat .v small { font-size: 13px; color: var(--muted); font-family: var(--font); font-weight: 500; }
.krow { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.krow:last-child { border-bottom: 0; }
.krow .name { width: 42%; font-size: 14px; }
.krow .track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.krow .track i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.krow .track i.low { background: var(--danger); }
.krow .pct { width: 58px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── 弹窗 / 提示 ─────────────────────────────────────── */
.modal-root:empty { display: none; }
.modal-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,18,14,.45);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--r-xl); padding: 26px; width: min(560px, 100%);
  box-shadow: var(--shadow-lg); max-height: 86vh; overflow: auto;
}
.modal h3 { font-size: 19px; margin-bottom: 6px; }
.modal p { color: var(--muted); font-size: 14px; }
.modal .ops { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--surface); padding: 11px 20px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 84vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.notice {
  background: var(--warn-soft); color: var(--warn); border-radius: var(--r-md);
  padding: 11px 16px; font-size: 13.5px; margin: 12px 0;
}
.notice.brand { display: block; background: var(--brand-soft); color: var(--brand-dark); }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
.small { font-size: 13px; color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.hidden { display: none !important; }
input[type=file] { display: none; }

/* ── 板书：讲题右侧的黑板 ─────────────────────────────── */
.view.wide { max-width: 1420px; }

.tutor-wrap.board-on {
  max-width: 1360px; margin: 0 auto; padding-bottom: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 46%);
  gap: 20px; align-items: start;
}
.tutor-main { min-width: 0; }
.tutor-wrap.board-on .tutor-main { padding-bottom: 10px; }
.tutor-wrap.board-on .dock {
  position: sticky; left: auto; right: auto; bottom: 0;
  max-width: none; margin: 8px 0 0; padding: 10px 0 16px;
  background: linear-gradient(transparent, var(--bg) 30%);
}

.board-panel {
  position: sticky; top: 76px; height: calc(100vh - 96px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.board-head {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); flex: none;
}
.board-name { font-family: var(--serif); font-size: 15.5px; font-weight: 700; color: var(--ink); }
.board-sub { margin-left: 2px; }
.orig-view {
  flex: 1 1 auto; min-height: 150px; display: flex; flex-direction: column;
  background: #f7f4ec;
}
.orig-tools {
  display: flex; align-items: center; gap: 4px; flex: none;
  padding: 3px 8px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.orig-scroll {
  flex: 1; min-height: 0; overflow: auto; padding: 6px;
  display: flex; align-items: flex-start; justify-content: flex-start;
}
.orig-scroll img { width: 100%; height: auto; max-width: none; display: block; }
.orig-view.zoomed .orig-scroll { align-items: flex-start; }

/* 认图：孩子在图上一个一个戳出字母点 */
.calib {
  flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--brand-soft); border-bottom: 1px solid var(--line);
  font-size: 13.5px; color: var(--brand-dark);
}
.calib-tip b { font-size: 17px; color: var(--brand); letter-spacing: 1px; }
.calib-ops { display: flex; gap: 6px; margin-left: auto; }
#board-panel.calib-on .orig-tools { background: var(--brand-soft); }
.orig-img.calib-img, .calib-on .fig-box { cursor: crosshair; }
.calib-on .orig-scroll { outline: 2px dashed var(--brand); outline-offset: -4px; }

/* 卷面原图 + 标在图上的东西：坐标按整页 0~1 换算，缩放到多大都对得上 */
.fig-box { position: relative; width: 100%; margin: 0 auto; flex: none; }
.fig-box img { width: 100%; height: auto; display: block; }
.fig-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.fig-layer .mk-ring { transform-box: fill-box; transform-origin: center; animation: mkPulse 1.05s ease-out 2; }
.fig-layer .mk-dot { transform-box: fill-box; transform-origin: center; animation: mkDot 2.6s ease-out forwards; }
.fig-layer .out { opacity: 0; transition: opacity .4s ease; }
@keyframes mkPulse {
  0% { transform: scale(.5); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scale(1.55); opacity: 0; }
}
@keyframes mkDot {
  0% { opacity: 0; transform: scale(.4); }
  18% { opacity: 1; transform: scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; }
}
.board-canvas-wrap { position: relative; flex: 1; min-height: 200px; }
.board-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.board-canvas-wrap canvas:active { cursor: grabbing; }
.board-empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 2px; color: var(--muted); pointer-events: none; text-align: center;
}
.board-empty b { font-family: var(--serif); font-size: 21px; color: var(--ink-2); letter-spacing: 1px; }
.board-empty span { font-size: 13px; }
#board-toggle.has-draw { border-color: var(--brand); color: var(--brand); }
#calib-start.want { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
#board-panel.calib-on #calib-start { display: none; }

.tutor-wrap.board-on.board-hidden { display: block; max-width: 860px; }
.tutor-wrap.board-on.board-hidden .board-panel { display: none; }

@media (max-width: 999px) {
  .tutor-wrap.board-on { display: block; max-width: 860px; }
  .board-panel {
    position: fixed; inset: 66px 10px 10px; height: auto; z-index: 45;
    display: none; box-shadow: var(--shadow-lg);
  }
  .tutor-wrap.board-on:not(.board-hidden) .board-panel { display: flex; }
}

/* ── 板书台 ───────────────────────────────────────────── */
.board-page { max-width: 1240px; margin: 0 auto; }
.scene-groups { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.scene-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scene-topic { font-size: 12px; letter-spacing: 1px; color: var(--muted); }
.scene-group .chip { padding: 5px 12px; font-size: 13px; }

.scene-stage { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.board-canvas-wrap.big {
  height: min(64vh, 640px); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.scene-side {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.scene-side h2 { font-size: 18px; margin-bottom: 6px; }
.scene-side .small { margin: 0 0 14px; line-height: 1.6; }
.scene-params { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.param { display: grid; grid-template-columns: 78px 1fr 44px; align-items: center; gap: 8px; font-size: 13px; }
.param-k { color: var(--ink-2); }
.param input[type="range"] { width: 100%; accent-color: var(--brand); }
.param-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--brand-dark); }
.scene-hud {
  font-size: 13.5px; line-height: 1.7; color: var(--ink-2);
  background: var(--brand-softer); border-radius: var(--r-sm);
  padding: 9px 12px; margin-bottom: 14px; min-height: 38px;
}
.scene-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.board-note { margin-top: 16px; }

@media (max-width: 900px) {
  .scene-stage { grid-template-columns: 1fr; }
  .board-canvas-wrap.big { height: 48vh; min-height: 300px; }
}

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .who { display: none; }
  .view { padding: 20px 14px 80px; }
}

@media (min-width: 1000px) {
  /* 整页不滚，聊天区自己滚：右边黑板连同标题栏一直留在视野里 */
  .view.tutor { padding-bottom: 0; }
  .tutor-wrap.board-on .tutor-main {
    display: flex; flex-direction: column;
    height: calc(100vh - 118px); min-height: 0;
  }
  .tutor-wrap.board-on #msgs {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .view.tutor .board-panel { height: calc(100vh - 118px); }
}

.board-close { display: none; }
@media (max-width: 999px) { .board-close { display: inline-flex; } }
