* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --court: #1d4e89;        /* pickleball court blue */
  --court-dark: #122f52;
  --clay: #f2a83b;         /* warm accent */
  --line: #f5f1e6;         /* court line white */
  --ball: #e8f04a;         /* pickleball yellow */
}

html, body {
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #1a3f6e 0%, #0a1e38 100%);
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: var(--line);
  user-select: none;
  -webkit-user-select: none;
}

#game-shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  display: flex;
  flex-direction: column;
}

#hud {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--court-dark);
  font-weight: 700;
  letter-spacing: 1px;
  font-size: clamp(9px, 2.5vw, 14px);
  flex-wrap: wrap;
}

.hud-item span { color: var(--ball); margin-left: 6px; }

#canvas-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(6, 25, 19, 0.88);
  text-align: center;
  transition: opacity 0.3s;
}

#overlay.hidden { opacity: 0; pointer-events: none; }

#overlay h1 {
  font-size: clamp(24px, 6vw, 52px);
  letter-spacing: 6px;
  color: var(--ball);
  text-shadow: 0 0 24px rgba(212, 240, 74, 0.35);
}

#overlay .subtitle {
  font-size: clamp(10px, 2.5vw, 14px);
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--clay);
  font-weight: 700;
}

#overlay-msg { font-size: clamp(13px, 3.5vw, 18px); max-width: 88vw; }

.controls-hint { font-size: clamp(10px, 2.8vw, 13px); opacity: 0.7; max-width: 92vw; }

#start-btn {
  margin-top: 8px;
  padding: 14px 42px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--court-dark);
  background: var(--ball);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

#start-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 28px rgba(212, 240, 74, 0.5);
}

#footer-hint {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  opacity: 0.5;
}

/* ---- 3D edition effects ---- */

#flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: #fff;
  transition: opacity 0.35s ease-out;
}

#banner {
  position: absolute;
  top: 38%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(24px, 7vw, 54px);
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--ball);
  text-shadow: 0 0 30px rgba(212, 240, 74, 0.6);
  pointer-events: none;
  transition: none;
}

#banner.hidden { display: none; }

#banner.pop { animation: banner-pop 1.4s ease-out forwards; }

@keyframes banner-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  15%  { transform: scale(1.15); opacity: 1; }
  30%  { transform: scale(1); }
  75%  { opacity: 1; }
  100% { transform: scale(1.05); opacity: 0; }
}

.floater {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 20px;
  color: var(--ball);
  text-shadow: 0 0 12px rgba(212, 240, 74, 0.8);
  pointer-events: none;
  animation: float-up 0.9s ease-out forwards;
}

@keyframes float-up {
  0%   { opacity: 1; margin-top: 0; }
  100% { opacity: 0; margin-top: -60px; }
}

/* ---- power-up chips ---- */
#active-fx {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}

.fx-chip {
  background: rgba(6, 25, 19, 0.85);
  border: 1px solid var(--ball);
  color: var(--ball);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ---- charge meter ---- */
#charge-wrap {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 10px;
  border: 1px solid rgba(245, 241, 230, 0.5);
  border-radius: 999px;
  background: rgba(6, 25, 19, 0.6);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

#charge-wrap.visible { opacity: 1; }

#charge-bar {
  height: 100%;
  width: 0%;
  background: var(--ball);
  border-radius: 999px;
  transition: background 0.1s;
}

#charge-bar.drive { background: #f04a4a; }

/* ---- power-up showcase (start screen) ---- */
#bonus-showcase { margin-top: 6px; }

.bonus-intro {
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--ball);
  font-size: clamp(11px, 3vw, 15px);
}

#bonus-grid {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.bonus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 92px;
}

.bonus svg {
  width: clamp(38px, 13vw, 62px);
  height: clamp(38px, 13vw, 62px);
  box-sizing: border-box;
  padding: clamp(8px, 2.6vw, 13px);
  border: 2px dashed var(--c);
  border-radius: 50%;
  fill: #fff;
  animation: bonus-spin 24s linear infinite;
}

.bonus span {
  font-size: clamp(7px, 2vw, 10px);
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.85;
}

@keyframes bonus-spin {
  to { transform: rotate(360deg); }
}

/* ---- countdown + tutorial hint ---- */
#countdown {
  position: absolute;
  top: 34%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(60px, 20vw, 120px);
  font-weight: 800;
  color: var(--ball);
  text-shadow: 0 0 40px rgba(232, 240, 74, 0.5);
  pointer-events: none;
}

#countdown.hidden { display: none; }

#countdown.pop { animation: cd-pop 0.7s ease-out forwards; }

@keyframes cd-pop {
  0%   { transform: scale(1.6); opacity: 0; }
  20%  { transform: scale(1); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: scale(0.9); opacity: 0; }
}

#tut-hint {
  position: absolute;
  top: 58%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(10px, 3vw, 15px);
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--line);
  opacity: 0.85;
  pointer-events: none;
  animation: tut-pulse 1.2s ease-in-out infinite;
}

#tut-hint.hidden { display: none; }

@keyframes tut-pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.95; }
}

/* ---- lives ball icons + score tick ---- */
#lives { display: inline-flex; gap: 5px; margin-left: 6px; vertical-align: middle; }

.ball-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ball);
  box-shadow: 0 0 8px rgba(232, 240, 74, 0.7);
  display: inline-block;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.ball-dot.lost {
  background: #4a4a4a;
  box-shadow: none;
  transform: scale(0.8);
}

.ball-dot.pop { animation: dot-pop 0.4s ease-out; }

@keyframes dot-pop {
  0% { transform: scale(1.8); }
  100% { transform: scale(0.8); }
}

#score { display: inline-block; }

#score.tick { animation: score-tick 0.18s ease-out; }

@keyframes score-tick {
  0% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---- score screen + bonus announcement ---- */
#overlay.score-mode {
  background: rgba(6, 25, 19, 0.55);
  backdrop-filter: blur(6px);
}

#overlay.score-mode h1 {
  font-size: 24px;
  letter-spacing: 6px;
  color: var(--ball);
  text-shadow: none;
}

.big-score {
  display: block;
  font-size: clamp(40px, 12vw, 76px);
  font-weight: 800;
  color: #fff;
  letter-spacing: 2px;
}

.sub-score {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  letter-spacing: 2px;
  opacity: 0.75;
}

/* "powerup" — NOT "bonus": .bonus is taken by the showcase tiles (width: 92px) */
#banner.powerup {
  font-size: clamp(20px, 5vw, 44px);
  letter-spacing: 14px;
  padding-left: 14px; /* compensate trailing letter-spacing so text centers */
  color: #fff;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.45);
}

/* long labels like DEFENSIVE WALL must fit narrow screens on one line */
@media (max-width: 480px) {
  #banner.powerup {
    letter-spacing: 5px;
    padding-left: 5px;
  }
}

