* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #05030c;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  color: #e8f0ff;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #05030c;
}

/* Game stage fills remaining space above controller */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0614;
}
#c {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0614;
  image-rendering: pixelated;
}

#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
}
.hud-left, .hud-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.chip {
  background: rgba(10, 6, 20, .82);
  border: 1px solid rgba(0, 255, 220, .35);
  color: #9efcf0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .05em;
  padding: 8px 12px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.chip strong {
  color: #fff;
  font-size: 18px;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
#weaponChip {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #7af8ff;
  text-shadow: 0 0 12px rgba(122, 248, 255, .45);
  min-width: 148px;
  text-align: center;
  transition: transform .12s ease, box-shadow .12s ease;
  font-variant-numeric: tabular-nums;
}
#weaponChip.weapon-pop {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(122, 248, 255, .35);
}
.mute {
  pointer-events: auto;
  border: 1px solid rgba(255, 0, 200, .4);
  background: rgba(10,6,20,.9);
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
}

/* ═══ Game Boy controller ═══ */
.gb {
  flex: 0 0 auto;
  z-index: 8;
  pointer-events: auto;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #1a1430 0%, #12101c 40%, #0c0a14 100%);
  border-top: 2px solid rgba(0, 255, 220, .2);
  box-shadow: 0 -8px 32px rgba(0,0,0,.45);
}
.gb-shell {
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 6px;
}
.gb-left { display: flex; justify-content: flex-start; padding-left: 4px; }
.gb-right { display: flex; justify-content: flex-end; padding-right: 4px; }
.gb-mid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

/* Cross D-pad */
.dpad {
  position: relative;
  width: 148px;
  height: 148px;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,.35));
}
.d-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #3a3550, #1e1a2e);
  color: #c8c0e0;
  font-size: 16px;
  font-weight: 900;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.12),
    inset 0 -3px 0 rgba(0,0,0,.4),
    0 2px 0 #0a0810;
}
.d-btn:active, .d-btn.is-down {
  transform: translateY(2px);
  background: linear-gradient(180deg, #2a2640, #141020);
  color: #7af8ff;
  box-shadow: inset 0 3px 8px rgba(0,0,0,.55);
}
.d-up { left: 50px; top: 2px; border-radius: 10px 10px 6px 6px; }
.d-down { left: 50px; bottom: 2px; border-radius: 6px 6px 10px 10px; }
.d-left { left: 2px; top: 50px; border-radius: 10px 6px 6px 10px; }
.d-right { right: 2px; top: 50px; border-radius: 6px 10px 10px 6px; }
.d-center {
  left: 50px; top: 50px;
  width: 48px; height: 48px;
  pointer-events: none;
  background: radial-gradient(circle at 40% 35%, #2e2a42, #14101f);
  border-radius: 8px;
  box-shadow: inset 0 0 12px rgba(0,0,0,.5);
}

/* Select-style middle buttons */
.sel {
  min-width: 72px;
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a2a55, #1a1228);
  color: #d0c4f0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  touch-action: manipulation;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 3px 0 #0a0614;
}
.sel:active, .sel.is-down {
  transform: translateY(2px);
  color: #ff4fd8;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.5);
}

/* A / B face buttons */
.ab {
  position: relative;
  width: 150px;
  height: 120px;
}
.face {
  position: absolute;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  touch-action: manipulation;
  font-weight: 900;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.18),
    inset 0 -4px 0 rgba(0,0,0,.35),
    0 6px 0 rgba(0,0,0,.35);
}
.face span { font-size: 22px; line-height: 1; }
.face small { font-size: 9px; letter-spacing: .08em; opacity: .85; }
.a-btn {
  right: 0; top: 8px;
  background: linear-gradient(160deg, #ff6ad5, #c01090);
  color: #fff;
}
.b-btn {
  left: 0; bottom: 0;
  background: linear-gradient(160deg, #7af0ff, #2090c8);
  color: #041820;
}
.face:active, .face.is-down {
  transform: translateY(3px);
  box-shadow:
    inset 0 4px 10px rgba(0,0,0,.35),
    0 2px 0 rgba(0,0,0,.3);
}

/* Overlay / menu */
.overlay, .transition {
  position: absolute; inset: 0; z-index: 20;
  pointer-events: auto;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(40,10,60,.88), rgba(5,3,12,.96));
  padding: 20px;
}
.overlay.hidden, .transition.hidden { display: none; }
.panel {
  pointer-events: auto;
  max-width: 440px; width: 100%; text-align: center;
  border: 1px solid rgba(0, 255, 220, .35);
  background: rgba(12, 8, 28, .92);
  border-radius: 20px; padding: 28px 22px;
  box-shadow: 0 0 40px rgba(255, 0, 200, .15), inset 0 0 30px rgba(0, 255, 220, .05);
}
.tag { color: #ff4fd8; font-size: 12px; font-weight: 800; letter-spacing: .2em; margin-bottom: 8px; }
.panel h1 {
  font-size: clamp(36px, 9vw, 52px); line-height: .95; font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff, #7af8ff 50%, #ff4fd8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 12px;
}
.sub { color: rgba(220, 230, 255, .8); font-size: 15px; line-height: 1.45; margin-bottom: 18px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.cta {
  border: 1px solid rgba(0, 255, 220, .35); background: rgba(0, 255, 220, .08);
  color: #e8ffff; font-weight: 800; padding: 14px 18px; border-radius: 14px; cursor: pointer;
  font-size: 16px; min-height: 48px;
}
.cta.primary {
  background: linear-gradient(180deg, #ff4fd8, #a01090);
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px rgba(255, 0, 180, .35);
}
.cta:active { transform: scale(0.97); }
.hint { font-size: 12px; color: rgba(180, 200, 230, .6); line-height: 1.45; }
.transition .glitch {
  font-size: 24px; font-weight: 900; letter-spacing: .08em;
  color: #7af8ff; text-shadow: 2px 0 #ff4fd8, -2px 0 #00ffc8;
  margin-bottom: 12px; text-align: center;
}
.transition p { color: rgba(200, 220, 255, .75); font-size: 14px; text-align: center; }

/* Desktop: keep pad but smaller / optional */
@media (min-width: 900px) and (min-height: 700px) {
  .gb { padding-bottom: 16px; }
  .dpad { width: 160px; height: 160px; }
  .d-btn { width: 52px; height: 52px; }
  .d-up, .d-down { left: 54px; }
  .d-left, .d-right { top: 54px; }
  .d-center { left: 54px; top: 54px; width: 52px; height: 52px; }
}

@media (max-width: 380px) {
  .dpad { width: 128px; height: 128px; }
  .d-btn { width: 42px; height: 42px; font-size: 14px; }
  .d-up, .d-down { left: 43px; }
  .d-left, .d-right { top: 43px; }
  .d-center { left: 43px; top: 43px; width: 42px; height: 42px; }
  .face { width: 64px; height: 64px; }
  .ab { width: 132px; height: 110px; }
  .sel { min-width: 64px; font-size: 9px; }
}
