/* Party Golf: clean, glossy, friendly UI (white + sky blue, rounded everything). */
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url('../vendor/fonts/nunito-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url('../vendor/fonts/nunito-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 900; font-display: swap; src: url('../vendor/fonts/nunito-latin-900-normal.woff2') format('woff2'); }

:root {
  --accent: #3BB4F2; --accent-dark: #1E8FD0; --navy: #1B2A4A; --muted: #6B7A99;
  --card: rgba(255, 255, 255, 0.94); --line: #E3EAF3; --soft: #F4F8FC;
  --good: #4CC77A; --warn: #FFB020; --bad: #FF5A5F;
  --radius: 24px; --shadow: 0 10px 30px rgba(27, 42, 74, 0.18), 0 2px 6px rgba(27, 42, 74, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8FD8FF;
  font-family: 'Nunito', system-ui, -apple-system, sans-serif; color: var(--navy); user-select: none; }
#stage { position: fixed; inset: 0; }
.hidden { display: none !important; }
.layer { position: fixed; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }

/* ---- buttons -------------------------------------------------------------------- */
.btn { font: 800 20px 'Nunito', system-ui, sans-serif; color: var(--navy); cursor: pointer;
  border: 2px solid var(--line); border-radius: 999px; padding: 12px 28px;
  background: linear-gradient(#FFFFFF 0%, #FFFFFF 45%, #EEF4FA 100%);
  box-shadow: 0 4px 0 #D5DFEB, 0 6px 14px rgba(27, 42, 74, 0.12);
  transition: transform .12s cubic-bezier(.3, 1.6, .5, 1), box-shadow .12s, border-color .12s; }
.btn:hover, .btn:focus-visible { border-color: var(--accent); outline: none;
  box-shadow: 0 4px 0 #BFE3F7, 0 0 0 6px rgba(59, 180, 242, 0.22), 0 6px 14px rgba(27, 42, 74, 0.12); transform: translateY(-2px); }
.btn:active { transform: translateY(3px) scale(.97); box-shadow: 0 1px 0 #D5DFEB; }
.btn.primary { color: #fff; border-color: #2AA4E4; background: linear-gradient(#6FCBFA 0%, #3BB4F2 50%, #22A0E2 100%);
  box-shadow: 0 4px 0 #1785C2, 0 6px 16px rgba(59, 180, 242, 0.45); text-shadow: 0 1px 0 rgba(0,0,0,.15); }
.btn.primary:hover { box-shadow: 0 4px 0 #1785C2, 0 0 0 6px rgba(59, 180, 242, 0.3), 0 6px 16px rgba(59, 180, 242, 0.45); }
.btn.small { font-size: 15px; padding: 7px 16px; }
.btn.round { width: 56px; height: 56px; padding: 0; font-size: 26px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---- menu ------------------------------------------------------------------------- */
#menu { display: flex; align-items: center; justify-content: center; }
.screen { width: min(1100px, 92vw); max-height: 96vh; overflow: auto; padding: 8px 4px; text-align: center;
  animation: popIn .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.screen.leaving { animation: popOut .2s ease-in both; }
@keyframes popIn { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@keyframes popOut { to { opacity: 0; transform: translateY(-16px) scale(.97); } }
.logo { font-weight: 900; font-size: clamp(48px, 8vw, 96px); letter-spacing: .06em; margin: 0 0 6px;
  color: #fff; text-shadow: 0 4px 0 var(--accent-dark), 0 10px 24px rgba(27, 42, 74, .25); }
.logo .flag { display: inline-block; animation: wave 2s ease-in-out infinite; transform-origin: bottom left; }
@keyframes wave { 50% { transform: rotate(-8deg); } }
.tagline { font-weight: 800; font-size: 20px; color: #fff; margin-bottom: 36px; text-shadow: 0 2px 6px rgba(27,42,74,.35); }
.title { font-weight: 900; font-size: 40px; margin: 0 0 22px; color: #fff; text-shadow: 0 3px 0 var(--accent-dark), 0 8px 18px rgba(27,42,74,.25); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.8); padding: 24px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.mode-card { cursor: pointer; padding: 28px 20px 24px; transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .18s; text-align: center; }
.mode-card:hover, .mode-card:focus-visible { transform: translateY(-6px) rotate(-.5deg); outline: none;
  box-shadow: 0 0 0 6px rgba(59, 180, 242, .35), var(--shadow); }
.mode-card .icon { font-size: 64px; display: inline-block; animation: bob 3s ease-in-out infinite; }
.mode-card:nth-child(2) .icon { animation-delay: -1s; } .mode-card:nth-child(3) .icon { animation-delay: -2s; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.mode-card h3 { font-size: 28px; font-weight: 900; margin: 10px 0 6px; }
.mode-card p { color: var(--muted); font-weight: 600; margin: 0; font-size: 16px; }
.bottom-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 8px 16px;
  font-weight: 800; box-shadow: var(--shadow); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: #C9D3E0; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px rgba(76,199,122,.25); }
.nav { display: flex; justify-content: center; gap: 14px; margin-top: 26px; }

.counter { display: flex; align-items: center; justify-content: center; gap: 30px; padding: 36px; }
.counter .num { font-size: 120px; font-weight: 900; width: 160px; line-height: 1; color: var(--accent-dark); }
.player-rows { display: grid; gap: 14px; text-align: left; }
.player-row { display: grid; grid-template-columns: 54px 1fr auto auto; gap: 14px; align-items: center; padding: 12px 16px; }
.badge { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.12), inset 0 4px 0 rgba(255,255,255,.35); }
input.name { font: 800 22px 'Nunito', system-ui, sans-serif; color: var(--navy); border: 2px solid var(--line); border-radius: 14px;
  padding: 10px 14px; width: 100%; background: var(--soft); }
input.name:focus { outline: none; border-color: var(--accent); background: #fff; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.swatch.sel { box-shadow: 0 0 0 3px var(--navy); }
.swatch.taken { opacity: .25; pointer-events: none; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 4px; border: 2px solid var(--line); }
.seg button { font: 800 15px 'Nunito', system-ui; border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg button.sel { background: #fff; color: var(--navy); box-shadow: 0 2px 6px rgba(27,42,74,.15); }

.course-card { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; text-align: left; align-items: center; cursor: pointer; }
.course-card h3 { font-size: 34px; margin: 0; font-weight: 900; }
.course-card .meta { color: var(--muted); font-weight: 700; margin: 6px 0 12px; }
.minimap { width: 100%; height: 220px; border-radius: 18px; background: #6CCB5F; }

/* lobby */
.lobby { display: grid; grid-template-columns: 340px 1fr; gap: 22px; text-align: left; }
.qr { background: #fff; border-radius: 18px; padding: 12px; display: grid; place-items: center; }
.qr img { width: min(190px, 22vh); height: min(190px, 22vh); image-rendering: pixelated; }
.room-code { font-weight: 900; font-size: 38px; line-height: 1; letter-spacing: .25em; text-align: center; color: var(--navy); margin: -6px 0 8px; padding-left: .25em; }
.code-sm { letter-spacing: .12em; }
.url { font-weight: 900; font-size: 14px; text-align: center; margin: 10px 0; word-break: break-all; color: var(--accent-dark); }
.steps { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.45; margin: 8px 0 0; padding-left: 20px; }
.tabs { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.lobby-player { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; margin-bottom: 10px; }
.safety { display: inline-block; background: var(--card); border-radius: 14px; padding: 8px 14px; font-weight: 800; font-size: 14px; color: #8A5A00; box-shadow: var(--shadow); }
.lobby-player .sub { font-size: 14px; color: var(--muted); font-weight: 700; }
select.dev { font: 800 15px 'Nunito', system-ui; border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--soft); color: var(--navy); }
.rate { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 8px; background: #E7F7EE; color: #2B9A5A; margin-left: 6px; }
.rate.low { background: #FFF3DC; color: #B07400; }
.hint { font-size: 14px; color: var(--muted); font-weight: 700; }

/* settings */
.settings { display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: center; text-align: left; font-weight: 800; font-size: 18px; }
.settings .desc { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
input[type=range] { accent-color: var(--accent); width: 200px; }

/* ---- HUD ---------------------------------------------------------------------------------- */
#hud { font-weight: 800; }
.hud-box { position: absolute; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 10px 18px; }
#hud-player { top: 18px; left: 18px; display: flex; align-items: center; gap: 12px; padding: 8px 20px 8px 8px; border-radius: 999px; }
#hud-player .badge { width: 46px; height: 46px; }
#hud-player .name { font-size: 24px; font-weight: 900; line-height: 1.05; }
#hud-player .sub { font-size: 14px; color: var(--muted); }
#hud-hole { top: 18px; right: 18px; text-align: right; }
#hud-hole .big { font-size: 24px; font-weight: 900; }
#hud-hole .sub { font-size: 14px; color: var(--muted); }
#hud-hole .dist { font-size: 30px; font-weight: 900; color: var(--accent-dark); }
#hud-wind { bottom: 18px; left: 18px; display: flex; align-items: center; gap: 12px; }
#hud-wind .arrow { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 26px; transition: transform .5s; }
#hud-club { bottom: 18px; left: 50%; transform: translateX(-50%); text-align: center; min-width: 300px; }
#hud-club .club { font-size: 28px; font-weight: 900; }
#hud-club .sub { font-size: 14px; color: var(--muted); }
#swing-pill { display: inline-block; margin-top: 6px; padding: 4px 14px; border-radius: 999px; font-size: 16px; background: var(--soft); color: var(--muted); transition: all .2s; }
#swing-pill.ready { background: var(--good); color: #fff; animation: pulse 1s ease-in-out infinite; }
#swing-pill.moving { background: var(--accent); color: #fff; }
#swing-pill.bad { background: var(--warn); color: #fff; }
@keyframes pulse { 50% { transform: scale(1.08); } }
#hud-phones { bottom: 18px; right: 18px; display: flex; gap: 10px; align-items: center; font-size: 14px; }
#hud-shot { top: 110px; right: 18px; width: 250px; animation: slideIn .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } }
#hud-shot h4 { margin: 0 0 8px; font-size: 18px; font-weight: 900; }
#hud-shot .row { display: flex; justify-content: space-between; font-size: 16px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
#hud-shot .row b { font-weight: 900; }
#hud-keys { position: absolute; bottom: 136px; left: 50%; transform: translateX(-50%); font-size: 13px; color: #fff;
  text-shadow: 0 1px 3px rgba(27,42,74,.6); font-weight: 800; white-space: nowrap; }
#power { position: absolute; bottom: 166px; left: 50%; transform: translateX(-50%); width: 360px; height: 22px; border-radius: 999px;
  background: rgba(255,255,255,.9); box-shadow: var(--shadow); overflow: hidden; }
#power .fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #6FCBFA, #3BB4F2 70%, #FFB020 85%, #FF5A5F); }
#power .mark { position: absolute; top: 0; bottom: 0; left: 83.3%; width: 3px; background: var(--navy); opacity: .4; }

/* toast + confetti */
#toast { position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; text-align: center; z-index: 30; }
#toast .t { font-weight: 900; font-size: clamp(48px, 9vw, 110px); color: #fff; letter-spacing: .04em;
  text-shadow: 0 5px 0 var(--accent-dark), 0 12px 30px rgba(27,42,74,.35); animation: toastIn .6s cubic-bezier(.2, 1.6, .4, 1) both; }
#toast .s { font-weight: 900; font-size: 26px; color: #fff; text-shadow: 0 2px 8px rgba(27,42,74,.5); animation: toastIn .6s .1s both; }
@keyframes toastIn { from { opacity: 0; transform: scale(.4); } }
#toast.out { animation: popOut .3s both; }
.confetti { position: fixed; top: -20px; width: 12px; height: 18px; border-radius: 4px; z-index: 29; pointer-events: none;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
#mini-toast { position: fixed; top: 96px; left: 50%; transform: translateX(-50%); z-index: 25; pointer-events: none; }
#mini-toast .m { background: var(--card); border-radius: 999px; padding: 8px 20px; font-weight: 800; box-shadow: var(--shadow); animation: popIn .3s both; }

/* overlay dialogs */
#overlay { display: flex; align-items: center; justify-content: center; background: rgba(27, 42, 74, .28); backdrop-filter: blur(3px); z-index: 20; }
#overlay.hidden { display: none; }
.dialog { min-width: 420px; max-width: min(960px, 94vw); max-height: 90vh; overflow: auto; text-align: center; animation: popIn .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.dialog h2 { font-size: 34px; font-weight: 900; margin: 0 0 12px; }
.dialog p { font-weight: 700; color: var(--muted); }
.dialog .stack { display: grid; gap: 12px; max-width: 360px; margin: 18px auto 0; }
.count { font-size: 120px; font-weight: 900; color: var(--accent-dark); animation: popIn .4s both; }

table.scorecard { border-collapse: separate; border-spacing: 0; margin: 10px auto; font-weight: 800; font-size: 17px; }
.scorecard th, .scorecard td { padding: 7px 10px; text-align: center; min-width: 40px; }
.scorecard th { color: var(--muted); font-size: 14px; }
.scorecard td.name { text-align: left; white-space: nowrap; }
.scorecard .badge { width: 28px; height: 28px; font-size: 13px; display: inline-grid; vertical-align: middle; margin-right: 6px; }
.scorecard tr.par td { color: var(--muted); }
.scorecard tbody tr:nth-child(even) td { background: var(--soft); }
.scorecard .sc { display: inline-grid; place-items: center; width: 30px; height: 30px; }
.scorecard .sc.under { border: 2.5px solid var(--bad); border-radius: 50%; }
.scorecard .sc.under2 { border: 2.5px double var(--bad); border-radius: 50%; border-width: 5px; }
.scorecard .sc.over { border: 2.5px solid var(--navy); border-radius: 4px; }
.scorecard .sc.over2 { border: 5px double var(--navy); border-radius: 4px; }
.scorecard td.total { font-size: 20px; font-weight: 900; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin: 20px 0; }
.podium .p { width: 150px; border-radius: 18px 18px 6px 6px; color: #fff; padding: 12px; font-weight: 900;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.12); animation: popIn .6s both; }
.podium .p .n { font-size: 20px; } .podium .p .sc { font-size: 34px; }

#netbar { position: fixed; top: 0; left: 50%; transform: translateX(-50%); background: var(--warn); color: #fff; font-weight: 900;
  padding: 8px 20px; border-radius: 0 0 16px 16px; z-index: 40; }
