/* === Brick Breaker - Cartoon Arcade Style === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #0b0e2a;
  --bg-playfield: #141838;
  --surface: #ffffff;
  --ink: #111827;
  --outline: #101014;
  --cyan: #2dd4bf;
  --gold: #ffd447;
  --lime: #74f05d;
  --red: #ff405d;
  --font-title: Impact, "Arial Black", system-ui;
  --font-hud: Arial, system-ui, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  font-family: var(--font-hud);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#game-wrapper {
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%; height: 100%;
  background: var(--bg-playfield);
}

/* === HUD === */
.hud {
  position: fixed;
  top: 12px; left: 0; right: 0;
  display: flex; justify-content: center; align-items: flex-start;
  gap: 12px;
  padding: 0 16px;
  pointer-events: none;
  z-index: 10;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--surface);
  border: 3px solid var(--outline);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--outline), 0 6px 16px rgba(0,0,0,0.25);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  line-height: 1;
}

.score-chip { gap: 6px; }
.level-chip { min-width: 56px; justify-content: center; }
.lives-chip { font-size: 16px; letter-spacing: 2px; }

.hud-icon {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--outline);
}

/* === Interaction Prompt === */
.interaction-prompt {
  position: fixed;
  left: 50%; bottom: 14%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(16,16,20,0.82);
  color: white;
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 14px;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.4s ease;
}
.interaction-prompt.hidden { opacity: 0; }

/* === Overlay System === */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s ease;
}
.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a1f4e 0%, #0b0e2a 70%);
  opacity: 0.95;
}
.overlay-bg.translucent {
  background: rgba(11,14,42,0.82);
}
.overlay-bg.translucent-dark {
  background: rgba(0,0,0,0.88);
}

.overlay-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
  padding: 20px;
  text-align: center;
}

/* === Title === */
.game-title {
  font-family: var(--font-title);
  font-size: clamp(48px, 12vw, 100px);
  color: #fff;
  -webkit-text-stroke: 4px var(--outline);
  text-shadow: 0 6px 0 var(--outline), 0 12px 28px rgba(0,0,0,0.35);
  letter-spacing: -1px;
  line-height: 0.88;
  margin-bottom: 4px;
}

.subtitle {
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: clamp(14px, 2.5vw, 20px);
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.controls-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-hud);
  font-weight: 600;
  font-size: clamp(11px, 1.8vw, 14px);
  color: rgba(255,255,255,0.7);
  margin: 8px 0;
}

/* === Buttons === */
.game-button {
  font-family: var(--font-hud);
  font-weight: 900;
  font-size: clamp(18px, 3vw, 26px);
  padding: 14px 48px;
  border: 3px solid var(--outline);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff17a, var(--gold));
  color: var(--outline);
  box-shadow: 0 6px 0 var(--outline), 0 12px 28px rgba(0,0,0,0.25);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.game-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--outline), 0 16px 32px rgba(0,0,0,0.3);
}
.game-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--outline), 0 6px 16px rgba(0,0,0,0.2);
}
.game-button.secondary {
  background: linear-gradient(180deg, #f0f0f0, #d4d4d4);
  font-size: clamp(14px, 2vw, 18px);
  padding: 10px 32px;
}

.play-button {
  padding: 18px 72px;
  font-size: clamp(22px, 4vw, 34px);
  margin-top: 8px;
}

/* === Pause Title === */
.pause-title {
  font-family: var(--font-title);
  font-size: clamp(42px, 10vw, 80px);
  color: #fff;
  -webkit-text-stroke: 4px var(--outline);
  text-shadow: 0 6px 0 var(--outline);
  letter-spacing: 4px;
}

/* === Level Clear / Win / Game Over === */
.level-clear-title {
  font-family: var(--font-title);
  font-size: clamp(36px, 8vw, 64px);
  color: var(--gold);
  -webkit-text-stroke: 3px var(--outline);
  text-shadow: 0 5px 0 var(--outline), 0 10px 30px rgba(255,212,71,0.3);
  letter-spacing: 2px;
}

.win-title {
  font-family: var(--font-title);
  font-size: clamp(40px, 9vw, 72px);
  color: var(--lime);
  -webkit-text-stroke: 3px var(--outline);
  text-shadow: 0 5px 0 var(--outline), 0 10px 30px rgba(116,240,93,0.3);
  letter-spacing: 2px;
}

.gameover-title {
  font-family: var(--font-title);
  font-size: clamp(40px, 9vw, 72px);
  color: var(--red);
  -webkit-text-stroke: 3px var(--outline);
  text-shadow: 0 5px 0 var(--outline), 0 10px 30px rgba(255,64,93,0.3);
  letter-spacing: 2px;
}

.complete-info {
  font-family: var(--font-hud);
  font-weight: 800;
  font-size: clamp(18px, 3vw, 28px);
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.complete-info-small {
  font-family: var(--font-hud);
  font-weight: 600;
  font-size: clamp(13px, 2vw, 18px);
  color: rgba(255,255,255,0.65);
}

/* === Level Intro Banner === */
#level-intro-banner {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#level-intro-banner.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#level-intro-banner .banner-text {
  font-family: var(--font-title);
  font-size: clamp(32px, 7vw, 56px);
  color: #fff;
  -webkit-text-stroke: 3px var(--outline);
  text-shadow: 0 5px 0 var(--outline), 0 12px 30px rgba(0,0,0,0.4);
  text-align: center;
  line-height: 1.2;
  letter-spacing: 1px;
}
#level-intro-banner .banner-sub {
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: clamp(14px, 2.5vw, 22px);
  color: var(--gold);
  text-align: center;
  margin-top: 4px;
}

/* === Responsive === */
@media (max-width: 600px) {
  .hud { gap: 6px; padding: 0 8px; top: 8px; }
  .hud-chip { padding: 5px 8px; border-width: 2px; border-radius: 10px; font-size: 12px; }
  .lives-chip { font-size: 13px; letter-spacing: 1px; }
  .hud-icon { width: 14px; height: 14px; }
  .interaction-prompt { font-size: 12px; padding: 8px 14px; bottom: 10%; }
}
