* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; font-family: 'Nunito', sans-serif; user-select: none; background: #1a0a1e; }
canvas { display: block; }

/* ─── MENU OVERLAY (join + lobby combined) ─── */
#menu-overlay {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  display: flex; flex-direction: column;
}
#menu-overlay.hidden { display: none; }

/* Title */
#game-title-bar { width: 100%; text-align: center; padding-top: 24px; }
#game-title {
  font-family: 'Fredoka One', cursive; font-size: 64px; text-transform: uppercase;
  letter-spacing: 8px; display: inline-block;
  text-shadow: 0 4px 0 #d4456a, 0 8px 0 #b83a5c, 0 12px 20px rgba(0,0,0,0.3), 0 0 40px rgba(255,150,180,0.4);
}
.lt-k{color:#ff6b8a} .lt-o1{color:#ffb347} .lt-n{color:#fff176} .lt-o2{color:#81c784}
.lt-c{color:#64b5f6} .lt-k2{color:#ce93d8} .lt-u{color:#ff8a65} .lt-t{color:#f06292}

/* Lobby strip (top-right) */
#lobby-strip { position: absolute; top: 20px; right: 24px; text-align: right; }
#lobby-slots { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.lobby-slot {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5);
  background: rgba(30,20,40,0.6); display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; font-family: 'Fredoka One', cursive; font-size: 14px; color: #fff;
}
.lobby-slot.joined { border-color: #fff; background: rgba(60,50,80,0.9); }
.lobby-slot.picked { border-color: #66bb6a; background: #2e7d32; box-shadow: 0 0 10px rgba(102,187,106,0.5); }
#lobby-status {
  display: inline-block; font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.7);
  letter-spacing: 1px; background: rgba(0,0,0,0.35); backdrop-filter: blur(8px);
  padding: 5px 14px; border-radius: 8px;
}
#lobby-status span { color: #fff; font-weight: 900; }

/* Left panel (name + character selector) */
#menu-content { flex: 1; display: flex; align-items: center; padding: 0 40px; }
#left-panel { width: 360px; min-width: 300px; pointer-events: all; margin-left: 30px; }
.panel-card {
  background: rgba(255,255,255,0.12); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.2); border-radius: 20px; padding: 30px 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
}
.panel-label { font-size: 12px; font-weight: 800; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 3px; margin-bottom: 8px; }

#player-name-input {
  width: 100%; padding: 12px 18px; font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 700;
  color: #fff; background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px; outline: none; transition: all 0.3s; margin-bottom: 22px;
}
#player-name-input::placeholder { color: rgba(255,255,255,0.3); }
#player-name-input:focus { border-color: rgba(255,180,100,0.6); background: rgba(255,255,255,0.15); }

/* Character carousel */
#char-selector { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.arrow-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08); color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.arrow-btn:hover { background: rgba(255,180,100,0.25); border-color: rgba(255,180,100,0.5); transform: scale(1.1); }
#char-info { text-align: center; flex: 1; padding: 0 10px; }
#char-name { font-family: 'Fredoka One', cursive; font-size: 22px; color: #fff; text-transform: uppercase; letter-spacing: 2px; }
#char-counter { font-size: 11px; color: rgba(255,255,255,0.35); letter-spacing: 2px; margin-top: 2px; }

/* Per-round Play button (shown after room assignment) */
#join-btn {
  width: 100%; padding: 14px; font-family: 'Fredoka One', cursive; font-size: 22px;
  letter-spacing: 3px; text-transform: uppercase; color: #fff;
  background: linear-gradient(135deg, #ff6b8a, #ff8a65, #ffb347); border: none; border-radius: 14px;
  cursor: pointer; transition: all 0.3s; position: relative; overflow: hidden;
  box-shadow: 0 4px 0 #d4456a, 0 6px 20px rgba(255,100,120,0.3);
}
#join-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #d4456a, 0 10px 30px rgba(255,100,120,0.4); }
#join-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #d4456a, 0 4px 10px rgba(255,100,120,0.3); }
#join-btn.in-room {
  background: linear-gradient(135deg, #66bb6a, #43a047);
  box-shadow: 0 4px 0 #2e7d32, 0 6px 20px rgba(76,175,80,0.4);
}
#join-btn.in-room:hover { box-shadow: 0 6px 0 #2e7d32, 0 10px 30px rgba(76,175,80,0.5); }
#join-btn.in-room:active { box-shadow: 0 2px 0 #2e7d32, 0 4px 10px rgba(76,175,80,0.3); }
#join-btn.joined { background: linear-gradient(135deg, #43a047, #2e7d32); box-shadow: 0 4px 0 #1b5e20, 0 6px 20px rgba(76,175,80,0.5); }
#join-btn.disabled { background: linear-gradient(135deg, #666, #555); box-shadow: 0 4px 0 #444; cursor: not-allowed; opacity: 0.6; }

/* Menu buttons (Quick Play / Create / Join) */
.menu-btn {
  width: 100%; padding: 14px; font-family: 'Fredoka One', cursive; font-size: 18px;
  letter-spacing: 2px; text-transform: uppercase; color: #fff;
  border: none; border-radius: 14px; cursor: pointer; transition: all 0.3s;
  position: relative; overflow: hidden;
}
.menu-btn.primary {
  font-size: 22px; letter-spacing: 3px; margin-bottom: 10px;
  background: linear-gradient(135deg, #ff6b8a, #ff8a65, #ffb347);
  box-shadow: 0 4px 0 #d4456a, 0 6px 20px rgba(255,100,120,0.3);
}
.menu-btn.primary::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: btnShine 3s infinite;
}
.menu-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #d4456a, 0 10px 30px rgba(255,100,120,0.4); }
.menu-btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #d4456a, 0 4px 10px rgba(255,100,120,0.3); }
.menu-btn.secondary {
  background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.2);
  margin-bottom: 10px;
}
.menu-btn.secondary:hover { background: rgba(255,180,100,0.2); border-color: rgba(255,180,100,0.4); }
.menu-btn.joined { background: linear-gradient(135deg, #66bb6a, #43a047); box-shadow: 0 4px 0 #2e7d32, 0 6px 20px rgba(76,175,80,0.4); }
.menu-btn.disabled { background: linear-gradient(135deg, #666, #555); box-shadow: 0 4px 0 #444; cursor: not-allowed; opacity: 0.6; }
.menu-btn.disabled::after { display: none; }
@keyframes btnShine { 0%{left:-100%} 50%{left:100%} 100%{left:100%} }

/* Join-with-code row */
#join-code-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: stretch; }
#join-code-input {
  flex: 1 1 auto; min-width: 0;
  padding: 12px 14px; font-family: 'Fredoka One', cursive; font-size: 18px;
  letter-spacing: 4px; text-transform: uppercase; text-align: center; color: #fff;
  background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px; outline: none; transition: all 0.3s;
}
#join-code-input::placeholder { color: rgba(255,255,255,0.3); letter-spacing: 3px; }
#join-code-input:focus { border-color: rgba(255,180,100,0.6); background: rgba(255,255,255,0.15); }
#join-code-row .menu-btn {
  flex: 0 0 auto; width: auto; min-width: 90px;
  padding: 12px 18px; margin-bottom: 0; font-size: 16px;
}

/* Room error inline */
#room-error {
  min-height: 18px; margin-top: 6px; font-size: 13px; font-weight: 700;
  color: #ff6b8a; text-align: center; letter-spacing: 1px;
  opacity: 0; transition: opacity 0.3s;
}
#room-error.visible { opacity: 1; }

/* Room code display (shown after creating a private room) */
#room-code-display {
  display: none; margin-top: 18px; padding: 16px; text-align: center;
  background: rgba(102,187,106,0.15); border: 2px solid rgba(102,187,106,0.4);
  border-radius: 12px;
}
#room-code-display.visible { display: block; }
#room-code-text {
  font-family: 'Fredoka One', cursive; font-size: 38px; color: #fff;
  letter-spacing: 8px; margin: 8px 0 12px;
  text-shadow: 0 2px 10px rgba(102,187,106,0.5);
}
#copy-link-btn {
  padding: 8px 16px; font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 800;
  letter-spacing: 1px; color: #fff; background: rgba(102,187,106,0.4);
  border: 1px solid rgba(102,187,106,0.6); border-radius: 8px; cursor: pointer;
  transition: all 0.2s; text-transform: uppercase;
}
#copy-link-btn:hover { background: rgba(102,187,106,0.6); }
#copy-link-btn.copied { background: #43a047; border-color: #2e7d32; }

/* Taken banner */
#taken-banner {
  position: absolute; right: 50px; bottom: 130px; text-align: right; opacity: 0; transition: opacity 0.3s;
}
#taken-banner.visible { opacity: 1; }
.taken-tag { display: inline-block; padding: 5px 16px; background: rgba(244,67,54,0.8); backdrop-filter: blur(8px); border-radius: 8px; font-family: 'Fredoka One', cursive; font-size: 13px; color: #fff; letter-spacing: 2px; text-transform: uppercase; }

/* Character spotlight label */
#char-spotlight { position: absolute; right: 50px; bottom: 40px; text-align: right; }
#spotlight-name { font-family: 'Fredoka One', cursive; font-size: 36px; color: #fff; text-transform: uppercase; letter-spacing: 3px; text-shadow: 0 3px 15px rgba(0,0,0,0.4); }

/* Lobby timer */
#lobby-timer-bar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.7); background: rgba(0,0,0,0.35); backdrop-filter: blur(8px); padding: 6px 18px; border-radius: 8px; }
#lobby-timer-bar.urgent { background: rgba(255,50,50,0.4); color: #fff; }

/* Keyboard hints */
#kb-hints {
  position: absolute; bottom: 55px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 16px; font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 1px;
}
.kb-key { padding: 2px 8px; border: 1px solid rgba(255,255,255,0.3); border-radius: 5px; font-size: 10px; margin-right: 3px; background: rgba(255,255,255,0.08); }

/* COUNTDOWN */
#countdown-overlay {
  display: none; position: fixed; inset: 0; z-index: 25;
  flex-direction: column; align-items: center; justify-content: center; pointer-events: none;
  background: rgba(0, 0, 0, 0.3);
}
#countdown-text {
  font-family: 'Fredoka One', cursive; font-size: 160px; color: #fff; line-height: 1;
  text-shadow: 0 6px 0 #d4456a, 0 12px 30px rgba(0,0,0,0.4), 0 0 60px rgba(255,150,180,0.5);
  transform: scale(0); opacity: 0;
}
#countdown-text.pop {
  animation: countPop 0.9s ease-out forwards;
}
#countdown-text.go {
  animation: goPop 1.2s ease-out forwards;
  color: #66bb6a;
  text-shadow: 0 6px 0 #2e7d32, 0 12px 30px rgba(0,0,0,0.4), 0 0 80px rgba(102,187,106,0.6);
}
@keyframes countPop {
  0% { transform: scale(2.5); opacity: 0; }
  15% { transform: scale(0.9); opacity: 1; }
  25% { transform: scale(1.05); }
  35% { transform: scale(1); }
  80% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}
@keyframes goPop {
  0% { transform: scale(3); opacity: 0; }
  15% { transform: scale(0.85); opacity: 1; }
  25% { transform: scale(1.1); }
  35% { transform: scale(1); }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* PLAYING HUD (hex-fall) */
#playing-hud { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none; }
#playing-timer { text-align: center; padding: 12px; font-size: 32px; font-weight: bold; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
#playing-players { position: fixed; top: 12px; left: 12px; font-size: 14px; color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.7); }

/* RACE HUD (obstacle-course) */
#race-hud { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none; }
#race-title { text-align: center; padding: 8px; font-size: 20px; font-weight: bold; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
#race-timer { text-align: center; font-size: 28px; font-weight: bold; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
#race-progress-bar {
  display: none; position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 300px; background: rgba(0,0,0,0.3); border-radius: 10px; pointer-events: none;
}
#race-progress-fill { position: absolute; bottom: 0; width: 100%; background: #4caf50; border-radius: 10px; height: 0; transition: height 0.15s; }

/* ELIMINATED — styled to match the click-to-play card aesthetic */
#eliminated-overlay {
  display: none; position: fixed; inset: 0; z-index: 95;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(40, 8, 14, 0.45) 0%, rgba(8, 4, 10, 0.78) 80%);
  pointer-events: auto;
}
#eliminated-overlay .elim-card {
  text-align: center;
  padding: 36px 56px 32px;
  background: rgba(20, 8, 14, 0.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(230, 57, 70, 0.55);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0,0,0,0.55), 0 0 70px rgba(230, 57, 70, 0.28);
}
#eliminated-text {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(36px, 5vw, 60px);
  letter-spacing: 0.14em;
  color: #ff5d6e;
  text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 32px rgba(230, 57, 70, 0.55);
  line-height: 1;
  margin-bottom: 14px;
}
#eliminated-sub {
  font-family: 'Fredoka One', 'Bungee', sans-serif;
  font-size: 14px; letter-spacing: 0.08em;
  color: rgba(255, 246, 234, 0.78);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  margin-bottom: 22px;
}
#eliminated-exit-btn {
  font-family: 'Bungee', sans-serif;
  padding: 12px 30px; font-size: 14px; letter-spacing: 0.14em;
  color: #fff;
  background: rgba(230, 57, 70, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  cursor: pointer; transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 24px rgba(230, 57, 70, 0.35);
}
#eliminated-exit-btn:hover { background: rgba(230, 57, 70, 1); box-shadow: 0 8px 26px rgba(0,0,0,0.55), 0 0 32px rgba(230, 57, 70, 0.5); }
#eliminated-exit-btn:active { transform: translateY(1px); }

/* When eliminated, suppress the click-to-play overlay if a stale listener
   tries to reshow it. The eliminated card sits above and owns the screen. */
#eliminated-overlay[style*="flex"] ~ #balloon-clicktoplay,
body:has(#eliminated-overlay[style*="flex"]) #balloon-clicktoplay {
  display: none !important;
}

/* GAME OVER — celebratory winner card matching the click-to-play / eliminated style */
#gameover-overlay {
  display: none; position: fixed; inset: 0; z-index: 95;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(50, 38, 8, 0.45) 0%, rgba(8, 6, 4, 0.78) 80%);
  pointer-events: auto;
}
#gameover-overlay .gameover-card {
  text-align: center;
  padding: 36px 64px 32px;
  background: rgba(20, 16, 8, 0.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 214, 0, 0.55);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0,0,0,0.55), 0 0 80px rgba(255, 214, 0, 0.32);
}
#gameover-trophy {
  font-size: 56px; line-height: 1;
  color: #ffd600;
  text-shadow: 0 0 28px rgba(255, 214, 0, 0.7), 0 0 48px rgba(255, 214, 0, 0.45);
  margin-bottom: 10px;
  animation: gameoverTrophy 2.4s ease-in-out infinite;
}
#gameover-text {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(36px, 5.4vw, 64px);
  letter-spacing: 0.12em;
  color: #ffd600;
  text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 32px rgba(255, 214, 0, 0.55);
  line-height: 1;
  margin-bottom: 14px;
}
#gameover-sub {
  font-family: 'Fredoka One', 'Bungee', sans-serif;
  font-size: 14px; letter-spacing: 0.08em;
  color: rgba(255, 246, 234, 0.82);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  margin-bottom: 24px;
}
#gameover-exit-btn {
  font-family: 'Bungee', sans-serif;
  padding: 12px 30px; font-size: 14px; letter-spacing: 0.14em;
  color: #1a0e02;
  background: rgba(255, 214, 0, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  cursor: pointer; transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5), 0 0 28px rgba(255, 214, 0, 0.4);
}
#gameover-exit-btn:hover { background: rgba(255, 224, 60, 1); box-shadow: 0 8px 28px rgba(0,0,0,0.55), 0 0 36px rgba(255, 214, 0, 0.55); }
#gameover-exit-btn:active { transform: translateY(1px); }
@keyframes gameoverTrophy {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.05); }
}

/* Crosshair for pointer lock */
#crosshair {
  display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 4px; height: 4px; background: rgba(255,255,255,0.5); border-radius: 50%; z-index: 8; pointer-events: none;
}

/* ======================================================================
   LOBBY GLOBE OVERLAY — waiting-for-players view (shown after Play! click)
   Vanilla port of reference/game 2/project/globe.jsx + scene.jsx Sky
   ====================================================================== */
#lobby-globe-overlay {
  position: fixed; inset: 0; z-index: 22;
  overflow: hidden;
  font-family: 'Manrope', 'Nunito', system-ui, sans-serif;
  color: #fff6ea;
  /* Banner, stage and timer are absolutely positioned. The sphere height
     is computed from viewport height minus banner/timer reserved space so
     they never overlap, regardless of window size. */
}

/* Sky backdrop (gradient + cloud bands + sun glow + a few floating sparks) */
#lobby-globe-overlay .lg-sky {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(ellipse 140% 70% at 50% -20%, #ffe5c7 0%, transparent 60%),
    linear-gradient(180deg, #ffd0b3 0%, #ffb1a6 35%, #e39ab8 62%, #a282b8 88%, #6b5b8a 100%);
}

/* 14 glowing sparks drifting along varied 2D paths across the sky */
#lobby-globe-overlay .lg-spark {
  position: absolute; border-radius: 50%;
  background: rgba(255, 245, 230, 0.78);
  box-shadow: 0 0 14px rgba(255, 240, 220, 0.85), 0 0 28px rgba(255, 235, 205, 0.45);
  pointer-events: none;
  will-change: transform, opacity;
}
/* Four drift paths — assigned in rotation across the 14 sparks for variety */
@keyframes lgDriftA {
  0%   { transform: translate(0, 0)        scale(1);    opacity: 0.55; }
  25%  { transform: translate(40px, -22px) scale(1.15); opacity: 0.95; }
  50%  { transform: translate(72px, 8px)   scale(1);    opacity: 0.8;  }
  75%  { transform: translate(28px, 30px)  scale(0.9);  opacity: 0.6;  }
  100% { transform: translate(0, 0)        scale(1);    opacity: 0.55; }
}
@keyframes lgDriftB {
  0%   { transform: translate(0, 0)         scale(1);    opacity: 0.7;  }
  30%  { transform: translate(-36px, -28px) scale(1.2);  opacity: 1;    }
  60%  { transform: translate(-58px, 18px)  scale(0.95); opacity: 0.65; }
  100% { transform: translate(0, 0)         scale(1);    opacity: 0.7;  }
}
@keyframes lgDriftC {
  0%   { transform: translate(0, 0)        scale(0.95); opacity: 0.5;  }
  35%  { transform: translate(28px, 36px)  scale(1.1);  opacity: 0.9;  }
  70%  { transform: translate(-18px, 52px) scale(1);    opacity: 0.75; }
  100% { transform: translate(0, 0)        scale(0.95); opacity: 0.5;  }
}
@keyframes lgDriftD {
  0%   { transform: translate(0, 0)         scale(1);    opacity: 0.6;  }
  40%  { transform: translate(-44px, -38px) scale(1.18); opacity: 1;    }
  80%  { transform: translate(20px, -22px)  scale(1);    opacity: 0.7;  }
  100% { transform: translate(0, 0)         scale(1);    opacity: 0.6;  }
}
/* Per-spark position, size, animation, duration, delay */
#lobby-globe-overlay .lg-spark.s1  { left: 8%;  top: 18%; width: 6px; height: 6px; animation: lgDriftA 14s ease-in-out -1s infinite; }
#lobby-globe-overlay .lg-spark.s2  { left: 22%; top: 64%; width: 8px; height: 8px; animation: lgDriftB 17s ease-in-out -6s infinite; }
#lobby-globe-overlay .lg-spark.s3  { left: 34%; top: 12%; width: 5px; height: 5px; animation: lgDriftC 12s ease-in-out -3s infinite; }
#lobby-globe-overlay .lg-spark.s4  { left: 46%; top: 80%; width: 7px; height: 7px; animation: lgDriftD 19s ease-in-out -8s infinite; }
#lobby-globe-overlay .lg-spark.s5  { left: 60%; top: 24%; width: 5px; height: 5px; animation: lgDriftA 13s ease-in-out -4s infinite; }
#lobby-globe-overlay .lg-spark.s6  { left: 76%; top: 60%; width: 9px; height: 9px; animation: lgDriftB 16s ease-in-out -2s infinite; }
#lobby-globe-overlay .lg-spark.s7  { left: 88%; top: 30%; width: 6px; height: 6px; animation: lgDriftC 18s ease-in-out -10s infinite; }
#lobby-globe-overlay .lg-spark.s8  { left: 14%; top: 86%; width: 5px; height: 5px; animation: lgDriftD 15s ease-in-out -5s infinite; }
#lobby-globe-overlay .lg-spark.s9  { left: 52%; top: 8%;  width: 4px; height: 4px; animation: lgDriftA 11s ease-in-out -7s infinite; }
#lobby-globe-overlay .lg-spark.s10 { left: 92%; top: 76%; width: 6px; height: 6px; animation: lgDriftB 20s ease-in-out -3s infinite; }
#lobby-globe-overlay .lg-spark.s11 { left: 4%;  top: 48%; width: 7px; height: 7px; animation: lgDriftC 14s ease-in-out -9s infinite; }
#lobby-globe-overlay .lg-spark.s12 { left: 30%; top: 38%; width: 4px; height: 4px; animation: lgDriftD 16s ease-in-out -12s infinite; }
#lobby-globe-overlay .lg-spark.s13 { left: 68%; top: 88%; width: 8px; height: 8px; animation: lgDriftA 18s ease-in-out -2s infinite; }
#lobby-globe-overlay .lg-spark.s14 { left: 80%; top: 14%; width: 5px; height: 5px; animation: lgDriftB 13s ease-in-out -6s infinite; }
#lobby-globe-overlay .lg-sky::before {
  content: ''; position: absolute; left: -40px; right: -40px; top: 44%; height: 22%;
  background:
    radial-gradient(ellipse 60% 80% at 20% 50%, rgba(255,220,210,.9), transparent 70%),
    radial-gradient(ellipse 50% 70% at 55% 40%, rgba(255,200,220,.8), transparent 70%),
    radial-gradient(ellipse 60% 80% at 85% 60%, rgba(255,210,200,.85), transparent 70%);
  filter: blur(1px);
}
#lobby-globe-overlay .lg-sky::after {
  content: ''; position: absolute; left: -60px; right: -60px; bottom: -20px; height: 42%;
  background:
    radial-gradient(ellipse 60% 80% at 15% 30%, #f4b8b9 0%, transparent 65%),
    radial-gradient(ellipse 55% 70% at 40% 60%, #e8a6b8 0%, transparent 65%),
    radial-gradient(ellipse 65% 75% at 70% 35%, #f0b0b4 0%, transparent 65%),
    radial-gradient(ellipse 55% 80% at 92% 55%, #d998ac 0%, transparent 65%),
    linear-gradient(180deg, transparent 0%, #b68aaa 90%);
  filter: blur(2px);
}

/* "WAITING FOR PLAYERS..." banner at top — dark contrast plate behind text */
#lobby-globe-overlay .lg-banner {
  position: absolute; top: 24px; left: 0; right: 0;
  z-index: 15; text-align: center; pointer-events: none;
}
#lobby-globe-overlay .lg-banner-plate {
  display: inline-block;
  padding: 12px 26px 10px;
  border-radius: 18px;
  background: rgba(40, 30, 60, 0.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 26px rgba(0,0,0,0.30);
}
#lobby-globe-overlay .lg-title {
  font-family: 'Bungee', 'Fredoka One', sans-serif;
  font-size: clamp(16px, 1.9vw, 26px);
  color: #fff6ea;
  text-shadow: 0 3px 0 rgba(0,0,0,.22), 0 8px 18px rgba(0,0,0,.28);
  letter-spacing: .04em;
  white-space: nowrap;
  transition: color .3s ease;
}
#lobby-globe-overlay .lg-title.bots-joining {
  color: #6ce49a;
  text-shadow: 0 3px 0 rgba(0,0,0,.22), 0 0 18px rgba(108,228,154,.55);
}
/* Three always-rendered boxy dots that fade in sequence (plate width never changes) */
#lobby-globe-overlay .lg-dots-group {
  display: inline-flex; gap: 7px; margin-left: 14px;
  vertical-align: middle; transform: translateY(2px);
}
#lobby-globe-overlay .lg-dot {
  display: inline-block; width: 0.45em; height: 0.45em;
  background: #fff6ea;
  opacity: 0.22;
  animation: lgDotFade 1.5s ease-in-out infinite;
}
#lobby-globe-overlay .lg-dot:nth-child(1) { animation-delay: 0s; }
#lobby-globe-overlay .lg-dot:nth-child(2) { animation-delay: 0.25s; }
#lobby-globe-overlay .lg-dot:nth-child(3) { animation-delay: 0.5s; }
@keyframes lgDotFade {
  0%, 80%, 100% { opacity: 0.22; }
  20%, 50%      { opacity: 1; }
}
#lobby-globe-overlay .lg-sub {
  margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: #ffd23f;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
/* Countdown pill — absolutely positioned at bottom-center */
#lobby-globe-overlay .lg-timer-pill {
  position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 16; pointer-events: none; text-align: center;
  padding: 10px 28px 12px; border-radius: 22px;
  background: rgba(20,10,40,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  width: max-content; max-width: 90vw;
}
#lobby-globe-overlay .lg-timer-label {
  font-size: 11px; font-weight: 800; letter-spacing: .25em;
  color: rgba(255,246,234,.7); text-transform: uppercase;
}
#lobby-globe-overlay .lg-timer {
  margin-top: 2px; font-family: 'Bungee', sans-serif;
  font-size: clamp(28px, 3.4vw, 46px); color: #ffd23f;
  text-shadow: 0 4px 0 rgba(0,0,0,.28), 0 8px 22px rgba(255,210,63,.3);
  letter-spacing: .05em; line-height: 1;
}
#lobby-globe-overlay .lg-timer.urgent { color: #ff5c8a; text-shadow: 0 4px 0 rgba(0,0,0,.28), 0 8px 22px rgba(255,92,138,.45); }
#lobby-globe-overlay .lg-timer-pill.urgent { border-color: rgba(255,92,138,.55); background: rgba(60,10,30,.65); }

/* Globe stage (sphere + halo) — fills the central area between banner
   and timer pill (each absolutely positioned). */
#lobby-globe-overlay .lg-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  perspective: 1400px;
}
#lobby-globe-overlay .lg-halo {
  position: absolute; top: 50%; left: 50%;
  width: min(720px, 80vmin, 130%);
  height: min(720px, 80vmin, 130%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(70,214,224,0) 38%, rgba(157,123,255,.35) 50%, rgba(255,92,138,.25) 58%, transparent 72%);
  filter: blur(6px); pointer-events: none;
  transform: translate(-50%, -50%);
  animation: lgHaloPulse 5s ease-in-out infinite;
}
@keyframes lgHaloPulse {
  0%, 100% { opacity: .85; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.03); }
}

/* The sphere (560px = 2R where R=280 in the prototype). Cap so it always
   leaves visible space above (banner ≈ 110px + 24px gap) and below
   (timer ≈ 90px + 32px gap) — total ~256px reserved. */
#lobby-globe-overlay .lg-sphere {
  --lg-reserved: 240px;
  position: relative;
  width: min(560px, 62vmin, 92vw, calc(100vh - var(--lg-reserved)));
  height: min(560px, 62vmin, 92vw, calc(100vh - var(--lg-reserved)));
  aspect-ratio: 1 / 1;
  transform-style: preserve-3d;
}
#lobby-globe-overlay .lg-shell {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,.28) 0%, rgba(255,255,255,0) 22%),
    radial-gradient(circle at 35% 40%, #46d6e0 0%, #3a9ed0 30%, #2a6aa8 65%, #1a3c70 100%);
  box-shadow:
    inset -30px -40px 90px rgba(10,20,50,.75),
    inset 20px 20px 60px rgba(160,230,255,.3),
    0 40px 80px rgba(0,0,0,.55),
    0 0 120px rgba(70,214,224,.5),
    0 0 220px rgba(157,123,255,.25);
}
#lobby-globe-overlay .lg-dots-layer,
#lobby-globe-overlay .lg-equator-layer,
#lobby-globe-overlay .lg-pins-layer {
  position: absolute; inset: 0; pointer-events: none;
}
#lobby-globe-overlay .lg-continents {
  position: absolute; left: 50%; top: 50%;
  overflow: visible; pointer-events: none;
  /* Pixel width/height and negative margins are set from JS (paintContinents)
     to match the sphere's current R. No CSS transform here — the JS-computed
     margins perform the centering. */
}
#lobby-globe-overlay .lg-ocean-dot {
  position: absolute; left: 50%; top: 50%;
  width: 1.6px; height: 1.6px; border-radius: 50%;
  background: rgba(255,255,255,.9);
  pointer-events: none;
}
#lobby-globe-overlay .lg-eq-dot {
  position: absolute; left: 50%; top: 50%;
  width: 1.6px; height: 1.6px; border-radius: 50%;
  background: rgba(255,210,63,.45);
  pointer-events: none;
}

/* Slot markers */
#lobby-globe-overlay .lg-slot {
  position: absolute; left: 50%; top: 50%;
  pointer-events: none; transform-origin: center;
}
#lobby-globe-overlay .lg-ring {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%; border-style: dashed;
  animation: lgRingSpin 6s linear infinite;
}
/* Centering is done via JS-set marginLeft/Top — keyframe must NOT also translate */
@keyframes lgRingSpin { to { transform: rotate(360deg); } }
#lobby-globe-overlay .lg-empty-dot {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%; background: #fff6ea;
  box-shadow: 0 0 10px #fff6ea;
  animation: lgPinPulse 1.6s ease-in-out infinite;
}
@keyframes lgPinPulse { 0%,100%{ transform: scale(1); opacity:.6 } 50%{ transform: scale(1.6); opacity:1 } }

/* Filled player pin */
#lobby-globe-overlay .lg-pin {
  position: absolute; left: 50%; top: 50%;
  animation: lgPinDrop 700ms cubic-bezier(.2,1.4,.3,1) both;
}
@keyframes lgPinDrop {
  0%   { transform: translate(-50%,-50%) translateY(-120px) scale(.3); opacity: 0; }
  55%  { transform: translate(-50%,-50%) translateY(8px) scale(1.1);  opacity: 1; }
  75%  { transform: translate(-50%,-50%) translateY(-3px) scale(.96); }
  100% { transform: translate(-50%,-50%) translateY(0) scale(1); opacity: 1; }
}
#lobby-globe-overlay .lg-pin-beam {
  position: absolute; left: 50%; bottom: 100%;
  transform-origin: bottom; filter: blur(1px);
  animation: lgBeamDown 700ms ease-out both;
}
@keyframes lgBeamDown {
  0%   { opacity: 0; transform: translateX(-50%) scaleY(0); }
  30%  { opacity: 1; transform: translateX(-50%) scaleY(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
#lobby-globe-overlay .lg-pin-glow {
  position: absolute; border-radius: 50%;
  filter: blur(3px); pointer-events: none;
}
#lobby-globe-overlay .lg-pin-ring {
  position: relative; border-radius: 50%;
}
#lobby-globe-overlay .lg-pin-portrait {
  width: 100%; height: 100%; border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #ffd7c2, #b68aaa);
}
#lobby-globe-overlay .lg-pin-portrait img {
  width: 140%; height: 140%;
  object-fit: cover; object-position: 50% 18%;
  margin-left: -20%; margin-top: -10%;
  display: block;
}
#lobby-globe-overlay .lg-pin-label {
  position: absolute; left: 50%; top: 100%;
  transform: translate(-50%, 6px);
  border-radius: 999px;
  background: rgba(20,10,40,.85); backdrop-filter: blur(6px);
  font-weight: 700; color: #fff6ea; letter-spacing: .03em;
  white-space: nowrap;
}

/* ======================================================================
   LOBBY GLOBE — SIDE PANELS (Controls right, How to Win left)
   ====================================================================== */
#lobby-globe-overlay .lg-side {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 16; pointer-events: none;
  display: flex; flex-direction: column; gap: 18px;
  width: 300px; max-width: 28vw;
}
#lobby-globe-overlay .lg-side-left  { left: 24px; }
#lobby-globe-overlay .lg-side-right { right: 24px; }
#lobby-globe-overlay .lg-card {
  position: relative;
  padding: 18px 20px 20px;
  border-radius: 18px;
  background: rgba(40, 30, 60, 0.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 12px 32px rgba(0,0,0,0.32);
  color: #fff6ea;
}
#lobby-globe-overlay .lg-card-title {
  font-family: 'Bungee', 'Fredoka One', sans-serif;
  font-size: 18px; letter-spacing: .04em; line-height: 1;
  margin: 0 0 10px;
}
#lobby-globe-overlay .lg-card-title--cyan { color: #46d6e0; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
#lobby-globe-overlay .lg-card-title--pink { color: #ff5c8a; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
#lobby-globe-overlay .lg-card-rule { height: 2px; border-radius: 2px; margin-bottom: 14px; }
#lobby-globe-overlay .lg-card-rule--cyan { background: linear-gradient(90deg, #46d6e0, rgba(70,214,224,0)); }
#lobby-globe-overlay .lg-card-rule--pink { background: linear-gradient(90deg, #ff5c8a, rgba(255,92,138,0)); }

/* Controls rows */
#lobby-globe-overlay .lg-ctl-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#lobby-globe-overlay .lg-ctl-row:last-child { border-bottom: none; }
#lobby-globe-overlay .lg-ctl-label {
  font-family: 'Bungee', 'Fredoka One', sans-serif;
  font-size: 14px; letter-spacing: .08em; color: #fff6ea;
  text-shadow: 0 2px 0 rgba(0,0,0,.2);
}
#lobby-globe-overlay .lg-ctl-sub {
  font-size: 11px; color: rgba(255,246,234,0.55);
  letter-spacing: .03em; margin-top: 2px;
}

/* Key caps */
#lobby-globe-overlay .lg-key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff6ea, #e7dcc8);
  color: #1a1230;
  font-family: 'Bungee', 'Fredoka One', sans-serif;
  font-size: 13px; letter-spacing: .04em;
  box-shadow:
    0 2px 0 rgba(20,10,40,0.35),
    0 4px 8px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.55);
}
#lobby-globe-overlay .lg-key--wide { min-width: 78px; padding: 0 14px; }
#lobby-globe-overlay .lg-keypad {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
#lobby-globe-overlay .lg-keypad-row { display: flex; gap: 4px; }

/* Mouse icon */
#lobby-globe-overlay .lg-mouse-icon {
  width: 32px; height: 44px; flex-shrink: 0;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.25));
}

/* How to Win list */
#lobby-globe-overlay .lg-howto-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 12px;
}
#lobby-globe-overlay .lg-howto-list li {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 13px; line-height: 1.4; color: #fff6ea;
}
#lobby-globe-overlay .lg-num {
  flex: 0 0 24px;
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #ff7aa3, #ff5c8a);
  color: #fff6ea;
  font-family: 'Bungee', 'Fredoka One', sans-serif;
  font-size: 12px; line-height: 1;
  box-shadow: 0 3px 8px rgba(255,92,138,0.35), inset 0 1px 0 rgba(255,255,255,0.3);
}
#lobby-globe-overlay .lg-disclaimer {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.10);
  font-size: 11px; font-style: italic; color: rgba(255,246,234,0.55);
}

/* Hide on screens too narrow to fit panel + globe comfortably */
@media (max-width: 1100px) {
  #lobby-globe-overlay .lg-side { display: none; }
}


/* ─── Hex Fall HUD (single eliminated counter, top-left) ─── */
#hex-hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: 'Bungee', 'Fredoka One', cursive;
}
#hex-hud .hex-card {
  position: absolute; top: 14px; right: 18px;
  background: rgba(15, 10, 22, 0.92);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  color: #fff;
  padding: 10px 18px;
  font-size: 16px;
  letter-spacing: 1.8px;
}
#hex-hud .hex-card span { color: #ff5577; }

/* ─── Glass Bridge HUD (left-stacked cards: alive, time, event feed) ─── */
#glass-bridge-hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: 'Bungee', 'Fredoka One', cursive;
}
#glass-bridge-hud .gb-stack {
  position: absolute; top: 14px; right: 18px;
  display: flex; flex-direction: column; gap: 7px;
  width: 165px;
}
#glass-bridge-hud .gb-card {
  background: rgba(15, 10, 22, 0.92); /* solid-ish — no backdrop-filter so GPU stays free */
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  color: #fff;
}
#glass-bridge-hud #gb-alive-card {
  padding: 8px 14px;
  font-size: 14px;
  letter-spacing: 1.5px;
  text-align: center;
}
#glass-bridge-hud #gb-alive-card span { color: #ff5577; }
#glass-bridge-hud #gb-timer-card {
  padding: 7px 12px;
  display: flex; align-items: center; gap: 9px;
}
#glass-bridge-hud #gb-timer-card .gb-stopwatch {
  flex-shrink: 0; color: #fff;
  width: 20px; height: 20px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}
#glass-bridge-hud #gb-timer-card .gb-timer-right {
  display: flex; flex-direction: column; line-height: 1;
}
#glass-bridge-hud #gb-timer-card .gb-timer-num {
  font-size: 20px; color: #ffd23f;
  text-shadow: 0 2px 0 rgba(0,0,0,0.45);
  letter-spacing: 1px;
}
#glass-bridge-hud #gb-timer-card .gb-timer-label {
  font-size: 8px; color: rgba(255,255,255,0.78);
  letter-spacing: 2px;
  margin-top: 3px;
}
#glass-bridge-hud #gb-timer-card.gb-timer-low .gb-timer-num { color: #ff5577; }


/* ─── Hot Air Balloon Fight HUD ─── */
#balloon-hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: 'Nunito', 'Manrope', sans-serif;
  cursor: crosshair;
}
#balloon-hud #balloon-damage-flash {
  position: absolute; inset: 0;
  pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,0,0.6) 100%);
  z-index: 2;
}
#balloon-hud #balloon-damage-flash.flash { animation: balloonDamageFlash 0.5s ease-out forwards; }
@keyframes balloonDamageFlash { 0% { opacity: 0.9; } 100% { opacity: 0; } }

#balloon-hud #balloon-wind-indicator {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.42); backdrop-filter: blur(8px);
  padding: 9px 22px; border-radius: 12px; text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
}
#balloon-hud .balloon-wind-title {
  font-size: 11px; color: rgba(255,255,255,0.55);
  letter-spacing: 2px; text-transform: uppercase;
}
#balloon-hud #balloon-wind-arrow {
  font-size: 28px; color: #fff; display: block; margin-top: 2px;
  transition: transform 0.8s ease;
}
#balloon-hud #balloon-wind-label {
  font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 2px;
}

#balloon-hud #balloon-alive-counter {
  position: absolute; top: 16px; right: 24px;
  background: rgba(0,0,0,0.42); backdrop-filter: blur(8px);
  padding: 10px 20px; border-radius: 12px;
  font-family: 'Bungee', 'Fredoka One', cursive;
  color: #fff; font-size: 16px; letter-spacing: 2px;
  border: 1px solid rgba(255,255,255,0.08);
}
#balloon-hud #balloon-alive-counter span { color: #ff6b8a; }

#balloon-hud #balloon-hp-bar {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: 240px;
}
#balloon-hud #balloon-hp-label {
  font-family: 'Bungee', 'Fredoka One', cursive;
  font-size: 13px; color: #fff; letter-spacing: 2px;
  margin-bottom: 4px; text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
#balloon-hud #balloon-hp-track {
  width: 100%; height: 14px; background: rgba(0,0,0,0.55);
  border-radius: 7px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
}
#balloon-hud #balloon-hp-fill {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, #66bb6a, #43a047);
  border-radius: 7px; transition: width 0.25s ease;
}
#balloon-hud #balloon-hp-fill.hurt {
  background: linear-gradient(90deg, #ff6b6b, #ee5a24);
}

/* Controls hint — bottom-right key-chip legend so it reads as game UI,
   not raw text. Out of the centre view. */
#balloon-hud #balloon-controls-hint {
  position: absolute; right: 22px; bottom: 56px;
  display: flex; flex-direction: column; gap: 5px;
  pointer-events: none;
  background: rgba(20, 10, 30, 0.42);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 210, 63, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Bungee', sans-serif;
}
#balloon-hud #balloon-controls-hint .ctrl-row {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}
#balloon-hud #balloon-controls-hint .ctrl-keys {
  display: inline-flex; gap: 3px;
}
#balloon-hud #balloon-controls-hint .key {
  display: inline-block;
  min-width: 22px;
  padding: 3px 7px 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(220,210,190,0.9) 100%);
  border: 1px solid rgba(0,0,0,0.25);
  border-bottom: 2px solid rgba(0,0,0,0.4);
  border-radius: 4px;
  color: #1a0a1e;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
}
/* Mouse glyph replaces the LMB keycap — styled like the loading-screen mouse */
#balloon-hud #balloon-controls-hint .key-mouse {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  min-width: 0;
  display: inline-flex; align-items: center; justify-content: center;
  text-shadow: none;
}
#balloon-hud #balloon-controls-hint .key-mouse svg {
  display: block;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.45));
}
#balloon-hud #balloon-controls-hint .lbl {
  font-family: 'Fredoka One', 'Bungee', sans-serif;
  font-size: 11px; letter-spacing: 0.06em;
  color: rgba(255, 246, 234, 0.85);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  min-width: 60px;
  text-align: left;
}

#balloon-hud #balloon-kill-feed {
  position: absolute; top: 70px; right: 24px;
  text-align: right; max-width: 320px;
}
#balloon-hud #balloon-kill-feed .kill-msg {
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.85);
  margin-bottom: 4px; opacity: 1; transition: opacity 0.5s ease;
  background: rgba(0,0,0,0.32); padding: 4px 12px; border-radius: 8px;
  display: inline-block;
}
#balloon-hud #balloon-kill-feed .kill-msg .killer { color: #ff6b8a; }
#balloon-hud #balloon-kill-feed .kill-msg .victim { color: #ffb347; }

#balloon-hud #balloon-hit-marker {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 48px; color: #fff; font-weight: 900;
  opacity: 0; pointer-events: none;
  text-shadow: 0 0 15px rgba(255,50,50,0.85);
}
#balloon-hud #balloon-hit-marker.show { animation: balloonHitPop 0.5s ease-out forwards; }
@keyframes balloonHitPop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(2); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1) translateY(-30px); }
}

#balloon-hud #balloon-crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px;
}
#balloon-hud #balloon-crosshair::before,
#balloon-hud #balloon-crosshair::after {
  content: ''; position: absolute;
  background: rgba(255,255,255,0.7); border-radius: 2px;
}
#balloon-hud #balloon-crosshair::before { width: 2px; height: 40px; left: 19px; top: 0; }
#balloon-hud #balloon-crosshair::after  { width: 40px; height: 2px; top: 19px; left: 0; }
#balloon-hud .balloon-crosshair-dot {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.9); top: 17px; left: 17px;
}

/* Cooldown dim — applied to global #crosshair too if it ever shows during balloon round */
#crosshair.cooldown,
#balloon-hud #balloon-crosshair.cooldown { opacity: 0.35; transition: opacity 0.1s ease; }

/* Ammo card — bottom-LEFT corner, opposite the controls hint. Big readable
   number is the primary feedback; the icon strip below echoes the count. */
#balloon-hud #balloon-ammo {
  position: absolute; left: 22px; bottom: 56px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  font-family: 'Bungee', sans-serif; pointer-events: none;
  z-index: 30;
  background: rgba(20, 10, 30, 0.42);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 210, 63, 0.22);
  border-radius: 10px;
  padding: 8px 14px 10px;
  min-width: 110px;
}
#balloon-hud #balloon-ammo .ammo-label {
  font-size: 10px; letter-spacing: 0.22em;
  color: rgba(255, 246, 234, 0.7);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
#balloon-hud #balloon-ammo .ammo-count {
  display: flex; align-items: baseline; gap: 3px;
  color: #ffd23f;
  text-shadow: 0 2px 0 rgba(0,0,0,0.55), 0 0 18px rgba(255, 180, 60, 0.5);
  line-height: 1;
}
#balloon-hud #balloon-ammo #ammo-current {
  font-size: 28px; min-width: 1ch; text-align: left;
}
#balloon-hud #balloon-ammo .ammo-sep,
#balloon-hud #balloon-ammo #ammo-max {
  font-size: 14px; opacity: 0.65;
}
#balloon-hud #balloon-ammo.low #ammo-current {
  color: #ff7755;
  text-shadow: 0 2px 0 rgba(0,0,0,0.55), 0 0 18px rgba(255, 100, 70, 0.6);
}
#balloon-hud #balloon-ammo.low {
  border-color: rgba(255, 120, 80, 0.5);
}
#balloon-hud #balloon-ammo-icons {
  display: flex; gap: 3px;
  margin-top: 2px;
}
#balloon-hud .balloon-arrow-icon {
  width: 5px; height: 14px; border-radius: 1.5px;
  background: linear-gradient(180deg, #fff6ea 0%, #ffd23f 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.45);
  transition: opacity 0.15s ease;
}
#balloon-hud .balloon-arrow-icon.empty {
  background: rgba(255,255,255,0.12);
  box-shadow: none;
}
/* Old corner reload bar is replaced by the ring around the crosshair. Keep it
   in the DOM so socket.js's existing addClass('active') call doesn't error,
   but hide it visually. */
#balloon-hud #balloon-reload-bar { display: none !important; }

/* Circular reload progress around the crosshair — primary reload feedback */
#balloon-hud #balloon-reload-ring {
  position: absolute; top: 50%; left: 50%;
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  filter: drop-shadow(0 0 8px rgba(255, 210, 63, 0.55));
}
#balloon-hud #balloon-reload-ring.active { opacity: 1; }
#balloon-hud #balloon-reload-ring svg { width: 100%; height: 100%; display: block; }
#balloon-hud #balloon-reload-ring-fill {
  transition: stroke-dashoffset 80ms linear;
}

/* Balloon loading screen — pre-round briefing.
   Layout: vertical column.
     ┌──────────────────────────────┐
     │   ROUND 1                    │  header (slides down)
     │   HOT AIR BALLOON FIGHT      │
     │                              │
     │   [briefing image]           │  centered, fades + scales in
     │                              │
     │   GET READY...               │  footer (pulses)
     └──────────────────────────────┘ */
#balloon-loading-screen {
  position: fixed; inset: 0;
  z-index: 100;
  background:
    radial-gradient(ellipse at center, rgba(40,15,55,0.94) 0%, rgba(10,4,16,0.99) 75%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 2.2vh 0 2.5vh;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#balloon-loading-screen.show { opacity: 1; }

/* === ROUND TITLE (compact, since the image already has the round name) === */
#balloon-loading-screen .balloon-loading-round {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(22px, 3vw, 42px);
  letter-spacing: 0.1em;
  color: #ffd23f;
  text-shadow:
    0 3px 0 rgba(0,0,0,0.55),
    0 6px 20px rgba(255, 180, 60, 0.35),
    0 0 40px rgba(255, 210, 63, 0.3);
  line-height: 1;
  text-align: center;
  transform: translateY(-20px);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(.34,1.4,.64,1) 0.05s, opacity 0.45s ease 0.05s;
}
#balloon-loading-screen.show .balloon-loading-round {
  transform: translateY(0);
  opacity: 1;
}

/* === IMAGE (now larger — fills most of the screen) === */
#balloon-loading-screen .balloon-loading-img {
  display: block;
  max-width: min(94vw, 1700px);
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 14px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.7),
    0 0 120px rgba(255, 180, 60, 0.18);
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.65s cubic-bezier(.34,1.4,.64,1) 0.15s, opacity 0.55s ease 0.15s;
}
#balloon-loading-screen.show .balloon-loading-img {
  transform: scale(1);
  opacity: 1;
}

/* === FOOTER (GET READY...) — true horizontal centering === */
#balloon-loading-screen .balloon-loading-footer {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(18px, 2vw, 28px);
  letter-spacing: 0.4em;
  color: #ffd23f;
  text-shadow: 0 3px 0 rgba(0,0,0,0.5), 0 0 24px rgba(255, 180, 60, 0.4);
  opacity: 0;
  transition: opacity 0.5s ease 0.35s;
  text-align: center;
  white-space: nowrap;
}
#balloon-loading-screen.show .balloon-loading-footer { opacity: 1; }
#balloon-loading-screen .balloon-loading-dots {
  display: inline-block;
  margin-left: 4px;
}
#balloon-loading-screen .balloon-loading-dots span {
  display: inline-block;
  margin: 0 2px;
  animation: balloonLoadingDot 1.4s ease-in-out infinite;
}
#balloon-loading-screen .balloon-loading-dots span:nth-child(2) { animation-delay: 0.18s; }
#balloon-loading-screen .balloon-loading-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes balloonLoadingDot {
  0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

/* Objective panel — shown on left during COUNTDOWN to brief the round */
#objective-panel {
  position: fixed;
  left: 36px;
  top: 50%;
  transform: translateY(-50%) translateX(-30px);
  z-index: 60;
  width: 320px;
  padding: 22px 24px 20px;
  background: rgba(20, 10, 30, 0.65);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 210, 63, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 24px rgba(255,210,63,0.18);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(.34,1.56,.64,1);
}
#objective-panel.show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
#objective-panel .obj-label {
  font-family: 'Bungee', sans-serif;
  font-size: 11px; letter-spacing: .3em;
  color: #ffd23f; opacity: 0.75;
  margin-bottom: 6px;
}
#objective-panel .obj-title {
  font-family: 'Bungee', sans-serif;
  font-size: 22px; line-height: 1.1;
  color: #fff6ea;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  margin-bottom: 12px;
}
#objective-panel .obj-desc {
  font-family: 'Fredoka One', 'Bungee', sans-serif;
  font-size: 14px; line-height: 1.5;
  color: rgba(255, 246, 234, 0.92);
  margin-bottom: 16px;
  white-space: pre-line;
}
#objective-panel .obj-controls {
  font-family: 'Fredoka One', 'Bungee', sans-serif;
  font-size: 11px; letter-spacing: .04em;
  color: rgba(255, 246, 234, 0.65);
  border-top: 1px solid rgba(255, 246, 234, 0.18);
  padding-top: 12px;
  line-height: 1.6;
}
#objective-panel .obj-controls .key {
  display: inline-block;
  background: rgba(255, 210, 63, 0.85);
  color: #1a0a1e;
  padding: 1px 6px 0;
  border-radius: 3px;
  font-size: 10px;
  margin: 0 2px;
  vertical-align: 1px;
  font-family: 'Bungee', sans-serif;
}

/* Click-to-play overlay — shown when pointer-lock isn't acquired during PLAYING.
   First click engages pointer lock + dismisses; reappears on accidental ESC. */
#balloon-clicktoplay {
  position: fixed; inset: 0;
  z-index: 90;
  background:
    radial-gradient(ellipse at center, rgba(20, 10, 30, 0.4) 0%, rgba(8, 4, 14, 0.7) 80%);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  animation: balloonCTPPulse 1.6s ease-in-out infinite;
}
#balloon-clicktoplay .ctp-card {
  text-align: center;
  padding: 28px 48px 24px;
  background: rgba(20, 10, 30, 0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 210, 63, 0.45);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 60px rgba(255, 180, 60, 0.25);
}
#balloon-clicktoplay .ctp-title {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: 0.12em;
  color: #ffd23f;
  text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 28px rgba(255, 180, 60, 0.5);
  line-height: 1;
  margin-bottom: 14px;
}
#balloon-clicktoplay .ctp-sub {
  font-family: 'Fredoka One', 'Bungee', sans-serif;
  font-size: 13px; letter-spacing: 0.06em;
  color: rgba(255, 246, 234, 0.75);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
#balloon-clicktoplay .ctp-key {
  display: inline-block;
  padding: 1px 7px;
  background: rgba(255, 210, 63, 0.85);
  color: #1a0a1e;
  border-radius: 4px;
  font-family: 'Bungee', sans-serif;
  font-size: 11px;
  margin: 0 2px;
}
@keyframes balloonCTPPulse {
  0%, 100% { background: radial-gradient(ellipse at center, rgba(20, 10, 30, 0.4) 0%, rgba(8, 4, 14, 0.7) 80%); }
  50%      { background: radial-gradient(ellipse at center, rgba(40, 20, 60, 0.5) 0%, rgba(8, 4, 14, 0.8) 80%); }
}

/* "Press R to reload" prompt — flashed on empty-click and during reload */
#balloon-hud #balloon-reload-prompt {
  position: absolute; left: 50%; top: 58%;
  transform: translateX(-50%);
  font-family: 'Bungee', sans-serif;
  font-size: 18px; letter-spacing: .12em;
  color: #ffd23f; text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 0 14px rgba(255,180,40,.55);
  background: rgba(20, 10, 30, 0.55);
  padding: 8px 18px; border-radius: 8px;
  border: 1px solid rgba(255,210,63,0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 50;
}
#balloon-hud #balloon-reload-prompt.show {
  opacity: 1;
  animation: balloonReloadPromptPulse 0.6s ease-in-out infinite alternate;
}
#balloon-hud #balloon-reload-prompt .key {
  display: inline-block;
  background: #ffd23f; color: #1a0a1e;
  padding: 1px 8px 0; border-radius: 4px;
  margin: 0 4px;
  font-size: 16px;
  vertical-align: 1px;
}
@keyframes balloonReloadPromptPulse {
  from { transform: translateX(-50%) scale(1); }
  to   { transform: translateX(-50%) scale(1.06); }
}

/* Aim ghost — small dot at predicted arrow impact (drawn each frame in screen space) */
#balloon-hud #balloon-aim-ghost {
  position: absolute; left: 50%; top: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(120, 220, 255, 0.85);
  border-radius: 50%;
  background: rgba(120, 220, 255, 0.18);
  box-shadow: 0 0 12px rgba(120, 220, 255, 0.55);
  pointer-events: none;
  display: none;
  transform: translate(0, 0);
}

/* Damage direction arc — short red wedge at screen edge pointing toward attacker */
#balloon-hud #balloon-damage-arcs {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.balloon-damage-arc {
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  /* The arc is rendered as a rotated radial-gradient sector via a wedge shape */
  transform-origin: 0 0;
  pointer-events: none;
}
.balloon-damage-arc::before {
  content: '';
  position: absolute;
  width: 75vmin;
  height: 38vmin;
  left: 0; top: -19vmin;
  background: radial-gradient(ellipse at left center,
    rgba(255, 40, 40, 0) 0%,
    rgba(255, 40, 40, 0) 50%,
    rgba(255, 40, 40, 0.65) 72%,
    rgba(255, 60, 60, 0.92) 88%,
    rgba(255, 90, 90, 1.0) 100%);
  filter: blur(2.5px);
  animation: balloonDamageArcFade 2600ms ease-out forwards;
}
@keyframes balloonDamageArcFade {
  0%   { opacity: 1; }
  10%  { opacity: 1; }
  35%  { opacity: 0.85; }
  100% { opacity: 0; }
}
