/* Public pages (Schedule, Standings, Scores, Player). Dark, phone-first. Admin keeps style.css. */
:root {
  --bg: #0B100D;
  --surface: #131A16;
  --surface-2: #1A241E;
  --surface-3: #1F2A23;
  --border: #1F2923;
  --border-strong: #243029;
  --hero-bg: #12251A;
  --hero-border: #1F3A2A;
  --hero-line: #2A4A37;
  --text: #EDF2EE;
  --text-2: #DCE5DF;
  --text-soft: #B9C7BE;
  --muted: #93A198;
  --dim: #7D8A82;
  --disabled: #4E5A53;
  --accent: #A3E35F;
  --on-accent: #0B100D;
  --accent-tint: rgba(163, 227, 95, 0.14);
  --accent-tint-text: #CFEFA9;
  --gold: #E9C46A;
  --gold-tint: rgba(233, 196, 106, 0.14);
  --finals-bg: #1C1A12;
  --finals-border: #3A3320;
  --finals-chip-border: #4A4128;
  --finals-title: #FBF6E9;
  --finals-text: #C9BF9F;
  --finals-text-2: #E8DFC6;
  --finals-chip-text: #F1E7CB;
  --tabbar-bg: rgba(11, 16, 13, 0.94);
  --chart-connector: #34423A;
  --win-row: #15241B;
  --red: #E8766A;
  --red-tint: rgba(232, 118, 106, 0.14);
  --dm-row: rgba(233, 196, 106, 0.06);
  --sans: 'Geist', 'Helvetica Neue', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body.app {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.4 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* one phone-width column; centered on wider screens */
.shell {
  max-width: 560px; margin: 0 auto; min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 12px) 0 calc(84px + env(safe-area-inset-bottom) + 28px);
}

/* ---------- header ---------- */
.hdr { padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; flex: none; }
.logo-text { display: flex; flex-direction: column; gap: 1px; }
.logo-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.logo-sub { font-size: 12px; color: var(--muted); }
.hdr-tools { display: flex; align-items: center; gap: 4px; }

/* pill controls draw at 36px but keep a 44px tap area */
.pill { position: relative; display: flex; align-items: center; height: 44px; }
.pill::before { content: ""; position: absolute; inset: 4px 0; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); pointer-events: none; }
.pill select { position: relative; z-index: 1; appearance: none; -webkit-appearance: none; height: 44px; border: 0; background: transparent; padding: 0 32px 0 12px; font: 500 13px var(--mono); color: var(--text); cursor: pointer; }
.pill.sans select { font: 500 13px var(--sans); }
.pill select:focus-visible { outline: none; }
.pill:focus-within::before { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill svg { position: absolute; right: 12px; z-index: 1; pointer-events: none; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.icon-btn span { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.icon-btn:focus-visible { outline: none; }
.icon-btn:focus-visible span { outline: 2px solid var(--accent); outline-offset: 2px; }

h1.title { margin: 28px 20px 0; font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; }

/* ---------- sections ---------- */
.section { margin-top: 32px; }
.section-head { padding: 0 20px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.section-head .aside { font-size: 12px; color: var(--muted); }
.section-head .legend { font: 500 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }

.card { margin: 0 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.card > * + * { border-top: 1px solid var(--border); }
.card .col-head + * { border-top: 0; }
.col-head { padding: 12px 16px; display: flex; align-items: center; gap: 12px; font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); border-bottom: 1px solid var(--border); }
/* sortable headings (static/sort.js): the tap area fills the header's height; the sorted column is brighter, with an arrow */
.col-head button { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; border-radius: 4px; padding: 12px 0; margin: -12px 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.col-head button:focus-visible { outline: 2px solid var(--accent); outline-offset: -8px; }
.col-head button > span { position: relative; }
.col-head button[data-dir] { color: var(--text-2); }
.col-head button[data-dir] > span::before { content: "▲"; position: absolute; right: 100%; top: 50%; transform: translateY(-50%); margin-right: 3px; font-size: 7px; color: var(--accent); }
.col-head button[data-dir="desc"] > span::before { content: "▼"; }
.col-head .c-player { flex: 1; text-align: left; }
.col-head .c-player > span::before { right: auto; left: 100%; margin: 0 0 0 4px; }

/* ---------- hero cards ---------- */
.hero { position: relative; overflow: hidden; margin: 20px 16px 0; border-radius: 24px; background: var(--hero-bg); border: 1px solid var(--hero-border); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.hero > * { position: relative; }
.hero .contour { position: absolute; right: -90px; top: -40px; opacity: 0.9; }
.eyebrow { display: flex; align-items: center; gap: 8px; font: 600 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.eyebrow.accent { color: var(--accent); }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--accent); }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-when { font: 500 12px var(--mono); color: var(--text-soft); }
.hero-titles { display: flex; flex-direction: column; gap: 6px; }
.hero-sub { font-size: 13px; color: var(--text-soft); }
.hero-course { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; text-wrap: balance; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); font-size: 12px; color: var(--text-2); }
.chip.gold { background: var(--gold-tint); color: var(--gold); }
.hero-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; }
.date-stack { display: flex; flex-direction: column; gap: 2px; }
.date-stack .wd { font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.date-stack .md { font: 600 20px var(--mono); letter-spacing: -0.02em; }
.btn-primary { height: 44px; padding: 0 18px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; flex: none; }

/* ---------- season progress ---------- */
.progress { margin: 24px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.progress-top .mono { font-size: 12px; font-weight: 500; }
.segments { display: grid; gap: 4px; }
.segments span { height: 6px; border-radius: 3px; background: var(--border-strong); }
.segments span.post { background: var(--finals-border); }
.segments span.done { background: var(--accent); }
.progress-cap { display: flex; justify-content: space-between; gap: 8px; font: 500 11px var(--mono); color: var(--dim); }

/* ---------- schedule rows ---------- */
.srow { min-height: 68px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; }
.wk-badge { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font: 600 14px var(--mono); color: var(--text-2); }
.wk-badge.small-text { font-size: 13px; }
.wk-badge .wk { font: 500 9px var(--mono); letter-spacing: 0.08em; color: var(--dim); }
.srow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.srow-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow-sub { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.srow-sub .won { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow-date { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.srow-date .md { font: 500 14px var(--mono); }
.srow-date .wd { font: 500 11px var(--mono); color: var(--dim); }
.tag-major { padding: 2px 7px; border-radius: 6px; background: var(--gold-tint); color: var(--gold); font: 600 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; flex: none; }
.break-row { min-height: 44px; padding: 0 16px; display: flex; align-items: center; gap: 14px; background: repeating-linear-gradient(135deg, #111814 0 8px, #131A16 8px 16px); }
.break-row .dash { width: 40px; flex: none; text-align: center; font: 500 12px var(--mono); color: var(--dim); }
.break-row .label { flex: 1; font-size: 13px; color: var(--muted); }
.break-row .md { font: 500 12px var(--mono); color: var(--dim); }

.finals { margin: 12px 16px 0; border-radius: 24px; background: var(--finals-bg); border: 1px solid var(--finals-border); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.finals-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.finals .eyebrow { color: var(--gold); }
.finals-date { font: 500 13px var(--mono); color: var(--finals-text-2); }
.finals-course { font-size: 26px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; color: var(--finals-title); }
.finals-meta { font-size: 13px; color: var(--finals-text); }
.finals-extra { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--finals-border); font-size: 12px; color: var(--finals-text); }
.finals-chip { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--finals-chip-border); font-size: 12px; color: var(--finals-chip-text); }

/* ---------- playoff bracket ---------- */
.bracket-card { margin: 12px 16px 0; padding: 16px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.br-title { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.bracket-card .br-title + .death-round { margin-top: -6px; }
.death-round { display: flex; flex-direction: column; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.death-round p { margin: 0; font-size: 13px; color: var(--text-soft); }
.death-round strong { font-weight: 600; color: var(--text); }
.death-round .out { color: var(--muted); }
.br-head { font: 500 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
/* Every column is the same height and each match splits its column evenly, so a match's middle lines up with
   the slot it feeds in the next column. Lines: a bracket off each match (::after) and a stub into each slot (::before). */
.bracket { --br-gap: 16px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr); column-gap: var(--br-gap); }
.br-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.br-round { height: 304px; display: flex; flex-direction: column; }
.br-match { flex: 1; display: flex; flex-direction: column; position: relative; }
.br-slot { flex: 1; display: flex; align-items: center; position: relative; }
.br-box { width: 100%; height: 30px; padding: 0 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border-strong); display: flex; align-items: center; font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.br-box.empty { background: none; border-style: dashed; border-color: var(--chart-connector); }
.br-box.dm { border-style: dashed; border-color: var(--muted); color: var(--text-soft); }
.br-box.champ { height: auto; padding: 10px 4px; flex-direction: column; justify-content: center; gap: 4px; background: var(--finals-bg); border-color: var(--finals-border); color: var(--gold); font-size: 11px; }
.br-match::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: calc(var(--br-gap) / -2); width: calc(var(--br-gap) / 2); border: 1px solid var(--chart-connector); border-left: 0; border-radius: 0 6px 6px 0; }
.br-col.champ .br-match::after { content: none; }
.br-col + .br-col .br-slot::before { content: ""; position: absolute; top: 50%; left: calc(var(--br-gap) / -2); width: calc(var(--br-gap) / 2); border-top: 1px solid var(--chart-connector); }
/* very narrow phones: tighter gaps and a smaller champion label */
@media (max-width: 359px) { .bracket { --br-gap: 10px; } .br-box.champ { padding-inline: 2px; font-size: 10px; } }

/* ---------- standings ---------- */
.notice { margin: 20px 16px 0; padding: 14px 16px; border-radius: 18px; background: var(--hero-bg); border: 1px solid var(--hero-border); display: flex; align-items: center; gap: 12px; }
.notice-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.notice-text { display: flex; flex-direction: column; gap: 2px; }
.notice-text strong { font-size: 14px; font-weight: 600; }
.notice-text span { font-size: 13px; color: var(--text-soft); }
.lb { margin-top: 24px; }
.c-pos { width: 20px; flex: none; text-align: center; }
.c-hcp { width: 48px; flex: none; text-align: right; }
.c-w { width: 32px; flex: none; text-align: right; }
.c-pts { width: 44px; flex: none; text-align: right; }
.prow { min-height: 60px; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.prow .c-pos { font: 500 13px var(--mono); color: var(--dim); }
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.who-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.who-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 999px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--text-2); }
.avatar.posted { background: var(--accent); color: var(--on-accent); }
.avatar.waiting { background: none; border: 1px dashed var(--chart-connector); color: var(--muted); }
.prow .c-hcp { font: 500 14px var(--mono); color: var(--text-2); }
.prow .c-w { font: 500 14px var(--mono); color: var(--muted); }
.prow .c-pts { font: 600 18px var(--mono); letter-spacing: -0.02em; }
/* playoff zones (current season): the death match places get a faint gold wash, and a dashed red line
   marks where the playoffs cut off. Each zone's tag sits on its top edge. The tint follows the player when
   the table is re-sorted, but the line and tags only make sense in place order, so they hide otherwise. */
.prow { position: relative; }
.prow.dm { background: var(--dm-row); }
.card > .prow.out.zone-start { border-top: 1px dashed var(--red); }
.zone-tag { position: absolute; left: 12px; top: 0; transform: translateY(-50%); padding: 1px 7px; border-radius: 6px; font: 600 10px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.dm .zone-tag { color: var(--gold); background: linear-gradient(var(--gold-tint), var(--gold-tint)), var(--surface); }
.out .zone-tag { color: var(--red); background: linear-gradient(var(--red-tint), var(--red-tint)), var(--surface); }
.lb:has(.col-head .c-pos:not([data-dir="asc"])) .zone-tag { display: none; }
.lb:has(.col-head .c-pos:not([data-dir="asc"])) > .prow.out.zone-start { border-top: 1px solid var(--border); }

.how { margin: 24px 16px 0; padding: 18px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.how h2 { margin: 0; font-size: 16px; font-weight: 600; }
.how p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-soft); text-wrap: pretty; }
.ladder { display: flex; flex-direction: column; gap: 8px; }
.ladder-name { font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ladder-name.gold { color: var(--gold); }
.ladder-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cell { height: 44px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.cell .pl { font: 500 10px var(--mono); color: var(--dim); }
.cell .pt { font: 600 14px var(--mono); color: var(--text); }
.cell.bonus { background: var(--gold-tint); }
.cell.bonus .pl { color: #B9A36A; }
.cell.bonus .pt { color: var(--gold); }

/* ---------- scores ---------- */
.week-chips { margin-top: 16px; padding: 0 16px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.week-chips::-webkit-scrollbar { display: none; }
.week-chip { height: 40px; min-width: 44px; padding: 0 12px; flex: none; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft); font: 600 13px var(--mono); display: flex; align-items: center; justify-content: center; gap: 5px; }
.week-chip[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.week-chip .gdot { width: 5px; height: 5px; border-radius: 999px; background: var(--gold); }

.round { margin: 16px 16px 0; padding: 18px; border-radius: 22px; background: var(--hero-bg); border: 1px solid var(--hero-border); display: flex; flex-direction: column; gap: 12px; }
.round-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.round-top .eyebrow { color: var(--text-soft); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--text-2); font-size: 11px; font-weight: 500; }
.tag.accent { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.tag.gold { background: var(--gold-tint); color: var(--gold); font-weight: 600; }
.round-titles { display: flex; flex-direction: column; gap: 4px; }
.round-course { font-size: 24px; line-height: 1.15; font-weight: 600; letter-spacing: -0.025em; }
.round-meta { font-size: 13px; color: var(--text-soft); }
.posted { display: flex; flex-direction: column; gap: 6px; }
.posted .bar { display: grid; gap: 4px; }
.posted .bar span { height: 4px; border-radius: 2px; background: var(--hero-line); }
.posted .bar span.on { background: var(--accent); }
.posted .cap { font: 500 12px var(--mono); color: var(--text-soft); }
.posted .note { font-size: 12px; color: var(--muted); }

.filter { margin: 20px 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter label { font-size: 13px; color: var(--muted); }
.select-box { position: relative; display: flex; align-items: center; }
.select-box select { appearance: none; -webkit-appearance: none; height: 44px; padding: 0 36px 0 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 14px var(--sans); cursor: pointer; }
.select-box svg { position: absolute; right: 12px; pointer-events: none; color: var(--muted); }
.scorecards { margin-top: 12px; }
.c-num { width: 52px; flex: none; text-align: right; }
.c-sm { width: 40px; flex: none; text-align: right; }
.c-badge { width: 32px; flex: none; display: flex; justify-content: center; }
.score-row { min-height: 64px; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.score-row.win { background: var(--win-row); }
.score-row .big { font: 600 20px var(--mono); letter-spacing: -0.02em; }
.score-row .mid { font: 500 14px var(--mono); color: var(--text-soft); }
.score-row .net { font: 600 18px var(--mono); letter-spacing: -0.02em; }
.score-row.waiting { min-height: 60px; }
.score-row.waiting .who-name { color: #C9D4CD; }
.score-row.waiting .who-sub { font-family: var(--sans); color: var(--dim); }
.score-row .na { font: 500 16px var(--mono); color: var(--disabled); }
.score-row .na.sm { font-size: 14px; }
/* stroke play has four number columns, so tighter spacing keeps room for the player on narrow phones */
.scorecards.stroke .score-row, .scorecards.stroke .col-head { gap: 8px; }
.scorecards.stroke .c-sm { width: 38px; }
.scorecards.stroke .c-sm:last-child { width: 44px; }  /* split points, like 10.33 */
.pos-badge { min-width: 28px; padding: 2px 6px; border-radius: 6px; text-align: center; background: var(--surface-3); color: var(--text-soft); font: 600 11px var(--mono); }
.pos-badge.podium { background: var(--accent-tint); color: var(--accent-tint-text); }
.pos-badge.win { background: var(--accent); color: var(--on-accent); }
.pos-badge.none { background: none; color: var(--disabled); }
.empty-note { margin: 12px 16px 0; padding: 18px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; color: var(--text-soft); line-height: 1.5; }
.empty-note strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

.locations { margin-top: 24px; }
.loc-row { padding: 12px 16px; display: flex; align-items: flex-start; gap: 14px; }
.loc-row .wk-badge { color: var(--text-soft); }
.loc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.loc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.loc-count { font: 500 12px var(--mono); color: var(--dim); flex: none; }
.loc-players { display: flex; flex-wrap: wrap; gap: 6px; }
.loc-chip { min-height: 28px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.loc-chip.posted { background: var(--accent-tint); color: var(--accent-tint-text); }

/* ---------- player ---------- */
.topbar { padding: 0 12px; display: flex; align-items: center; justify-content: space-between; }
.back { height: 44px; padding: 0 10px 0 4px; display: flex; align-items: center; gap: 2px; font-size: 15px; font-weight: 500; color: var(--text-soft); }
.identity { margin: 20px 20px 0; display: flex; align-items: center; gap: 16px; }
.avatar-lg { width: 64px; height: 64px; flex: none; border-radius: 999px; background: var(--surface-3); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 600; color: var(--text); }
.identity-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.identity h1 { margin: 0; font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; overflow: hidden; text-overflow: ellipsis; }
.identity-sub { font-size: 13px; color: var(--muted); }
.hcp-index { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.hcp-index .lbl { font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.hcp-index .val { font: 600 28px var(--mono); letter-spacing: -0.03em; color: var(--accent); }
.seg { margin: 24px 16px 0; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.seg a { height: 40px; border-radius: 10px; color: var(--text-soft); display: flex; align-items: center; justify-content: center; font: 500 13px var(--mono); }
.seg a[aria-current="page"] { background: var(--text); color: var(--bg); font-weight: 600; }

.hero.player-hero { margin-top: 16px; }
.hero.player-hero .contour { right: -110px; top: -50px; }
.hero-course.sm { font-size: 26px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 14px; border-top: 1px solid var(--hero-border); }
.hero-stats span { display: flex; flex-direction: column; gap: 2px; }
.hero-stats b { font: 600 20px var(--mono); }
.hero-stats small { font-size: 12px; color: var(--text-soft); }
.last-season { margin: 12px 16px 0; padding: 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.last-top { display: flex; align-items: center; justify-content: space-between; }
.last-top b { display: block; font-size: 15px; font-weight: 600; }
.last-top small { font: 500 12px var(--mono); color: var(--muted); }
.round-btn { width: 32px; height: 32px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); display: flex; align-items: center; justify-content: center; }
.mini-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mini-tiles span { padding: 10px 8px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini-tiles b { font: 600 16px var(--mono); }
.mini-tiles small { font-size: 11px; color: var(--muted); }

/* six columns, so a row can hold one wide tile, two halves, or three thirds */
.tiles { margin: 16px 16px 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.tile { grid-column: span 3; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile.wide { grid-column: 1 / -1; }
.tile.third { grid-column: span 2; padding: 14px 12px; }
.tile.third .val { font-size: 22px; }
.tile.lead { background: var(--hero-bg); border-color: var(--hero-border); }
.tile .lbl { font-size: 12px; color: var(--muted); }
.tile.lead .lbl { color: var(--text-soft); }
.tile .val { font: 600 28px var(--mono); letter-spacing: -0.03em; white-space: nowrap; }
.tile.lead .val { color: var(--accent); }
.tile .val small { font: 500 13px var(--sans); color: var(--muted); letter-spacing: 0; }

.chart-card { margin: 12px 16px 0; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.chart-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-top > span:first-child { flex: none; }
.chart-top h2 { margin: 0; font-size: 15px; font-weight: 600; }
.chart-top .sub { font-size: 12px; color: var(--muted); }
.readout { min-width: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.readout-top { display: flex; align-items: baseline; gap: 8px; }
.readout b { font: 600 18px var(--mono); }
.readout small { font: 500 11px var(--mono); color: var(--muted); }
.readout > small { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }  /* long course names */
.plot { position: relative; height: 140px; margin: 0 -8px; }
.plot svg { position: absolute; inset: 0; overflow: visible; }
.plot .axis { fill: var(--dim); font: 400 11px var(--mono); }
.plot .avg-label { fill: var(--muted); font: 400 10px var(--mono); }
.plot button { position: absolute; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 999px; }
.plot button span { width: 8px; height: 8px; border-radius: 999px; background: var(--text-2); box-shadow: 0 0 0 2px var(--surface); }
.plot button span.counts { background: var(--accent); }
.plot button span.open { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--muted), 0 0 0 2px var(--surface); }
.plot button[aria-pressed="true"] span { width: 12px; height: 12px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
.plot button[aria-pressed="true"] span.open { box-shadow: inset 0 0 0 2px var(--muted), 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font: 500 11px var(--mono); color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key { width: 8px; height: 8px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--muted); }
.chart-legend .key.counts { background: var(--accent); box-shadow: none; }

.rrow { min-height: 72px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.rrow.win { background: var(--win-row); }
.rrow .srow-sub { font: 500 11px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rrow .gross { width: 30px; flex: none; text-align: right; font: 600 18px var(--mono); letter-spacing: -0.02em; }
.rrow .gross.dnf { font-size: 13px; color: var(--muted); }
.rrow .pos-col { width: 54px; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.rrow .pos-col small { font: 500 11px var(--mono); color: var(--muted); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(84px + env(safe-area-inset-bottom)); padding: 8px 24px calc(26px + env(safe-area-inset-bottom));
  background: var(--tabbar-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
}
.tabbar-inner { max-width: 512px; height: 100%; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--dim); font-size: 11px; font-weight: 500; border-radius: 12px; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
