/* =====================================================================
   BomberBot — fixed "deep-space arcade" theme.
   Like the other arcade canvas pages (Flappy, Super Plumber), this page
   deliberately ignores the center's light/dark mode and the shared glass
   chrome (no glass.css is loaded); every color is hardcoded, taken straight
   from the game's own canvas palette: deep-violet space, chrome/amber robot,
   teal plasma, magenta crystals, ink outlines.

   The c-* chrome block lives in EACH canvas game's own stylesheet (it is not
   inherited from base.css), so it is copied here wholesale and re-tinted.
   ===================================================================== */
:root {
  --bb-space:  #1b1440;   /* arena backdrop top */
  --bb-space2: #2a1c5c;   /* nebula violet */
  --bb-space3: #0c0a20;   /* deep floor of the gradient */
  --bb-teal:   #2ec9e6;   /* plasma / hero optic */
  --bb-teal2:  #189fc0;
  --bb-violet: #7b4be0;   /* hive / frame accent */
  --bb-pink:   #ff5d8f;   /* antenna / danger */
  --bb-gold:   #ffce4d;   /* modal heading + fuse spark */
  --bb-ink:    #141830;   /* outline ink — main text color */
  --bb-line:   rgba(20, 24, 48, .8);
}

html, body { height: 100%; }
body.bb-page {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: manipulation;
  background:
    radial-gradient(120% 80% at 20% 0%, var(--bb-space2) 0%, transparent 55%),
    linear-gradient(180deg, var(--bb-space) 0%, var(--bb-space3) 100%);
  color: #eaf2ff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.bb-page *,
body.bb-page *::before,
body.bb-page *::after { box-sizing: border-box; }

/* ---------- App frame ---------- */
.c-app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
.c-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  padding: 12px clamp(12px, 3vw, 28px);
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(123, 75, 224, .18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--bb-violet);
  z-index: 20;
}
.c-bar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.c-bar__brand svg { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.c-bar__title {
  margin: 0;
  font-size: clamp(19px, 3.4vw, 26px);
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #f4f8ff;
  text-shadow: 0 0 12px rgba(46, 201, 230, .5), 2px 2px 0 rgba(0, 0, 0, .35);
}
.c-bar__stats { display: flex; align-items: center; gap: 8px 18px; margin-left: auto; }
.c-bar__controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat { font-size: 14px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; color: rgba(234, 242, 255, .7); }
.stat b { color: var(--bb-teal); font-size: 16px; }

/* ---------- Buttons (chunky arcade style) ---------- */
.c-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
  padding: 9px 16px;
  border-radius: 12px;
  border: 2px solid var(--bb-line);
  background: #cdd7ea;
  color: var(--bb-ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .45);
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease;
}
.c-btn:hover { background: #eaf6ff; border-color: var(--bb-teal); }
.c-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .45); }
.c-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(46, 201, 230, .55); }
.c-btn--primary {
  background: linear-gradient(140deg, var(--bb-teal), var(--bb-teal2));
  border-color: var(--bb-line);
  color: #04212a;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, .25);
}
.c-btn--primary:hover { background: linear-gradient(140deg, #56e0f5, var(--bb-teal)); }

/* ---------- Table / stage ---------- */
.c-table {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.4vh, 22px);
}
.bb-stage {
  position: relative;
  /* 15:13 landscape arena. It grows with the viewport up to ~1080px on large
     screens, but is always capped by the available height minus the chrome so
     a small/short screen just gets a smaller board (no horizontal scroll). */
  width: min(94vw, calc((100vh - 150px) * 1.1538), 1080px);
  max-width: 1080px;
  aspect-ratio: 15 / 13;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bb-space);
  border: 3px solid rgba(123, 75, 224, .7);
  box-shadow: 0 0 0 1px rgba(46, 201, 230, .35), 0 12px 0 rgba(0, 0, 0, .3), 0 24px 52px rgba(0, 0, 0, .55);
  touch-action: manipulation;
}
#screen {
  display: block; width: 100%; height: 100%;
  touch-action: none;
}

/* ---------- Touch pad ---------- */
.bb-pad { position: absolute; inset: auto 0 0 0; z-index: 6; display: flex; align-items: flex-end; justify-content: space-between; padding: 12px 16px; pointer-events: none; }
.bb-pad[hidden] { display: none; }
.bb-pad__dpad { display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); gap: 4px; pointer-events: auto; }
.bb-key {
  appearance: none; cursor: pointer;
  font: 800 18px/1 system-ui, sans-serif;
  color: #eaf2ff;
  background: rgba(123, 75, 224, .42);
  border: 2px solid rgba(46, 201, 230, .55);
  border-radius: 12px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .4);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
}
.bb-key:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .4); background: rgba(46, 201, 230, .4); }
.bb-key--up { grid-area: 1 / 2; }
.bb-key--left { grid-area: 2 / 1; }
.bb-key--right { grid-area: 2 / 3; }
.bb-key--down { grid-area: 3 / 2; }
.bb-key--bomb { pointer-events: auto; width: 74px; height: 74px; border-radius: 50%; font-size: 15px; background: rgba(255, 93, 143, .5); border-color: var(--bb-pink); }

/* ---------- Ready / game-over overlays ---------- */
.bb-overlay {
  touch-action: manipulation;
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(10, 8, 24, .62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.bb-overlay[hidden] { display: none; }
.bb-card {
  touch-action: manipulation;
  max-width: 320px;
  text-align: center;
  padding: 22px 24px 20px;
  border-radius: 16px;
  background: linear-gradient(160deg, #2a2350, #16112f);
  border: 2px solid rgba(46, 201, 230, .5);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .35), 0 22px 50px rgba(0, 0, 0, .55);
  color: #eaf2ff;
  animation: bbPop .3s ease;
}
@keyframes bbPop { from { transform: scale(.88); opacity: 0; } }
.bb-card__big svg { width: 84px; height: 84px; display: block; margin: 0 auto; }
.bb-card h2 {
  margin: 6px 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 12px rgba(46, 201, 230, .55);
}
.bb-card p { margin: 0 0 14px; color: #c3c9ec; font-size: 13.5px; line-height: 1.55; }
.bb-card p b { color: var(--bb-teal); }
.bb-card .c-btn { font-size: 14px; }
.bb-card kbd, .c-modal kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin: 0 1px;
  font: 700 12px/1.5 ui-monospace, "Segoe UI", monospace;
  text-align: center;
  color: var(--bb-ink);
  background: #eaf2ff;
  border: 1px solid var(--bb-line);
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.c-win__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Rules modal ----------
   The full-screen overlay scrolls (see AGENTS.md); the panel never gets its
   own max-height + overflow box, so no scrollbar gutter sits inside the card. */
.c-modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.c-modal[hidden] { display: none; }
.c-modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 5, 18, .66);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.c-modal__panel {
  position: relative; z-index: 1;
  margin: auto;                 /* centres AND lets a too-tall card scroll from the top */
  width: min(92vw, 480px);
  background: linear-gradient(160deg, #2a2358, #151030);
  color: #e7ecf4;
  border-radius: 16px;
  border: 2px solid rgba(46, 201, 230, .5);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .4), 0 24px 60px rgba(0, 0, 0, .6);
}
.c-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(46, 201, 230, .28);
}
.c-modal__head h2 {
  margin: 0; font-size: 18px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em;
  color: #fff; text-shadow: 0 0 10px rgba(46, 201, 230, .5);
}
.c-modal__x {
  appearance: none; border: 0; background: none;
  color: #cfe9ff; font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.c-modal__x:hover { color: var(--bb-gold); }
.c-modal__body { padding: 8px 20px 4px; font-size: 14px; line-height: 1.55; }
.c-modal__body h3 {
  margin: 16px 0 6px; font-size: 13px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--bb-gold);
}
.c-modal__body ul { margin: 0; padding-left: 20px; }
.c-modal__body li { margin: 4px 0; }
.c-modal__body b { color: var(--bb-teal); }
.c-modal__lead { margin: 12px 0; }
.c-modal__note {
  margin: 14px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(123, 75, 224, .18);
  border: 1px solid rgba(123, 75, 224, .45);
  font-size: 13px;
  color: #d7d4ff;
}
.c-modal__foot { display: flex; justify-content: flex-end; padding: 12px 20px 16px; }
.c-modal .c-btn { border-color: rgba(46, 201, 230, .6); box-shadow: 0 3px 0 rgba(0, 0, 0, .4); }

/* ---------- Responsive ---------- */
@media (max-width: 700px), (max-height: 560px) {
  .c-bar { gap: 5px 12px; padding: 7px clamp(10px, 3vw, 18px); padding-top: max(7px, env(safe-area-inset-top)); }
  .c-bar__brand { gap: 8px; }
  .c-bar__title { font-size: 16px; }
  .c-bar__stats { gap: 4px 12px; margin-left: auto; }
  .stat { font-size: 12px; }
  .stat b { font-size: 13px; }
  .c-btn { padding: 8px 10px; font-size: 12px; }
  .c-bar__controls { gap: 6px; }
  .c-bar__controls .c-btn { padding: 9px 10px; white-space: nowrap; }
}
@media (max-width: 700px) {
  .c-bar__controls { flex: 1 1 100%; flex-wrap: nowrap; }
  .c-bar__controls .c-btn { flex: 1 1 auto; min-width: 0; padding: 9px 6px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 380px) {
  .c-bar { gap: 5px 8px; }
  .c-bar__title { font-size: 15px; }
  .stat { font-size: 11px; }
  .stat b { font-size: 12px; }
  .c-bar__controls { gap: 4px; }
  .c-bar__controls .c-btn { font-size: clamp(10px, 3.2vw, 12px); padding: 9px 4px; letter-spacing: .01em; }
}

@media (prefers-reduced-motion: reduce) {
  .c-btn, .bb-card, .bb-key { transition: none; animation: none; }
}
