/* FairwayFinda Caddie — V3 · 3D ONLY
 * One app, many courses: a selector screen in front of the V2-21 hole engine.
 * The hole is pure-black sunlight (it sits under a rendered course). The SELECTOR
 * is a public brand surface — a golfer reaches it from fairwayfinda.com — so it
 * wears the LANDING's kit: Inter black uppercase, the gold wordmark, the glass card
 * system and the per-section accent tokens. Where the two disagree, the landing wins. */

/* Inter, self-hosted: the caddie is a PWA a golfer opens on the 12th with no signal.
   A webfont from a CDN is a webfont that is not there. Variable, latin, 47 KB. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('font/inter-latin-var.woff2') format('woff2');
}

:root {
  color-scheme: dark;
  --c90: #34d399;
  --c110: #fbbf24;
  --c130: #60a5fa;
  --glass: rgba(10, 12, 14, 0.78);
  --stroke: rgba(255, 255, 255, 0.10);
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.35);

  /* ---- the landing's tokens, verbatim ---- */
  --ink: #020617;
  --paper: #f8fafc;
  --gold: linear-gradient(180deg, #fbe7a6 0%, #ecc66f 25%, #f6dc8a 45%, #b88c3a 70%, #f0d27a 100%);
  --brand: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* per-card accent, cycling the landing's four section accents */
.accent-sky     { --accent: #38bdf8; --accent-rgb: 56,189,248; }
.accent-amber   { --accent: #fbbf24; --accent-rgb: 251,191,36; }
.accent-emerald { --accent: #34d399; --accent-rgb: 52,211,153; }
.accent-indigo  { --accent: #818cf8; --accent-rgb: 129,140,248; }

/* the landing's eyebrow: small, uppercase, wide-tracked */
.eyebrow {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3em;
}
/* the landing's card lift */
.lift { transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.hidden { display: none !important; }
button { font-family: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: 8px; z-index: 40; transform: translateY(-150%); background: #fff; color: #000; padding: 13px 16px; min-height: 44px; display: flex; align-items: center; border-radius: 10px; }
.skip-link:focus { transform: translateY(0); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }

#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- 3D stage ---------- */
#stage { position: relative; flex: 1 1 auto; min-height: 0; background: #000; overflow: hidden; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#stage::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 130px;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
  pointer-events: none; z-index: 2;
}

/* floating 3D labels (ring / arc tags) */
#labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.lbl {
  position: absolute; left: 0; top: 0; will-change: transform;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; white-space: nowrap;
  background: rgba(0, 0, 0, 0.62); border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px; padding: 2px 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}

/* loading veil */
#veil {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--muted);
}

/* WebGL failure panel */
#glFail {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.72); padding: 24px;
}
#glFail .gfbox {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 18px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  padding: 24px 20px; text-align: center; max-width: 340px;
}
#glFail .msg { font-size: 14px; line-height: 1.5; color: var(--muted); }
#glFail a.big { display: block; text-decoration: none; text-align: center; }

/* ---------- top bar ---------- */
#topBar {
  position: absolute; z-index: 4;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 7px;
}
#holePill {
  display: flex; align-items: stretch; gap: 2px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  height: 50px; padding: 2px;
}
#holePill button {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 800 28px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  min-width: 50px; border-radius: 13px;
}
#holePill button:active { background: rgba(255,255,255,.12); }
#holeLabel {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 17px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
#holeLabel .sep { color: var(--faint); font-weight: 400; }
#holeLen { color: var(--muted); font-weight: 700; }
#autoBtn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font: 700 11px/1 -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: .08em; color: var(--muted) !important;
  min-width: 56px !important;
  border: 1px solid transparent !important;
}
.autodot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.28); }
#autoBtn.on { color: #7ef0b0 !important; }
#autoBtn.on .autodot { background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,.9); }

/* ---------- hole strip (standards 1–18 plus authored 2A) ---------- */
#holeStrip {
  display: flex; justify-content: flex-start; align-items: center;
  padding: 0 4px; height: 44px; overflow-x: auto; scrollbar-width: none;
}
#holeStrip::-webkit-scrollbar { display: none; }
#holeStrip button {
  flex: 0 0 44px; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer;
  position: relative; min-width: 44px; padding: 0;
}
#holeStrip button::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,.30);
  box-shadow: 0 0 4px rgba(0,0,0,.9);
  transition: transform .18s, background .18s;
}
#holeStrip button.cur::after {
  background: #34d399; transform: translate(-50%, -50%) scale(1.9);
  box-shadow: 0 0 8px rgba(52,211,153,.8);
}
#holeStrip button.custom-hole::after { border-radius: 2px; background: #fbbf24; transform: translate(-50%, -50%) rotate(45deg); }
#holeStrip button.custom-hole.cur::after { background: #34d399; transform: translate(-50%, -50%) rotate(45deg) scale(1.9); }

/* ---------- sim chip + toast ---------- */
/* quiet chip language, same slot as the LIVE chip — never a full-width bar */
#simBanner {
  position: absolute; z-index: 3; left: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 152px);
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid rgba(245,158,11,.5); border-radius: 999px;
  padding: 4px 6px 4px 10px;
  font-size: 10px; font-weight: 800; letter-spacing: .1em; color: #fbbf24;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.simdot {
  width: 7px; height: 7px; border-radius: 50%; background: #f59e0b;
  box-shadow: 0 0 8px rgba(245,158,11,.9);
}
#useGpsBtn {
  border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(245,158,11,.18); color: #fcd34d;
  font-size: 10px; font-weight: 800; letter-spacing: .07em;
  padding: 10px 14px; min-width: 112px; min-height: 44px;
}
#useGpsBtn:active { background: rgba(245,158,11,.35); }
#toast {
  position: absolute; z-index: 5; left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 100px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: rgba(8, 10, 12, .92); border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-radius: 999px; padding: 10px 12px 10px 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,.6);
  font-size: 14px; font-weight: 700; white-space: nowrap;
  animation: toastIn .22s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }
#toastUndo {
  border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(52,211,153,.16); color: #7ef0b0;
  font-size: 12px; font-weight: 800; letter-spacing: .08em;
  padding: 8px 14px; min-width: 68px; min-height: 44px;
}

/* ---------- right rail ---------- */
#rail {
  position: absolute; z-index: 4; right: max(10px, env(safe-area-inset-right, 0px));
  top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 9px;
}
#rail button {
  width: 46px; height: 46px; border-radius: 15px; cursor: pointer;
  border: 1px solid var(--stroke);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: #fff; font-size: 24px; font-weight: 700; line-height: 1;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
#rail button:active { background: rgba(255,255,255,.16); }
#recenterBtn { font-size: 26px; }
#rail button.txt { font-size: 12px; font-weight: 800; letter-spacing: .06em; }
#flyBtn { color: #7ef0b0 !important; }
#flyBtn.on { background: rgba(52,211,153,.2) !important; border-color: rgba(52,211,153,.5) !important; }

/* ---------- bottom panel ---------- */
#panel {
  flex: 0 0 auto; z-index: 4;
  background: linear-gradient(180deg, rgba(13,15,17,.94), rgba(6,7,8,.99));
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--stroke);
  border-radius: 18px 18px 0 0;
  margin-top: -18px;
  padding: 12px 14px calc(env(safe-area-inset-bottom, 0px) + 10px);
  text-align: center;
}
#panel > div { display: none; }
#panel[data-mode="gate"]    #gate    { display: flex; }
#panel[data-mode="denied"]  #denied  { display: flex; }
#panel[data-mode="waiting"] #waiting { display: flex; }
#panel[data-mode="read"]    #readout { display: block; }

/* gate boxes */
.gatebox { flex-direction: column; align-items: center; gap: 10px; padding: 8px 4px 6px; }
.brand { font-size: 12px; font-weight: 800; letter-spacing: .3em; color: #8fd6a0; }
.brand.warn { color: #fbbf24; }
.gatebox .msg, .gfbox .msg { font-size: 15px; line-height: 1.45; color: var(--muted); max-width: 36ch; }
.gatebox .msg b { color: #fff; }
button.big, a.big {
  width: 100%; max-width: 320px; padding: 16px;
  border: 0; border-radius: 14px; cursor: pointer;
  background: #1f7a3d; color: #fff;
  font-size: 18px; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 4px 18px rgba(31,122,61,.4);
}
button.big:active, a.big:active { background: #2a9c50; }
.privacy { font-size: 12px; color: var(--faint); }
.linkbtn {
  border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  padding: 8px 16px; min-height: 44px;
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15); border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- readout ---------- */
sup { font-size: .62em; font-weight: 800; vertical-align: super; margin-left: 3px; }
sup.up { color: #fbbf24; }
sup.dn { color: #60a5fa; }

#targetRow {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 15px; min-height: 28px; margin-bottom: 1px;
}
#targetRow .tlab { font-size: 10px; font-weight: 800; letter-spacing: .18em; color: var(--faint); }
#targetRow .tnum { font-size: 19px; font-weight: 800; color: #fff; }
#targetRow sup { font-size: 12px; }
#targetRow .tarrow { color: var(--faint); font-size: 14px; margin: 0 2px; }
#targetRow.idle { opacity: .35; }
.tclub {
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(52,211,153,.16); color: #7ef0b0; margin-left: 4px;
}
.tclear {
  border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.10); color: var(--muted);
  width: 44px; height: 44px; min-width: 44px; font-size: 12px; line-height: 1; margin-left: 2px;
}

#heroLabel { font-size: 11px; font-weight: 800; letter-spacing: .34em; color: var(--faint); }
#hero { line-height: 0.95; margin: 0; white-space: nowrap; }
#heroNum { font-size: 72px; font-weight: 800; letter-spacing: -0.02em; color: #fff; transition: opacity .3s; }
#heroPl { font-size: 24px; font-weight: 800; vertical-align: 38px; margin-left: 6px; color: var(--muted); }
#heroPl.up { color: #fbbf24; }
#heroPl.dn { color: #60a5fa; }
#readout.stale #heroNum { opacity: .45; }
#readout.attack #heroLabel::after { content: " · ATTACK"; color: #34d399; letter-spacing: .2em; }
#acc { font-size: 12px; color: var(--faint); font-weight: 600; margin-top: 1px; min-height: 15px; }
#acc.poor { color: #fbbf24; }

#fcb {
  display: flex; justify-content: center; gap: 8px; margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,.07); padding-top: 6px;
}
#fcb .fcbi { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0; }
#fcb .flab { font-size: 9px; font-weight: 800; letter-spacing: .22em; color: var(--faint); }
#fcb b { color: #e8edf2; font-size: 23px; font-weight: 800; line-height: 1.1; }
#fcb .fcbi.on b { color: #fff; font-size: 28px; }
#fcb sup { font-size: 11px; }

/* ---------- bag strip ---------- */
#bagStrip {
  display: flex; gap: 8px; margin-top: 8px; padding: 2px 2px 4px;
  overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
#bagStrip::-webkit-scrollbar { display: none; }
.clubchip {
  position: relative; flex: 0 0 auto; min-width: 86px;
  scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 12px 7px; border-radius: 13px;
  border: 1px solid var(--stroke); background: rgba(255,255,255,.05);
  color: #fff; cursor: pointer;
  transition: border-color .2s, background .2s, opacity .2s;
}
.clubchip:active { background: rgba(255,255,255,.12); }
.clubchip .cname { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .02em; white-space: nowrap; }
.clubchip .ccarry { font-size: 19px; font-weight: 800; }
.clubchip .chit { font-size: 11px; font-weight: 700; color: var(--muted); min-height: 14px; white-space: nowrap; }
.clubchip .chit b { color: #fff; font-size: 13px; }
.clubchip.reach { border-color: rgba(52,211,153,.55); background: rgba(52,211,153,.10); }
.clubchip.long  { border-color: rgba(251,191,36,.40); background: rgba(251,191,36,.07); }
.clubchip.short { opacity: .38; }
.clubchip.sel   { border-color: rgba(255,255,255,.75); box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }
.ringIco {
  position: absolute; top: 5px; right: 5px;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
}
.clubchip.ring-on .ringIco { border-color: var(--cc, #fff); box-shadow: 0 0 7px var(--cc, #fff); }

@media (max-height: 760px) {
  #heroNum { font-size: 56px; }
  #heroPl { font-size: 19px; vertical-align: 28px; }
  #fcb b { font-size: 19px; }
  #fcb .fcbi.on b { font-size: 23px; }
  #fcb { margin-top: 4px; padding-top: 4px; }
  #bagStrip { margin-top: 5px; }
  .clubchip { padding: 6px 10px 5px; min-width: 80px; }
  .clubchip .ccarry { font-size: 17px; }
}

/* ---------- scorecard HUD bits ---------- */
#holePar { font-weight: 800; color: #fff; }
#holeSi { color: var(--muted); font-weight: 700; font-size: 13px; }

/* ---------- shot pill: club · verdict · plays-like ---------- */
#shotPill {
  position: absolute; z-index: 3; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  min-width: 244px; max-width: calc(100% - 88px);
  text-align: center; pointer-events: none;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 16px;
  padding: 8px 16px 7px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
#spTop { display: flex; gap: 10px; align-items: baseline; justify-content: center; white-space: nowrap; }
#spClub { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--muted); }
#spVerdict { font-size: 16px; font-weight: 900; letter-spacing: .05em; }
#spSub { margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
#shotPill.v-clear #spVerdict { color: #34d399; text-shadow: 0 0 12px rgba(52,211,153,.5); }
#shotPill.v-tight #spVerdict { color: #fbbf24; text-shadow: 0 0 12px rgba(251,191,36,.5); }
#shotPill.v-blocked #spVerdict { color: #f87171; text-shadow: 0 0 12px rgba(248,113,113,.55); }
#shotPill.v-blocked { border-color: rgba(248,113,113,.4); }

/* ---------- power gauge: the aim's second axis, priced in golf numbers ---------- */
#spPower { margin-top: 7px; }
#spPowRow { display: flex; align-items: center; gap: 8px; }
#spPowBar {
  position: relative; flex: 1; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,.13);
}
/* the 100% detent, drawn exactly where the gauge snaps: (1.00-0.50)/(1.20-0.50) */
#spPowBar::after {
  content: ''; position: absolute; left: 71.43%; top: -3px; bottom: -3px; width: 2px;
  background: rgba(255,255,255,.5); border-radius: 1px;
}
#spPowFill {
  display: block; height: 100%; width: 0; border-radius: 999px;
  transition: width .07s linear;   /* tracks the thumb, never lags it */
}
#spPowPct {
  font-size: 14px; font-weight: 900; letter-spacing: .03em;
  min-width: 46px; text-align: right; font-variant-numeric: tabular-nums;
}
#spPowClamp {
  font-size: 9px; font-weight: 900; letter-spacing: .08em; color: #ffb84d;
  border: 1px solid rgba(255,184,77,.5); border-radius: 4px; padding: 1px 4px;
}
#spPowMeans {
  margin-top: 3px; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  color: rgba(255,255,255,.75); white-space: nowrap; font-variant-numeric: tabular-nums;
}
#spPower.snap #spPowBar::after { background: #fff; box-shadow: 0 0 7px rgba(255,255,255,.9); }
/* the roll sim did not converge — the ball was still moving when it quit. Never
   present that as a resting place: the number wears a '+' and this badge. */
#spPowClamp.runs-out { color: #f87171; border-color: rgba(248,113,113,.55); }

/* ---------- plan chip: playing from a tapped point ---------- */
#planChip {
  position: absolute; z-index: 3; left: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 148px);
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid rgba(255,255,255,.22); border-radius: 999px;
  padding: 6px 6px 6px 12px;
  font-size: 11px; font-weight: 800; letter-spacing: .07em; color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#planChip button {
  border: 0; border-radius: 50%; width: 44px; height: 44px; min-width: 44px; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-size: 12px; font-weight: 800;
}
#planChip button:active { background: rgba(255,255,255,.3); }

/* ---------- live GPS chip ---------- */
#gpsChip {
  position: absolute; z-index: 3; left: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 152px);
  display: flex; align-items: center; gap: 6px;
  background: var(--glass); border: 1px solid rgba(52,211,153,.35); border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px; font-weight: 800; letter-spacing: .1em; color: #7ef0b0;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  pointer-events: none;
}
.livedot {
  width: 7px; height: 7px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 8px rgba(52,211,153,.9);
  animation: livepulse 1.6s ease-in-out infinite;
}
@keyframes livepulse { 50% { opacity: .35; } }
/* live chip present -> plan chip drops below it */
#gpsChip:not(.hidden) ~ #planChip { top: calc(env(safe-area-inset-top, 0px) + 190px); }

/* sim chip present -> plan chip drops below it (same slot as LIVE) */
#simBanner.hidden { display: none; }
#simBanner:not(.hidden) ~ #planChip { top: calc(env(safe-area-inset-top, 0px) + 190px); }

/* ---------- locate button: eye-view mode ---------- */
#rail button.on { color: #7ef0b0; border-color: rgba(52,211,153,.5); box-shadow: 0 0 10px rgba(52,211,153,.35); }

/* ---------- collapse to map-dominant mode ---------- */
#collapseBtn {
  display: block; width: 100%; height: 44px; min-height: 44px; margin: -8px 0 0;
  border: 0; background: transparent; cursor: pointer; position: relative;
}
.chev {
  display: inline-block; width: 10px; height: 10px;
  border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
  transform: rotate(45deg) translateY(-2px);   /* points down = collapse */
}
.chev.up { transform: rotate(-135deg) translateY(-1px); }
#collapseBtn .chev { position: absolute; left: 50%; top: 13px; margin-left: -5px; }
#collapseBtn:active .chev { border-color: #fff; }

#miniPill {
  display: none; width: 100%;
  align-items: center; justify-content: center; gap: 10px;
  border: 0; border-top: 1px solid var(--stroke); cursor: pointer;
  background: var(--glass); color: #fff;
  min-height: 44px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  font-family: inherit; font-variant-numeric: tabular-nums;
}
#miniPill #miniTo { font-size: 26px; font-weight: 900; line-height: 1; }
#miniPill .munit { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: -6px; }
#miniPill #miniClub { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--muted); }
.mdot { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,.25); }
.mdot.clear { background: #34d399; box-shadow: 0 0 9px rgba(52,211,153,.8); }
.mdot.tight { background: #fbbf24; box-shadow: 0 0 9px rgba(251,191,36,.8); }
.mdot.blocked { background: #f87171; box-shadow: 0 0 9px rgba(248,113,113,.8); }

#panel.collapsed[data-mode="read"] #readout { display: none; }
#panel.collapsed[data-mode="read"] #miniPill { display: flex; }

/* line-of-play scrub — vertical, left edge */
#lopSlider {
  position: absolute; z-index: 5;
  left: 14px; top: 50%;
  width: min(300px, 44vh); height: 44px;
  transform: translate(calc(-50% + 22px), -50%) rotate(-90deg);
  appearance: none; -webkit-appearance: none;
  background: transparent; touch-action: none;
}
#lopSlider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(52,211,153,.55), rgba(255,255,255,.14));
  border: 1px solid rgba(255,255,255,.18);
}
#lopSlider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -11px;
  border-radius: 50%;
  background: rgba(10, 22, 16, .9);
  border: 2px solid #34d399;
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
#lopSlider::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.16); }
#lopSlider::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #0a1610; border: 2px solid #34d399; }
#topBtn.on { background: rgba(52,211,153,.2) !important; border-color: rgba(52,211,153,.5) !important; color: #7ef0b0; }

#spDyn { font-size: 11px; font-weight: 700; letter-spacing: .03em; color: rgba(255,255,255,.72); margin-top: 2px; }

#modeChip {
  position: absolute; z-index: 3; left: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 192px);
  background: var(--glass); border: 1px solid rgba(52,211,153,.45); border-radius: 999px;
  min-width: 44px; min-height: 44px; padding: 10px 14px; font-size: 11px; font-weight: 800; letter-spacing: .07em; color: #7ef0b0;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  cursor: pointer; user-select: none;
}
#modeChip:active { background: rgba(52,211,153,.25); }

/* aim chip — mirrors planChip, stacked below the mode chip */
#aimChip {
  position: absolute; z-index: 3; left: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 236px);
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid rgba(103,232,249,.45); border-radius: 999px;
  padding: 6px 6px 6px 12px;
  font-size: 11px; font-weight: 800; letter-spacing: .07em; color: #a5f3fc;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#aimChip button {
  border: 0; border-radius: 50%; width: 44px; height: 44px; min-width: 44px; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-size: 12px; font-weight: 800;
}
#aimChip button:active { background: rgba(255,255,255,.3); }

/* the sim banner must never eat canvas gestures — only its button is interactive */
#simBanner { pointer-events: none; }
#simBanner button { pointer-events: auto; }

/* ==================================================================
   V3 — THE FRONT DOOR: THE COURSE-SELECT SCREEN

   ALWAYS the first screen. A golfer arrives from the Course Finder card on
   fairwayfinda.com, so this is a public brand surface and the first thing he ever
   sees of the product.

   The bar is a PREMIUM SPORTS TITLE'S COURSE-SELECT SCREEN, not a settings menu.
   The course fills the screen as its own measured aerial; its name is display type;
   its spec sheet ends on the number nobody else can print — how many trees we
   MEASURED. Picking a course is a moment: the hero crossfades, the type re-sets,
   the numbers land.

   Dark AND luminous. The failure being corrected is a black void with no light in
   it, so the light here comes from the aerial itself, a vignette that frames it,
   gold, and the course's accent — never from adding more black.
   Transform/opacity only: it has to hold 60fps on a phone.
   ================================================================== */

body[data-screen="select"] #app { display: none; }
body[data-screen="play"] #selector { display: none; }

#selector {
  position: fixed; inset: 0; z-index: 30;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--ink);
  font-family: var(--brand);
  --accent: #38bdf8; --accent-rgb: 56,189,248;
}

/* ---------- the hero: the course, full bleed ---------- */
.heroStack { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

/* two layers so a pick CROSSFADES rather than cuts */
.heroLayer {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 900ms cubic-bezier(.4,0,.2,1);
  will-change: opacity, transform;
}
/* slow drift — the screen breathes instead of sitting still */
.heroLayer.on {
  opacity: 1;
  animation: kenburns 34s cubic-bezier(.4,0,.5,1) infinite alternate;
}
@keyframes kenburns {
  from { transform: scale(1.06) translate3d(0, 0, 0); }
  to   { transform: scale(1.20) translate3d(-2.2%, -1.6%, 0); }
}

/* the vignette FRAMES the course and buys the type its legibility. Cinematic, and
   load-bearing: display type over a satellite aerial is unreadable without it. */
.heroVig {
  position: absolute; inset: 0;
  background:
    radial-gradient(125% 85% at 50% 32%, rgba(2,6,23,0) 18%, rgba(2,6,23,.42) 58%, rgba(2,6,23,.86) 100%),
    linear-gradient(180deg,
      rgba(2,6,23,.78) 0%,
      rgba(2,6,23,.30) 20%,
      rgba(2,6,23,.42) 44%,
      rgba(2,6,23,.88) 72%,
      #020617 94%);
}
/* gold high-left, the course's accent low-right. FairwayFinda gold against the green
   and blue of a real aerial is the gift — take it. */
.heroWash {
  position: absolute; inset: 0;
  background:
    radial-gradient(65% 45% at 6% 2%, rgba(232,200,121,0.20), transparent 66%),
    radial-gradient(80% 55% at 96% 96%, rgba(var(--accent-rgb), 0.22), transparent 70%);
  transition: background 700ms ease;
}
.heroGrid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 85% 45% at 50% 8%, #000 20%, transparent 72%);
          mask-image: radial-gradient(ellipse 85% 45% at 50% 8%, #000 20%, transparent 72%);
}

/* ---------- the layout ---------- */
.selwrap {
  position: relative; z-index: 1;
  min-height: 100%;
  display: flex; flex-direction: column;
  max-width: 640px; margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 22px)
    max(20px, env(safe-area-inset-right, 0px))
    calc(env(safe-area-inset-bottom, 0px) + 20px)
    max(20px, env(safe-area-inset-left, 0px));
}

.selTop {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.sellogo { display: flex; align-items: center; gap: 10px; }
.selmark { height: 30px; width: auto; display: block; flex-shrink: 0; }
/* the landing's hero wordmark recipe: black, uppercase, tight, gold, soft halo */
.selword {
  font-weight: 900; font-size: 20px; line-height: 1;
  text-transform: uppercase; letter-spacing: -0.035em;
  background: var(--gold);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 22px rgba(232,200,121,0.32));
}
.selbrow { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.seldot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18), 0 0 12px rgba(var(--accent-rgb), 0.9);
}

.selerr {
  margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: rgba(248,113,113,.14); border: 1px solid rgba(248,113,113,.40);
  color: #fca5a5; font: 600 13px/1.45 var(--brand);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

/* ---------- THE HERO: the course he is about to play ---------- */
/* margin-top:auto floats it to the bottom of the screen, over the aerial, with the
   rail beneath it — the console layout: picture, title, spec, PLAY. */
.selhero {
  margin-top: auto;
  padding-top: 40px;
  display: flex; flex-direction: column; align-items: flex-start;
}

.heroLoc {
  color: var(--accent);
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
  margin-bottom: 10px;
}

/* DISPLAY TYPE. Course names are not list labels. */
.heroName {
  font-weight: 900; text-transform: uppercase;
  font-size: clamp(38px, 12.5vw, 62px);
  letter-spacing: -0.034em; line-height: 0.90;
  color: var(--paper);
  text-shadow: 0 4px 30px rgba(0,0,0,.72), 0 1px 3px rgba(0,0,0,.5);
  margin-bottom: 18px;
  text-wrap: balance;
}

/* THE SPEC SHEET — like a car-select screen */
.heroSpec {
  display: flex; align-items: flex-start; flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 16px;
}
.spec { display: flex; flex-direction: column; gap: 3px; }
.spec b {
  font-weight: 800; font-size: 22px; line-height: 1;
  letter-spacing: -0.02em; color: var(--paper);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.spec i {
  font-style: normal;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: rgba(248,250,252,0.55);
}
/* the measured trees are OUR number. It wears the gold and it stands apart. */
.spec.gold {
  padding-left: 20px; margin-left: 2px;
  border-left: 1px solid rgba(232,200,121,0.30);
}
.spec.gold b {
  background: var(--gold);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px rgba(232,200,121,0.35));
  font-size: 24px;
}
.spec.gold i { color: rgba(240,210,122,0.80); }

.heroClaim {
  font-size: 13px; line-height: 1.55; font-weight: 400;
  color: rgba(248,250,252,0.72);
  max-width: 40ch; margin-bottom: 20px;
  text-shadow: 0 1px 10px rgba(0,0,0,.6);
}

/* PLAY. The gold does the work — this is the one thing on the screen he came for. */
.playBtn {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 62px;
  padding: 0 18px 0 22px;
  border: 0; border-radius: 15px; cursor: pointer;
  background: var(--gold);
  color: #1a1206;
  box-shadow: 0 12px 40px rgba(232,200,121,0.24), 0 2px 0 rgba(255,255,255,0.35) inset;
  transition: transform 180ms cubic-bezier(.2,.7,.3,1), box-shadow 180ms ease, filter 180ms ease;
}
.playBtn:hover { transform: translateY(-2px); box-shadow: 0 18px 52px rgba(232,200,121,0.34), 0 2px 0 rgba(255,255,255,0.4) inset; filter: brightness(1.04); }
.playBtn:active { transform: translateY(0) scale(.99); }
.playTxt {
  font-weight: 900; font-size: 17px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.playSub {
  flex: 1;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: rgba(26,18,6,0.62);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.playArr { font-size: 26px; font-weight: 900; line-height: 1; }

/* the reveal: on every pick the type and the numbers LAND */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.selhero.in .heroLoc   { animation: rise 520ms  40ms cubic-bezier(.22,.7,.18,1) both; }
.selhero.in .heroName  { animation: rise 640ms  90ms cubic-bezier(.22,.7,.18,1) both; }
.selhero.in .spec      { animation: rise 520ms cubic-bezier(.22,.7,.18,1) both;
                         animation-delay: calc(200ms + var(--i, 0) * 65ms); }
.selhero.in .heroClaim { animation: rise 520ms 420ms cubic-bezier(.22,.7,.18,1) both; }
.selhero.in .playBtn   { animation: rise 520ms 480ms cubic-bezier(.22,.7,.18,1) both; }

/* ---------- THE RAIL: every course we have measured ---------- */
.selrail { margin-top: 26px; }
.raillabel {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 11px;
  color: rgba(248,250,252,0.45);
}
.selcount {
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: rgba(248,250,252,0.45); font-variant-numeric: tabular-nums;
}

/* swipeable on a phone — reads far better than a grid of small cards */
.railtrack {
  display: flex; gap: 11px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 0 6px;
  margin: -4px -20px -6px;            /* bleed to the screen edge: there is more to see */
  padding-left: 20px; padding-right: 20px;
}
.railtrack::-webkit-scrollbar { display: none; }

.rtile {
  position: relative; flex: 0 0 auto;
  width: 146px; height: 96px;
  padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 13px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.55);
  scroll-snap-align: center;
  color: var(--paper);
  transition: transform 220ms cubic-bezier(.2,.7,.3,1), border-color 220ms ease, box-shadow 220ms ease;
  animation: rise 560ms cubic-bezier(.22,.7,.18,1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}
.rimg {
  position: absolute; inset: 0;
  background-color: #0d1512;
  background-size: cover; background-position: center;
  transform: scale(1.04);
  filter: saturate(.75) brightness(.72);
  transition: transform 420ms ease, filter 300ms ease;
}
.rscrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(2,6,23,0) 28%, rgba(2,6,23,.88) 100%);
}
.rbody {
  position: absolute; left: 10px; right: 10px; bottom: 8px;
  display: flex; flex-direction: column; gap: 1px;
}
.rname {
  font-weight: 800; font-size: 12px; line-height: 1.15;
  text-transform: uppercase; letter-spacing: -0.006em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}
.rmeta {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: rgba(248,250,252,0.58);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* the selected course is LIT — its accent, its image at full strength */
.rtile.on {
  transform: translateY(-4px);
  border-color: rgba(var(--accent-rgb), 0.95);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.45),
              0 14px 34px rgba(0,0,0,0.55),
              0 0 30px rgba(var(--accent-rgb), 0.30);
}
.rtile.on .rimg { transform: scale(1.12); filter: saturate(1.05) brightness(1); }
.rtile.on .rmeta { color: var(--accent); }
.rtile:not(.on):hover { border-color: rgba(255,255,255,0.34); transform: translateY(-2px); }
.rtile:not(.on):hover .rimg { filter: saturate(.9) brightness(.85); }

.selempty { padding: 30px 4px; text-align: center; }
.selempty .brand { font: 800 12px/1 var(--brand); letter-spacing: .18em; margin-bottom: 10px; }
.selempty .brand.warn { color: #fca5a5; }
.selempty .msg { font: 400 14px/1.5 var(--brand); color: rgba(248,250,252,0.6); }

.selfoot {
  margin-top: 22px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  font: 400 11px/1.4 var(--brand); color: rgba(248,250,252,0.36); text-align: center;
}

/* ---------- desktop: the same screen, given room ---------- */
@media (min-width: 900px) {
  .selwrap { max-width: 1200px; padding-top: 34px; padding-bottom: 30px; }
  .selhero { max-width: 660px; padding-top: 60px; }
  .heroName { font-size: clamp(56px, 5.4vw, 88px); }
  .spec b { font-size: 26px; }
  .spec.gold b { font-size: 28px; }
  .heroClaim { font-size: 14px; }
  .playBtn { width: auto; min-width: 320px; }
  .railtrack { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .rtile { width: 190px; height: 118px; }
  .rname { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .heroLayer, .heroLayer.on { animation: none; transform: scale(1.04); }
  .selhero.in .heroLoc, .selhero.in .heroName, .selhero.in .spec,
  .selhero.in .heroClaim, .selhero.in .playBtn, .rtile { animation: none; }
  .rtile, .rimg, .playBtn { transition: none; }
}

/* ---------- in-round: the way back to the selector ---------- */
#courseBtn {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 70%; height: 44px; padding: 0 15px 0 11px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--stroke); border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
  color: #fff; cursor: pointer;
  font: 700 12px/1 -apple-system, sans-serif; letter-spacing: .05em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#courseBtn::before { content: "\2039"; font-size: 19px; font-weight: 800; color: var(--faint); }
#courseBtn:active { background: rgba(255,255,255,.12); }

/* ---------- power gauge: the aim's second axis, priced in golf numbers ---------- */
#spPower { margin-top: 7px; }
#spPowRow { display: flex; align-items: center; gap: 8px; }
#spPowBar {
  position: relative; flex: 1; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,.13);
}
/* the 100% detent, drawn exactly where the gauge snaps: (1.00-0.50)/(1.20-0.50) */
#spPowBar::after {
  content: ''; position: absolute; left: 71.43%; top: -3px; bottom: -3px; width: 2px;
  background: rgba(255,255,255,.5); border-radius: 1px;
}
#spPowFill {
  display: block; height: 100%; width: 0; border-radius: 999px;
  transition: width .07s linear;   /* tracks the thumb, never lags it */
}
#spPowPct {
  font-size: 14px; font-weight: 900; letter-spacing: .03em;
  min-width: 46px; text-align: right; font-variant-numeric: tabular-nums;
}
#spPowClamp {
  font-size: 9px; font-weight: 900; letter-spacing: .08em; color: #ffb84d;
  border: 1px solid rgba(255,184,77,.5); border-radius: 4px; padding: 1px 4px;
}
#spPowMeans {
  margin-top: 3px; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  color: rgba(255,255,255,.75); white-space: nowrap; font-variant-numeric: tabular-nums;
}
#spPower.snap #spPowBar::after { background: #fff; box-shadow: 0 0 7px rgba(255,255,255,.9); }
/* the roll sim did not converge — the ball was still moving when it quit. Never
   present that as a resting place: the number wears a '+' and this badge. */
#spPowClamp.runs-out { color: #f87171; border-color: rgba(248,113,113,.55); }
