/* 版面：深灰頁首帶堅心橘，下方一欄賽事列表；篩選列黏在上方。手機優先。 */
:root {
  --bg: #F4F4F3;
  --surface: #FFFFFF;
  --ink: #1F1F1F;
  --muted: #62625F;
  --line: #E0E0DD;
  --head: #2F2F2F;
  --head-ink: #FFFFFF;
  --head-muted: #BDBDBD;
  --brand: #ED5D2B;
  --brand-ink: #B5441C;
  --brand-soft: #FCEDE7;
  --open: #1B7446;
  --open-soft: #E2F1E8;
  --warn: #A9500A;
  --warn-soft: #FCEFDC;
  --soon: #2C5A99;
  --soon-soft: #E6EDF7;
  --closed: #74746F;
  --closed-soft: #ECECEA;
  --f-body: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --f-num: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616; --surface: #202020; --ink: #ECECEA; --muted: #A3A39F; --line: #343432;
    --head: #0F0F0F; --head-ink: #FFFFFF; --head-muted: #A3A39F;
    --brand: #F0764A; --brand-ink: #F59A76; --brand-soft: #3A231A;
    --open: #5CC98E; --open-soft: #14301F; --warn: #F1A457; --warn-soft: #3A2714;
    --soon: #8DB2E6; --soon-soft: #1C2A3D; --closed: #8E8E8A; --closed-soft: #2A2A28;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.6; }
a { color: var(--brand-ink); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.wrap { max-width: 960px; margin-inline: auto; padding-inline: 16px; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* 頁首 */
.site-head { background: var(--head); color: var(--head-ink); padding-block: calc(24px + env(safe-area-inset-top, 0px)) 22px; }
.site-head .wrap { display: grid; gap: 8px; }
.byline { font-size: 13px; letter-spacing: .06em; color: var(--head-muted); }
.byline a { color: var(--head-ink); text-decoration: none; border-bottom: 2px solid var(--brand); }
.site-head h1 { margin: 0; font-size: clamp(24px, 5.2vw, 34px); font-weight: 800; line-height: 1.25; text-wrap: balance; }
.site-head h1 em { font-style: normal; color: var(--brand); }
.site-head .lede { margin: 0; color: var(--head-muted); font-size: 15px; max-width: 40em; }
.updated { font-size: 13px; color: var(--head-muted); }

/* 篩選列 */
.filters { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.filters .wrap { display: grid; gap: 10px; padding-block: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { flex: 1 1 220px; min-width: 0; font: inherit; font-size: 16px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
select { font: inherit; font-size: 15px; padding: 8px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); max-width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 14px; line-height: 1.4; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #FFFFFF; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }
.count { font-size: 14px; color: var(--muted); margin-left: auto; }
.reset { font: inherit; font-size: 14px; background: none; border: 0; color: var(--brand-ink); cursor: pointer; padding: 4px 0; text-decoration: underline; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 14px; padding: 6px 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); font-weight: 600; }
.mnav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.mnav::-webkit-scrollbar { display: none; }
.mnav a { flex: none; font-size: 14px; padding: 4px 10px; border-radius: 6px; background: var(--bg); color: var(--ink); text-decoration: none; white-space: nowrap; }
.mnav a:hover { background: var(--brand-soft); color: var(--brand-ink); }
.mnav .n { margin-left: 4px; font-family: var(--f-num); font-weight: 600; color: var(--muted); }
.totop { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 6; font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 999px; background: var(--ink); color: var(--surface); text-decoration: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }

/* 列表 */
main { padding-block: 8px 48px; }
.month { scroll-margin-top: 190px; }
.month > h2 { margin: 0; padding-block: 22px 8px; font-size: 15px; font-weight: 700; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.race { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 6px 16px; padding-block: 16px; border-bottom: 1px solid var(--line); align-items: start; }
.when { display: grid; line-height: 1.1; }
.when .md { font-family: var(--f-num); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; }
.when .dow { font-size: 13px; color: var(--muted); margin-top: 4px; }
.r-body { min-width: 0; display: grid; gap: 3px; }
.race.is-closed .when, .race.is-closed .r-body { opacity: .6; }
.race.is-closed .btn { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.r-body h3 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; }
.r-body h3 a { color: var(--ink); text-decoration: none; }
.r-body h3 a:hover { color: var(--brand-ink); text-decoration: underline; }
.meta { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.meta b { color: var(--ink); font-weight: 600; }
.dist { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dist li { font-family: var(--f-num); font-weight: 600; font-size: 15px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; font-variant-numeric: tabular-nums; }
.dist li.key { border-color: var(--brand); color: var(--brand-ink); }
.presence { margin: 6px 0 0; font-size: 14px; }
.presence a { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; font-weight: 600; }
.side { display: grid; gap: 8px; justify-items: end; align-content: start; }
.status { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status.open { background: var(--open-soft); color: var(--open); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.soon { background: var(--soon-soft); color: var(--soon); }
.status.closed, .status.full { background: var(--closed-soft); color: var(--closed); }
.status.unknown { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.acts { display: flex; gap: 8px; align-items: center; }
.btn { font-size: 14px; font-weight: 600; padding: 5px 12px; border-radius: 8px; background: var(--ink); color: var(--surface); text-decoration: none; white-space: nowrap; }
.cal { position: relative; font-size: 14px; }
.cal summary { list-style: none; cursor: pointer; color: var(--brand-ink); padding: 5px 2px; white-space: nowrap; }
.cal summary::-webkit-details-marker { display: none; }
.cal .menu { position: absolute; right: 0; top: 100%; z-index: 3; display: grid; min-width: 11em; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); padding: 4px; }
.cal .menu a, .cal .menu button { font: inherit; font-size: 14px; text-align: left; padding: 8px 10px; border: 0; background: none; color: var(--ink); text-decoration: none; cursor: pointer; border-radius: 6px; }
.cal .menu a:hover, .cal .menu button:hover { background: var(--bg); }
.also { font-size: 12px; color: var(--muted); text-align: right; }
.also a { color: var(--muted); }

/* 推廣卡 */
.promo { margin-block: 20px 4px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; padding: 16px 18px; border-radius: 10px; background: var(--head); color: var(--head-ink); }
.promo .eyebrow { font-size: 12px; letter-spacing: .08em; color: var(--brand); font-weight: 700; }
.promo h2 { margin: 2px 0; font-size: 18px; line-height: 1.4; }
.promo p { margin: 0; font-size: 14px; color: var(--head-muted); }
.promo .go { font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 8px; background: var(--brand); color: #FFFFFF; text-decoration: none; white-space: nowrap; }

.empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* 頁尾 */
.site-foot { border-top: 1px solid var(--line); padding-block: 24px calc(32px + env(safe-area-inset-bottom, 0px)); font-size: 14px; color: var(--muted); }
.site-foot .wrap { display: grid; gap: 8px; }
.site-foot p { margin: 0; max-width: 42em; }

@media (max-width: 640px) {
  .race { grid-template-columns: 56px minmax(0, 1fr); }
  .when .md { font-size: 24px; }
  .side { grid-column: 2; justify-items: start; grid-auto-flow: row; }
  .side .status { justify-self: start; }
  .also { text-align: left; }
  .cal .menu { left: 0; right: auto; }
  .promo { grid-template-columns: minmax(0, 1fr); }
  .promo .go { justify-self: start; }
  .count { margin-left: 0; }
  .filters { position: static; }
  .month { scroll-margin-top: 8px; }
  .seg { flex: 1 1 100%; }
  .seg button { flex: 1; padding: 7px 4px; }
  .filters .wrap { padding-block: 10px; gap: 8px; }
  .chips { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
