:root {
  /* notch / home-bar insets; non-zero only when running edge-to-edge (installed app, viewport-fit=cover) */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --ink: #0b1424;
  --panel: rgba(11, 20, 36, 0.82);
  --panel-2: rgba(22, 36, 60, 0.9);
  --line: rgba(255, 255, 255, 0.12);
  --lime: #c6ff3d;
  --lime-2: #8fe01f;
  --coral: #ff5d5d;
  --sky: #3dd6ff;
  --gold: #ffc23d;
  --txt: #f3f7ff;
  --mute: #9fb0c8;
  --r: 16px;
  --head: 'Segoe UI Black', 'Arial Black', 'Helvetica Neue', system-ui, sans-serif;
  --body: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--txt); font-family: var(--body); -webkit-user-select: none; user-select: none; touch-action: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); }
.hidden { display: none !important; }
small { font-size: 0.75em; }
kbd { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-size: 0.85em; font-family: var(--body); }

/* ---------- icons */
.ico { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.16em; margin-right: 0.28em; border-radius: 50%; }
.ico.coin { background: radial-gradient(circle at 35% 30%, #fff6b8 0 18%, #ffd23d 19% 55%, #d99a00 56%); box-shadow: inset 0 0 0 2px #b98000; }
.ico.trophy { border-radius: 3px 3px 40% 40%; background: linear-gradient(#ffe38a, #f0a800); clip-path: polygon(10% 0, 90% 0, 85% 45%, 60% 62%, 60% 78%, 78% 100%, 22% 100%, 40% 78%, 40% 62%, 15% 45%); }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font: 900 20px var(--head); color: var(--ink); background: var(--lime); transform: skew(-6deg); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 14px; border-radius: 8px; }
.avatar.xl { width: 96px; height: 96px; font-size: 48px; border-radius: 26px; }
.gball { display: inline-block; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 20%, var(--gc) 60%, #0003 100%); box-shadow: inset -2px -3px 0 rgba(0, 0, 0, 0.15); flex: none; }
.gtee { display: inline-block; width: 22px; height: 22px; flex: none; background: var(--gc); clip-path: polygon(10% 0, 90% 0, 90% 18%, 60% 26%, 56% 100%, 44% 100%, 40% 26%, 10% 18%); }
.gball.big, .gtee.big { width: 48px; height: 48px; }

/* ---------- buttons */
.btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 22px; border-radius: 14px; font: 900 16px var(--head); text-transform: uppercase; letter-spacing: 0.04em; background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); transition: transform 0.08s, filter 0.15s; }
.btn:not(:disabled):hover { filter: brightness(1.12); }
.btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn small { font: 600 12px var(--body); text-transform: none; letter-spacing: 0; opacity: 0.85; }
.btn.primary { background: linear-gradient(180deg, var(--lime), var(--lime-2)); color: var(--ink); border-color: transparent; box-shadow: 0 4px 0 #4f8a00; }
.btn.primary:not(:disabled):active { box-shadow: 0 1px 0 #4f8a00; }
.btn.ghost { background: rgba(255, 255, 255, 0.06); }
.btn.big { padding: 16px 40px; font-size: 24px; }
.btn.sm { padding: 8px 12px; font-size: 13px; flex-direction: row; gap: 4px; }

/* ---------- HUD */
#hud { position: fixed; inset: var(--sat) var(--sar) var(--sab) var(--sal); pointer-events: none; }
#hud > *, #aimControls > *, #bottomRow > * { pointer-events: auto; }
#aimControls, #bottomRow, #swingHud { pointer-events: none; }
#topbar { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.pcard { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 190px; backdrop-filter: blur(6px); transition: box-shadow 0.25s, border-color 0.25s; }
.pcard.foe { justify-content: flex-end; text-align: right; }
.pcard.you.active { border-color: var(--lime); box-shadow: 0 0 0 2px rgba(198, 255, 61, 0.25), 0 0 24px rgba(198, 255, 61, 0.25); }
.pcard.foe.active { border-color: var(--coral); box-shadow: 0 0 0 2px rgba(255, 93, 93, 0.25), 0 0 24px rgba(255, 93, 93, 0.25); }
.pcard.foe .avatar { background: var(--coral); }
.pname { font: 900 15px var(--head); text-transform: uppercase; letter-spacing: 0.02em; }
.pstat { font-size: 12px; color: var(--mute); }
.pstat b { color: var(--txt); }
#holeBadge { text-align: center; padding: 6px 18px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); margin-top: -10px; }
.hb-course { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: 0.1em; }
.hb-hole { font: 900 22px var(--head); font-style: italic; text-transform: uppercase; }
.hb-par { font-size: 13px; color: var(--lime); font-weight: 700; }

#wind { position: absolute; left: 14px; top: 92px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.wind-dial { width: 64px; height: 64px; border-radius: 50%; position: relative; background: radial-gradient(circle, rgba(61, 214, 255, 0.18), transparent 70%), repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.25) 0 2deg, transparent 2deg 45deg); border: 2px solid rgba(255, 255, 255, 0.2); }
.wind-arrow { position: absolute; inset: 6px; transition: transform 0.3s; }
.wind-arrow::before { content: ''; position: absolute; left: 50%; top: 2px; width: 0; height: 0; transform: translateX(-50%); border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid var(--sky); }
.wind-arrow::after { content: ''; position: absolute; left: 50%; top: 16px; bottom: 6px; width: 5px; transform: translateX(-50%); background: linear-gradient(var(--sky), transparent); border-radius: 3px; }
.wind-speed { font: 900 20px var(--head); }
.wind-speed small { font: 600 11px var(--body); color: var(--mute); margin-left: 2px; }

#lieChip { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 7px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; white-space: nowrap; pointer-events: none; }
.lie { font-weight: 800; }
.lie.fairway, .lie.tee, span.fairway, span.tee { color: #9fff6a; }
.lie.green, span.green { color: var(--lime); }
.lie.fringe, span.fringe { color: #b7f07a; }
.lie.rough, span.rough { color: #e8c66a; }
.lie.sand, span.sand { color: #ffd98a; }
.lie.water, span.water { color: var(--sky); }
.lie.oob, span.oob { color: var(--coral); }
.lie.deep, span.deep { color: #d9a45a; }
.blind-tag { font: 800 11px var(--head); letter-spacing: 0.05em; padding: 2px 7px; border-radius: 99px; background: rgba(255, 93, 93, 0.2); color: #ffb0a0; }
.plays { display: block; font-size: 10px; font-weight: 700; font-style: normal; opacity: 0.85; }
.warn { color: var(--gold); }

#viewBtns { position: absolute; right: 14px; top: 92px; display: flex; flex-direction: column; gap: 6px; }
#viewBtns button { padding: 8px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font: 800 12px var(--head); text-transform: uppercase; letter-spacing: 0.05em; }
#viewBtns button.on { background: var(--lime); color: var(--ink); }

#spinPad { position: absolute; right: 14px; bottom: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
#spinPad.disabled { opacity: 0.5; pointer-events: none; }
.spin-ball { width: 92px; height: 92px; border-radius: 50%; position: relative; cursor: crosshair; touch-action: none; background: radial-gradient(circle at 36% 30%, #ffffff 0 16%, #e4ebf3 45%, #a9b6c6 100%); box-shadow: inset -6px -8px 0 rgba(0, 0, 0, 0.12), 0 4px 0 rgba(0, 0, 0, 0.3); }
.spin-ball::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background-image: radial-gradient(circle, rgba(0, 0, 0, 0.12) 1.5px, transparent 2px); background-size: 9px 9px; }
.spin-cross { position: absolute; inset: 12%; border-radius: 50%; border: 1px dashed rgba(11, 20, 36, 0.35); }
.spin-cross::before, .spin-cross::after { content: ''; position: absolute; background: rgba(11, 20, 36, 0.25); }
.spin-cross::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.spin-cross::after { top: 50%; left: 0; right: 0; height: 1px; }
.spin-dot { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--coral); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); left: 50%; top: 50%; transition: left 0.06s, top 0.06s; pointer-events: none; }
.spin-label { font-size: 11px; color: var(--mute); max-width: 120px; text-align: center; min-height: 14px; }

#bottomRow { position: absolute; left: 10px; right: 10px; bottom: 12px; display: flex; align-items: flex-end; gap: 10px; }
#gearRow { display: flex; flex-direction: column; gap: 6px; }
.gear { display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; min-width: 170px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-align: left; font-size: 13px; font-weight: 700; }
.gear span small { display: block; font-size: 10px; color: var(--mute); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.gear em { font-style: normal; color: var(--lime); margin-left: 4px; }
#clubBar { flex: 1; display: flex; gap: 6px; justify-content: center; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; }
.club { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 74px; padding: 8px 6px 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); transition: transform 0.12s, background 0.12s; }
.club:hover { transform: translateY(-3px); }
.club .cs { font: 900 20px var(--head); font-style: italic; color: var(--cc); }
.club .cd { font-size: 13px; font-weight: 800; }
.club .cn { font-size: 9.5px; color: var(--mute); max-width: 70px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.club.active { background: linear-gradient(180deg, rgba(198, 255, 61, 0.25), var(--panel)); border-color: var(--lime); transform: translateY(-6px); }
.club.suggested::after { content: 'BEST'; position: absolute; top: -8px; right: -4px; font: 900 8px var(--head); padding: 2px 5px; border-radius: 6px; background: var(--gold); color: var(--ink); }
#shootBtn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 124px; height: 84px; border-radius: 22px; background: linear-gradient(180deg, var(--lime), var(--lime-2)); color: var(--ink); box-shadow: 0 6px 0 #4f8a00, 0 10px 30px rgba(198, 255, 61, 0.35); font: 900 26px var(--head); font-style: italic; text-transform: uppercase; transition: transform 0.08s; animation: pulse 2s infinite; }
#shootBtn small { font: 700 11px var(--body); opacity: 0.6; font-style: normal; }
#shootBtn:active { transform: translateY(4px); box-shadow: 0 2px 0 #4f8a00; }
@keyframes pulse { 50% { box-shadow: 0 6px 0 #4f8a00, 0 10px 44px rgba(198, 255, 61, 0.6); } }

#popover { position: absolute; left: 10px; bottom: 120px; width: 320px; max-height: 60vh; overflow: auto; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4); }
.pop-title { font: 900 14px var(--head); text-transform: uppercase; padding: 4px 6px 8px; }
.pop-foot { font-size: 11px; color: var(--mute); padding: 6px; text-align: center; }
.gear-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; }
.gear-opt:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.gear-opt.on { background: rgba(198, 255, 61, 0.14); outline: 1px solid var(--lime); }
.gear-opt span { flex: 1; }
.gear-opt b { display: block; font-size: 13px; }
.gear-opt small { color: var(--mute); }
.gear-opt em { font-style: normal; font-weight: 800; color: var(--lime); }

/* swing hud */
#swingHud { position: absolute; inset: 0; pointer-events: auto; cursor: pointer; }
#swingInfo { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); padding: 7px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; white-space: nowrap; }
#powerMeter { position: absolute; right: 36px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pm-track { position: relative; width: 38px; height: 46vh; max-height: 380px; border-radius: 19px; background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.3); overflow: visible; }
.pm-fill { position: absolute; left: 4px; right: 4px; bottom: 4px; height: 0; max-height: calc(100% - 8px); border-radius: 14px; background: linear-gradient(0deg, var(--lime-2), var(--lime) 60%, var(--gold) 85%, var(--coral)); }
.pm-target { position: absolute; left: -12px; right: -12px; height: 4px; margin-bottom: -2px; background: #fff; border-radius: 2px; box-shadow: 0 0 10px #fff; }
.pm-target span { position: absolute; right: calc(100% + 6px); top: -8px; font: 900 11px var(--head); color: #fff; text-shadow: 0 1px 3px #000; }
#powerMeter.near .pm-track { border-color: var(--lime); box-shadow: 0 0 18px rgba(198, 255, 61, 0.6); }
.pm-label { font: 900 12px var(--head); text-transform: uppercase; letter-spacing: 0.1em; text-shadow: 0 1px 3px #000; }
#accWrap { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); width: min(560px, 80vw); }
#accMeter { position: relative; height: 30px; border-radius: 15px; background: linear-gradient(90deg, rgba(255, 93, 93, 0.55), rgba(255, 194, 61, 0.45) 30%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 194, 61, 0.45) 70%, rgba(255, 93, 93, 0.55)); border: 2px solid rgba(255, 255, 255, 0.3); }
.am-sweet { position: absolute; top: 2px; bottom: 2px; background: var(--lime); border-radius: 10px; box-shadow: 0 0 14px rgba(198, 255, 61, 0.7); }
.am-center { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: #fff; transform: translateX(-50%); }
.am-needle { position: absolute; top: -10px; bottom: -10px; width: 6px; margin-left: -3px; background: #fff; border-radius: 3px; box-shadow: 0 0 10px #fff, 0 0 0 2px var(--ink); }
.am-labels { display: flex; justify-content: space-between; margin-top: 6px; font: 800 11px var(--head); text-transform: uppercase; color: #fff; text-shadow: 0 1px 3px #000; letter-spacing: 0.1em; }
#swingHint { position: absolute; left: 50%; bottom: 130px; transform: translateX(-50%); font-size: 16px; font-weight: 700; text-shadow: 0 2px 6px #000; white-space: nowrap; }
#backBtn { position: absolute; left: 14px; bottom: 16px; padding: 10px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; }

/* labels */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; will-change: transform; }
.lbl.pin { margin: -44px 0 0 -30px; width: 60px; text-align: center; }
.lbl.pin span { display: block; font: 900 9px var(--head); color: #fff; background: #ff3d6e; border-radius: 6px 6px 0 0; padding: 1px 0; }
.lbl.pin b { display: block; background: var(--panel-2); border-radius: 0 0 6px 6px; font-size: 13px; padding: 2px 0; }
.lbl.target { margin: 14px 0 0 -40px; width: 80px; text-align: center; }
.lbl.target b { display: inline-block; font: 900 16px var(--head); padding: 2px 10px; border-radius: 10px; background: rgba(11, 20, 36, 0.85); }
.lbl.target span { display: block; font-size: 11px; font-weight: 800; text-shadow: 0 1px 3px #000; }
.lbl.ball { margin: -34px 0 0 -30px; width: 60px; text-align: center; font: 900 10px var(--head); text-transform: uppercase; padding: 2px 0; border-radius: 8px; color: var(--ink); }
.lbl.ball::after { content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-bottom: 0; border-top-color: inherit; }
.lbl.ball.you { background: var(--lime); border-color: var(--lime); }
.lbl.ball.foe { background: var(--coral); border-color: var(--coral); color: #fff; }
.lbl b small { font-size: 0.7em; }

/* banners */
#banner { position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%) scale(0.6); opacity: 0; pointer-events: none; text-align: center; transition: transform 0.25s cubic-bezier(.2, 1.6, .4, 1), opacity 0.2s; }
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.b-main { font: 900 clamp(34px, 6vw, 64px) var(--head); font-style: italic; text-transform: uppercase; letter-spacing: 0.02em; color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 30px rgba(0, 0, 0, 0.35); -webkit-text-stroke: 1px rgba(0, 0, 0, 0.2); }
#banner.you .b-main { color: var(--lime); }
#banner.foe .b-main { color: var(--coral); }
.b-sub { display: inline-block; margin-top: 6px; padding: 6px 16px; border-radius: 999px; background: var(--panel); font-weight: 700; font-size: 15px; }
#rating { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%) scale(0.5); opacity: 0; pointer-events: none; font: 900 46px var(--head); font-style: italic; text-transform: uppercase; transition: all 0.25s cubic-bezier(.2, 1.6, .4, 1); text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
#rating.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#rating.perfect { color: var(--lime); }
#rating.great { color: var(--sky); }
#rating.good { color: #fff; }
#rating.bad { color: var(--coral); }
#toast { position: fixed; left: 50%; bottom: calc(120px + var(--sab)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 18px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; white-space: nowrap; transition: all 0.25s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#hud[data-mode='aim'] ~ #toast { bottom: calc(140px + var(--sab)); }
#holeCard { position: fixed; left: calc(40px + var(--sal)); bottom: calc(40px + var(--sab)); padding: 18px 26px; background: var(--panel); border-left: 6px solid var(--lime); border-radius: var(--r); opacity: 0; transform: translateX(-30px); transition: all 0.4s; pointer-events: none; }
#holeCard.show { opacity: 1; transform: none; }
.hc-num { font: 900 42px var(--head); font-style: italic; text-transform: uppercase; line-height: 1; }
.hc-par { font: 900 22px var(--head); color: var(--lime); text-transform: uppercase; }
.hc-yds, .hc-wind { font-size: 15px; color: var(--mute); }
.hc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; max-width: 300px; }
.hc-tags span { font: 800 11px var(--head); text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 99px; background: rgba(198, 255, 61, 0.14); color: var(--lime); }
.hc-skip { margin-top: 8px; font-size: 11px; color: var(--mute); opacity: 0.7; }

/* loading */
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(11, 20, 36, 0.92); z-index: 50; font: 900 20px var(--head); text-transform: uppercase; letter-spacing: 0.06em; }
.ball-spin { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #c9d3df); box-shadow: 0 0 0 6px rgba(198, 255, 61, 0.25); animation: bounce 0.7s infinite cubic-bezier(.5, 0, .5, 1) alternate; }
@keyframes bounce { from { transform: translateY(-18px); } to { transform: translateY(10px) scale(1.1, 0.9); } }

/* modal */
#modal { position: fixed; inset: 0; padding: var(--sat) var(--sar) var(--sab) var(--sal); display: none; align-items: center; justify-content: center; background: rgba(5, 10, 20, 0.55); z-index: 30; }
#modal.show { display: flex; }
.panel { width: min(560px, 92vw); padding: 24px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5); text-align: center; animation: pop 0.3s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.p-title { font: 900 30px var(--head); font-style: italic; text-transform: uppercase; }
.p-sub { font-size: 16px; font-weight: 700; margin: 4px 0 14px; color: var(--mute); }
.p-sub.good, .good { color: var(--lime) !important; }
.p-sub.bad, .bad { color: var(--coral) !important; }
.hole-names { display: flex; justify-content: center; gap: 20px; margin-bottom: 14px; font: 900 18px var(--head); text-transform: uppercase; font-style: italic; }
.hole-names .you { color: var(--lime); }
.hole-names .foe { color: var(--coral); }
table.card { width: 100%; border-collapse: separate; border-spacing: 4px; margin-bottom: 18px; font-weight: 700; }
table.card th, table.card td { padding: 8px 6px; border-radius: 8px; text-align: center; background: rgba(255, 255, 255, 0.05); }
table.card th { font: 800 12px var(--head); text-transform: uppercase; color: var(--mute); }
table.card th.you { color: var(--lime); text-align: left; }
table.card th.foe { color: var(--coral); text-align: left; }
table.card .parrow td { color: var(--mute); }
table.card td.ace, table.card td.eagle { background: var(--gold); color: var(--ink); }
table.card td.birdie { background: var(--lime); color: var(--ink); }
table.card td.par { background: rgba(255, 255, 255, 0.12); }
table.card td.bogey { background: rgba(61, 214, 255, 0.3); }
table.card td.dbl { background: rgba(255, 93, 93, 0.4); }
table.card td.tot { background: rgba(255, 255, 255, 0.18); font-size: 18px; }

/* ---------- menus */
#screens { position: fixed; inset: 0; padding: var(--sat) var(--sar) var(--sab) var(--sal); display: none; flex-direction: column; z-index: 10; background: linear-gradient(180deg, rgba(11, 20, 36, 0.7), rgba(11, 20, 36, 0.15) 35%, rgba(11, 20, 36, 0.25) 70%, rgba(11, 20, 36, 0.85)); }
#screens.on { display: flex; }
.m-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; gap: 10px; }
.logo { display: flex; align-items: baseline; gap: 8px; font: 900 34px var(--head); font-style: italic; letter-spacing: -0.01em; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); }
.logo .l2 { background: var(--lime); color: var(--ink); padding: 0 12px; border-radius: 10px; transform: skew(-8deg) rotate(-3deg); display: inline-block; text-shadow: none; box-shadow: 0 4px 0 #4f8a00; }
.pills { display: flex; gap: 8px; align-items: center; }
.pill { display: flex; align-items: center; gap: 6px; padding: 7px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 15px; }
.pill.prof { padding: 4px 14px 4px 4px; }
.home-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 10px; }
.home-mid > * { flex-shrink: 0; } /* scroll on short screens instead of squashing the course cards */
.courses { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.course { position: relative; width: 250px; border-radius: 22px; overflow: hidden; text-align: left; background: var(--panel-2); border: 2px solid var(--line); transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.course:hover { transform: translateY(-4px); }
.course.sel { border-color: var(--lime); transform: translateY(-8px) scale(1.04); box-shadow: 0 0 0 4px rgba(198, 255, 61, 0.2), 0 20px 40px rgba(0, 0, 0, 0.45); }
.c-art { position: relative; height: 110px; overflow: hidden; }
.course.pine .c-art { background: linear-gradient(180deg, #7ec8ff, #dff3ff); }
.course.desert .c-art { background: linear-gradient(180deg, #ff9d57, #ffe3b8); }
.course.snow .c-art { background: linear-gradient(180deg, #8fb4d9, #eef6ff); }
.c-sun { position: absolute; right: 24px; top: 16px; width: 34px; height: 34px; border-radius: 50%; background: #fff7d6; box-shadow: 0 0 30px #fff3b0; }
.c-hill { position: absolute; bottom: -40px; border-radius: 50%; }
.c-hill.h1 { left: -30px; width: 200px; height: 100px; }
.c-hill.h2 { right: -40px; width: 230px; height: 90px; bottom: -46px; }
.course.pine .h1 { background: #4f8a30; } .course.pine .h2 { background: #6dbb3c; }
.course.desert .h1 { background: #c97b4f; } .course.desert .h2 { background: #8fbf4a; }
.course.snow .h1 { background: #dfe8ee; } .course.snow .h2 { background: #7bb36a; }
.c-flag { position: absolute; left: 58%; bottom: 30px; width: 3px; height: 44px; background: #fff; }
.c-flag::after { content: ''; position: absolute; left: 3px; top: 0; border-left: 22px solid #ff3d6e; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.c-body { padding: 12px 16px 16px; }
.c-name { font: 900 20px var(--head); font-style: italic; text-transform: uppercase; line-height: 1.1; }
.c-tag { font-size: 12px; color: var(--mute); margin: 2px 0 10px; }
.c-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; border-top: 1px dashed var(--line); }
.c-row span { color: var(--mute); }
.c-lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(11, 20, 36, 0.72); font-weight: 800; backdrop-filter: grayscale(1); }
.lock-ico { width: 30px; height: 26px; border-radius: 6px; background: #fff; position: relative; margin-top: 12px; }
.lock-ico::before { content: ''; position: absolute; left: 6px; top: -14px; width: 14px; height: 14px; border: 4px solid #fff; border-bottom: 0; border-radius: 10px 10px 0 0; }
.play-row { display: flex; gap: 12px; align-items: stretch; }
.daily { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-radius: 16px; background: linear-gradient(90deg, rgba(255, 194, 61, 0.25), rgba(255, 194, 61, 0.08)); border: 1px solid rgba(255, 194, 61, 0.6); text-align: left; animation: glow 1.6s infinite alternate; }
.daily small { display: block; color: var(--mute); }
.gift { width: 30px; height: 26px; background: var(--gold); border-radius: 5px; position: relative; box-shadow: inset 0 0 0 0 #000; }
.gift::before { content: ''; position: absolute; left: 50%; top: -4px; bottom: 0; width: 5px; transform: translateX(-50%); background: var(--coral); }
.gift::after { content: ''; position: absolute; left: -3px; right: -3px; top: 0; height: 7px; background: #ffd86b; border-radius: 3px; }
@keyframes glow { to { box-shadow: 0 0 24px rgba(255, 194, 61, 0.45); } }
.install-btn { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-radius: 16px; text-align: left; background: linear-gradient(90deg, rgba(198, 255, 61, 0.22), rgba(198, 255, 61, 0.06)); border: 1px solid rgba(198, 255, 61, 0.45); }
.install-btn small { display: block; color: var(--mute); }
.install-ico { width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--lime); clip-path: polygon(40% 8%, 60% 8%, 60% 46%, 78% 46%, 50% 74%, 22% 46%, 40% 46%, 40% 8%); box-shadow: inset 0 -6px 0 rgba(0,0,0,0.15); }
.install-help ol { text-align: left; line-height: 1.7; margin: 12px 0 18px; padding-left: 22px; }
.share-ico { display: inline-block; width: 14px; height: 16px; vertical-align: -2px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; position: relative; }
.share-ico::before { content: ''; position: absolute; left: 4px; top: -8px; width: 2px; height: 12px; background: currentColor; }
.hint-line { font-size: 13px; color: var(--gold); }
.m-nav { display: flex; justify-content: center; gap: 8px; padding: 10px 10px 16px; }
.m-nav button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 92px; padding: 8px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font: 800 12px var(--head); text-transform: uppercase; letter-spacing: 0.04em; }
.m-nav button.on { background: var(--lime); color: var(--ink); }
.nav-ico { width: 22px; height: 22px; background: currentColor; }
.nav-ico.home { clip-path: polygon(30% 0, 36% 0, 36% 8%, 90% 26%, 36% 44%, 36% 100%, 30% 100%); }
.nav-ico.locker { clip-path: polygon(20% 100%, 26% 100%, 70% 18%, 92% 24%, 96% 8%, 64% 0, 58% 14%); }
.nav-ico.shop { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 16%, currentColor 18%); }
.nav-ico.profile { clip-path: circle(50% at 50% 50%); background: radial-gradient(circle at 50% 36%, currentColor 0 24%, transparent 25%), radial-gradient(ellipse at 50% 100%, currentColor 0 44%, transparent 45%); }
.m-nav button .nav-ico.shop { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.9) 0 16%, currentColor 18%); }

/* versus */
.vs-wrap { flex: 1; display: flex; align-items: center; justify-content: center; gap: 40px; background: linear-gradient(110deg, rgba(198, 255, 61, 0.18) 0 49.8%, rgba(255, 93, 93, 0.18) 50.2%); }
.vs-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 30px; min-width: 220px; background: var(--panel); border-radius: 24px; border: 2px solid var(--line); animation: slideL 0.5s cubic-bezier(.2, 1.3, .4, 1); }
.vs-card.foe { animation-name: slideR; border-color: rgba(255, 93, 93, 0.5); }
.vs-card.you { border-color: rgba(198, 255, 61, 0.5); }
.vs-card.searching .avatar { animation: shake 0.3s infinite; }
.vs-card.found { animation: pop 0.4s cubic-bezier(.2, 1.4, .4, 1); }
.vs-name { font: 900 22px var(--head); text-transform: uppercase; font-style: italic; }
.vs-sub { color: var(--mute); font-weight: 700; }
.vs-mid { text-align: center; }
.vs { font: 900 90px var(--head); font-style: italic; line-height: 1; background: linear-gradient(90deg, var(--lime), var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.35)); }
.vs-course { font: 900 18px var(--head); text-transform: uppercase; margin-top: 6px; }
.vs-stake { color: var(--gold); font-weight: 700; margin-top: 4px; }
@keyframes slideL { from { transform: translateX(-60px); opacity: 0; } }
@keyframes slideR { from { transform: translateX(60px); opacity: 0; } }
@keyframes shake { 50% { transform: skew(-6deg) rotate(6deg); } }

/* result */
#screens.scr-result { background: rgba(11, 20, 36, 0.55); }
.result { margin: auto; width: min(600px, 94vw); padding: 28px; text-align: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5); animation: pop 0.4s cubic-bezier(.2, 1.4, .4, 1); }
.r-title { font: 900 60px var(--head); font-style: italic; text-transform: uppercase; line-height: 1; }
.result.win .r-title { color: var(--lime); }
.result.loss .r-title { color: var(--coral); }
.r-score { font: 900 38px var(--head); margin: 8px 0 16px; }
.r-score .you { color: var(--lime); }
.r-score .foe { color: var(--coral); }
.r-score .dash { color: var(--mute); margin: 0 14px; }
.r-rewards { text-align: left; margin-bottom: 18px; }
.r-line { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px dashed var(--line); }
.r-line.total { font-size: 18px; border-bottom: 0; }
.unlock { padding: 10px; margin-bottom: 14px; border-radius: 12px; background: rgba(198, 255, 61, 0.15); border: 1px solid var(--lime); }
.r-btns { display: flex; gap: 12px; justify-content: center; }

/* pages */
.page { flex: 1; overflow: auto; padding: 4px 20px 20px; width: min(1100px, 100%); margin: 0 auto; }
.page.narrow { width: min(720px, 100%); }
.page-title { font: 900 32px var(--head); font-style: italic; text-transform: uppercase; margin-bottom: 12px; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.page-title small { display: block; font: 600 13px var(--body); text-transform: none; font-style: normal; color: var(--mute); text-shadow: none; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 9px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font: 800 13px var(--head); text-transform: uppercase; border-bottom: 3px solid var(--cc); }
.tab.on { background: var(--cc); color: var(--ink); }
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.club-card { padding: 16px; border-radius: 20px; background: var(--panel-2); border: 2px solid var(--line); border-top: 5px solid var(--rc); }
.club-card.eq { border-color: var(--lime); border-top-color: var(--rc); box-shadow: 0 0 0 3px rgba(198, 255, 61, 0.15); }
.club-card.unowned { opacity: 0.92; }
.cc-head { display: flex; justify-content: space-between; align-items: baseline; }
.cc-name { font: 900 19px var(--head); font-style: italic; text-transform: uppercase; }
.cc-rar { font: 800 11px var(--head); text-transform: uppercase; color: var(--rc); }
.cc-lvl { font-size: 12px; color: var(--mute); margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 10px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.pips i.f { background: var(--lime); }
.stats { display: grid; gap: 6px; }
.stat { display: grid; grid-template-columns: 70px 1fr 64px; align-items: center; gap: 8px; font-size: 12px; }
.stat span { color: var(--mute); }
.stat .bar { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stat .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--sky), var(--lime)); border-radius: 4px; }
.stat .bar i.up { background: var(--gold); border-radius: 0 4px 4px 0; animation: blink 1s infinite alternate; }
@keyframes blink { to { opacity: 0.4; } }
.stat b { text-align: right; }
.stat b em { font-style: normal; color: var(--gold); font-size: 10px; margin-left: 3px; }
.perks { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.perks span { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: rgba(61, 214, 255, 0.15); color: var(--sky); font-weight: 700; }
.cc-act { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 14px; }
.equipped { font: 800 12px var(--head); color: var(--lime); text-transform: uppercase; margin-right: auto; }
.maxed { font-size: 12px; color: var(--gold); font-weight: 700; }
.shop-sec h3 { font: 900 18px var(--head); text-transform: uppercase; margin: 10px 0; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.shop-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--panel-2); border: 1px solid var(--line); }
.si-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.si-body small { color: var(--mute); }
.owned { font-size: 12px; color: var(--lime); font-weight: 700; }
.free { font-size: 12px; color: var(--mute); }
.prof-card { display: flex; gap: 20px; align-items: center; padding: 18px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 14px; }
.prof-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mute); }
.prof-edit input { font: 900 20px var(--head); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--txt); width: 260px; -webkit-user-select: text; user-select: text; }
.swatches { display: flex; gap: 8px; margin-top: 10px; }
.sw { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.sw.on { border-color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.sg { padding: 14px 10px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); text-align: center; }
.sg b { display: block; font: 900 24px var(--head); }
.sg span { font-size: 12px; color: var(--mute); }
.settings { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 14px; }
.toggle { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.toggle input { width: 20px; height: 20px; accent-color: var(--lime); }
.howto { padding: 16px 20px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.howto h3 { font: 900 16px var(--head); text-transform: uppercase; margin: 0 0 8px; }
.howto ol { padding-left: 20px; margin: 0 0 8px; }
.keys { color: var(--mute); margin: 0; }

/* responsive */
@media (max-width: 820px) {
  .pcard { min-width: 0; padding: 6px 8px; }
  .pcard .pstat { display: none; }
  .pname { font-size: 12px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .avatar { width: 32px; height: 32px; font-size: 16px; }
  .hb-hole { font-size: 17px; }
  #bottomRow { flex-wrap: wrap; }
  #clubBar { order: -1; width: 100%; flex: none; justify-content: flex-start; }
  .club { min-width: 62px; }
  #gearRow { flex-direction: row; flex: 1; }
  .gear { min-width: 0; flex: 1; }
  #shootBtn { width: 100px; height: 64px; font-size: 20px; }
  #spinPad { bottom: 200px; }
  .spin-ball { width: 70px; height: 70px; }
  #lieChip { top: 70px; font-size: 11px; gap: 8px; max-width: 94vw; overflow: hidden; }
  #wind { top: 106px; padding: 6px; }
  .wind-dial { width: 48px; height: 48px; }
  #viewBtns { top: 106px; }
  .home-mid { justify-content: flex-start; gap: 14px; overflow-y: auto; }
  .courses { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: 100%; padding: 12px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .course { flex: none; width: 210px; scroll-snap-align: center; }
  .course.sel { transform: none; }
  .c-art { height: 70px; }
  .play-row { flex-direction: column; width: 100%; padding: 0 16px; }
  .btn.big { padding: 14px 20px; font-size: 20px; }
  .m-top { padding: 10px 12px; flex-wrap: wrap; }
  .m-nav button { min-width: 0; flex: 1; padding: 8px 4px; font-size: 10px; }
  .page { padding: 4px 12px 12px; }
  .club-grid, .shop-grid { grid-template-columns: 1fr; }
  .prof-card { flex-direction: column; }
  .prof-edit input { width: 100%; }
  .logo { font-size: 24px; }
  .pill { font-size: 13px; padding: 5px 10px; }
  .pill.prof b { display: none; }
  .vs-wrap { flex-direction: column; gap: 14px; }
  .vs { font-size: 54px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  #toast { white-space: normal; width: 92vw; text-align: center; bottom: calc(170px + var(--sab)); }
}
@media (max-height: 540px) {
  .m-top { padding: 6px 14px; }
  .logo { font-size: 22px; }
  .home-mid { justify-content: flex-start; gap: 10px; overflow-y: auto; padding-top: 0; }
  .courses { flex-wrap: nowrap; }
  .course { width: 200px; flex: none; }
  .course.sel { transform: translateY(-2px); }
  .c-art, .c-tag { display: none; }
  .c-body { padding: 8px 12px 10px; }
  .c-name { font-size: 16px; margin-bottom: 6px; }
  .c-lock { flex-direction: row; font-size: 13px; }
  .lock-ico { transform: scale(0.7); margin-top: 8px; }
  .btn.big { padding: 10px 26px; font-size: 18px; }
  .play-row { flex-direction: row; }
  .daily { padding: 6px 12px; }
  .m-nav { padding: 4px 10px 8px; }
  .m-nav button { padding: 5px 10px; }
  #topbar { top: 6px; }
  .pcard .pstat { display: none; }
  #holeBadge { padding: 4px 14px 6px; }
  .hb-hole { font-size: 16px; }
  #lieChip { top: 60px; font-size: 11px; padding: 4px 10px; }
  #wind, #viewBtns { top: 64px; }
  #wind { padding: 5px; }
  .wind-dial { width: 42px; height: 42px; }
  #viewBtns button { padding: 5px 10px; }
  #spinPad { bottom: 96px; padding: 6px; }
  .spin-ball { width: 58px; height: 58px; }
  .spin-label { display: none; }
  #bottomRow { bottom: 6px; flex-wrap: nowrap; }
  #clubBar { order: 0; width: auto; flex: 1; }
  .club { min-width: 54px; padding: 5px 4px 4px; }
  .club .cn { display: none; }
  .club .cs { font-size: 16px; }
  .gear { min-width: 0; padding: 4px 8px 4px 6px; font-size: 11px; }
  #gearRow { flex-direction: column; flex: none; }
  #shootBtn { width: 96px; height: 58px; font-size: 19px; }
  .pm-track { height: 52vh; }
  #accWrap { bottom: 40px; }
  #swingHint { bottom: 92px; font-size: 13px; }
  #swingInfo { top: 56px; font-size: 11px; }
  #toast { bottom: calc(76px + var(--sab)); }
  #holeCard { left: calc(14px + var(--sal)); bottom: calc(14px + var(--sab)); padding: 10px 16px; }
  .hc-num { font-size: 28px; }
  .panel, .result { padding: 14px; max-height: 96vh; overflow: auto; }
  .r-title { font-size: 38px; }
  .r-score { font-size: 26px; margin: 2px 0 8px; }
  table.card th, table.card td { padding: 4px; }
  .vs-wrap { flex-direction: row; gap: 18px; }
  .avatar.xl { width: 64px; height: 64px; font-size: 32px; }
}
