/* 捷運搭乘 — 樣式
   🤖 Claude 產生　｜　版本 v0.1.0　｜　最後更新：2026-11-19
   風格：第 1 種「系統預設」（石墨中性＋冷藍點綴，使用者 2026-11-19 選定；與姊妹作 45_1 同一種）。
   色碼出處：tokens.json 的 femh.archetype.system-graphite（中性與主色）、femh.semantic（成功／警示／危險／資訊）——與 45_1 styles.css 同一組。
   🔴 捷運線色不寫在這裡：一律來自路網包的官方 LineColor（TDX），由 app.js 設成 CSS 變數 --c。
      官方線色是「識別」不是品牌色（使用者要求以現行顏色標示）；字色另由 core.js chip() 依對比自動決定。
   ⚠️ 四條無聲失敗規則（ui-rules）：
     ① 吃 CSS 變數的屬性不可掛 transition（本檔完全不用 transition）
     ② 字級縮放用 rem：html 的字級＝16px × --fs；頂欄、分頁列、膠囊、地圖控制鈕一律寫 px，不隨字級變
     ③ 內容框寬度寫 px（--maxw），字級怎麼調框寬都不變
     ④ 任何會被裁切的地方要看得出「還有東西」 */

:root {
  --fs: 1;
  --maxw: 760px;
  --topbar-h: 104px;
  --font: "Helvetica Neue", Arial, "Microsoft JhengHei", "微軟正黑體", "PingFang TC", "Noto Sans TC", sans-serif;

  /* 系統預設｜淺色（同 45_1） */
  --bg: #f7f7f8; --surface: #ffffff; --zebra: #f3f4f4; --border: #dddedf; --input-bd: #8f9499;
  --ink: #27292a; --ink2: #676b6f; --brand-text: #4f565f;
  --accent: #3f76a6; --link: #3f76a6; --link2: #2d5476;   /* link2：灰底（斑馬列）上的連結。#3f76a6 在 #f3f4f4 只有 4.38（2026-11-19 畫面驗收實測），改用同色相深一階（45_1 色票 note-text） */
  --th-bg: #ecedee; --badge-bg: #ebedef; --badge-text: #2e4a6b; --badge-bd: #cdd1d5;
  /* 主要動作鈕：冷藍底＋白字（4.93:1）。深淺兩主題共用同一個填色（全域 §五 fill 規則①） */
  --cta-bg: #3f76a6; --cta-fg: #ffffff;
  --ok-bg: #E3F1E8; --ok-fg: #1A5C38; --ok-bd: #7FB89A; --ok-text: #1A5C38;
  --warn-bg: #FBE8C8; --warn-fg: #7A4F00; --warn-bd: #D4A75C; --warn-text: #8A5A00;
  --bad-bg: #F9D8D3; --bad-fg: #962317; --bad-bd: #DE9086; --bad-text: #C0392B;
  --info-bg: #CFEAED; --info-fg: #0A5F67; --info-bd: #5FAEB7; --info-text: #0C676F;
  --hl-bg: rgba(14,124,134,0.12); --hl-bar: #0E7C86;
  /* 地圖：線的外框（casing），讓黃色環狀線、淺藍三鶯線在白底上看得出來 */
  --casing: #27292a; --map-bg: #f7f7f8; --node-fill: #ffffff; --node-bd: #27292a;
  --shadow: 0 2px 10px rgba(39,41,42,.08);
}
html[data-theme="dark"] {
  --bg: #141415; --surface: #1c1d1e; --zebra: #252627; --border: #393b3c; --input-bd: #6e7278;
  --ink: #eaebeb; --ink2: #a1a3a6; --brand-text: #8793a0;
  --accent: #679ccb; --link: #679ccb; --link2: #86b5df;
  --th-bg: #292b2e; --badge-bg: #272b30; --badge-text: #afb7c1; --badge-bd: #4a515a;
  --ok-bg: #16302A; --ok-fg: #4BD98A; --ok-bd: #2F6B52; --ok-text: #00C35E;
  --warn-bg: #382C18; --warn-fg: #F0B65C; --warn-bd: #6B5530; --warn-text: #E8A33D;
  --bad-bg: #3A211E; --bad-fg: #F0897A; --bad-bd: #6E403A; --bad-text: #E06C5C;
  --info-bg: #123035; --info-fg: #6FD5DE; --info-bd: #2E5B62; --info-text: #13ABB9;
  --hl-bg: rgba(19,171,185,0.16); --hl-bar: #13ABB9;
  --casing: #eaebeb; --map-bg: #141415; --node-fill: #1c1d1e; --node-bd: #eaebeb;
  --shadow: 0 2px 12px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--fs)); scroll-padding-top: calc(var(--topbar-h) + 12px); -webkit-text-size-adjust: 100%; overflow-y: scroll; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.65; padding-bottom: env(safe-area-inset-bottom, 0px); }
button, input, select, textarea { font-family: inherit; font-size: 1em; color: inherit; }
button { cursor: pointer; }
p, li, dd, td, .note, .muted, .small, label, summary, h2, h3 { text-wrap: pretty; }
.ph { display: inline-block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 300; font-size: 15px; }
.skip:focus { left: 8px; top: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ══ 頂欄（固定、不隨字級縮放）══ 分隔訊號：陰影＋2px 框線 */
.topbar { position: sticky; top: 0; z-index: 100; background: var(--surface); border-bottom: 2px solid var(--border); box-shadow: var(--shadow); padding-top: env(safe-area-inset-top, 0px); }
.tb-row, .tabs { padding-inline: max(16px, calc((100% - var(--maxw)) / 2 + 16px)); }
.tb-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; min-height: 52px; padding-block: 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; color: var(--brand-text); white-space: nowrap; }
.logo { display: inline-flex; width: 32px; height: 32px; border-radius: 9px; background: #ffffff; border: 1px solid var(--border); align-items: center; justify-content: center; font-size: 18px; color: #27292a; }
.tb-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fsz { display: flex; align-items: center; gap: 3px; }
.tbtn { height: 34px; min-width: 34px; padding: 0 10px; flex: none; white-space: nowrap; border: 1px solid var(--input-bd); border-radius: 9px; background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.tbtn.sq { width: 34px; padding: 0; }
.tbtn:disabled { opacity: .38; cursor: default; }
.fsval { min-width: 46px; text-align: center; font-size: 14px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; border-top: 1px solid var(--border); }
.tab { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 4px 8px; font-size: 15px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ══ 內容區（rem＝跟著字級縮放；寬度 px＝不跟著變）══ */
main { max-width: var(--maxw); margin: 0 auto; padding: 14px 16px 40px; font-size: 1.0625rem; }
.view > * + * { margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; min-width: 0; }
h2 { font-size: 1.0625rem; margin: 0 0 10px; color: var(--brand-text); }
h3 { font-size: 1rem; margin: 12px 0 6px; }
.muted { color: var(--ink2); font-size: .90625rem; }
.small { font-size: .90625rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note { margin: 8px 0 0; padding: 8px 11px; border-radius: 10px; background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd); font-size: .90625rem; }
.note.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.note.bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.note a, .note .linkbtn { color: inherit; }

.btn { min-height: 44px; padding: 8px 16px; border-radius: 11px; border: 1px solid var(--input-bd); background: var(--surface); color: var(--ink); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.cta { background: var(--cta-bg); color: var(--cta-fg); border-color: var(--cta-bg); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: .9375rem; }
.btn:disabled { opacity: .45; cursor: default; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--link); text-decoration: underline; font-weight: 600; text-align: left; }

/* 徽章（13.5px 下限）：資料等級 */
.bdg { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 8px; font-size: max(13.5px, .84375rem); font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--badge-bg); color: var(--badge-text); border: 1px solid var(--badge-bd); vertical-align: middle; }
.bdg.g-official { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.bdg.g-est, .bdg.g-derived { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.bdg.g-none { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.bdg.g-tag { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.bdg.wrap { white-space: normal; overflow-wrap: anywhere; }

/* 線碼徽章：實心（線色底＋自動字色）或外框（線色外框＋一般底與字）——core.js chip() 決定 */
.lc { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 7px; font-size: max(13.5px, .84375rem); font-weight: 700; line-height: 1.45; white-space: nowrap;
  background: var(--c); color: var(--f, #fff); border: 2px solid var(--c); vertical-align: middle; font-variant-numeric: tabular-nums; }
.lc.ring { background: var(--surface); color: var(--ink); }
.lc .nm { font-weight: 600; }

/* ══ 起訖點輸入 ══ */
.odrow { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px; align-items: center; }
.odrow + .odrow { margin-top: 8px; }
.odlbl { font-weight: 700; color: var(--ink2); font-size: .9375rem; }
.combo { position: relative; display: flex; gap: 6px; min-width: 0; }
.combo input { flex: 1; min-width: 0; height: auto; min-height: 48px; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--input-bd); background: var(--surface); font-size: max(16px, 1.0625rem); text-overflow: ellipsis; }
.combo input.set { border-color: var(--accent); }
.gps { flex: none; width: max(48px, 2.9rem); height: max(48px, 2.9rem); border-radius: 11px; border: 1.5px solid var(--input-bd); background: var(--surface); font-size: 1.25rem; padding: 0; }   /* 跟著字級放大（自我檢查 2026-11-19：200% 時原本固定 20px） */
.sugg { position: absolute; left: 0; right: 0; top: 52px; z-index: 50; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--input-bd);
  border-radius: 12px; box-shadow: var(--shadow); max-height: min(60svh, 420px); overflow-y: auto; }
.sugg li { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px; cursor: pointer; min-height: 44px; flex-wrap: wrap; }
.sugg li[aria-selected="true"], .sugg li:hover { background: var(--hl-bg); box-shadow: inset 4px 0 0 var(--hl-bar); }
.sugg .nm { font-weight: 600; }
.sugg .en { color: var(--ink2); font-size: .90625rem; }
.swapline { display: flex; justify-content: flex-end; margin: 6px 0 -2px; gap: 8px; flex-wrap: wrap; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.seg button { min-height: 44px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--input-bd); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9375rem; }
.seg button[aria-checked="true"] { background: var(--cta-bg); color: var(--cta-fg); border-color: var(--cta-bg); }
.timepick { margin-top: 10px; }
.timepick input { height: 46px; width: 100%; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--input-bd); background: var(--surface); font-size: max(16px, 1.0625rem); }
.opts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: stretch; margin-top: 12px; }
@container (max-width: 30em) { .opts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .opts { grid-template-columns: minmax(0, 1fr); } }
.tgl { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--zebra); cursor: pointer; min-width: 0; }
.tgl input { width: 24px; height: 24px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.tgl .t, .fsel .t { font-weight: 700; }
.tgl .d { display: block; color: var(--ink2); font-size: .90625rem; line-height: 1.5; }
.fsel { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 10px; background: var(--zebra); }
.fsel select { min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--input-bd); background: var(--surface); font-size: max(16px, 1rem); }
table.data tr.cur td { font-weight: 700; background: var(--hl-bg); }
button.bdg { cursor: help; font-family: inherit; }
.nearlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.nearlist li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--zebra); }
.nearlist .nm { font-weight: 700; }

/* ══ 方案卡 ══ */
.plan { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
.plan + .plan { margin-top: 10px; }
.plan .top { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.plan .tm { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan .dur { font-weight: 700; }
.plan .facts { display: flex; gap: 4px 12px; flex-wrap: wrap; color: var(--ink2); font-size: .9375rem; margin-top: 4px; }
.plan .seq { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; margin-top: 8px; }
.plan .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.legend { display: flex; gap: 6px 10px; flex-wrap: wrap; font-size: .90625rem; color: var(--ink2); }

/* ══ 搭乘圖說（時間軸）══ 左欄是線（線色＋外框），右欄是文字 */
.tl { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; margin-top: 10px; }
.tl .rail2 { position: relative; display: flex; flex-direction: column; align-items: center; }
.tl .bar { flex: 1; width: 8px; background: var(--c); box-shadow: 0 0 0 1.5px var(--casing); border-radius: 2px; min-height: 22px; }
.tl .bar.walk { background: repeating-linear-gradient(var(--ink2) 0 5px, transparent 5px 10px); box-shadow: none; width: 4px; }
.tl .dot { width: 18px; height: 18px; border-radius: 50%; border: 4px solid var(--c, var(--ink)); background: var(--surface); flex: none; box-shadow: 0 0 0 1.5px var(--casing); }
.tl .dot.xfer { width: 22px; height: 22px; border-color: var(--ink); }
.tl .txt { padding-bottom: 12px; min-width: 0; }
.tl .stn { font-weight: 700; font-size: 1.0625rem; }
.tl .tt { font-variant-numeric: tabular-nums; font-weight: 700; margin-right: 6px; }
.tl .sub { color: var(--ink2); font-size: .9375rem; }
.xcard { margin-top: 6px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--zebra); font-size: .9375rem; }
.xcard b { font-weight: 700; }
details.stops { margin-top: 4px; }
details.stops > summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: .9375rem; list-style: none; }
details.stops > summary::-webkit-details-marker { display: none; }
details.stops > summary::before { content: '▸ '; }
details.stops[open] > summary::before { content: '▾ '; }
table.st { width: 100%; border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums; margin-top: 6px; }
table.st th, table.st td { padding: 6px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
table.st th { background: var(--th-bg); font-weight: 700; }

/* ══ 長頁的區塊折疊與頂端圖卡（ui-rules ⑩）══ */
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(9.5em, 100%), 1fr)); gap: 6px; }
.toc a { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--ink); min-width: 0; }
.toc a b { font-size: .9375rem; }
.toc a span { color: var(--ink2); font-size: .875rem; }
.foldbar { display: flex; justify-content: flex-end; }
details.sec { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; }
details.sec > summary { cursor: pointer; font-weight: 700; color: var(--brand-text); list-style: none; display: flex; gap: 6px 10px; align-items: baseline; flex-wrap: wrap; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: '▸'; color: var(--ink2); flex: none; }
details.sec[open] > summary::before { content: '▾'; }
details.sec > summary .sum { font-weight: 400; color: var(--ink2); font-size: .90625rem; }
details.sec > .body { margin-top: 10px; }

/* 車站頁 */
.sthead { display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; }
.sthead .nm { font-size: 1.375rem; font-weight: 700; }
.sthead .en { color: var(--ink2); }
.deps { display: grid; gap: 8px; }
.dep { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 10px; border-radius: 10px; background: var(--zebra); align-items: center; }
.dep .to { font-weight: 700; }
.dep .times { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.0625rem; }
.dep .fl { grid-column: 1 / -1; color: var(--ink2); font-size: .90625rem; }
.exits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.exits li { padding: 8px 10px; border-radius: 10px; background: var(--zebra); }
.exits .eh { display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; }
.exits .eid { font-weight: 700; }
.exits a, .xcard a, .nearlist a:not(.btn), .dep a, .linelist a { color: var(--link2); }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--ink2); font-weight: 600; font-size: .9375rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ══ 路網圖 ══ */
.mapwrap { position: relative; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--map-bg);
  height: max(320px, calc(100svh - var(--topbar-h) - 210px)); touch-action: none; }
.mapwrap svg { display: block; cursor: grab; }
.mapwrap svg.drag { cursor: grabbing; }
.mapwrap .seg-c { stroke: var(--casing); }
.mapwrap .node { fill: var(--node-fill); stroke: var(--node-bd); }
.mapwrap .lbl { fill: var(--ink); font-size: calc(var(--mapfs, 13.5px) * var(--k, 1)); font-weight: 600; paint-order: stroke; stroke: var(--map-bg); stroke-width: calc(3px * var(--k, 1)); }
.mapwrap .lbl.xf { font-weight: 800; }
.mapwrap .hit { fill: transparent; stroke: none; cursor: pointer; }
.mapctl { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.mapctl button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--input-bd); background: var(--surface); color: var(--ink); font-size: 18px; font-weight: 700; padding: 0; box-shadow: var(--shadow); }
.maphint { margin: 6px 0 0; }   /* 放在地圖框外：放在框內會蓋住底部的站（2026-11-19 實測蓋住頂埔一帶） */
.mappop { position: absolute; left: 8px; right: 56px; top: 8px; z-index: 6; background: var(--surface); border: 1px solid var(--input-bd); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 15px; }
.mappop .row { margin-top: 6px; }
.linefilter { display: flex; gap: 6px; flex-wrap: wrap; }
.linefilter button { border: 0; padding: 0; background: none; border-radius: 9px; }
.linefilter button[aria-pressed="false"] .lc { opacity: .45; }
.linefilter .all { padding: 2px 10px; border: 1px solid var(--input-bd); border-radius: 9px; background: var(--surface); font-weight: 600; font-size: max(13.5px, .84375rem); min-height: 30px; }
.linelist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.linelist button { border: 1px solid var(--border); background: var(--zebra); border-radius: 8px; padding: 3px 8px; font-size: .9375rem; }

/* 可左右捲的表格：兩側點得到的捲動鈕＋常駐捲軸（ui-rules ⑨；使用者從遠端桌面用滑鼠） */
.hsw { position: relative; }
.hs { overflow-x: auto; }
.hs::-webkit-scrollbar { height: 12px; }
.hs::-webkit-scrollbar-thumb { background: var(--input-bd); border-radius: 6px; }
.hs::-webkit-scrollbar-track { background: var(--zebra); }
@supports not selector(::-webkit-scrollbar) { .hs { scrollbar-width: auto; scrollbar-color: var(--input-bd) var(--zebra); } }
.harr { position: absolute; top: 2px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--input-bd); background: var(--surface); color: var(--ink); font-size: 18px; font-weight: 700; padding: 0; box-shadow: var(--shadow); }
.harr.l { left: 2px; } .harr.r { right: 2px; }
table.data { border-collapse: collapse; font-size: .9375rem; min-width: 100%; }
table.data th, table.data td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data th { background: var(--th-bg); }
.wlist { margin: 6px 0 0; padding-left: 1.2em; }
.wlist li + li { margin-top: 4px; }

/* ══ 側邊導覽膠囊（四件套；尺寸固定、不隨字級縮放；位置由 JS 量測）══ */
.rail { position: fixed; left: var(--railx, calc(100% - 64px)); top: 50%; transform: translateY(-50%); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 7px;
  border: 1px solid var(--border); border-radius: 29px; background: var(--surface); box-shadow: var(--shadow); font-size: 15px; }
.rbtn { width: 36px; height: 36px; flex: none; padding: 0; border-radius: 50%; border: 1px solid var(--input-bd); background: var(--surface); color: var(--ink); font-size: 17px; font-weight: 700; line-height: 1; display: flex; align-items: center; justify-content: center; }
.rbtn:disabled { opacity: .34; cursor: default; }
#r-top { background: var(--cta-bg); color: var(--cta-fg); border-color: var(--cta-bg); }
#r-top:disabled { background: var(--zebra); color: var(--ink2); border-color: var(--border); }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 400; max-width: min(92vw, 520px); background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: 12px; font-size: 15px; line-height: 1.5; box-shadow: var(--shadow); }
#toast:empty { display: none; }
.loadbox { text-align: center; padding: 40px 16px; color: var(--ink2); }

@media (max-width: 960px) {
  /* 窄幕：膠囊轉橫排收到右下角（垂直置中會壓在內容正中間）；四顆鈕全部留著。transform:none 不可省 */
  .rail { left: auto; right: 8px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: none; flex-direction: row; padding: 6px 7px; }
  main { padding-bottom: 96px; }
}
@media (max-width: 420px) {
  .tbtn .tt { display: none; }
  #theme { width: 38px; padding: 0; }
  .logo { width: 30px; height: 30px; font-size: 17px; }
  .brand { gap: 6px; font-size: 16px; }
  .fsval { min-width: 42px; }
  .rail { gap: 5px; padding: 5px 6px; }
  .rbtn { width: 32px; height: 32px; font-size: 16px; }
}
@media (max-width: 340px) { .bname { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0s !important; scroll-behavior: auto !important; } }

/* 列印：收合的內容要印出來、控制項不上紙（ui-rules ⑩②；另有 beforeprint JS 那一道） */
@media print {
  .topbar, .rail, #toast, .skip, .mapctl, .foldbar, .harr, .gps, .seg, .swapline { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; font-size: 11pt; }
  .card, details.sec, .plan { border-color: #999; break-inside: avoid; }
  details { display: block !important; }
  details > * { display: revert !important; }
  details::details-content { content-visibility: visible !important; block-size: auto !important; }
  .muted, .small, .note, .bdg, .lc, table.st, table.data, .sub { font-size: 9.5pt !important; }
  h2 { font-size: 12pt; }
}
