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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05070d;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #fff;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Mirrored webcam feed, dimmed behind the game */
#webcam {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%) scaleX(-1);
  object-fit: cover;
  filter: brightness(0.45) saturate(1.1);
  z-index: 0;
}

/* Soft dojo-lantern glows in the corners for atmosphere */
.lantern-glow {
  position: absolute;
  width: 42vw;
  height: 42vw;
  max-width: 420px;
  max-height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,150,60,0.16), rgba(255,150,60,0) 70%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 1;
}
.lantern-glow.top-left { top: -12%; left: -12%; }
.lantern-glow.bottom-right { bottom: -12%; right: -12%; background: radial-gradient(circle, rgba(255,60,90,0.14), rgba(255,60,90,0) 70%); }

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Darkened edges above the canvas, purely decorative */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%);
}

/* Red pulse on bomb hits */
#damage-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  opacity: 0;
}
#damage-flash.active {
  animation: flashHit 0.4s ease-out;
}
@keyframes flashHit {
  0% { opacity: 0.75; background: rgba(255, 30, 30, 0.6); }
  100% { opacity: 0; background: rgba(255, 30, 30, 0.6); }
}

/* Screen shake on bomb hits */
#stage.shake {
  animation: shakeStage 0.4s ease;
}
@keyframes shakeStage {
  0% { transform: translate(0, 0); }
  10% { transform: translate(-10px, -6px); }
  20% { transform: translate(10px, 6px); }
  30% { transform: translate(-8px, 8px); }
  40% { transform: translate(8px, -8px); }
  50% { transform: translate(-6px, 4px); }
  60% { transform: translate(6px, -4px); }
  70% { transform: translate(-4px, 2px); }
  80% { transform: translate(4px, -2px); }
  100% { transform: translate(0, 0); }
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 36px;
  pointer-events: none;
  z-index: 5;
}

#score {
  font-size: 56px;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(255, 200, 60, 0.7), 0 2px 4px rgba(0,0,0,0.6);
  color: #ffd93b;
  letter-spacing: 1px;
}

#lives {
  display: flex;
  gap: 8px;
}

#lives .life {
  font-size: 34px;
  color: #ff3b5c;
  text-shadow: 0 0 12px rgba(255, 59, 92, 0.8);
  transition: transform 0.2s, opacity 0.2s;
}

#lives .life.lost {
  opacity: 0.15;
  transform: scale(0.6);
  color: #555;
  text-shadow: none;
}

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(10,14,28,0.55) 0%, rgba(3,4,10,0.88) 100%);
  z-index: 10;
  padding: 20px;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  font-size: clamp(42px, 9vw, 92px);
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0,0,0,0.6);
}

.overlay h1 .accent {
  color: #ff3b5c;
  text-shadow: 0 0 24px rgba(255, 59, 92, 0.8);
}

.tagline {
  margin-top: 14px;
  font-size: 20px;
  color: #cfd6e6;
}

.hint {
  margin-top: 18px;
  font-size: 14px;
  color: #8b93a8;
  max-width: 420px;
}

.status-text {
  margin-top: 14px;
  font-size: 15px;
  min-height: 20px;
  color: #ff8b8b;
}

button {
  margin-top: 32px;
  padding: 16px 42px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #1a0a0a;
  background: linear-gradient(180deg, #ffe066, #ffb400);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 0 #b57900, 0 10px 24px rgba(255, 180, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #b57900, 0 4px 12px rgba(255, 180, 0, 0.35);
}

#countdown-number {
  font-size: 180px;
  font-weight: 900;
  color: #ffd93b;
  text-shadow: 0 0 40px rgba(255, 200, 60, 0.8);
  animation: pop 1s ease;
}

@keyframes pop {
  0% { transform: scale(0.3); opacity: 0; }
  30% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.score-row {
  display: flex;
  gap: 48px;
  margin-top: 28px;
}

.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-label {
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8b93a8;
}

.score-value {
  font-size: 52px;
  font-weight: 800;
  color: #ffd93b;
  text-shadow: 0 0 18px rgba(255, 200, 60, 0.6);
}

.hidden {
  display: none !important;
}

#combo-banner {
  position: absolute;
  z-index: 6;
  font-size: 34px;
  font-weight: 800;
  color: #ffd93b;
  text-shadow: 0 0 16px rgba(255,200,60,0.8);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: comboPop 0.7s ease forwards;
}

@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}
