/* ============================================================
   arcade.css — "neon arcade" presentation layer.
   Loaded last: overrides layout only, never game logic.
   Goal: compact glass HUD bar, edge booster rails, a board that
   fills the viewport, and a neon-glass world/level map.
   ============================================================ */

/* ---------- shell: board-first, chrome pushed below the fold ---------- */

.app-shell {
  max-width: 560px;
  min-height: 100svh;
  padding: 10px 10px 18px;
  gap: 8px;
  justify-content: flex-start;
}

/* ---------- top HUD bar ---------- */

#topBar {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 8px 26px rgba(0,0,0,0.45),
    0 0 30px -12px var(--accent-violet);
}

.hud-icon-btn {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.22);
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 14px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, box-shadow .12s ease;
}
.hud-icon-btn:active { transform: scale(0.92); }

.tb-metric {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 52px;
}
.tb-metric.right { align-items: flex-end; }
.tb-label {
  font-family: var(--font-ui);
  font-size: 8px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.tb-value {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.tb-value.score { color: var(--accent-gold); text-shadow: 0 0 14px rgba(255,209,102,.45); }
.tb-value.level { color: var(--accent-cyan); text-shadow: 0 0 14px rgba(34,229,238,.45); }

.tb-mission { flex: 1 1 auto; min-width: 0; }
#objectivesPanel {
  background: none;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  gap: 3px;
}
#objectivesPanel .obj-header { font-size: 8px; letter-spacing: 1.4px; }
#objectivesPanel .objective-row .obj-label { font-size: 9.5px; }
#objectivesPanel .progress-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(0,0,0,0.35);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
#objectivesPanel .progress-fill {
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-pink));
  box-shadow: 0 0 12px rgba(255,110,196,0.65);
}

/* ---------- secondary chip row ---------- */

#subBar {
  width: 100%;
  max-width: 520px;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 99px;
  padding: 4px 11px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  cursor: default;
  margin: 0;
}
.sub-chip b { color: var(--text-primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-chip i { font-style: normal; font-size: 9px; color: var(--text-faint); letter-spacing: .6px; }
.sub-chip.combo b { color: var(--accent-pink); }
.sub-chip.coin-pill { cursor: pointer; }
.sub-chip.combo.hot { animation: comboPulse 0.5s ease; }

#rowMeter {
  width: auto;
  max-width: none;
  margin-top: 0;
  text-align: left;
}

#bossBar { width: 100%; max-width: 520px; border-radius: 14px; }

/* ---------- the board: as large as the viewport allows ---------- */

#stageWrap {
  max-width: min(520px, calc((100svh - 190px) * 0.75));
  /* never let the flex column squash the board out of its 3:4 ratio */
  flex: 0 0 auto;
  aspect-ratio: 480 / 640;
  border-radius: 26px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.10),
    0 0 0 6px rgba(120, 90, 255, 0.10),
    0 0 90px -10px rgba(120, 80, 255, 0.55),
    0 24px 70px rgba(0,0,0,0.7);
}

/* ---------- booster rails pinned to the board edges ---------- */

#boosterTray.booster-rail,
#boosterTrayRight.booster-rail,
.booster-rail {
  position: absolute;
  bottom: 26%;
  width: auto;
  max-width: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 5px;
  border-radius: 18px;
  z-index: 3;
  background: none;
  border: none;
  box-shadow: none;
  /* the rail itself must never block aiming — only the chips are clickable */
  pointer-events: none;
}
.booster-rail .booster-chip { pointer-events: auto; }
.booster-rail.left { left: 4px; }
.booster-rail.right { right: 4px; }

/* Rails float over the board on phones, so keep them out of the way of the
   aim guide: translucent, and pushed fully outside the board when there is
   horizontal room for them. */
@media (min-width: 620px) {
  .app-shell { max-width: 660px; }
  #stageWrap { overflow: visible; }
  .booster-rail.left { left: -58px; }
  .booster-rail.right { right: -58px; }
}

.booster-rail .booster-chip {
  position: relative;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.20);
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,0.30), rgba(90,60,180,0.35) 55%, rgba(20,10,45,0.85));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 4px 12px rgba(0,0,0,0.45);
  transition: transform .12s ease, box-shadow .12s ease;
}
.booster-rail .booster-chip:active { transform: scale(0.9); }
.booster-rail .booster-chip.active,
.booster-rail .booster-chip.armed {
  box-shadow: 0 0 0 2px var(--accent-cyan), 0 0 18px rgba(34,229,238,.6);
}
.booster-rail .bc-icon { font-size: 18px; line-height: 1; }
.booster-rail .bc-count {
  position: absolute;
  right: -3px;
  bottom: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
  color: #1b0f30;
  background: linear-gradient(180deg, #fff, var(--accent-gold));
  border: 1px solid rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- bottom controls ---------- */

#controlsRow { max-width: 520px; gap: 6px; }
#controlsRow .pill-btn { padding: 8px 14px; font-size: 11.5px; border-radius: 99px; }

/* ---------- below-the-fold branding ---------- */

.brand { margin-top: 18px; }
.brand-title { font-size: 22px; letter-spacing: 3px; }
.legend, #instructions { opacity: .8; }

/* ---------- world map / level select: neon glass ---------- */

.screen { padding: 26px 16px 40px; }
.screen-header h2 { font-size: 22px; letter-spacing: 1px; }

.world-node {
  padding: 18px 16px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(160deg, rgba(255,255,255,0.12), rgba(255,255,255,0.03));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 12px 34px rgba(0,0,0,0.5), 0 0 40px -18px var(--accent-violet);
}
.world-node .wn-icon { font-size: 32px; filter: drop-shadow(0 0 12px rgba(255,255,255,.35)); }
.world-node .wn-name { font-size: 16px; letter-spacing: .4px; }

.level-node {
  border: 1px solid rgba(255,255,255,0.18);
  background: radial-gradient(circle at 32% 24%, rgba(255,255,255,0.22), rgba(90,60,180,0.30) 55%, rgba(16,8,38,0.9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 8px 22px rgba(0,0,0,0.5), 0 0 26px -8px var(--accent-violet);
}
.level-node .ln-num { font-size: 18px; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.level-node .ln-stars { color: var(--accent-gold); font-size: 10px; text-shadow: 0 0 8px rgba(255,209,102,.7); }
.level-node.boss {
  background: radial-gradient(circle at 32% 24%, rgba(255,255,255,0.25), rgba(255,110,196,0.35) 55%, rgba(60,6,40,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 30px -6px var(--accent-pink);
}

/* ---------- narrow phones ---------- */

@media (max-width: 380px) {
  .tb-value { font-size: 15px; }
  .booster-rail .booster-chip { width: 34px; height: 34px; }
  .booster-rail .bc-icon { font-size: 15px; }
}

/* ---------- phones: keep the board square-on and as large as it fits ---------- */

@media (max-width: 620px) {
  .app-shell { padding: 8px 8px 14px; gap: 6px; }
  #topBar { padding: 6px 8px; gap: 8px; }

  /* reserve room for HUD + stat chips + controls, then give the rest to the
     board while preserving its 3:4 ratio (no more squashed bubbles) */
  #stageWrap { width: 100%; max-width: min(100%, calc((100svh - 250px) * 0.75)); }

  #controlsRow { flex-wrap: wrap; justify-content: center; gap: 5px; }
  #controlsRow .pill-btn { padding: 7px 11px; font-size: 11px; }

  .booster-rail { bottom: 20%; gap: 5px; padding: 2px; }
  .booster-rail .booster-chip { width: 36px; height: 36px; }
  .booster-rail .bc-icon { font-size: 16px; }
  .booster-rail.left { left: 2px; }
  .booster-rail.right { right: 2px; }
}
