/* BOMB IT — the HUD that sits on the arena.
   Palette measured off the account's own avatar and banner: vermillon body,
   deep maroon shadow, cream sky, ink outline. Nothing is desaturated. */

:root {
  --ink: #130a09;
  --night: #0b0708;
  --body: #d35731;
  --shade: #a8431f;
  --deep: #5c2716;
  --cream: #f5e5d0;
  --sand: #e8cfae;
  --gold: #f3c34b;
  --ember: #ff7a1a;
  --slate: #7fa6b8;
  --panel: rgba(11, 7, 8, 0.80);
  --line: rgba(245, 229, 208, 0.16);
  --display: 'Press Start 2P', monospace;
  --text: 'Rubik', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --bar: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--night);
}

body {
  font-family: var(--text);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

code, pre, kbd { font-family: var(--mono); }

/* ------------------------------------------------------------------ boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  background: var(--night);
  transition: opacity .45s ease;
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot-mark { width: min(340px, 64vw); image-rendering: pixelated; }
.boot-bar {
  width: min(300px, 56vw);
  height: 10px;
  border: 2px solid var(--deep);
  background: rgba(245, 229, 208, .06);
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 6%;
  background: var(--body);
  transition: width .3s ease;
}
.boot-txt {
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--sand);
  opacity: .72;
}

/* ----------------------------------------------------------------- stage */

.stage { position: fixed; inset: 0; z-index: 0; }
.stage canvas { display: block; width: 100%; height: 100%; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(112% 84% at 50% 44%, transparent 42%, rgba(22, 9, 7, .55) 72%, rgba(14, 6, 5, .86) 100%);
}
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .20;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0 2px,
    rgba(0, 0, 0, .5) 2px 3px
  );
  mix-blend-mode: multiply;
}

/* A reading page dims the arena behind it: the stage is the subject on
   /arena, and a backdrop everywhere else. Panels keep their own fill so the
   bloom never washes a label out. */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease;
  background:
    linear-gradient(to bottom, rgba(18, 8, 6, .93), rgba(20, 9, 7, .76) 40%, rgba(14, 6, 5, .92)),
    rgba(18, 8, 6, .28);
}
body:not([data-route="arena"]) .scrim { opacity: 1; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: linear-gradient(to bottom, rgba(8, 5, 5, .94), rgba(8, 5, 5, .58) 72%, transparent);
}
.brand { flex: none; line-height: 0; }
.brand img { width: 148px; image-rendering: pixelated; }
.brand .mark-mini { display: none; width: 30px; }

.tabs { display: flex; gap: 4px; margin-left: 6px; }
.tabs a {
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: .06em;
  text-decoration: none;
  padding: 10px 12px;
  color: rgba(245, 229, 208, .62);
  border: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.tabs a:hover { color: var(--cream); }
body[data-route="arena"] .tabs a[data-tab="arena"],
body[data-route="lobby"] .tabs a[data-tab="lobby"],
body[data-route="rules"] .tabs a[data-tab="rules"],
body[data-route="token"] .tabs a[data-tab="token"] {
  color: var(--cream);
  border-color: var(--deep);
  background: rgba(211, 87, 49, .22);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: .06em;
  padding: 9px 11px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .64);
  color: var(--sand);
  text-decoration: none;
  white-space: nowrap;
}
.pill i {
  width: 7px;
  height: 7px;
  background: var(--body);
  box-shadow: 0 0 10px var(--ember);
}
.pill.ghost:hover { border-color: var(--body); color: var(--cream); }

/* --------------------------------------------------------------- buttons */

.btn {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--ink);
  background: var(--body);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--deep);
  padding: 12px 15px;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: var(--ember); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--deep); }
.btn[disabled] { opacity: .42; cursor: not-allowed; box-shadow: 3px 3px 0 var(--deep); }
.btn-sm { font-size: 8px; padding: 10px 12px; }
.btn-ghost {
  background: transparent;
  color: var(--sand);
  border-color: var(--line);
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(211, 87, 49, .2); color: var(--cream); }
.btn-bomb { width: 100%; background: var(--gold); }
.btn-bomb.armed { background: var(--ember); color: var(--cream); }

/* --------------------------------------------------------------- screens */

main { position: relative; z-index: 10; }

.screen { display: none; }
body[data-route="arena"] [data-screen="arena"],
body[data-route="lobby"] [data-screen="lobby"],
body[data-route="rules"] [data-screen="rules"],
body[data-route="token"] [data-screen="token"] { display: block; }

.panel {
  background: var(--panel);
  backdrop-filter: blur(9px);
  border: 2px solid var(--line);
  padding: 16px;
}

/* --------------------------------------------------------------- the HUD */

.arena-grid {
  position: fixed;
  inset: var(--bar) 0 0 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  pointer-events: none;
}
.arena-grid > * { pointer-events: auto; }
.hud-left, .hud-right { width: 290px; max-width: 42vw; }

.hud-phase {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-size: 11px;
}
.hud-phase .dot {
  width: 10px;
  height: 10px;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}
.hud-phase .dot[data-phase="reveal"] { background: var(--slate); box-shadow: 0 0 12px var(--slate); }
.hud-phase .dot[data-phase="resolve"] { background: var(--ember); box-shadow: 0 0 12px var(--ember); }
.hud-tick {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--sand);
  opacity: .8;
}
.hud-tick b { color: var(--cream); }

.meter {
  height: 8px;
  margin: 12px 0 10px;
  border: 2px solid var(--line);
  background: rgba(245, 229, 208, .05);
}
.meter i { display: block; height: 100%; width: 0; background: var(--body); }

.hud-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(245, 229, 208, .74);
}

.seal { margin-bottom: 14px; }
.seal-label {
  display: block;
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: .1em;
  color: var(--sand);
  opacity: .66;
  margin-bottom: 6px;
}
.seal code {
  display: block;
  font-size: 11px;
  padding: 8px 9px;
  border: 2px solid var(--line);
  background: rgba(0, 0, 0, .34);
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls { display: grid; gap: 10px; }
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: ". up ." "left stay right" ". down .";
  gap: 5px;
  justify-items: stretch;
}
.dpad button {
  font-size: 13px;
  line-height: 1;
  padding: 11px 0;
  color: var(--cream);
  background: rgba(245, 229, 208, .07);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.dpad button:hover { background: rgba(211, 87, 49, .3); }
.dpad button.on { background: var(--body); border-color: var(--ink); color: var(--ink); }
.dpad button[disabled] { opacity: .26; cursor: not-allowed; }
.dpad button[data-move="1"] { grid-area: up; }
.dpad button[data-move="3"] { grid-area: left; }
.dpad button[data-move="0"] { grid-area: stay; }
.dpad button[data-move="4"] { grid-area: right; }
.dpad button[data-move="2"] { grid-area: down; }

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: rgba(245, 229, 208, .5);
}
kbd {
  display: inline-block;
  padding: 2px 5px;
  margin-right: 2px;
  font-size: 10px;
  border: 1px solid var(--line);
  background: rgba(245, 229, 208, .07);
}

.hud-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.hud-head h2 {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: .06em;
  margin: 0;
  margin-right: auto;
}

.seats { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 7px; }
.seats li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 2px solid var(--line);
  background: rgba(0, 0, 0, .28);
  font-size: 12px;
}
.seats li.dead { opacity: .36; }
.seats li.you { border-color: var(--body); }
.seats .swatch { width: 13px; height: 13px; border: 2px solid var(--ink); flex: none; }
.seats .who { font-family: var(--display); font-size: 8px; letter-spacing: .04em; }
.seats .stats { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--sand); }
.seats .stats b { color: var(--cream); }

.legend {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 11.5px;
  color: rgba(245, 229, 208, .66);
}
.legend span { display: flex; align-items: center; gap: 7px; }
.chip { width: 11px; height: 11px; flex: none; border: 2px solid var(--ink); }
.chip.fire { background: var(--ember); }
.chip.bomb { background: var(--body); }
.chip.vest { background: var(--slate); }
.chip.gold { background: var(--gold); }

.hud-foot {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.55;
  color: rgba(245, 229, 208, .5);
}
.hud-foot code { color: var(--sand); font-size: 11px; }
.seedline { font-family: var(--mono); font-size: 10.5px; color: rgba(245, 229, 208, .4); }
.seedline code { color: var(--gold); }

.banner {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--panel);
  backdrop-filter: blur(9px);
  border: 2px solid var(--body);
  box-shadow: 0 0 44px rgba(211, 87, 49, .36);
  max-width: calc(100vw - 32px);
}
.banner[hidden] { display: none; }
.banner strong { font-family: var(--display); font-size: 13px; color: var(--gold); }
.banner span { font-size: 13px; color: rgba(245, 229, 208, .78); }

/* ------------------------------------------------------------ long pages */

.column {
  max-width: 860px;
  margin: 0 auto;
  padding: calc(var(--bar) + 36px) 16px 120px;
}

.column h1 {
  font-family: var(--display);
  font-size: clamp(19px, 4.3vw, 30px);
  line-height: 1.5;
  letter-spacing: .02em;
  margin: 0 0 18px;
  text-shadow: 3px 3px 0 var(--deep);
}
.column h2 {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: .04em;
  margin: 46px 0 14px;
  color: var(--body);
}
.column h3 { font-family: var(--display); font-size: 11px; margin: 0 0 8px; line-height: 1.6; }

.lede {
  font-size: 15.5px;
  line-height: 1.72;
  color: rgba(245, 229, 208, .82);
  margin: 0 0 16px;
  max-width: 68ch;
}
.lede.muted { color: rgba(245, 229, 208, .55); font-size: 14px; }
.lede code, .column p code { color: var(--gold); font-size: 13.5px; }

.state-card { display: grid; gap: 10px; margin: 20px 0 10px; }
.state-card p { margin: 0; font-size: 14.5px; line-height: 1.68; color: rgba(245, 229, 208, .76); }
.state-card p.muted { color: rgba(245, 229, 208, .5); }
.tag {
  justify-self: start;
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: .12em;
  padding: 6px 8px;
  background: var(--deep);
  color: var(--sand);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 20px 0;
}
.stat {
  padding: 14px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .84);
  backdrop-filter: blur(6px);
  display: grid;
  gap: 5px;
}
.stat span { font-family: var(--display); font-size: 7px; letter-spacing: .1em; color: var(--sand); opacity: .7; }
.stat b { font-family: var(--mono); font-size: 20px; color: var(--cream); font-weight: 600; }
.stat em { font-style: normal; font-size: 11.5px; color: rgba(245, 229, 208, .46); }

.steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.steps li {
  position: relative;
  padding: 18px 18px 18px 64px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .84);
  backdrop-filter: blur(6px);
}
.step-no {
  position: absolute;
  left: 16px;
  top: 17px;
  width: 32px;
  height: 32px;
  display: grid;
  place-content: center;
  font-family: var(--display);
  font-size: 12px;
  color: var(--ink);
  background: var(--body);
  border: 2px solid var(--ink);
}
.steps p { margin: 0; font-size: 14px; line-height: 1.66; color: rgba(245, 229, 208, .76); }

.order { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 8px; }
.order li { font-size: 14.5px; line-height: 1.6; color: rgba(245, 229, 208, .8); }
.order b { color: var(--gold); font-family: var(--mono); }

.board-art {
  margin: 0 0 16px;
  padding: 18px;
  border: 2px solid var(--line);
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(6px);
  font-size: 12px;
  line-height: 1.5;
  color: var(--sand);
  overflow-x: auto;
}

.pups { display: grid; gap: 8px; margin-bottom: 10px; }
.pups > div {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .84);
  backdrop-filter: blur(6px);
  font-size: 14px;
  flex-wrap: wrap;
}
.pups b { font-family: var(--display); font-size: 9px; }
.pups span { color: rgba(245, 229, 208, .7); }

.table-spec, .gas { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.table-spec > div, .gas > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .84);
  backdrop-filter: blur(6px);
  font-size: 13.5px;
}
.table-spec span, .gas span { color: rgba(245, 229, 208, .6); }
.table-spec b, .gas b { font-family: var(--mono); color: var(--cream); font-weight: 600; }

.flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.flow-node {
  flex: 1 1 150px;
  min-width: 0;
  padding: 14px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .84);
  backdrop-filter: blur(6px);
  display: grid;
  gap: 5px;
}
.flow-node b { font-family: var(--display); font-size: 11px; }
.flow-node span { font-size: 12px; color: rgba(245, 229, 208, .62); }
.flow-node.win { border-color: var(--body); }
.flow-node.burn { border-color: var(--ember); }
.flow-node.vault { border-color: var(--gold); }
.flow-arrow { align-self: center; font-size: 17px; color: var(--sand); opacity: .5; }

.tables { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tables li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .84);
  backdrop-filter: blur(6px);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.tables .id { font-family: var(--display); font-size: 9px; color: var(--gold); }
.tables .meta { color: rgba(245, 229, 208, .66); }
.tables .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.addr-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.addr-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 8, .84);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}
.addr-list span { font-family: var(--display); font-size: 8px; color: var(--sand); }
.addr-list code { margin-left: auto; font-size: 12px; color: var(--gold); word-break: break-all; }

.foot {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 18px 16px 24px;
  font-size: 12px;
  color: rgba(245, 229, 208, .42);
  border-top: 2px solid var(--line);
  background: rgba(8, 5, 5, .72);
}
body[data-route="arena"] .foot { display: none; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--body); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 12px 16px;
  font-size: 13px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 2px solid var(--body);
  max-width: calc(100vw - 32px);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1020px) {
  .hud-left, .hud-right { width: 252px; }
}

@media (max-width: 860px) {
  :root { --bar: 56px; }
  .brand img { width: 112px; }
  .tabs a { padding: 9px 8px; font-size: 8px; }
  .x-link { display: none; }
  .arena-grid {
    inset: auto 0 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    max-height: 52vh;
    overflow-y: auto;
  }
  .hud-left, .hud-right { width: auto; max-width: none; }
  .hud-left { order: -1; }
  .hud-foot, .keys, .legend, .seedline { display: none; }
  .hud-note { font-size: 12px; margin-bottom: 9px; }
  .seats li { padding: 6px 8px; font-size: 11px; }
  .panel { padding: 12px; }
  .banner { bottom: auto; top: calc(var(--bar) + 10px); }
}

@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand .mark-full { display: none; }
  .brand .mark-mini { display: block; }
  .tabs { margin-left: 0; gap: 2px; }
  .tabs a { padding: 8px 5px; font-size: 7px; }
  .btn-sm { padding: 9px 9px; }
  .pill.chain { display: none; }
  .column { padding-left: 16px; padding-right: 16px; }
  .flow-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
