:root {
  --gold: #ffd23f;
  --gold-deep: #f29e1f;
  --ink: #1b1d3a;
  --sky: #69b8ff;
  --glass: rgba(20, 24, 58, 0.62);
  --stroke: 0 3px 0 #1b1d3a, 3px 0 0 #1b1d3a, -3px 0 0 #1b1d3a, 0 -3px 0 #1b1d3a,
    2px 2px 0 #1b1d3a, -2px -2px 0 #1b1d3a, 2px -2px 0 #1b1d3a, -2px 2px 0 #1b1d3a;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #2478e0 0%, #8cd0ff 56%, #ffe8c8 100%);
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  color: #fff;
  touch-action: none;
  overscroll-behavior: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  outline: none;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* ---------- 2D Overlay for Reticle & Floating Popups ---------- */
#overlay-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  overflow: hidden;
}

#reticle {
  position: absolute;
  width: 88px;
  height: 88px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.95));
}

.reticle-ring {
  position: absolute;
  border-radius: 50%;
  border: 3.5px solid #22e3ff;
  inset: 14px;
  animation: reticleSpin 4s linear infinite;
}

.reticle-ring.outer {
  inset: 8px;
  border-style: dashed;
  border-width: 3px;
  border-color: rgba(82, 238, 255, 0.94);
}

.reticle-ring.inner {
  inset: 22px;
  border-color: #ffffff;
  border-width: 2.5px;
  animation-direction: reverse;
  animation-duration: 2.6s;
}

.reticle-cross {
  position: absolute;
  background: #22e3ff;
  border-radius: 2px;
}

.reticle-cross.h {
  left: 2px;
  right: 2px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  clip-path: polygon(0 0, 26% 0, 26% 100%, 0 100%, 0 0, 74% 0, 100% 0, 100% 100%, 74% 100%);
}

.reticle-cross.v {
  top: 2px;
  bottom: 2px;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 100% 26%, 0 26%, 0 0, 0 74%, 100% 74%, 100% 100%, 0 100%);
}

.reticle-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px #00e5ff, 0 0 18px #ffd23f;
  transform: translate(-50%, -50%);
}

.reticle-power-svg {
  position: absolute;
  inset: -10px;
  width: 108px;
  height: 108px;
  transform: rotate(-90deg);
}

.power-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 7;
}

.power-fg {
  fill: none;
  stroke: var(--gold);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  transition: stroke 0.08s ease;
}

#reticle-label {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  font-family: 'Lilita One', cursive;
  font-size: 14px;
  letter-spacing: 0.8px;
  color: #fff;
  text-shadow: var(--stroke);
  white-space: nowrap;
}

#reticle.pop {
  animation: reticlePop 0.24s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes reticleSpin { to { transform: rotate(360deg); } }
@keyframes reticlePop {
  0% { transform: translate(-50%, -50%) scale(1.65); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

#hold-progress {
  position: absolute;
  width: 74px;
  height: 74px;
  transform: translate(-50%, -50%);
}
#hold-progress svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hold-bg { fill: rgba(0, 212, 255, 0.14); stroke: rgba(255, 255, 255, 0.35); stroke-width: 6; }
.hold-fg { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 201; stroke-dashoffset: 201; }

/* Floating Score Popups (+10, +20, +50, +100) rising from ground crashes in Lilita One */
.score-popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: 'Lilita One', cursive;
  font-size: 30px;
  letter-spacing: 0.6px;
  text-shadow: var(--stroke);
  animation: scoreFloatUp 1.35s cubic-bezier(0.18, 0.88, 0.32, 1) forwards;
  pointer-events: none;
  white-space: nowrap;
  will-change: transform, left, top, opacity;
}
.score-popup.world-rising {
  animation: none;
}
.score-popup.pts-10 { color: #ffe680; font-size: 27px; }
.score-popup.pts-20 { color: var(--gold); font-size: 32px; }
.score-popup.pts-50 { color: #ff595e; font-size: 39px; }
.score-popup.pts-100 { color: #56f3ff; font-size: 42px; }
.score-popup.pts-bonus { color: #80ff72; font-size: 36px; }

@keyframes scoreFloatUp {
  0% { opacity: 0; transform: translate(-50%, 0px) scale(0.45); }
  16% { opacity: 1; transform: translate(-50%, -26px) scale(1.22); }
  36% { opacity: 1; transform: translate(-50%, -58px) scale(1.02); }
  100% { opacity: 0; transform: translate(-50%, -145px) scale(0.94); }
}

/* ---------- Celebration Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  text-align: center;
  pointer-events: none;
  z-index: 26;
  width: 92vw;
}
#toast.show {
  animation: toastAnim 2.2s cubic-bezier(.2,1.4,.4,1) forwards;
}
#toast-title {
  font-family: 'Lilita One', cursive;
  font-size: clamp(34px, 7vw, 60px);
  color: var(--gold);
  text-shadow: var(--stroke), 0 0 34px rgba(255, 190, 40, 0.9);
}
#toast-sub {
  font-weight: 900;
  font-size: clamp(15px, 3.2vw, 22px);
  text-shadow: var(--stroke);
  margin-top: 4px;
}
@keyframes toastAnim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  26% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(0.95); }
}

/* ---------- Gameplay HUD ---------- */
#hud-top {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

#hud-top > * {
  pointer-events: auto;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.score-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 2.5px solid rgba(255, 210, 63, 0.65);
  border-radius: 18px;
  padding: 5px 15px 9px;
  min-width: 146px;
  box-shadow: 0 5px 0 var(--ink), 0 8px 20px rgba(0, 0, 0, 0.36);
}

.score-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-star {
  color: var(--gold);
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 210, 63, 0.85));
  animation: spinY 3.2s linear infinite;
  display: inline-block;
}

@keyframes spinY {
  0% { transform: scaleX(1); }
  50% { transform: scaleX(0.2); }
  100% { transform: scaleX(1); }
}

.score-value {
  font-family: 'Lilita One', cursive;
  font-size: 34px;
  line-height: 1;
  color: #fff;
  text-shadow: var(--stroke);
}

.medal-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
  margin-top: 6px;
}

.medal-progress {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #cd7f32, #e0e6ed, var(--gold));
  transition: width 0.25s ease;
}

.medal-pip {
  position: absolute;
  top: -6px;
  font-size: 13px;
  transform: translateX(-50%);
  opacity: 0.4;
  filter: grayscale(0.75);
  transition: transform 0.25s, opacity 0.25s, filter 0.25s;
}
.medal-pip.earned {
  opacity: 1;
  filter: none;
  transform: translateX(-50%) scale(1.25);
}
.medal-pip.bronze { left: 42%; }
.medal-pip.silver { left: 72%; }
.medal-pip.gold { left: 100%; }

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: 'Lilita One', cursive;
  font-size: 19px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 var(--ink);
  box-shadow: 0 4px 0 var(--ink), 0 6px 14px rgba(0, 0, 0, 0.32);
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 7px;
}

.level-badge {
  background: linear-gradient(180deg, #fff3a6 0%, var(--gold) 55%, var(--gold-deep) 100%);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 6px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Lilita One', cursive;
  box-shadow: 0 4px 0 var(--ink), 0 8px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s;
}
.level-badge:hover { transform: translateY(-2px) scale(1.02); }
.level-badge:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }

#level-num {
  background: var(--ink);
  color: var(--gold);
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
}

#level-title {
  font-size: 18px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.hud-right {
  display: flex;
  gap: 7px;
  align-items: center;
}

/* Round HUD Action Pills */
.hud-pill {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink), 0 6px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}
.hud-pill.nav-pill {
  width: 38px;
  height: 38px;
  font-size: 14px;
}
.hud-pill:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.hud-pill:active {
  transform: translateY(2px) scale(0.94);
  box-shadow: 0 2px 0 var(--ink);
}
.hud-pill.active {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--ink);
}

/* Bottom HUD */
#hud-bottom {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
#hud-bottom > * { pointer-events: auto; }

.ammo-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  padding: 6px 10px;
  box-shadow: 0 5px 0 var(--ink), 0 8px 20px rgba(0, 0, 0, 0.38);
}

.throws-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 10px;
  border-right: 1.5px solid rgba(255, 255, 255, 0.2);
}

#throws-left {
  font-family: 'Lilita One', cursive;
  font-size: 29px;
  line-height: 1;
  color: #8dffb8;
  text-shadow: 0 2px 0 var(--ink);
}

.throws-sub {
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #cbd5e1;
}

.ball-selector {
  display: flex;
  gap: 5px;
}

.ball-btn {
  background: rgba(255, 255, 255, 0.09);
  border: 2px solid transparent;
  border-radius: 13px;
  color: #fff;
  padding: 5px 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  transition: all 0.12s ease;
}
.ball-btn:hover { background: rgba(255, 255, 255, 0.18); }
.ball-btn.active {
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.34), rgba(242, 158, 31, 0.25));
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(255, 210, 63, 0.45);
}
.ball-emoji { font-size: 18px; line-height: 1.1; }
.ball-name { font-size: 10px; font-weight: 900; margin-top: 2px; }

.aim-status-bar {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 800;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 0 var(--ink), 0 6px 16px rgba(0, 0, 0, 0.32);
}
.aim-status-bar.locked {
  border-color: var(--gold);
  background: rgba(24, 34, 82, 0.88);
  color: #fff3a6;
}

.clear-target-btn {
  background: rgba(240, 70, 88, 0.32);
  border: 1.5px solid #ff8fab;
  color: #fff;
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.swing-gauge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  padding: 9px 14px;
  min-width: 196px;
  box-shadow: 0 5px 0 var(--ink), 0 8px 20px rgba(0, 0, 0, 0.38);
}
.swing-gauge-label { font-size: 10.5px; font-weight: 900; letter-spacing: 1px; color: #cbd5e1; }
.swing-gauge-track { flex: 1; height: 12px; background: rgba(255, 255, 255, 0.14); border-radius: 99px; overflow: hidden; }
.swing-gauge-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #27c96b, var(--gold) 55%, #f04658);
  transition: width 0.05s linear;
}
.swing-gauge-pct {
  font-family: 'Lilita One', cursive;
  font-size: 18px;
  min-width: 42px;
  text-align: right;
  color: var(--gold);
  text-shadow: 0 2px 0 var(--ink);
}

/* ---------- Overlays, Title Screen & Buttons ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(30, 40, 110, 0.32), rgba(8, 10, 30, 0.78));
  overflow-y: auto;
  padding: 16px;
  z-index: 40;
}

.overlay.title-overlay {
  background: linear-gradient(
    180deg,
    rgba(12, 22, 58, 0.48) 0%,
    rgba(12, 22, 58, 0.04) 36%,
    rgba(12, 22, 58, 0.04) 64%,
    rgba(10, 18, 46, 0.58) 100%
  );
  align-items: stretch;
  padding: max(20px, env(safe-area-inset-top)) 20px max(26px, env(safe-area-inset-bottom));
}

.start-hero-layout {
  width: min(860px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  pointer-events: none;
  animation: rise 0.7s cubic-bezier(.2,1.2,.4,1);
}

.start-brand {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(4px, 2vh, 18px);
}

.blox-crest {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 5px 18px;
  border-radius: 999px;
  background: rgba(18, 25, 64, 0.62);
  border: 2px solid rgba(255, 210, 63, 0.7);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  margin-bottom: 6px;
}
.crest-star {
  font-size: 24px;
  color: var(--gold);
  filter: drop-shadow(0 0 10px rgba(255, 200, 40, 0.9));
}
.crest-icons {
  font-size: 24px;
}

.game-title {
  font-family: 'Lilita One', cursive;
  font-size: clamp(48px, 9vw, 90px);
  line-height: 0.96;
  margin: 2px 0 8px;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #ffffff 12%, #ffe680 52%, #ff9f1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 5px 0 #1b1d3a) drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55));
}
.game-title span {
  background: linear-gradient(180deg, #b8f6ff 10%, #48b8ff 60%, #1d7dfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.subtitle-ribbon {
  display: inline-block;
  font-family: 'Lilita One', cursive;
  font-size: clamp(18px, 3.2vw, 26px);
  letter-spacing: 2px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff3a6 0%, var(--gold) 55%, var(--gold-deep) 100%);
  padding: 6px 26px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink), 0 10px 24px rgba(0, 0, 0, 0.4);
  transform: rotate(-1.3deg);
  margin-bottom: 10px;
}

.tagline {
  font-size: clamp(14px, 2.2vw, 18px);
  font-weight: 900;
  color: #ffffff;
  text-shadow: var(--stroke), 0 4px 14px rgba(0, 0, 0, 0.65);
  margin: 0;
  max-width: 720px;
}

.start-actions {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(4px, 1.5vh, 14px);
}

.start-sub-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn-primary {
  font-family: 'Lilita One', cursive;
  font-size: clamp(22px, 3.8vw, 28px);
  letter-spacing: 1px;
  color: var(--ink);
  cursor: pointer;
  padding: 13px 40px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #fff3a6, var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 6px 0 var(--ink), 0 12px 30px rgba(255, 180, 40, 0.45);
  transition: transform 0.12s, box-shadow 0.12s;
  animation: pulseBtn 1.8s ease-in-out infinite;
}
.btn-primary.btn-play {
  font-size: clamp(24px, 4.2vw, 33px);
  padding: 15px 48px;
}
.btn-primary.btn-compact {
  font-size: 20px;
  padding: 10px 28px;
}
.btn-primary:hover { transform: translateY(-2px) scale(1.04); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }

@keyframes pulseBtn {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.1); }
}

.btn-secondary {
  font-family: 'Lilita One', cursive;
  font-size: clamp(17px, 2.8vw, 20px);
  letter-spacing: 0.8px;
  color: #fff;
  cursor: pointer;
  padding: 10px 26px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #38bdf8, #0284c7 55%, #0369a1);
  box-shadow: 0 5px 0 var(--ink), 0 10px 24px rgba(2, 132, 199, 0.45);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-secondary:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.08); }
.btn-secondary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

.btn-pill {
  font-family: 'Lilita One', cursive;
  font-size: clamp(16px, 2.5vw, 19px);
  letter-spacing: 0.8px;
  padding: 10px 24px;
  border-radius: 999px;
  cursor: pointer;
}

.btn-glass {
  color: #ffffff;
  background: rgba(20, 28, 68, 0.8);
  backdrop-filter: blur(10px);
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 5px 0 var(--ink), 0 10px 22px rgba(0, 0, 0, 0.42);
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn-glass:hover {
  transform: translateY(-2px) scale(1.03);
  background: rgba(32, 44, 102, 0.9);
  border-color: var(--gold);
}
.btn-glass:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}

/* ---------- Modal Cards ---------- */
.title-card {
  width: min(740px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 30px 22px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(160deg, rgba(34, 46, 118, 0.92), rgba(16, 20, 54, 0.95));
  backdrop-filter: blur(16px);
  border: 2.5px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: rise 0.42s cubic-bezier(.2,1.2,.4,1);
}
.title-card.small { width: min(430px, 100%); }

@keyframes rise {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.controls-modal-header { margin-bottom: 12px; }
.controls-badge {
  display: inline-block;
  padding: 3px 13px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.22);
  border: 1.5px solid rgba(56, 189, 248, 0.65);
  color: #bae6fd;
  font-weight: 900;
  font-size: 11.5px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.controls-title {
  font-family: 'Lilita One', cursive;
  font-size: clamp(28px, 4.6vw, 40px);
  color: var(--gold);
  text-shadow: var(--stroke);
  margin: 0 0 2px;
  font-weight: 400;
}
.controls-sub {
  font-size: 14px;
  font-weight: 800;
  color: #cbd5e1;
  margin: 0;
}

.controls-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin: 12px 0;
  text-align: left;
}
.ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 13px;
  border-radius: 13px;
  background: rgba(15, 23, 52, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.ctrl-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-weight: 900;
  font-size: 13px;
  color: #9ff3ff;
}
.ctrl-desc {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
}
kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 7px;
  font-family: inherit;
  font-weight: 900;
  font-size: 12px;
  background: linear-gradient(180deg, #fff, #d9e2ff);
  color: var(--ink);
  border-bottom: 3px solid #8b95c9;
  text-align: center;
}

.block-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  background: rgba(10, 16, 38, 0.55);
  padding: 9px 12px;
  border-radius: 13px;
  font-size: 12.5px;
  font-weight: 800;
  margin-bottom: 14px;
}

.controls-modal-footer {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

/* Level Map Grid */
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
  margin-top: 12px;
  text-align: left;
}
.level-card-btn {
  background: rgba(15, 23, 52, 0.68);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 12px 13px;
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
  box-shadow: 0 4px 0 var(--ink);
}
.level-card-btn:hover, .level-card-btn.current {
  border-color: var(--gold);
  background: rgba(42, 58, 136, 0.85);
  transform: translateY(-2px);
}
.level-card-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 900;
  color: #72efdd;
  margin-bottom: 4px;
}
.level-card-name {
  font-family: 'Lilita One', cursive;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 3px;
}
.level-card-desc {
  font-size: 12px;
  font-weight: 800;
  color: #dbeafe;
}

.sandbox-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.sandbox-heading {
  font-family: 'Lilita One', cursive;
  font-size: 19px;
  color: #9ff3ff;
  margin-bottom: 10px;
}
.sandbox-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.sb-btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.pause-title {
  font-family: 'Lilita One', cursive;
  font-size: 46px;
  margin: 0 0 8px;
  font-weight: 400;
  color: var(--gold);
  text-shadow: var(--stroke);
}
.pause-stats {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 18px;
  color: #e2e8f0;
}
.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* Result Banner */
.result-banner {
  position: fixed;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  pointer-events: auto;
}
.result-card {
  background: linear-gradient(160deg, rgba(34, 46, 118, 0.94), rgba(16, 20, 54, 0.96));
  backdrop-filter: blur(12px);
  border: 3px solid var(--gold);
  border-radius: 24px;
  padding: 16px 26px;
  text-align: center;
  box-shadow: 0 8px 0 var(--ink), 0 18px 40px rgba(0, 0, 0, 0.55);
  animation: popIn 0.34s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.result-medal { font-size: 46px; line-height: 1; }
.result-card h2 {
  margin: 4px 0 3px;
  font-family: 'Lilita One', cursive;
  font-size: 26px;
  color: var(--gold);
  text-shadow: var(--stroke);
}
.result-card p {
  margin: 0 0 12px;
  font-size: 14.5px;
  font-weight: 800;
  color: #e2e8f0;
}
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.75); }
  to { opacity: 1; transform: scale(1); }
}

/* Loading Splash */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(180deg, #2478e0 0%, #8cd0ff 60%, #ffe8c8 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease;
}
.loader-logo {
  font-family: 'Lilita One', cursive;
  font-size: clamp(44px, 8vw, 72px);
  color: var(--gold);
  text-shadow: var(--stroke);
  letter-spacing: 2px;
}
.loader-logo span { color: #56f3ff; }
.loader-sub {
  margin-top: 10px;
  font-weight: 900;
  color: var(--ink);
  font-size: 16px;
}

/* Responsive Mobile Tweaks */
@media (max-width: 760px) {
  .aim-status-bar {
    position: fixed;
    bottom: 78px;
    left: 12px;
    right: 12px;
    justify-content: center;
    font-size: 12px;
    padding: 6px 12px;
  }
  #level-title {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .swing-gauge-wrap {
    min-width: 132px;
    padding: 8px 10px;
  }
  .swing-gauge-label { display: none; }
  .ball-name { display: none; }
  .ball-btn { min-width: 40px; padding: 6px; }
  .hud-pill { width: 38px; height: 38px; font-size: 16px; }
  .sync-status-pill { font-size: 13px; padding: 6px 10px; }
}

/* ---------- Deterministic Physics & Multi-Browser Sync UI ---------- */
.sync-status-pill {
  color: #e2e8f0;
  cursor: pointer;
  font-family: 'Nunito', monospace, sans-serif;
  font-weight: 900;
  font-size: 13.5px;
  padding: 7px 13px;
  gap: 7px;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.sync-status-pill:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.sync-status-pill.live-peers {
  border-color: #38ef7d;
  background: rgba(14, 48, 38, 0.78);
  color: #b8ffda;
}
.sync-status-pill.replaying {
  border-color: #ff9f1c;
  background: rgba(68, 36, 12, 0.85);
  color: #ffe680;
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  display: inline-block;
}
.sync-status-pill.live-peers .sync-dot {
  background: #38ef7d;
  box-shadow: 0 0 10px #38ef7d;
}
.sync-status-pill.replaying .sync-dot {
  background: #ff9f1c;
  box-shadow: 0 0 10px #ff9f1c;
}

#remote-reticle {
  position: absolute;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 102, 196, 0.95));
}
.remote-reticle-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 3.5px dashed #ff66c4;
  animation: reticleSpin 3s linear infinite;
}
#remote-reticle-label {
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%);
  font-family: 'Lilita One', cursive;
  font-size: 12px;
  color: #ffb3e6;
  text-shadow: var(--stroke);
  white-space: nowrap;
}

.det-telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 9px;
  margin: 14px 0 10px;
}
.det-stat-box {
  background: rgba(12, 18, 46, 0.76);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.det-stat-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #94a3b8;
}
.det-stat-value {
  font-family: 'Lilita One', cursive;
  font-size: 19px;
  color: #fff;
  letter-spacing: 0.5px;
}
.det-stat-value.hash-code {
  color: #72efdd;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 900;
  font-size: 17px;
}

.det-verify-banner {
  background: rgba(15, 32, 68, 0.74);
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  border-radius: 13px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  color: #e0f2fe;
  margin-bottom: 12px;
}
.det-verify-banner.verified {
  background: rgba(14, 58, 42, 0.82);
  border-color: #38ef7d;
  color: #bbf7d0;
}

.sync-room-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.sync-room-label {
  font-weight: 900;
  font-size: 14px;
  color: #ffe680;
}
.sync-room-input {
  background: rgba(10, 16, 40, 0.88);
  border: 2px solid rgba(255, 210, 63, 0.65);
  border-radius: 999px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 14px;
  padding: 7px 14px;
  width: 148px;
  outline: none;
  text-align: center;
  user-select: text;
  -webkit-user-select: text;
}
.sync-toggles-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.sb-btn.active-toggle {
  border-color: #38ef7d;
  color: #bbf7d0;
}


/* ---------- Party-Lobby, Turn-Based Roster & Extra-Weapons UI ---------- */
.hud-center-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.turn-scoreboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.player-turn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 22, 54, 0.72);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 900;
  color: #dbeafe;
  box-shadow: 0 3px 0 var(--ink), 0 5px 12px rgba(0, 0, 0, 0.32);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.player-turn-pill.active {
  background: linear-gradient(180deg, rgba(44, 62, 148, 0.94), rgba(22, 32, 88, 0.96));
  border-color: var(--gold);
  color: #ffffff;
  transform: scale(1.06);
  box-shadow: 0 4px 0 var(--ink), 0 0 18px rgba(255, 210, 63, 0.55);
}

.player-turn-arrow {
  color: var(--gold);
  font-size: 12px;
}

.player-turn-score {
  font-family: 'Lilita One', cursive;
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 0.4px;
}

.player-turn-wpns {
  font-size: 11.5px;
  background: rgba(255, 210, 63, 0.18);
  border-radius: 99px;
  padding: 1px 6px;
  color: #ffe680;
}

/* Extra-Weapon Ammo & Locked States */
.ball-btn {
  position: relative;
  min-width: 56px;
  padding: 5px 9px 4px;
}

.ball-ammo {
  margin-top: 2px;
  font-family: 'Lilita One', cursive;
  font-size: 11px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(255, 210, 63, 0.28);
  color: #ffe680;
  border: 1px solid rgba(255, 210, 63, 0.55);
}

.ball-ammo.infinite {
  background: rgba(56, 239, 125, 0.22);
  color: #9ff7c4;
  border-color: rgba(56, 239, 125, 0.5);
}

.ball-btn.locked-weapon {
  opacity: 0.46;
  filter: grayscale(0.55);
}

.ball-btn.locked-weapon .ball-ammo {
  background: rgba(15, 23, 42, 0.75);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
}

.ball-btn.unlocked-pop {
  animation: weaponUnlockPop 0.55s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes weaponUnlockPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.26); box-shadow: 0 0 22px #ffd23f; }
  100% { transform: scale(1); }
}

.aim-status-bar.waiting-turn {
  border-color: #56f3ff;
  background: rgba(16, 36, 74, 0.86);
  color: #bae6fd;
}

.skip-turn-btn {
  background: rgba(255, 159, 28, 0.34);
  border-color: #ffd166;
}

.score-popup.pts-weapon {
  color: #ffd23f;
  font-size: 34px;
  filter: drop-shadow(0 0 12px rgba(255, 210, 63, 0.85));
}

/* Party-Lobby Hero Card */
.start-hero-layout {
  gap: 10px;
}

.lobby-panel {
  pointer-events: auto;
  width: min(690px, 100%);
  background: linear-gradient(165deg, rgba(20, 30, 82, 0.78), rgba(12, 18, 48, 0.84));
  backdrop-filter: blur(12px);
  border: 2.5px solid rgba(255, 210, 63, 0.68);
  border-radius: 24px;
  padding: 14px 18px;
  box-shadow: 0 8px 0 var(--ink), 0 18px 44px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-align: left;
}

.lobby-top-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.lobby-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lobby-field label {
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #ffe680;
}

.lobby-inline-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lobby-input {
  background: rgba(8, 14, 36, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 13.5px;
  padding: 6px 13px;
  width: 118px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.lobby-input:focus {
  border-color: var(--gold);
}
.lobby-input.name-input {
  width: 100%;
}

.lobby-mini-btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.lobby-roster-section {
  background: rgba(8, 13, 34, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 9px 12px;
}

.lobby-roster-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
  color: #9ff3ff;
  margin-bottom: 7px;
}

.hotseat-controls {
  display: flex;
  gap: 6px;
}

.lobby-tag-btn {
  background: rgba(56, 189, 248, 0.2);
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  color: #e0f2fe;
  border-radius: 999px;
  padding: 3px 10px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 11.5px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.12s;
}
.lobby-tag-btn:hover {
  border-color: var(--gold);
  color: #fff;
  transform: translateY(-1px);
}

.lobby-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.roster-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(26, 38, 92, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 3px 0 var(--ink);
}
.roster-chip.is-self {
  border-color: var(--gold);
  background: rgba(46, 62, 138, 0.92);
}
.roster-seat {
  font-family: 'Lilita One', cursive;
  font-size: 12px;
  color: var(--gold);
}
.roster-you-tag {
  font-size: 10.5px;
  background: rgba(56, 239, 125, 0.22);
  color: #bbf7d0;
  padding: 1px 6px;
  border-radius: 99px;
}

.lobby-level-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lobby-level-caption {
  font-size: 13px;
  font-weight: 900;
  color: #ffe680;
}

.lobby-level-picker {
  display: flex;
  align-items: center;
  gap: 7px;
}

.lobby-level-badge {
  padding: 5px 15px;
}

#lobby-level-num {
  background: var(--ink);
  color: var(--gold);
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
}

#lobby-level-label {
  font-size: 16px;
}

.lobby-rules-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  color: #e2e8f0;
}

/* Winner & Per-Player Result Leaderboard */
.result-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0 0 12px;
  text-align: left;
}

.result-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(12, 18, 48, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 900;
}

.result-player-row.winner {
  border-color: var(--gold);
  background: rgba(48, 62, 138, 0.85);
}

.result-player-score {
  font-family: 'Lilita One', cursive;
  font-size: 17px;
  color: var(--gold);
}
