:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1d1f1c;
  --muted: #6b6f68;
  --line: #e2e0d8;
  --accent: #2f6f4f;
  --accent-ink: #ffffff;
  --up: #1f7a45;
  --down: #b2402f;
  --warn-bg: #fff4d6;
  --err-bg: #fde5e1;
  --ok-bg: #e3f3e8;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151714; --panel: #1e211d; --ink: #e8e8e3; --muted: #9a9e96; --line: #30342e;
    --accent: #5fb68a; --accent-ink: #0d1510; --up: #6fcf97; --down: #f08a78;
    --warn-bg: #3a3320; --err-bg: #3d2420; --ok-bg: #1f3526;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top {
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0 16px;
}
header.top .inner { max-width: 1100px; margin: 0 auto; display: flex; gap: 24px; align-items: center; height: 56px; }
header.top .brand { font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: -0.01em; }
header.top .brand .ticks { color: var(--accent); font-family: var(--mono); margin-right: 6px; }
header.top nav { display: flex; gap: 16px; flex-wrap: wrap; }
header.top nav a { color: var(--muted); font-weight: 500; }
header.top nav a:hover { color: var(--ink); }
.admin-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--warn-bg); color: var(--ink); padding: 2px 8px; border-radius: 99px; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pill.final { background: var(--ok-bg); border-color: transparent; color: var(--ink); }
.pill.draft { background: var(--warn-bg); border-color: transparent; color: var(--ink); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
tr:last-child td { border-bottom: none; }
.rank { width: 2.5em; color: var(--muted); font-family: var(--mono); }
.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }
.even { color: var(--muted); }
.scroll { overflow-x: auto; }
table.grid-table th.game { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-weight: 500; text-transform: none; letter-spacing: 0; padding: 8px 4px; }
table.grid-table td.cell { text-align: center; font-family: var(--mono); font-size: 13px; padding: 6px 4px; }
table.grid-table td.blank { color: var(--line); text-align: center; }
table.grid-table td.sticky, table.grid-table th.sticky { position: sticky; left: 0; background: var(--panel); }

table.grid-table td.cell .score { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 999px; font-variant-numeric: tabular-nums; }
table.grid-table td.cell .score.win { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
table.grid-table td.cell .noscore { color: var(--muted); }
td .win { color: var(--accent); }

.bar { height: 6px; border-radius: 3px; background: var(--line); position: relative; min-width: 80px; }
.bar > span { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.bar > span.up { background: var(--up); left: 50%; }
.bar > span.down { background: var(--down); right: 50%; }

.season-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 20px; }
.season-nav a { padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 13px; }
.season-nav a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); }
.flash.err { background: var(--err-bg); }

form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=date], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; width: 100%;
}
textarea { min-height: 70px; }
input[type=number] { width: 90px; text-align: right; font-family: var(--mono); }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 12px; }
.fields .wide { grid-column: 1 / -1; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 7px 14px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); display: inline-block;
}
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button.danger { background: transparent; border-color: var(--down); color: var(--down); }
button.small { padding: 3px 10px; font-size: 13px; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 500; }
details[open] > summary { margin-bottom: 10px; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 16px; margin-bottom: 12px; }
.checklist label { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 14px; margin: 0; }
.totals { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0; }
.totals div { font-size: 13px; color: var(--muted); }
.totals strong { display: block; font-size: 20px; color: var(--ink); font-family: var(--mono); }
tr.absent td { opacity: .45; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }
.show-sm { display: none; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  header.top .inner { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 8px 16px; }
  h1 { font-size: 22px; }
}

/* Tick flow chart */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948; --sx: #9a9e96;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --sx: #6b6f68;
  }
}
.tickflow .tf-legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 8px; }
.tickflow .tf-key {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--ink);
  border: 1px solid transparent; border-radius: 99px; padding: 3px 10px; font-weight: 500; font-size: 13px;
}
.tickflow .tf-key:hover { border-color: var(--line); }
.tickflow .tf-key[aria-pressed="true"] { border-color: var(--ink); }
.tickflow .tf-key.dim { opacity: .45; }
.tickflow .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tickflow .tf-plot { position: relative; touch-action: pan-y; }
.tickflow svg { display: block; overflow: visible; }
.tickflow .tf-axis text { fill: var(--muted); font: 11px var(--mono); }
.tickflow .tf-axis .grid { stroke: var(--line); stroke-width: 1; }
.tickflow .tf-axis .zero { stroke: var(--muted); stroke-width: 1; }
.tickflow .tf-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; transition: opacity .15s; }
.tickflow .tf-line.dim { opacity: .15; }
.tickflow .tf-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tickflow .tf-dot { stroke: var(--panel); stroke-width: 2; }
.tickflow .tf-tip {
  position: absolute; top: 0; pointer-events: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; min-width: 150px; box-shadow: 0 4px 14px rgba(0,0,0,.08);
}
.tickflow .tf-tip-h { color: var(--muted); margin-bottom: 4px; }
.tickflow .tf-row { display: flex; align-items: center; gap: 6px; }
.tickflow .tf-row.dim { opacity: .45; }
.tickflow .tf-row .nm { flex: 1; }
.tickflow .tf-row .v { font-family: var(--mono); }
.tickflow .tf-table { margin-top: 12px; }
