/* Balloon Popper — styles */
:root {
  --bg1: #1c1030;
  --bg2: #3b1e5e;
  --accent: #ffb703;
  --accent2: #ff5d8f;
  --card: rgba(255, 255, 255, 0.92);
  --ink: #241530;
  --muted: #6d5880;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg1);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.hidden { display: none !important; }

/* ---------------- HUD ---------------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
#hud button { pointer-events: auto; }

.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 0;
}

.hud-left { display: flex; flex-direction: column; gap: 4px; }
#hud-score {
  font-size: 42px;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  line-height: 1;
}
#hud-combo {
  font-size: 16px;
  font-weight: 700;
  color: #ffe28a;
  text-shadow: 0 1px 0 rgba(0,0,0,.4);
}

.hud-right { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: none;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 19px;
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.chip {
  height: 42px;
  padding: 0 12px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,.18);
  color: #ffe28a;
  font-size: 16px;
  font-weight: 700;
  backdrop-filter: blur(4px);
  cursor: default;
}

.hud-mid {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  left: 0; right: 0;
  text-align: center;
}
#hud-lives { font-size: 20px; letter-spacing: 2px; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
#hud-timer {
  display: inline-block;
  font-size: 34px;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
#hud-mode-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: .75;
  text-transform: uppercase;
  margin-top: 2px;
}

.hud-buffs {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 120px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.buff-chip {
  display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
}
.buff-chip .bar {
  width: 46px; height: 5px;
  background: rgba(255,255,255,.25);
  border-radius: 3px;
  overflow: hidden;
}
.buff-chip .bar i { display: block; height: 100%; background: var(--accent); }

/* ---------------- Screens ---------------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, rgba(28,16,48,.92), rgba(59,30,94,.88));
  backdrop-filter: blur(3px);
  padding: 16px;
  overflow-y: auto;
}

.panel {
  width: min(480px, 100%);
  background: var(--card);
  color: var(--ink);
  border-radius: 22px;
  padding: 22px 20px 20px;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
  text-align: center;
  max-height: 92dvh;
  overflow-y: auto;
}

.logo {
  margin: 0 0 2px;
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 900;
  color: #3b2a55;
}
.logo span { color: var(--accent2); }
.tagline { margin: 0 0 10px; color: var(--muted); font-size: 14px; }

.menu-coins {
  display: inline-block;
  background: #2b1a45;
  color: #ffe28a;
  border-radius: 999px;
  padding: 4px 16px;
  font-weight: 800;
  margin-bottom: 12px;
}

.btn {
  border: none;
  border-radius: 14px;
  background: #6d4a9e;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform .06s, filter .1s;
}
.btn:active { transform: scale(.96); filter: brightness(1.15); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff8c00); color: #3a1c00; }
.btn-big {
  width: 100%;
  font-size: 24px;
  padding: 16px;
  border-radius: 18px;
  margin-bottom: 12px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.mode-btn {
  border: none;
  border-radius: 16px;
  padding: 12px 8px;
  background: #efe6f8;
  color: #3b2a55;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.mode-btn:hover { background: #e4d5f5; }
.mode-btn small { font-weight: 600; color: var(--muted); }

.menu-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

h2 { margin: 0 0 4px; font-size: 24px; }
.sub { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

/* ---------------- Cards (loadout / upgrades) ---------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.pcard {
  border: 3px solid transparent;
  background: #f6f0fc;
  border-radius: 16px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  transition: transform .06s;
}
.pcard:active { transform: scale(.97); }
.pcard.selected { border-color: var(--accent); background: #fff3d0; }
.pcard.disabled { opacity: .45; }
.pcard .glyph { font-size: 34px; line-height: 1.2; }
.pcard .name { font-weight: 800; font-size: 13px; margin-top: 2px; }
.pcard .fx { font-size: 11px; color: var(--muted); min-height: 28px; }
.pcard .meta { font-size: 11px; font-weight: 700; color: #8a6d00; margin-top: 2px; }
.pcard .pips { letter-spacing: 2px; color: var(--accent); }

.slots { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.slot {
  width: 62px; height: 62px;
  border: 2px dashed #b9a3d4;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: #b9a3d4;
  background: #f9f5fd;
}

.help-list { text-align: left; padding-left: 20px; font-size: 14px; line-height: 1.55; }
.help-keys {
  margin-top: 10px;
  background: #efe6f8;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
}

/* Game over / pause panel */
#overlay-panel h2 { margin-bottom: 8px; }
.stat-row { display: flex; justify-content: space-between; padding: 5px 2px; font-size: 15px; border-bottom: 1px solid #eee; }
.stat-row b { color: #3b2a55; }

/* Pseudo-fullscreen fallback when the Fullscreen API is unavailable */
body.pseudo-fs #app { background: #000; }

@media (min-width: 700px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}
