/* Pinhunter — mobile-first golf app styles.
   Themes: dark (default), light, and "outdoor" high-contrast for direct sunlight. */

:root {
  --bg: #050706;
  --surface: #0e1311;
  --surface-2: #151c19;
  --surface-3: #1e2723;
  --line: #26312c;
  --line-strong: #364540;
  --text: #f2f6f4;
  --text-2: #a7b4ae;
  --text-3: #6d7b75;
  --accent: #3ee08f;
  --accent-strong: #22c776;
  --accent-ink: #03140b;
  --accent-soft: rgba(62, 224, 143, 0.14);
  --danger: #ff5f5f;
  --warn: #ffb547;
  --info: #56aaff;
  --water: #48a8f0;
  --sand: #e6cf94;
  /* Score scale (diverging around par; validated ramps): red = under par, blue = over par. */
  --sc-eagle: #e4857e;
  --sc-birdie: #b13f3c;
  --sc-par: #3d4440;
  --sc-bogey: #256abf;
  --sc-double: #6da7ec;
  --sc-eagle-ink: #0b0f0d;
  --sc-double-ink: #0b0f0d;
  --chart-grid: #232c28;
  --chart-axis: #3d4440;
  --glass: rgba(6, 9, 8, 0.74);
  --glass-line: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 11px;
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --num-weight: 750;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f5f3;
    --surface: #ffffff;
    --surface-2: #f1f4f2;
    --surface-3: #e5ebe8;
    --line: #dbe2de;
    --line-strong: #c4cfca;
    --text: #0b1310;
    --text-2: #4a5852;
    --text-3: #7b8983;
    --accent: #0c9a55;
    --accent-strong: #08834a;
    --accent-ink: #ffffff;
    --accent-soft: rgba(12, 154, 85, 0.12);
    --glass: rgba(255, 255, 255, 0.86);
    --glass-line: rgba(0, 0, 0, 0.08);
    --shadow: 0 10px 30px rgba(10, 30, 20, 0.16);
    --sc-eagle: #892b2a;
    --sc-birdie: #d75853;
    --sc-par: #c3c2b7;
    --sc-bogey: #3987e5;
    --sc-double: #184f95;
    --sc-eagle-ink: #ffffff;
    --sc-double-ink: #ffffff;
    --chart-grid: #e6ebe8;
    --chart-axis: #c3c2b7;
    --water: #1f7fd0;
    --sand: #b8953d;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #f1f4f2;
  --surface-3: #e5ebe8;
  --line: #dbe2de;
  --line-strong: #c4cfca;
  --text: #0b1310;
  --text-2: #4a5852;
  --text-3: #7b8983;
  --accent: #0c9a55;
  --accent-strong: #08834a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(12, 154, 85, 0.12);
  --glass: rgba(255, 255, 255, 0.86);
  --glass-line: rgba(0, 0, 0, 0.08);
  --shadow: 0 10px 30px rgba(10, 30, 20, 0.16);
  --sc-eagle: #892b2a;
  --sc-birdie: #d75853;
  --sc-par: #c3c2b7;
  --sc-bogey: #3987e5;
  --sc-double: #184f95;
  --sc-eagle-ink: #ffffff;
  --sc-double-ink: #ffffff;
  --chart-grid: #e6ebe8;
  --chart-axis: #c3c2b7;
  --water: #1f7fd0;
  --sand: #b8953d;
  color-scheme: light;
}

/* Outdoor: maximum contrast and heavier type for reading in full sun. */
:root[data-outdoor="1"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --surface-3: #e8e8e8;
  --line: #000000;
  --line-strong: #000000;
  --text: #000000;
  --text-2: #111111;
  --text-3: #333333;
  --accent: #006b36;
  --accent-strong: #004d27;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 107, 54, 0.14);
  --glass: rgba(255, 255, 255, 0.96);
  --glass-line: #000000;
  --shadow: 0 0 0 2px #000;
  --sc-eagle: #892b2a;
  --sc-birdie: #d75853;
  --sc-par: #9a9990;
  --sc-bogey: #3987e5;
  --sc-double: #184f95;
  --sc-eagle-ink: #ffffff;
  --sc-double-ink: #ffffff;
  --chart-grid: #c8c8c8;
  --chart-axis: #000000;
  --water: #0b56b0;
  --sand: #7a5d10;
  --num-weight: 850;
  color-scheme: light;
}
:root[data-outdoor="1"] body { font-weight: 600; }
:root[data-outdoor="1"] .card,
:root[data-outdoor="1"] .btn,
:root[data-outdoor="1"] .glass { border-width: 2px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 19px; font-weight: 750; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; font-weight: var(--num-weight); letter-spacing: -0.02em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 700; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.boot-name { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }

/* ---------- Page layout ---------- */
.app { min-height: 100vh; }
.page {
  max-width: 620px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(var(--nav-h) + 28px + var(--safe-bottom));
}
.page.no-nav { padding-bottom: calc(28px + var(--safe-bottom)); }
.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; min-height: 40px; }
.page-head h1 { flex: 1; }
.section { margin-top: 22px; }
.section > .section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.section-title h2 { font-size: 17px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.card.accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 60%); }
.card + .card { margin-top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: transparent; }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 18px; border-radius: 14px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer; flex: none;
}
.icon-btn.plain { background: transparent; border-color: transparent; }
.icon-btn:active { transform: scale(0.94); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 13px; color: var(--text-3); }
.error-text { color: var(--danger); font-size: 14px; font-weight: 600; }

.seg { display: flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; color: var(--text-2); cursor: pointer; padding: 0 8px; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(0,0,0,0.2); }
:root[data-outdoor="1"] .seg button[aria-pressed="true"] { background: #000; color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  font-weight: 700; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(127,127,127,0.6); }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: background 0.15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text-2); transition: transform 0.15s, background 0.15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--accent-ink); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; min-height: 56px;
  border-top: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-bottom: 0;
  text-align: left; width: 100%; cursor: pointer; color: inherit;
}
.list-item:first-child { border-top: 0; }
.list-item .meta { margin-left: auto; text-align: right; }
.list-item.static { cursor: default; }
.list-item:active:not(.static) { background: var(--surface-2); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.kpi .kpi-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.kpi .kpi-value { font-size: 28px; margin-top: 2px; line-height: 1.05; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- Score shapes (circle = under par, square = over par; digits stay in text ink) ---------- */
.score { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 2px; font-variant-numeric: tabular-nums; font-weight: 800; position: relative; color: var(--text); }
.score.eagle { background: var(--sc-eagle); color: var(--sc-eagle-ink); border-radius: 50%; }
.score.birdie { border: 2px solid var(--sc-birdie); border-radius: 50%; }
.score.bogey { border: 2px solid var(--sc-bogey); border-radius: 4px; }
.score.double, .score.worse { background: var(--sc-double); color: var(--sc-double-ink); border-radius: 4px; }
.score.empty { color: var(--text-3); }

/* ---------- Scorecard table ---------- */
.sc-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.sc { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
table.sc th, table.sc td { text-align: center; padding: 6px 1px; border-bottom: 1px solid var(--line); min-width: 26px; }
table.sc th:first-child, table.sc td:first-child { text-align: left; padding-left: 10px; min-width: 52px; position: sticky; left: 0; background: var(--surface); z-index: 1; font-weight: 700; white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
table.sc .tot { min-width: 30px; }
table.sc .score { min-width: 24px; height: 24px; font-size: 13px; }
table.sc thead th { color: var(--text-2); font-size: 12px; font-weight: 800; }
table.sc .tot { font-weight: 800; background: var(--surface-2); }
table.sc tr.par-row td { color: var(--text-2); font-weight: 700; }
table.sc tr.minor td { color: var(--text-3); font-size: 12px; }
table.sc td.cur { background: var(--accent-soft); }
table.sc td.tap { cursor: pointer; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--glass-line);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 11px; font-weight: 700; max-width: 120px;
}
.bottom-nav a svg.icon { width: 24px; height: 24px; }
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a.play-tab .play-dot { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); margin-top: -12px; box-shadow: 0 6px 18px rgba(0,0,0,0.35); }
.bottom-nav a.play-tab.live .play-dot { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(62,224,143,0.5); } 50% { box-shadow: 0 0 0 10px rgba(62,224,143,0); } }

/* ---------- Toasts / sheets / dialogs ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px + var(--safe-bottom)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--line-strong); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 650; max-width: 520px; animation: toast-in 0.18s ease-out; pointer-events: none; }
.toast.interactive { pointer-events: auto; }
/* On the hole screen, toasts drop in under the header so they never cover the action buttons. */
.in-play .toasts { bottom: auto; top: calc(124px + var(--safe-top)); }
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 80; animation: fade-in 0.15s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  max-width: 620px; margin: 0 auto;
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(20px + var(--safe-bottom));
  box-shadow: var(--shadow);
  animation: sheet-in 0.2s ease-out;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0.4; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.good { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.dot-status { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.dot-status.off { background: var(--warn); }
.dot-status.err { background: var(--danger); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 800; color: var(--text); flex: none; }
.empty-state { text-align: center; padding: 28px 12px; color: var(--text-2); }
.empty-state svg.icon { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 8px; }

/* ---------- Play view (map + overlays) ---------- */
.play { position: fixed; inset: 0; background: #000; overflow: hidden; }
.play .map { position: absolute; inset: 0; }
.glass {
  background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  color: var(--text);
}
.play-top { position: absolute; top: calc(8px + var(--safe-top)); left: 8px; right: 8px; display: flex; gap: 8px; align-items: stretch; z-index: 5; }
.hole-head { flex: 1; display: flex; align-items: center; gap: 10px; padding: 6px 12px; min-height: 52px; }
.hole-num { font-size: 30px; font-weight: 850; line-height: 1; min-width: 34px; text-align: center; }
.hole-info { line-height: 1.15; }
.hole-info .l1 { font-weight: 800; font-size: 15px; }
.hole-info .l2 { font-size: 12px; color: var(--text-2); font-weight: 650; }

.yard-panel { position: absolute; right: 8px; top: calc(70px + var(--safe-top)); z-index: 5; width: 112px; padding: 10px 8px; text-align: center; }
.yard-row { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.yard-row .lbl { font-size: 11px; font-weight: 800; color: var(--text-3); width: 12px; }
.yard-row .val { font-size: 22px; }
.yard-row.center .val { font-size: 46px; line-height: 1; color: var(--text); }
.yard-row.center .lbl { color: var(--accent); }
.plays { font-size: 12px; font-weight: 750; color: var(--text-2); margin-top: 2px; }
.plays b { color: var(--text); }
.yard-sep { height: 1px; background: var(--glass-line); margin: 6px 4px; }

.hazard-line { position: absolute; left: 8px; right: 128px; top: calc(70px + var(--safe-top)); z-index: 5; padding: 8px 12px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.hazard-line .hz-icon { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hazard-line .hz-icon.water { background: var(--water); }
.hazard-line .hz-icon.bunker { background: var(--sand); }

.map-tools { position: absolute; left: 8px; top: calc(118px + var(--safe-top)); z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.map-tools .icon-btn { background: var(--glass); border-color: var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); width: 44px; height: 44px; }
.map-tools .icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.status-chips { position: absolute; left: 8px; bottom: calc(146px + var(--safe-bottom)); z-index: 5; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.status-chip.preview { color: var(--warn); }
.wind-arrow { width: 18px; height: 18px; transition: transform 0.4s ease; }

/* Laser readout sits under the yardage panel in the same right-hand column. */
.laser-card { position: absolute; right: 8px; top: calc(258px + var(--safe-top)); z-index: 6; width: 112px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 4px; }
.laser-card .ld { text-align: center; line-height: 1.05; }
.laser-card .ld .v { font-size: 26px; }
.laser-card .ld .k { font-size: 10px; font-weight: 800; color: var(--text-3); letter-spacing: 0.05em; text-transform: uppercase; }
.laser-card .icon-btn { width: 36px; height: 30px; }

.play-bottom { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom)); z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.play-actions { display: flex; gap: 8px; }
.play-actions .btn { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 0 10px; background: var(--glass); border-color: var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 15px; white-space: nowrap; }
.play-actions .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; }
.play-actions .btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.play-nav { display: flex; gap: 8px; align-items: stretch; }
.play-nav .icon-btn { width: 56px; height: auto; min-height: 60px; background: var(--glass); border-color: var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.score-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 60px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 800; font-size: 17px; cursor: pointer; }
.score-btn.has-score { background: var(--glass); color: var(--text); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.score-btn .score { min-width: 36px; height: 36px; font-size: 18px; }

.next-banner { position: absolute; left: 50%; transform: translateX(-50%); top: calc(126px + var(--safe-top)); z-index: 7; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-weight: 750; white-space: nowrap; }

/* Map markers */
.mk-player { width: 22px; height: 22px; border-radius: 50%; background: #2f8bff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,139,255,0.25), 0 2px 6px rgba(0,0,0,0.5); }
.mk-player.preview { background: #ffb547; box-shadow: 0 0 0 6px rgba(255,181,71,0.3), 0 2px 6px rgba(0,0,0,0.5); }
.mk-target { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; background: rgba(62,224,143,0.25); box-shadow: 0 1px 6px rgba(0,0,0,0.6); position: relative; }
.mk-target::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; }
.mk-label { background: rgba(0,0,0,0.78); color: #fff; font-weight: 800; font-size: 15px; padding: 3px 8px; border-radius: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; border: 1px solid rgba(255,255,255,0.25); pointer-events: none; }
.mk-label small { font-weight: 650; color: #cfd8d3; font-size: 11px; margin-left: 3px; }
.mk-flag { display: flex; flex-direction: column; align-items: center; pointer-events: auto; cursor: pointer; }
.mk-flag .pole { width: 2px; height: 30px; background: #fff; }
.mk-flag .cloth { position: absolute; top: 0; left: 50%; min-width: 22px; height: 16px; padding: 0 4px; background: #ff3b3b; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border-radius: 0 3px 3px 0; }
.mk-flag .base { width: 8px; height: 8px; border-radius: 50%; background: #fff; margin-top: -4px; }
.mk-shot { width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #000; font-size: 12px; font-weight: 900; display: grid; place-items: center; border: 2px solid #000; }
.mk-tee { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.6); }

/* Score entry sheet */
.player-score { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.player-score:first-of-type { border-top: 0; }
.player-score .pname { flex: 1; font-weight: 750; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; }
.stepper .val { min-width: 54px; text-align: center; font-size: 30px; }
.quick-picks { display: flex; gap: 6px; margin: 6px 0 4px; }
.quick-picks button { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); font-weight: 800; cursor: pointer; font-variant-numeric: tabular-nums; }
.quick-picks button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.quick-picks button small { display: block; font-size: 10px; font-weight: 700; opacity: 0.75; }
.stat-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.stat-row > .label { width: 74px; flex: none; }

.club-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.club-grid button { min-height: 58px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.club-grid button small { font-size: 11px; font-weight: 650; color: var(--text-3); margin-top: 2px; }
.club-grid button.suggest { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.club-grid button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.club-grid button[aria-pressed="true"] small { color: inherit; }

/* Caddie */
.caddie-club { font-size: 44px; line-height: 1; }
.caddie-tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.caddie-tip:first-child { border-top: 0; }
.caddie-tip svg.icon { color: var(--accent); margin-top: 2px; }
.caddie-tip.warn svg.icon { color: var(--warn); }

/* Charts (hand-rolled SVG; see js/views/charts.js) */
.chart-slot { position: relative; width: 100%; }
.chart { display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart text.lbl { fill: var(--text-2); font-weight: 700; }
.chart text.val { fill: var(--text); font-weight: 800; font-size: 12px; }
.chart text.in-seg { font-weight: 800; font-size: 11px; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--chart-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:focus { outline: none; }
.chart .hit:focus-visible + .mark, .chart [data-tip]:focus-visible { outline: 2px solid var(--accent); }
.chart .mark { transition: opacity 0.12s; }
.chart .crosshair { stroke: var(--text-3); stroke-width: 1; shape-rendering: crispEdges; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--text-2); font-weight: 650; }
.legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .key.line { height: 2px; width: 14px; border-radius: 1px; vertical-align: 3px; }
.legend .key.dot { border-radius: 50%; }
.legend .key.ring { border-radius: 50%; background: transparent !important; border: 2px solid var(--accent); }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 9px; box-shadow: var(--shadow); white-space: nowrap; z-index: 3; line-height: 1.25; }
.chart-tip .tv { font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip .tl { font-size: 12px; font-weight: 600; color: var(--text-2); }
.table-toggle { font-size: 13px; font-weight: 700; color: var(--text-2); background: none; border: 0; padding: 4px 0; cursor: pointer; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 8px; }
table.data th, table.data td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--text-2); font-size: 12px; }

/* Achievements */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px 12px; text-align: center; }
.ach .ach-icon { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ach .ach-icon svg.icon { width: 26px; height: 26px; }
.ach.locked { opacity: 0.5; }
.ach.locked .ach-icon { background: var(--surface-3); color: var(--text-3); }
.ach .ach-name { font-weight: 800; font-size: 14px; }
.ach .ach-desc { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.ach .ach-date { font-size: 11px; color: var(--text-3); margin-top: 6px; font-weight: 700; }

/* Full-screen map pages (3D course, range) */
.map-page { position: fixed; inset: 0; background: #000; }
.map-page .map { position: absolute; inset: 0; }
.map-page .floating-head { position: absolute; top: calc(8px + var(--safe-top)); left: 8px; right: 8px; z-index: 5; display: flex; gap: 8px; align-items: center; padding: 6px; }
.hole-strip { position: absolute; left: 0; right: 0; bottom: calc(10px + var(--safe-bottom)); z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 4px 10px; scrollbar-width: none; }
.hole-strip::-webkit-scrollbar { display: none; }
.hole-strip button { flex: none; min-width: 46px; height: 46px; border-radius: 12px; font-weight: 850; cursor: pointer; }
.hole-strip button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-bottom-right { bottom: calc(132px + var(--safe-bottom)); }
.map-page .maplibregl-ctrl-bottom-right { bottom: calc(64px + var(--safe-bottom)); }

/* Utility spacing */
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 22px; font-weight: 800; letter-spacing: 0.08em; padding: 12px 14px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; text-align: center; user-select: all; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }

/* Smooth graphics (older phones): blur over a moving map is the single most expensive effect, so the
   glass panels become solid, and nothing animates forever. */
html.smooth { --glass: rgba(10, 14, 12, 0.94); }
html.smooth[data-theme="light"], html.smooth[data-outdoor="1"] { --glass: rgba(255, 255, 255, 0.97); }
@media (prefers-color-scheme: light) { html.smooth:not([data-theme="dark"]) { --glass: rgba(255, 255, 255, 0.97); } }
html.smooth .glass, html.smooth .bottom-nav, html.smooth .play-actions .btn, html.smooth .play-nav .icon-btn,
html.smooth .score-btn.has-score, html.smooth .map-tools .icon-btn { backdrop-filter: none; -webkit-backdrop-filter: none; }
html.smooth .bottom-nav a.play-tab.live .play-dot { animation: none; }
html.smooth .wind-arrow { transition: none; }
html.smooth .toast, html.smooth .sheet, html.smooth .backdrop { animation-duration: 0.01s; }

@media (min-width: 700px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .club-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
