:root {
  --bg: #fbf4e6;
  --surface: #fffdf8;
  --ink: #2b1a10;
  --muted: #7a6455;
  --line: #e8dcc6;
  --salsa: #d6402b;
  --salsa-ink: #b32f1d;
  --lime: #5d8a12;
  --tortilla: #f1dfb8;
  --flag: #fff1c2;
  --radius: 14px;
  --display: "Bricolage Grotesque", ui-rounded, "Avenir Next", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1410;
    --surface: #271d17;
    --ink: #f6eada;
    --muted: #b7a290;
    --line: #3d2f26;
    --salsa: #ef5a43;
    --salsa-ink: #ff8a75;
    --lime: #a3d14b;
    --tortilla: #4a3a26;
    --flag: #4a3b12;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
main, .hero, .tabs, .foot { max-width: 720px; margin-inline: auto; padding-inline: 16px; }
h1, h2, h3, .big-score, .rank, .save-total { font-family: var(--display); }
h2 { font-size: 1.5rem; margin: 2rem 0 .75rem; letter-spacing: -.01em; }
small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

/* Hero */
.hero { padding-top: 40px; padding-bottom: 20px; }
.eyebrow { margin: 0 0 6px; font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--salsa-ink); }
h1 { margin: 0; font-size: clamp(3rem, 15vw, 5.5rem); line-height: .88; font-weight: 800; letter-spacing: -.04em; }
h1 span { display: block; color: var(--salsa); }
.tagline { margin: 16px 0 0; max-width: 34ch; color: var(--muted); font-size: 1.05rem; }

/* Tabs */
.tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; padding-block: 10px; background: var(--bg); }
.tabs a {
  flex: 1; text-align: center; padding: 10px 6px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 650; font-size: .95rem;
  border: 1.5px solid var(--line); background: var(--surface);
}
.tabs a[aria-current] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--salsa); border-color: var(--salsa); color: #fff; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.btn:focus-visible, .tabs a:focus-visible, summary:focus-visible, input:focus-visible + span, .link:focus-visible,
label.btn:has(+ input:focus-visible) { outline: 3px solid var(--lime); outline-offset: 2px; }
.link { border: 0; background: none; padding: 4px; color: var(--muted); font: inherit; font-size: .8rem; text-decoration: underline; cursor: pointer; }

/* Standings */
.empty { padding: 28px 20px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; margin-top: 12px; }
.empty strong { display: block; color: var(--ink); font-family: var(--display); font-size: 1.25rem; }
.awards { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0; margin: 0 0 12px; }
.awards li { background: var(--tortilla); border-radius: 12px; padding: 10px 12px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.awards span { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 650; color: var(--muted); margin-bottom: 2px; }
.standings, .schedule, .rater-list, .rubric-list { list-style: none; padding: 0; margin: 0; }
.standings > li { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.standings > li:first-child { border-color: var(--salsa); }
summary {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px;
  padding: 14px 16px; cursor: pointer; list-style: none; border-radius: var(--radius);
}
summary::-webkit-details-marker { display: none; }
.rank { font-size: 1.6rem; font-weight: 800; width: 1.4ch; text-align: center; color: var(--muted); }
.standings > li:first-child .rank { color: var(--salsa); }
.who-where { min-width: 0; }
.who-where strong { display: block; line-height: 1.25; }
.who-where small { display: block; }
.big-score { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.meter { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; display: block; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--salsa); }
.meter.small { height: 6px; flex: 1; }
.meter.small i { background: var(--lime); }
.detail { padding: 4px 16px 16px; border-top: 1.5px solid var(--line); }
.breakdown { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; align-items: center; }
.breakdown dt { font-size: .9rem; }
.breakdown dd { margin: 0; display: flex; align-items: center; gap: 10px; }
.breakdown .num { width: 5.2em; text-align: right; font-size: .9rem; font-weight: 650; }
.rater-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.rater-name { font-weight: 650; overflow-wrap: anywhere; }
.rater-list q { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }

/* Route */
.schedule li {
  display: grid; grid-template-columns: 5.4rem 1fr auto auto; align-items: center; gap: 10px;
  padding: 12px 0; border-top: 1.5px solid var(--line);
}
.schedule li.is-today { background: var(--tortilla); border-radius: var(--radius); border-color: transparent; padding-inline: 12px; margin-inline: -12px; }
.day { font-size: .85rem; color: var(--muted); line-height: 1.3; white-space: nowrap; }
.day b { display: block; color: var(--ink); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.pill { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--line); white-space: nowrap; }
.pill.now { background: var(--salsa); color: #fff; }
.pill.done { background: var(--lime); color: var(--bg); }
@media (max-width: 420px) {
  .schedule li { grid-template-columns: 5.4rem 1fr auto; }
  .schedule .pill { grid-column: 2; grid-row: 2; justify-self: start; }
  .schedule .btn { grid-row: 1 / span 2; grid-column: 3; }
}

/* Score form */
.paper-bar { margin-top: 16px; padding: 14px 16px; background: var(--tortilla); border-radius: var(--radius); }
.paper-bar p { margin: 0 0 10px; }
.paper-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.paper-actions .btn { flex: 1 1 auto; }
#scan-result { margin-top: 12px; }
#scan-status { font-weight: 650; }
#scan-preview { display: block; max-width: 100%; max-height: 70vh; border-radius: 10px; }
.error { color: var(--salsa-ink); }

.who { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.who label, .notes { display: block; font-weight: 650; font-size: .9rem; }
input:not([type=radio]):not([type=file]), textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px;
}
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: right 18px center, right 13px center; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--lime); outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.stops { margin-top: 18px; }
.stops legend { font-weight: 650; font-size: .9rem; padding: 0; margin-bottom: 4px; }
.stop-picker { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; margin-inline: -16px; scrollbar-width: none; }
.stop-picker label { flex: 1 0 auto; }
.stop-picker input, .pips input { position: absolute; opacity: 0; pointer-events: none; }
.stop-picker span {
  display: block; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; line-height: 1.25; text-align: center;
}
.stop-picker b, .stop-picker small { display: block; white-space: nowrap; }
.stop-picker input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.stop-picker input:checked + span small { color: inherit; opacity: .75; }
.form-note { margin: 10px 0 0; font-size: .9rem; color: var(--muted); }

.group { margin-top: 22px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.group h3 { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 2px; font-size: 1.2rem; }
.group h3 small { font-family: system-ui, sans-serif; font-size: .8rem; font-weight: 650; }
.crit { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.crit legend { float: left; width: 100%; grid-column: 1; padding: 0; font-weight: 650; }
.crit .hint { grid-column: 1; margin: 0; font-size: .85rem; color: var(--muted); }
.crit .pts { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.crit.flagged { background: var(--flag); margin-inline: -16px; padding-inline: 16px; }
.pips { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.pips.bool { grid-template-columns: repeat(2, 1fr); }
.pips span {
  display: grid; place-items: center; height: 46px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); font-weight: 700; font-size: 1.05rem; cursor: pointer; user-select: none;
}
.pips input:checked + span { background: var(--salsa); border-color: var(--salsa); color: #fff; }
.notes { margin-top: 22px; }
.save-bar {
  position: sticky; bottom: 0; z-index: 4; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  margin: 20px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1.5px solid var(--line);
}
.save-total { font-size: 2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.save-total span { font-size: .9rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
#save-status { margin: 0; font-size: .85rem; font-weight: 650; text-align: right; }

/* People */
.people > li:first-child { border-color: var(--line); }
.initials {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: var(--tortilla); font-family: var(--display); font-weight: 800; font-size: .95rem;
}
.stop-strip { grid-column: 1 / -1; list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; margin: 4px 0 0; }
.stop-strip li { min-width: 0; padding: 6px 4px; border-radius: 10px; background: var(--bg); text-align: center; line-height: 1.2; }
.stop-strip li.done { background: var(--tortilla); }
.stop-strip small { display: block; font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-strip b { font-size: 1rem; }
.stop-strip li:not(.done) b { color: var(--muted); font-weight: 400; }
.table-wrap { overflow-x: auto; margin: 12px -16px 0; padding-inline: 16px; }
.ratings { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ratings th, .ratings td { padding: 5px 6px; border-top: 1px solid var(--line); }
.ratings thead th { border-top: 0; font-size: .75rem; color: var(--muted); font-weight: 650; white-space: nowrap; }
.ratings th[scope=row] { text-align: left; font-weight: 500; white-space: nowrap; }
.ratings td, .ratings thead th:not(:first-child) { text-align: center; }
.ratings thead th:first-child { text-align: left; }
.ratings tr.sec th { text-align: left; padding-top: 12px; font-family: var(--display); font-size: .95rem; border-top: 0; }
.ratings tfoot th, .ratings tfoot td { border-top: 1.5px solid var(--ink); font-weight: 800; }
.table-note { font-size: .8rem; margin: 6px 0 0; }

/* Rubric */
.lede { color: var(--muted); max-width: 62ch; }
.lede strong { color: var(--ink); }
.rubric-list li { display: grid; grid-template-columns: 1fr auto 2.2em; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.rubric-list small { display: block; font-size: .85rem; }
.rubric-list .num { font-size: .85rem; color: var(--muted); }
.rubric-list .max { text-align: right; font-weight: 800; font-size: 1.05rem; color: var(--ink); }

.foot { padding-block: 40px; color: var(--muted); font-size: .85rem; text-align: center; }
