/* 天氣預報頁（/weather/ 與 /weather/<縣市>/）。桌機放寬到 1400px，手機 360 直向第一屏就看得到今天天氣。 */
.wrap:has(.wx-root) { max-width: 1400px; }
.wx-root { min-width: 0; }
.wx-root h1 { margin-top: .6rem; }
.wx-alt { font-size: .55em; font-weight: 500; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.wx-lead { color: var(--muted); font-size: 1rem; }
.wx-sec { margin: 1.1rem 0; }
.wx-sec > h2 { margin: .9rem 0 .6rem; font-size: 1.3rem; }

/* ---- 圖示 ---- */
.wx-ic { width: 34px; height: 34px; flex: none; display: block; }
.wx-ic-md { width: 44px; height: 44px; }
.wx-ic-lg { width: 76px; height: 76px; }

/* ---- 今明 36 小時卡片 ---- */
.wx-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wx-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: linear-gradient(180deg, #f5f9ff 0%, #fff 70%); min-width: 0; }
.wx-card-now { grid-column: 1 / -1; background: linear-gradient(180deg, #e3efff 0%, #fff 80%); border-color: #9db9ee; }
.wx-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.4; }
.wx-range { margin: 0 0 6px; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.wx-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wx-card:not(.wx-card-now) .wx-ic-lg { width: 48px; height: 48px; }
.wx-card:not(.wx-card-now) .wx-temp { font-size: 1.5rem; }
.wx-main > div { min-width: 0; }
.wx-text { margin: 0; font-weight: 700; font-size: 1.05rem; line-height: 1.4; }
.wx-temp { margin: 2px 0 0; font-size: 1.9rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-temp small { font-size: .9rem; color: var(--muted); margin-left: 2px; font-weight: 500; }
.wx-hi { color: #c2410c; }
.wx-lo { color: #1d4ed8; }
.wx-slash { color: #94a3b8; margin: 0 4px; font-weight: 400; }
.wx-kv { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 0; font-size: .95rem; }
.wx-kv div { min-width: 0; }
.wx-kv dt { display: inline; color: var(--muted); }
.wx-kv dt::after { content: "："; }
.wx-kv dd { display: inline; margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 700px) {
  .wx-cards { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .wx-card-now { grid-column: auto; }
  .wx-card { padding: 16px 18px; }
  .wx-card .wx-ic-lg, .wx-card:not(.wx-card-now) .wx-ic-lg { width: 60px; height: 60px; }
  .wx-card .wx-temp, .wx-card:not(.wx-card-now) .wx-temp { font-size: 1.8rem; }
}
@media (min-width: 1100px) {
  .wx-card .wx-ic-lg, .wx-card:not(.wx-card-now) .wx-ic-lg { width: 76px; height: 76px; }
  .wx-card .wx-temp, .wx-card:not(.wx-card-now) .wx-temp { font-size: 2.2rem; }
}

/* ---- 選擇器 ---- */
.wx-pick { display: grid; grid-template-columns: 1fr; gap: 6px 14px; margin: .4rem 0; }
.wx-pick label { display: block; font-weight: 600; font-size: 1rem; min-width: 0; }
.wx-pick select, .wx-search input {
  display: block; width: 100%; min-height: 46px; padding: 8px 10px; margin-top: 4px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 1rem; background: #fff; color: var(--fg);
}
.wx-pick .btn { min-height: 46px; align-self: end; }
@media (min-width: 640px) {
  .wx-pick { grid-template-columns: 1fr 1fr; }
  .wx-pick-wide { grid-template-columns: 1fr 1fr auto; }
}
.wx-status { min-height: 1.4em; margin: .3rem 0; font-size: .95rem; color: var(--muted); }
.wx-status.wx-err { color: var(--bad); }
.wx-search { display: block; margin-top: 10px; font-weight: 600; font-size: 1rem; max-width: 420px; }

/* ---- 分頁 ---- */
.wx-tabs { display: flex; gap: 6px; margin: .6rem 0 0; border-bottom: 2px solid var(--line); }
.wx-tabs button {
  flex: 1 1 0; min-height: 46px; padding: 6px 10px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--soft); color: var(--fg); font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; margin-bottom: -2px;
}
.wx-tabs button[aria-selected="true"] { background: #fff; color: var(--brand); border-color: var(--brand); border-bottom: 2px solid #fff; }
@media (min-width: 640px) { .wx-tabs button { flex: 0 0 auto; padding: 6px 26px; } }
.wx-panel { padding-top: 10px; min-width: 0; }
.wx-panel[hidden] { display: none; }

/* ---- 表格 ---- */
.wx-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; background: #fff; }
.wx-scroll:focus-visible { outline: 3px solid #9db9ee; }
.wx-table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 1rem; }
.wx-table th, .wx-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
.wx-table thead th { background: var(--soft); font-size: .92rem; white-space: nowrap; position: sticky; top: 0; }
.wx-table tbody tr:last-child td, .wx-table tbody tr:last-child th.wx-time { border-bottom: 0; }
tr.wx-date th { background: #e8f0fe; color: var(--brand-dark); font-size: .98rem; padding: 6px 10px; }
.wx-time { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; position: sticky; left: 0; background: #fff; }
.wx-cell-wx { white-space: nowrap; }
.wx-cell-wx span { margin-left: 8px; vertical-align: middle; }
.wx-cell-wx .wx-ic { display: inline-block; vertical-align: middle; }
.wx-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-num strong { font-size: 1.1rem; }
.wx-wind { white-space: nowrap; }
.wx-foot { margin: 8px 2px 0; font-size: .88rem; color: var(--muted); }
.wx-desc { margin: 8px 0 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.wx-desc summary { cursor: pointer; font-weight: 600; font-size: .98rem; }
.wx-desc ul { margin: 8px 0 0; padding-left: 1.1rem; font-size: .92rem; }
.wx-desc li { margin-bottom: 6px; }
.wx-wk { min-width: 600px; }
.wx-wk th:first-child { width: 110px; }
.wx-wk-date { white-space: nowrap; font-weight: 600; position: sticky; left: 0; background: #fff; }
.wx-wk-cell { vertical-align: top !important; min-width: 220px; }
.wx-wk-top { display: flex; align-items: center; gap: 10px; }
.wx-wk-top strong { display: block; line-height: 1.35; }
.wx-wk-t { display: block; font-variant-numeric: tabular-nums; font-weight: 600; color: #c2410c; }
.wx-wk-m { margin: 4px 0 0; font-size: .92rem; color: var(--fg); }
.wx-wk-d { margin: 4px 0 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }
.wx-wk-none { color: var(--muted); }

/* ---- 特報、提示 ---- */
.wx-warn { border: 2px solid var(--bad); background: #fef2f2; border-radius: 12px; padding: 4px 14px 10px; margin: .8rem 0; }
.wx-warn h3 { margin: .6rem 0 .2rem; font-size: 1.15rem; color: var(--bad); }
.wx-warn p { margin: .3rem 0; font-size: 1rem; line-height: 1.65; }
.wx-warn-t { color: var(--muted); font-size: .92rem !important; }
.wx-oldnote { background: #fff7e6; border-left: 4px solid var(--warn); padding: 8px 12px; border-radius: 6px; font-size: .95rem; margin: .6rem 0; }
.wx-pending, .wx-empty { background: var(--soft); border-radius: 10px; padding: 12px 14px; font-size: 1rem; margin: .4rem 0; }
.wx-pending.wx-err { background: #fef2f2; color: var(--bad); }

/* ---- 版面：桌機兩欄 ---- */
.wx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 28px; align-items: start; }
.wx-detail > h2 { margin-top: 0; }
@media (min-width: 1100px) {
  .wx-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}
.wx-aside { border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px 14px; background: var(--soft); margin-top: 1.1rem; }
.wx-aside h2 { margin: .7rem 0 .3rem; font-size: 1.15rem; }
.wx-cities { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; }
.wx-cities h3 { margin: .7rem 0 .1rem; font-size: .95rem; color: var(--muted); }
.wx-cities ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.wx-cities li a, .wx-cities li span { display: inline-block; padding: 4px 0; font-size: 1rem; min-height: 32px; }
.wx-cities li span { font-weight: 700; color: var(--fg); }
.wx-asidelink { margin: .8rem 0 0; font-size: .98rem; }
@media (min-width: 1100px) { .wx-cities { grid-template-columns: 1fr 1fr; } }

/* ---- 總覽卡片 ---- */
.wx-oc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
.wx-oc-list[hidden] { display: none; }
.wx-oc a { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 12px; color: var(--fg); text-decoration: none; background: linear-gradient(180deg, #f5f9ff 0%, #fff 70%); height: 100%; }
.wx-oc a:hover, .wx-oc a:focus-visible { border-color: var(--brand); box-shadow: 0 2px 10px rgba(29, 78, 216, .14); }
.wx-oc h3 { margin: 0 0 6px; font-size: 1.15rem; color: var(--brand); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wx-badge { background: var(--bad); color: #fff; border-radius: 6px; padding: 0 7px; font-size: .78rem; font-weight: 600; line-height: 1.6; }
.wx-oc-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wx-oc-p { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; font-size: .9rem; line-height: 1.35; }
.wx-oc-l { color: var(--muted); font-size: .82rem; }
.wx-oc-w { font-weight: 600; min-height: 2.7em; display: flex; align-items: center; justify-content: center; }
.wx-oc-t { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-oc-t b { color: #c2410c; }
.wx-oc-r { color: var(--muted); font-size: .85rem; }
.wx-oc-none { color: var(--muted); margin: 0; }
@media (min-width: 640px) { .wx-oc-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .wx-oc-list { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .wx-oc-list { grid-template-columns: repeat(4, 1fr); } }

/* ---- 其他 ---- */
.wx-content table { min-width: 0; }
.wx-legal { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 14px; margin: 1.5rem 0; font-size: .95rem; }
.wx-legal h2 { font-size: 1.15rem; margin: .8rem 0 .4rem; }
.wx-legal p, .wx-legal ul { margin: .4rem 0; line-height: 1.7; }
.wx-legal ul { padding-left: 1.2rem; }
.wx-stamp { color: var(--muted); }
@media (min-width: 1100px) {
  .wx-content { max-width: 960px; }
  .wx-root > .privacy-note { max-width: 960px; }
}
@media (max-width: 380px) {
  .wx-temp { font-size: 1.6rem; }
  .wx-ic-lg { width: 64px; height: 64px; }
  .wx-oc-row { gap: 2px; }
}
body:has(.wx-root) .site-header .wrap, body:has(.wx-root) .site-footer .wrap { max-width: 1400px; }

/* ---- 警特報固定連結、特報無法確認、提示 ---- */
.wx-cwa { margin: .6rem 0; padding: 10px 14px; border: 2px solid var(--brand); border-radius: 10px; background: #eff4ff; font-size: 1rem; line-height: 1.6; }
.wx-cwa a { font-weight: 700; white-space: nowrap; }
.wx-warn-unknown { border-color: var(--warn); background: #fff7e6; }
.wx-warn-unknown h3 { color: var(--warn); }
.wx-hint { margin: 6px 2px; font-size: .9rem; color: var(--muted); }
.wx-wk-r { margin: 4px 0 0; font-size: .85rem; color: var(--warn); font-weight: 600; }

/* ---- FAQ 觸控高度（只調本頁）---- */
.wx-content .faq summary { display: list-item; padding: 9px 0; line-height: 1.5; min-height: 44px; box-sizing: border-box; }

/* ---- 手機：逐 3 小時表前四欄（時間、天氣、溫度、降雨機率）不用捲動；一週表白天晚上直向並排 ---- */
@media (max-width: 640px) {
  .wx-t3 { min-width: 0; width: max-content; }
  .wx-t3 th, .wx-t3 td { padding: 6px 7px; font-size: .95rem; }
  .wx-t3 .wx-time { padding-left: 8px; }
  .wx-t3 .wx-cell-wx { white-space: normal; min-width: 112px; max-width: 126px; line-height: 1.3; }
  .wx-t3 .wx-cell-wx .wx-ic { width: 28px; height: 28px; margin-right: 3px; }
  .wx-t3 .wx-cell-wx span { margin-left: 0; font-size: .9rem; }
  .wx-t3 tr.wx-date th { position: sticky; left: 0; }
  .wx-wk, .wx-wk tbody { display: block; min-width: 0; width: 100%; }
  .wx-wk thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wx-wk tbody tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
  .wx-wk tbody tr:last-child { border-bottom: 0; }
  .wx-wk th.wx-wk-date { grid-column: 1 / -1; position: static; background: #e8f0fe; color: var(--brand-dark); border-bottom: 0; padding: 6px 10px; width: auto; }
  .wx-wk td { border-bottom: 0; min-width: 0; padding: 8px 10px; }
  .wx-wk td:nth-of-type(1) { border-right: 1px solid var(--line); }
  .wx-wk td::before { content: attr(data-label); display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }
  .wx-wk .wx-wk-cell { min-width: 0; }
  .wx-wk-top { flex-direction: column; align-items: flex-start; gap: 2px; }
  .wx-wk-d { font-size: .8rem; }
}
