:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --muted: #5f6672;
  --border: #e2e5ea;
  --accent: #1f5fbf;
  --accent-soft: #e6eefb;
  --track: #c4472d;
  --badge-bg: #fdeee9;
  --grid: #eceef2;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --border: #2c323a;
    --accent: #7fb0ff;
    --accent-soft: #1f2a3b;
    --track: #ff8a6b;
    --badge-bg: #3a2620;
    --grid: #262b33;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 1.25rem 0 .25rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.meta { color: var(--muted); margin: 0; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--track); margin-right: 8px; vertical-align: 1px; }
.nav { display: flex; gap: 16px; font-size: .95rem; }
.nav .lang { color: var(--muted); }

/* search */
.search { position: relative; }
.search input {
  width: 100%; padding: 10px 12px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search-results {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: 4px 0; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.search-results li a, .search-results li.empty { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; color: var(--text); }
.search-results li a:hover, .search-results li a.active { background: var(--accent-soft); text-decoration: none; }
.search-results .sub { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* cards & lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.hero { padding: 1rem 0 0; }
.lead { font-size: 1.1rem; margin: .25rem 0; }
.meet-list { list-style: none; padding: 0; margin: 0; }
.meet-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.year-nav { display: flex; gap: 12px; margin: .5rem 0; }
.club-list { columns: 3 160px; padding: 0; list-style: none; }
.club-list li { padding: 3px 0; break-inside: avoid; }

/* tables */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 5px 6px; vertical-align: baseline; }
thead th { font-size: .8rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
tbody tr + tr td, tbody tr + tr th { border-top: 1px solid var(--grid); }
tbody th { font-weight: 500; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wind { color: var(--muted); font-size: .85rem; }
.wind abbr { color: var(--track); text-decoration: none; margin-left: 2px; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--track); background: var(--badge-bg); border-radius: 4px; padding: 0 5px; vertical-align: 1px; }

/* athlete */
.pb-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.card { overflow-x: auto; }
.pb th { white-space: nowrap; width: 1%; padding-right: 16px; }
.pb td:last-child { width: 100%; }
.chart-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.chart-grid figure { margin: 0; }
.chart-grid figcaption { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.legend { font-size: .85rem; margin-top: -.5rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 2px 0 8px; border: 2px solid var(--track); }
.dot.out { background: var(--track); }
.meet-block, .event-block { margin-bottom: 10px; }
.meet-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 4px; font-weight: 600; }
.meet-head .muted { font-weight: 400; font-size: .9rem; }
.event-title { margin: 0; font-size: 1.05rem; }
.event-block .small { margin: 0 0 6px; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .yr { stroke: var(--border); stroke-dasharray: 2 3; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--track); stroke-width: 1.5; opacity: .45; }
.chart .pt { stroke: var(--track); stroke-width: 1.5; }
.chart .pt.out { fill: var(--track); }
.chart .pt.in { fill: var(--surface); }

/* rankings */
.rank-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.rank-grid h3 { font-size: .95rem; }
.rank-grid .rank { width: 2.5em; }
.rank-grid th a { color: var(--text); }
.center { text-align: center; }
.chip { display: inline-block; padding: 2px 9px; margin: 2px 4px 2px 0; border-radius: 999px; border: 1px solid var(--border); font-size: .85rem; background: var(--surface); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 600; }
.chip.off { color: var(--muted); opacity: .45; }
.switcher { display: grid; gap: 6px; margin: .75rem 0 1.25rem; }
.crumbs { margin: 1rem 0 0; font-size: .9rem; }
.crumbs + h1 { margin-top: .25rem; }
.ranking-index { margin-bottom: 12px; }
.ranking-index h2 { margin-top: 0; }
.ranking-index td, .ranking-index th { padding: 3px 4px; }
.ranking-index .chip { min-width: 2.6em; text-align: center; margin: 0; }
.ranking-index thead th.small { font-size: .75rem; font-weight: 500; }
details summary { cursor: pointer; color: var(--accent); font-size: .9rem; padding: 6px 0 2px; }
.show-sm { display: none; }

.site-footer { color: var(--muted); font-size: .85rem; padding-top: 2rem; padding-bottom: 2rem; }

@media (max-width: 560px) {
  .hide-sm { display: none; }
  h1 { font-size: 1.45rem; }
  .card { padding: 10px; }
  th, td { padding: 5px 4px; }
  .pb th, .pb .nowrap { white-space: normal; }
  .pb th { width: auto; padding-right: 4px; }
  .show-sm { display: inline; }
  .ranking-index .chip { padding: 1px 4px; font-size: .75rem; min-width: 2.2em; }
  .ranking-index thead th.small { font-size: .65rem; }
}
@media (max-width: 760px) {
  .hide-md { display: none; }
}
