:root {
  --ink: #1f2a44;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --course: #2563eb;
  --good: #16a34a;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: #f1f5f9; padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hint { color: var(--muted); margin: 6px 0; font-size: 0.95rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 10px; font-size: 0.95rem; cursor: pointer; text-decoration: none; font-weight: 600; transition: transform 0.08s, background 0.15s; }
.btn:hover { background: #f8fafc; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--course); border-color: var(--course); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.accent { background: #fef3c7; border-color: #fcd34d; }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }
.btn.big { padding: 14px 28px; font-size: 1.15rem; }
.btn.wide { width: 100%; justify-content: center; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-weight: 600; }
.tag.warn { background: #fef3c7; color: #92400e; }

/* ---------- home ---------- */
.home { max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }
.home-hero { padding: 28px 0 20px; }
.brand { font-weight: 800; letter-spacing: 0.08em; color: #2563eb; font-size: 0.9rem; }
.home-hero h1 { font-size: 2.3rem; margin: 8px 0; }
.home-hero p { font-size: 1.08rem; color: #334155; max-width: 760px; line-height: 1.7; }
.status-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 0.85rem; }
.pill.on { border-color: #86efac; background: #f0fdf4; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-top: 20px; }
.course-card { background: var(--card); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); border-top: 6px solid var(--course); display: flex; flex-direction: column; gap: 10px; }
.cc-top { display: flex; justify-content: space-between; align-items: center; }
.cc-emoji { font-size: 2.4rem; }
.cc-grade { font-size: 0.85rem; color: var(--muted); }
.course-card h2 { margin: 0; font-size: 1.3rem; }
.cc-theme { margin: 0; color: #475569; line-height: 1.6; min-height: 3.2em; }
.cc-flow { display: flex; gap: 3px; height: 10px; }
.cc-seg { border-radius: 4px; }
.cc-meta { font-size: 0.85rem; color: var(--muted); }
.cc-actions { display: flex; gap: 10px; margin-top: auto; }
.legend { margin-top: 36px; background: #fff; border-radius: var(--radius); padding: 18px 22px; }
.legend h3 { margin: 0 0 8px; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-item { display: inline-flex; gap: 6px; align-items: center; }
.legend-item i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---------- course page ---------- */
.course-page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.cp-head { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; }
.cp-head h1 { margin: 4px 0; }
.cp-grade { color: var(--course); font-weight: 700; }
.cp-actions { display: flex; flex-direction: column; gap: 8px; }
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin: 18px 0; }
.tab { padding: 10px 16px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--course); border-color: var(--course); }
.cp-body h2 { margin-top: 26px; }
.qa-card { background: #fff; border-radius: var(--radius); padding: 16px 20px; margin: 12px 0; box-shadow: var(--shadow); }
.qa-card.excluded { opacity: 0.65; }
.qa-head { display: flex; gap: 10px; align-items: center; }
.qa-q { margin: 10px 0; line-height: 1.8; }
.qa-ans { margin-bottom: 6px; }
.qa-uses { margin: 8px 0; padding-left: 22px; line-height: 2; }
.qa-uses li .kp-chip { margin-right: 8px; }
.qa-flow { margin-top: 8px; background: #f8fafc; padding: 8px 12px; border-radius: 10px; font-size: 0.92rem; }
.qa-wrong ul { line-height: 1.9; }
.seg-link { font-weight: 700; color: var(--course); }
.kp-chip { display: inline-block; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; border-radius: 999px; padding: 1px 9px; font-size: 0.8rem; font-weight: 600; margin: 1px 3px; white-space: nowrap; }
.kp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.kp-card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: relative; }
.kp-card h3 { margin: 4px 0 8px; }
.kp-card p { margin: 6px 0; line-height: 1.6; }
.kp-id { position: absolute; top: 12px; right: 14px; font-weight: 800; color: var(--course); font-size: 1.3rem; opacity: 0.6; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; position: sticky; top: 0; background: var(--bg); padding: 10px 0; z-index: 5; }
.toc-item { border-left: 4px solid var(--k); background: #fff; padding: 6px 10px; border-radius: 8px; text-decoration: none; font-size: 0.88rem; }
.seg-card { background: #fff; border-radius: var(--radius); padding: 18px 20px; margin: 16px 0; box-shadow: var(--shadow); border-left: 6px solid var(--k); }
.seg-card header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg-card header h2 { margin: 0; font-size: 1.2rem; }
.seg-card header .btn { margin-left: auto; }
.seg-obj { margin: 10px 0; background: #f8fafc; padding: 10px 12px; border-radius: 10px; line-height: 1.6; }
.seg-obj .feyn { float: right; color: var(--muted); font-size: 0.85rem; }
.seg-card details { margin-top: 10px; }
.seg-card summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
table.narr { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.narr th, table.narr td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: top; text-align: left; }
table.narr th { background: #f8fafc; }
td.nid { color: var(--muted); font-family: ui-monospace, monospace; font-size: 0.78rem; white-space: nowrap; }
td.acts { width: 42%; }
.act { margin: 2px 0; }
.cp-inline { margin-top: 4px; font-size: 0.85rem; color: #9333ea; }
ol.sol li { margin: 6px 0; }
.check { margin-left: 8px; color: #0f766e; }
.ix-sum { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.ix-sum-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.params { background: #0f172a; color: #e2e8f0; padding: 8px 10px; border-radius: 8px; font-size: 0.78rem; white-space: pre-wrap; word-break: break-all; }
.ix-sample { background: #fffbeb; padding: 8px 12px; border-radius: 8px; margin-top: 6px; }
dl.faq dt { font-weight: 700; margin-top: 8px; color: #1e40af; }
dl.faq dd { margin: 2px 0 0 0; }
.persona-card { background: #fff; border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow); max-width: 760px; line-height: 1.7; }

/* ---------- classroom ---------- */
.classroom { height: 100vh; display: grid; grid-template-rows: auto auto 1fr; overflow: hidden; background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 160px); }
.cr-top { display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.cr-title { font-weight: 800; font-size: 1.1rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-emoji { margin-right: 6px; }
.cr-tools { display: flex; gap: 8px; align-items: center; }
.mode-sel { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: #fff; font-size: 0.85rem; }
.timeline { display: flex; gap: 4px; padding: 0 18px 10px; }
.tl-chip { border: none; background: #fff; border-bottom: 4px solid var(--k); border-radius: 8px; padding: 5px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; opacity: 0.7; }
.tl-chip.current { opacity: 1; background: var(--k); color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15); }
.tl-chip.done { opacity: 1; }
.tl-chip.done:not(.current) .tl-id::after { content: " ✓"; color: var(--good); }
.tl-id { font-weight: 800; font-size: 0.8rem; }
.tl-kind { font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cr-body { display: grid; grid-template-columns: 1fr 360px; gap: 16px; padding: 0 18px 16px; min-height: 0; }
.stage { display: flex; flex-direction: column; min-height: 0; background: #fff; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.seg-head { display: flex; gap: 10px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.kind-badge { color: #fff; font-weight: 700; font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; }
.seg-title { font-weight: 800; font-size: 1.05rem; }
.seg-feyn { margin-left: auto; color: var(--muted); font-size: 0.82rem; }
.board-wrap { position: relative; flex: 1; min-height: 0; }
.board { position: absolute; inset: 0; overflow-y: auto; padding: 22px 30px 40px; background: radial-gradient(#e2e8f0 1px, transparent 1px) 0 0 / 22px 22px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.board-item.enter { animation: pop 0.45s ease-out; }
.board-item.update { animation: flash 0.5s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes flash { from { filter: brightness(1.15); } to { filter: none; } }
.board h2 { margin: 0; font-size: 1.5rem; }
.board p { margin: 0; font-size: 1.15rem; line-height: 1.7; background: rgba(255, 255, 255, 0.85); padding: 2px 6px; border-radius: 6px; }
.math-line { font-size: 1.35rem; background: #fff; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); align-self: center; }
.step-box { display: flex; gap: 12px; align-items: center; background: #fff; border: 2px solid #c7d2fe; border-radius: 12px; padding: 10px 14px; font-size: 1.15rem; flex-wrap: wrap; }
.step-n { background: #4f46e5; color: #fff; font-size: 0.8rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.step-note { color: var(--muted); font-size: 0.92rem; width: 100%; }
.note { padding: 10px 14px; border-radius: 12px; font-size: 1.05rem; line-height: 1.6; max-width: 100%; }
.note-tip { background: #fefce8; border: 1px solid #fde68a; }
.note-warn { background: #fef2f2; border: 1px solid #fecaca; }
.note-kp { background: #eff6ff; border: 2px solid #93c5fd; font-weight: 700; }
.scene { display: flex; gap: 16px; align-items: center; background: #fff; border-radius: 16px; padding: 14px 20px; box-shadow: var(--shadow); }
.scene-emoji { font-size: 3.4rem; }
.scene-text { font-size: 1.15rem; line-height: 1.6; }
.board-fig { margin: 0; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06); align-self: center; }
.board-fig figcaption { text-align: center; color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.seg-progress { height: 5px; background: var(--line); }
.seg-progress .bar { height: 100%; width: 0; background: var(--course); transition: width 0.4s; }

/* SVG */
.viz { display: block; max-width: 100%; height: auto; }
.viz-label { font-size: 14px; fill: var(--ink); font-weight: 600; }
.viz-label.small { font-size: 12px; }
.viz-label.warn { fill: var(--bad); }
.viz-big { font-size: 26px; font-weight: 800; fill: var(--ink); }
.tick { font-size: 11px; fill: var(--muted); }
.tok-text { font-size: 10px; fill: #fff; font-weight: 700; }
.clickable { cursor: pointer; }
.pie path.clickable:hover { filter: brightness(0.94); }

/* overlays */
.ix-host { position: absolute; inset: 0; background: #f4f6fb; overflow-y: auto; padding: 18px 22px; display: none; z-index: 3; }
.ix-host.show { display: block; animation: pop 0.3s ease-out; }
.cp-host { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(560px, 92%); display: none; z-index: 4; }
.cp-host.show { display: block; animation: pop 0.3s ease-out; }
.cp-card { background: #fff; border: 2px solid #c084fc; border-radius: 16px; padding: 14px 16px; box-shadow: 0 12px 34px rgba(88, 28, 135, 0.18); }
.cp-tag { font-size: 0.8rem; font-weight: 700; color: #9333ea; }
.cp-q { font-size: 1.1rem; margin: 6px 0 10px; font-weight: 700; }
.gate { max-width: 520px; margin: 8vh auto; text-align: center; background: #fff; border-radius: 20px; padding: 30px; box-shadow: var(--shadow); }
.gate-emoji { font-size: 4rem; }
.gate h2 { margin: 8px 0; }

/* interaction card */
.ix-card { background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); max-width: 980px; margin: 0 auto; }
.small-card { max-width: 420px; margin-top: 12vh; text-align: center; }
.ix-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ix-icon { font-size: 1.6rem; }
.ix-tag { background: var(--course); color: #fff; font-weight: 700; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; }
.ix-head h3 { margin: 0; font-size: 1.15rem; }
.ix-prompt { margin: 10px 0; font-size: 1.08rem; line-height: 1.7; }
.ix-body { margin-top: 6px; }
.ix-feedback { display: none; margin-top: 12px; padding: 10px 14px; border-radius: 12px; line-height: 1.6; }
.ix-feedback.show { display: block; animation: pop 0.25s; }
.ix-feedback.good { background: #f0fdf4; border: 1px solid #86efac; }
.ix-feedback.bad { background: #fef2f2; border: 1px solid #fecaca; }
.ix-feedback.info { background: #eff6ff; border: 1px solid #bfdbfe; }
.ix-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.ix-figure { display: flex; justify-content: center; margin: 8px 0; }
.readout { text-align: center; font-size: 1.05rem; margin: 6px 0 10px; line-height: 1.9; }
.readout.warn { color: var(--bad); }
.good-tag { background: #dcfce7; color: #166534; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; }
.warn-tag { background: #fee2e2; color: #991b1b; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; }
b.good { color: var(--good); }
b.bad { color: var(--bad); }
.choices { display: grid; gap: 8px; }
.choices.compact { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choice { display: flex; align-items: center; gap: 10px; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; font-size: 1.02rem; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.choice:hover:not(:disabled) { border-color: var(--course); }
.choice.picked { border-color: var(--course); background: #eff6ff; }
.choice.right { border-color: var(--good); background: #f0fdf4; }
.choice.wrong { border-color: var(--bad); background: #fef2f2; animation: shake 0.3s; }
.choice-key { width: 26px; height: 26px; border-radius: 50%; background: #f1f5f9; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.ans-row { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.ans-input { border: 2px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 1.05rem; width: 180px; }
.ans-input:focus { outline: none; border-color: var(--course); }
.slider-row { display: grid; grid-template-columns: 170px 1fr 60px; gap: 12px; align-items: center; margin: 8px auto; max-width: 620px; }
.slider { width: 100%; accent-color: var(--course); height: 28px; }
.slider-val { font-weight: 800; font-size: 1.05rem; text-align: right; }
.stage-box { margin: 6px 0; }
.stepper { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 8px 0; }
.stepper-val { min-width: 28px; text-align: center; font-size: 1.2rem; }
.derivation { font-size: 1.12rem; line-height: 1.6; padding-left: 26px; }
.derivation li { padding: 8px 12px; margin: 6px 0; border-radius: 10px; border: 2px solid transparent; }
.derivation li:hover { background: #f8fafc; }
.derivation li.circled { border-color: var(--bad); border-radius: 40px; background: #fef2f2; }
.derivation li.nope { background: #f1f5f9; }
.deriv-note { color: var(--muted); font-size: 0.9rem; margin-left: 10px; }

/* handwrite */
.hw-layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.hw-problem { background: #fffbeb; border: 1px solid #fde68a; padding: 10px 14px; border-radius: 12px; line-height: 1.7; margin-bottom: 10px; }
.hw-problem .tag { margin-right: 6px; }
.hw-canvas-wrap { border: 2px solid #e7e5d8; border-radius: 12px; overflow: hidden; }
.hw-canvas { width: 100%; display: block; touch-action: none; cursor: crosshair; }
.hw-tools { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.hw-steps-title { font-weight: 800; margin-bottom: 6px; }
.hw-steps { padding-left: 0; list-style: none; margin: 0; }
.hw-step { border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; transition: opacity 0.2s; }
.hw-step.locked { opacity: 0.4; }
.hw-step.current { border-color: var(--course); }
.hw-step.right { border-color: var(--good); background: #f0fdf4; }
.hw-step.wrong, .hw-step.circled { border-color: var(--bad); background: #fef2f2; border-radius: 26px; }
.hw-step-label { font-size: 0.92rem; margin-bottom: 6px; }
.hw-step-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hw-step-row .ans-input { width: 130px; padding: 6px 10px; }
.hw-status { font-weight: 800; font-size: 1.2rem; }
.hw-step.right .hw-status { color: var(--good); }
.hw-step.wrong .hw-status { color: var(--bad); }
.hw-hint { display: none; margin-top: 6px; background: #fefce8; padding: 6px 10px; border-radius: 8px; font-size: 0.92rem; }
.hw-hint.show { display: block; }

/* teach */
.teach-layout { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
.teach-chat { background: #f8fafc; border-radius: 12px; padding: 10px; height: 260px; overflow-y: auto; }
.tc-msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; margin: 6px 0; line-height: 1.6; }
.tc-msg.ai { background: #fff; border: 1px solid var(--line); }
.tc-msg.me { background: var(--course); color: #fff; margin-left: auto; }
.tc-who { font-size: 0.72rem; opacity: 0.7; margin-bottom: 2px; }
.teach-row { margin-top: 8px; display: grid; gap: 8px; }
.teach-input { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 10px; font-size: 1rem; font-family: inherit; resize: vertical; }
.rubric-box { background: #fdf2f8; border-radius: 12px; padding: 12px; }
.rb-title { font-weight: 800; margin-bottom: 6px; }
.rubric { list-style: none; padding: 0; margin: 0; }
.rubric li { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #fbcfe8; font-size: 0.92rem; color: var(--muted); }
.rubric li.ok { color: var(--ink); }
.rb-mark { font-weight: 800; }
.rubric li.ok .rb-mark { color: var(--good); }
.mic-btn.rec { background: #fee2e2; border-color: #fca5a5; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.15); } }

/* teacher column */
.teacher { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.teacher-card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 12px; text-align: center; }
.teacher-name { font-weight: 800; margin-top: 4px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.llm-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-weight: 600; }
.llm-badge.on { background: #dcfce7; color: #166534; }
.avatar { width: 200px; margin: 0 auto; }
.avatar-svg { width: 100%; display: block; }
.avatar .av-head { transform-origin: 100px 150px; animation: bob 4s ease-in-out infinite; }
.avatar[data-state="talking"] .av-head { animation: talkbob 0.9s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(2px) rotate(-1deg); } }
@keyframes talkbob { 25% { transform: rotate(1.5deg); } 75% { transform: rotate(-1.5deg) translateY(1px); } }
.avatar.blink .eye { transform: scaleY(0.1); transform-box: fill-box; transform-origin: center; }
.avatar .happy-eyes { display: none; }
.avatar.emote-happy .eye { display: none; }
.avatar.emote-happy .happy-eyes { display: inline; }
.avatar.emote-curious .brow-r { transform: translateY(-5px); }
.avatar .av-think, .avatar .av-listen { display: none; }
.avatar[data-state="thinking"] .av-think { display: inline; fill: #94a3b8; animation: think 1.2s infinite; }
.avatar[data-state="listening"] .av-listen { display: inline; animation: think 1s infinite; }
@keyframes think { 50% { opacity: 0.35; } }
.subtitle { background: #fff; border-radius: 16px; padding: 12px 16px; font-size: 1.08rem; line-height: 1.7; box-shadow: var(--shadow); min-height: 72px; position: relative; }
.subtitle::before { content: ""; position: absolute; top: -8px; left: 50%; border: 8px solid transparent; border-top: 0; border-bottom-color: #fff; transform: translateX(-50%); }
.subtitle.aside { background: #faf5ff; }
.controls { display: flex; justify-content: center; gap: 10px; }
.ctl { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 1.1rem; cursor: pointer; }
.ctl.play { width: 56px; height: 56px; background: var(--course); color: #fff; border: none; font-size: 1.3rem; }
.ask-big { border: none; border-radius: 14px; padding: 14px; font-size: 1.1rem; font-weight: 800; background: linear-gradient(135deg, #f97316, #ef4444); color: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(239, 68, 68, 0.3); }
.ask-big.hide { display: none; }
.ask-panel { display: none; background: #fff; border-radius: 16px; padding: 12px; box-shadow: var(--shadow); border: 2px solid #fdba74; flex-direction: column; gap: 8px; }
.ask-panel.show { display: flex; animation: pop 0.25s; }
.ask-title { font-weight: 800; display: flex; justify-content: space-between; }
.ask-where { font-weight: 600; font-size: 0.78rem; color: var(--muted); }
.chat-log { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.msg { padding: 8px 11px; border-radius: 12px; line-height: 1.6; font-size: 0.95rem; max-width: 92%; }
.msg.ai { background: #f1f5f9; }
.msg.me { background: #fff7ed; border: 1px solid #fed7aa; align-self: flex-end; }
.msg-src { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid #fed7aa; background: #fffbeb; border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; cursor: pointer; }
.ask-row { display: flex; gap: 6px; }
.ask-input { flex: 1; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 0.95rem; min-width: 0; }

/* state panel */
.state-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 320px; background: #fff; box-shadow: -10px 0 30px rgba(15, 23, 42, 0.12); padding: 16px; overflow-y: auto; transform: translateX(105%); transition: transform 0.25s; z-index: 20; }
.state-panel.show { transform: none; }
.sp-head { display: flex; justify-content: space-between; align-items: center; }
.sp-sec { font-weight: 800; margin: 14px 0 6px; font-size: 0.9rem; color: #334155; }
.mastery { display: grid; grid-template-columns: 1fr 90px 40px; gap: 6px; align-items: center; font-size: 0.82rem; margin: 4px 0; }
.m-bar { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.m-bar i { display: block; height: 100%; }
.m-val { text-align: right; font-weight: 700; }
.sp-list { padding-left: 18px; font-size: 0.85rem; margin: 0; line-height: 1.7; }

/* summary */
.summary { max-width: 780px; margin: 0 auto; background: #fff; border-radius: 18px; padding: 24px 28px; box-shadow: var(--shadow); }
.sum-kps { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.sum-kp { background: #f8fafc; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.sum-kp span { font-size: 1.3rem; font-weight: 800; color: var(--course); }

@media (max-width: 1000px) {
  .classroom { height: auto; min-height: 100vh; overflow: visible; }
  .cr-body { grid-template-columns: 1fr; }
  .stage { min-height: 70vh; }
  .teacher { order: -1; }
  .avatar { width: 140px; }
  .hw-layout, .teach-layout { grid-template-columns: 1fr; }
  .cp-head { grid-template-columns: 1fr; }
  .tl-kind { display: none; }
}
