/* The Scratch — Stats screen. Editorial, not a dashboard: no cards, hairlines and space, one big number per
   section, numbers in the serif, one electric-blue accent that always means "you / now / latest". Every colour is a
   token; app.css owns the shared ones, the fallbacks here keep the screen
   whole if it loads alone (dev harness). Chart series, heat ramp and the
   scoring scale were run through the dataviz validator — see docs/STATS.md. */

.st {
  --st-paper: var(--paper, #F3EEE2);
  --st-surface: var(--surface, #FBF8F1);
  --st-surface-2: var(--surface-2, #EDE6D6);
  --st-ink: var(--ink, #1B2A22);
  --st-ink-2: var(--ink-2, #3A4A40);
  --st-quiet: var(--quiet, #7A8279);
  --st-line: var(--line, #D9D2C3);
  --st-line-2: var(--line-2, #C9C1AE);
  --st-brass: var(--brass, #B8863F);
  --st-brass-ink: var(--brass-ink, #7E5A24);
  --st-brass-soft: var(--brass-soft, #F1E6CF);
  --st-good: var(--good, #2F7D4F);
  --st-bad: var(--bad, #A8322A);
  --st-serif: var(--serif, "Fraunces", Georgia, serif);
  --st-sans: var(--sans, system-ui, -apple-system, "Segoe UI", sans-serif);
  --st-r: var(--r, 14px);
  --st-ease: var(--ease, cubic-bezier(.2, .7, .2, 1));

  /* chart chrome */
  --st-grid: #E8E2D4;           /* one step off the surface, hairline */
  --st-axis-ink: var(--st-quiet);
  --st-mute: #C9C1AE;           /* dropped differentials, de-emphasis */

  /* categorical series — validated light on #FBF8F1 (adjacent: all pass) */
  --st-s1: #0C7B60;             /* pine */
  --st-s2: #B8863F;             /* brass */
  --st-s3: #4A5BA8;             /* slate blue */
  --st-s4: #9C4F3E;             /* clay */

  /* sequential heat: strokes over par, one hue, light -> dark (ordinal-validated) */
  --st-h1: #7ABFA4;
  --st-h2: #53A88A;
  --st-h3: #329072;
  --st-h4: #0D785B;
  --st-h5: #005F46;

  /* the accent: you, now, latest (text-safe: 5.35:1 on paper) */
  --st-accent: #2450E8;
  --st-accent-soft: #E3E9FD;

  /* Season Fingerprint, diverging: under par blue | par neutral | over par clay (validated, adjacent ΔE ≥ 16) */
  --st-fp-eagle: #1238C9;
  --st-fp-birdie: #4A7DFF;
  --st-fp-par: #DDD6C7;
  --st-fp-bogey: #DE8C4C;
  --st-fp-double: #A33A1A;

  /* Road to Scratch, ordinal greens: biggest cost darkest (ordinal-validated) */
  --st-r1: #173A28;
  --st-r2: #2A573E;
  --st-r3: #43735A;
  --st-r4: #62927A;
  --st-r5: #88AF97;
  --st-r6: #B5CCBB;

  /* diverging scoring scale: under par (blue) | par (neutral) | over par (clay) */
  --st-d-eagle: #3B539A;
  --st-d-birdie: #899DD1;
  --st-d-par: #CBC6BA;
  --st-d-bogey: #D8A48C;
  --st-d-double: #9D5035;

  font-family: var(--st-sans);
  color: var(--st-ink);
  font-size: 16px;
  line-height: 1.45;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: 720px;
  margin: 0 auto;
}

/* Dark: selected steps, not an automatic flip. Covers an explicit dark theme
   and the on-course scene, so the screen never breaks if it renders there. */
:root[data-theme="dark"] .st,
:root[data-scene="play"] .st,
.st.st--dusk {
  --st-paper: #0B0F0D;
  --st-surface: #121915;
  --st-surface-2: #1A231E;
  --st-ink: #F3EEE2;
  --st-ink-2: #D8D3C6;
  --st-quiet: #8E968D;
  --st-line: #263029;
  --st-line-2: #33403A;
  --st-brass-ink: #D9AE6A;
  --st-brass-soft: #2B2516;
  --st-good: #5DBB84;
  --st-bad: #E07A6E;
  --st-grid: #212B25;
  --st-mute: #4A554E;
  --st-s1: #14876A;
  --st-s2: #B8863F;
  --st-s3: #6170C0;
  --st-s4: #B0583F;
  --st-h1: #226952;
  --st-h2: #318267;
  --st-h3: #409C7D;
  --st-h4: #5BB696;
  --st-h5: #81D1B3;
  --st-d-eagle: #87A2EA;
  --st-d-birdie: #5B6FA7;
  --st-d-par: #504D47;
  --st-d-bogey: #99624A;
  --st-d-double: #DA8F74;
  --st-accent: #6F95FF;
  --st-accent-soft: #1A2547;
  --st-fp-eagle: #9DBBFF;
  --st-fp-birdie: #4573F5;
  --st-fp-par: #303C35;
  --st-fp-bogey: #A0602F;
  --st-fp-double: #F59A5E;
  --st-r1: #A9D2B6;
  --st-r2: #7DB28F;
  --st-r3: #58946F;
  --st-r4: #3F7656;
  --st-r5: #2E5A41;
  --st-r6: #24493A;
  color-scheme: dark;
}

.st *, .st *::before, .st *::after { box-sizing: border-box; }
.st p { margin: 0; }
.st h2, .st h3 { margin: 0; }
.st .num { font-family: var(--st-serif); font-variant-numeric: tabular-nums lining-nums; }
.st .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st :focus-visible { outline: 2px solid var(--st-accent); outline-offset: 2px; border-radius: 6px; }
.st ::selection { background: var(--st-accent-soft); color: var(--st-ink); }

/* ---------- type ---------- */
.st-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--st-quiet); line-height: 1.3;
}
.st-sub { font-size: 14px; color: var(--st-quiet); line-height: 1.4; }
.st-body { font-size: 16px; color: var(--st-ink-2); }
.st-quiet { color: var(--st-quiet); }
.st-section-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.st-note { font-size: 14px; color: var(--st-quiet); margin-top: 12px; line-height: 1.45; }

/* ---------- tabs: four words on a hairline, the current one underlined in the accent ---------- */
.st-tabs {
  display: flex; gap: 22px; margin: 0 0 4px; padding: 0; border-bottom: 1px solid var(--st-line);
  overflow-x: auto; scrollbar-width: none;
}
.st-tabs::-webkit-scrollbar { display: none; }
.st-tab {
  position: relative; flex: none; min-height: 48px; padding: 0; border: 0; background: transparent;
  font: 600 15px/1 var(--st-sans); color: var(--st-quiet); cursor: pointer; white-space: nowrap;
  transition: color 150ms var(--st-ease); -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.st-tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--st-accent); transform: scaleX(0); transform-origin: left; transition: transform 300ms cubic-bezier(.16, 1, .3, 1);
}
.st-tab[aria-selected="true"] { color: var(--st-ink); }
.st-tab[aria-selected="true"]::after { transform: scaleX(1); }
.st-panel { display: grid; gap: 0; outline: none; }

/* ---------- filter row (one row, above what it scopes) ---------- */
.st-filter { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; }
.st-filter-text { display: grid; gap: 2px; min-width: 0; }
.st-seg { display: inline-flex; gap: 2px; border: 1px solid var(--st-line-2); border-radius: 999px; padding: 2px; }
.st-seg > button {
  min-height: 40px; min-width: 50px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent;
  font: 600 13px/1 var(--st-sans); letter-spacing: .02em; color: var(--st-quiet); cursor: pointer; touch-action: manipulation;
  transition: background-color 150ms var(--st-ease), color 150ms var(--st-ease);
}
.st-seg > button[aria-pressed="true"] { background: var(--st-ink); color: var(--st-paper); }

.st-select-wrap { display: grid; gap: 6px; }
.st-select {
  appearance: none; -webkit-appearance: none; width: 100%; min-height: 48px; padding: 0 40px 0 14px;
  border: 1px solid var(--st-line-2); border-radius: 12px; color: var(--st-ink); font: 500 16px/1.2 var(--st-sans);
  background: var(--st-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%237A8279' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center;
}

/* ---------- cards ---------- */
.st-card {
  background: transparent; border: 0; border-top: 1px solid var(--st-line); border-radius: 0;
  padding: 22px 0 18px; min-width: 0;
}
.st-card.st-flat { border-top: 0; padding-top: 10px; }
.st-card-head { display: grid; gap: 3px; margin-bottom: 14px; }
.st-card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.st-card-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: 8px -6px -8px 0; }
.st-card-foot > .st-link:first-child { margin-right: auto; }
.st-tabletoggle { color: var(--st-quiet); font-weight: 500; text-decoration-color: var(--st-line-2); }
.st-tabletoggle, .st-link {
  min-height: 44px; padding: 0 6px; border: 0; background: transparent; cursor: pointer;
  font: 600 14px/1 var(--st-sans); color: var(--st-accent); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 4px; display: inline-flex; align-items: center;
}
.st-link { padding-left: 0; }
.st-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  border-radius: 12px; background: var(--st-ink); color: var(--st-paper); border: 1px solid var(--st-ink);
  font: 600 16px/1 var(--st-sans); text-decoration: none; cursor: pointer; margin-top: 16px;
}
.st-btn--quiet { background: transparent; color: var(--st-ink); border-color: var(--st-line-2); margin-top: 12px; }

.st-empty { display: grid; gap: 8px; padding: 28px 20px; margin-top: 8px; justify-items: start; }
.st-empty-title { font-family: var(--st-serif); font-size: 28px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.st-empty--small { padding: 20px 16px; margin-top: 0; }

/* ---------- hero index ---------- */
.st-hero { display: grid; gap: 8px; border-top: 0; padding: 26px 0 26px; }
.st-hero-row { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.st-hero-value {
  font-family: var(--st-serif); font-size: clamp(76px, 24vw, 104px); font-weight: 400; line-height: .86;
  letter-spacing: -0.045em; font-variant-numeric: tabular-nums lining-nums; color: var(--st-ink);
}
.st-hero .st-spark { width: min(46%, 180px); height: auto; }
.st-hero .st-link { justify-self: start; }
.st-hero-value--none { color: var(--st-line-2); }
.st-hero-meta { font-size: 14px; color: var(--st-ink-2); font-family: var(--st-serif); font-variant-numeric: tabular-nums; }
.st-hero-trend { margin-top: 2px; }
.st-spark { flex: none; overflow: visible; }

.st-needs { display: grid; gap: 8px; margin-top: 4px; }
.st-meter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; max-width: 240px; }
.st-meter > span { height: 8px; border-radius: 4px; background: var(--st-brass-soft); }
.st-meter > span.on { background: var(--st-brass); }

/* ---------- deltas: icon + words, never colour alone ---------- */
.st-delta { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; line-height: 1.2; }
.st-delta-icon { flex: none; }
.st-delta--good { color: var(--st-good); }
.st-delta--bad { color: var(--st-bad); }
.st-delta--flat { color: var(--st-quiet); }
.st-delta--flat .st-delta-icon { width: 14px; text-align: center; }

/* ---------- tiles ---------- */
.st-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .st-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.st-tile {
  background: transparent; border: 0; border-top: 1px solid var(--st-line); border-radius: 0;
  padding: 16px 0 12px; display: grid; gap: 4px; align-content: start; min-width: 0;
}
.st-tile--wide { grid-column: 1 / -1; }
.st-tile-value {
  font-family: var(--st-serif); font-size: 30px; font-weight: 400; line-height: 1.05;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums lining-nums; color: var(--st-ink);
}
.st-tile-sub { font-size: 13px; color: var(--st-quiet); line-height: 1.35; }

/* ---------- last 5 vs prior 5 ---------- */
.st-compare { list-style: none; margin: 0; padding: 0; }
.st-compare li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "lab now" "was delta";
  column-gap: 12px; row-gap: 2px; padding: 10px 0; border-top: 1px solid var(--st-line);
}
.st-compare li:first-child { border-top: 0; padding-top: 0; }
.st-compare-label { grid-area: lab; font-size: 16px; color: var(--st-ink); }
.st-compare-now { grid-area: now; font-size: 20px; text-align: right; line-height: 1.1; }
.st-compare-was { grid-area: was; font-size: 13px; color: var(--st-quiet); font-variant-numeric: tabular-nums; }
.st-compare .st-delta { grid-area: delta; justify-self: end; font-size: 13px; }

/* ---------- charts ---------- */
.st-chart { position: relative; }
.st-plot { position: relative; width: 100%; min-height: 40px; touch-action: pan-y; overflow-x: clip; }
.st-svg { display: block; overflow: visible; font-family: var(--st-sans); -webkit-user-select: none; user-select: none; }
.st-grid { stroke: var(--st-grid); stroke-width: 1; shape-rendering: crispEdges; }
.st-baseline { stroke: var(--st-line-2); stroke-width: 1; shape-rendering: crispEdges; }
.st-refline { stroke: var(--st-quiet); stroke-width: 1; shape-rendering: crispEdges; opacity: .7; }
.st-axis { font-size: 11px; fill: var(--st-axis-ink); font-variant-numeric: tabular-nums; }
.st-axis--strong { fill: var(--st-ink-2); font-weight: 600; }
.st-endlabel { font: 400 13px var(--st-serif); fill: var(--st-ink); font-variant-numeric: tabular-nums; }
.st-marklabel { font: 600 12px var(--st-sans); fill: var(--st-brass-ink); }
.st-value { font: 400 13px var(--st-serif); fill: var(--st-ink); font-variant-numeric: tabular-nums; }
.st-rowlabel { font-size: 14px; fill: var(--st-ink-2); }
.st-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.st-line--quiet { stroke: var(--st-line-2); }
.st-area { opacity: .1; stroke: none; }
.st-dot { stroke: var(--st-surface); stroke-width: 2; paint-order: stroke; }
.st-dot--marker { stroke-width: 2.5; }
.st-crossline { stroke: var(--st-ink-2); stroke-width: 1; opacity: .35; shape-rendering: crispEdges; }
.st-bar, .st-stack, .st-cell { transition: opacity 120ms var(--st-ease); }
.st-bar.is-hot, .st-cell.is-hot { opacity: .78; }
.st-dot.is-hot { stroke-width: 3; }
.st-cell { stroke: none; }
.st-cell.is-hot { stroke: var(--st-ink); stroke-width: 1.5; opacity: 1; }
.st-cell--empty { fill: none; stroke: var(--st-line); stroke-width: 1; stroke-dasharray: none; }
.st-celltext { font: 500 12px var(--st-serif); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; pointer-events: none; }
/* text on a heat cell: ink or paper by the step's lightness (flips with the ramp in dark) */
.st-celltext--s1, .st-celltext--s2, .st-celltext--dark { fill: #1B2A22; }
.st-celltext--s3, .st-celltext--s4, .st-celltext--s5, .st-celltext--light { fill: #FBF8F1; }
:root[data-theme="dark"] .st-celltext--s1, :root[data-theme="dark"] .st-celltext--s2,
:root[data-scene="play"] .st-celltext--s1, :root[data-scene="play"] .st-celltext--s2 { fill: #F3EEE2; }
:root[data-theme="dark"] .st-celltext--s3, :root[data-theme="dark"] .st-celltext--s4, :root[data-theme="dark"] .st-celltext--s5,
:root[data-scene="play"] .st-celltext--s3, :root[data-scene="play"] .st-celltext--s4, :root[data-scene="play"] .st-celltext--s5 { fill: #0B0F0D; }
.st-hit { cursor: pointer; outline: none; }
.st-hit:focus-visible { stroke: var(--st-brass); stroke-width: 2; }
.st-hit--row.is-hot { fill: var(--st-ink); fill-opacity: .04; }

/* legend: swatch mirrors the mark */
.st-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -4px 0 10px; padding: 0; font-size: 13px; color: var(--st-ink-2); }
.st-legend li { display: inline-flex; align-items: center; gap: 6px; }
.st-key { flex: none; display: inline-block; background: var(--k); }
.st-key--line { width: 14px; height: 2px; border-radius: 1px; }
.st-key--rect { width: 10px; height: 10px; border-radius: 3px; }
.st-key--dot { width: 8px; height: 8px; border-radius: 50%; }

/* tooltip: value leads, label follows */
.st-tip {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; opacity: 0; visibility: hidden;
  min-width: 96px; max-width: min(260px, calc(100% - 8px)); padding: 8px 30px 8px 10px; border-radius: 10px;
  background: var(--st-ink); color: var(--st-paper); box-shadow: 0 6px 20px rgba(11, 15, 13, .18);
  transition: opacity 120ms var(--st-ease); font-size: 13px; line-height: 1.35;
}
.st-tip.on { opacity: 1; visibility: visible; pointer-events: auto; }
.st-tip-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(127, 127, 127, .22); color: inherit; font: 600 16px/22px var(--st-sans, system-ui); cursor: pointer; }
.st-tip-x:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.st-tip-title { font-size: 11px; letter-spacing: 0.04em; opacity: .72; margin-bottom: 4px; }
.st-tip-row { display: flex; align-items: center; gap: 8px; }
.st-tip-row + .st-tip-row { margin-top: 2px; }
.st-tip-val { font: 500 16px var(--st-serif); font-variant-numeric: tabular-nums; }
.st-tip-lab { opacity: .78; }
:root[data-theme="dark"] .st-tip, :root[data-scene="play"] .st-tip { background: #F3EEE2; color: #1B2A22; }

/* table twin */
.st-tablescroll { overflow-x: auto; margin: 0 -4px; }
.st-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.st-table th, .st-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--st-line); vertical-align: top; }
.st-table thead th { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--st-quiet); white-space: nowrap; }
.st-table tbody th { font-weight: 500; color: var(--st-ink); white-space: nowrap; }
.st-table .n { text-align: right; font-family: var(--st-serif); font-variant-numeric: tabular-nums lining-nums; }
.st-table thead .n { font-family: var(--st-sans); }

/* heat scale legend */
.st-scale { display: flex; align-items: center; gap: 2px; margin-top: 10px; font-size: 12px; color: var(--st-quiet); }
.st-scale-step { width: 22px; height: 10px; background: var(--k); }
.st-scale-step:first-of-type { border-radius: 3px 0 0 3px; }
.st-scale-step:last-of-type { border-radius: 0 3px 3px 0; }
.st-scale-end:first-child { margin-right: 6px; }
.st-scale-end:last-child { margin-left: 6px; }

/* small multiples: two charts, same 0–100 scale, side by side */
.st-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.st-pair .st-card { padding: 22px 0 14px; }
.st-pair .st-card-title { font-size: 15px; }
@media (max-width: 340px) { .st-pair { grid-template-columns: 1fr; } }

.st-bypar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.st-bypar-value { font-size: 26px; line-height: 1.1; margin: 2px 0; }

/* ---------- rounds list: one line per round, hairlines, the round as 18 small marks ---------- */
.st-scores { list-style: none; margin: 0; padding: 0; }
.st-score-item { border-bottom: 1px solid var(--st-line); }
.st-score {
  width: 100%; display: flex; gap: 12px; justify-content: space-between; align-items: center;
  padding: 14px 0; min-height: 68px; border: 0; background: transparent; text-align: left; cursor: pointer;
  color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.st-score-main { display: grid; gap: 3px; min-width: 0; flex: 1; }
.st-score-course { font-size: 16px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-score-meta { font-size: 13px; color: var(--st-quiet); }
.st-score-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--st-ink-2); padding-top: 2px; }
.st-score-nums > span { display: inline-flex; gap: 5px; align-items: baseline; }
.st-score-k { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--st-quiet); }
.st-score-side { display: grid; justify-items: end; gap: 3px; flex: none; }
.st-score-gross { font-size: 30px; line-height: 1; letter-spacing: -0.02em; }
.st-score-topar { font-size: 13px; color: var(--st-quiet); font-family: var(--st-serif); font-variant-numeric: tabular-nums; }
.st-score[aria-expanded="true"] .st-score-gross { color: var(--st-accent); }
.st-score-body { padding: 0 0 16px; }
.st-mini { display: flex; gap: 2px; margin-top: 5px; }
.st-mini i { width: 7px; height: 7px; border-radius: 2px; background: var(--st-fp-par); }
.st-mini i:nth-child(9) { margin-right: 4px; }
.st-mini .k-eagle { background: var(--st-fp-eagle); }
.st-mini .k-birdie { background: var(--st-fp-birdie); }
.st-mini .k-bogey { background: var(--st-fp-bogey); }
.st-mini .k-double { background: var(--st-fp-double); }
.st-mini .k-none { background: transparent; box-shadow: inset 0 0 0 1px var(--st-line); }
.st-logo { flex: none; display: grid; }
.st-logo .crest { width: 34px; height: 34px; }
.st-course .st-card-head { grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
.st-course .st-card-head > .st-logo { grid-row: span 2; }

.st-flags { display: inline-flex; gap: 4px; margin-top: 4px; }
.st-flag {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
  font: 700 11px/1 var(--st-sans); text-decoration: none; border: 1px solid var(--st-line-2); color: var(--st-ink-2);
}
.st-flag--E { border-color: var(--st-brass); color: var(--st-brass-ink); background: var(--st-brass-soft); }
.st-flag--C { border-color: var(--st-ink-2); color: var(--st-ink); }
.st-flag--P { border-style: dashed; color: var(--st-quiet); }
.st-legendline { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--st-quiet); padding: 4px 2px; }
.st-legendline > span { display: inline-flex; align-items: center; gap: 6px; }

/* scorecard strip with golf notation */
.st-card-strip { display: grid; gap: 12px; padding-top: 10px; }
.st-strip { display: grid; gap: 2px; }
.st-strip-row { display: grid; grid-template-columns: 44px repeat(9, minmax(0, 1fr)) 34px; align-items: center; text-align: center; }
.st-strip-row > span:first-child { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--st-quiet); }
.st-strip-row--head > span { font-size: 11px; color: var(--st-quiet); font-variant-numeric: tabular-nums; }
.st-strip-row--par > span { font-size: 13px; color: var(--st-ink-2); font-variant-numeric: tabular-nums; }
.st-strip-row--score { min-height: 36px; }
.st-strip-total { font-weight: 600; color: var(--st-ink) !important; }
.st-strip-row--score .st-strip-total { font-size: 16px; }
.st-strip-blank { color: var(--st-line-2); }
.st-strip-facts { margin-top: -2px; }

.st-gn {
  --gn: 21px;
  display: inline-grid; place-items: center; width: var(--gn); height: var(--gn);
  font: 500 15px/1 var(--st-serif); font-variant-numeric: tabular-nums lining-nums; color: var(--st-ink);
}
.st-gn--birdie { border: 1.5px solid var(--st-ink); border-radius: 50%; }
.st-gn--eagle { border: 1.5px solid var(--st-ink); border-radius: 50%; box-shadow: 0 0 0 1.5px var(--st-surface), 0 0 0 3px var(--st-ink); }
.st-gn--bogey { border: 1.5px solid var(--st-ink); border-radius: 2px; }
.st-gn--double { border: 1.5px solid var(--st-ink); border-radius: 2px; box-shadow: 0 0 0 1.5px var(--st-surface), 0 0 0 3px var(--st-ink); }
.st-gn-key { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--st-quiet); }
.st-gn-key > span { display: inline-flex; align-items: center; gap: 8px; }
.st-gn--key { --gn: 19px; font-size: 12px; }

/* ---------- differentials list ---------- */
.st-diffs { list-style: none; margin: 0; padding: 0; }
.st-diffs li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px;
  min-height: 48px; padding: 6px 0; border-top: 1px solid var(--st-line);
}
.st-diffs li:first-child { border-top: 0; }
.st-diff-pos { font-size: 13px; color: var(--st-quiet); }
.st-diff-main { display: grid; min-width: 0; }
.st-diff-course { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-diff-date { font-size: 13px; color: var(--st-quiet); }
.st-diff-val { font-size: 20px; min-width: 3ch; text-align: right; }
.st-diff-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--st-accent); background: var(--st-accent-soft); border-radius: 6px; padding: 4px 6px;
}
.st-diffs li.is-counted .st-diff-val { color: var(--st-accent); }
.st-diffs li.is-dropped .st-diff-val, .st-diffs li.is-dropped .st-diff-course { color: var(--st-quiet); }
.st-diffs .st-flags { margin-top: 0; }
.st-replaced { margin-top: 10px; }

/* ---------- why it moved ---------- */
.st-callout { border-top: 1px solid var(--st-line); padding: 22px 0 8px; }
.st-callout-title { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--st-quiet); margin-bottom: 8px; }
.st-callout ul { margin: 0; padding: 0 0 0 18px; display: grid; gap: 6px; color: var(--st-ink-2); font-size: 16px; }

/* ---------- courses ---------- */
.st-course-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--st-line); }
.st-fact { font-size: 22px; line-height: 1.15; margin-top: 2px; }
@media (max-width: 360px) { .st-course-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Overview: sections, the Road to Scratch, the Fingerprint, key numbers ---------- */
.st-sec { border-top: 1px solid var(--st-line); padding: 26px 0 8px; }
.st-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--st-quiet); margin-bottom: 10px; }
.st-chapter { font-family: var(--st-serif); font-weight: 400; font-size: 30px; letter-spacing: -0.02em; line-height: 1.1; border-top: 1px solid var(--st-ink); padding: 18px 0 2px; margin-top: 18px; }
.st-sec .st-filter { padding-top: 0; margin-bottom: 4px; }

.st-road-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.st-road-big .num { font-size: clamp(56px, 17vw, 76px); line-height: .9; letter-spacing: -0.04em; }
.st-road-unit { font-size: 15px; color: var(--st-quiet); }
.st-road-sec > .st-body { max-width: 42ch; font-size: 15px; }
.st-road-seg { transition: opacity 150ms var(--st-ease), fill 150ms var(--st-ease); }
.st-road-seg.is-dim { opacity: .28; }
.st-road-seg.is-on { fill: var(--st-accent) !important; }
.st-road-seg.is-hot { opacity: .82; }
.st-road-won { fill: var(--st-accent); }
.st-road-net { stroke: var(--st-ink); stroke-width: 1.5; }
.st-road-list { list-style: none; margin: 14px 0 0; padding: 0; }
.st-road-list > li { border-top: 1px solid var(--st-line); }
.st-road-row {
  width: 100%; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 4ch; align-items: center; gap: 12px;
  min-height: 48px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.st-road-key { width: 12px; height: 12px; border-radius: 3px; background: var(--k); }
.st-road-row.is-on .st-road-key { background: var(--st-accent); }
.st-road-label { font-size: 16px; }
.st-road-row.is-on .st-road-label { font-weight: 600; }
.st-road-val { font-size: 22px; text-align: right; }
.st-road-trend { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-road-trend.is-good { color: var(--st-good); }
.st-road-trend.is-bad { color: var(--st-bad); }
.st-road-more { padding: 0 0 14px 24px; display: grid; gap: 8px; }
.st-road-more[hidden] { display: none; }
.st-road-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--st-ink-2); }
.st-road-top li { display: flex; justify-content: space-between; gap: 12px; }

.st-fp-cell { fill: var(--st-fp-par); }
.st-fp-cell--none { fill: none; stroke: var(--st-line); stroke-width: 1; }
.st-fp-row { transition: opacity 120ms var(--st-ease); }
.st-fp:has(.st-fp-row.is-hot) .st-fp-row:not(.is-hot) { opacity: .45; }

.st-kns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 22px 0; }
.st-kn { display: grid; gap: 4px; align-content: start; padding: 0 8px; border-left: 1px solid var(--st-line); min-width: 0; }
.st-kn:first-child { border-left: 0; padding-left: 0; }
.st-kn-v { font-size: clamp(22px, 6.4vw, 30px); line-height: 1; letter-spacing: -0.02em; }
.st-kn-l { font-size: 12px; color: var(--st-quiet); line-height: 1.25; }
.st-kn-d { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-kn-d.is-good { color: var(--st-good); }
.st-kn-d.is-bad { color: var(--st-bad); }
@media (max-width: 380px) {
  .st-kns { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 18px; }
  .st-kn:nth-child(4) { border-left: 0; padding-left: 0; }
}

/* Trends: the last round against your own usual. A hairline list, no cards. */
.st-usual { list-style: none; margin: 8px 0 0; padding: 0; }
.st-usual-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label val" "norm delta"; align-items: baseline; column-gap: 12px; row-gap: 2px; padding: 14px 0; border-top: 1px solid var(--st-line); }
.st-usual-row:first-child { border-top: 0; }
.st-usual-label { grid-area: label; font-size: 16px; font-weight: 600; }
.st-usual-val { grid-area: val; font-size: 30px; line-height: 1; letter-spacing: -0.02em; text-align: right; }
.st-usual-norm { grid-area: norm; font-size: 14px; color: var(--st-quiet); }
.st-usual-row .st-delta { grid-area: delta; justify-self: end; font-size: 14px; }

.st-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--st-accent); font: 600 15px/1 var(--st-sans); cursor: pointer; margin: 6px 0 2px; }
.st-back span:first-child { font-size: 22px; line-height: 0; }

/* Numbers settle in once as their section arrives; nothing loops. */
@media (prefers-reduced-motion: no-preference) {
  .st-panel > * { animation: st-in 500ms cubic-bezier(.16, 1, .3, 1) both; }
  .st-panel > :nth-child(2) { animation-delay: 60ms; }
  .st-panel > :nth-child(3) { animation-delay: 120ms; }
  .st-panel > :nth-child(n+4) { animation-delay: 180ms; }
}
@keyframes st-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (min-width: 720px) {
  .st-pair { gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .st-tab, .st-tab::after, .st-seg > button, .st-tip, .st-bar, .st-stack, .st-cell, .st-road-seg { transition: none; }
}

@media (forced-colors: active) {
  .st-bar, .st-stack, .st-cell, .st-dot { forced-color-adjust: none; }
  .st-tab[aria-selected="true"], .st-seg > button[aria-pressed="true"] { outline: 2px solid CanvasText; }
  .st-fp-cell, .st-road-seg, .st-mini i { forced-color-adjust: none; }
}


/* ── Polish round (Luke, 2026-10-10): a grass header, a ground colour per section, one plain sentence per chart, a lit-edge feel ── */

/* The grass header: the Index big and white, then three headline numbers. */
.st-grass { margin: 4px 0 18px; padding: 18px 16px 16px; border-radius: 22px; color: #fff; text-shadow: 0 1px 3px rgba(0, 30, 10, .5);
  background: linear-gradient(rgba(6, 36, 14, .42), rgba(6, 36, 14, .42)), url(/img/grass.jpg) center top / 460px auto; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 24px rgba(4, 28, 12, .28); }
.st-grass-k { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.st-grass-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.st-grass-idx { margin: 0; font-family: var(--st-serif); font-size: clamp(76px, 22vw, 104px); line-height: 1; letter-spacing: -0.03em; font-variation-settings: "opsz" 144; text-shadow: 0 0 24px rgba(190, 255, 160, .3), 0 2px 6px rgba(0, 30, 10, .45); }
.st-grass-d { margin: 0; padding: 3px 10px; border-radius: 999px; background: rgba(6, 36, 14, .6); font-size: 14px; font-weight: 650; text-shadow: none; }
.st-hts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.st-ht { padding: 10px 8px; border-radius: 14px; background: rgba(6, 36, 14, .45); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); min-width: 0; }
.st-ht-v { margin: 0; font-family: var(--st-serif); font-size: 26px; line-height: 1; letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; }
.st-ht-l { margin: 4px 0 0; font-size: 13px; line-height: 1.25; opacity: .92; }
.st-pb-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: #F2C230; box-shadow: 0 0 0 2px rgba(242, 194, 48, .35); }

/* A ground colour per section, so the page reads as separate things. */
.st-g { margin: 14px 0; padding: 16px 14px 14px; border-radius: 20px; border: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 2px rgba(8, 28, 16, .08), 0 8px 18px rgba(8, 28, 16, .1); }
.st-g .st-card { background: transparent; box-shadow: none; padding: 0; border: 0; }
.st-g-blue { background: linear-gradient(165deg, #DCEBFA, #F3F8FE 75%); }
.st-g-green { background: linear-gradient(165deg, #DDEFD8, #F1F8EE 75%); }
.st-g-sand { background: linear-gradient(165deg, #F1E6CF, #FAF4E6 75%); }
.st-g-fair { background: repeating-linear-gradient(90deg, #E8F3DD 0 28px, #DFEDD2 28px 56px); }
.st-g.st-sec { border-top: 0; }

/* One plain sentence above each chart: what it means. */
.st-insight { margin: 0 0 10px; font-size: 16px; line-height: 1.4; font-weight: 600; color: var(--st-ink); }

/* Personal best badge. */
.st-pb { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: #FFF4CF; color: #5E4708; font-size: 13px; font-weight: 700; }

/* The tab pills get a lit edge like the buttons elsewhere. */
.st-tabs { gap: 6px; }

.st-kn, .st-ht { transition: transform 120ms ease-out; }

/* Empty state: a blurred example chart with a promise on top. */
.st-sample-wrap { position: relative; margin: 0 0 14px; color: var(--st-accent); }
.st-sample { display: block; width: 100%; height: auto; filter: blur(3px); opacity: .8; }
.st-sample-note { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 16px; font-weight: 700; color: var(--st-ink); text-shadow: 0 0 10px #fff; }
.st-g .st-insight { margin: 12px 0 14px; }
.st-g .st-insight:first-child { margin-top: 0; }
.st-diff-tag { font-size: 13px; }

.st-pb + .st-pb { margin-left: 4px; }
.st-peek { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .7); box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(8, 28, 16, .1); }
.st-peek[hidden] { display: none; }
.st-peek-t { margin: 0 0 6px; font-weight: 650; font-size: 16px; }
.st-peek-n { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 6px; font-size: 16px; }
.st-peek-n .st-score-k { display: block; font-size: 13px; color: var(--st-quiet); }
