/* 國語除錯 — 樣式 */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --text: #1e1c19;
  --muted: #6c675f;
  --line: #e2ddd3;
  --accent: #2b6b66;
  --accent-ink: #ffffff;
  --accent-soft: #e0eeeb;
  --good: #2c7a4d;
  --good-soft: #e2f2e8;
  --bad: #b13f2c;
  --bad-soft: #f9e5e0;
  --warn: #9a6400;
  --warn-soft: #f8edd6;
  --info: #4a5f8a;
  --info-soft: #e6ebf5;
  --hm0: #e9e5dd; --hm1: #cfe3df; --hm2: #8fc2ba; --hm3: #4f9990; --hm4: #2b6b66;
  --shadow: 0 1px 2px rgba(30, 28, 25, .04), 0 6px 24px rgba(30, 28, 25, .06);
  --radius: 16px;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", "Source Han Sans TC", "WenQuanYi Zen Hei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sent: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", "WenQuanYi Zen Hei", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141412; --surface: #1d1d1a; --surface-2: #272723; --text: #ecebe6; --muted: #a39e94; --line: #33312c;
    --accent: #6cbdb2; --accent-ink: #0f1a19; --accent-soft: #1d3331;
    --good: #6fc391; --good-soft: #1b3324; --bad: #ef8d79; --bad-soft: #3b211c; --warn: #e2b45c; --warn-soft: #3a2f18; --info: #9db2e0; --info-soft: #222b3d;
    --hm0: #24241f; --hm1: #1f3a37; --hm2: #2c5d57; --hm3: #3f8b82; --hm4: #6cbdb2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141412; --surface: #1d1d1a; --surface-2: #272723; --text: #ecebe6; --muted: #a39e94; --line: #33312c;
  --accent: #6cbdb2; --accent-ink: #0f1a19; --accent-soft: #1d3331;
  --good: #6fc391; --good-soft: #1b3324; --bad: #ef8d79; --bad-soft: #3b211c; --warn: #e2b45c; --warn-soft: #3a2f18; --info: #9db2e0; --info-soft: #222b3d;
  --hm0: #24241f; --hm1: #1f3a37; --hm2: #2c5d57; --hm3: #3f8b82; --hm4: #6cbdb2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.65; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .4em; letter-spacing: .02em; }
h1 { font-size: 1.6rem; }
p { margin: 0 0 .7em; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .9em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .8rem; }
.block { display: block; }
.hidden { display: none !important; }
.grow { flex: 1; }
.ico { display: inline-flex; vertical-align: middle; }

/* ─── 外框 ─── */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; letter-spacing: .08em; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 6px; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav-a { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; color: var(--muted); font-size: .92rem; }
.nav-a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-a.active { color: var(--accent); background: var(--accent-soft); }
.gear { padding: 6px 8px; }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 16px 56px; }
main:focus { outline: none; }
.tabbar { display: none; }

@media (max-width: 720px) {
  .clock { display: none; }
  .home-top { padding-top: 4px; }
  .nav { display: none; }
  .gear { margin-left: auto; }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: .72rem; color: var(--muted); padding: 4px 0; border-radius: 10px; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
}

/* ─── 通用元件 ─── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 0 0 16px; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card-h { font-size: 1.05rem; margin-bottom: .7em; }
.page-head { margin: 12px 0 20px; }
.page-head p { max-width: 60ch; }
.sec { font-size: 1rem; margin: 28px 0 12px; color: var(--muted); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.actions.center { justify-content: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 8px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: .95rem; line-height: 1.3; text-decoration: none; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: default; opacity: .55; transform: none; }
.btn.opt.right { border-color: var(--good); background: var(--good-soft); opacity: 1; }
.btn.opt.wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: .85rem; border-radius: 10px; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.5em; height: 1.5em; padding: 0 .3em;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .72rem; color: var(--muted); background: var(--surface-2);
}
@media (hover: none) { kbd, .kbd-hint { display: none !important; } }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.bar.thin { height: 5px; }

.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.st-open { background: var(--surface-2); color: var(--muted); }
.st-wip { background: var(--warn-soft); color: var(--warn); }
.st-fixed { background: var(--good-soft); color: var(--good); }
.st-stable { background: var(--accent); color: var(--accent-ink); }
.badge.focus { background: var(--accent-soft); color: var(--accent); }
.badge.lv-err { background: var(--bad-soft); color: var(--bad); }
.badge.lv-warn { background: var(--warn-soft); color: var(--warn); }
.badge.lv-info { background: var(--info-soft); color: var(--info); }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); min-width: 0; }
.tag:hover { color: var(--accent); text-decoration: none; }
.tag-no { font-weight: 700; letter-spacing: .06em; color: var(--accent); white-space: nowrap; }
.tag-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.say { display: inline-flex; align-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 4px; margin-left: 4px; border-radius: 6px; vertical-align: middle; }
.say:hover { color: var(--accent); background: var(--surface-2); }
.say svg { width: 16px; height: 16px; }

/* ─── 首頁 ─── */
.home-top { text-align: center; padding: clamp(8px, 5vh, 48px) 0 18px; }
.clock { font-size: clamp(3rem, 9vw, 4.6rem); font-weight: 200; letter-spacing: .04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.date { color: var(--muted); margin-top: 6px; font-size: .95rem; }
.stats-strip { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 6px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .88rem; min-height: 36px; }
.pill:hover { text-decoration: none; border-color: var(--accent); }
.pill .flame { font-size: 1rem; padding-left: 4px; }
.ring { position: relative; display: inline-flex; width: 28px; height: 28px; }
.ring svg { width: 28px; height: 28px; }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: .6rem; }
.welcome h2 { font-size: 1.15rem; }
.stage { margin: 8px 0 18px; }
.tips { text-align: center; margin-top: 8px; }
.tip { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: baseline; color: var(--text); font-size: .92rem; }
.tip-k { font-size: .75rem; color: var(--accent); font-weight: 700; letter-spacing: .1em; }
.tip.sub { display: block; color: var(--muted); font-size: .82rem; margin-top: 8px; }
.done-card { text-align: center; padding: 32px 20px; }
.big { font-size: 2.4rem; line-height: 1; margin-bottom: 10px; }

/* ─── 練習卡片 ─── */
.ex { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px 20px; box-shadow: var(--shadow); transition: border-color .2s; }
.ex.is-ok { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.ex.is-bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mode { font-size: .78rem; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.mode .new { background: var(--accent-soft); color: var(--accent); padding: 0 7px; border-radius: 99px; font-weight: 700; }
.ask { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.sent { font-family: var(--font-sent); font-size: clamp(1.25rem, 3.6vw, 1.55rem); line-height: 1.6; margin: 4px 0 18px; letter-spacing: .03em; }
.sent.src { font-size: 1.15rem; color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 50%, transparent); text-decoration-thickness: 1.5px; margin-bottom: 14px; }
.sent.scene { font-size: 1.08rem; line-height: 1.7; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.opt { min-height: 52px; justify-content: flex-start; padding: 10px 14px; font-size: 1rem; gap: 10px; border-radius: 14px; text-align: left; }
.row2 .btn.opt { justify-content: center; }
.btn.opt.yes:hover:not(:disabled) { border-color: var(--good); background: var(--good-soft); }
.btn.opt.no:hover:not(:disabled) { border-color: var(--bad); background: var(--bad-soft); }
.opts { display: grid; gap: 10px; }
.opts.inline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.sent-opt span { font-family: var(--font-sent); font-size: 1.1rem; line-height: 1.5; }
.btn.opt:hover:not(:disabled) { border-color: var(--accent); }
.blank { display: inline-block; min-width: 3em; padding: 0 .3em; border-bottom: 2px solid var(--accent); color: var(--accent); text-align: center; }
.blank.filled { font-weight: 700; }
.ex.is-ok .blank { color: var(--good); border-color: var(--good); }
.ex.is-bad .blank { color: var(--bad); border-color: var(--bad); text-decoration: line-through; }
.slot { min-height: 58px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 1.5px dashed var(--line); border-radius: 14px; margin-bottom: 12px; background: var(--bg); }
.slot-ph { color: var(--muted); font-size: .88rem; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 44px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-family: var(--font-sent); font-size: 1.08rem; cursor: pointer; line-height: 1.3; min-height: 40px; }
.chip:hover:not(:disabled) { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: transparent; }
.chip kbd { font-size: .65rem; }
.row-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
textarea.type, .field, .lint-input {
  width: 100%; font: inherit; font-size: 1.1rem; line-height: 1.6; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; resize: vertical;
}
textarea.type:focus, .field:focus, .lint-input:focus { outline: none; border-color: var(--accent); }
textarea.type:disabled { opacity: .7; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.selfgrade:not(:empty) { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.selfgrade .row2 { margin-top: 12px; }

.ex-fb:not(:empty) { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.verdict { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.verdict strong { font-size: 1.05rem; }
.verdict.ok strong { color: var(--good); }
.verdict.bad strong { color: var(--bad); }
.verdict span { color: var(--muted); font-size: .88rem; }
.lines { display: grid; gap: 6px; }
.line { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 12px; font-family: var(--font-sent); font-size: 1.05rem; line-height: 1.55; }
.line .mk { flex: none; font-family: var(--font); font-size: .78rem; font-weight: 700; min-width: 1.4em; }
.line.bad { background: var(--bad-soft); }
.line.bad .mk { color: var(--bad); }
.line.bad > span:nth-child(2) { color: color-mix(in srgb, var(--text) 75%, var(--bad)); }
.line.good { background: var(--good-soft); }
.line.good .mk { color: var(--good); }
.line.you { background: var(--surface-2); }
.line.you .mk { color: var(--muted); }
.line mark { background: transparent; color: var(--good); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.diff del { color: var(--bad); text-decoration: line-through; background: var(--bad-soft); border-radius: 3px; }
.diff ins { color: var(--good); text-decoration: none; background: var(--good-soft); border-radius: 3px; font-weight: 700; }
.mini { font-size: .85rem; color: var(--muted); margin: 2px 4px; }
.note { margin: 12px 2px 0; font-size: .92rem; color: var(--text); }
.lint-mini { margin: 4px 0; padding-left: 1.2em; font-size: .88rem; }
.lint-mini li { margin: 4px 0; }
.kbd-hint { font-size: .75rem; color: var(--muted); margin-left: auto; }
.ex.compact .sent { margin-bottom: 16px; }

/* ─── 練習頁 ─── */
.session-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 12px 0 10px; }
.session-head h1 { font-size: 1.3rem; }
.session-head p { margin: 0; font-size: .88rem; }
.prog-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.prog-row .bar { flex: 1; }
.summary { text-align: center; padding: 32px 20px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0; }
a.chip { font-family: var(--font); font-size: .85rem; color: var(--text); }
a.chip:hover { text-decoration: none; }
.chip.ok { background: var(--good-soft); border-color: transparent; }
.chip.bad { background: var(--warn-soft); border-color: transparent; }

/* ─── 學習 ─── */
.bug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 12px; }
.bug-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.bug-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.bug-card.focus { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.bug-card h3 { font-size: 1.05rem; margin: 8px 0 2px; }
.bug-card p { margin-bottom: 10px; }
.bug-card .tiny { margin: 8px 0 0; }
.bc-top { display: flex; align-items: center; gap: 6px; }
.bc-no { font-weight: 700; color: var(--accent); letter-spacing: .06em; margin-right: auto; font-size: .9rem; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; margin: 8px 0; }
.study-head { margin: 8px 0 20px; }
.study-no { color: var(--accent); font-weight: 700; letter-spacing: .08em; font-size: .9rem; }
.study-head h1 { font-size: clamp(1.5rem, 5vw, 2rem); margin-top: 6px; }
.lead { color: var(--muted); font-size: 1.05rem; }
.study-meta { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.rule-box, .check-box { border-radius: var(--radius); padding: 18px 20px; margin: 0 0 24px; }
.rule-box { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.rule-box p { font-size: 1.08rem; margin: 6px 0 0; }
.rule-box b { color: var(--accent); }
.rule-box .mn { font-size: .95rem; margin-top: 10px; color: var(--text); }
.check-box { background: var(--warn-soft); }
.check-box p { margin: 6px 0 0; }
.rb-k { font-size: .75rem; font-weight: 700; letter-spacing: .12em; color: var(--accent); }
.check-box .rb-k { color: var(--warn); }
.study-sec { margin: 0 0 26px; }
.study-sec h2 { font-size: 1.1rem; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.formula { display: grid; gap: 8px; }
.f-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; align-items: center; }
.f-pat { font-weight: 600; color: var(--accent); font-size: .95rem; }
.f-ex { font-family: var(--font-sent); }
@media (max-width: 560px) { .f-row { grid-template-columns: 1fr; gap: 2px; } }
.contrast { display: grid; gap: 10px; }
.c-row { display: grid; gap: 4px; }
.edges { padding-left: 1.2em; margin: 0; }
.edges li { margin: 0 0 10px; }
.edges b { color: var(--accent); font-weight: 600; }
.mine { display: grid; gap: 6px; }
.m-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .95rem; }
.m-date { color: var(--muted); font-size: .78rem; }
.m-bad { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
.m-arrow { color: var(--muted); }
.m-good { color: var(--good); font-weight: 600; }
@media (max-width: 560px) { .m-row { grid-template-columns: 1fr; gap: 0; } .m-arrow { display: none; } }
.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 30px; flex-wrap: wrap; }
.pager .btn { max-width: 100%; }

/* ─── 檢查器 ─── */
.lint-input { min-height: 120px; }
.lint-preview { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-family: var(--font-sent); font-size: 1.08rem; line-height: 1.9; min-height: 3em; word-break: break-word; }
mark.lv-err, mark.lv-warn, mark.lv-info { color: inherit; border-radius: 4px; padding: 1px 0; }
mark.lv-err { background: var(--bad-soft); box-shadow: inset 0 -2px 0 var(--bad); }
mark.lv-warn { background: var(--warn-soft); box-shadow: inset 0 -2px 0 var(--warn); }
mark.lv-info { background: var(--info-soft); box-shadow: inset 0 -2px 0 var(--info); }
.lint-sum { margin: 12px 0; }
.lint-list { display: grid; gap: 10px; }
.lint-item { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.lint-item.lv-err { border-left-color: var(--bad); }
.lint-item.lv-warn { border-left-color: var(--warn); }
.lint-item.lv-info { border-left-color: var(--info); }
.lint-item p { margin: 8px 0 0; }
.lint-item .actions { margin-top: 8px; }
.li-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.li-top .btn { margin-left: auto; }

/* ─── 進度 ─── */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 600px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-v { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile-k { font-size: .85rem; color: var(--muted); }
.tile-s { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); gap: 3px; justify-content: start; }
.hm-cell { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--hm0); min-width: 8px; }
.hm-cell.l1 { background: var(--hm1); } .hm-cell.l2 { background: var(--hm2); } .hm-cell.l3 { background: var(--hm3); } .hm-cell.l4 { background: var(--hm4); }
.hm-cell.future { background: transparent; }
.hm-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.hm-legend .hm-cell { width: 11px; min-width: 11px; }
.bug-table { display: grid; gap: 2px; }
.bt-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) auto; grid-template-areas: "name bar st" "meta meta meta"; gap: 2px 12px; align-items: center; padding: 10px 8px; border-radius: 10px; color: var(--text); }
.bt-row:hover { background: var(--surface-2); text-decoration: none; }
.bt-name { grid-area: name; display: flex; gap: 8px; align-items: baseline; font-weight: 600; font-size: .9rem; min-width: 0; }
.bt-title { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-bar { grid-area: bar; }
.bt-row .badge { grid-area: st; }
.bt-meta { grid-area: meta; }

/* ─── 表單／設定 ─── */
.form label { display: grid; gap: 4px; margin-bottom: 12px; font-size: .88rem; color: var(--muted); }
.field { font-size: 1rem; }
select.field { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.note-list { display: grid; gap: 10px; }
.note-item { padding: 14px 16px; margin: 0; display: grid; gap: 6px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.set-row:first-of-type { border-top: 0; }
.set-row p { margin: 0; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 12px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: .9rem; min-height: 34px; font-variant-numeric: tabular-nums; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); font-weight: 600; }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.tg-ui { flex: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; margin-top: 2px; }
.tg-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.toggle input:checked + .tg-ui { background: var(--accent); }
.toggle input:checked + .tg-ui::after { transform: translateX(18px); }
.toggle input:focus-visible + .tg-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.focus-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.fchip { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 99px; cursor: pointer; font-size: .86rem; color: var(--muted); }
.fchip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.warn-text { color: var(--warn); min-height: 1em; margin: 0; }
.danger { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.danger-btn { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: transparent; }
.danger-btn:hover { background: var(--bad-soft); }

/* ─── 說明頁 ─── */
.method .how { color: var(--accent); font-weight: 600; margin: 0; }
.steps { padding-left: 1.3em; margin: 0 0 8px; }
.steps li { margin: 0 0 6px; }

@media (max-width: 720px) {
  .home-top { padding: 0 0 12px; }
  .stats-strip { margin-top: 6px; gap: 6px; }
  .pill { font-size: .8rem; padding: 2px 10px 2px 4px; min-height: 32px; gap: 6px; }
  .ring, .ring svg { width: 24px; height: 24px; }
  .ex { padding: 16px; border-radius: 18px; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
