* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, #2a1030 0%, transparent 55%),
    radial-gradient(ellipse at 20% 80%, #0a2030 0%, transparent 40%),
    #07040a;
  color: #ffe7c2;
  font-family: 'VT323', monospace;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: stretch;
}

.arcade-back {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 40;
  background: #1a1018;
  border: 2px solid #ff4ad8;
  color: #7dfffa;
  padding: 8px 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  text-decoration: none;
  box-shadow:
    0 3px 0 #0a0408,
    0 0 12px rgba(255, 74, 216, 0.45),
    0 0 4px rgba(125, 255, 250, 0.35);
}
.arcade-back:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a0408; }

#fps {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 40;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(9px, 2.6vw, 11px);
  color: #7dfffa;
  background: rgba(10, 4, 12, 0.72);
  border: 2px solid #ff4ad8;
  padding: 6px 8px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(125, 255, 250, 0.55);
  pointer-events: none;
  min-width: 4.6em;
  text-align: center;
  box-shadow: 0 0 10px rgba(255, 74, 216, 0.35);
}
#fps.low {
  color: #ff9a2a;
  border-color: #ff7a1a;
  text-shadow: 0 0 8px rgba(255, 154, 42, 0.55);
}
#fps.crit {
  color: #ff6b9a;
  border-color: #ff4ad8;
}


#hud {
  position: relative;
  z-index: 10;
  width: min(720px, 100%);
  padding: 44px 14px 6px;
  text-align: center;
}
.hud-row {
  display: flex;
  justify-content: space-between;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(9px, 2.4vw, 11px);
  color: #ff4ad8;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(255, 74, 216, 0.55);
}
.hud-row b {
  color: #ffe08a;
  text-shadow: 0 0 10px rgba(255, 224, 138, 0.7);
}
#credits.punch b,
#wins.punch b {
  animation: hudPunch 0.45s ease-out;
  color: #7dfffa;
  text-shadow: 0 0 14px #7dfffa, 0 0 28px #ff4ad8;
}
@keyframes hudPunch {
  0% { transform: scale(1.55); filter: brightness(1.6); }
  100% { transform: scale(1); filter: brightness(1); }
}
#credits, #wins { display: inline-block; }
#credits b, #wins b { display: inline-block; }

#status {
  margin-top: 8px;
  font-size: clamp(18px, 4.5vw, 22px);
  color: #7dfffa;
  letter-spacing: 0.06em;
  min-height: 1.2em;
  text-shadow: 0 0 10px rgba(125, 255, 250, 0.45);
  animation: statusPulse 2.4s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; text-shadow: 0 0 16px rgba(125, 255, 250, 0.75), 0 0 4px #ff4ad8; }
}

#canvas-wrap {
  position: relative;
  flex: 1;
  width: min(720px, 100%);
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
#game {
  width: 100%;
  height: 100%;
  display: block;
  background: #0c0810;
  border: 4px solid #ff7a1a;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px #000,
    0 0 18px rgba(255, 122, 26, 0.35),
    0 0 36px rgba(170, 68, 255, 0.22),
    0 10px 0 #0a0408,
    inset 0 0 40px rgba(0,0,0,0.35);
}

/* Screen flash / chroma overlays (phone-safe, brief) */
#fx-flash {
  pointer-events: none;
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  background: radial-gradient(circle at 50% 40%, rgba(255, 240, 180, 0.55), transparent 65%);
  opacity: 0;
  z-index: 5;
  mix-blend-mode: screen;
}
#fx-flash.on {
  animation: flashPop 0.35s ease-out;
}
@keyframes flashPop {
  0% { opacity: 0.7; }
  100% { opacity: 0; }
}
#fx-chroma {
  pointer-events: none;
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  box-shadow:
    inset 4px 0 12px rgba(0, 255, 255, 0),
    inset -4px 0 12px rgba(255, 0, 200, 0);
  opacity: 0;
  z-index: 6;
}
#fx-chroma.on {
  animation: chromaPulse 0.5s ease-out;
}
@keyframes chromaPulse {
  0% {
    opacity: 0.85;
    box-shadow:
      inset 6px 0 18px rgba(0, 255, 255, 0.45),
      inset -6px 0 18px rgba(255, 0, 200, 0.4);
  }
  100% {
    opacity: 0;
    box-shadow:
      inset 0 0 0 rgba(0, 255, 255, 0),
      inset 0 0 0 rgba(255, 0, 200, 0);
  }
}

#confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 7;
  border-radius: 8px;
}
#confetti .bit {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  top: 35%;
  left: 50%;
  opacity: 0;
  animation: confettiFly 1.1s ease-out forwards;
}
@keyframes confettiFly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); }
}

#banner {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 30;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(14px, 4vw, 22px);
  color: #1a0c04;
  background: linear-gradient(135deg, #ffe08a 0%, #ff9a2a 45%, #ff4ad8 100%);
  border: 4px solid #7dfffa;
  padding: 18px 22px;
  text-align: center;
  box-shadow:
    0 8px 0 #3a1400,
    0 0 28px rgba(255, 154, 42, 0.55),
    0 0 48px rgba(255, 74, 216, 0.35);
  pointer-events: auto;
  cursor: pointer;
  max-width: 90vw;
  line-height: 1.5;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}
#banner.hidden { display: none; }
#banner.win {
  animation: bannerWin 0.55s ease-out;
}
@keyframes bannerWin {
  0% { transform: translate(-50%, -50%) scale(0.7); filter: brightness(1.4); }
  60% { transform: translate(-50%, -50%) scale(1.08); }
  100% { transform: translate(-50%, -50%) scale(1); filter: brightness(1); }
}
#banner.miss {
  background: linear-gradient(#c9a27a, #8a6040);
  border-color: #3a2418;
  box-shadow: 0 8px 0 #1a1008;
  animation: none;
}

#pads {
  position: relative;
  z-index: 10;
  width: min(720px, 100%);
  padding: 10px 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.dpad .mid {
  display: flex;
  gap: 36px;
}
#pads button {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: #1a0c04;
  background: linear-gradient(#ffe08a, #ff9a2a);
  border: 3px solid #5a2200;
  width: 56px;
  height: 48px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 0 #3a1400, 0 0 10px rgba(255, 154, 42, 0.25);
  touch-action: none;
}
#pads button:active,
#pads button.held {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #3a1400;
  filter: brightness(1.08);
}
#dropBtn {
  width: 110px !important;
  height: 72px !important;
  font-size: 12px !important;
  line-height: 1.35;
  color: #041a10 !important;
  background: linear-gradient(160deg, #b8ffd0, #2ecc71 55%, #7dfffa) !important;
  border-color: #145a2e !important;
  box-shadow:
    0 4px 0 #0a3020,
    0 0 14px rgba(46, 204, 113, 0.55),
    0 0 28px rgba(125, 255, 250, 0.35) !important;
  animation: dropGlow 1.8s ease-in-out infinite;
}
@keyframes dropGlow {
  0%, 100% {
    box-shadow:
      0 4px 0 #0a3020,
      0 0 12px rgba(46, 204, 113, 0.45),
      0 0 22px rgba(125, 255, 250, 0.25);
  }
  50% {
    box-shadow:
      0 4px 0 #0a3020,
      0 0 20px rgba(46, 204, 113, 0.75),
      0 0 36px rgba(125, 255, 250, 0.45);
  }
}
#dropBtn small {
  font-size: 8px;
  opacity: 0.85;
}
#dropBtn:disabled {
  opacity: 0.45;
  filter: grayscale(0.4);
  animation: none;
  box-shadow: 0 4px 0 #0a3020 !important;
}
#dropBtn.drop-punch {
  animation: dropPunch 0.4s ease-out;
}
@keyframes dropPunch {
  0% { transform: scale(1.12); filter: brightness(1.35); }
  100% { transform: scale(1); filter: brightness(1); }
}

.la-mark {
  position: fixed;
  right: 10px;
  bottom: 8px;
  z-index: 40;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #7a5080;
  letter-spacing: 0.12em;
  opacity: 0.7;
  text-shadow: 0 0 6px rgba(255, 74, 216, 0.35);
}

@media (max-width: 480px) {
  #fps { font-size: 9px; padding: 5px 7px; top: 6px; right: 6px; }
  #pads button { width: 48px; height: 42px; font-size: 12px; }
  #dropBtn { width: 96px !important; height: 64px !important; }
  .dpad .mid { gap: 28px; }
  /* Keep flash softer on phone */
  #fx-flash.on { animation-duration: 0.28s; }
}

#banner[data-hint="1"]::after {
  content: "PRESS ENTER";
  display: block;
  margin-top: 10px;
  font-size: 0.55em;
  letter-spacing: 0.12em;
  opacity: 0.85;
  animation: hintPulse 1.1s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
