/*
 * Balloon Blast — Chompy's UI system (chompy-3d/src/styles/chompy.css: one palette of tokens, one
 * radius scale, Luckiest Guy display face) recoloured from the pound's dark gold/violet into a bright
 * daylight candy set.
 */
:root {
  --bb-pink: #ff5fa2;
  --bb-pink-deep: #e0438a;
  --bb-lime: #8be04e;
  --bb-lime-deep: #62c22b;
  --bb-sky: #3fb8ff;
  --bb-sun: #ffd23f;
  --bb-grape: #b37bff;
  --bb-cream: #fffaf2;
  --bb-ink: #2a1840;
  --bb-ink-soft: rgba(42, 24, 64, 0.65);
  --bb-panel: rgba(255, 250, 242, 0.94);
  --bb-r-sm: 10px;
  --bb-r-md: 16px;
  --bb-r-lg: 26px;
  --bb-display: 'Luckiest Guy', 'Arial Rounded MT Bold', 'Trebuchet MS', -apple-system, BlinkMacSystemFont, sans-serif;
  --bb-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #7cc4ff; color: var(--bb-ink); font-family: var(--bb-body);
  position: fixed; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none;
}
#game { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

/* ── corner: exit · wallet · volume ─────────────────────────────────────── */
.corner {
  position: absolute; top: calc(var(--safe-top) + 10px); left: 10px; right: 10px; z-index: 30;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.corner > * { pointer-events: auto; }
.corner .wallet { margin-left: auto; }
.round-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff;
  background: var(--bb-pink); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 0 var(--bb-pink-deep), 0 6px 14px rgba(0, 0, 0, 0.18); cursor: pointer; padding: 0;
}
.round-btn.big { width: 52px; height: 52px; }
.round-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--bb-pink-deep); }
.wallet {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: #fff; border: 3px solid var(--bb-sun); font-family: var(--bb-display); font-size: 16px; color: var(--bb-ink);
}
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff59a, #3fcf5a 60%, #1f9a3a); }

/* ── screens ────────────────────────────────────────────────────────────── */
.screen { position: absolute; inset: 0; display: none; z-index: 10; }
.screen.active { display: flex; }
#menu-screen, #lobby-screen, #results-screen {
  align-items: center; justify-content: center; padding: calc(var(--safe-top) + 60px) 16px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(180deg, rgba(124, 196, 255, 0.15), rgba(255, 233, 246, 0.35));
  overflow-y: auto;
}
.panel {
  width: 100%; max-width: 420px; background: var(--bb-panel); border-radius: var(--bb-r-lg);
  padding: 20px 18px; border: 4px solid #fff; box-shadow: 0 10px 0 rgba(224, 67, 138, 0.35), 0 18px 40px rgba(42, 24, 64, 0.25);
  display: flex; flex-direction: column; gap: 12px; align-items: stretch; max-height: 100%; overflow-y: auto;
}
.wordmark {
  font-family: var(--bb-display); font-weight: 400; margin: 0; text-align: center; line-height: 0.95;
  font-size: clamp(44px, 14vw, 64px); display: flex; flex-direction: column;
}
.wordmark span:first-child { color: var(--bb-pink); text-shadow: 0 4px 0 #fff, 0 6px 0 var(--bb-pink-deep); }
.wordmark span:last-child { color: var(--bb-sky); text-shadow: 0 4px 0 #fff, 0 6px 0 #1f8bd1; }
.tagline { text-align: center; margin: 0; font-family: var(--bb-display); color: var(--bb-grape); font-size: 18px; letter-spacing: 1px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.big-btn {
  font-family: var(--bb-display); font-size: 20px; letter-spacing: 0.5px; color: #fff; border: 3px solid #fff;
  border-radius: var(--bb-r-md); padding: 12px 16px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}
.big-btn small { font-family: var(--bb-body); font-weight: 800; font-size: 12px; opacity: 0.95; background: rgba(255, 255, 255, 0.28); padding: 3px 8px; border-radius: 999px; }
.big-btn small.cost::before { content: ''; display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; background: radial-gradient(circle at 35% 35%, #fff59a, #3fcf5a 60%, #1f9a3a); }
.big-btn.small { font-size: 16px; padding: 10px 14px; }
.big-btn:active { transform: translateY(3px); }
.big-btn:disabled { filter: grayscale(0.7); opacity: 0.6; }
.big-btn.pink { background: var(--bb-pink); box-shadow: 0 5px 0 var(--bb-pink-deep); }
.big-btn.blue { background: var(--bb-sky); box-shadow: 0 5px 0 #1f8bd1; }
.big-btn.lime { background: var(--bb-lime); box-shadow: 0 5px 0 var(--bb-lime-deep); }
.big-btn.sun { background: #ffbf1f; box-shadow: 0 5px 0 #d89800; }
.big-btn.grape { background: var(--bb-grape); box-shadow: 0 5px 0 #8a52e0; }
.ghost-btn { font-family: var(--bb-display); font-size: 16px; background: transparent; border: 3px dashed rgba(42, 24, 64, 0.3); color: var(--bb-ink-soft); border-radius: var(--bb-r-md); padding: 9px 14px; cursor: pointer; }
.chip { font-family: var(--bb-display); font-size: 14px; border: 3px solid var(--bb-sky); color: var(--bb-ink); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip.on { background: var(--bb-sun); border-color: #ffbf1f; }
.chip:disabled { opacity: 0.45; }
.code-row { display: flex; gap: 8px; }
.code-row input {
  flex: 1; min-width: 0; font-family: var(--bb-display); font-size: 26px; letter-spacing: 6px; text-align: center; text-transform: uppercase;
  border: 3px solid var(--bb-sun); border-radius: var(--bb-r-md); padding: 6px; color: var(--bb-ink); background: #fff; user-select: text; -webkit-user-select: text;
}
.settings-row { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 13px; color: var(--bb-ink-soft); }
.note { text-align: center; margin: 0; font-size: 13px; font-weight: 700; color: var(--bb-pink-deep); min-height: 1em; }
.hint { text-align: center; margin: 0; font-size: 12px; color: var(--bb-ink-soft); }

/* ── lobby ──────────────────────────────────────────────────────────────── */
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lobby-head h2, .results h2 { font-family: var(--bb-display); font-weight: 400; font-size: 28px; margin: 0; color: var(--bb-pink); }
.room-code { font-family: var(--bb-display); font-size: 22px; letter-spacing: 4px; background: var(--bb-sun); border-radius: var(--bb-r-sm); padding: 4px 10px; color: var(--bb-ink); }
.room-code:empty { display: none; }
.status { text-align: center; font-weight: 800; font-size: 14px; color: var(--bb-ink-soft); min-height: 1.2em; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team { border-radius: var(--bb-r-md); padding: 10px; display: flex; flex-direction: column; gap: 6px; min-height: 110px; }
.team0 { background: rgba(255, 95, 162, 0.16); border: 3px solid var(--bb-pink); }
.team1 { background: rgba(139, 224, 78, 0.18); border: 3px solid var(--bb-lime); }
.team h3 { font-family: var(--bb-display); font-weight: 400; margin: 0; font-size: 18px; }
.team0 h3 { color: var(--bb-pink-deep); }
.team1 h3 { color: var(--bb-lime-deep); }
.team ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.team li { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.team li .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.15); }
.team li .tag { font-size: 10px; background: var(--bb-sun); border-radius: 6px; padding: 1px 5px; }
.team li.me { color: var(--bb-sky); }
.mode-row, .host-row, .pay-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mode-row:empty, .host-row:empty, .pay-row:empty { display: none; }
.pay-row { font-weight: 800; font-size: 14px; flex-direction: column; align-items: center; text-align: center; }
.lobby-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── HUD ───────────────────────────────────────────────────────────────── */
#game-screen { pointer-events: none; }
#game-screen button, #game-screen input, #game-screen .emote-wheel { pointer-events: auto; }
.hud-top {
  position: absolute; top: calc(var(--safe-top) + 58px); left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 10px;
}
.score-pill { font-family: var(--bb-display); font-size: 24px; color: #fff; min-width: 64px; text-align: center; padding: 4px 12px; border-radius: 999px; border: 3px solid #fff; }
.score-pill.team0 { background: var(--bb-pink); }
.score-pill.team1 { background: var(--bb-lime); }
.clock { font-family: var(--bb-display); font-size: 22px; color: var(--bb-ink); background: #fff; padding: 4px 12px; border-radius: var(--bb-r-md); display: flex; flex-direction: column; align-items: center; line-height: 1; }
.clock small { font-family: var(--bb-body); font-weight: 800; font-size: 10px; color: var(--bb-ink-soft); }
.clock small:empty { display: none; }
.scope-viewport { position: absolute; inset: 0; }
.scope-svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.15s; }
.reticle { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.reticle i { position: absolute; background: #fff; box-shadow: 0 0 0 1.5px var(--bb-pink); border-radius: 2px; }
.reticle i:nth-child(1) { left: -2px; top: -22px; width: 4px; height: 12px; }
.reticle i:nth-child(2) { left: -2px; top: 10px; width: 4px; height: 12px; }
.reticle i:nth-child(3) { left: -22px; top: -2px; width: 12px; height: 4px; }
.reticle i:nth-child(4) { left: 10px; top: -2px; width: 12px; height: 4px; }
.reticle b { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--bb-sun); box-shadow: 0 0 0 2px var(--bb-pink); }
.hit-pop { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--bb-display); font-size: 30px; color: #fff; text-shadow: 0 3px 0 var(--bb-pink-deep); animation: pop-up 0.7s ease-out forwards; }
@keyframes pop-up { from { opacity: 1; transform: translate(-50%, -30%) scale(0.6); } 40% { transform: translate(-50%, -80%) scale(1.15); } to { opacity: 0; transform: translate(-50%, -140%) scale(1); } }
.banner, .toast {
  position: absolute; left: 50%; transform: translateX(-50%); font-family: var(--bb-display); color: #fff; text-align: center; white-space: nowrap;
  text-shadow: 0 3px 0 rgba(0,0,0,0.2);
}
.banner { top: 30%; font-size: 40px; background: var(--bb-grape); padding: 8px 22px; border-radius: var(--bb-r-lg); border: 4px solid #fff; }
.toast { top: calc(var(--safe-top) + 106px); font-size: 16px; background: rgba(42, 24, 64, 0.72); padding: 6px 14px; border-radius: 999px; }
.peek-hint { position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 108px); transform: translateX(-50%); font-weight: 800; font-size: 13px; color: #fff; background: rgba(42, 24, 64, 0.55); padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.peek-hint:empty { display: none; }
.hud-left { position: absolute; left: 12px; bottom: calc(var(--safe-bottom) + 16px); }
.me-body { width: 56px; height: 70px; background: rgba(255,255,255,0.75); border-radius: var(--bb-r-md); border: 3px solid #fff; padding: 4px; }
.hud-bottom { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 14px); display: flex; justify-content: flex-start; align-items: flex-end; padding-left: 80px; }
.darts { display: flex; gap: 5px; background: rgba(255, 255, 255, 0.8); border: 3px solid #fff; padding: 6px 10px; border-radius: 999px; margin-bottom: 8px; }
.darts .dart { width: 12px; height: 26px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--bb-pink) 0 30%, var(--bb-sun) 30% 100%); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.12); }
.darts .dart.spent { background: rgba(42, 24, 64, 0.15); box-shadow: none; }
.darts.refilling { animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.05); } }
.blaster { position: absolute; right: -12px; bottom: -8px; width: 170px; height: 130px; }
.hud-right { position: absolute; right: 10px; bottom: calc(var(--safe-bottom) + 120px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.zoom { writing-mode: vertical-lr; direction: rtl; width: 28px; height: 120px; accent-color: var(--bb-pink); }
.emote-wheel { position: absolute; right: 70px; bottom: calc(var(--safe-bottom) + 170px); display: grid; grid-template-columns: repeat(2, auto); gap: 8px; }
.emote-wheel button { font-family: var(--bb-display); font-size: 16px; border: 3px solid #fff; border-radius: var(--bb-r-md); background: var(--bb-sky); color: #fff; padding: 8px 12px; box-shadow: 0 4px 0 #1f8bd1; }
.emote-bubble { position: absolute; transform: translate(-50%, -100%); font-family: var(--bb-display); font-size: 16px; background: #fff; color: var(--bb-ink); padding: 4px 10px; border-radius: 12px; border: 3px solid var(--bb-sun); pointer-events: none; white-space: nowrap; animation: bubble 1.8s ease-out forwards; }
@keyframes bubble { from { opacity: 0; margin-top: 10px; } 12% { opacity: 1; margin-top: 0; } 80% { opacity: 1; } to { opacity: 0; margin-top: -12px; } }
.countdown { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; pointer-events: none; font-family: var(--bb-display); font-size: 120px; color: #fff; text-shadow: 0 6px 0 var(--bb-pink-deep), 0 0 30px rgba(255, 95, 162, 0.6); }

/* ── results ───────────────────────────────────────────────────────────── */
.results-teams { display: flex; justify-content: center; gap: 14px; }
.results-teams .score-pill { font-size: 32px; }
.results-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.results-list li { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: var(--bb-r-sm); padding: 8px 10px; font-weight: 800; font-size: 14px; }
.results-list li .dot { width: 14px; height: 14px; border-radius: 50%; }
.results-list li .pts { margin-left: auto; font-family: var(--bb-display); font-size: 18px; color: var(--bb-pink); }
.results-list li.win { outline: 3px solid var(--bb-sun); }

/* ── calibration (Buck Hunter's upright gate, recoloured) ─────────────── */
.calibrate-overlay { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(124, 196, 255, 0.92); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.calibrate-overlay.show { opacity: 1; pointer-events: auto; }
.calibrate-card { text-align: center; padding: 24px; max-width: 320px; }
.calibrate-card h2 { font-family: var(--bb-display); font-weight: 400; color: #fff; font-size: 30px; margin: 14px 0 6px; text-shadow: 0 3px 0 var(--bb-pink-deep); }
.calibrate-card p { font-weight: 700; color: var(--bb-ink); margin: 0 0 16px; }
.calibrate-phone { width: 64px; height: 110px; margin: 0 auto; border-radius: 14px; background: var(--bb-ink); border: 4px solid #fff; transform: rotate(-35deg); transition: transform 0.25s; padding: 8px 6px; }
.calibrate-phone .scr { width: 100%; height: 100%; border-radius: 6px; background: var(--bb-sky); }
.calibrate-phone.upright { transform: rotate(0deg); }
.calibrate-phone.upright .scr { background: var(--bb-lime); }
.calibrate-bar { width: 200px; max-width: 80%; height: 10px; margin: 0 auto; border-radius: 999px; background: rgba(255,255,255,0.6); overflow: hidden; }
.calibrate-bar-fill { height: 100%; width: 0%; background: var(--bb-pink); border-radius: 999px; }

/* ── splash flash (the family-friendly "muzzle flash": star pop, bubbles, comic word) ──────────── */
.splash-flash { position: absolute; left: -26px; top: 42px; width: 76px; height: 76px; pointer-events: none; }
.splash-flash .sf-star { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transform: scale(0.2); }
.splash-flash .sf-bub { position: absolute; left: 30px; top: 30px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; background: rgba(255,255,255,0.55); opacity: 0; }
.splash-flash .sf-bub:nth-child(3) { width: 10px; height: 10px; }
.splash-flash .sf-bub:nth-child(5) { width: 18px; height: 18px; }
.splash-flash .sf-word { position: absolute; left: -40px; top: -30px; font-family: var(--bb-display); font-weight: 400; font-size: 26px; white-space: nowrap; opacity: 0; -webkit-text-stroke: 1.5px #fff; text-shadow: 0 3px 0 rgba(42,24,64,0.35); }
.splash-flash.go .sf-star { animation: sf-star 0.2s ease-out forwards; }
.splash-flash.go .sf-bub { animation: sf-bub 0.45s ease-out forwards; }
.splash-flash.go .sf-word { animation: sf-word 0.32s ease-out forwards; }
@keyframes sf-star { 0% { opacity: 1; transform: scale(0.2) rotate(0deg); } 60% { opacity: 1; transform: scale(1.15) rotate(20deg); } 100% { opacity: 0; transform: scale(1.3) rotate(30deg); } }
@keyframes sf-bub { 0% { opacity: 1; transform: translate(0, 0) scale(0.4); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.1); } }
@keyframes sf-word { 0% { opacity: 1; transform: scale(0.3) rotate(-8deg); } 55% { opacity: 1; transform: scale(1.15) rotate(-8deg); } 100% { opacity: 0; transform: scale(1.25) translateY(-10px) rotate(-8deg); } }
