/* ===========================================================================
   Math-Master web — 手機優先、零依賴、支援深色模式與列印
   顏色一律走 CSS 變數，深色模式只重新定義變數，不重寫版面。
   =========================================================================== */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #d9e0ea;
  --border-strong: #b9c4d3;
  --text: #17202e;
  --muted: #5d6b80;
  --accent: #1f6feb;
  --accent-soft: #e5eeff;
  --accent-ink: #ffffff;
  --ok: #1a8a54;
  --ok-soft: #e2f5ec;
  --bad: #c62b3d;
  --bad-soft: #fdeaec;
  --warn: #9a6400;
  --warn-soft: #fff3da;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 6px 18px rgba(20, 30, 50, .06);
  --radius: 14px;
  --radius-sm: 10px;
  /* 圖形一律畫在淺色底板上：引擎輸出的 SVG 用的是印刷用深色線條，
     直接放到深色背景上會看不見。 */
  --figure-bg: #ffffff;
  --figure-shade: none;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --surface: #1a202a;
    --surface-2: #222a36;
    --border: #2d3745;
    --border-strong: #3d4a5c;
    --text: #e8edf5;
    --muted: #9dabbf;
    --accent: #5c9bff;
    --accent-soft: #1d2b44;
    --accent-ink: #0b1220;
    --ok: #55d29b;
    --ok-soft: #14301f;
    --bad: #ff8a94;
    --bad-soft: #3a1a1f;
    --warn: #ffc866;
    --warn-soft: #3a2c12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .35);
    --figure-bg: #e9eef6;
    --figure-shade: saturate(.95);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
               system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.06rem; letter-spacing: .01em; }
h3 { font-size: .98rem; }
p { margin: 0 0 .7em; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--muted); }
.small { font-size: .84rem; }
.strong { font-weight: 700; }
.center { text-align: center; }
.wide { width: 100%; }

/* ------------------------------------------------------------------ 版面 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--gutter);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-home {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 2px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.logo {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 17px;
}

.brand { font-weight: 700; letter-spacing: .02em; }
.topbar-ctx { margin-left: auto; color: var(--muted); font-size: .84rem; text-align: right; }

#app {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px var(--gutter) 40px;
}

.footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px var(--gutter) 32px;
}

.view { display: block; }
[hidden] { display: none !important; }

.hero { padding: 6px 2px 14px; }
.hero h1 { margin-bottom: .2em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 0 14px;
}

.card > h2:first-child { margin-top: 0; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}
.row .btn { flex: 1 1 auto; }

/* ------------------------------------------------------------------ 按鈕 */

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.big { width: 100%; font-size: 1.05rem; padding: 15px; margin-bottom: 14px; }
.btn.small { min-height: 38px; padding: 7px 12px; font-size: .86rem; font-weight: 600; }

/* --------------------------------------------------- 晶片 / 分段控制 */

.chipbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .86rem;
  line-height: 1.3;
  padding: 8px 11px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 38px;
  text-align: left;
}
.chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chip .code { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip.preset { font-weight: 600; }

.gradegroup {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  margin: 0 0 8px;
  background: var(--surface);
}
.gradegroup > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  padding: 8px 2px;
  min-height: 38px;
  display: flex;
  align-items: center;
}
.gradegroup > summary::-webkit-details-marker { display: none; }
.gradegroup > summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--muted);
  font-size: .8rem;
}
.gradegroup[open] > summary::after { content: '▴'; }
.gradegroup > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.scope-group { margin: 0 0 12px; }
.scope-group h3 { font-size: .82rem; color: var(--muted); font-weight: 700; margin: 0 0 6px; }
.scope-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.seg {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 14px;
}
.seg-btn {
  flex: 1;
  appearance: none;
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 11px 6px;
  min-height: 44px;
  cursor: pointer;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn.is-on { background: var(--accent); color: var(--accent-ink); }
.seg-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* ------------------------------------------------------------------ 作答 */

.quizbar { margin-bottom: 12px; }
.quizbar-row { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.quizbar-row .strong { flex: 0 0 auto; white-space: nowrap; }
.quizbar-row .muted { flex: 1 1 auto; min-width: 0; margin-left: auto; text-align: right; overflow-wrap: anywhere; }

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .25s ease; }

.dots { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.dot {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
}
.dot.answered { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.dot.current { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 卡片是程式設定焦點的目標，不該畫出焦點框；真的用鍵盤走過來時才畫 */
#quiz-card:focus { outline: none; }
#quiz-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* 題組情境：和小題的題幹視覺上分開，學生才知道「這段是背景、下面才是問題」 */
.stimulus {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  margin: 0 0 14px;
}
.stimulus-tag {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 6px;
}
.stimulus-text {
  margin: 0;
  font-size: .96rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.stimulus .figure { margin: 10px 0 0; }

.question .stem {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.7;
  overflow-wrap: anywhere;
  margin-bottom: 14px;
}

.figure {
  background: var(--figure-bg);
  filter: var(--figure-shade);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 0 0 14px;
  overflow-x: auto;
}
.figure svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }

.options { display: grid; gap: 9px; }

.opt {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 52px;
  transition: background .12s ease, border-color .12s ease;
}
.opt:hover { background: var(--surface-2); }
.opt:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.opt.is-on { background: var(--accent-soft); border-color: var(--accent); }
.opt.right { background: var(--ok-soft); border-color: var(--ok); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); }
/* 檢討模式的選項只是展示，不再是可按的東西 —— 但仍要保持完全可讀 */
.opt[disabled] { cursor: default; opacity: 1; }
.opt[disabled]:hover { background: var(--surface); }
.opt.right[disabled]:hover { background: var(--ok-soft); }
.opt.wrong[disabled]:hover { background: var(--bad-soft); }

.opt-key {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: .9rem;
}
.opt.is-on .opt-key { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt.right .opt-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong .opt-key { background: var(--bad); border-color: var(--bad); color: #fff; }

.opt-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.opt-body .osvg {
  background: var(--figure-bg);
  filter: var(--figure-shade);
  border-radius: 6px;
  padding: 4px;
  display: inline-block;
}
.opt-body .osvg svg { display: block; max-width: 100%; height: auto; max-height: 110px; width: auto; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 62%, transparent);
  padding: 10px 0 8px;
  margin: 14px 0 0;
}

/* ------------------------------------------------------------------ 結果 */

.score {
  display: flex;
  align-items: center;
  gap: 18px;
}
.score-num { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.score-num small { font-size: 1rem; font-weight: 600; color: var(--muted); }

.ring {
  --p: 0;
  flex: 0 0 auto;
  width: 84px; height: 84px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0);
}
.ring > span {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.meter { margin: 9px 0; }
.meter-top { display: flex; gap: 8px; align-items: baseline; font-size: .9rem; }
.meter-top .t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.meter-top .v { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-bar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 4px; }
.meter-bar > i { display: block; height: 100%; background: var(--accent); }
.meter.lo .meter-bar > i { background: var(--bad); }
.meter.mid .meter-bar > i { background: var(--warn); }
.meter.hi .meter-bar > i { background: var(--ok); }

.weak {
  border: 1px solid var(--border);
  border-left: 4px solid var(--bad);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 13px;
  margin: 0 0 12px;
}
.weak.habit { border-left-color: var(--warn); }
.weak.watch { border-left-color: var(--border-strong); }
.weak h3 { margin-bottom: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.weak dl { margin: 10px 0 0; }
.weak dt { font-size: .8rem; color: var(--muted); font-weight: 700; margin-top: 8px; }
.weak dd { margin: 2px 0 0; font-size: .92rem; }

.badge {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.bad { background: var(--bad-soft); border-color: var(--bad); }
.badge.ok { background: var(--ok-soft); border-color: var(--ok); }
.badge.warn { background: var(--warn-soft); border-color: var(--warn); }

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--muted);
  text-align: center;
  font-size: .92rem;
}

/* 逐題檢討 */
.review { border-top: 1px solid var(--border); }
.review:first-of-type { border-top: 0; }

.review > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 2px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.review > summary::-webkit-details-marker { display: none; }
.review > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.review .rv-n {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: .8rem; font-weight: 700;
  background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok);
}
.review.miss .rv-n { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.review .rv-t { flex: 1 1 auto; min-width: 0; font-size: .95rem; overflow-wrap: anywhere; }
.review .rv-more { flex: 0 0 auto; color: var(--muted); font-size: .8rem; }
.review[open] .rv-more { visibility: hidden; }
.review-body { padding: 0 2px 16px; }

.misline {
  background: var(--bad-soft);
  border: 1px solid var(--bad);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: .9rem;
  margin: 10px 0;
}

/* 階層式解題步驟 */
.steps { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li {
  position: relative;
  padding: 0 0 0 30px;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 1px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .74rem;
  font-weight: 700;
  display: grid; place-items: center;
}
/* 關鍵步驟：標記要看得出來，但不能吵到把整份詳解變成一片色塊 */
.steps > li.key > .keytag,
.crit .keytag {
  display: inline-block;
  margin-left: 6px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
  vertical-align: 1px;
}
.steps > li.key::before { box-shadow: 0 0 0 3px var(--accent-soft); }
.allkey { margin-top: -4px; }

.steps .rule {
  display: inline-block;
  margin-left: 6px;
  font-size: .74rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
}
.substeps {
  margin: 7px 0 0;
  padding: 0 0 0 14px;
  list-style: none;
  border-left: 2px solid var(--border);
}
.substeps > li { margin: 0 0 6px; font-size: .9rem; color: var(--muted); }
.substeps .substeps { padding-left: 12px; }

/* 練習 */
.practice-head {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.feedback {
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 12px 0 0;
  font-size: .94rem;
  border: 1px solid;
}
.feedback.good { background: var(--ok-soft); border-color: var(--ok); }
.feedback.bad { background: var(--bad-soft); border-color: var(--bad); }

/* 歷史紀錄 */
.hist {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: .9rem;
}
.hist:first-child { border-top: 0; }
.hist .h-when { flex: 1 1 auto; min-width: 0; }
.hist .h-score { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist .btn { flex: 0 0 auto; white-space: nowrap; }

.spinner {
  width: 26px; height: 26px;
  margin: 8px auto 12px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.banner {
  border: 1px solid var(--warn);
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 14px;
  font-size: .9rem;
}

/* =========================================================================
   付費功能（需要連線）：問老師、學習報告、非選擇題評分
   沿用既有的卡片／按鈕／meter 語彙，只補上這三個功能自己的排版。
   ========================================================================= */

/* 標示「這個功能要連到伺服器」。顏色刻意用 accent 而不是 warn ——
   它不是警告，只是說明這一塊和其他功能不一樣。 */
.badge.pro {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  margin-left: 8px;
  font-weight: 700;
}
h2 > .badge.pro, h3 > .badge.pro { vertical-align: middle; }

.spinner.inline {
  width: 14px; height: 14px;
  margin: 0 7px 0 0;
  border-width: 2px;
  display: inline-block;
  vertical-align: -2px;
}

.netfail {
  border: 1px solid var(--warn);
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .88rem;
}

/* ------------------------------------------------------------- 問老師 */

.tutor {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
}
.tutor-title { margin-bottom: 4px; }
.tutor-log { display: grid; gap: 8px; margin: 10px 0; }
.tutor-log:empty { display: none; }

.bubble {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .92rem;
  line-height: 1.7;
  max-width: 92%;
  overflow-wrap: anywhere;
}
.bubble.me {
  justify-self: end;
  background: var(--accent-soft);
  border-color: var(--accent);
}
.bubble.tutor { justify-self: start; }
.bubble.busy { color: var(--muted); }
.bubble.err {
  justify-self: start;
  background: var(--warn-soft);
  border-color: var(--warn);
}

.tutor-form { display: flex; gap: 8px; align-items: flex-end; }
.tutor-form .btn { flex: 0 0 auto; }

.tutor-input, .work-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  font: inherit;
  font-size: 1rem;               /* 小於 16px 時 iOS Safari 會放大整頁 */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.7;
}
.tutor-input:focus-visible, .work-input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}
.tutor-input[disabled], .work-input[disabled] { opacity: .6; }

/* ------------------------------------------------------------- 學習報告 */

.report-out { margin-top: 12px; }
.report-text {
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px;
  font-size: .95rem;
  line-height: 1.85;
}
.report-text p:last-child { margin-bottom: 0; }
.report-wait { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------- 非選擇題：作答與評分 */

.work { margin-top: 14px; }
.work-label { display: block; font-size: .86rem; color: var(--muted); margin-bottom: 6px; font-weight: 700; }

.optref {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.optref .options { margin-top: 8px; }

.gradebox { margin: 12px 0 0; }
.gradebox .comment {
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .93rem;
}
.gradebox dl { margin: 10px 0 0; }
.gradebox dt { font-size: .8rem; color: var(--muted); font-weight: 700; margin-top: 10px; }
.gradebox dd { margin: 2px 0 0; }
.crit { margin: 6px 0 0; padding-left: 20px; font-size: .9rem; }
.crit li { margin-bottom: 4px; }
.crit.ok li::marker { color: var(--ok); }
.crit.no { color: var(--muted); }
.crit.no li::marker { color: var(--bad); }
.crit.unk { color: var(--muted); }

.worktext {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .92rem;
  line-height: 1.8;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 12px;
}

/* 逐題檢討的摘要在非選擇題模式下顯示分數而不是對／錯 */
.review .rv-n.pts { font-variant-numeric: tabular-nums; font-size: .78rem; }
.review .rv-n.pts.full { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

@media print {
  .tutor-form, .tutor-input, .report-aud { display: none !important; }
}

/* ------------------------------------------------------------- 大螢幕 */

@media (min-width: 560px) {
  :root { --gutter: 24px; }
  h1 { font-size: 1.8rem; }
  .options { gap: 10px; }
}

/* ------------------------------------------------------------- 列印 */

@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #f4f4f4;
    --border: #bbb; --border-strong: #999;
    --text: #000; --muted: #444; --accent: #333; --accent-soft: #eee;
    --figure-bg: #fff; --figure-shade: none;
    --shadow: none;
  }
  .topbar, .footer, .no-print, .sticky-actions, #btn-abandon { display: none !important; }
  #app { max-width: none; padding: 0; }
  .card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; margin-bottom: 10px; }
  .review { break-inside: avoid; }
  .review-body { display: block !important; }
  details { break-inside: avoid; }
  .weak { break-inside: avoid; }
  a[href]::after { content: ""; }
}
