/* ==========================================================================
   衛教說得通 — 設計系統
   兩個來源、兩種顏色，全站一致：
     醫學依據（教科書／藥品／法規）＝ --med 藍
     病友聲音（真實病友經驗）    ＝ --voice 陶土橘
   品牌主色 --brand 深青綠，只用在操作與導覽。
   ========================================================================== */
:root {
  --bg: #F5F3EE;
  --bg-2: #EFECE4;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --ink: #1C2629;
  --ink-2: #445055;
  --muted: #646E71;          /* 11/23 由 #7B8588 加深：小字在白底、米白底都達 WCAG AA 4.5:1 */
  --line: #E4E0D6;
  --line-2: #D6D1C4;

  --brand: #0D6B65;
  --brand-ink: #094E4A;
  --brand-soft: #E2F0EE;
  --brand-glow: rgba(13, 107, 101, .16);

  --med: #2D5DA6;
  --med-soft: #E9EFF9;
  --med-line: #C9D7EE;
  --voice: #B4532A;
  --voice-soft: #FBEEE6;
  --voice-line: #F0D3C2;

  --ok: #2F7D4F;
  --ok-soft: #E5F3EA;
  --warn: #A86A12;
  --warn-soft: #FBF1DE;
  --danger: #BF3B2F;
  --danger-soft: #FBE8E5;
  --chk: #3F5B73;            /* 檢查我的衛教（第三個模式，11/24）：石板藍灰，和「依據」的醫學藍分開 */
  --chk-soft: #E7EDF2;
  --chk-line: #C8D4DE;
  --violet: #6B4FA8;
  --violet-soft: #EFEAF8;
  --on-brand: #FFFFFF;           /* 品牌色底上的文字（深色模式品牌色較亮，改用深字確保對比） */

  --shadow-1: 0 1px 2px rgba(28, 38, 41, .05), 0 1px 1px rgba(28, 38, 41, .03);
  --shadow-2: 0 2px 6px rgba(28, 38, 41, .05), 0 10px 28px -12px rgba(28, 38, 41, .14);
  --shadow-3: 0 12px 40px -12px rgba(28, 38, 41, .28);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --serif: "Noto Serif TC", "Songti TC", serif;
  --side-w: 272px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121719; --bg-2: #171E20; --surface: #1A2225; --surface-2: #1E272A;
    --ink: #E8ECEA; --ink-2: #B8C2C0; --muted: #85908F; --line: #2A3538; --line-2: #354245;
    --brand: #4FB3A9; --brand-ink: #7FD0C6; --brand-soft: #173431; --brand-glow: rgba(79, 179, 169, .2);
    --med: #82A8E6; --med-soft: #1B2638; --med-line: #2C3E5C;
    --voice: #E59570; --voice-soft: #33231B; --voice-line: #57392A;
    --ok: #6CC08E; --ok-soft: #18301F; --warn: #E2B05A; --warn-soft: #33291A;
    --chk: #9DB7CF; --chk-soft: #1E2A34; --chk-line: #33475A;
    --danger: #EE8277; --danger-soft: #3A1F1C; --violet: #B49BE6; --violet-soft: #2A2338; --on-brand: #0B1F1D;
    --shadow-2: 0 2px 6px rgba(0,0,0,.3), 0 10px 28px -12px rgba(0,0,0,.5);
    --shadow-3: 0 12px 40px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121719; --bg-2: #171E20; --surface: #1A2225; --surface-2: #1E272A;
  --ink: #E8ECEA; --ink-2: #B8C2C0; --muted: #85908F; --line: #2A3538; --line-2: #354245;
  --brand: #4FB3A9; --brand-ink: #7FD0C6; --brand-soft: #173431; --brand-glow: rgba(79, 179, 169, .2);
  --med: #82A8E6; --med-soft: #1B2638; --med-line: #2C3E5C;
  --voice: #E59570; --voice-soft: #33231B; --voice-line: #57392A;
  --ok: #6CC08E; --ok-soft: #18301F; --warn: #E2B05A; --warn-soft: #33291A;
  --chk: #9DB7CF; --chk-soft: #1E2A34; --chk-line: #33475A;
  --danger: #EE8277; --danger-soft: #3A1F1C; --violet: #B49BE6; --violet-soft: #2A2338; --on-brand: #0B1F1D;
  --shadow-2: 0 2px 6px rgba(0,0,0,.3), 0 10px 28px -12px rgba(0,0,0,.5);
  --shadow-3: 0 12px 40px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 15px; line-height: 1.7; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; letter-spacing: .01em; }
p { margin: 0; }
::selection { background: var(--brand-glow); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }

/* ---------------------------------------------------------------- 版面 */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px 20px;
  scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, var(--brand) 0%, #13867C 55%, var(--voice) 160%); color: #fff;
  box-shadow: 0 6px 16px -6px var(--brand-glow);
}
.brand-logo { flex: none; display: block; }
.brand-name { font-weight: 900; font-size: 18px; line-height: 1.2; white-space: nowrap; letter-spacing: .08em; display: block; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; }
/* 品牌字樣圖（12/01，生圖：聽診器＋衛教說得通／Welltold）：淺色用 lk-l、深色用 lk-d；寬高比 3:1 */
.lk { display: block; height: auto; flex: none; }
.lk-d { display: none; }
:root[data-theme="dark"] .lk-l { display: none; }
:root[data-theme="dark"] .lk-d { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lk-l { display: none; } :root:not([data-theme="light"]) .lk-d { display: block; } }

.topic-pill {
  display: flex; flex-direction: column; align-items: stretch; width: 100%; height: auto; text-align: left; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--r); padding: 10px 12px; cursor: pointer; margin-bottom: 14px; transition: .15s;
}
.topic-pill:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.topic-pill .k { font-size: 11px; color: var(--muted); letter-spacing: .08em; display: flex; justify-content: space-between; }
.topic-pill .v { font-weight: 600; font-size: 14px; line-height: 1.45; margin-top: 2px; }
.topic-pill .v.empty { color: var(--brand); padding: 0; text-align: left; }   /* 不吃通用 .empty 的 40px 內距 */

.nav-group { margin: 10px 0 4px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .12em; padding: 6px 10px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--ink-2);
  font-size: 14px; line-height: 1.4; transition: background .12s;
}
.nav a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav a svg.i { color: var(--muted); }
.nav a.on svg.i { color: var(--brand); }
.side-foot { margin-top: auto; padding-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: none; align-items: center; gap: 10px;
  padding: 10px 16px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.view { padding: 32px 40px 80px; max-width: 1200px; width: 100%; margin: 0 auto; }
.view.wide { max-width: 1400px; }

/* ---------------------------------------------------------------- 頁首（功能頁：文字＋插畫封面） */
.page-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 28px; }
.page-head .num {
  font-family: var(--serif); font-size: 13px; font-weight: 700; color: var(--brand); flex: none;
  min-width: 34px; height: 26px; padding: 0 8px; border-radius: 8px; display: inline-grid; place-items: center;
  background: var(--brand-soft); letter-spacing: .04em;
}
.page-head h1 { font-size: 30px; letter-spacing: .01em; }
.page-head .lead { color: var(--ink-2); margin-top: 8px; max-width: 640px; font-size: 15.5px; }
.page-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.page-head.has-cover {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 400px); gap: 32px; align-items: center;
  padding: 28px 28px 28px 32px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); overflow: hidden;
}
.ph-cover { border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--bg-2); }
.ph-cover img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; color: var(--brand); }

/* ---------------------------------------------------------------- 卡片 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card.pad { padding: 22px 24px; }
.card.raise { box-shadow: var(--shadow-2); border-color: transparent; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h2, .card-h h3 { font-size: 16.5px; }
.card-h .sub { color: var(--muted); font-size: 13px; }
.card-h .grow { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.split.l { grid-template-columns: 340px minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.stack-s > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.serif { font-family: var(--serif); }
.hr { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.sticky { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

/* ---------------------------------------------------------------- 按鈕與表單 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; transition: .15s; white-space: nowrap;
  text-decoration: none !important;
}
.btn:hover { border-color: var(--ink-2); }
.btn:focus-visible, .chip:focus-visible, .opt:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-glow); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 4px 14px -6px var(--brand); }
.btn.primary:hover { background: var(--brand-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn .spin { width: 15px; height: 15px; }

.field { display: block; }
.field > .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field > .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; transition: .15s; line-height: 1.6;
}
.textarea { resize: vertical; min-height: 96px; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }

.seg { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  color: var(--ink-2); font-weight: 500;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; }

.opts { display: grid; gap: 10px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; border: 1.5px solid var(--line);
  background: var(--surface); border-radius: var(--r); padding: 13px 15px; cursor: pointer; transition: .15s;
}
.opt:hover { border-color: var(--brand); }
.opt.on { border-color: var(--brand); background: var(--brand-soft); }
.opt .t { font-weight: 600; }
.opt .d { font-size: 13px; color: var(--muted); }
.opt .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); flex: none; color: var(--brand); }

/* ---------------------------------------------------------------- 標籤／徽章 */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; background: var(--bg-2); color: var(--ink-2); border: 1px solid transparent;
  white-space: nowrap; cursor: default; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
button.chip { cursor: pointer; }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.out { background: transparent; border-color: var(--line-2); }

/* 出處標記：M＝醫學，V＝病友 */
.refs { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: 1px; margin-left: 4px; }
.ref {
  display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px 0 5px; border-radius: 99px; font-size: 11.5px;
  font-weight: 600; cursor: pointer; border: 1px solid; font-family: var(--sans); white-space: nowrap;
  letter-spacing: 0; line-height: 1; transition: .12s; vertical-align: 1px;
}
.ref svg { width: 12px; height: 12px; flex: none; }
.ref-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.ref-tabs button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.ref-tabs button.on { background: var(--med-soft); border-color: var(--med-line); color: var(--med); font-weight: 600; }
.ref.m { color: var(--med); background: var(--med-soft); border-color: var(--med-line); }
.ref.v { color: var(--voice); background: var(--voice-soft); border-color: var(--voice-line); }
.ref:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.src-legend { display: inline-flex; gap: 14px; font-size: 12.5px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.src-legend .dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.dot.m { background: var(--med); }
.dot.v { background: var(--voice); }

/* ---------------------------------------------------------------- 病友聲音（引文） */
.quote {
  position: relative; padding: 14px 16px 12px 18px; border-radius: var(--r); background: var(--voice-soft);
  border: 1px solid var(--voice-line);
}
.quote::before {
  content: "“"; position: absolute; left: 10px; top: -6px; font-family: var(--serif); font-size: 40px;
  color: var(--voice); opacity: .35; line-height: 1;
}
.quote .q { font-family: var(--serif); font-size: 15px; line-height: 1.75; color: var(--ink); }
.quote .who { margin-top: 8px; font-size: 12px; color: var(--voice); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quote.plain { background: var(--surface-2); border-color: var(--line); }
.med-snip { padding: 13px 15px; border-radius: var(--r); background: var(--med-soft); border: 1px solid var(--med-line); }
.med-snip .src { font-size: 12px; color: var(--med); font-weight: 600; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.med-snip .tx { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.med-snip .gl-tag { flex: none; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--med-line); background: var(--surface, transparent); color: var(--med); }

/* ---------------------------------------------------------------- 出處抽屜 */
.drawer-mask { position: fixed; inset: 0; background: rgba(15, 22, 24, .32); z-index: 104; opacity: 0; pointer-events: none; transition: .2s; }
.drawer-mask.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface); z-index: 105;
  box-shadow: var(--shadow-3); transform: translateX(105%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.drawer-h { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.drawer-b { padding: 18px 20px 30px; overflow-y: auto; flex: 1; }
.drawer-b .full { white-space: pre-wrap; font-size: 14.5px; line-height: 1.85; color: var(--ink-2); }

/* ---------------------------------------------------------------- 對話 */
.chat { display: flex; flex-direction: column; height: min(72vh, 760px); min-height: 460px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-lg) var(--r-lg) 0 0; flex-wrap: wrap; }
.chat-head .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.chat-head .mini { width: 70px; height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.chat-head .mini > i { display: block; height: 100%; background: var(--brand); transition: width .5s; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px 20px 8px; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; margin-bottom: 16px; align-items: flex-end; animation: rise .25s ease both; }
.msg.me { flex-direction: row-reverse; }
.msg .av {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700;
  font-size: 13px; color: #fff; background: var(--muted);
}
.msg .bub {
  max-width: min(78%, 620px); padding: 10px 14px; border-radius: 16px; background: var(--surface-2);
  border: 1px solid var(--line); border-bottom-left-radius: 5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere;
}
/* 寬度上限放在外層欄：泡泡的百分比上限若相對於會縮到內容寬的外層，「好喔」也會被拆成兩行 */
.msg .msg-col { min-width: 0; max-width: min(78%, 620px); display: flex; flex-direction: column; align-items: flex-start; }
.msg.me .msg-col { align-items: flex-end; }
.msg .msg-col .bub { max-width: 100%; }
.msg.me .bub { background: var(--brand); color: var(--on-brand); border-color: var(--brand); border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.msg .nm { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.msg .act { font-size: 12.5px; color: var(--muted); font-style: italic; margin-bottom: 2px; }
.msg .tools { display: flex; gap: 4px; margin-top: 4px; }
.msg.sys { justify-content: center; }
.msg.sys .bub { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); font-size: 13px; max-width: 90%; text-align: center; }
.msg.coach .bub { background: var(--brand-soft); border-color: transparent; color: var(--ink); font-size: 13.5px; }
.msg.coach .bub > svg { color: var(--brand); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
.chat-in { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.chat-in .textarea { min-height: 44px; max-height: 160px; resize: none; padding: 10px 12px; }
.addr { display: flex; gap: 6px; padding: 8px 12px 0; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 量表／分數 */
.meter { display: grid; gap: 5px; }
.meter .top { display: flex; justify-content: space-between; font-size: 13px; }
.meter .bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.meter .bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.ring { position: relative; width: 116px; height: 116px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .val span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat { padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.stat b { font-size: 24px; display: block; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- 清單 */
.list { display: grid; gap: 10px; }
.li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.li .ix { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 700; background: var(--brand-soft); color: var(--brand-ink); }
.li.ok .ix { background: var(--ok-soft); color: var(--ok); }
.li.warn .ix { background: var(--warn-soft); color: var(--warn); }
.li.bad .ix { background: var(--danger-soft); color: var(--danger); }
.li .t { font-weight: 600; }
.li .d { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.callout { padding: 14px 16px; border-radius: var(--r); background: var(--brand-soft); color: var(--ink); display: flex; gap: 10px; align-items: flex-start; }
.callout.warn { background: var(--warn-soft); }
.callout.danger { background: var(--danger-soft); }
.callout.violet { background: var(--violet-soft); }
.callout > svg { margin-top: 3px; color: var(--brand); }
.callout.warn > svg { color: var(--warn); }
.callout.danger > svg { color: var(--danger); }
.callout.violet > svg { color: var(--violet); }

/* ---------------------------------------------------------------- 首頁 */
/* ---------------------------------------------------------------- 首頁 */
.kicker { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.kicker .dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.kicker .x { color: var(--muted); font-weight: 400; }

.topic-stats { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.topic-stats .stat { padding: 8px 14px; flex: 1; min-width: 110px; }
.topic-stats .stat b { font-size: 19px; }

.sec { margin-top: 48px; }
.sec-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.sec-h h2 { font-size: 22px; margin-top: 4px; }
.sec-h > p { max-width: 520px; font-size: 14px; }
.mod-group { margin-top: 22px; }
.mod-group-h { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .1em; margin-bottom: 12px; }


.path { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }

.preset {
  text-align: left; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; transition: .15s; display: flex; gap: 12px; align-items: center;
}
.preset:hover { border-color: var(--brand); box-shadow: var(--shadow-1); }
.preset .thumb { width: 56px; height: 56px; border-radius: 11px; object-fit: cover; flex: none; background: var(--bg-2); }
.preset .t { font-weight: 600; font-size: 14px; line-height: 1.45; }
.preset .d { font-size: 12px; color: var(--muted); margin-top: 3px; }

.empty-state { text-align: center; padding: 28px 20px 36px; }
.empty-state img { width: min(300px, 70%); margin: 0 auto 18px; border-radius: 18px; }
.empty-state h3 { font-size: 18px; }
.empty-state p { color: var(--muted); margin: 6px auto 18px; max-width: 420px; }

.site-foot { margin-top: 64px; padding: 24px 0 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.site-foot > div { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.site-foot b { color: var(--ink-2); font-size: 13.5px; }
.site-foot .crisis-line { margin-top: 6px; display: flex; gap: 6px; align-items: center; color: var(--ink-2); }

.tabbar { display: none; }

/* 素材包頁 */
.pack-tabs { position: sticky; top: 0; z-index: 15; background: var(--bg); margin-bottom: 20px; }
.pack-grid { align-items: start; }
.src-tag { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.src-tag.m { background: var(--med-soft); color: var(--med); }
.src-tag.v { background: var(--voice-soft); color: var(--voice); }
.voice-card { border-color: var(--voice-line); }
.vg-h { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; display: flex; gap: 6px; align-items: center; color: var(--ink-2); }
.vg-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.vg-list li::marker { color: var(--voice); }
.concept { padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.concept .t { font-weight: 700; margin-bottom: 8px; }
.concept .pro, .concept .plain { font-size: 13.5px; display: grid; grid-template-columns: 40px 1fr; gap: 6px; margin-top: 4px; }
.concept .pro { color: var(--muted); }
.concept .plain { color: var(--brand-ink); }
.concept .pro span, .concept .plain span { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; padding-top: 2px; }
.live-ev { margin-top: 18px; }
.live-ev summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13.5px; }

/* 手機主要行動按鈕：黏在畫面底部（導覽列上方）；桌面版照常排版 */
.cta-sticky { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- 等待 */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 48px 20px; text-align: center; color: var(--ink-2); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.steps { display: grid; gap: 6px; text-align: left; font-size: 13.5px; }
.steps .s { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.steps .s.on { color: var(--ink); font-weight: 600; }
.steps .s.done { color: var(--ok); }
.sk { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }

/* ---------------------------------------------------------------- 浮層 */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-3); animation: rise .2s ease both; max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.modal-mask { position: fixed; inset: 0; background: rgba(15, 22, 24, .45); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 24px; animation: rise .2s ease both; }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------------------------------------------------------------- 富文字 */
.prose { line-height: 1.85; }
.prose p + p, .prose ul, .prose ol { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: 4px; }
.prose h3, .prose h4 { margin-top: 18px; margin-bottom: 6px; }
.prose strong { color: var(--ink); }
mark.hl { background: var(--warn-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
mark.bad { background: var(--danger-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
mark.good { background: var(--ok-soft); color: inherit; padding: 0 2px; border-radius: 3px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--line-2); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--brand); }

.persona { display: flex; gap: 14px; align-items: flex-start; }
.persona .av { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 20px; font-weight: 700; color: #fff; flex: none; }
.persona .nm { font-weight: 700; font-size: 16px; }
.persona .rl { font-size: 13px; color: var(--muted); }

.crisis { border: 1.5px solid var(--danger); background: var(--danger-soft); border-radius: var(--r); padding: 14px 16px; }
.crisis b { color: var(--danger); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(191, 59, 47, .45); } 100% { box-shadow: 0 0 0 12px rgba(191, 59, 47, 0); } }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- 列印（回診問題卡、生活小步卡） */
@media print {
  @page { size: A4; margin: 12mm; }   /* 11/23：沒有 @page 時瀏覽器用預設邊界，決策單被切成兩頁 */
  .side, .topbar, .no-print, .drawer, .drawer-mask, .toast-wrap { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing .print-sheet { display: block; }
}
.print-sheet { display: none; color: #111; font-size: 12pt; line-height: 1.7; }
.print-sheet h1 { font-size: 18pt; margin: 0 0 6px; }
.print-sheet h2 { font-size: 13pt; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid #999; }
.print-sheet ol, .print-sheet ul { padding-left: 1.4em; margin: 0; }
.print-sheet li { margin: 4px 0; break-inside: avoid; }
.print-sheet .print-src { font-size: 10pt; color: #333; }
.print-sheet .print-foot { margin-top: 20px; font-size: 9.5pt; color: #555; }
.src-sum { margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.src-sum summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.src-sum .li { background: var(--surface); padding: 9px 12px; }
.src-sum .li .t { font-size: 13.5px; font-weight: 500; }

/* ---------------------------------------------------------------- RWD */
@media (max-width: 1180px) {
  .page-head.has-cover { grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
  .split, .split.l { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  /* scrollIntoView 不要停在頂部固定列下面、底部導覽上面（11/23 走查：m05 總評、m02「下一關」被蓋住） */
  html { scroll-padding-top: 72px; scroll-padding-bottom: 84px; }
  .pack-tabs { top: 57px; }
  .tabs { padding-right: 32px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  .tabbar {
    display: grid; grid-template-columns: repeat(2, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 11px;
    color: var(--muted); border: 0; background: none; cursor: pointer; text-decoration: none !important; font-weight: 500; }
  .tabbar svg.i { width: 22px; height: 22px; }
  .tabbar .on { color: var(--brand); font-weight: 700; }
  .view { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .toast-wrap { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .cta-sticky {
    position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 30; margin: 16px -4px 0; padding: 10px;
    border-radius: 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    box-shadow: 0 -2px 20px -8px rgba(28, 38, 41, .25); border: 1px solid var(--line);
  }
  .cta-sticky > .btn { flex: 1; }
  /* 對話演練中：收起底部導覽，對話框佔滿可視高度 */
  body.in-session .tabbar { display: none; }
  body.in-session .view { padding-bottom: 24px; }
  body.in-session .cta-sticky { bottom: calc(8px + env(safe-area-inset-bottom)); }
  .chat { height: calc(100dvh - 120px); min-height: 420px; }
  .page-head.has-cover { grid-template-columns: minmax(0, 1fr); padding: 0 0 20px; gap: 0; border-radius: 20px; }
  .page-head.has-cover .ph-cover { order: -1; border-radius: 0; aspect-ratio: 16 / 7; }
  .page-head.has-cover .ph-text { padding: 18px 18px 0; }
  .page-head h1 { font-size: 23px; }
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 90; transform: translateX(-105%); transition: transform .25s; box-shadow: var(--shadow-3); }
  .side.on { transform: none; }
  .topbar { display: flex; }
  .view { padding: 20px 16px 64px; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head h1 { font-size: 22px; }
  .page-head .num { width: 40px; height: 40px; font-size: 13px; }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat b { font-size: 20px; }
  .card.pad { padding: 18px 16px; }
  .msg .bub, .msg .msg-col { max-width: 86%; }
  .msg .msg-col .bub { max-width: 100%; }
  .page-head { gap: 12px; }
  .ring { width: 96px; height: 96px; }
  .ring .val b { font-size: 24px; }
  /* 首頁：推薦路徑改橫向滑動、全部功能改兩欄精簡卡 */
  .path { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 10px; gap: 12px; scrollbar-width: none; }
  .path::-webkit-scrollbar { display: none; }
  .path .mod-card { flex: 0 0 74%; scroll-snap-align: start; }
  .grid.g4.mods { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mods .mod-body { padding: 10px 12px 12px; }
  .mods .mod-body p, .mods .mod-body .go span:first-child { display: none; }
  .mods .mod-body h3 { font-size: 14px; }
  .mods .mod-body .go { padding-top: 2px; }
  .sec { margin-top: 36px; }
  .sec-h h2 { font-size: 19px; }
  .preset { padding: 8px; }
  .preset .thumb { width: 46px; height: 46px; }
}

/* 出處抽屜：被引用的那一句 */
.drawer mark.hl { background: var(--warn-soft); color: inherit; padding: 1px 2px; border-radius: 4px; box-shadow: 0 0 0 2px var(--warn-soft); }

/* 我的練習：手機上分數與按鈕換到下一行（並排時主題與日期被擠成五行） */
@media (max-width: 600px) {
  .hist-row { flex-wrap: wrap; align-items: center; }
  .hist-row > .grow { flex: 1 1 calc(100% - 40px); }
  .hist-row > .chip { margin-left: 38px; }
  .hist-row > .btn { margin-left: auto; }
}

/* 教育理論分析卡（core.frameworkCard） */
.fw { margin-top: 18px; }
.fw > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.fw > summary::-webkit-details-marker { display: none; }
.fw-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.fw .callout.violet { background: var(--brand-soft); }   /* 「下次這樣做」：紫色不在色彩語意裡（11/23 走查） */
.fw .callout.violet > svg { color: var(--brand); }
.fw-h h3 { font-size: 16.5px; line-height: 1.4; }
.fw-b { margin-top: 14px; }
.fw-why { font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.fw-ms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.fw-m { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--line-2); }
.fw-m.good { border-top-color: var(--ok); }
.fw-m.fair { border-top-color: var(--brand); }
.fw-m.low { border-top-color: var(--warn); }
.fw-m.bad { border-top-color: var(--danger); }
.fw-m-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.fw-m-v { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: .01em; }
.fw-m-t { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fw-m-n { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.55; }
.fw-q { font-size: 13px; color: var(--muted); margin-top: 6px; }
.fw-tip { font-size: 13.5px; color: var(--brand-ink); margin-top: 6px; }
/* 手機一欄：兩欄時標題一行只剩 4–5 個字、「做到了」被切成「做到`」（11/23 走查） */
.fw-m-top .chip { flex: none; white-space: nowrap; }
@media (max-width: 600px) { .fw-ms { grid-template-columns: minmax(0, 1fr); } .fw-m-v { font-size: 19px; } }
.fw-ok { margin-top: 10px; }
.fw-ok > summary { cursor: pointer; color: var(--ok); font-weight: 600; padding: 6px 0; }
.fw-ok > .list { margin-top: 8px; }
.fw-sum { font-size: 13px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.fw[open] .fw-sum { display: none; }
.fw-tog { color: var(--muted); transition: transform .2s; display: inline-flex; }
.fw[open] .fw-tog { transform: rotate(180deg); }

/* 出處抽屜：頂部（分頁＋來源）固定，捲到標出的句子時不會被捲走 */
.ref-head { position: sticky; top: -18px; z-index: 2; background: var(--surface); margin: -18px -20px 0; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
.ref-head .ref-tabs { margin-bottom: 10px; padding-bottom: 10px; }
.ref-claim { margin-top: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; line-height: 1.65; display: grid; gap: 4px; }
.ref-found { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); }
.ref-st { color: var(--muted); }
.ref-st:empty { display: none; }
.ref .ref-n { font-size: 10.5px; font-weight: 700; margin-left: 1px; }   /* 11/23 拿掉 opacity：半透明藍在淺藍底只有 4.15:1 */

/* ---------------------------------------------------------------- 外框：首頁分層路徑、病人版、手機選單 */
.fresh { margin-top: 10px; display: flex; align-items: center; gap: 2px; }
.print-sheet.print-big { font-size: 15pt; line-height: 1.75; }
.print-big .pb-tag { font-size: 10pt; letter-spacing: .2em; color: #0D6B65; font-weight: 700; }
.print-big h1 { font-size: 22pt; margin-top: 4px; }
.print-big .pb-lead { font-size: 14pt; color: #333; }
.print-big h2 { font-size: 16pt; border-bottom: 2px solid #0D6B65; }
.print-big h2.pb-red { border-bottom-color: #BF3B2F; color: #9B2C22; }
.print-big .pb-three > li { margin: 10px 0; }
.print-big .pb-three b { font-size: 16pt; }
.print-big .pb-note { margin-top: 16px; padding: 10px 14px; border: 1.5px solid #999; border-radius: 8px; font-size: 13pt; }
.print-big .pb-crisis { margin-top: 12px; padding: 8px 12px; border-left: 4px solid #0D6B65; background: #EEF6F4; font-size: 12.5pt; break-inside: avoid; }
@media (max-width: 900px) {
  .side.on ~ .main::before { content: ""; position: fixed; inset: 0; background: rgba(15, 22, 24, .4); z-index: 85; }
  .side-foot { position: sticky; bottom: -20px; background: var(--surface); margin: auto -14px -20px; padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
}

/* ---------- 精簡頁首（取代大插畫封面） */
.page-head.compact { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; padding: 0; background: none; border: 0; box-shadow: none; }
.page-head.compact .ph-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand-ink); }
.page-head.compact .ph-tt { flex: 1; min-width: 0; }
.page-head.compact h1 { font-size: 22px; line-height: 1.3; font-weight: 700; }
.page-head.compact .ph-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head.compact .meta { margin-top: 0; flex-wrap: nowrap; }
@media (max-width: 600px) {
  .page-head.compact { flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
  .page-head.compact h1 { font-size: 19px; }
  .page-head.compact .ph-sub { display: none; }
  .page-head.compact .meta { width: 100%; }
}

/* ---------- 結果頁共用版型 */
.r-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; }
.r-hero .ring { width: 104px; height: 104px; }
.r-hero h2 { font-size: 20px; line-height: 1.45; }
.r-hero-sub { font-size: 14px; color: var(--ink-2); margin-top: 6px; line-height: 1.6; }
.r-hero-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.r-hero-acts { display: flex; flex-direction: column; gap: 8px; min-width: 180px; }
.r-fix { margin-top: 16px; }
.r-fix h3 { font-size: 16px; margin-bottom: 12px; }
.r-fix-list { display: grid; gap: 10px; }
.r-fix-it { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--brand); }
.r-fix-it.bad { border-left-color: var(--danger); }
.r-said { font-size: 13.5px; color: var(--muted); }
.r-fix-it.bad .r-said { text-decoration: line-through; }
.r-better { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; font-size: 14.5px; line-height: 1.6; }
.r-arrow { color: var(--brand); flex: none; margin-top: 3px; display: inline-flex; }
.r-why { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.r-more { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.r-more > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 14.5px; display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.r-more > summary::-webkit-details-marker { display: none; }
.r-more[open] > summary svg { transform: rotate(180deg); }
.r-more-b { padding: 0 18px 18px; display: grid; gap: 14px; }
.r-more-b > .card { margin-top: 0; }
@media (max-width: 760px) {
  .r-hero { grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
  .r-hero .ring { width: 84px; height: 84px; }
  .r-hero h2 { font-size: 17px; }
  .r-hero-acts { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .r-hero-acts > * { flex: 1 1 150px; }
  /* 次要區是一列按鈕（例：看修正版＋重來圖示）時：文字按鈕撐滿、不要擠到一字一行 */
  .r-hero-acts > .row > .btn:not(.icon) { flex: 1; white-space: nowrap; }
}

/* ---------------------------------------------------------------- 外框（工作台版首頁、素材包頁、我的練習、頁尾）
   設計規範：頁標題 22px／區塊標題 16px／內文 14px／說明 12.5px；間距 8 的倍數；每頁一個實心主按鈕 */
.ws-head { display: flex; align-items: center; gap: 24px; }
.ws-topic { flex: 1; min-width: 0; }
.ws-title { font-size: 22px; line-height: 1.35; font-weight: 700; margin-top: 2px; }
.fresh { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.ws-acts { display: flex; gap: 8px; align-items: center; flex: none; }
.ws-sec { margin-top: 32px; }
.ws-h { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.sug-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sug-card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); transition: .15s; }
.sug-card:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.sug-ic, .mr-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand-ink); }
.sug-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sug-tx b { font-size: 14.5px; }
.sug-tx span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-min, .mr-meta { font-size: 12.5px; color: var(--muted); flex: none; display: flex; gap: 10px; align-items: center; }
.tier { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.tier + .tier { margin-top: 8px; }
.tier > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.tier > summary::-webkit-details-marker { display: none; }
.tier > summary b { font-size: 14.5px; }
.tier-d { font-size: 12.5px; color: var(--muted); }
.tier-n { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tier > summary svg { color: var(--muted); transition: transform .2s; }
.tier[open] > summary svg { transform: rotate(180deg); }
.mod-list { border-top: 1px solid var(--line); }
.mod-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: var(--ink); border-top: 1px solid var(--line); }
.mod-row:first-child { border-top: 0; }
.mod-row:hover { text-decoration: none; background: var(--surface-2); }
.mod-row > svg:last-child { color: var(--muted); flex: none; }
.mod-row.next { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.mr-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mr-tx b { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.mr-tx span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-next { font-size: 11px !important; font-weight: 700; color: var(--brand) !important; background: var(--brand-soft); padding: 1px 7px; border-radius: 99px; overflow: visible !important; }
.mr-done { color: var(--ok); display: inline-flex; align-items: center; }

/* 沒選主題：只做「選主題」一件事 */
.pick { max-width: 760px; }
.pick .ws-title { margin-bottom: 4px; }
.qp { margin-top: 16px; display: grid; gap: 12px; }
.qp-row { display: flex; gap: 8px; }
.qp-row .input { flex: 1; height: 44px; }
.qp-lbl { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.qp-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qp-chip { text-align: left; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; display: grid; gap: 2px; }
.qp-chip:hover { border-color: var(--brand); }
.qp-chip b { font-size: 13.5px; line-height: 1.4; }
.qp-chip span { font-size: 12px; color: var(--muted); }

/* 素材包頁 */
.pack-head { margin-bottom: 8px; }
.pack-head .ph-sub { white-space: nowrap; }
.pack-acts { display: flex; gap: 8px; align-items: center; flex: none; }
.pack-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12.5px; color: var(--muted); margin: 0 0 20px 54px; }
.pack-meta > span { display: inline-flex; align-items: center; gap: 2px; }
.pack-meta .fresh { margin-top: 0; }
.info-pop { position: relative; }
.info-pop > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.info-pop > summary::-webkit-details-marker { display: none; }
.info-pop > summary:hover { color: var(--ink); }
.info-body { position: absolute; z-index: 30; top: 24px; left: 0; width: min(340px, 80vw); padding: 12px 14px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-2); font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.dd { position: relative; }
.dd > summary { list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd[open] > summary svg:last-child { transform: rotate(180deg); }
.dd-menu { position: absolute; z-index: 40; right: 0; top: calc(100% + 6px); min-width: 230px; padding: 6px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-3); display: grid; gap: 2px; }
.dd-menu button { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--ink); }
.dd-menu button:hover { background: var(--surface-2); }
.dd-menu button > svg { color: var(--brand); margin-top: 2px; }
.dd-menu b { display: block; font-size: 13.5px; }
.dd-menu span span { display: block; font-size: 12px; color: var(--muted); }
.kf-list { display: grid; gap: 6px; }
.kf { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.kf > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.kf > summary::-webkit-details-marker { display: none; }
.kf > summary .ix { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand-ink); }
.kf-t { flex: 1; font-weight: 600; font-size: 14px; line-height: 1.5; }
.kf > summary > svg:last-child { color: var(--muted); flex: none; transition: transform .2s; }
.kf[open] > summary > svg:last-child { transform: rotate(180deg); }
.kf-d { padding: 0 12px 12px 46px; font-size: 13.5px; color: var(--ink-2); line-height: 1.65; }
.tips > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.tips > summary::-webkit-details-marker { display: none; }
.tips > summary h2 { font-size: 16.5px; }
.tips > summary .sub { color: var(--muted); font-size: 13px; }
.tips > summary > svg:last-child { margin-left: auto; color: var(--muted); transition: transform .2s; }
.tips[open] > summary > svg:last-child { transform: rotate(180deg); }
.tips[open] > summary { margin-bottom: 12px; }
.tip-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
/* 素材包頁底：其他練習小卡片 */
.pack-next { margin-top: 36px; }
.pack-next-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pack-next-h h2 { font-size: 17px; }
.pack-next-h .sub { font-size: 12.5px; color: var(--muted); }
.pack-next-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pack-next-it {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pack-next-it:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.pack-next-it:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-glow); }
.pack-next-it .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.pack-next-it .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pack-next-it b { font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.pack-next-it b .chip { height: 20px; font-size: 11px; padding: 0 7px; }
.pack-next-it small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.pack-next-it > svg.i:last-child { color: var(--muted); flex: none; }
.pack-next-it:hover > svg.i:last-child { color: var(--brand); }
/* 手機版的素材資訊（一行、可展開）；桌機用原本的 .pack-meta */
.pack-meta-m { display: none; }

/* 我的練習 */
.hist-empty { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hist-where { margin-top: 16px; font-size: 12px; color: var(--muted); }

/* 頁尾：一行 */
.site-foot { margin-top: 48px; padding: 16px 0 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6;
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.site-foot .sep { color: var(--line-2); }

@media (max-width: 900px) {
  .ws-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .ws-acts { flex-direction: row-reverse; }
  .ws-acts .btn.primary { flex: 1; }
  .sug-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pack-head { flex-wrap: wrap; }
  .pack-acts { width: 100%; }
  .pack-acts .btn.primary { flex: 1; justify-content: center; }
  .pack-meta { margin-left: 0; }
  .pack-next-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .ws-title { font-size: 19px; }
  .pack-next-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pack-meta { display: none; }
  .pack-meta-m { display: block; margin: -4px 0 14px; font-size: 12.5px; color: var(--muted); }
  .pack-meta-m > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 6px 2px; }
  .pack-meta-m > summary::-webkit-details-marker { display: none; }
  .pack-meta-m .pmm-tog { color: var(--brand); font-weight: 600; }
  .pack-meta-m > summary > svg.i:last-child { color: var(--brand); transition: transform .2s; }
  .pack-meta-m[open] > summary > svg.i:last-child { transform: rotate(180deg); }
  .pmm-b { padding: 8px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 6px; line-height: 1.6; color: var(--ink-2); }
  .pmm-b .fresh { margin: 0; }
  .pmm-note { font-size: 12.5px; }
  .tier-d { display: none; }
  .qp-presets { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qp-row { flex-direction: column; }
  .mod-row { padding: 10px 12px; }
  .dd-menu { right: auto; left: 0; }
}

/* ---------------------------------------------------------------- 選主題視窗（第十五輪：登入後必選；已建立／建立新主題分兩區） */
.tp-mask.required { background: rgba(15, 22, 24, .62); backdrop-filter: blur(3px); }
body.tp-open { overflow: hidden; }
.tp-modal { width: min(720px, 100%); max-height: min(92vh, 860px); display: flex; flex-direction: column; padding: 22px 24px 20px; overflow: hidden; }
.tp-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.tp-top h2 { font-size: 20px; line-height: 1.35; margin-bottom: 2px; }
.tp { display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1; }
.tp.busy { pointer-events: none; }
.tp.busy .tp-sec { opacity: .45; }
.tp-search { position: relative; display: flex; align-items: center; }
.tp-search > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.tp-in { width: 100%; height: 48px; padding-left: 42px; font-size: 15px; }
.tp-status:empty { display: none; }
.tp-checking { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); }
.tp-checking .spinner { width: 16px; height: 16px; border-width: 2px; flex: none; }
.tp-err { margin: 0; font-size: 13.5px; line-height: 1.65; }
.tp-sec { border-radius: var(--r-lg); border: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.tp-sec.built { flex: 1; background: var(--surface-2); }
.tp-sec.new { border-style: dashed; }
.tp-h { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tp-sec.built .tp-dot { background: var(--ok); }
.tp-sec.new .tp-dot { background: var(--brand); }
.tp-n { margin-left: auto; font-size: 12.5px; color: var(--muted); text-align: right; }
.tp-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 40vh; min-height: 120px; padding-right: 2px; overscroll-behavior: contain; }
.tp-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; color: inherit; font: inherit; }
.tp-row:hover, .tp-row:focus-visible { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); outline: none; }
.tp-ok { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); flex: none; }
.tp-ok svg { width: 15px; height: 15px; }
.tp-tx { display: grid; gap: 2px; min-width: 0; flex: 1; }
.tp-tx b { font-size: 14.5px; line-height: 1.4; font-weight: 600; }
.tp-tx span { font-size: 12.5px; color: var(--muted); }
.tp-tx .tp-focus { font-size: 13px; color: var(--ink-2); line-height: 1.45; }   /* 主題範圍：分辨相近主題（11/23） */
.tp-tag { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); flex: none; }
.tp-go { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ok); font-weight: 600; flex: none; }
.tp-go svg { width: 14px; height: 14px; }
.tp-none { font-size: 13px; color: var(--muted); padding: 12px 4px; }
.tp-make { align-self: flex-start; max-width: 100%; }
.tp-sugs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tp-sugs:empty { display: none; }
.tp-sl { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.tp-sug { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; border: 1px dashed var(--line-2, var(--line)); background: transparent; color: var(--ink-2); font-size: 12.5px; cursor: pointer; }
.tp-sug:hover { border-color: var(--brand); color: var(--brand); }
.tp-sug svg { width: 13px; height: 13px; }
@media (max-width: 600px) {
  .tp-mask { padding: 0; align-items: end; }
  .tp-modal { width: 100%; max-height: 94vh; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px 16px 16px; }
  .tp-top h2 { font-size: 18px; }
  .tp-list { max-height: 44vh; }
  .tp-go span, .tp-go { font-size: 0; gap: 0; }
  .tp-go svg { width: 16px; height: 16px; }
  .tp-sec { padding: 10px; }
}

/* ---------------------------------------------------------------- 第十六輪：對話室與結果頁 */
/* 停止朗讀：只在正在念（或還有排隊的台詞）時出現，放在輸入列上方右側 */
.chat > .chat-stop { display: flex; margin: 0 12px 8px auto; }
.chat > .chat-stop[hidden] { display: none; }

/* 演練中參考：本主題重點（桌機側欄可收合；≤1180 改成對話框頂列的「重點」按鈕，在對話框內展開） */
.cv-ref-side > summary { list-style: none; cursor: pointer; font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: center; color: var(--ink-2); }
.cv-ref-side > summary::-webkit-details-marker { display: none; }
.cv-ref-n { margin-left: auto; height: 22px; font-size: 11.5px; }
.cv-ref-b { display: grid; gap: 12px; margin-top: 12px; font-size: 13.5px; line-height: 1.6; }
.cv-ref-sec { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.cv-ref-sec.now { background: var(--danger-soft); border-color: transparent; }
.cv-ref-sec.later { background: var(--warn-soft); border-color: transparent; }
.cv-ref-h { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; color: var(--ink-2); }
.cv-ref-sec.now .cv-ref-h { color: var(--danger); }
.cv-ref-b ul, .cv-ref-b ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.cv-ref-b ol b { font-weight: 600; }
.cv-ref-tog { display: none; height: 28px; cursor: pointer; }
.cv-refbox { border-bottom: 1px solid var(--line); padding: 10px 14px 12px; max-height: 42vh; overflow-y: auto; background: var(--surface); overscroll-behavior: contain; }
.cv-refbox-h { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cv-refbox .cv-ref-b { margin-top: 8px; }
.cv-ref-inline { display: none; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 10px 14px; }
.cv-ref-inline > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
@media (max-width: 1180px) {
  .cv-ref-side { display: none; }
  .cv-ref-tog { display: inline-flex; }
  .cv-ref-inline { display: block; }
}

/* 警訊處理結果（結果頁第一層，列在要更正的說法之前） */
.cv-rf { margin-top: 16px; border-color: var(--danger); }
.cv-rf h3 { font-size: 16px; display: flex; align-items: center; gap: 6px; color: var(--danger); }
.cv-rf h3 svg { width: 18px; height: 18px; }
.cv-rf-list { display: grid; gap: 10px; margin-top: 10px; }
.cv-rf-it { padding: 10px 14px; border-radius: var(--r); background: var(--danger-soft); }
.cv-rf-flag { font-weight: 700; }
.cv-rf-said { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.cv-rf-fix { font-size: 13.5px; margin-top: 4px; }
.cv-rf-ok { margin-top: 16px; background: var(--ok-soft); }
.cv-rf-ok > svg { color: var(--ok); }

/* 結果頁主／次按鈕：長名字換行，不超出畫面 */
.r-hero-acts .btn { white-space: normal; text-align: center; line-height: 1.35; height: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; }

/* 選主題視窗：科別篩選、排序 */
.tp-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
/* 橫向捲動的列：右緣淡出提示「還有」；右側留白，捲到底時最後一個不會被淡出蓋住 */
.tp-cats { padding-right: 32px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.tp-cats:empty { display: none; }
.tp-cat { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; cursor: pointer; }
.tp-cat span { font-size: 11.5px; color: var(--muted); }
.tp-cat.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ink); font-weight: 600; }
.tp-sort { margin-left: 8px; }
.tp-sort:empty { display: none; }
.tp-sort button { height: 26px; font-size: 12px; padding: 0 10px; }
@media (max-width: 600px) {
  .tp-h { flex-wrap: wrap; }
  .tp-sort { margin-left: 0; }
}
.cv-how { margin-top: 4px; }
.cv-how > summary { cursor: pointer; font-size: 12.5px; color: var(--brand-ink); font-weight: 600; width: fit-content; }
.cv-qline { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.cv-qline.open { display: block; -webkit-line-clamp: unset; }
/* 手機對話框頂列多了「重點」：可以換行（conv.css 設了 nowrap，這裡要更高的權重） */
@media (max-width: 600px) {
  .chat.cv-chat .chat-head { flex-wrap: wrap; row-gap: 6px; }
  .chat.cv-chat .chat-head .cv-ref-tog { margin-left: auto; height: 24px; padding: 0 8px; font-size: 12px; }
}

/* ---------------------------------------------------------------- 11/27 UI/UX 走查：手機點擊目標與輸入
   觸控目標至少 40–44px；輸入框 16px（iPhone 小於 16px 會在點進去時自動放大畫面、要手動縮回來） */
@media (max-width: 900px) {
  .topbar { padding: 6px 12px 6px 6px; }
  .topbar > .btn.icon { width: 44px; height: 44px; }
  .topbar .chip-clip { min-height: 36px; padding: 0 12px; }
  .nav a { padding: 11px 12px; font-size: 15px; }
  .nav-label { padding-top: 10px; }
  .side-foot .btn { height: 44px; flex: 1; justify-content: center; font-size: 14px; }
  .btn.sm { height: 40px; padding: 0 14px; font-size: 14px; }
  .btn.sm.icon { width: 40px; padding: 0; }
  .seg button { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .input, .textarea, .select, input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="number"], textarea, select { font-size: 16px; }
  /* 「依據」小標籤：畫面上維持小巧，點擊範圍往外擴 */
  .ref { height: 24px; padding: 0 8px 0 6px; font-size: 12.5px; position: relative; }
  .ref::after { content: ""; position: absolute; inset: -10px -4px; }
  .ref .ref-n { font-size: 11.5px; }
  .chip { min-height: 26px; }
}
.side-x { display: none; }
@media (max-width: 900px) {
  .side { position: fixed; }
  .side-x { display: inline-flex; position: absolute; top: 10px; right: 8px; width: 44px; height: 44px; z-index: 2; }
}
@media (max-width: 900px) {
  .pk-issue.icon { width: 40px; height: 40px; }
  details.card > summary, details.tips > summary { min-height: 44px; }
  .mode-hint a, .mode-hint .lnk { display: inline-block; padding: 9px 0; }
  .side > * { flex-shrink: 0; }
}

/* 11/28：紅色只給醫學錯誤與安全——一般錯誤訊息（網路斷線、格式不對）改用提醒色 */
.toast.err { background: var(--ink); color: var(--surface); }
/* 側欄最下面：登入的 Email、條款與合作洽談（11/29） */
.side-legal { padding: 10px 6px 0; display: grid; gap: 6px; }
.side-me { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.side-me span:not(.chip) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-me .i { width: 15px; height: 15px; flex: none; color: var(--muted); }
.side-legal nav { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.side-legal nav a { font-size: 12px; color: var(--muted); padding: 4px 0; }
@media (max-width: 900px) { .side-legal nav a { padding: 9px 0; font-size: 13px; min-height: 40px; display: inline-flex; align-items: center; } }   /* 12/01 QA：手機點擊目標 ≥40px */
.side-legal { order: 1; margin-top: auto; padding-top: 14px; }
.side > .side-foot { order: 2; margin-top: 6px; }

/* 11/29 使用次數：側欄「今天的免費次數」、標題列剩餘次數 chip */
.q-chip { flex: none; white-space: nowrap; }
.q-chip[role="button"] { cursor: pointer; }
.side-q { font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px 10px; margin: 6px 0; }
.side-q > summary { display: flex; align-items: center; gap: 6px; min-height: 40px; cursor: pointer; list-style: none; }
.side-q > summary::-webkit-details-marker { display: none; }
.side-q > summary .i { width: 15px; height: 15px; color: var(--muted); flex: none; }
.side-q-n { margin-left: auto; color: var(--muted); }
.side-q ul { list-style: none; margin: 0; padding: 0 0 4px; display: grid; gap: 2px; }
.side-q li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px dashed var(--line); }
.side-q li b { font-weight: 600; white-space: nowrap; }
.side-q li.out b { color: var(--warn); }
.side-q-tip { margin: 4px 0; color: var(--muted); font-size: 12px; }
.side-q-go { display: inline-flex; align-items: center; min-height: 40px; color: var(--brand-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 600px) { .page-head .meta:has(.q-chip:not([hidden])) .ph-mins { display: none; } }   /* 手機標題列放不下：有剩餘次數時先藏「約 N 分鐘」 */
