/* Last Person Standing: Racing
   paddock #16352B · rail #EEF1EC · winner gold #D9A520 · placed blue #2F6690 · NR red #C2412D */
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("../vendor/fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Framework7 Icons"; font-weight: 400; src: url("../vendor/fonts/Framework7Icons-Regular.woff2") format("woff2"); }

:root {
  --ink: #16352B;
  --ink-soft: #4D6359;
  --paper: #EEF1EC;
  --surface: #FFFFFF;
  --line: #D3DBD5;
  --gold: #D9A520;
  --gold-tint: #FBF1D3;
  --blue: #2F6690;
  --blue-tint: #E1ECF4;
  --red: #C2412D;
  --red-tint: #F9E3DF;
  --chosen: #16352B;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;

  --f7-font-family: var(--body);
  --f7-ios-font-family: var(--body);
  --f7-md-font-family: var(--body);
  --f7-page-bg-color: var(--paper);
  --f7-bars-bg-color: #16352B;
  --f7-bars-text-color: #fff;
  --f7-bars-link-color: #fff;
  --f7-navbar-title-font-size: 22px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E3ECE6; --ink-soft: #9DB2A7; --paper: #0D1A15; --surface: #15261F; --line: #26392F;
    --gold-tint: #3A3015; --blue: #7FB3DB; --blue-tint: #1A2C3A; --red: #F07A66; --red-tint: #3A1E1A;
    --chosen: #2C6B54; --f7-bars-bg-color: #0F2219;
  }
}
body { background: var(--paper); color: var(--ink); }
.page { background: var(--paper); }
.navbar .title { font-family: var(--display); font-weight: 700; letter-spacing: .01em; }
.navbar .title, .navbar a.link, .navbar .icon, .navbar .if-not-md { color: #fff; }
.navbar-bg, .md .navbar .navbar-bg { background: var(--f7-bars-bg-color); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0; }

.button { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: .02em; text-transform: none; border-radius: 6px; height: 46px; }
.button-fill { background: #16352B; color: #fff; }
.button-quiet { color: var(--ink); background: transparent; border: 2px solid var(--ink); }
.button-danger { color: var(--red); background: transparent; border: 2px solid var(--red); }
.stack { display: grid; gap: 12px; }
.wrap { padding: 0 16px; max-width: 640px; margin: 0 auto; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.loading { text-align: center; padding: 32px 0; margin: 0; }
.tag { font-size: 12px; font-weight: 600; color: var(--ink-soft); background: var(--paper); padding: 1px 6px; border-radius: 3px; margin-left: 6px; vertical-align: 1px; }
.tag.nap { background: var(--gold-tint); color: var(--ink); }

/* sign in */
.signin { min-height: 100%; display: grid; align-content: center; gap: 28px; padding: 32px 20px calc(32px + env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; }
.signin .mark { font-family: var(--display); font-weight: 800; font-size: 52px; line-height: .92; }
.signin .mark span { display: block; }
.signin .mark em { display: inline-block; margin-top: 10px; font-style: normal; font-size: 22px; letter-spacing: .04em;
  background: var(--gold); color: #16352B; padding: 2px 10px 1px; border-radius: 3px; }
.signin p { font-size: 17px; line-height: 1.5; margin: 0; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 15px; }
.field input, .field select { height: 46px; border: 2px solid var(--line); border-radius: 6px; padding: 0 12px; font: 17px var(--body);
  background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; }
.field input:focus, .field select:focus { border-color: var(--ink); outline: none; }
.field .hint { font-size: 14px; color: var(--ink-soft); }
.codeinput { font-family: var(--display) !important; font-size: 28px !important; letter-spacing: .12em; text-transform: uppercase; height: 56px !important; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.form-error { color: var(--red); font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 2px solid var(--line); border-radius: 6px; padding: 3px; gap: 3px; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--ink); font: 600 16px var(--body); padding: 9px; border-radius: 4px; cursor: pointer; }
.seg button.on { background: #16352B; color: #fff; }

/* home */
.comp-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 16px; background: var(--surface); border-left: 6px solid var(--line); border-radius: 4px; color: inherit; }
.comp-row.active { border-left-color: var(--ink); }
.comp-row.open { border-left-color: var(--blue); }
.comp-row.winner { border-left-color: var(--gold); }
.comp-row h3 { font-size: 24px; }
.comp-row .meta { font-size: 15px; color: var(--ink-soft); margin-top: 2px; }
.comp-row .pts { font-family: var(--display); font-weight: 800; font-size: 32px; text-align: right; line-height: 1; }
.comp-row .pts small { display: block; font-family: var(--body); font-weight: 500; font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.comp-row .nudge { grid-column: 1 / -1; font-weight: 600; }
.comp-row .nudge.todo { color: var(--red); }
.empty { padding: 40px 16px; text-align: center; display: grid; gap: 16px; justify-items: center; }
.empty h2 { font-size: 30px; }
.empty p { max-width: 34ch; margin: 0; line-height: 1.5; }

/* competition */
.scoreboard { background: #16352B; color: #EEF1EC; border-radius: 8px; padding: 18px; display: grid; gap: 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scoreboard { background: #071510; } }
.scoreboard .label { font-size: 14px; opacity: .8; }
.scoreboard .big { font-family: var(--display); font-weight: 800; font-size: clamp(42px, 13vw, 60px); line-height: .92; }
.scoreboard .big.none { opacity: .45; }
.scoreboard .sub { font-size: 15px; opacity: .8; }
.scoreboard .deadline { justify-self: start; background: var(--gold); color: #16352B; font-weight: 700; padding: 4px 10px; border-radius: 3px; font-size: 15px; }
.scoreboard .deadline.passed { background: transparent; color: inherit; border: 1px solid currentColor; opacity: .75; }
.scoreboard .button { margin-top: 4px; background: #fff; color: #16352B; }
.statline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.statline div { background: var(--surface); padding: 10px 12px; border-radius: 4px; }
.statline b { display: block; font-family: var(--display); font-size: 28px; line-height: 1; }
.statline span { font-size: 13px; color: var(--ink-soft); }
.banner { padding: 14px 16px; border-radius: 4px; font-weight: 600; line-height: 1.4; }
.banner.win { background: var(--gold-tint); border-left: 6px solid var(--gold); }
.banner.out { background: var(--red-tint); border-left: 6px solid var(--red); }
.banner.info { background: var(--surface); border-left: 6px solid var(--ink-soft); font-weight: 500; }
.board { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 4px; overflow: hidden; }
.board th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.board td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board .rank { font-family: var(--display); font-weight: 700; font-size: 20px; width: 28px; color: var(--ink-soft); }
.board .who { font-weight: 600; }
.board .places { font-size: 14px; color: var(--ink-soft); white-space: nowrap; text-align: center; }
.board .pts { font-family: var(--display); font-weight: 800; font-size: 24px; text-align: right; width: 48px; }
.board tr.mine td { background: var(--blue-tint); }
.board tr.winner .rank { color: var(--gold); }

/* card */
.daytabs { display: flex; gap: 6px; overflow-x: auto; }
.daytabs button { width: auto; appearance: none; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: 600 15px var(--body); padding: 8px 14px; border-radius: 20px; white-space: nowrap; cursor: pointer; }
.daytabs button.on { background: #16352B; border-color: #16352B; color: #fff; }
.cardbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--gold-tint); border: 1px solid var(--gold); padding: 10px 12px; border-radius: 6px; font-size: 15px; }
.cardbar.locked { background: var(--surface); border-color: var(--line); }
.race { background: var(--surface); border-radius: 6px; overflow: hidden; }
.race > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.race.done > header { box-shadow: inset 4px 0 0 var(--ink); }
.race .rhead { min-width: 0; flex: 1; }
.race .off { font-family: var(--display); font-weight: 800; font-size: 26px; margin-right: 8px; }
.race .course { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--ink-soft); }
.race .rname { font-weight: 600; margin: 2px 0; }
.napbtn { flex: none; width: auto; appearance: none; border: 2px solid var(--gold); background: transparent; color: var(--ink); font: 700 15px var(--display); letter-spacing: .03em;
  padding: 6px 10px; border-radius: 4px; white-space: nowrap; cursor: pointer; }
.napbtn.on { background: var(--gold); color: #16352B; }
.napbtn:disabled { opacity: .6; cursor: default; }
.runners { display: grid; }
.runner { appearance: none; display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); padding: 10px 14px; cursor: pointer; font: inherit; min-height: 56px; }
.runner:last-child { border-bottom: 0; }
.runner .cloth { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 4px; background: var(--paper); border: 1px solid var(--line);
  font-family: var(--display); font-weight: 800; font-size: 19px; }
.runner .horse b { display: block; font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1; }
.runner .horse small { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.runner .end { font-size: 14px; }
.runner .tick { font-size: 20px; font-weight: 700; }
.runner.chosen { background: var(--chosen); color: #fff; }
.runner.chosen .horse small { color: rgba(255,255,255,.8); }
.runner.chosen .cloth { background: #fff; color: #16352B; border-color: #fff; }
.runner.nr { opacity: .55; }
.runner.nr .horse b { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.runner:disabled { cursor: default; }
.runner:not(:disabled):not(.chosen):hover { background: var(--paper); }
.mypick { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--paper); }
.pos { display: inline-block; font-family: var(--display); font-weight: 800; font-size: 15px; padding: 1px 6px; border-radius: 3px; background: var(--paper); color: var(--ink); }
.pos.p1 { background: var(--gold); color: #16352B; }
.pos.p2, .pos.p3 { background: var(--blue-tint); color: var(--blue); }
.runner.chosen .pos { background: #fff; color: #16352B; }
.chip { display: inline-flex; align-items: center; justify-content: center; line-height: 1; min-height: 26px; box-sizing: border-box; align-self: center; min-width: 34px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 16px; padding: 2px 8px; border-radius: 3px; background: var(--paper); }
.chip.won { background: var(--gold); color: #16352B; }
.chip.placed { background: var(--blue-tint); color: var(--blue); }

/* results */
.podium { margin: 0; padding: 10px 14px; list-style: none; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.pickrows { display: grid; }
.pickrow { display: grid; grid-template-columns: minmax(80px, 1fr) 1.4fr auto; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.pickrow:last-child { border-bottom: 0; }

/* manage */
.code { font-family: var(--display); font-weight: 800; font-size: 44px; letter-spacing: .12em; background: var(--surface); text-align: center; padding: 12px; border-radius: 4px; border: 2px dashed var(--line); }
.players { background: var(--surface); border-radius: 4px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.rules-list { background: var(--surface); border-radius: 4px; padding: 4px 14px; }
.rules-list p { margin: 10px 0; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
