/* BALLOONAGEDDON - arcade styling */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

html, body {
  height: 100%;
  background: radial-gradient(ellipse at 50% 30%, #1a1f2e 0%, #0b0d12 70%);
  overflow: hidden;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#app {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wrap {
  position: relative;
  height: min(100vh, 139vw);
  aspect-ratio: 540 / 780;
  box-shadow: 0 0 60px rgba(0,0,0,0.8), 0 0 0 4px #23283a, 0 0 0 8px #0d0f14;
  overflow: hidden;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 9.5%;
  padding: 1.2% 2.5% 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: linear-gradient(to bottom, rgba(6,8,12,0.92) 0%, rgba(6,8,12,0.75) 65%, rgba(6,8,12,0) 100%);
  color: #ffd93d;
  pointer-events: none;
  z-index: 5;
}

.hud-col { display: flex; flex-direction: column; gap: 4%; min-width: 26%; }
.hud-col.right { align-items: flex-end; }
.hud-mid { display: flex; flex-direction: column; gap: 4%; align-items: center; min-width: 30%; }

.hud-col .lbl { font-size: clamp(6px, 1.1vh, 10px); color: #8a93b5; letter-spacing: 1px; }
#hud-score, #hud-hi { font-size: clamp(9px, 1.9vh, 17px); color: #fff; text-shadow: 0 0 6px rgba(255,217,61,0.5); }
#hud-hi { color: #ffd93d; }
#hud-stage { font-size: clamp(7px, 1.4vh, 12px); color: #fff; }
#hud-weapon { font-size: clamp(6px, 1.1vh, 10px); color: #7ee787; letter-spacing: 1px; }
#hud-panic { font-size: clamp(6px, 1.1vh, 10px); color: #ff4d5a; }

.lives { display: flex; gap: 4px; margin-top: 2px; }
.lives span {
  width: clamp(8px, 1.6vh, 14px);
  height: clamp(8px, 1.6vh, 14px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9aa2, #ff4d5a 60%, #b3122f);
  border: 1px solid #fff;
}

/* ---------- overlays / screens ---------- */
#overlay { position: absolute; inset: 0; z-index: 10; pointer-events: none; }

.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3.2%;
  background: rgba(8, 10, 16, 0.72);
  text-align: center;
  pointer-events: auto;
}
.screen.on { display: flex; }
.screen.title { background: rgba(8, 10, 16, 0.55); }
.screen.gap-lg { gap: 5%; }

#logo-img {
  width: 62%;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.7));
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.tagline { color: #8a93b5; font-size: clamp(7px, 1.5vh, 12px); letter-spacing: 1px; }

h1.screen-title {
  color: #ffd93d;
  font-size: clamp(18px, 4.6vh, 40px);
  text-shadow: 3px 3px 0 #b3122f, 0 0 24px rgba(255,217,61,0.35);
  letter-spacing: 2px;
}
h2.screen-sub { color: #fff; font-size: clamp(10px, 2.2vh, 18px); letter-spacing: 2px; }
.stage-no { color: #7ee787; font-size: clamp(9px, 2vh, 16px); letter-spacing: 2px; }

.screen p.tip { color: #aab4d4; font-size: clamp(7px, 1.5vh, 11px); line-height: 1.9; max-width: 82%; }
.screen .big-score { color: #fff; font-size: clamp(12px, 2.6vh, 22px); }
.screen .big-score em { color: #ffd93d; font-style: normal; }
.new-record { color: #ff4d5a; font-size: clamp(8px, 1.7vh, 13px); animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.help { color: #6c7698; font-size: clamp(6px, 1.25vh, 9px); line-height: 2; letter-spacing: 1px; }

/* ---------- buttons ---------- */
.btn-row { display: flex; flex-direction: column; gap: 2.4%; align-items: center; }

.btn, a.btn {
  display: inline-block;
  font-family: inherit;
  font-size: clamp(9px, 2vh, 16px);
  color: #fff;
  background: linear-gradient(to bottom, #ff5e63, #c81e46);
  border: 3px solid #fff;
  border-radius: 6px;
  padding: 2.1vh 4.5vw;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 5px 0 #7a0c2a, 0 8px 16px rgba(0,0,0,0.5);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
}
.btn:hover, a.btn:hover { filter: brightness(1.12); }
.btn:active, a.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #7a0c2a; }

a.btn.more {
  background: linear-gradient(to bottom, #3ec6ff, #1668c8);
  box-shadow: 0 5px 0 #0a3f7e, 0 8px 16px rgba(0,0,0,0.5);
  font-size: clamp(8px, 1.7vh, 13px);
  padding: 1.7vh 3.6vw;
}
a.btn.more:active { box-shadow: 0 1px 0 #0a3f7e; }

.btn.ghost {
  background: linear-gradient(to bottom, #2a3047, #181c2a);
  box-shadow: 0 5px 0 #0c0e16;
  font-size: clamp(8px, 1.7vh, 13px);
  padding: 1.7vh 3.6vw;
}

/* ---------- panic / combo banner ---------- */
#banner {
  position: absolute;
  top: 38%; left: 0; right: 0;
  text-align: center;
  color: #ff4d5a;
  font-size: clamp(14px, 3.6vh, 30px);
  text-shadow: 3px 3px 0 #400, 0 0 20px rgba(255,77,90,0.6);
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  letter-spacing: 2px;
}
#banner.show { animation: bannerPop 1.6s ease-out; }
@keyframes bannerPop {
  0% { opacity: 0; transform: scale(0.4); }
  15% { opacity: 1; transform: scale(1.15); }
  30% { transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05); }
}

/* ---------- mute button: glass speaker orb ---------- */
#mute-btn {
  position: absolute;
  right: 1.6%; top: 11%;
  z-index: 20;
  width: clamp(30px, 5.6vh, 44px);
  height: clamp(30px, 5.6vh, 44px);
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(142,156,196,0.55);
  background: linear-gradient(160deg, rgba(34,40,64,0.88) 0%, rgba(12,14,24,0.92) 100%);
  box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.16);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
#mute-btn:hover {
  border-color: #ffd93d;
  box-shadow: 0 3px 14px rgba(255,217,61,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: scale(1.08);
}
#mute-btn:active { transform: scale(0.92); }
#mute-btn svg { width: 60%; height: 60%; display: block; }
#mute-btn .spk { fill: #ffd93d; }
#mute-btn .wav { stroke: #ffd93d; fill: none; stroke-linecap: round; }
#mute-btn:not(.muted) .wav { animation: waveBeat 1.1s ease-in-out infinite; }
#mute-btn .x { stroke: #ff4d5a; fill: none; stroke-linecap: round; }
#mute-btn.muted .spk { fill: #8a93b5; }
#mute-btn.muted .wav { display: none; }
#mute-btn:not(.muted) .x { display: none; }
@keyframes waveBeat {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ---------- touch controls ---------- */
#touch { position: absolute; inset: 0; z-index: 15; pointer-events: none; display: none; }
body.touchmode #touch { display: block; }

.tzone {
  position: absolute;
  bottom: 4%;
  width: 17%;
  height: 13%;
  border-radius: 14px;
  background: rgba(255,255,255,0.09);
  border: 2px solid rgba(255,255,255,0.25);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.65);
  font-size: clamp(14px, 3vh, 24px);
}
.tzone.left { left: 3%; }
.tzone.right { left: 22%; }
.tzone.fire {
  right: 3%;
  width: 22%;
  border-radius: 50%;
  background: rgba(255,77,90,0.22);
  border-color: rgba(255,77,90,0.55);
  color: rgba(255,180,185,0.9);
}
.tzone.pressed { background: rgba(255,255,255,0.28); }

/* ---------- CRT scanlines ---------- */
#crt {
  position: absolute; inset: 0;
  z-index: 30;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.10) 0 2px, transparent 2px 4px);
  mix-blend-mode: multiply;
}

/* loading text */
#load-note { color: #6c7698; font-size: clamp(7px, 1.5vh, 11px); }

/* ---------- mode buttons ---------- */
.btn.endless, a.btn.endless {
  background: linear-gradient(to bottom, #ffb14d, #e07a12);
  box-shadow: 0 5px 0 #8a4a08, 0 8px 16px rgba(0,0,0,0.5);
}
.btn.endless:active { box-shadow: 0 1px 0 #8a4a08; }

/* ---------- tour complete badge ---------- */
.badge {
  color: #ffd93d;
  border: 3px solid #ffd93d;
  border-radius: 8px;
  background: rgba(60, 40, 0, 0.55);
  padding: 1.4vh 3vw;
  font-size: clamp(8px, 1.8vh, 14px);
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(255,217,61,0.6);
  animation: badgeGlow 2s ease-in-out infinite;
}
@keyframes badgeGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,217,61,0.25); }
  50% { box-shadow: 0 0 24px rgba(255,217,61,0.55); }
}

/* ---------- cutscene & ending ---------- */
.screen.cutscene {
  background: #0a0c12;
  justify-content: flex-start;
  padding: 0;
  gap: 0;
}
#cutscene-img, #ending-img {
  width: 100%;
  height: 50%;
  object-fit: cover;
  display: block;
  filter: brightness(0.92);
  border-bottom: 4px solid #2a3047;
}
.cutscene-panel {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2vh;
  padding: 3vh 7% 2.5vh;
  text-align: center;
}
.slide-title {
  color: #ffd93d;
  font-size: clamp(12px, 2.8vh, 22px);
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #7a4a00;
}
.slide-text {
  color: #dfe6ff;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: clamp(10px, 2vh, 15px);
  line-height: 1.75;
  max-width: 92%;
  min-height: 8.5em;
  letter-spacing: 0.5px;
}
.slide-foot {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.btn.ghost.small {
  font-size: clamp(7px, 1.5vh, 11px);
  padding: 1.1vh 2.6vw;
}
.hint {
  color: #6c7698;
  font-size: clamp(7px, 1.5vh, 11px);
  letter-spacing: 1px;
  animation: blink 1.2s steps(2) infinite;
}

/* ending lines roll-in */
.ending-lines {
  display: flex;
  flex-direction: column;
  gap: 1vh;
  max-width: 94%;
}
.end-line {
  color: #dfe6ff;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: clamp(9px, 1.9vh, 14px);
  letter-spacing: 0.5px;
  opacity: 0;
  animation: lineIn 0.9s ease forwards;
}
.end-line.the-end {
  color: #ffd93d;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: clamp(12px, 2.6vh, 20px);
  margin-top: 1vh;
  text-shadow: 2px 2px 0 #7a4a00;
}
@keyframes lineIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* endless mode accents */
#hud-stage.endless { color: #ff9f43; }
#screen-intro.endless .stage-no { color: #ff9f43; }
#screen-intro.endless h1.screen-title { text-shadow: 3px 3px 0 #7a3200, 0 0 24px rgba(255,159,67,0.4); }

/* ---------- world tour map (story mode) ---------- */
.screen.map { gap: 1.8vh; padding: 2.4vh 0 2vh; }
.screen.map .stage-no { font-size: clamp(7px, 1.4vh, 11px); }
#map-world {
  position: relative;
  width: 86%;
  aspect-ratio: 1 / 1;
  border: 3px solid #3a415c;
  border-radius: 10px;
  overflow: hidden;
  background: #0a1428;
  box-shadow: 0 0 34px rgba(0,0,0,0.65), inset 0 0 40px rgba(0,0,0,0.4);
}
#map-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  opacity: 0.92;
}
#map-route { position: absolute; inset: 0; width: 100%; height: 100%; }
#map-route polyline { fill: none; }
#map-route .route-full {
  stroke: rgba(255,255,255,0.45);
  stroke-width: 2px;
  stroke-dasharray: 7 6;
  vector-effect: non-scaling-stroke;
}
#map-route .route-past {
  stroke: #ffd93d;
  stroke-width: 2.5px;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(255,217,61,0.7));
}

.map-node {
  position: absolute;
  width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: #5a6488;
  border: 2px solid rgba(255,255,255,0.55);
  z-index: 2;
}
.map-node.done { background: #ffd93d; border-color: #7a5200; }
.map-node.cur {
  width: 15px; height: 15px;
  margin: -7.5px 0 0 -7.5px;
  background: #ff4d5a;
  border-color: #fff;
  z-index: 4;
  animation: nodePulse 1s ease-in-out infinite;
}
@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,90,0.55); }
  50% { box-shadow: 0 0 16px 5px rgba(255,77,90,0.4); }
}

.map-label {
  position: absolute;
  transform: translate(-50%, -230%);
  background: rgba(8,10,16,0.88);
  color: #ffd93d;
  border: 2px solid #ffd93d;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: clamp(7px, 1.5vh, 10px);
  letter-spacing: 1px;
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
}

#map-plane { position: absolute; width: 0; height: 0; z-index: 3; }
#map-plane.fly { transition: left 2.3s linear, top 2.3s linear; }
#map-plane::before {
  content: '';
  position: absolute; left: -8px; top: -11px;
  width: 0; height: 0;
  border-right: 8px solid transparent;
  border-left: 8px solid transparent;
  border-bottom: 17px solid #fff;
  filter: drop-shadow(0 0 5px rgba(255,217,61,0.95));
}
#map-plane::after {
  content: '';
  position: absolute; left: -1.5px; top: 6px;
  width: 3px; height: 14px;
  background: linear-gradient(to bottom, rgba(255,217,61,0.85), rgba(255,217,61,0));
}

/* ending panel: keep score + buttons inside the fold */
.cutscene-panel { overflow-y: auto; }
#screen-ending .cutscene-panel { gap: 1.4vh; padding-top: 1.8vh; }
#screen-ending h1.screen-title { font-size: clamp(14px, 3.4vh, 28px); }
#screen-ending .btn-row { gap: 1.2vh; }
#screen-ending .btn, #screen-ending a.btn {
  font-size: clamp(8px, 1.6vh, 13px);
  padding: 1.5vh 3.4vw;
}
#screen-ending .btn.more {
  font-size: clamp(7px, 1.4vh, 11px);
  padding: 1.2vh 2.8vw;
}
#screen-ending .big-score { font-size: clamp(10px, 2vh, 16px); }
.ending-lines { gap: 0.55vh; }
.end-line { font-size: clamp(8px, 1.65vh, 12px); }
.end-line.the-end { font-size: clamp(10px, 2.1vh, 16px); margin-top: 0.6vh; }
