/* ==========================================================================
   放假了嗎？ — 豪雨停班停課即時監測
   警戒色階採台灣防災慣用的 黃→橙→紅→紫，中性色偏冷藍以貼近氣象主題。
   ========================================================================== */

:root {
  color-scheme: light dark;

  --s0: #67808F;  --s0-bg: #EAEFF2;
  --s1: #B8830D;  --s1-bg: #FAF0D6;
  --s2: #D2621B;  --s2-bg: #FBE6D7;
  --s3: #C42F20;  --s3-bg: #FADEDA;
  --s4: #8A34A0;  --s4-bg: #F3E2F7;

  --paper: #E9EEF1;
  --surface: #FFFFFF;
  --surface-2: #F3F7F9;
  --surface-3: #E6ECF0;
  --ink: #101C26;
  --ink-2: #354B59;
  --muted: #5E7481;
  --faint: #85979F;
  --rule: #D0DAE0;
  --rule-soft: #E2E9ED;
  --accent: #17587F;
  --accent-ink: #114761;
  --accent-wash: #DFECF3;
  --sea: #D9E4EA;
  --ty-sea: #C8DCE8;
  --ty-land: #E8EDE6;

  --shadow-1: 0 1px 2px rgba(16, 32, 44, .06);
  --shadow-2: 0 2px 4px rgba(16, 32, 44, .06), 0 12px 28px -18px rgba(16, 32, 44, .35);

  --sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Helvetica Neue", sans-serif;
  --num: "Barlow Semi Condensed", "Noto Sans TC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r: 12px;
  --r-sm: 7px;
  --gap: 16px;
}

/* 作者樣式會蓋掉瀏覽器預設的 [hidden]{display:none}：
   只要某個元素被寫了 display:grid/flex，加 hidden 就沒有用了（我們踩過）。
   統一在這裡壓住，之後 .hidden 切換才可靠。 */
[hidden] { display: none !important; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s0: #8098A8;  --s0-bg: #1E2A34;
    --s1: #E5B647;  --s1-bg: #342A10;
    --s2: #F79049;  --s2-bg: #3A2210;
    --s3: #F26652;  --s3-bg: #391A15;
    --s4: #C97CDA;  --s4-bg: #2E1936;

    --paper: #0A1117;
    --surface: #131E27;
    --surface-2: #19252F;
    --surface-3: #202E3A;
    --ink: #E4EDF2;
    --ink-2: #B7C7D1;
    --muted: #93A5B1;
    --faint: #6F818E;
    --rule: #2B3B48;
    --rule-soft: #22313B;
    --accent: #5FAEDE;
    --accent-ink: #8DC8EA;
    --accent-wash: #12303F;
    --sea: #0E1820;
    --ty-sea: #0C1922;
    --ty-land: #23303A;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, .35), 0 14px 30px -20px rgba(0, 0, 0, .8);
  }
}

:root[data-theme="dark"] {
  --s0: #8098A8;  --s0-bg: #1E2A34;
  --s1: #E5B647;  --s1-bg: #342A10;
  --s2: #F79049;  --s2-bg: #3A2210;
  --s3: #F26652;  --s3-bg: #391A15;
  --s4: #C97CDA;  --s4-bg: #2E1936;

  --paper: #0A1117;
  --surface: #131E27;
  --surface-2: #19252F;
  --surface-3: #202E3A;
  --ink: #E4EDF2;
  --ink-2: #B7C7D1;
  --muted: #93A5B1;
  --faint: #6F818E;
  --rule: #2B3B48;
  --rule-soft: #22313B;
  --accent: #5FAEDE;
  --accent-ink: #8DC8EA;
  --accent-wash: #12303F;
  --sea: #0E1820;
  --ty-sea: #0C1922;
  --ty-land: #23303A;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, .35), 0 14px 30px -20px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.35; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.num { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.shell { max-width: 1480px; margin: 0 auto; padding: 0 20px 92px; }
@media (max-width: 700px) { .shell { padding: 0 12px 80px; } }

/* ── 頂列 ───────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar-in {
  max-width: 1480px; margin: 0 auto; padding: 8px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
@media (max-width: 700px) { .topbar-in { padding: 7px 12px; gap: 10px; } }

.topbar-prog { height: 2px; background: transparent; overflow: hidden; }
.topbar-prog i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent));
  transition: width 1s linear;
}

.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; min-width: 0; }
.brand-mark { display: grid; place-items: center; flex: none; line-height: 0; }
.brand-mark svg { display: block; filter: drop-shadow(0 2px 5px rgba(23, 88, 127, .3)); }
.brand-txt { min-width: 0; display: block; }
.brand-txt b {
  display: block; font-size: 21px; font-weight: 900; letter-spacing: .015em;
  line-height: 1.2; white-space: nowrap; color: var(--ink);
}
.brand-txt b i { font-style: normal; color: var(--accent); }
.brand-txt > span {
  display: block; font-size: 11.5px; color: var(--faint);
  letter-spacing: .04em; white-space: nowrap; line-height: 1.35;
}
@media (max-width: 700px) { .brand-txt b { font-size: 19px; } }
@media (max-width: 400px) { .brand-txt > span { display: none; } }

.top-stat {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.top-stat b { font-family: var(--num); font-size: 18px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.top-stat.next { font-family: var(--mono); font-size: 12px; color: var(--faint); min-width: 96px; justify-content: flex-end; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--s0); flex: none; }
.dot.live { background: #2F9A67; box-shadow: 0 0 0 0 rgba(47, 154, 103, .6); animation: pulse 2.6s infinite; }
.dot.busy { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(47, 154, 103, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 154, 103, 0); } }
@media (prefers-reduced-motion: reduce) { .dot.live, .dot.busy { animation: none; } }

.btn {
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2);
  border-radius: var(--r-sm); padding: 7px 13px; font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-ink); }
.btn.spin svg { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 620px) {
  .topbar-in { flex-wrap: nowrap; }
  .top-stat.stn, .top-stat.next { display: none; }
  .btn > span { display: none; }
  .btn { padding: 8px 10px; }
}
@media (max-width: 430px) { #liveTxt { display: none; } }

/* ── 主答案橫幅 ─────────────────────────────────────────────── */
.banner {
  margin: var(--gap) 0 0; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--rule); background: var(--surface); box-shadow: var(--shadow-2);
  display: grid; grid-template-columns: 9px 1fr;
}
.banner-bar { background: var(--s0); }
.banner-in { padding: 24px 28px; display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
@media (max-width: 700px) { .banner-in { padding: 18px 16px; gap: 16px; } }
.banner-lead { flex: 1 1 340px; min-width: 0; }
.banner-eyebrow {
  font-size: 12.5px; letter-spacing: .1em; color: var(--muted);
  display: block; margin-bottom: 8px; font-weight: 500;
}
.banner-title {
  font-size: clamp(26px, 4.4vw, 42px); font-weight: 900;
  letter-spacing: -.015em; line-height: 1.25; text-wrap: balance;
}
.banner-sub { margin-top: 10px; color: var(--muted); font-size: 15.5px; line-height: 1.75; }
.banner-kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi {
  background: var(--surface-2); border: 1px solid var(--rule-soft); border-radius: var(--r-sm);
  padding: 10px 15px; min-width: 88px;
}
.kpi-v { font-family: var(--num); font-size: 32px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
@media (max-width: 700px) {
  .banner-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
  .kpi { min-width: 0; padding: 9px 10px; }
  .kpi-v { font-size: 27px; }
  .kpi-l { font-size: 11.5px; white-space: normal; }
}

/* ── 觀察小卡 ───────────────────────────────────────────────── */
/* 抽屜裡的行政區清單 */
.twns { display: grid; gap: 2px; }
.twn {
  display: grid; grid-template-columns: minmax(88px, 1.1fr) minmax(60px, 1.7fr) 62px 42px 66px 70px;
  align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; font-size: 13px;
}
.twn.me { background: var(--accent-wash); outline: 1px solid var(--accent); }
.twn-n { color: var(--ink); font-weight: 500; display: flex; align-items: baseline; gap: 5px; }
.twn-n i { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--s2); background: var(--s2-bg); padding: 1px 5px; border-radius: 3px; }
.twn-n b { font-size: 10.5px; color: var(--accent-ink); font-weight: 700; }
.twn-bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.twn-bar i { display: block; height: 100%; border-radius: 4px; }
.twn-v { font-family: var(--num); font-weight: 700; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.twn-v u { text-decoration: none; font-family: var(--sans); font-size: 10.5px; color: var(--faint); margin-left: 2px; }
.twn-p { font-family: var(--num); font-size: 13.5px; color: var(--muted); text-align: right; }
.twn-w { font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; }
.twn-h1 { font-size: 11.5px; color: var(--faint); text-align: right; }
.twn-foot { font-size: 12px; color: var(--faint); line-height: 1.6; margin-top: 8px; }
@media (max-width: 560px) {
  .twn { grid-template-columns: minmax(76px, 1fr) minmax(30px, 1fr) 56px 40px 62px; }
  .twn-h1 { display: none; }
}

/* ── 我家那一區 ─────────────────────────────────────────────
   放在橫幅正下方：多數人打開這個網站只想知道「我家會不會放假」，
   縣市清單是第二順位。設定前是一張邀請卡，設定後變成自己的看板。 */
.mine {
  margin-top: var(--gap); border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--rule); background: var(--surface); box-shadow: var(--shadow-1);
  display: grid; grid-template-columns: 6px 1fr;
}
.mine-bar { background: var(--accent); }
.mine-in { padding: 16px 18px; min-width: 0; }

.mine-ask { display: grid; gap: 10px; }
.mine-ask-t b { font-size: 17px; font-weight: 700; margin-right: 8px; }
.mine-ask-t span { font-size: 13.5px; color: var(--muted); }
.mine-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mine-actions .btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700;
}
.mine-actions .btn.primary:hover { filter: brightness(1.08); color: #fff; }
.mine-actions .btn.busy { opacity: .6; }
.mine-or { font-size: 12.5px; color: var(--faint); }
.mine-actions select {
  font: inherit; font-size: 13.5px; color: var(--ink-2);
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--surface); padding: 6px 10px; cursor: pointer;
}
.mine-actions select:disabled { color: var(--faint); cursor: default; }
.mine-note { font-size: 12px; color: var(--faint); }

.mine-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mine-eyebrow { font-size: 11.5px; color: var(--faint); letter-spacing: .06em; display: block; }
.mine-where h2 { font-size: 15px; font-weight: 500; color: var(--muted); }
.mine-where h2 b { font-size: 24px; font-weight: 900; color: var(--ink); margin-left: 4px; }
.mine-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mine-change { margin-left: auto; }

.mine-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.mine-num {
  background: var(--surface-2); border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm); padding: 9px 12px;
}
.mine-num.on { border-color: var(--accent); background: var(--accent-wash); }
.mine-num dt { font-size: 11.5px; color: var(--muted); }
.mine-num dd {
  font-family: var(--num); font-size: 27px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums; margin: 1px 0 2px;
}
.mine-num dd u { text-decoration: none; font-family: var(--sans); font-size: 11.5px; color: var(--faint); margin-left: 4px; }
.mine-num small { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.mine-meter { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.mine-meter i { display: block; height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.2,.7,.3,1); }

.mine-say { font-size: 14px; color: var(--ink-2); line-height: 1.7; margin-top: 10px; }
.mine-far { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.mine-high { display: block; color: var(--s2); font-size: 13px; margin-top: 2px; }
.mine-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.mine-tip { font-size: 12px; color: var(--faint); }

/* 縣市內雨最多的行政區：選了縣市之後，原本空白的地方拿來放這個 */
.rk { margin-top: 12px; border: 1px solid var(--rule-soft); border-radius: var(--r-sm); overflow: hidden; }
.rk-h {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 7px 11px; background: var(--surface-2); border-bottom: 1px solid var(--rule-soft);
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.rk-h span { font-size: 11.5px; font-weight: 400; color: var(--faint); margin-left: auto; }
.rk-list { display: grid; }
.rk-item {
  display: grid; grid-template-columns: 20px minmax(72px, 1fr) minmax(40px, 1.6fr) 66px 74px;
  align-items: center; gap: 9px; padding: 7px 11px; font: inherit; font-size: 13px;
  background: none; border: 0; border-top: 1px solid var(--rule-soft); cursor: pointer; text-align: left;
}
.rk-item:first-child { border-top: 0; }
.rk-item:hover { background: var(--accent-wash); }
.rk-i { font-family: var(--num); font-weight: 700; color: var(--faint); }
.rk-n { color: var(--ink); font-weight: 500; display: flex; align-items: baseline; gap: 5px; }
.rk-n i { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--s2); background: var(--s2-bg); padding: 1px 5px; border-radius: 3px; }
.rk-bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; border-radius: 4px; }
.rk-v { font-family: var(--num); font-weight: 700; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.rk-v u { text-decoration: none; font-family: var(--sans); font-size: 10.5px; color: var(--faint); margin-left: 2px; }
.rk-h1 { font-size: 11.5px; color: var(--faint); text-align: right; }
.rk-go { margin-top: 10px; }

@media (max-width: 620px) {
  .mine-nums { grid-template-columns: 1fr; }
  .mine-change { margin-left: 0; }
  /* 手機一行放不下兩個下拉＋按鈕：按鈕整列、縣市與行政區各半 */
  .mine-ask-t b { display: block; margin-bottom: 2px; }
  .mine-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .mine-actions .btn.primary { grid-column: 1 / -1; justify-content: center; }
  .mine-actions select { width: 100%; }
  .mine-or { display: none; }
  /* 螢幕窄就只留前三名，不用 JS 判斷寬度，轉向也不會失準 */
  .rk-item:nth-child(n+4) { display: none; }
  .rk-item { grid-template-columns: 18px minmax(64px, 1fr) minmax(30px, 1.2fr) 60px; }
  .rk-h1 { display: none; }
}

.watch { margin-top: 30px; }
.watch-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.watch-h h2 { font-size: 20px; }
.watch-note { font-size: 13.5px; color: var(--muted); }

.watch-row {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
/* 手機一律直向堆疊，不做橫向捲動 */
@media (max-width: 700px) {
  .watch-row { grid-template-columns: 1fr; gap: 10px; }
  .wcard { padding: 12px 14px; gap: 12px; }
  .wring { width: 60px; height: 60px; }
}

.wcard {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--rule);
  border-left: 5px solid var(--c, var(--s0));
  border-radius: var(--r); padding: 14px 16px; cursor: pointer;
  box-shadow: var(--shadow-1); transition: box-shadow .16s, transform .16s;
  min-width: 0;
}
.wcard:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.wring { width: 68px; height: 68px; flex: none; }
.wr-bg { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.wr-fg { fill: none; stroke: var(--c, var(--s0)); stroke-width: 8; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .6s cubic-bezier(.2,.7,.3,1); }
.wr-t { font-family: var(--num); font-size: 22px; font-weight: 700; fill: var(--ink); text-anchor: middle; font-variant-numeric: tabular-nums; }
.wr-u { font-size: 9.5px; fill: var(--muted); text-anchor: middle; }
/* 圈裡的百分比是哪一區算出來的，直接寫在數字底下，數字不會落單 */
.wr-z { font-size: 10px; font-weight: 700; fill: var(--ink-2); text-anchor: middle; letter-spacing: .04em; }

/* ── 分區標示：山區／平地／全縣市 ─────────────────────────────
   只要畫面上出現「單獨一個數字」，旁邊就掛這顆。山區用警示色（因為它最容易
   被誤讀成平地也快放假了），平地與全縣市維持中性，避免搶走等級顏色的注意力。 */
.zmark {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; line-height: 1.4;
  padding: 1.5px 6px 1.5px 5px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.zmark svg { width: 11px; height: 11px; flex: none; }
.zmark.z-mountain { background: var(--s2-bg); color: var(--s2); }
.zmark.z-flat, .zmark.z-unified { background: var(--surface-3); color: var(--ink-2); }
.zmark.met { background: var(--s3-bg); color: var(--s3); }
.wc-body { min-width: 0; display: grid; gap: 4px; flex: 1; }
.wc-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.wc-top b { font-size: 19px; font-weight: 700; letter-spacing: .01em; }
.wb {
  font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.wb.full { background: var(--s4-bg); color: var(--s4); font-weight: 700; }
.wb.partial { background: var(--s1-bg); color: var(--s1); }
.wb.hz { background: var(--s3-bg); color: var(--s3); }
.wb.mtn { background: var(--s3-bg); color: var(--s3); font-weight: 700; }
.wb.fc { background: var(--accent-wash); color: var(--accent-ink); font-weight: 700; }
.wb.fc-low { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--rule); }
.wc-go { flex: none; color: var(--faint); display: grid; place-items: center; transition: transform .16s, color .16s; }
.wcard:hover .wc-go { color: var(--c, var(--accent)); transform: translateX(2px); }
.wc-lv { font-size: 13.5px; font-weight: 500; color: var(--c, var(--s0)); }
.wc-msg {
  font-size: 13px; color: var(--muted); line-height: 1.55;
  /* 山區帶起來的縣市要同時交代平地與山區兩組數字，兩行會把後半截掉 */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── 版面骨架 ───────────────────────────────────────────────── */
.grid-main {
  display: grid; gap: var(--gap); margin-top: var(--gap);
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 1080px) { .grid-main { grid-template-columns: 1fr; } }
.col-right { display: grid; gap: var(--gap); align-content: start; min-width: 0; }

/* 地圖與旁邊的時程表要切齊：右欄整欄拉到跟地圖一樣高，
   時程卡吃掉多出來的高度，收合的排行卡貼在底部。 */
.grid-main.align { align-items: stretch; }
/* 第一張卡吃掉多出來的高度，之後補進來的卡片各自照內容高度排在下面。
   固定寫成「1fr auto」會在只剩一張卡時多留一個 gap，右欄就比地圖矮 16px。 */
.grid-main.align .col-right { align-content: stretch; grid-template-rows: 1fr; grid-auto-rows: auto; }

.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--shadow-1); overflow: hidden;
}
.card-h {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 15px 19px; border-bottom: 1px solid var(--rule-soft);
}
.card-h h2 { font-size: 17px; margin-right: auto; }
.card-h .hint { font-size: 12.5px; color: var(--faint); }
.card-b { padding: 19px; }
.card-b.tight { padding: 10px 14px; }

/* ── 地圖 ───────────────────────────────────────────────────── */

/* 颱風卡是獨立的大區塊，間距跟「最有機會放假的縣市」同一套節奏，
   不能貼著上面的小卡 */
.ty { margin-top: 30px; }

/* ── 颱風動態：地圖在左、數字在右 ─────────────────────────────
   路徑分歧是這張圖的重點，所以顏色只用在「哪一國」，
   底圖（海、陸、格線）一律壓到最低對比，不跟路徑搶。 */
.ty .card-h { flex-wrap: wrap; }
.ty-tabs { display: flex; gap: 6px; margin-left: auto; }
.ty-tab {
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2);
}
.ty-tab[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

.ty-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
/* 地圖欄比右欄矮的時候，圖例要壓在卡片底部，兩欄下緣才切齊；
   中間多出來的空間本來就是海，留白不突兀。 */
.ty-mapwrap {
  background: var(--ty-sea); border-right: 1px solid var(--rule-soft);
  display: flex; flex-direction: column;
}
.ty-mapwrap #tyMap { flex: 0 0 auto; }
.ty-mapwrap .ty-legend { margin-top: auto; }
#tyMap { display: block; width: 100%; height: auto; }
.ty-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  padding: 7px 12px; font-size: 11.5px; color: var(--muted);
  background: var(--surface); border-top: 1px solid var(--rule-soft);
}
.ty-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.ty-legend .lg-note { margin-left: auto; color: var(--faint); }
/* 選擇器要比通用的 .lg i 更具體，否則圓點會被改回方塊 */
.ty-legend .lg-eye { width: 9px; height: 9px; border-radius: 50%; background: var(--s3); box-shadow: 0 0 0 3px var(--s3-bg); }
.ty-legend .lg-past { width: 16px; height: 0; border: 0; border-top: 2px dashed var(--muted); border-radius: 0; }
.ty-legend .lg-r70 { width: 11px; height: 11px; border-radius: 50%; border: 1.5px dashed var(--s2); background: none; opacity: .8; }

.ty-side { padding: 16px 18px; display: grid; align-content: start; gap: 14px; }

.ty-name { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.ty-name b { font-size: 22px; font-weight: 900; letter-spacing: .01em; }
.ty-name span { font-size: 12.5px; color: var(--muted); letter-spacing: .04em; }

.ty-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ty-stat { background: var(--surface-2); border: 1px solid var(--rule-soft); border-radius: var(--r-sm); padding: 8px 11px; }
.ty-stat dt { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.ty-stat dd {
  font-family: var(--num); font-size: 22px; font-weight: 700; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ty-stat dd u { text-decoration: none; font-family: var(--sans); font-size: 11.5px; color: var(--faint); margin-left: 3px; }
.ty-stat dd small { display: block; font-family: var(--sans); font-size: 11.5px; font-weight: 400; color: var(--muted); }
.ty-move { font-size: 13px; color: var(--ink-2); line-height: 1.6; }

.ty-rows-h { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.ty-row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center;
  gap: 4px 9px; padding: 7px 0; border-top: 1px solid var(--rule-soft);
}
.ty-row i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.ty-ag { font-size: 13.5px; color: var(--ink-2); display: flex; align-items: baseline; gap: 6px; }
.ty-ag b { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.ty-near { font-size: 13px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ty-near b { font-family: var(--num); font-size: 17px; font-weight: 700; color: var(--c); }
.ty-near u { text-decoration: none; font-size: 11.5px; color: var(--faint); margin-left: 4px; }
.ty-last { grid-column: 2 / -1; font-size: 11.5px; color: var(--faint); }
.ty-foot { font-size: 12px; color: var(--muted); line-height: 1.65; }

/* 地圖本身 */
.ty-sea { fill: var(--ty-sea); }
.ty-land { fill: var(--ty-land); stroke: var(--rule); stroke-width: 1; }
.ty-tw { fill: var(--accent-wash); stroke: var(--accent); stroke-width: 1.4; }
.ty-grat { stroke: var(--rule); stroke-width: 1; opacity: .55; }
.ty-gt { fill: var(--faint); text-anchor: middle; font-family: var(--num); }
.ty-past { fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-dasharray: 7 6; opacity: .75; }
.ty-pastdot { fill: var(--muted); opacity: .6; }
/* 主線（我國官方預報）粗、其他國家細：先給讀者一條可以站的線，再談分歧 */
.ty-fc { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: .78; }
.ty-fc.main { stroke-width: 5; opacity: 1; }
.ty-fcdot { stroke: var(--surface); stroke-width: 1.2; opacity: .85; }
.ty-fcdot.main { opacity: 1; stroke-width: 1.6; }
/* 標籤照氣象署路徑圖：白底方框 + 細引線指回對應的點，字不再泡在路線裡 */
.ty-lbl { text-anchor: middle; dominant-baseline: middle; }
.ty-lbl-bg { fill: var(--surface); stroke: var(--rule); stroke-width: 1.2; }
.ty-lbl-bg.main { stroke-width: 1.8; }
.ty-lead { stroke: var(--ink-2); stroke-width: 1.2; opacity: .5; }
.ty-tag { font-family: var(--num); font-weight: 700; }
.ty-time { font-family: var(--num); font-weight: 600; fill: var(--ink-2); }
.ty-pastlbl { fill: var(--muted); text-anchor: middle; font-family: var(--num); }
.ty-r70 { fill: none; stroke: var(--s2); stroke-width: 1.2; stroke-dasharray: 4 5; opacity: .45; }
.ty-eye-name { fill: var(--s3); font-weight: 900; letter-spacing: .04em; }
.ty-eye-name .sub { fill: var(--ink-2); font-family: var(--num); font-weight: 600; letter-spacing: .06em; }
.ty-eye-halo { fill: var(--s3); opacity: .18; }
.ty-eye-arm { fill: none; stroke: var(--s3); stroke-width: 3.2; stroke-linecap: round; }
.ty-eye-c { fill: var(--s3); }

@media (max-width: 900px) {
  .ty-body { grid-template-columns: minmax(0, 1fr); }
  .ty-mapwrap { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
}

/* 地圖底下的即時排行：把原本的留白換成「現在哪裡雨最大、風最強」 */
.map-tops {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 6px 18px; padding: 4px 14px 14px;
}
.mt-col { min-width: 0; }
.mt-h {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  padding: 6px 2px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 2px;
}
.mt-h span { font-size: 11px; font-weight: 400; color: var(--faint); margin-left: auto; }
.mt-row {
  display: grid; grid-template-columns: minmax(84px, 1.15fr) minmax(30px, 1fr) 62px;
  align-items: center; gap: 8px; width: 100%;
  padding: 4px 2px; font: inherit; font-size: 12.5px; text-align: left;
  background: none; border: 0; cursor: pointer; border-radius: 5px;
}
.mt-row:hover { background: var(--accent-wash); }
.mt-n { color: var(--muted); display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.mt-n b { color: var(--ink); font-weight: 700; }
.mt-n i {
  font-style: normal; font-size: 10px; font-weight: 700; color: var(--s2);
  background: var(--s2-bg); padding: 0 4px; border-radius: 3px;
}
.mt-bar { height: 7px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.mt-bar i { display: block; height: 100%; border-radius: 4px; }
.mt-v { font-family: var(--num); font-weight: 700; font-size: 14.5px; text-align: right; font-variant-numeric: tabular-nums; }
.mt-v u { text-decoration: none; font-family: var(--sans); font-size: 10.5px; color: var(--faint); margin-left: 2px; }
.mt-empty { font-size: 12.5px; color: var(--faint); padding: 8px 2px; }

/* 即時雨雷達：回波是資訊主角，但不該把縣市警戒色壓死，所以留一點透明 */
.radar image { opacity: .78; image-rendering: auto; }
.radar-tag {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  display: flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; pointer-events: none;
  box-shadow: var(--shadow-1);
}
.radar-tag b { font-size: 12px; font-weight: 700; color: var(--accent-ink); }
.radar-tag i {
  font-style: normal; font-size: 10.5px; font-weight: 700;
  color: var(--s3); background: var(--s3-bg); padding: 1px 6px; border-radius: 999px;
}

.map-wrap { position: relative; background: var(--sea); }
#map {
  display: block; width: 100%; height: auto; touch-action: manipulation;
  max-height: min(80vh, 820px);
}
@media (max-width: 1080px) { #map { max-height: min(78vh, 900px); } }
#map .county {
  stroke: var(--surface); stroke-width: .8; stroke-linejoin: round;
  cursor: pointer; transition: filter .15s;
}
#map .county:hover { filter: brightness(1.12); }
#map .county.sel { stroke: var(--ink); stroke-width: 2; }
/* 標籤壓在各種警戒色塊上，用固定的深字＋白色光暈，兩種主題都保持可讀 */
#map .clabel {
  font-family: var(--sans); font-weight: 500;
  fill: #16222A; paint-order: stroke; stroke: rgba(255, 255, 255, .94);
  stroke-linejoin: round; pointer-events: none; user-select: none;
}
#map .cval { font-weight: 700; }
#map .cval.dim { font-weight: 500; opacity: .72; }
#map .stn { pointer-events: none; }

.map-legend {
  display: grid; gap: 6px;
  padding: 11px 18px; border-top: 1px solid var(--rule-soft); background: var(--surface);
  font-size: 12.5px; color: var(--muted);
}
/* 標題欄寬度對齊，兩列的色塊才會從同一個位置開始排 */
.lg-row { display: flex; align-items: center; gap: 5px 14px; flex-wrap: wrap; }
.lg-row .lg-t { color: var(--ink-2); font-weight: 500; min-width: 8.2em; }
.lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }

.islands { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; }
.island {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 6px 10px; box-shadow: var(--shadow-1); cursor: pointer; text-align: center; line-height: 1.25;
}
.island b { display: block; font-size: 12px; font-weight: 500; }
.island span { display: block; font-family: var(--num); font-size: 16px; font-weight: 600; }

.tip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-sm);
  box-shadow: var(--shadow-2); padding: 10px 13px; font-size: 13.5px; max-width: 260px;
  transition: opacity .12s;
}
.tip.on { opacity: 1; }
.tip b { display: block; font-size: 15px; margin-bottom: 4px; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); }
.tip .row b { display: inline; font-family: var(--num); font-size: 14.5px; color: var(--ink); margin: 0; }

/* ── 決策時鐘（寬度固定，數字跳動不位移） ──────────────────── */
.clock-now { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.clock-now .t {
  font-family: var(--num); font-size: 40px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
  min-width: 4.6em; flex: none;
}
.cd { display: grid; gap: 2px; min-width: 0; }
/* 桌機一行放得下就不折；手機寧可折行也不要把「發布截止」這種關鍵字截掉 */
.cd-label {
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 900px) {
  .cd-label { white-space: normal; overflow: visible; text-overflow: clip; }
}
.cd-val {
  font-size: 13px; color: var(--muted); display: flex; align-items: baseline; gap: 1px;
  white-space: nowrap;
}
.cd-val b {
  font-family: var(--num); font-size: 21px; font-weight: 600; color: var(--s2);
  font-variant-numeric: tabular-nums; display: inline-block;
  min-width: 1.28em; text-align: right; margin-right: 1px;
}
.cd-val b.h { min-width: 1.28em; }

.track { position: relative; height: 42px; margin: 4px 0 10px; }
.track-rail { position: absolute; left: 0; right: 0; top: 16px; height: 9px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.track-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); opacity: .3; }
.track-win { position: absolute; top: 16px; height: 9px; background: var(--s2); opacity: .5; border-radius: 2px; }
.track-mk { position: absolute; top: 10px; width: 2px; height: 21px; background: var(--s3); border-radius: 1px; }
.track-mk.feed { background: var(--rule); top: 14px; height: 13px; }
.track-now { position: absolute; top: 5px; width: 2px; height: 31px; background: var(--ink); transition: left 1s linear; }
.track-now::after {
  content: ""; position: absolute; left: -4.5px; top: -5px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--ink); border: 2px solid var(--surface);
}
.track-labels { position: relative; height: 15px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.track-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

.clock-list { display: grid; margin-top: 6px; }
.clock-row {
  display: grid; grid-template-columns: 62px 1fr auto; gap: 12px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--rule-soft); font-size: 14.5px;
}
.clock-row .ct { font-family: var(--num); font-size: 18px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.clock-row.dl .ct { color: var(--s3); }
.clock-row.past { opacity: .4; }
.clock-row .cl { color: var(--ink-2); line-height: 1.5; }
.clock-row .cn { font-size: 12px; color: var(--faint); white-space: nowrap; }
@media (max-width: 480px) { .clock-row .cn { display: none; } }

/* ── 縣市卡片 ───────────────────────────────────────────────── */
.section-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 30px 0 12px; }
.section-h h2 { font-size: 20px; }
.section-h .sh-note { font-size: 13px; color: var(--muted); }
.section-h .spacer { margin-left: auto; }
.sortbar { display: flex; gap: 6px; flex-wrap: wrap; }

.counties { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 700px) { .counties { grid-template-columns: 1fr; gap: 11px; } }

.cty {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--shadow-1); overflow: hidden; display: grid; grid-template-columns: 6px 1fr;
  transition: box-shadow .16s; cursor: pointer;
}
.cty:hover { box-shadow: var(--shadow-2); }
.cty-bar { background: var(--s0); }
.cty-in { padding: 15px 17px 17px; min-width: 0; }
.cty-top { display: flex; align-items: center; gap: 8px; }
.cty-name { font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.cty-badges { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.tag {
  font-size: 11.5px; font-weight: 500; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 4px; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.tag.lv { color: #fff; font-weight: 700; }
.tag.fc { background: var(--accent-wash); color: var(--accent-ink); font-weight: 700; }
.tag.fc-low { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--rule); }
.tag.hz { background: var(--s3-bg); color: var(--s3); }
.tag.mtn { background: var(--s3-bg); color: var(--s3); font-weight: 700; }
.tag.dq { background: var(--s1-bg); color: var(--s1); }

.zone:first-of-type { margin-top: 12px; }

.zone { margin-top: 14px; }
.zone-h { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.zone-h .zn { font-weight: 500; color: var(--ink-2); font-size: 14px; }
.zone-h .zt { font-size: 12.5px; color: var(--faint); }
.zone-h .zv {
  margin-left: auto; font-family: var(--num); font-size: 25px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.zone-h .zv u { text-decoration: none; font-size: 12px; color: var(--faint); font-family: var(--sans); }

.meter { position: relative; height: 11px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; transition: width .6s cubic-bezier(.2,.7,.3,1); }
.meter-ticks { position: absolute; inset: 0; pointer-events: none; }
.meter-ticks i { position: absolute; top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, var(--ink) 20%, transparent); }
.zone-foot { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--faint); }
.zone-foot .eta { color: var(--s2); font-weight: 500; }
.zone-foot .warn { color: var(--s1); font-weight: 500; }
.zone-foot .hit { color: var(--s3); font-weight: 700; }

.spark { display: block; width: 100%; height: 32px; margin-top: 12px; }

/* ── 排行 ───────────────────────────────────────────────────── */

/* ── 警報 feed ──────────────────────────────────────────────── */
.feed { display: grid; max-height: 400px; overflow-y: auto; }
.feed-row { padding: 12px 0; border-top: 1px solid var(--rule-soft); display: grid; gap: 5px; }
.feed-row:first-child { border-top: 0; }
.feed-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feed-cat { font-size: 11.5px; padding: 3px 8px; border-radius: 4px; background: var(--s3-bg); color: var(--s3); font-weight: 500; }
.feed-cat.soft { background: var(--surface-3); color: var(--muted); }
.feed-src { font-size: 12px; color: var(--faint); }
.feed-time { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.feed-txt { font-size: 14px; color: var(--ink-2); line-height: 1.65; }

/* ── 特報全文 ───────────────────────────────────────────────── */
.wtext {
  background: var(--surface-2); border-left: 4px solid var(--accent);
  padding: 14px 17px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 14.5px;
  line-height: 1.85; color: var(--ink-2); white-space: pre-wrap;
}
.wtext + .wtext { margin-top: 11px; }
.wtext b { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 5px; }

/* ── 詳情抽屜 ───────────────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 100; display: none; }
@supports (height: 100dvh) { .drawer { height: 100dvh; } }
.drawer.on { display: block; }
.drawer-bg { position: absolute; inset: 0; background: rgba(8, 16, 22, .55); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(480px, 100%);
  background: var(--surface); border-left: 1px solid var(--rule);
  overflow-y: auto; box-shadow: -20px 0 50px -30px rgba(0,0,0,.6);
  overscroll-behavior: contain;              /* 捲到底不要把後面的頁面一起帶走 */
  -webkit-overflow-scrolling: touch;
  animation: slideX .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes slideX { from { transform: translateX(100%); } }
@keyframes slideY { from { transform: translateY(100%); } }
@media (max-width: 620px) {
  /* 不能用 vh：iOS Safari 的 vh 是「網址列收起時」的高度，
     面板貼底往上長 88vh 會超出可視範圍，把標題與關閉鈕頂到看不見的地方。
     改用 top/bottom 百分比，交給 position:fixed 的外層去量真正的可視高度。 */
  .drawer-panel {
    top: 9%; bottom: 0; height: auto; width: 100%;
    border-radius: 16px 16px 0 0;
    border-left: 0; border-top: 1px solid var(--rule); animation-name: slideY;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  /* 底部面板給一個可見的拖曳握把，讓人知道這是可以往下關的 */
  .drawer-panel::before {
    content: ""; position: sticky; top: 0; z-index: 3;
    display: block; width: 40px; height: 4px; margin: 8px auto 0;
    border-radius: 2px; background: var(--rule);
  }
  .drawer-h { padding-top: 10px; }
  .drawer-h .btn { padding: 9px 14px; }
}
@media (prefers-reduced-motion: reduce) { .drawer-panel { animation: none; } }
.drawer-h {
  position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--rule);
  padding: 16px 19px; display: flex; align-items: center; gap: 10px; z-index: 2;
}
.drawer-h h3 { font-size: 21px; margin-right: auto; }
.drawer-b { padding: 19px; display: grid; gap: 20px; }
.dl { display: grid; }
.dl-row { display: grid; grid-template-columns: 100px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--rule-soft); font-size: 14.5px; }
.dl-row:first-child { border-top: 0; }
.dl-row dt { color: var(--muted); font-size: 13px; }
.dl-row dd { margin: 0; }
.drawer-b h4 { font-size: 14.5px; margin-bottom: 9px; }

.reasons { display: grid; gap: 8px; }
.reason { display: grid; grid-template-columns: 14px 1fr; gap: 9px; font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.reason::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 9px; }

/* ── 說明 / 頁尾 ────────────────────────────────────────────── */
.notes { margin-top: var(--gap); }
.notes-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.note-b h4 { font-size: 15px; margin-bottom: 6px; }
.note-b p { font-size: 14px; color: var(--muted); line-height: 1.8; }
.note-b code {
  font-family: var(--mono); font-size: 12.5px; background: var(--surface-2);
  border: 1px solid var(--rule-soft); border-radius: 4px; padding: 1px 5px;
}
footer.legal { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--faint); line-height: 1.85; }

/* ── 載入 / 錯誤 ────────────────────────────────────────────── */
.loading { padding: 80px 20px; text-align: center; color: var(--muted); font-size: 15px; }
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--rule); border-top-color: var(--accent);
  border-radius: 50%; margin: 0 auto 16px; animation: rot .8s linear infinite;
}
.errbox {
  margin-top: 18px; background: var(--s3-bg); border: 1px solid var(--s3);
  border-radius: var(--r); padding: 16px 20px; color: var(--s3); font-size: 14.5px;
}

/* ── 固定頁尾署名 ───────────────────────────────────────────── */
.credit {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  padding: 0 20px; min-height: 36px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(10px);
  -webkit-backdrop-filter: saturate(1.5) blur(10px);
  border-top: 1px solid var(--rule);
  font-size: 12.5px; color: var(--muted);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.credit b { color: var(--ink); font-weight: 500; }
.credit-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); flex: none; }
.credit-right { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
@media (max-width: 880px) { .credit-right { display: none; } }
.credit-live { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 500; color: var(--ink-2); }
.credit-live b { font-family: var(--num); font-variant-numeric: tabular-nums; font-size: 15px; color: #2F9A67; font-weight: 700; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #2F9A67; flex: none;
  box-shadow: 0 0 0 0 rgba(47,154,103,.55); animation: pulse 2.6s infinite;
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.credit-by a {
  color: var(--ink); font-weight: 500; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--rule); padding-bottom: 1px; transition: color .15s, border-color .15s;
}
.credit-by a:hover { color: var(--accent); border-color: var(--accent); }
.credit-by a svg { opacity: .65; }

@media (max-width: 880px) {
  /* 窄螢幕改為置中，並保留在線人數這個活訊號 */
  .credit { justify-content: center; text-align: center; }
}
@media (max-width: 560px) {
  .credit { padding: 0 14px; gap: 8px; font-size: 12px; min-height: 38px; }
  .credit-dot { display: none; }
  .credit > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ── 抽屜最上方的官方公告（民眾最先要看到的東西） ──────────── */
.announce {
  border-radius: var(--r); padding: 16px 18px; display: grid; gap: 8px;
  border: 1px solid var(--rule); background: var(--surface-2);
}
.announce-tag { font-size: 17px; font-weight: 700; line-height: 1.4; }
.announce p { font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.announce-src { font-size: 12px; color: var(--faint); }
.announce.full { background: var(--s4-bg); border-color: var(--s4); }
.announce.full .announce-tag { color: var(--s4); }
.announce.partial { background: var(--s1-bg); border-color: var(--s1); }
.announce.partial .announce-tag { color: var(--s1); }
.announce.none .announce-tag { color: var(--muted); font-weight: 500; font-size: 15.5px; }

/* 公告拆成逐機構條列，狀態做成可掃視的標籤 */
/* 日期是第一維度：先分今天／明天，單位列在各自日期底下 */
.ann-days { display: grid; gap: 14px; }
.ann-day-block {
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  border-radius: 9px; padding: 11px 13px 12px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 9%, transparent);
}
.ann-day-block.tmr { background: transparent; }
.ann-day-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.ann-day-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.ann-list { display: grid; }
.ann-item {
  display: grid; gap: 6px; padding: 9px 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
}
.ann-item:first-of-type { border-top: 0; padding-top: 2px; }
.ann-item.single { padding-top: 0; border-top: 0; }
.ann-day {
  font-size: 13.5px; font-weight: 700; text-align: center;
  padding: 3px 9px; border-radius: 5px; white-space: nowrap;
  background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink-2);
  display: inline-flex; align-items: baseline; gap: 5px;
}
.ann-day em {
  font-style: normal; font-weight: 500; font-size: 11.5px; opacity: .75;
  font-variant-numeric: tabular-nums;
}
.ann-day.tmr { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px currentColor; font-weight: 500; }
.ann-item:first-child { border-top: 0; padding-top: 4px; }
.ann-who { font-size: 14.5px; font-weight: 500; line-height: 1.5; color: var(--ink); }
.ann-chips, .ann-single { display: flex; gap: 6px; flex-wrap: wrap; }
.ann-single { padding: 4px 0 2px; }
.ann-chip {
  font-size: 12.5px; padding: 3px 10px; border-radius: 5px; white-space: nowrap;
  background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted);
}
.ann-chip.stop {
  background: var(--surface); color: var(--s3); font-weight: 700;
  box-shadow: inset 0 0 0 1px currentColor;
}

/* 受影響縣市籤：數量再多也不會撐爛標題，且每個都能點進去 */
.banner-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.bchip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--rule); background: var(--surface);
  border-radius: 999px; padding: 6px 13px; font-size: 14px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.bchip:hover { border-color: var(--c); background: var(--surface-2); transform: translateY(-1px); }
.bchip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.bchip .zmark { margin: 0 -1px; }
.bchip b {
  font-family: var(--num); font-variant-numeric: tabular-nums;
  font-size: 15px; font-weight: 600; color: var(--c);
}
/* 被截掉的縣市要老實說，但它不能點，樣式上就要跟可點的籤分開 */
.bchip.more {
  color: var(--muted); font-size: 13px;
  border-style: dashed; background: none;
}
.bchip.more:hover { border-color: var(--ink-2); color: var(--ink-2); transform: none; }

/* 手機上一個籤約 180px、容器約 340px——差一點點就是塞不下兩個，
   於是每個籤自己一行。把字級與內距收一收，兩個就進得去，高度直接減半。 */
@media (max-width: 560px) {
  .banner-chips { gap: 6px; margin-top: 12px; }
  .bchip { gap: 5px; padding: 5px 10px; font-size: 13px; }
  .bchip i { width: 8px; height: 8px; }
  .bchip b { font-size: 13.5px; }
  .bchip .zmark { font-size: 10.5px; padding: 1px 4px; }
}
/* 真的很窄才只留分區圖示。說明那句話寫的是「標『山區』」，字被藏起來就對不上，
   所以能顯示就顯示；形狀（雙峰／地平線／兩者疊合）是最後的退路。 */
@media (max-width: 370px) {
  .bchip .zmark span, .bchip .zmark { font-size: 0; padding: 1px 3px; }
  .bchip .zmark svg { width: 13px; height: 13px; }
}

/* 推估算式與說明：跟主結論分層，但要能被讀者驗算 */
.eta-calc, .eta-why { display: block; font-size: 13px; line-height: 1.7; margin-top: 6px; }
.eta-calc {
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--rule-soft);
  border-radius: 6px; padding: 7px 10px; font-variant-numeric: tabular-nums;
}
.eta-why { color: var(--muted); }



/* 可點的 KPI */
button.kpi { cursor: pointer; text-align: left; font: inherit; transition: border-color .15s, background .15s, transform .15s; }
button.kpi:hover { border-color: var(--accent); background: var(--surface); transform: translateY(-1px); }
button.kpi::after {
  content: "▸"; position: absolute; opacity: 0; }
.kpi { position: relative; }
button.kpi .kpi-l::after { content: " ›"; color: var(--faint); font-weight: 700; }

/* KPI 清單彈窗 */
.kpi-item { display: grid; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.kpi-item:last-child { border-bottom: 0; padding-bottom: 0; }
.kpi-head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
}
.kpi-head b { font-size: 19px; font-weight: 700; }
.kpi-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.kpi-lv { font-size: 13.5px; font-weight: 500; }
.kpi-go {
  margin-left: auto; display: inline-flex; align-items: center; gap: 3px;
  font-size: 13px; color: var(--faint); white-space: nowrap;
}
.kpi-head:hover .kpi-go { color: var(--accent); }

/* 非焦點日的公告收合起來，不佔版面但點得開 */
.ann-day-block.folded {
  background: transparent; padding: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 9%, transparent);
}
.ann-day-block.folded > summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 13px; font-size: 13.5px; color: var(--muted); list-style: none;
}
.ann-day-block.folded > summary::-webkit-details-marker { display: none; }
.ann-day-block.folded > summary::before {
  content: "›"; font-weight: 700; font-size: 16px; color: var(--faint);
  transition: transform .18s; display: inline-block;
}
.ann-day-block.folded[open] > summary::before { transform: rotate(90deg); }
.ann-fold-day { font-weight: 700; color: var(--ink-2); }
.ann-fold-n { margin-left: auto; font-size: 12px; }
.ann-day-block.folded > .ann-day-head,
.ann-day-block.folded > .ann-item { padding-left: 13px; padding-right: 13px; }
.ann-day-block.folded > .ann-day-head { display: none; }
.ann-day-block.folded > .ann-item:last-child { padding-bottom: 12px; }

/* 決策時鐘：標出法源，並說明時間表以外的但書 */
.clock-row .cite {
  display: block; font-style: normal; font-size: 11.5px;
  color: var(--faint); margin-top: 1px;
}
.clock-notes {
  margin-top: 14px; padding: 12px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--rule-soft);
  font-size: 13.5px; line-height: 1.7; color: var(--muted);
}
.clock-notes b { display: block; color: var(--ink-2); font-size: 13px; margin-bottom: 6px; }
.clock-notes p { margin: 0; padding: 5px 0 5px 14px; position: relative; }
.clock-notes p::before {
  content: ""; position: absolute; left: 0; top: 14px;
  width: 6px; height: 1px; background: var(--faint);
}
.clock-notes .cite { display: inline; margin-left: 6px; }

/* 政府資料開放授權條款要求的顯名聲明（未標示視為未取得授權） */
.legal .ogdl {
  background: var(--surface-2); border: 1px solid var(--rule-soft);
  border-radius: 8px; padding: 12px 15px; margin: 0 0 14px;
  line-height: 1.9; color: var(--ink-2);
}
.legal .ogdl b { color: var(--ink); font-weight: 700; }
.legal .ogdl a { color: var(--accent); }

/* ── App 版（iOS）───────────────────────────────────────────────
   瀏覽器有網址列幫忙擋著瀏海，App 沒有，頂欄得自己讓開動態島；
   底部也要留出 Home 指示條的高度。這個 class 只有 native.js 會加，
   網站上的樣式一個字都不會變。 */
html.native .topbar-in { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
@media (max-width: 700px) {
  html.native .topbar-in { padding-top: calc(7px + env(safe-area-inset-top, 0px)); }
}
html.native .shell { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
/* App 裡沒有網址可複製，站名不該看起來像可以點的連結 */
html.native .brand { -webkit-touch-callout: none; }
html.native { -webkit-user-select: none; user-select: none; }
html.native input, html.native textarea { -webkit-user-select: text; user-select: text; }
