/* Stack Tower — game.css: canvas layout + HUD */

:root {
  --neon-blue: #4dd8ff;
  --neon-purple: #b06bff;
  --neon-pink: #ff5ec4;
  --neon-orange: #ffab4d;
  --neon-green: #5dffb0;
  --bg-navy: #0b0a1f;
  --bg-purple: #1a0f33;
  --bg-black: #05040a;
  --text-light: #eef0ff;
  --text-dim: #8b8bb0;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 20%, var(--bg-purple) 0%, var(--bg-navy) 45%, var(--bg-black) 100%);
}

#bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#hud[hidden] { display: none; }

.hud-top {
  position: absolute;
  top: calc(14px + var(--safe-top));
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 16px;
}

.hud-score, .hud-height {
  display: flex;
  flex-direction: column;
  min-width: 64px;
}
.hud-height { align-items: flex-end; }

.hud-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
  font-weight: 600;
}
.hud-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-light);
  text-shadow: 0 0 12px rgba(77, 216, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

#top-controls {
  /* Absolute + left:50%/translateX centers this cluster on the true
     viewport midpoint, independent of the SCORE/HEIGHT text widths on
     either side of it (a plain flex `space-between` middle child only
     lands at 50% when both flanking children happen to be equal width —
     SCORE and HEIGHT rarely are, since their digit counts differ). */
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Deliberately dark + fairly opaque (not just a light frosted tint) so
     the icon reads with consistent contrast against any of the 5 neon
     theme backgrounds behind it, including bright glow blobs — a light
     translucent chip washed out against lighter theme colors. */
  background: rgba(6, 4, 16, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  font-size: 16px;
  /* Explicit light color (not just inherited) so SVG icons using
     stroke="currentColor" — e.g. the fullscreen icon — are actually
     visible. Emoji glyphs (🔊/🎵/⚙/⏸) render in their own inherent colors
     regardless of this, so it's a no-op for those, purely additive. */
  color: var(--text-light);
  transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn[hidden] { display: none; }
.icon-btn.muted { opacity: 0.45; }
.icon-btn.active {
  background: rgba(77, 216, 255, 0.22);
  border-color: var(--neon-blue);
}

.combo-banner {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  animation: combo-pop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.combo-banner[hidden] { display: none; }
.combo-banner #combo-text {
  display: block;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 18px var(--neon-blue), 0 0 34px var(--neon-purple);
}
.combo-banner #combo-multiplier {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--neon-pink);
  text-shadow: 0 0 12px var(--neon-pink);
}

@keyframes combo-pop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.milestone-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  animation: milestone-in 1.4s ease forwards;
}
.milestone-banner[hidden] { display: none; }
.milestone-title {
  display: block;
  font-size: 15px;
  letter-spacing: 3px;
  font-weight: 700;
  color: var(--neon-orange);
  text-shadow: 0 0 12px var(--neon-orange);
}
.milestone-value {
  display: block;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 16px var(--neon-blue);
  white-space: nowrap;
}
.milestone-unlock {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--neon-orange);
  text-shadow: 0 0 10px var(--neon-orange);
  white-space: nowrap;
}
.milestone-unlock[hidden] { display: none; }
@keyframes milestone-in {
  0% { opacity: 0; transform: translate(-50%, -60%); }
  15% { opacity: 1; transform: translate(-50%, -50%); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%); }
}

@media (min-width: 700px) {
  .hud-value { font-size: 26px; }
}
