:root {
  --navy: #12355b;
  --navy-2: #1d4a7a;
  --orange: #b84a00;
  --ink: #222;
  --muted: #555;
  --line: #c9d2dc;
  --bg: #eef2f6;
  --link: #0b4f8a;
  --danger: #b00020;
  font-family: "Microsoft JhengHei", "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
input, select, button { font: inherit; color: inherit; }

/* 頁首 */
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 4px 8px; z-index: 10; }
.skip:focus { left: 8px; }
.util { background: #0b223b; }
.util ul { list-style: none; margin: 0 auto; padding: 0 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 4px; max-width: 1180px; }
.util a { color: #fff; font-size: 12px; display: inline-flex; align-items: center; min-height: 26px; padding: 0 6px; text-decoration: none; }
.masthead { background: var(--navy); color: #fff; }
.masthead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 6px 12px; max-width: none; }
.logo { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.logo-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; background: var(--orange); border-radius: 4px; }
.mega { position: relative; flex: 1; }
.mega-top { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.mega-btn { background: none; border: 0; color: #fff; padding: 4px 10px; min-height: 32px; cursor: pointer; border-radius: 3px; }
.mega-btn[aria-expanded="true"], .mega-btn:hover { background: var(--navy-2); }
.mega-btn::after { content: " ▾"; font-size: 10px; }
.mega-panel {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-top: 3px solid var(--orange); box-shadow: 0 6px 16px rgb(0 0 0 / .2);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px; padding: 10px 14px;
}
.mega-panel[hidden] { display: none; }
.mega-panel ul { list-style: none; margin: 0; padding: 0 0 0 12px; }
.mega-panel a { display: inline-flex; align-items: center; min-height: 26px; }
.mega-panel summary { font-weight: 700; color: var(--navy); }

/* 版面 */
main { max-width: 1180px; margin: 0 auto; padding: 8px 12px 32px; }
main:focus { outline: none; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; font-size: 12px; }
.crumbs li + li::before { content: "›"; padding: 0 6px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: 24px; }
.page-title { font-size: 20px; margin: 4px 0 10px; color: var(--navy); border-left: 4px solid var(--orange); padding-left: 8px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; margin-bottom: 12px; }
.panel h2 { font-size: 16px; margin: 0 0 8px; color: var(--navy); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sub { font-size: 15px; margin: 4px 0 8px; color: var(--navy); }
.sub:focus { outline: none; }
.cols { display: grid; gap: 0 12px; }
.note { color: var(--muted); margin: 6px 0; }
.error { color: var(--danger); margin: 4px 0; font-weight: 700; }
.error:empty { display: none; }

/* 看起來能點、其實不能點的標題 */
.fake-link { color: var(--link) !important; cursor: pointer; }
.fake-link::after { content: " ›"; }
.fake-link:hover { text-decoration: underline; }

/* 輪播樣式（靜態） */
.promo-track { display: grid; gap: 8px; }
.promo-card { border-radius: 4px; padding: 10px 12px; color: #fff; }
.promo-card h3 { font-size: 15px; margin: 2px 0 4px; color: #fff !important; text-decoration: underline; }
.promo-card p { margin: 0; font-size: 13px; }
.promo-tag { display: inline-block; background: rgb(0 0 0 / .35); padding: 0 6px; border-radius: 2px; font-size: 12px !important; }
.tone-a { background: #7a2e00; }
.tone-b { background: #1d4a7a; }
.tone-c { background: #2f5d1e; }
.promo-dots { display: flex; justify-content: center; gap: 6px; margin: 6px 0 0; }
.promo-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.promo-dots .on { background: var(--orange); }

/* 收合面板 */
details.step-panel { border: 1px solid var(--line); border-radius: 3px; margin: 6px 0; background: #fafbfc; }
details.step-panel > :not(summary) { margin-left: 10px; margin-right: 10px; }
details.step-panel > :last-child { margin-bottom: 8px; }
summary { cursor: pointer; min-height: 28px; display: list-item; padding: 4px 8px; }
details.step-panel > summary { font-weight: 700; background: #e7edf3; }

form label { display: grid; gap: 2px; margin: 4px 0; font-weight: 700; color: var(--ink); }
form label.check { display: flex; align-items: center; gap: 6px; font-weight: 400; }
input:not([type=checkbox], [type=radio]), select { min-height: 28px; padding: 2px 6px; border: 1px solid #8a96a3; border-radius: 2px; background: #fff; width: 100%; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; margin: 2px; flex: none; }
fieldset { border: 1px solid var(--line); margin: 6px 0; padding: 4px 10px 8px; }
legend { font-weight: 700; color: var(--navy); }
.grid2 { display: grid; gap: 0 12px; }

.btn { background: var(--orange); color: #fff; border: 0; border-radius: 3px; min-height: 30px; padding: 4px 16px; cursor: pointer; font-weight: 700; margin: 4px 0; }
.btn-ghost { background: #fff; color: var(--link); border: 1px solid var(--link); border-radius: 3px; min-height: 30px; padding: 4px 12px; cursor: pointer; }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

/* 時刻表 */
.route-group { border: 1px solid var(--line); margin: 4px 0; }
.route-group > summary { background: #e7edf3; font-weight: 700; }
.route-no { display: inline-block; background: var(--navy); color: #fff; padding: 0 6px; margin-right: 6px; border-radius: 2px; font-size: 12px; }
.count { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 12px; }
.tt { list-style: none; margin: 0; padding: 0; }
.tt li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 3px 8px; border-top: 1px solid #e3e8ee; font-size: 13px; font-variant-numeric: tabular-nums; }
.tt li:nth-child(even) { background: #f6f8fa; }
.tt-time { font-weight: 700; min-width: 3em; }
.tt-arr, .tt-type, .tt-seat { color: var(--muted); }
.tt button { margin-left: auto; min-height: 26px; min-width: 48px; background: #fff; border: 1px solid var(--link); color: var(--link); border-radius: 3px; cursor: pointer; }
.tt button:disabled { border-color: #999; color: #595959; cursor: not-allowed; }

.fare-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0; }
.fare-row label { font-weight: 700; }
.fare-row input { width: 64px !important; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.news { list-style: none; margin: 0; padding: 0; }
.news li { padding: 4px 0; border-bottom: 1px dotted var(--line); }
.news time { color: var(--muted); font-size: 12px; margin-right: 6px; }
.route-cards { display: grid; gap: 8px; }
.route-cards article { border: 1px solid var(--line); padding: 6px 10px; border-radius: 3px; }
.route-cards h3 { font-size: 14px; margin: 0; }
.route-cards p { margin: 2px 0 0; font-size: 13px; }

.toc ol { margin: 0; padding-left: 20px; }
.toc a { display: inline-flex; min-height: 26px; align-items: center; }
.toc-title { font-size: 15px !important; }
.tbl { border-collapse: collapse; width: 100%; margin: 6px 0; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.tbl th { background: #e7edf3; }

/* 頁尾 */
.site-foot { background: #0b223b; color: #fff; padding: 16px 12px; }
.site-foot a { color: #fff; display: inline-flex; min-height: 24px; align-items: center; font-size: 13px; }
.foot-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; max-width: 1180px; margin: 0 auto; }
.foot-cols ul { list-style: none; margin: 0; padding: 0; }
.foot-title { font-weight: 700; margin: 0 0 4px; }
.fine { font-size: 12px; text-align: center; color: #d0d8e0; margin: 16px 0 0; }

@media (min-width: 720px) {
  .promo-track { grid-template-columns: repeat(3, 1fr); }
  .cols { grid-template-columns: 2fr 1fr; }
  .cols:has(#member) { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .route-cards { grid-template-columns: repeat(3, 1fr); }
  .with-toc { display: grid; grid-template-columns: 200px 1fr; gap: 12px; align-items: start; }
  .toc { position: sticky; top: 8px; }
}
