/* 诗中有你 · 统一样式。纯 CSS 自定义属性，无框架。
 * 原则：系统字体、留白、少边框、每屏一个主操作；动画只动 transform / opacity，200–350ms 临界阻尼。 */
:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #efede7;
  --surface-3: #e6e3db;
  --text: #1d1d1f;
  --text-2: #55555c;
  --text-3: #85858c;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.16);
  --accent: #2f5d8c;
  --accent-press: #254b72;
  --accent-soft: #e4edf6;
  --cinnabar: #b5402f;
  --ok: #2b7a4b;
  --ok-soft: #e3f2e8;
  --warn: #9a6210;
  --warn-soft: #fbf0dc;
  --err: #b3261e;
  --err-soft: #fbe8e6;
  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 22px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.09);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 280ms;
  --bar-h: 64px;
  --fs: 18px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans SC", system-ui, sans-serif;
  --font-poem: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --bar-bg: rgba(245, 244, 240, 0.72);
}
body.teacher { --fs: 16px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs); line-height: 1.5; letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; color: var(--text); }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: 18px; line-height: 1.3; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden], .hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 0.875em; }
.tiny { font-size: 13px; color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- 按钮 ---------- */
.btn, button {
  font: inherit; font-size: 0.94em; font-weight: 500; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 0;
  background: var(--surface-2); color: var(--text); cursor: pointer;
  transition: transform 100ms ease-out, background-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover, button:hover { background: var(--surface-3); }
.btn:active, button:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-press); }
.btn-lg { min-height: 56px; padding: 14px 28px; font-size: 1.05em; font-weight: 600; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 0.86em; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--err-soft); color: var(--err); }
.btn-danger:hover { background: #f6d6d2; }
.btn:disabled, button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ---------- 输入 ---------- */
input, select, textarea {
  font: inherit; font-size: 1em; color: var(--text);
  min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface);
  transition: border-color var(--dur) var(--ease);
}
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 0.86em; color: var(--text-2); font-weight: 500; }

/* ---------- 顶栏（半透明，内容在下面滚动） ---------- */
.bar {
  position: sticky; top: 0; z-index: 20; height: var(--bar-h);
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px;
  padding: 0 24px; background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--line);
}
.bar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bar-brand .logo {
  flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--cinnabar); color: #fff; font-family: var(--font-poem); font-size: 20px; font-weight: 700;
}
.bar-title { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }

/* ---------- 步骤条 ---------- */
.stepper { display: flex; align-items: center; gap: 4px; padding: 4px; background: rgba(0, 0, 0, 0.05); border-radius: 999px; }
.stepper button {
  min-height: 40px; padding: 6px 16px 6px 8px; background: transparent; color: var(--text-2);
  font-size: 16px; font-weight: 500; gap: 8px; white-space: nowrap;
}
.stepper button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.6); }
.stepper .num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-size: 14px; font-weight: 600;
}
.stepper button.done .num { background: var(--ok); color: #fff; }
.stepper button.current { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.stepper button.current .num { background: var(--accent); color: #fff; }
.stepper button:disabled { opacity: 0.45; }

/* ---------- 状态小标签 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.live::before { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.25; } }

/* ---------- 页面与分步 ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 8px 24px 64px; }
.page.narrow { max-width: 760px; }
.step { animation: stepIn var(--dur) var(--ease); }
@keyframes stepIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.step-head { display: flex; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin: 20px 0 20px; }
.step-head .titles { flex: 1; min-width: 260px; }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--cinnabar); letter-spacing: 0.02em; margin-bottom: 4px; }
.lead { color: var(--text-2); margin-top: 6px; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 14px; }
.section-title h2 { font-size: 20px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.callout { border-radius: var(--radius); padding: 16px 20px; background: var(--accent-soft); color: var(--text); }
.callout.warn { background: var(--warn-soft); }
.callout.err { background: var(--err-soft); }
.callout.ok { background: var(--ok-soft); }
.banner {
  position: sticky; top: var(--bar-h); z-index: 15; padding: 12px 24px; text-align: center;
  background: var(--warn-soft); color: var(--warn); font-weight: 600;
}
.empty { padding: 28px; text-align: center; color: var(--text-3); }

/* ---------- 可选卡片（诗、形象） ---------- */
.tile-grid > .empty, .class-list > .empty, .class-list > .card { grid-column: 1 / -1; }
.tile-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  min-height: 0; padding: 20px 22px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); color: var(--text); font-weight: 400; font-size: 1em; line-height: 1.45;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tile:hover { background: var(--surface); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.tile:active { transform: scale(0.98); }
.tile.selected { box-shadow: 0 0 0 3px var(--accent), var(--shadow-lift); }
.tile .tile-title { font-family: var(--font-poem); font-size: 26px; font-weight: 700; letter-spacing: 0.02em; }
.tile .tile-sub { color: var(--text-2); font-size: 16px; }
.tile .tile-line { font-family: var(--font-poem); color: var(--text-2); font-size: 18px; }
.tile .check-mark {
  position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; display: none; place-items: center; font-size: 16px; font-weight: 700;
}
.tile.selected .check-mark { display: grid; }

.avatar-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.avatar-tile { padding: 12px; align-items: stretch; }
.avatar-tile canvas, .avatar-tile img {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; background: var(--surface-2); display: block; object-fit: contain;
}
.avatar-tile .tile-name { font-weight: 600; font-size: 17px; padding: 4px 4px 0; }
.avatar-tile .tile-sub { padding: 0 4px 4px; font-size: 14px; }

/* 自己画诗人 */
.make-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 260px); gap: 24px; align-items: start; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 16px 0 20px; }
.job-box { border-radius: var(--radius); background: var(--surface-2); padding: 14px; min-height: 140px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; color: var(--text-2); }
.job-box img { width: 100%; max-width: 220px; aspect-ratio: 3 / 4; object-fit: contain; border-radius: 12px; background: var(--surface); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 学生描述 + 预览 */
.desc-foot { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; }
.desc-foot .tiny { margin-left: auto; flex: none; font-variant-numeric: tabular-nums; padding-top: 6px; }
.desc-foot .tiny.over { color: var(--warn); font-weight: 600; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 34px; padding: 5px 14px; border-radius: 999px; font-size: 15px; font-weight: 500; background: var(--accent-soft); color: var(--accent); }
.chip:hover { background: #d6e3f1; }
.draw-preview { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 15px; line-height: 1.5; }
.field-msg { margin-top: 8px; color: var(--warn); font-size: 15px; }
textarea.invalid { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.job-summary { font-family: var(--font-poem); color: var(--text); font-size: 17px; line-height: 1.45; }
.job-note { font-size: 14px; color: var(--warn); background: var(--warn-soft); padding: 8px 10px; border-radius: 10px; line-height: 1.45; }
.job-actions { width: 100%; gap: 8px; }
.job-actions .btn { width: 100%; }
.job-actions .btn:not(.btn-primary) { background: var(--surface); }
.avatar-tile { cursor: pointer; }
.avatar-tile.disabled { cursor: not-allowed; opacity: 0.5; transform: none; box-shadow: var(--shadow); }
.avatar-tile:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-lift); }
.tile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 4px; }
.tile-actions:empty { display: none; }
.tile-actions .btn { width: 100%; }

/* 自己画：画风选择 */
.style-field { margin-top: 14px; }
.style-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; max-width: 520px; }
.style-opt { flex-direction: column; gap: 6px; padding: 8px; min-height: 0; border-radius: 14px; background: var(--surface-2); font-size: 15px; font-weight: 500; }
.style-opt:hover { background: var(--surface-3); }
.style-opt.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); font-weight: 600; }
.style-thumb { display: block; width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; }
.style-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mine-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* 待机动画进度：看得见，但不挡路 */
.idle-status { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-size: 16px; animation: stepIn var(--dur) var(--ease); }
.idle-status .idle-text { font-weight: 600; }
.idle-status .tiny { color: var(--text-2); }
.idle-status .btn { margin-left: auto; }
.idle-status.tone-ok { background: var(--ok-soft); color: var(--ok); }
.idle-status.tone-warn { background: var(--warn-soft); color: var(--warn); }
.idle-status.compact { margin-top: 8px; padding: 8px 12px; font-size: 14px; justify-content: center; text-align: left; flex-wrap: nowrap; }
.idle-status.compact .idle-text { font-weight: 500; }
.idle-status.compact .btn { margin-left: 0; flex: none; white-space: nowrap; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; flex: none; }
.poem-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.next-bar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 28px; flex-wrap: wrap; }

/* ---------- 问诗人工作台：三栏不溢出 ---------- */
.workbench {
  display: grid; gap: 20px;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr) minmax(300px, 400px);
  height: calc(100dvh - var(--bar-h) - 124px); min-height: 500px;
}
.panel { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 18px; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.avatar-panel { align-items: center; justify-content: center; gap: 12px; text-align: center; }
/* 形象框不随文字/进度条变化而移动：画布固定 3:4、不伸缩；下方信息区固定高度，内容变化只在区内发生。 */
.avatar-panel canvas { flex: none; width: 100%; max-width: 260px; max-height: calc(100% - 156px); aspect-ratio: 3 / 4; object-fit: contain; border-radius: 16px; background: var(--surface-2); }
.avatar-info { flex: none; height: 140px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; overflow: hidden; }
.avatar-info .idle-status.compact { margin-top: 0; }
.avatar-video-source { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.state-line { font-size: 15px; color: var(--text-2); line-height: 21px; height: 21px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-line.speaking { color: var(--accent); font-weight: 600; }
.poem-panel { overflow: auto; }
.poem-title { font-family: var(--font-poem); font-size: 30px; font-weight: 700; letter-spacing: 0.04em; }
.poem-author { color: var(--text-2); margin: 4px 0 18px; }
.poem-line {
  font-family: var(--font-poem); font-size: 26px; line-height: 1.6; letter-spacing: 0.08em;
  padding: 4px 12px; margin: 2px -12px; border-radius: 10px;
  transition: background-color var(--dur) var(--ease);
}
.poem-line.focus { background: #f6e7c9; }
.ai-note { margin-top: auto; padding-top: 16px; font-size: 14px; color: var(--text-3); }

.chat-panel { gap: 12px; padding: 16px; }
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-head h2 { font-size: 20px; flex: 1; }
.chat { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; scroll-behavior: smooth; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; animation: msgIn 220ms var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.msg.note { align-self: center; font-size: 14px; color: var(--text-3); background: none; padding: 2px 8px; }
.chat-empty { margin: auto; text-align: center; color: var(--text-3); padding: 12px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.suggest button { min-height: 38px; padding: 6px 14px; font-size: 15px; background: var(--accent-soft); color: var(--accent); font-weight: 500; text-align: left; max-width: 100%; }
.suggest button:hover { background: #d6e3f1; }
.composer { display: flex; gap: 8px; align-items: center; }
.composer input { flex: 1; min-width: 0; }
.mic-btn { width: 100%; min-height: 52px; font-weight: 600; }
.mic-btn.rec { background: var(--err); color: #fff; }
.asr-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface-2); }

/* ---------- 做短片 ---------- */
.shot-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.shot { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.shot-title { font-weight: 600; font-size: 18px; padding: 0 4px; }
.shot-line { font-family: var(--font-poem); color: var(--text-2); font-size: 17px; padding: 0 4px; }
.opt-group { display: flex; flex-direction: column; gap: 6px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: var(--surface-2); font-size: 16px; line-height: 1.4;
  transition: box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.opt input { margin-top: 2px; flex: none; }
.opt:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.opt b { font-weight: 600; }
.opt-chosen { padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 16px; }
.narr { font-size: 15px; color: var(--text-2); padding: 0 4px; line-height: 1.5; }
.action-bar { display: flex; gap: 12px 16px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.action-bar .reason { flex: 1 1 320px; }
.stagebar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stage { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); font-size: 15px; font-weight: 500; }
.stage .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.stage.done { color: var(--ok); }
.stage.done .dot { background: var(--ok); }
.stage.now { color: var(--accent); background: var(--accent-soft); }
.stage.now .dot { background: var(--accent); animation: breathe 1.2s ease-in-out infinite; }
.works { display: grid; grid-template-columns: minmax(0, 720px) minmax(220px, 300px); gap: 20px; align-items: start; }
.work-list { display: flex; flex-direction: column; gap: 8px; }
.work-item { justify-content: flex-start; text-align: left; border-radius: 14px; padding: 12px 14px; background: var(--surface-2); width: 100%; }
.work-item.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.work-item .wi-sub { display: block; font-size: 13px; color: var(--text-3); font-weight: 400; }
.player { display: flex; flex-direction: column; gap: 12px; }
#lightCanvas, .player video { width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: #111; display: block; }
video { max-width: 100%; border-radius: 12px; background: #111; }

/* ---------- 提示条 / 面板 ---------- */
.toast-region { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto; padding: 12px 22px; border-radius: 14px; font-size: 16px; font-weight: 500;
  background: rgba(29, 29, 31, 0.92); color: #fff; box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(12px) scale(0.98);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { background: rgba(31, 98, 60, 0.95); }
.toast-warn { background: rgba(122, 78, 10, 0.95); }
.toast-err { background: rgba(160, 32, 26, 0.95); }
dialog.sheet { border: 0; padding: 0; border-radius: var(--radius-l); box-shadow: var(--shadow-lift); max-width: min(520px, calc(100vw - 32px)); width: 100%; color: var(--text); background: var(--surface); }
dialog.sheet[open] { animation: sheetIn var(--dur) var(--ease); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.32); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.sheet-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.sheet-title { font-size: 22px; }
.sheet-text { color: var(--text-2); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
dialog.sheet.wide { max-width: min(760px, calc(100vw - 32px)); }

details.disclosure { margin-top: 28px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
details.disclosure > summary {
  list-style: none; cursor: pointer; padding: 18px 22px; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "›"; display: inline-block; font-size: 22px; line-height: 1; color: var(--text-3); transition: transform var(--dur) var(--ease); }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure > .disclosure-body { padding: 0 22px 22px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- 入口页 ---------- */
.hero { text-align: center; margin: 56px 0 32px; }
.hero .logo-lg { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 20px; display: grid; place-items: center; background: var(--cinnabar); color: #fff; font-family: var(--font-poem); font-size: 40px; font-weight: 700; }
.hero h1 { font-size: 40px; }
.join-card { display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.join-card input { min-height: 60px; font-size: 22px; padding: 12px 18px; }
.join-card input#code { letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.flow div { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.flow b { display: block; font-size: 15px; color: var(--cinnabar); }
.footer-link { text-align: center; margin: 32px 0; font-size: 15px; }

/* ---------- 教师端 ---------- */
.login-card { max-width: 420px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 16px; padding: 32px; }
.class-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.class-item { align-items: stretch; gap: 10px; }
.class-item .ci-top { display: flex; align-items: center; gap: 10px; width: 100%; }
.class-item .ci-name { font-weight: 600; font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-item .ci-meta { color: var(--text-2); font-size: 14px; }
.class-item .ci-code { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; letter-spacing: 0.12em; }
.code-btn { background: var(--surface); box-shadow: var(--shadow); font-variant-numeric: tabular-nums; letter-spacing: 0.1em; font-size: 20px; font-weight: 700; min-height: 44px; padding: 6px 16px; }
.code-btn small { font-size: 12px; letter-spacing: 0; font-weight: 500; color: var(--text-2); }
.code-overlay { position: fixed; inset: 0; z-index: 200; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; cursor: pointer; animation: stepIn var(--dur) var(--ease); }
.code-overlay .big { font-size: min(22vw, 220px); font-weight: 700; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; line-height: 1; }
.code-overlay .hint { color: var(--text-2); font-size: 22px; }
.console { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 24px; align-items: start; }
.console-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--bar-h) + 16px); }
.console-side .card + .card { margin-top: 0; }
.group-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.gcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gcard-top { display: flex; gap: 12px; align-items: center; }
.gcard-thumb { width: 52px; height: 68px; flex: none; border-radius: 10px; background: var(--surface-2); object-fit: cover; }
.gcard-name { font-weight: 600; font-size: 18px; }
.gcard-poem { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.gcard-film { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.gcard-film .btn, .film .btn { white-space: nowrap; flex: none; }
.film-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.film { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.film video { aspect-ratio: 16 / 9; }
.film.is-hidden { opacity: 0.55; }
.film-head { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.film-head b { flex: 1 1 auto; min-width: 0; }
.side-card h3 { margin-bottom: 10px; }
.sp-list { display: flex; flex-direction: column; }
.sp-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.sp-item:first-child { border-top: 0; padding-top: 0; }
.meter { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; display: flex; margin: 10px 0 6px; }
.meter .spent { background: var(--cinnabar); transition: width var(--dur) var(--ease); }
.meter .reserved { background: #d9a441; transition: width var(--dur) var(--ease); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 3px 0; color: var(--text-2); }
.kv b { color: var(--text); font-weight: 600; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 12px; width: 100%; }
.seg button { flex: 1; min-height: 36px; border-radius: 9px; background: transparent; font-size: 14px; padding: 6px 10px; }
.seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { color: var(--text-3); font-weight: 500; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.fault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; font-size: 14px; }
.fault-grid input[type="number"] { width: 80px; min-height: 36px; padding: 4px 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }


/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .console { grid-template-columns: minmax(0, 1fr) minmax(260px, 300px); gap: 16px; }
  .group-grid, .film-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 1000px) {
  .console { grid-template-columns: minmax(0, 1fr); }
  .console-side { order: -1; position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
}
@media (max-width: 1180px) {
  .bar { padding: 0 16px; gap: 10px; }
  .stepper button { padding: 6px 12px 6px 6px; font-size: 15px; }
  body.teacher .bar-end .btn { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 760px) {
  .bar { grid-template-columns: minmax(0, 1fr) auto; height: auto; min-height: var(--bar-h); padding: 8px 16px; row-gap: 8px; }
  .bar .stepper, .bar #barCenter { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .banner { top: 0; position: relative; }
}
@media (max-width: 1023px) {
  .workbench { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .avatar-panel { flex-direction: row; text-align: left; align-items: center; justify-content: flex-start; }
  .avatar-panel canvas { width: 160px; max-height: none; }
  .avatar-info { flex: 1; min-width: 0; align-items: flex-start; }
  .chat-panel { height: 70vh; min-height: 420px; }
  .make-card, .works { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 8px 16px 48px; }
}
@media (max-width: 640px) {
  .stepper button { padding: 6px 10px 6px 6px; font-size: 14px; }
  .stepper .label { display: none; }
  .stepper button.current .label { display: inline; }
  h1 { font-size: 26px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .bar-end .hide-sm { display: none; }
}

/* ---------- 无障碍偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-property: opacity !important; transition-duration: 150ms !important; scroll-behavior: auto !important; }
  .btn:active, button:active, .tile:active, .tile:hover { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --bar-bg: #f5f4f0; }
  .bar { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --text-2: #303036; --text-3: #4a4a50; --line: rgba(0, 0, 0, 0.3); }
  .card, .tile, .panel, .shot, .gcard, .film, details.disclosure, .stepper button.current { box-shadow: none; border: 1px solid #000; }
  .btn, button { border: 1px solid currentColor; }
}

/* 会动 / 静态 标签：叠在形象左上角，不占布局 */
.avatar-panel { position: relative; }
.motion-badge {
  position: absolute; top: 18px; left: 18px; z-index: 2; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.5; pointer-events: none;
  background: rgba(255, 255, 255, 0.85); color: var(--text-2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.motion-badge.moving { background: var(--ok-soft); color: var(--ok); }
.motion-badge.nolip { background: var(--warn-soft); color: var(--warn); }
/* 问诗人页：不张嘴的提示与“重做一次”（在固定高度的信息区里） */
.motion-note { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; font-size: 13px; line-height: 1.4; color: var(--text-2); text-align: center; }
.motion-note .btn { min-height: 30px; padding: 4px 12px; font-size: 13px; }
.tile-actions .btn-redo { font-size: 13px; padding: 6px 10px; white-space: normal; line-height: 1.25; }
@media (prefers-reduced-transparency: reduce) { .motion-badge { background: var(--surface); } }
