/* Dartpijl, look "Podium": the stage at night. Always dark; board red for
   actions, board green for good news, a condensed scoreboard face for
   headings and figures. Mobile-first, no build step. */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url(/static/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url(/static/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-style: normal; font-display: swap; src: url(/static/fonts/barlow-condensed-latin-800-normal.woff2) format("woff2"); }
:root {
  color-scheme: dark;
  --bg: #0a0e1c;
  --surface: #121a30;
  --surface-2: #0c1224;
  --text: #f3eee4;
  --muted: #9aa4bd;
  --border: #232d4a;
  --accent: #ff4b45;      /* board red: buttons, choices, joker */
  --accent-text: #ffffff;
  --good: #3ccf7a;        /* board green: links, complete, gained */
  --danger: #ff6b66;
  --notice: #18233f;
  --radius: 14px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
}
* { 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(--good); }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 24px 16px; }
footer a { color: inherit; }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 16px 0 8px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }
.notice { background: var(--notice); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }

form { display: grid; gap: 12px; }
form.inline { display: inline; }
form.grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 0.95rem; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
button {
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px;
}
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

/* Phase 1 */
textarea, select, input[type=datetime-local] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
pre.code { overflow-x: auto; background: var(--bg); padding: 10px; border-radius: 8px; font-size: 0.8rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 16px; min-width: 0; }
fieldset.card { padding: 12px 16px; }
legend { font-weight: 700; padding: 0 4px; }
.error ul { margin: 0; padding-left: 20px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; background: var(--bg); border: 1px solid var(--border); }
.badge.open { color: var(--accent); border-color: var(--accent); }
.badge.closed { color: var(--danger); border-color: var(--danger); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checklist { padding-left: 0; list-style: none; display: grid; gap: 6px; }
.checklist li::before { margin-right: 8px; }
.checklist .done::before { content: "✓"; color: var(--accent); font-weight: 700; }
.checklist .todo::before { content: "•"; color: var(--danger); font-weight: 700; }
.counter { margin: 0 0 8px; color: var(--muted); }
fieldset.category.complete legend, fieldset.category.complete .counter { color: var(--accent); }
.pick-list, .player-admin { list-style: none; margin: 0; padding: 0; }
.pick-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border); }
.pick-list li:last-child { border-bottom: 0; }
label.pick { display: flex; align-items: center; gap: 10px; font-weight: 400; padding: 8px 0; flex: 1; min-width: 0; cursor: pointer; }
.player-name { font-weight: 600; }
label.captain { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.sticky-save {
  position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px;
}
.choices { display: flex; gap: 20px; }
fieldset.question select + select { margin-top: 8px; }
.player-admin li { border-bottom: 1px solid var(--border); padding: 6px 0; }
form.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.row input[type=text] { width: auto; flex: 1 1 160px; }
form.row select { width: auto; }
input.short { max-width: 90px; }
form.row input.short { flex: 0 0 80px; }
.seed { min-width: 32px; color: var(--muted); font-size: 0.85rem; }
.small { font-size: 0.8rem; }
td.wrap { white-space: normal; }
form.row button { padding: 6px 12px; }
/* Keep long legends inside the card instead of on its border. */
fieldset.card > legend { float: left; width: 100%; padding: 0; margin-bottom: 6px; }
fieldset.card > legend + * { clear: both; }

/* Phase 2 */
form.session > h2 { margin: 24px 0 8px; }
.winner-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.winner-choice label { border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-weight: 600; }
.winner-choice label:has(input:checked) { border-color: var(--accent); background: var(--notice); }
.row-inline { display: flex; align-items: end; gap: 16px; flex-wrap: wrap; }
.row-inline label:first-child { flex: 1 1 160px; }
fieldset.match.has-joker { border-color: var(--accent); }
details { border-top: 1px solid var(--border); padding: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
.past-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.past-list li { display: flex; flex-direction: column; }
.standings td.num, .standings th.num { text-align: right; }
.standings .me { background: var(--notice); }
.move-up { color: var(--accent); font-size: 0.8rem; }
.move-down { color: var(--danger); font-size: 0.8rem; }
.result-form .players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-form .player-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px; display: grid; gap: 6px; }
.result-form .player-box .name { font-weight: 700; }
.result-form label { font-weight: 400; font-size: 0.85rem; }
.result-form .buttons { display: flex; gap: 8px; flex-wrap: wrap; }
button.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.round-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.round-tabs a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-size: 0.9rem; }
.round-tabs a.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.status-finished legend::after { content: " ✓"; color: var(--accent); }

/* Phase 4 */
th.num, td.num { text-align: right; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare ul { margin: 4px 0 0; padding-left: 18px; }
h3 { font-size: 1rem; margin: 16px 0 4px; }
.bracket-round summary { font-size: 1.05rem; }
.bracket { list-style: none; padding: 0; margin: 8px 0 0; }
.bracket li { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); align-items: center; }
.bracket li:last-child { border-bottom: 0; }
.bracket li > span:last-child { text-align: right; }
.bracket .score { color: var(--muted); font-size: 0.85rem; text-align: center; white-space: nowrap; }
.bracket .won { font-weight: 700; }
.bracket .lost { color: var(--muted); }
.upset { border-left: 4px solid var(--danger); }
.upset p { margin: 4px 0; }
.day-winner { border-left: 4px solid var(--accent); }
.standings a { color: inherit; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
h2.group { margin: 24px 0 8px; }

/* On phones the standings show rank, name and total; tap a name for details. */
@media (max-width: 480px) {
  .standings .detail { display: none; }
}


/* --- Podium ------------------------------------------------------------ */
body { background: radial-gradient(120% 60% at 50% -10%, #1c2850 0%, var(--bg) 60%) fixed, var(--bg); }
h1, h2, h3, legend, .brand-name { font-family: var(--display); letter-spacing: .01em; }
h1 { font-size: 2.1rem; font-weight: 800; line-height: 1.05; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
h3 { font-size: 1.2rem; font-weight: 700; }
legend { font-weight: 700; font-size: 1.15rem; }
.card { background: var(--surface); border-color: var(--border); border-radius: var(--radius); }
button { border-radius: 999px; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea { background: var(--surface-2); border-color: var(--border); color: var(--text); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
td, th, .counter, .num { font-variant-numeric: tabular-nums; }

/* Header and brand: a dartboard ring as the mark. */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; flex: none; background: radial-gradient(circle, var(--accent) 0 18%, #f3eee4 19% 30%, var(--good) 31% 45%, #f3eee4 46% 58%, #11182e 59% 100%); box-shadow: 0 0 0 2px #f3eee4 inset; }
.brand-name { font-size: 1.6rem; font-weight: 800; line-height: 1; }

/* Navigation: header links on wide screens, a tab bar on phones. */
.tabs { display: flex; align-items: center; gap: 4px; }
.tabs > a, .more summary { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; cursor: pointer; }
.tabs > a:hover, .more summary:hover { color: var(--text); }
.tabs > a[aria-current="page"] { color: var(--text); background: var(--surface); }
.tabs > a svg, .more summary svg { width: 20px; height: 20px; flex: none; }
.more { position: relative; border: 0; padding: 0; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: grid; gap: 2px; z-index: 40; box-shadow: 0 12px 32px rgba(0,0,0,.45); }
.more:not([open]) .more-menu { display: none; }
.more-menu a, .more-menu button { display: block; font-size: 1rem; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; background: none; }
.more-menu a:hover, .more-menu button:hover { background: var(--notice); }
.more-menu form { margin: 0; display: block; }
.more-menu .logout { color: var(--danger); }
@media (max-width: 640px) {
  .topbar { display: flex; justify-content: space-between; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px)); background: #0d1326; border-top: 1px solid var(--border); }
  .tabs > a, .more summary { flex-direction: column; gap: 3px; padding: 4px 0; font-size: 11px; border-radius: 10px; justify-content: center; }
  .tabs > a svg, .more summary svg { width: 24px; height: 24px; }
  .tabs > a[aria-current="page"] { background: none; color: var(--text); }
  .tabs > a[aria-current="page"] svg { color: var(--accent); }
  .more { display: flex; justify-content: center; }
  .more-menu { top: auto; bottom: calc(100% + 10px); right: 6px; }
  main { padding-bottom: 8px; }
  .sticky-save { bottom: 76px; }
  footer { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* Standings: a scoreboard. */
.standings th { color: var(--muted); font-weight: 600; }
.standings td { border-color: var(--border); padding: 10px 6px; }
.standings td.rank { font-family: var(--display); font-size: 1.5rem; font-weight: 700; width: 58px; }
.standings td.total { font-family: var(--display); font-size: 1.45rem; font-weight: 700; color: #fff; }
.standings .me { background: linear-gradient(90deg, rgba(255,75,69,.22), rgba(255,75,69,0)); }
.standings a { color: var(--text); text-decoration: none; font-weight: 600; }
.standings a:hover { text-decoration: underline; }
.move-up { color: var(--good); } .move-down { color: var(--danger); }
/* Columns that may go on a phone. */
@media (max-width: 480px) { .detail { display: none; } }

/* News first: day winner in green, upsets in red. */
.day-winner { border-left: 0; background: linear-gradient(135deg, #1b5e3b, #123d29); border-color: #1f6b43; }
.upset { border-left: 0; background: linear-gradient(135deg, #7a1e22, #4a1216); border-color: #8a2a2e; }
.day-winner strong, .upset strong { font-family: var(--display); font-size: 1.15rem; letter-spacing: .01em; }
.upset .muted { color: #f3c9c9; }

/* Good news is green, choices are red. */
fieldset.category.complete legend, fieldset.category.complete .counter, .checklist .done::before, .badge.open { color: var(--good); }
.badge.open { border-color: var(--good); }
.winner-choice label:has(input:checked) { border-color: var(--accent); background: rgba(255,75,69,.14); }
fieldset.match.has-joker { border-color: var(--accent); }
.sticky-save { background: rgba(18,26,48,.97); border-color: var(--border); }
.notice { background: var(--notice); }
.round-tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Sync log */
.sync-log { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sync-log li { padding-left: 12px; border-left: 3px solid var(--border); }
.sync-log li.warn { border-left-color: #ffb020; }
.sync-log li.error { border-left-color: var(--danger); }
.sync-log li.info { border-left-color: var(--good); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
