/* ===================================================
  HELIUM HAVOC — Cartoon Theme
   =================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

@import url('https://fonts.googleapis.com/css2?family=Boogaloo&family=Nunito:wght@600;800&display=swap');

:root {
  --clr-sky-top:    #2bc0e4;
  --clr-sky-bot:    #eaecc6;
  --clr-green:      #4cbb17;
  --clr-green-dark: #37841d;
  --clr-red:        #e74c3c;
  --clr-orange:     #f39c12;
  --clr-yellow:     #f1c40f;
  --clr-blue:       #3498db;
  --clr-purple:     #9b59b6;
  --clr-dark:       #2c3e50;
  --clr-white:      #fefefe;
  --clr-panel:      rgba(255, 255, 255, 0.92);
  --font-title:     'Boogaloo', cursive;
  --font-body:      'Nunito', sans-serif;
  --shadow-card:    0 6px 0 rgba(0,0,0,.15);
  --shadow-btn:     0 5px 0 var(--clr-green-dark);
  --radius:         16px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--clr-dark);
}

body {
  background: linear-gradient(180deg, var(--clr-sky-top) 0%, var(--clr-sky-bot) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Floating Balloons (BG decoration) ---------- */
.bg-balloons { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }

.balloon {
  position: absolute;
  width: 48px; height: 60px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: .45;
  animation: floatUp linear infinite;
}
.balloon::after {
  content: '';
  position: absolute;
  bottom: -18px; left: 50%;
  width: 2px; height: 18px;
  background: rgba(0,0,0,.25);
  transform: translateX(-50%);
}

.b1 { background: #e74c3c; left: 5%;  animation-duration: 14s; animation-delay: 0s;   width: 40px; height: 52px; }
.b2 { background: #3498db; left: 18%; animation-duration: 18s; animation-delay: 2s;   width: 52px; height: 66px; }
.b3 { background: #f1c40f; left: 32%; animation-duration: 12s; animation-delay: 4s;   width: 36px; height: 46px; }
.b4 { background: #2ecc71; left: 50%; animation-duration: 16s; animation-delay: 1s;   width: 44px; height: 56px; }
.b5 { background: #9b59b6; left: 65%; animation-duration: 20s; animation-delay: 3s;   width: 50px; height: 64px; }
.b6 { background: #e67e22; left: 78%; animation-duration: 15s; animation-delay: 5s;   width: 38px; height: 48px; }
.b7 { background: #1abc9c; left: 88%; animation-duration: 17s; animation-delay: 0.5s; width: 46px; height: 58px; }
.b8 { background: #fd79a8; left: 42%; animation-duration: 22s; animation-delay: 7s;   width: 54px; height: 70px; }

@keyframes floatUp {
  0%   { transform: translateY(110vh) rotate(0deg)   scale(1);   }
  50%  { transform: translateY(50vh)  rotate(15deg)  scale(1.05); }
  100% { transform: translateY(-20vh) rotate(-10deg) scale(.95);  }
}

/* ---------- Screens ---------- */

/* ---- Intro Video Screen ---- */
#screen-intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#screen-intro:not(.active) { display: none; }

#intro-video {
  max-width: 85%;
  max-height: 80%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
}

#intro-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
#intro-fade.active {
  opacity: 1;
}

#skip-intro {
  position: absolute;
  bottom: 28px;
  right: 28px;
  font-family: var(--font-title);
  font-size: 1rem;
  padding: 8px 22px;
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 10px;
  background: rgba(0,0,0,.5);
  color: #fff;
  cursor: pointer;
  letter-spacing: 1px;
  opacity: .7;
  transition: opacity .2s, background .2s;
  z-index: 101;
}
#skip-intro:hover {
  opacity: 1;
  background: rgba(255,255,255,.15);
}
#skip-intro.hidden { display: none; }

/* ---- Loading Screen ---- */
#screen-loading {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#screen-loading:not(.active) { display: none; }

#loading-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

#loading-bar-wrap {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  width: 52%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#loading-bar-track {
  width: 100%;
  height: 28px;
  background: rgba(0,0,0,.55);
  border: 3px solid #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 12px rgba(0,0,0,.5),
    inset 0 2px 6px rgba(0,0,0,.3);
}

#loading-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 13px;
  background: linear-gradient(180deg, #5dde3b 0%, #4cbb17 40%, #37841d 100%);
  box-shadow: 0 0 14px rgba(76,187,23,.5);
  transition: width .25s ease;
}

#loading-bar-text {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,.7);
  letter-spacing: 2px;
}

#loading-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  z-index: 3;
}
#loading-fade.active {
  opacity: 1;
}

/* Intro Start Button Overlay */
#intro-start-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 102;
  background: rgba(0,0,0,.65);
}
#intro-start-wrap.hidden { display: none; }

#intro-start-btn {
  font-family: var(--font-title);
  font-size: 2.2rem;
  padding: 20px 56px;
  border: 4px solid #fff;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--clr-green) 0%, var(--clr-green-dark) 100%);
  color: #fff;
  cursor: pointer;
  letter-spacing: 3px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow:
    0 6px 0 rgba(0,0,0,.25),
    0 0 40px rgba(76,187,23,.3);
  transition: transform .12s, box-shadow .12s;
}
#intro-start-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 9px 0 rgba(0,0,0,.25),
    0 0 60px rgba(76,187,23,.45);
}
#intro-start-btn:active {
  transform: translateY(2px) scale(.97);
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.intro-play-icon {
  font-size: 2rem;
}

.screen {
  position: fixed; inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1;
  animation: fadeIn .35s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---------- Menu Container ---------- */
#menu-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: brightness(0.6);
}

#menu-vignette {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 30%,
    rgba(0,0,0,.35) 65%,
    rgba(0,0,0,.75) 100%
  );
}

.menu-container {
  text-align: center;
  padding: 40px 50px 50px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  border: 4px solid var(--clr-dark);
  box-shadow:
    0 10px 0 rgba(0,0,0,.12),
    0 20px 60px rgba(0,0,0,.18),
    0 0 50px rgba(255,255,255,.25),
    0 0 100px rgba(255,255,255,.12);
  max-width: 420px;
  width: 90%;
  z-index: 2;
  position: relative;
}

/* ---------- Title ---------- */
.title-banner {
  margin-bottom: 28px;
  animation: titleFloat 3s ease-in-out infinite;
}

@keyframes titleFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.game-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.title-pilots {
  font-family: var(--font-title);
  font-size: 2.4rem;
  background: linear-gradient(90deg, #a78bfa, #60a5fa, #a78bfa);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1.5px var(--clr-dark);
  paint-order: stroke fill;
  letter-spacing: 4px;
  text-transform: uppercase;
  filter: drop-shadow(0 0 8px rgba(138,100,255,.5));
  animation: gradientSlide 4s linear infinite;
}
.title-bloon {
  font-family: var(--font-title);
  font-size: 3.6rem;
  background: linear-gradient(90deg, #f97316, #facc15, #f97316, #ef4444, #f97316);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px var(--clr-dark);
  paint-order: stroke fill;
  letter-spacing: 3px;
  text-transform: uppercase;
  filter: drop-shadow(0 0 12px rgba(249,115,22,.6)) drop-shadow(0 4px 0 var(--clr-yellow));
  animation: gradientSlide 3s linear infinite, titlePulse 2s ease-in-out infinite;
  position: relative;
}

@keyframes gradientSlide {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

.subtitle {
  font-family: var(--font-title);
  font-size: 1.15rem;
  background: linear-gradient(90deg, #c084fc, #60a5fa, #c084fc);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 6px;
  letter-spacing: 2px;
  animation: gradientSlide 5s linear infinite;
  filter: drop-shadow(0 0 4px rgba(192,132,252,.4));
}

/* ---------- Auth Screen ---------- */
#screen-auth {
  background: linear-gradient(135deg, #1a1030 0%, #0f0a1e 100%);
}

.auth-container {
  background: rgba(30, 20, 55, 0.95);
  border: 2px solid rgba(138, 100, 255, 0.4);
  border-radius: 24px;
  padding: 36px 40px 30px;
  max-width: 380px;
  width: 90%;
  box-shadow:
    0 0 40px rgba(138, 100, 255, 0.2),
    0 0 80px rgba(138, 100, 255, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.auth-title {
  font-family: var(--font-title);
  font-size: 2rem;
  color: #c4b5fd;
  margin-bottom: 18px;
  letter-spacing: 2px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(138, 100, 255, 0.3);
}

.auth-tab {
  flex: 1;
  font-family: var(--font-title);
  font-size: 1.1rem;
  padding: 10px 0;
  background: rgba(255, 255, 255, 0.05);
  color: #a78bfa;
  border: none;
  cursor: pointer;
  transition: background .2s, color .2s;
  letter-spacing: 1px;
}
.auth-tab:hover {
  background: rgba(138, 100, 255, 0.15);
}
.auth-tab.active {
  background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
}

.auth-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: #a78bfa;
  text-align: left;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 2px solid rgba(138, 100, 255, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: #ede9fe;
  margin-bottom: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 12px rgba(138, 100, 255, 0.3);
}
.auth-input::placeholder {
  color: rgba(167, 139, 250, 0.4);
}

.auth-error {
  color: #f87171;
  font-family: var(--font-body);
  font-size: 0.85rem;
  margin-bottom: 10px;
}
.auth-success {
  color: #4ade80;
  font-family: var(--font-body);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.btn-auth-submit {
  width: 100%;
  padding: 13px 0;
  font-family: var(--font-title);
  font-size: 1.2rem;
  letter-spacing: 1.5px;
  border: 2px solid rgba(138, 100, 255, 0.4);
  border-radius: 12px;
  background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 4px 0 #4c1d95, 0 0 20px rgba(124, 58, 237, 0.3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #4c1d95, 0 0 30px rgba(124, 58, 237, 0.5);
}
.btn-auth-submit:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #4c1d95;
}

.spinner {
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

#screen-auth .btn-back {
  background: rgba(255,255,255,.08);
  color: #a78bfa;
  border-color: rgba(138,100,255,.3);
  box-shadow: none;
  margin-top: 6px;
  font-size: 1rem;
}
#screen-auth .btn-back:hover {
  background: rgba(138,100,255,.15);
}

/* ---------- Menu Buttons ---------- */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn {
  font-family: var(--font-title);
  font-size: 1.3rem;
  letter-spacing: 1.5px;
  padding: 14px 28px;
  border: 3px solid var(--clr-dark);
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  transition: transform .12s, box-shadow .12s, filter .12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  outline: none;
  user-select: none;
}
.btn:hover  { transform: translateY(-3px); filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: none !important; }

.btn-icon { font-size: 1.1em; }

/* Individual button colours */
.btn-play {
  background: linear-gradient(180deg, #9a4dff 0%, #7b2abd 100%);
  color: var(--clr-white); 
  box-shadow: 0 5px 0 #5a1a8a;
}
.btn-help {
  background: linear-gradient(180deg, #3498db 0%, #2176ad 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #185a85;
}
.btn-options {
  background: linear-gradient(180deg, #9a4dff 0%, #7b2abd 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #5a1a8a;
}
.btn-levels {
  background: linear-gradient(180deg, #9b59b6 0%, #763d94 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #5b2e72;
}
.btn-customize {
  background: linear-gradient(180deg, #f472b6 0%, #db2777 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #9d174d;
}
.btn-quit {
  background: linear-gradient(180deg, #9a4dff 0%, #7b2abd 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #5a1a8a;
}

/* ---------- Customize / Avatar Screen ---------- */
.cust-layout {
  display: flex;
  gap: 14px;
  width: 95%;
  max-width: 900px;
  height: 80vh;
  max-height: 600px;
  margin: 0 auto;
  align-items: stretch;
}
.cust-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 130px;
  background: rgba(20,15,40,.85);
  border-radius: 16px;
  padding: 12px 10px;
  border: 2px solid rgba(168,85,247,.3);
}
.cust-menu-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: #d8b4fe;
  text-align: center;
  margin: 0 0 6px;
}
.cust-cat {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 10px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(138,43,226,.15);
  color: #e0d0f8;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.cust-cat:hover { background: rgba(138,43,226,.35); }
.cust-cat.active {
  background: linear-gradient(135deg,#7c3aed,#a855f7);
  color: #fff;
  border-color: #c084fc;
  box-shadow: 0 0 12px rgba(168,85,247,.4);
}
.cust-save-btn {
  margin-top: auto;
  background: rgba(34,197,94,.2) !important;
  color: #86efac !important;
  border-color: transparent !important;
}
.cust-save-btn:hover {
  background: rgba(34,197,94,.45) !important;
}
.cust-save-btn.active {
  background: linear-gradient(135deg,#16a34a,#22c55e) !important;
  color: #fff !important;
  border-color: #4ade80 !important;
  box-shadow: 0 0 12px rgba(34,197,94,.5) !important;
}
.cust-back-btn {
  margin-top: 4px;
  font-size: 0.78rem !important;
  padding: 6px 8px !important;
}

/* Podium / Preview */
.cust-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 200px;
  flex: 0 0 auto;
}
#avatar-canvas {
  display: block;
  border-radius: 12px;
}
.cust-podium {
  width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.podium-top {
  width: 140px;
  height: 14px;
  background: linear-gradient(180deg,#6d28d9,#5b21b6);
  border-radius: 8px 8px 0 0;
  border: 2px solid #7c3aed;
  border-bottom: none;
}
.podium-base {
  width: 180px;
  height: 18px;
  background: linear-gradient(180deg,#4c1d95,#3b0764);
  border-radius: 0 0 10px 10px;
  border: 2px solid #6d28d9;
  border-top: none;
}
.cust-username {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: #d8b4fe;
  margin: 4px 0 0;
  text-align: center;
}

/* Controls: D-Pad + Size Slider */
.cust-controls {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(20,15,40,.85);
  border-radius: 12px;
  padding: 8px 12px;
  border: 2px solid rgba(168,85,247,.25);
}
.cust-ctrl-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  color: #a78bfa;
  margin: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.cust-ctrl-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

/* D-Pad */
.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dpad-mid {
  display: flex;
  align-items: center;
  gap: 2px;
}
.dpad-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(138,43,226,.3);
  color: #d8b4fe;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
  line-height: 1;
  padding: 0;
}
.dpad-btn:hover { background: rgba(138,43,226,.55); }
.dpad-btn:active { background: #7c3aed; color: #fff; }
.dpad-center {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #6d28d9;
}

/* Size Slider */
.size-ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.size-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  color: #a78bfa;
}
.size-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 6px;
  border-radius: 3px;
  background: rgba(138,43,226,.35);
  outline: none;
}
.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #a855f7;
  cursor: pointer;
  border: 2px solid #c084fc;
}
.size-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #a855f7;
  cursor: pointer;
  border: 2px solid #c084fc;
}
.size-val {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  color: #c4b5fd;
}
.reset-btn {
  width: auto !important;
  padding: 2px 8px !important;
  font-size: 0.6rem !important;
  margin-top: 2px;
}
#avatar-canvas {
  cursor: grab;
}
#avatar-canvas.dragging {
  cursor: grabbing;
}

/* Item Picker */
.cust-items {
  flex: 1;
  background: rgba(20,15,40,.85);
  border-radius: 16px;
  padding: 14px;
  border: 2px solid rgba(168,85,247,.3);
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  align-content: start;
}
.cust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(138,43,226,.12);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
}
.cust-item:hover {
  background: rgba(138,43,226,.3);
  transform: translateY(-2px);
}
.cust-item.selected {
  border-color: #a855f7;
  background: rgba(168,85,247,.22);
  box-shadow: 0 0 12px rgba(168,85,247,.4);
}
.cust-item-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}
.cust-item-swatch {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,.15);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.25);
}
.cust-item-shoe {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cust-item-shoe canvas {
  display: block;
}
.cust-item-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: #c4b5fd;
  text-align: center;
  line-height: 1.1;
}

/* Save Overlay */
.save-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 28px;
  background: rgba(20,15,40,.95);
  border: 2px solid #22c55e;
  border-radius: 18px;
}
.save-icon { font-size: 2.4rem; }
.save-box h2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: #86efac;
  text-align: center;
}
.save-spinner-wrap { display: flex; justify-content: center; }
.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid rgba(34,197,94,.25);
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: spinAnim .7s linear infinite;
}
@keyframes spinAnim { to { transform: rotate(360deg); } }

.btn-back {
  background: linear-gradient(180deg, #95a5a6 0%, #6d7d7e 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #4e5c5d;
  margin-top: 18px;
  font-size: 1.1rem;
}
.btn-luck {
  background: linear-gradient(180deg, #ffd700 0%, #e6a800 50%, #cc8400 100%);
  color: var(--clr-dark);
  box-shadow: 0 5px 0 #9a6400, 0 0 18px rgba(255,215,0,.35);
  font-size: 1.15rem;
  text-shadow: 1px 1px 0 rgba(255,255,255,.5);
  animation: luckyShimmer 2s ease-in-out infinite;
}
.btn-luck:hover {
  box-shadow: 0 5px 0 #9a6400, 0 0 28px rgba(255,215,0,.55);
}
@keyframes luckyShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}
.btn-start {
  background: linear-gradient(180deg, #4cbb17 0%, #37841d 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #265c13;
  font-size: 1.35rem;
}

/* ---------- Panel (sub-screens) ---------- */
.panel {
  background: var(--clr-panel);
  border: 4px solid var(--clr-dark);
  border-radius: 28px;
  box-shadow: 0 10px 0 rgba(0,0,0,.12), 0 20px 60px rgba(0,0,0,.18);
  padding: 36px 42px 42px;
  max-width: 560px;
  width: 92%;
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}
.panel-title {
  font-family: var(--font-title);
  font-size: 2.4rem;
  color: var(--clr-dark);
  margin-bottom: 18px;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 var(--clr-yellow);
}
.panel-text {
  font-size: 1.05rem;
  margin-bottom: 22px;
  color: #555;
}

/* ---------- Play screen hero ---------- */
.play-hero { margin-bottom: 22px; }
.hero-circle {
  width: 110px; height: 110px;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--clr-yellow), var(--clr-orange));
  border: 4px solid var(--clr-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
  animation: bobble 2s ease-in-out infinite;
  overflow: hidden;
}
#play-hero-canvas { display: block; width: 90px; height: 90px; }
.hero-emoji { font-size: 3rem; }
.hero-label {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--clr-dark);
  letter-spacing: 1px;
}

@keyframes bobble {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* ---------- Help Grid ---------- */
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.help-card {
  background: #fff;
  border: 3px solid var(--clr-dark);
  border-radius: var(--radius);
  padding: 18px 14px;
  box-shadow: var(--shadow-card);
  transition: transform .15s;
}
.help-card:hover { transform: translateY(-4px); }
.help-icon { font-size: 2rem; margin-bottom: 6px; }
.help-card h3 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  margin-bottom: 4px;
  color: var(--clr-dark);
}
.help-card p { font-size: .85rem; color: #555; }

/* ---------- Options ---------- */
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 2px dashed #d5d5d5;
}
.option-row label {
  font-family: var(--font-title);
  font-size: 1.1rem;
  min-width: 120px;
  text-align: left;
}
.option-row input[type=range] {
  flex: 1;
  margin: 0 14px;
  accent-color: var(--clr-green);
  height: 8px;
}
.range-val {
  font-family: var(--font-title);
  font-size: 1rem;
  width: 34px;
  text-align: right;
  color: var(--clr-dark);
}
.difficulty-btns { display: flex; gap: 8px; }
.diff-btn {
  font-family: var(--font-title);
  font-size: .95rem;
  padding: 6px 16px;
  border: 3px solid var(--clr-dark);
  border-radius: 10px;
  cursor: pointer;
  background: #ecf0f1;
  color: var(--clr-dark);
  transition: background .15s, color .15s, transform .1s;
}
.diff-btn.active {
  background: var(--clr-green);
  color: var(--clr-white);
  box-shadow: 0 3px 0 var(--clr-green-dark);
}
.diff-btn:hover { transform: translateY(-2px); }

.toggle-btn {
  font-family: var(--font-title);
  font-size: 1rem;
  padding: 6px 20px;
  border: 3px solid var(--clr-dark);
  border-radius: 10px;
  cursor: pointer;
  background: #ecf0f1;
  color: var(--clr-dark);
  transition: background .15s, color .15s;
}
.toggle-btn.on {
  background: var(--clr-green);
  color: var(--clr-white);
}

/* ---------- Levels Grid ---------- */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.level-card {
  background: #fff;
  border: 3px solid var(--clr-dark);
  border-radius: var(--radius);
  padding: 18px 10px 14px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.level-card.unlocked:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 0 rgba(0,0,0,.12);
}
.level-card.locked {
  background: #d5d8dc;
  cursor: not-allowed;
  opacity: .65;
}
.level-num {
  font-family: var(--font-title);
  font-size: 2rem;
  display: block;
  color: var(--clr-blue);
}
.level-card.locked .level-num { color: #888; }
.level-name {
  font-size: .78rem;
  font-weight: 800;
  display: block;
  margin: 4px 0 6px;
  color: #444;
}
.stars { display: flex; justify-content: center; gap: 2px; }
.stars span { font-size: 1.1rem; color: var(--clr-yellow); }

/* ---------- Quit Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--clr-panel);
  border: 4px solid var(--clr-dark);
  border-radius: 24px;
  padding: 34px 44px;
  text-align: center;
  box-shadow: 0 10px 0 rgba(0,0,0,.15);
  max-width: 360px; width: 88%;
}
.modal-box h2 {
  font-family: var(--font-title);
  font-size: 2rem;
  color: var(--clr-red);
  margin-bottom: 8px;
}
.modal-box p { margin-bottom: 22px; color: #555; }
.modal-actions { display: flex; gap: 14px; justify-content: center; }

.btn-yes {
  background: linear-gradient(180deg, #e74c3c 0%, #b93428 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #8e2118;
  font-size: 1.1rem;
}
.btn-no {
  background: linear-gradient(180deg, #4cbb17 0%, #37841d 100%);
  color: var(--clr-white);
  box-shadow: 0 5px 0 #265c13;
  font-size: 1.1rem;
}

/* ========== LEADERBOARD ========== */
.btn-leaderboard {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: var(--clr-dark);
  box-shadow: 0 5px 0 #92400e;
  margin-top: 10px;
  margin-bottom: 4px;
  justify-content: center;
}

.leaderboard-panel {
  max-width: 460px;
}
.lb-table-wrap {
  max-height: 52vh;
  overflow-y: auto;
  border-radius: 12px;
  border: 2px solid var(--clr-dark);
  margin-bottom: 16px;
}
.lb-table-wrap::-webkit-scrollbar {
  width: 6px;
}
.lb-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.25);
  border-radius: 3px;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
}
.lb-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.lb-table th {
  font-family: var(--font-title);
  font-size: 1rem;
  background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  padding: 10px 12px;
  letter-spacing: 1px;
  text-align: left;
}
.lb-table th.lb-rank  { text-align: center; width: 50px; }
.lb-table th.lb-score { text-align: right; width: 80px; }

.lb-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  font-size: 0.9rem;
}
.lb-table tbody tr:nth-child(odd) {
  background: rgba(124, 58, 237, 0.04);
}
.lb-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,.5);
}
.lb-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.1);
}
.lb-table td:first-child {
  text-align: center;
  font-weight: 800;
  font-family: var(--font-title);
}
.lb-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--clr-dark);
}
.lb-loading {
  text-align: center !important;
  font-style: italic;
  color: #888;
  padding: 24px !important;
}

/* Top-3 rank medals */
.lb-table tbody tr:nth-child(1) td:first-child { color: #fbbf24; }
.lb-table tbody tr:nth-child(2) td:first-child { color: #94a3b8; }
.lb-table tbody tr:nth-child(3) td:first-child { color: #d97706; }

.lb-me {
  background: rgba(124, 58, 237, 0.15) !important;
  font-weight: 700;
}

/* ========== GAME SCREEN ========== */
#screen-game {
  background: linear-gradient(180deg, #1a3c5e 0%, #2d6a4f 60%, #52b788 100%);
  flex-direction: column;
  padding: 0;
}
#screen-game.active { display: flex; }

/* HUD */
#game-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  background: rgba(0,0,0,.45);
  z-index: 10;
  font-family: var(--font-title);
  color: #fff;
  font-size: 1.25rem;
  letter-spacing: 1px;
}
#hud-left, #hud-right, #hud-center {
  display: flex;
  align-items: center;
  gap: 22px;
}
#hud-center { flex: 0 0 auto; }
#hud-coins {
  background: linear-gradient(135deg, #f9a825 0%, #ff8f00 100%);
  padding: 4px 14px;
  border-radius: 10px;
  border: 2px solid #fff;
  font-size: 1.15rem;
  font-family: var(--font-title);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(249,168,37,.45);
  transition: transform .15s ease;
}
#hud-coins.coin-pop {
  transform: scale(1.18);
}
#hud-timer {
  background: var(--clr-red);
  padding: 4px 14px;
  border-radius: 10px;
  border: 2px solid #fff;
  font-size: 1.3rem;
}
#hud-score {
  color: var(--clr-yellow);
}

/* Health Bar */
#health-bar-wrap {
  position: relative;
  width: 180px;
  height: 22px;
  background: #444;
  border: 2px solid #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
#health-bar-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 100%;
  background: linear-gradient(180deg, #4cbb17 0%, #2ecc71 50%, #27ae60 100%);
  border-radius: 10px;
  transition: width .35s ease, background .4s ease;
}
#health-bar-fill.medium {
  background: linear-gradient(180deg, #f39c12 0%, #e67e22 100%);
}
#health-bar-fill.low {
  background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
  animation: healthPulse 0.6s ease-in-out infinite;
}
@keyframes healthPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
#health-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: .85rem;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,.6);
  letter-spacing: 1px;
  z-index: 1;
}

/* Damage Pulse Overlay */
#damage-pulse-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  border: 0px solid transparent;
  box-shadow: inset 0 0 0 transparent;
  opacity: 0;
  transition: opacity .05s ease;
}
#damage-pulse-overlay.active {
  opacity: 1;
  border: 6px solid #ff1744;
  animation: damageNeonPulse 1s ease-out forwards;
}
@keyframes damageNeonPulse {
  0% {
    border-color: #ff0033;
    box-shadow:
      inset 0 0 60px rgba(255, 0, 51, .8),
      inset 0 0 120px rgba(255, 0, 51, .45),
      0 0 40px rgba(255, 0, 51, .7),
      0 0 100px rgba(255, 0, 51, .4);
    opacity: 1;
  }
  15% {
    border-color: #ff1744;
    box-shadow:
      inset 0 0 50px rgba(255, 23, 68, .75),
      inset 0 0 100px rgba(255, 23, 68, .4),
      0 0 35px rgba(255, 23, 68, .65),
      0 0 80px rgba(255, 23, 68, .35);
    opacity: 1;
  }
  45% {
    border-color: #ff5252;
    box-shadow:
      inset 0 0 35px rgba(255, 82, 82, .55),
      inset 0 0 70px rgba(255, 82, 82, .3),
      0 0 25px rgba(255, 82, 82, .45),
      0 0 55px rgba(255, 82, 82, .2);
    opacity: .8;
  }
  70% {
    border-color: rgba(255, 82, 82, .4);
    box-shadow:
      inset 0 0 18px rgba(255, 82, 82, .3),
      inset 0 0 40px rgba(255, 82, 82, .15),
      0 0 12px rgba(255, 82, 82, .2),
      0 0 30px rgba(255, 82, 82, .1);
    opacity: .45;
  }
  100% {
    border-color: transparent;
    box-shadow:
      inset 0 0 0 transparent,
      0 0 0 transparent;
    opacity: 0;
  }
}

/* Canvas */
#game-canvas {
  flex: 1;
  width: 100%;
  display: block;
  cursor: crosshair;
}

/* Game overlays (pause / victory / gameover) */
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fadeIn .25s ease;
}
.game-overlay.hidden { display: none; }

.overlay-box {
  background: var(--clr-panel);
  border: 4px solid var(--clr-dark);
  border-radius: 24px;
  padding: 34px 44px;
  text-align: center;
  box-shadow: 0 10px 0 rgba(0,0,0,.15);
  max-width: 400px;
  width: 88%;
}
.overlay-box h2 {
  font-family: var(--font-title);
  font-size: 2.2rem;
  margin-bottom: 12px;
  color: var(--clr-dark);
}
.overlay-box p {
  margin-bottom: 10px;
  color: #555;
  font-size: 1.05rem;
}
.victory-box h2 { color: var(--clr-green); text-shadow: 2px 2px 0 var(--clr-yellow); }
.gameover-box h2 { color: var(--clr-red); }

#victory-score, #gameover-score {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--clr-orange);
  margin-bottom: 18px;
}

/* ---------- Responsive ---------- */

/* ---------- Responsive — no scrollbars, everything shrinks to fit ---------- */

/* Kill all scrollbars */
.screen {
  overflow: hidden;
}
.menu-container, .panel, .overlay-box {
  max-height: 94vh;
  overflow: hidden;
}

/* Use viewport-relative sizing for key elements */
.menu-container {
  padding: clamp(14px, 4vh, 40px) clamp(18px, 4vw, 50px) clamp(16px, 4.5vh, 50px);
}
.title-banner { margin-bottom: clamp(10px, 2.5vh, 28px); }
.title-pilots { font-size: clamp(1.1rem, 3.2vh, 2.4rem); }
.title-bloon  { font-size: clamp(1.5rem, 4.8vh, 3.6rem); }
.subtitle     { font-size: clamp(0.7rem, 1.5vh, 1.15rem); margin-top: clamp(2px, 0.6vh, 6px); }

@media (max-width: 520px) {
  .title-pilots { -webkit-text-stroke: 1px var(--clr-dark); }
  .title-bloon  { -webkit-text-stroke: 1.5px var(--clr-dark); }
}

.menu-buttons { gap: clamp(4px, 1.3vh, 14px); }
.btn {
  font-size: clamp(0.8rem, 1.8vh, 1.3rem);
  padding: clamp(6px, 1.5vh, 14px) clamp(12px, 2.5vw, 28px);
  border-radius: clamp(8px, 1.5vh, 16px);
}
.btn-icon { font-size: 1.1em; }
.btn-back { margin-top: clamp(6px, 1.5vh, 18px); font-size: clamp(0.8rem, 1.6vh, 1.1rem); }

/* Auth responsive */
.auth-container {
  padding: clamp(20px, 4vh, 36px) clamp(22px, 4vw, 40px) clamp(18px, 3vh, 30px);
}
.auth-title { font-size: clamp(1.3rem, 3vh, 2rem); margin-bottom: clamp(10px, 2vh, 18px); }
.auth-tabs  { margin-bottom: clamp(12px, 2.5vh, 22px); }
.auth-tab   { font-size: clamp(0.85rem, 1.8vh, 1.1rem); padding: clamp(6px, 1.2vh, 10px) 0; }
.auth-label { font-size: clamp(0.7rem, 1.2vh, 0.85rem); }
.auth-input { font-size: clamp(0.8rem, 1.5vh, 1rem); padding: clamp(8px, 1.5vh, 12px) 14px; margin-bottom: clamp(8px, 1.5vh, 14px); }
.btn-auth-submit { font-size: clamp(0.9rem, 1.8vh, 1.2rem); padding: clamp(8px, 1.6vh, 13px) 0; }

.panel {
  padding: clamp(12px, 3vh, 36px) clamp(14px, 3.5vw, 42px) clamp(14px, 3.5vh, 42px);
  max-width: 560px;
  width: 92%;
  border-radius: clamp(14px, 2.5vh, 28px);
}
.panel-title { font-size: clamp(1.2rem, 3.2vh, 2.4rem); margin-bottom: clamp(6px, 1.5vh, 18px); }
.panel-text  { font-size: clamp(0.8rem, 1.4vh, 1.05rem); margin-bottom: clamp(8px, 1.8vh, 22px); }

.play-hero { margin-bottom: clamp(8px, 1.8vh, 22px); }
.hero-circle { width: clamp(50px, 12vh, 110px); height: clamp(50px, 12vh, 110px); }
.hero-label { font-size: clamp(0.7rem, 1.3vh, 1rem); }

.cust-layout { gap: clamp(6px, 1vw, 14px); max-height: clamp(320px, 80vh, 600px); }
.cust-menu { min-width: clamp(90px, 14vw, 140px); padding: clamp(6px, 1vh, 12px) clamp(6px, 0.8vw, 10px); gap: clamp(3px, 0.5vh, 6px); }
.cust-menu-title { font-size: clamp(0.8rem, 1.4vh, 1.1rem); }
.cust-cat { font-size: clamp(0.65rem, 1.1vh, 0.85rem); padding: clamp(4px, 0.8vh, 8px) clamp(6px, 0.8vw, 10px); }
#avatar-canvas { width: clamp(160px, 26vw, 280px); height: clamp(200px, 34vh, 340px); }
.cust-items { padding: clamp(8px, 1.2vh, 14px); gap: clamp(6px, 1vh, 10px); grid-template-columns: repeat(auto-fill, minmax(clamp(60px, 10vw, 90px), 1fr)); }
.cust-item-img, .cust-item-swatch, .cust-item-shoe { width: clamp(36px, 6vw, 56px); height: clamp(36px, 6vw, 56px); }
.cust-item-label { font-size: clamp(0.55rem, 0.9vh, 0.72rem); }
.cust-controls { padding: clamp(4px, 0.8vh, 8px) clamp(6px, 1vw, 12px); }
.cust-ctrl-label { font-size: clamp(0.55rem, 0.9vh, 0.7rem); }
.dpad-btn { width: clamp(22px, 3.5vw, 28px); height: clamp(22px, 3.5vw, 28px); font-size: clamp(0.55rem, 0.9vh, 0.7rem); }
.dpad-center { width: clamp(22px, 3.5vw, 28px); height: clamp(22px, 3.5vw, 28px); }
.size-slider { width: clamp(60px, 10vw, 90px); }
.size-label, .size-val { font-size: clamp(0.5rem, 0.8vh, 0.65rem); }
.leaderboard-panel { max-width: clamp(300px, 55vw, 460px); }
.lb-table th { font-size: clamp(0.75rem, 1.4vh, 1rem); padding: clamp(6px, 1vh, 10px) clamp(6px, 1vw, 12px); }
.lb-table td { font-size: clamp(0.7rem, 1.2vh, 0.9rem); padding: clamp(5px, 0.9vh, 9px) clamp(6px, 1vw, 12px); }
.lb-table-wrap { max-height: clamp(30vh, 50vh, 52vh); }

.help-grid { gap: clamp(6px, 1.2vh, 16px); }
.help-card { padding: clamp(8px, 1.5vh, 18px) clamp(6px, 1vw, 14px); }
.help-icon { font-size: clamp(1.1rem, 2.5vh, 2rem); }
.help-card h3 { font-size: clamp(0.85rem, 1.5vh, 1.15rem); }
.help-card p  { font-size: clamp(0.65rem, 1.1vh, 0.85rem); }

.option-row { padding: clamp(5px, 1vh, 12px) 0; }
.option-row label { font-size: clamp(0.8rem, 1.5vh, 1.1rem); min-width: clamp(60px, 10vw, 120px); }
.diff-btn { font-size: clamp(0.7rem, 1.2vh, 0.95rem); padding: clamp(3px, 0.6vh, 6px) clamp(8px, 1.5vw, 16px); }

.levels-grid { gap: clamp(6px, 1.2vh, 16px); }
.level-card { padding: clamp(8px, 1.5vh, 18px) clamp(6px, 1vw, 14px); }

.overlay-box {
  padding: clamp(14px, 3vh, 34px) clamp(16px, 3.5vw, 44px);
  border-radius: clamp(12px, 2vh, 24px);
}
.overlay-box h2 { font-size: clamp(1.1rem, 2.8vh, 2.2rem); margin-bottom: clamp(6px, 1.2vh, 12px); }
.overlay-box p { font-size: clamp(0.8rem, 1.3vh, 1.05rem); }

.ig-row { padding: clamp(5px, 1vh, 14px) 0; }
.ig-row label { font-size: clamp(0.8rem, 1.5vh, 1.15rem); }

.ig-options-box { min-width: unset; max-width: 420px; width: 88%; }
.pause-menu-box { min-width: unset; }

#health-bar-wrap { width: clamp(100px, 18vw, 180px); height: clamp(14px, 2.5vh, 22px); }
#game-hud { font-size: clamp(0.8rem, 1.6vh, 1.25rem); padding: clamp(4px, 1vh, 10px) clamp(10px, 2vw, 24px); }

/* Width-specific tweaks */
@media (max-width: 520px) {
  .help-grid     { grid-template-columns: 1fr; }
  .levels-grid   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .menu-container { max-width: 95%; }
  .panel { max-width: 95%; }
  .overlay-box { width: 95%; }
  .levels-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===================================================
   IN-GAME PAUSE SYSTEM
   =================================================== */

/* ---- Pause Button (bottom-left) ---- */
#pause-btn {
  position: absolute;
  bottom: 18px;
  left: 18px;
  z-index: 15;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--clr-dark);
  background: linear-gradient(180deg, #fff 0%, #e0e0e0 100%);
  color: var(--clr-dark);
  font-size: 1.1rem;
  letter-spacing: -4px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.2), 0 6px 14px rgba(0,0,0,.18);
  transition: transform .12s, box-shadow .12s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
}
#pause-btn:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 6px 0 rgba(0,0,0,.22), 0 10px 20px rgba(0,0,0,.2);
  background: linear-gradient(180deg, #fffde7 0%, #fff9c4 100%);
}
#pause-btn:active {
  transform: translateY(1px) scale(.96);
  box-shadow: 0 2px 0 rgba(0,0,0,.15);
}

/* ---- Scorestreak Boxes (right side, above speed button) ---- */
#streak-bar {
  position: absolute;
  right: 18px;
  bottom: 82px;          /* sits above the 52px speed button + gap */
  z-index: 15;
  display: flex;
  flex-direction: column-reverse;   /* box 1 at bottom, 9 at top */
  gap: 6px;
}
.streak-box {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 3px solid var(--clr-dark);
  background: linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(220,220,220,.88) 100%);
  box-shadow: 0 3px 0 rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.7);
  transition: transform .15s, background .2s, box-shadow .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--clr-dark);
  font-family: var(--font-title);
  opacity: .55;
}
.streak-box:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 0 rgba(0,0,0,.22), 0 6px 12px rgba(0,0,0,.15);
}
.streak-box.active {
  opacity: 1;
  border-color: var(--clr-orange);
  background: linear-gradient(180deg, #fffde7 0%, #fff9c4 100%);
  box-shadow: 0 3px 0 rgba(0,0,0,.2), 0 0 10px rgba(243,156,18,.4);
  cursor: pointer;
}
.streak-box.active:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 0 rgba(0,0,0,.22), 0 0 14px rgba(243,156,18,.55);
}
.streak-box .streak-box-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
}

/* ---- Speed (Fast Forward) Button (bottom-right) ---- */
#speed-btn {
  position: absolute;
  bottom: 18px;
  right: 18px;
  z-index: 15;
  height: 52px;
  padding: 0 18px;
  border-radius: 26px;
  border: 3px solid var(--clr-dark);
  background: linear-gradient(180deg, #fff 0%, #e0e0e0 100%);
  color: var(--clr-dark);
  font-size: .95rem;
  font-weight: 800;
  font-family: var(--font-title);
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.2), 0 6px 14px rgba(0,0,0,.18);
  transition: transform .12s, box-shadow .12s, background .15s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
#speed-btn:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 6px 0 rgba(0,0,0,.22), 0 10px 20px rgba(0,0,0,.2);
  background: linear-gradient(180deg, #fffde7 0%, #fff9c4 100%);
}
#speed-btn:active {
  transform: translateY(1px) scale(.96);
  box-shadow: 0 2px 0 rgba(0,0,0,.15);
}
#speed-btn.fast {
  background: linear-gradient(180deg, #fff9c4 0%, #f9a825 100%);
  border-color: #f57f17;
  color: #4e342e;
}

/* ---- Pause Menu Box ---- */
.pause-menu-box {
  min-width: 280px;
}
.pause-menu-box h2 {
  color: var(--clr-blue);
  text-shadow: 2px 2px 0 var(--clr-yellow);
  margin-bottom: 18px;
}
.pause-menu-box .btn {
  width: 100%;
  margin-bottom: 10px;
}
.pause-menu-box .btn:last-child { margin-bottom: 0; }

/* ---- In-Game Options Sub-overlay ---- */
.ig-options-box {
  min-width: 320px;
  max-width: 420px;
}
.ig-options-box h2 {
  color: var(--clr-orange);
  text-shadow: 2px 2px 0 var(--clr-yellow);
  margin-bottom: 20px;
}

.ig-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 2px dashed #d5d5d5;
}
.ig-row:last-of-type { border-bottom: none; }
.ig-row label {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--clr-dark);
  min-width: 100px;
  text-align: left;
}

/* Volume slider rows inside IG options */
.ig-vol-row {
  padding: 8px 0 14px;
  border-bottom: none !important;
}
.ig-slider {
  flex: 1;
  margin: 0 12px;
  accent-color: var(--clr-green);
  height: 6px;
  cursor: pointer;
}
.ig-vol-val {
  font-family: var(--font-title);
  font-size: .95rem;
  color: var(--clr-dark);
  min-width: 28px;
  text-align: right;
}

/* Key-bind button */
.keybind-btn {
  font-family: var(--font-title);
  font-size: 1rem;
  padding: 8px 22px;
  border: 3px solid var(--clr-dark);
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(180deg, #eceff1 0%, #cfd8dc 100%);
  color: var(--clr-dark);
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
  transition: transform .1s, background .15s, box-shadow .1s;
  min-width: 120px;
  text-align: center;
  letter-spacing: 1px;
}
.keybind-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(0,0,0,.15);
}
.keybind-btn.listening {
  background: linear-gradient(180deg, #fff9c4 0%, #fff176 100%);
  border-color: var(--clr-orange);
  animation: keybindPulse 0.8s ease-in-out infinite;
}
@keyframes keybindPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243,156,18,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(243,156,18,0); }
}

/* Toggle switch */
.tog-switch {
  width: 68px;
  height: 34px;
  border-radius: 17px;
  border: 3px solid var(--clr-dark);
  background: var(--clr-green);
  position: relative;
  cursor: pointer;
  transition: background .25s;
  display: flex;
  align-items: center;
  box-shadow: 0 3px 0 rgba(0,0,0,.12);
}
.tog-switch.off {
  background: #bdbdbd;
}
.tog-knob {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--clr-dark);
  position: absolute;
  left: 3px;
  transition: left .25s cubic-bezier(.4,.0,.2,1);
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.tog-switch:not(.off) .tog-knob {
  left: 35px;
}
.tog-label {
  position: absolute;
  font-family: var(--font-title);
  font-size: .72rem;
  color: #fff;
  letter-spacing: 1px;
  pointer-events: none;
  width: 100%;
  text-align: center;
}

/* ---- In-Game Levels Sub-overlay ---- */
/* ---- In-Game Item Shop Sub-overlay ---- */
.ig-shop-box {
  min-width: 600px;
  max-width: 860px !important;
  width: 90% !important;
  padding: 28px 32px;
  background:
    linear-gradient(180deg, #fdf6e3 0%, #f5e6c8 100%);
  border: 5px solid #8d6e63;
  border-radius: 22px;
  box-shadow:
    0 10px 0 rgba(0,0,0,.15),
    inset 0 2px 0 rgba(255,255,255,.5),
    0 0 40px rgba(141,110,99,.25);
  position: relative;
  overflow-y: auto !important;
  max-height: 90vh !important;
}
/* Scroll top / bottom curl accents */
.ig-shop-box::before,
.ig-shop-box::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  height: 18px;
  border-radius: 50%;
  background: rgba(141,110,99,.12);
}
.ig-shop-box::before { top: -9px; }
.ig-shop-box::after  { bottom: -9px; }

.ig-shop-box h2 {
  color: #5d4037;
  text-shadow: 2px 2px 0 var(--clr-yellow);
  margin-bottom: 16px;
  font-size: 1.8rem;
}

.shop-columns {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  max-height: 52vh;
  overflow-y: auto;
}
.shop-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.shop-col-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--clr-dark);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: .5px;
  text-shadow: 1px 1px 0 rgba(0,0,0,.08);
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  min-height: 0;
}
.shop-item {
  aspect-ratio: 1;
  min-width: 48px;
  min-height: 48px;
  border-radius: 12px;
  border: 3px solid var(--clr-dark);
  background: linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(230,230,230,.9) 100%);
  box-shadow: 0 3px 0 rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.6);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--clr-dark);
  font-family: var(--font-title);
}
.shop-item:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 5px 0 rgba(0,0,0,.18), 0 6px 14px rgba(0,0,0,.12);
  border-color: var(--clr-orange);
}
.shop-item:active {
  transform: translateY(1px) scale(.96);
  box-shadow: 0 1px 0 rgba(0,0,0,.1);
}
.shop-item.selected {
  border-color: var(--clr-green);
  background: linear-gradient(180deg, #e8f5e9 0%, #c8e6c9 100%);
  box-shadow: 0 3px 0 rgba(0,0,0,.14), 0 0 8px rgba(76,175,80,.35);
}

.ig-levels-box {
  min-width: 340px;
  max-width: 480px;
}
.ig-levels-box h2 {
  color: var(--clr-purple);
  text-shadow: 2px 2px 0 var(--clr-yellow);
  margin-bottom: 16px;
}

.ig-levels-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
  max-height: 320px;
  overflow-y: auto;
}

.ig-lv-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px 10px;
  border-radius: 14px;
  border: 3px solid var(--clr-dark);
  background: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.1);
  position: relative;
  transition: transform .12s;
}
.ig-lv-card.unlocked:hover {
  transform: translateY(-3px);
}
.ig-lv-card .ig-lv-num {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--clr-blue);
}
.ig-lv-card .ig-lv-name {
  font-size: .78rem;
  font-weight: 800;
  color: #444;
  margin: 2px 0 6px;
}
.ig-lv-card .ig-lv-stars {
  display: flex;
  gap: 2px;
}
.ig-lv-card .ig-lv-stars span {
  font-size: 1rem;
  color: var(--clr-yellow);
}

/* Locked / caged level card */
.ig-lv-card.locked {
  background: #d5d8dc;
  opacity: .65;
  cursor: not-allowed;
}
.ig-lv-card.locked .ig-lv-num {
  color: #888;
}
/* Cage bars overlay */
.ig-lv-card.locked::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    rgba(60,60,60,.25) 8px,
    rgba(60,60,60,.25) 11px
  );
  pointer-events: none;
}
/* Lock icon floater */
.ig-lv-card.locked::before {
  content: '🔒';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 1rem;
}

/* Current level highlight */
.ig-lv-card.current {
  border-color: var(--clr-orange);
  box-shadow: 0 0 0 3px rgba(243,156,18,.35), 0 4px 0 rgba(0,0,0,.1);
}
.ig-lv-card.current::before {
  content: '▶';
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: .8rem;
  color: var(--clr-orange);
}

/* ---- Autosave Toast ---- */
#autosave-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: linear-gradient(180deg, #37474f 0%, #263238 100%);
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.1rem;
  padding: 16px 30px;
  border-radius: 18px;
  border: 3px solid var(--clr-yellow);
  box-shadow: 0 6px 0 rgba(0,0,0,.25), 0 10px 30px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 500;
  white-space: nowrap;
  transition: transform .5s cubic-bezier(.34,1.56,.64,1);
  letter-spacing: .5px;
}
#autosave-toast.show {
  transform: translateX(-50%) translateY(0);
}
#autosave-toast.hidden { display: none; }
.toast-icon { font-size: 1.5rem; }
.toast-text { line-height: 1.3; }
.toast-dots {
  display: inline-block;
  min-width: 18px;
  text-align: left;
}

@keyframes dotBounce {
  0%   { content: '';    }
  25%  { content: '.';   }
  50%  { content: '..';  }
  75%  { content: '...'; }
  100% { content: '';    }
}

/* ---- Freeze Tag Timer (under health bar) ---- */
#freeze-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 16px;
  background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%);
  border: 2px solid #fff;
  border-radius: 10px;
  font-family: var(--font-title);
  font-size: 1rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(2,136,209,.5);
  animation: freezePulse 1.2s ease-in-out infinite;
}
#freeze-timer.hidden { display: none; }
#freeze-timer-icon {
  font-size: 1.2rem;
  animation: snowflakeSpin 3s linear infinite;
}
@keyframes freezePulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(2,136,209,.5); }
  50%      { box-shadow: 0 2px 16px rgba(79,195,247,.8), 0 0 24px rgba(79,195,247,.4); }
}
@keyframes snowflakeSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- Shop Item with Image/Name/Price ---- */
#shop-streaks {
  row-gap: 32px;
  column-gap: 8px;
  padding-top: 14px;
  padding-bottom: 14px;
}
#shop-streaks .shop-item {
  position: relative;
  overflow: visible;
}
.shop-item-name {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-title);
  font-size: .6rem;
  color: var(--clr-dark);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}
.shop-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 9px;
  z-index: 0;
}
.shop-item-price {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-title);
  font-size: .6rem;
  color: #f57f17;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(0,0,0,.1);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}
.shop-item-streak.owned {
  border-color: var(--clr-green);
  background: linear-gradient(180deg, #e8f5e9 0%, #c8e6c9 100%);
  opacity: .65;
  pointer-events: none;
}
.shop-item-streak.cant-afford {
  opacity: .45;
}
