/* Fairway League design system
   Clubhouse modern: deep forest surfaces, a lime accent for the thing you tap next, warm neutrals, big numbers.
   Everything is driven by the tokens below; dark mode only swaps tokens. */
:root {
  --green: #0d3b2a; --green-2: #135a3c; --fairway: #1f9a57; --fairway-ink: #16784a;
  --lime: #c9f36d; --lime-ink: #163a1f; --gold: #f2b738; --red: #e0453f; --blue: #2f6fd6; --eagle: #d08a00;
  --bg: #f3f4ef; --card: #ffffff; --cream: #eef0ea; --sand: #e8e4d6; --ink: #0f1f18; --muted: #65716b; --line: #e1e5de; --line-2: #cfd5cd;
  --shadow: 0 1px 2px rgba(15,31,24,.05), 0 8px 24px -12px rgba(15,31,24,.18);
  --shadow-lg: 0 24px 48px -24px rgba(15,31,24,.35);
  --radius: 18px; --radius-sm: 12px; --nav-h: 64px;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --green: #0a1f16; --green-2: #12402c; --fairway: #2fbb6c; --fairway-ink: #6fd79a;
  --bg: #0a0f0d; --card: #131b17; --cream: #1a241f; --sand: #22302a; --ink: #eef3ef; --muted: #91a098; --line: #21302a; --line-2: #2c3d35;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 48px -24px rgba(0,0,0,.8);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 500 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 24px; margin: 4px 0 12px; letter-spacing: -.02em; }
h3 { font-size: 12px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
p { margin: 6px 0; }
a { color: var(--fairway-ink); }
td a, .sub a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.b { font-weight: 700; }
::selection { background: var(--lime); color: var(--lime-ink); }

/* ---------- header ---------- */
#top { background: var(--green); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; background-image: radial-gradient(120% 140% at 100% 0%, rgba(201,243,109,.18), transparent 55%); }
#top h1 { font-size: 19px; margin: 0; flex: 1; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top .back { color: #fff; text-decoration: none; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.12); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; margin-left: -6px; padding-bottom: 3px; flex: none; }
#top .hbtn { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 10px; padding: 7px 12px; font-size: 14px; font-weight: 700; }
main#view { flex: 1; padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 980px; width: 100%; margin: 0 auto; }

/* ---------- bottom nav ---------- */
#nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 86%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); display: flex; z-index: 5; }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; border-radius: 12px; transition: color .15s, background .15s; }
#nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#nav a.active { color: var(--fairway-ink); background: color-mix(in srgb, var(--fairway) 10%, transparent); }
#nav a.active svg { stroke-width: 2.3; }

/* ---------- layout bits ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.card.tight { padding: 10px 14px; }
.card .title { font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.hr { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 11px 16px; background: var(--green-2); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .08s, filter .15s, background .15s; }
button:active, .btn:active { transform: scale(.97); }
button:disabled, .btn.disabled { opacity: .45; cursor: default; transform: none; }
.btn.secondary, button.secondary { background: var(--cream); color: var(--ink); border: 1px solid var(--line-2); }
.btn.danger, button.danger { background: var(--red); }
.btn.gold, button.gold { background: var(--lime); color: var(--lime-ink); box-shadow: 0 8px 20px -10px rgba(201,243,109,.9); }
.btn.block { width: 100%; }
.btn.sm, button.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.link, button.link { background: none; color: var(--fairway-ink); padding: 4px 6px; }
input, select, textarea { font: inherit; font-weight: 600; color: var(--ink); background: var(--card); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 10px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--fairway); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fairway) 22%, transparent); }
input::placeholder { color: var(--muted); font-weight: 500; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--fairway); transform: scale(1.2); margin: 0 6px 0 2px; }
input[type="color"] { padding: 2px; height: 42px; width: 54px; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
label.f { display: block; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.field { margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line-2); font-size: 13px; font-weight: 700; cursor: pointer; user-select: none; transition: background .12s, color .12s; }
.chip.on { background: var(--green-2); color: #fff; border-color: var(--green-2); }
.chip.sm { padding: 4px 10px; font-size: 12px; }
.chip.muted { opacity: .55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; border: 1px solid rgba(0,0,0,.15); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; flex: none; text-shadow: 0 1px 1px rgba(0,0,0,.25); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.tabs { display: flex; gap: 4px; background: var(--cream); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); padding: 9px 6px; font-size: 13px; border-radius: 11px; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.badge { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--cream); color: var(--muted); border: 1px solid var(--line-2); text-transform: uppercase; letter-spacing: .05em; vertical-align: middle; }
.badge.live { background: var(--red); color: #fff; border: 0; }
.badge.done { background: var(--green-2); color: #fff; border: 0; }
.banner { background: var(--sand); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.banner.warn { background: #fde9c9; color: #5a3b00; }
:root[data-theme="dark"] .banner.warn { background: #4a3a1a; color: #ffd98a; }
details summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.search { position: relative; }
.search input { padding-left: 38px; }
.search:before { content: ""; position: absolute; left: 13px; top: 12px; width: 15px; height: 15px; border: 2px solid var(--muted); border-radius: 50%; box-sizing: border-box; }
.search:after { content: ""; position: absolute; left: 24px; top: 23px; width: 7px; height: 2px; background: var(--muted); transform: rotate(45deg); border-radius: 2px; }

/* ---------- lists ---------- */
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list .item:first-child { padding-top: 2px; }
.list .item:last-child { border-bottom: 0; padding-bottom: 2px; }
.list .item .title { font-weight: 700; }
.list .item .sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.list .item .chev { color: var(--line-2); font-size: 22px; font-weight: 300; }
.list .item .ic { font-size: 20px; width: 36px; height: 36px; border-radius: 12px; background: var(--cream); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.card.item { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.card.item .title { font-weight: 800; }
.card.item .sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.card.item .chev { color: var(--line-2); font-size: 22px; }
.card.item .ic { font-size: 22px; width: 42px; height: 42px; border-radius: 14px; background: var(--cream); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sel-list .item { cursor: pointer; }
.sel-list .item.on { background: var(--cream); margin: 0 -16px; padding-left: 16px; padding-right: 16px; border-radius: 10px; }

/* ---------- stats, numbers ---------- */
.stat { background: var(--cream); border-radius: var(--radius-sm); padding: 12px 12px 10px; }
.stat .v { font-size: 26px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11.5px; color: var(--muted); font-weight: 700; margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }
.topar { font-weight: 800; font-variant-numeric: tabular-nums; }
.topar.under { color: var(--red); }
.topar.over { color: var(--ink); }
.topar.even { color: var(--fairway-ink); }
.place { width: 28px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb .row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.lb .row:last-child { border-bottom: 0; }
.lb .big { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; letter-spacing: -.02em; }
.lb .row:nth-child(1) .place, .lb .row:nth-child(2) .place, .lb .row:nth-child(3) .place { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
.lb .row:nth-child(1) .place { background: var(--gold); color: #3b2a00; }
.lb .row:nth-child(2) .place { background: #b8bfc4; color: #222; }
.lb .row:nth-child(3) .place { background: #c98a52; }
.bar { height: 10px; background: var(--cream); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--fairway); border-radius: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
canvas.chart { width: 100%; height: 200px; display: block; }
.teamhdr { font-weight: 800; margin: 10px 0 4px; display: flex; align-items: center; gap: 8px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.sc { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.sc th, .sc td { padding: 6px 3px; text-align: center; min-width: 34px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sc th:first-child, .sc td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); min-width: 92px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; font-weight: 700; }
.sc td.tot { font-weight: 800; background: var(--cream); }
.sc input { width: 34px; height: 34px; padding: 0; text-align: center; border-radius: 10px; border-width: 1.5px; font-weight: 700; }
.sc span.b, .sc span.e, .sc span.p, .sc span.bo, .sc span.dbl { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; font-weight: 700; }
/* scorecard glyphs: circle = birdie, double circle = eagle, square = bogey, double square = double+ */
.sc .b { color: var(--red); border: 1.5px solid var(--red); border-radius: 50%; }
.sc .e { color: var(--eagle); border: 1.5px solid var(--eagle); border-radius: 50%; box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--eagle); }
.sc .bo { color: var(--ink); border: 1.5px solid var(--line-2); border-radius: 4px; }
.sc .dbl { color: var(--muted); border: 1.5px solid var(--line-2); border-radius: 4px; box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--line-2); }
.sc input.b, .sc input.e { background: color-mix(in srgb, var(--red) 8%, var(--card)); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--green); background-image: radial-gradient(90% 120% at 100% 0%, rgba(201,243,109,.28), transparent 60%), radial-gradient(70% 90% at 0% 100%, rgba(47,187,108,.45), transparent 60%); color: #fff; border-radius: 22px; padding: 22px 18px 18px; margin-bottom: 14px; box-shadow: var(--shadow-lg); }
.hero h2 { color: #fff; margin: 0 0 4px; font-size: 26px; letter-spacing: -.03em; }
.hero p { opacity: .85; margin: 0 0 14px; font-size: 14px; max-width: 34em; }
.hero .btn.ghost { background: rgba(255,255,255,.14); color: #fff; box-shadow: none; margin-left: 8px; }
.pill.hold { background: var(--lime); color: var(--lime-ink); font-weight: 800; }
.pill.hold.over { background: var(--red); color: #fff; }
.tt-opt { padding: 14px 16px; }
.tt-opt.chosen { outline: 2px solid var(--lime); }
.tt-opt .tt-time { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.tt-opt .big { font-size: 28px; font-weight: 800; min-width: 36px; text-align: right; color: var(--green-2); }
.chip.no.on { background: var(--red); border-color: var(--red); }
.chip.gold { background: var(--lime); color: var(--lime-ink); border-color: transparent; }
.card.locked { background: var(--green); color: #fff; }
.card.locked .small { color: rgba(255,255,255,.8); }
.card.locked button.secondary { background: rgba(255,255,255,.16); color: #fff; border: 0; }
.card.locked button:not(.secondary) { background: var(--lime); color: var(--lime-ink); }
.tt-grid td, .tt-grid th { padding: 8px 6px; }
.tt-cell { display: inline-flex; width: 30px; height: 30px; border-radius: 9px; align-items: center; justify-content: center; font-weight: 800; background: var(--cream); color: var(--muted); cursor: pointer; }
.tt-cell.y { background: var(--green-2); color: #fff; }
.tt-cell.n { background: var(--red); color: #fff; }
button.secondary.on { outline: 2px solid var(--red); }
.intro .tick { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; background: var(--cream); color: var(--muted); border: 1.5px solid var(--line); flex: none; }
.intro .tick.on { background: var(--lime); color: var(--green); border-color: transparent; }
.intro .list .item { padding-left: 2px; }
.hero .btn { background: var(--lime); color: var(--lime-ink); padding: 12px 18px; font-size: 15px; }

/* ---------- hole screen ---------- */
.hole-head { background: var(--green); background-image: radial-gradient(80% 120% at 100% 0%, rgba(201,243,109,.22), transparent 60%); color: #fff; border-radius: 20px; padding: 14px 12px; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; box-shadow: var(--shadow-lg); }
.hole-head .n { font-size: 48px; font-weight: 800; line-height: 1; letter-spacing: -.04em; min-width: 54px; text-align: center; }
.hole-head .n::before { content: "Hole"; display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; font-weight: 700; margin-bottom: 2px; }
.hole-head .meta { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hole-head .pill { background: rgba(255,255,255,.14); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
.hole-head .pill.par { background: var(--lime); color: var(--lime-ink); }
.hole-head .meta .small { width: 100%; font-size: 12px; opacity: .75; font-weight: 600; }
.hole-head button { background: rgba(255,255,255,.14); width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; flex: none; }
.hole-head button:disabled { opacity: .25; }
.prog { height: 6px; background: var(--cream); border-radius: 6px; overflow: hidden; margin: -4px 0 12px; }
.prog > i { display: block; height: 100%; background: linear-gradient(90deg, var(--fairway), var(--lime)); border-radius: 6px; transition: width .25s; }
.score-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.score-row:last-of-type { border-bottom: 0; }
.score-row .name { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-row .name .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.score-row .name .tag { font-size: 11px; font-weight: 600; color: var(--muted); }
.score-row .name .tag .dot, .hole-head .pill .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); }
.score-row .pm { width: 46px; height: 46px; border-radius: 14px; font-size: 24px; padding: 0; background: var(--cream); color: var(--ink); border: 1px solid var(--line-2); }
.score-row .pm.plus { background: var(--green-2); color: #fff; border: 0; }
.score-row .val { width: 50px; text-align: center; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.score-row .val.empty { color: var(--line-2); }
.score-row .val.b { color: var(--red); }
.score-row .val.e { color: var(--eagle); }
.score-row .val.p { color: var(--ink); }
.score-row .val.bo, .score-row .val.dbl { color: var(--muted); }
.score-row.me { background: color-mix(in srgb, var(--fairway) 10%, transparent); border-radius: 14px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.score-row.me .name::after { content: "you"; font-size: 10px; color: var(--fairway-ink); font-weight: 800; margin-left: 6px; text-transform: uppercase; letter-spacing: .08em; background: color-mix(in srgb, var(--fairway) 14%, transparent); padding: 2px 6px; border-radius: 999px; vertical-align: 2px; }
.extras { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0 10px 46px; }
.extras .chip { font-size: 12px; padding: 4px 9px; }
.extras .chip.auto::after { content: "auto"; font-size: 9px; font-weight: 600; opacity: .75; margin-left: 2px; }
.holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; margin-top: 14px; }
.holes .h { aspect-ratio: 1; border-radius: 9px; background: var(--cream); border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.holes .h.full { background: color-mix(in srgb, var(--fairway) 16%, var(--card)); color: var(--fairway-ink); border-color: color-mix(in srgb, var(--fairway) 40%, transparent); }
.holes .h.on { background: var(--green-2); color: #fff; border-color: var(--green-2); }

/* ---------- group / sync ---------- */
.syncdot { font-size: 11px; font-weight: 800; color: #fff; text-decoration: none; padding: 5px 10px 5px 8px; border-radius: 999px; background: rgba(255,255,255,.14); max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 6px; }
.syncdot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #999; flex: none; }
.syncdot.ok::before { background: var(--lime); box-shadow: 0 0 0 3px rgba(201,243,109,.25); }
.syncdot.pending::before { background: var(--gold); }
.syncdot.offline::before { background: var(--red); }
.syncdot.nogroup::before, .syncdot.off::before { background: #bbb; }
.syncdot.hide { display: none; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 32px; font-weight: 800; letter-spacing: 4px; color: var(--green-2); margin: 2px 0 8px; }
:root[data-theme="dark"] .code { color: var(--lime); }

/* ---------- overlays ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#modal { position: fixed; inset: 0; background: rgba(5,12,9,.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
#modal[hidden] { display: none; }
#modal .sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
#modal .sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
#modal .sheet h2 { font-size: 20px; }
@media (min-width: 640px) { #modal { align-items: center; } #modal .sheet { border-radius: 24px; } #modal .sheet::before { display: none; } }
.kbd { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.kbd button { padding: 12px 0; font-size: 18px; background: var(--cream); color: var(--ink); border: 1px solid var(--line-2); }
.kbd button.go { background: var(--fairway); color: #fff; border: 0; }
.spark { display: inline-block; vertical-align: middle; }

@media (min-width: 700px) {
  main#view { padding-top: 22px; }
  .card { padding: 18px 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- season wrap ---------- */
.card.season { background: var(--green); background-image: radial-gradient(90% 120% at 100% 0%, rgba(201,243,109,.28), transparent 60%); color: #fff; text-decoration: none; display: block; }
.card.season .k { color: var(--lime); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.card.season .t { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0; }
.card.season .s { opacity: .85; font-size: 14px; }
.wrap-hero { background: var(--green); background-image: radial-gradient(90% 120% at 100% 0%, rgba(201,243,109,.28), transparent 60%), radial-gradient(70% 90% at 0% 100%, rgba(47,187,108,.45), transparent 60%); color: #fff; border-radius: 22px; padding: 20px 18px 16px; margin-bottom: 12px; box-shadow: var(--shadow-lg); }
.wrap-hero .k { color: var(--lime); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.wrap-hero h2 { color: #fff; margin: 2px 0 12px; font-size: 30px; letter-spacing: -.03em; }
.wrap-hero .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wrap-hero .nums .v { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.wrap-hero .nums .l { font-size: 11px; opacity: .75; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.award { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.award:last-child { border-bottom: 0; }
.award .ic { font-size: 24px; width: 44px; height: 44px; border-radius: 14px; background: var(--cream); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.award .ttl { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.award .who { font-weight: 800; font-size: 17px; }
.award .txt { font-size: 13px; color: var(--muted); font-weight: 500; }
.award .val { font-weight: 800; text-align: right; flex: none; color: var(--fairway-ink); font-variant-numeric: tabular-nums; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 90px; margin-top: 6px; }
.months .m { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 10px; color: var(--muted); font-weight: 700; }
.months .m i { display: block; width: 100%; background: var(--fairway); border-radius: 4px 4px 0 0; min-height: 2px; margin-bottom: 3px; }
.months .m b { font-size: 11px; color: var(--ink); }

/* ---------- sunlight mode: black on white, no gradients, bigger everything that matters on the course ---------- */
:root[data-sun] { --bg: #ffffff; --card: #ffffff; --cream: #f1f1f1; --sand: #eeeeee; --ink: #000000; --muted: #2b2b2b; --line: #9a9a9a; --line-2: #000000; --fairway: #006b2e; --fairway-ink: #004d20; --green: #000000; --green-2: #000000; --lime: #ffe600; --lime-ink: #000000; --red: #c40000; --eagle: #7a4f00; --gold: #ffd400; --blue: #0030a0; --shadow: none; --shadow-lg: none; color-scheme: light; }
:root[data-sun] body { font-size: 18px; }
:root[data-sun] * { transition: none !important; }
:root[data-sun] #top, :root[data-sun] .hero, :root[data-sun] .hole-head, :root[data-sun] .holemap, :root[data-sun] .wrap-hero, :root[data-sun] .card.season { background-image: none; }
:root[data-sun] #top { border-bottom: 2px solid #000; }
:root[data-sun] #nav { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; border-top: 2px solid #000; }
:root[data-sun] #nav a { color: #222; font-size: 12px; }
:root[data-sun] #nav a.active { color: #000; background: #ffe600; }
:root[data-sun] .card { border: 2px solid #000; }
:root[data-sun] .stat { border: 2px solid #000; background: #fff; }
:root[data-sun] .stat .v { font-size: 32px; }
:root[data-sun] .stat .l, :root[data-sun] h3, :root[data-sun] label.f, :root[data-sun] th { color: #000; }
:root[data-sun] button, :root[data-sun] .btn { border: 2px solid #000; font-size: 17px; }
:root[data-sun] button.secondary, :root[data-sun] .btn.secondary { background: #fff; color: #000; }
:root[data-sun] button.sm, :root[data-sun] .btn.sm { font-size: 15px; }
:root[data-sun] input, :root[data-sun] select, :root[data-sun] textarea { border: 2px solid #000; }
:root[data-sun] .chip { border: 2px solid #000; background: #fff; color: #000; font-size: 15px; }
:root[data-sun] .chip.on { background: #000; color: #fff; }
:root[data-sun] .extras .chip { font-size: 14px; padding: 6px 11px; }
:root[data-sun] .hole-head { padding: 14px; }
:root[data-sun] .hole-head .n { font-size: 60px; }
:root[data-sun] .hole-head .n::before { opacity: 1; }
:root[data-sun] .hole-head .pill { background: #fff; color: #000; font-size: 16px; }
:root[data-sun] .hole-head .pill.par { background: #ffe600; }
:root[data-sun] .hole-head .meta .small { opacity: 1; font-size: 13px; }
:root[data-sun] .hole-head button { background: #fff; color: #000; width: 52px; height: 52px; font-size: 28px; border: 0; }
:root[data-sun] .prog { background: #fff; border: 1px solid #000; }
:root[data-sun] .prog > i { background: #000; }
:root[data-sun] .score-row { padding: 11px 0; border-bottom: 1px solid #000; }
:root[data-sun] .score-row .name { font-size: 19px; }
:root[data-sun] .score-row .name .sub, :root[data-sun] .score-row .name .tag { color: #222; font-size: 13px; }
:root[data-sun] .score-row .val { font-size: 42px; width: 64px; }
:root[data-sun] .score-row .val.empty { color: #9a9a9a; }
:root[data-sun] .score-row .val.bo, :root[data-sun] .score-row .val.dbl { color: #000; }
:root[data-sun] .score-row .pm { width: 58px; height: 58px; font-size: 30px; border: 2px solid #000; background: #fff; color: #000; }
:root[data-sun] .score-row .pm.plus { background: #000; color: #fff; }
:root[data-sun] .score-row.me { background: #fff3a3; }
:root[data-sun] .score-row.me .name::after { background: #000; color: #fff; }
:root[data-sun] .holes .h { border: 2px solid #000; color: #000; background: #fff; font-size: 14px; }
:root[data-sun] .holes .h.full { background: #d9d9d9; color: #000; }
:root[data-sun] .holes .h.on { background: #000; color: #fff; }
:root[data-sun] .lb .big { font-size: 28px; }
:root[data-sun] .gps .yd .big { font-size: 56px; color: #000; }
:root[data-sun] .gps .l, :root[data-sun] .gps .fb { color: #000; }
:root[data-sun] .topar.even { color: #000; }
:root[data-sun] .avatar { box-shadow: inset 0 0 0 2px #000; text-shadow: none; }
:root[data-sun] .sc input { border: 2px solid #000; }
:root[data-sun] .sc .bo, :root[data-sun] .sc .dbl { color: #000; border-color: #000; }
:root[data-sun] .badge { border: 1.5px solid #000; color: #000; }
:root[data-sun] .badge.done, :root[data-sun] .badge.live { color: #fff; }
:root[data-sun] .list .item .sub, :root[data-sun] .card.item .sub, :root[data-sun] .award .txt { color: #222; }
:root[data-sun] .list .item .chev { color: #000; }
:root[data-sun] .list .item { border-bottom: 1px solid #000; }
:root[data-sun] #toast { background: #000; color: #fff; border: 2px solid #fff; }
:root[data-sun] .tabs { border: 2px solid #000; background: #fff; }
:root[data-sun] .tabs button { border: 0; }
:root[data-sun] .tabs button.on { background: #000; color: #fff; }
button.sun.on { background: #ffe600; color: #000; border: 2px solid #000; }

/* ---------- scorekeepers, checks ---------- */
.score-row .tag.lock { cursor: pointer; background: var(--cream); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; font-weight: 700; margin-left: 4px; }
.score-row .tag.lock.over { background: var(--lime); color: var(--lime-ink); border-color: transparent; }
.score-row.kept .pm { opacity: .3; }
.score-row.kept .val { opacity: .7; }
.card.checks { border: 2px solid var(--gold); }
.list .item .thumb { width: 58px; height: 58px; border-radius: 16px; background-size: cover; background-position: center; background-color: var(--cream); flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.banner { position: relative; height: 180px; border-radius: var(--radius); background-size: cover; background-position: center; background-color: var(--green); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-lg); }
.banner .banner-t { position: absolute; left: 0; right: 0; bottom: 0; padding: 36px 16px 14px; background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff; }
.banner .name { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.banner .sub { font-size: 12px; opacity: .8; margin-top: 3px; }
.hero.photo { background-image: linear-gradient(180deg, rgba(8,28,19,.45), rgba(8,28,19,.88)), var(--hero-photo); background-size: cover; background-position: center; }
:root[data-sun] .banner, :root[data-sun] .hero.photo { background-image: none !important; }
:root[data-sun] .banner .banner-t { background: #000; position: static; }
:root[data-sun] .banner { height: auto; }
.list .item .star { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--line-2); padding: 6px 4px; cursor: pointer; flex: none; }
.list .item .star.on { color: var(--gold); }
.list .item a.grow { text-decoration: none; color: inherit; min-width: 0; }
.fit { font-weight: 700; }
.fit.easier { color: var(--green-2, #2e8b57); }
.fit.tougher { color: var(--red, #c0392b); }
#wx_dummy, [id^="wx_"] { white-space: nowrap; }

/* ---------- order of play (spin the tee, honors) ---------- */
.order { margin: 0 0 12px; padding: 8px 10px 10px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.order .top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.order .row { align-items: center; }
.order .who { display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; padding: 3px 4px 4px 2px; flex: 1; min-width: 0; }
.order .who::-webkit-scrollbar { display: none; }
.order .u { position: relative; flex: none; }
.order .u .avatar { width: 30px; height: 30px; font-size: 12px; }
.order .u b { position: absolute; right: -10px; bottom: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ink); color: var(--card); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--card); }
.order .u.first .avatar { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--lime); }
.order .u.first b { background: var(--lime); color: var(--lime-ink); }
.order .lbl { flex: 1; min-width: 0; line-height: 1.2; }
.order .lbl b { display: block; font-size: 15px; }
.order .lbl > span { display: block; font-size: 13px; color: var(--ink); opacity: .78; }
/* After the first tee the strip folds into one tappable line. */
.order.chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px 7px 12px; min-height: 48px; text-align: left; color: var(--ink); font: inherit; border: 0; cursor: pointer; }
.order.chip .lbl { flex: 0 1 auto; }
.order.chip .main { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order.chip .main b { display: inline; font-size: inherit; font-weight: 800; }
.order.chip .sub { display: block; font-size: 12px; font-weight: 600; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order.chip .who { gap: 15px; justify-content: flex-end; padding: 3px 11px 6px 2px; }
.order.chip .u .avatar { width: 28px; height: 28px; font-size: 10.5px; }
.order.chip .u b { min-width: 15px; height: 15px; line-height: 15px; font-size: 9.5px; padding: 0 3px; right: -11px; bottom: -5px; }
.order.chip .go { font-size: 22px; line-height: 1; opacity: .6; flex: none; }
.order-note { margin: -6px 4px 12px; font-size: 13px; font-weight: 600; color: var(--ink); opacity: .8; }
.avatar.light { color: #13201a; text-shadow: none; }
.sheet-help { margin: -4px 0 10px; font-size: 14px; color: var(--ink); opacity: .82; }
#modal .sheet button.secondary { border: 1.5px solid color-mix(in srgb, var(--ink) 32%, transparent); }
.order-list .mv { width: 44px; height: 44px; padding: 0; font-size: 15px; border-radius: 12px; background: var(--cream); color: var(--ink); border: 1.5px solid color-mix(in srgb, var(--ink) 30%, transparent); }
.order-list .mv:disabled { opacity: .25; }
.order-list .item { gap: 8px; }
.spin { position: relative; width: 260px; height: 260px; margin: 6px auto 0; border-radius: 50%; background: radial-gradient(circle, var(--fairway) 0 34%, color-mix(in srgb, var(--fairway) 55%, var(--card)) 34% 36%, var(--cream) 36% 100%); box-shadow: inset 0 0 0 1px var(--line-2); }
.spin .p { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; transition: transform .2s; }
.spin .p.hit { transform: scale(1.25); }
.spin .p.hit .avatar { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--lime); }
.spin .tee { position: absolute; left: 50%; top: 50%; width: 22px; height: 123px; margin: -61.5px 0 0 -11px; transform-origin: 50% 50%; transition: transform 3.4s cubic-bezier(.1,.7,.08,1); filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.spin-out { text-align: center; font-size: 18px; font-weight: 700; margin: 10px 0 8px; min-height: 26px; }
.order-list .item .place { width: 24px; text-align: center; font-weight: 800; color: var(--muted); }

/* ---------- printable scorecard ---------- */
.printcard { overflow-x: auto; }
.printcard .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.printcard .head h2 { margin: 0; }
.printcard table.pc { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; table-layout: fixed; }
.printcard .pc th, .printcard .pc td { border: 1px solid var(--line-2); padding: 4px 2px; text-align: center; height: 34px; }
.printcard .pc th { font-size: 11px; background: var(--cream); }
.printcard .pc .lbl { text-align: left; width: 118px; padding-left: 6px; }
.printcard .pc .lbl .sub { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.printcard .pc tr.yd td, .printcard .pc tr.meta td { font-size: 11px; color: var(--muted); height: 22px; }
.printcard .pc tr.pl td { height: 44px; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; vertical-align: middle; position: relative; }
.printcard .pc tr.pl td .dots { position: absolute; top: 1px; left: 4px; font-size: 11px; color: var(--muted); letter-spacing: -1px; }
.printcard .pc tr.pl td .b { color: var(--red); }
.printcard .pc tr.pl td .e { color: var(--eagle); }
.printcard .pc td.tot { background: var(--cream); }
.printcard .sign { display: flex; gap: 24px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.printcard .sign span { flex: 1; border-top: 1px solid var(--ink); padding-top: 4px; }
@media print {
  :root, :root[data-theme="dark"], :root[data-sun] { --bg: #fff; --card: #fff; --cream: #f2f2f2; --ink: #000; --muted: #333; --line: #999; --line-2: #666; --shadow: none; --shadow-lg: none; }
  #top, #nav, #toast, #modal, .noprint { display: none !important; }
  html, body { background: #fff; color: #000; font-size: 12px; }
  main#view { padding: 0; max-width: none; }
  .card, .printcard { box-shadow: none; border: 0; margin: 0; padding: 0; }
  .printcard .pc tr.pl td { height: 40px; }
  @page { size: landscape; margin: 8mm; }
}

/* ---------- GPS yardages ---------- */
.gps { padding: 12px 14px; }
.gps .l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.gps .yd { display: flex; align-items: baseline; gap: 8px; margin: 2px 0; }
.gps .yd .big { font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--fairway-ink); }
.gps .yd .unit { font-size: 11px; line-height: 1.1; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.gps .fb { font-size: 13px; color: var(--muted); font-weight: 600; }
.gps .fb b { color: var(--ink); font-variant-numeric: tabular-nums; }
.gps .shot { text-align: right; flex: none; }
.gps .shot .small { margin-top: 4px; line-height: 1.3; }
.gps .shot b { color: var(--ink); }

/* ---------- side games ---------- */
.junk { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-2); }

/* ---------- hole map, clubs ---------- */
.holemap { width: 100%; height: auto; display: block; margin-top: 10px; border-radius: 14px; background: var(--green); background-image: radial-gradient(80% 100% at 100% 0%, rgba(47,187,108,.5), transparent 60%); cursor: crosshair; touch-action: manipulation; }
.holemap.aerial { background: #26332a; background-image: none; }
.clubs { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
