/* The cabinet: fills the whole browser window edge-to-edge, screen is inset within it */
#cabinet {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  box-sizing: border-box;
  padding: clamp(6px, 2.4vw, 46px);
}

.grille {
  position: absolute;
  top: clamp(4px, 1.4vw, 16px);
  width: clamp(26px, 4.6vw, 60px);
  height: clamp(26px, 4.6vw, 60px);
  border-radius: 50%;
  background-color: #0d0a07;
  background-image: radial-gradient(circle, rgba(226, 201, 142, 0.4) 1px, transparent 1.4px);
  background-size: 6px 6px;
  background-position: center;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9), 0 0 0 2px var(--cabinet-trim);
}

.grille-left { left: clamp(4px, 1.4vw, 20px); }
.grille-right { right: clamp(4px, 1.4vw, 20px); }

@media (max-width: 640px) {
  .grille { display: none; }
}

/* Marquee light strip along the top of the cabinet — real chasing bulbs, arcade-sign style */
.marquee-strip {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: min(70%, 640px);
  height: 6px;
  pointer-events: none;
  z-index: 1;
}

.marquee-strip::before,
.marquee-strip::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--gold-bright) 2px, transparent 2.6px);
  background-size: 22px 6px;
  background-position: 0 0;
  filter: drop-shadow(0 0 3px #fff8e6) drop-shadow(0 0 6px var(--gold-bright));
}

.marquee-strip::before {
  animation: bulbs-chase-a 0.9s steps(1) infinite;
}

.marquee-strip::after {
  background-position: 11px 0;
  animation: bulbs-chase-b 0.9s steps(1) infinite;
}

#game-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  border-radius: clamp(3px, 1vw, 16px);
  overflow: hidden;
  background: var(--space-bg);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 44px rgba(226, 201, 142, 0.15);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--space-bg);
  touch-action: none;
}

#screen-fx {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, 0) 0px, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0.12) 3px),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.4) 100%);
}

.toggle-row {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  z-index: 5;
  display: flex;
  gap: 8px;
}

#mute-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(226, 201, 142, 0.4);
  background: rgba(8, 8, 8, 0.6);
  color: var(--space-gold);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}

#mute-btn.muted {
  color: rgba(226, 201, 142, 0.35);
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(10px + env(safe-area-inset-top)) 84px 10px calc(14px + env(safe-area-inset-left));
  font-size: clamp(12px, 3vw, 14px);
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(226, 201, 142, 0.6);
  pointer-events: none;
  z-index: 2;
  color: var(--space-gold);
}

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

#lives span {
  width: 10px;
  height: 10px;
  background: var(--space-danger);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  filter: drop-shadow(0 0 4px var(--space-danger));
}

#powerup-bars {
  position: absolute;
  top: calc(38px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 2;
}

.powerup-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(160px, 42vw);
}

.powerup-label {
  font-size: 9px;
  letter-spacing: 1px;
  width: 40px;
  flex-shrink: 0;
  text-align: right;
  text-shadow: 0 0 6px rgba(226, 201, 142, 0.6);
}

.powerup-bar.rapid .powerup-label { color: var(--gold-bright); }
.powerup-bar.shield .powerup-label { color: var(--shield); }

.powerup-track {
  flex: 1;
  height: 4px;
  background: rgba(245, 240, 234, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.powerup-fill {
  height: 100%;
  width: 100%;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.powerup-bar.rapid .powerup-fill {
  background: var(--gold-bright);
  box-shadow: 0 0 5px var(--gold-bright);
}

.powerup-bar.shield .powerup-fill {
  background: var(--shield);
  box-shadow: 0 0 5px var(--shield);
}

#pause-hint {
  position: absolute;
  bottom: calc(8px + env(safe-area-inset-bottom));
  right: calc(12px + env(safe-area-inset-right));
  font-size: 10px;
  opacity: 0.4;
  letter-spacing: 1px;
  z-index: 2;
  color: var(--space-gold);
}

.screen-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(226, 201, 142, 0.9), transparent 70%);
  pointer-events: none;
  z-index: 6;
  opacity: 0;
}

.screen-flash.fire {
  animation: flash-pop 0.5s ease-out;
}

@keyframes flash-pop {
  0% { opacity: 0; }
  15% { opacity: 0.9; }
  100% { opacity: 0; }
}
