/* Layout: one full-bleed canvas arena, HUD along the top edge, two thumbpads in the bottom corners, one centered panel for title / pause / game over. A single deliberate dark look, so tokens are not themed. */
:root {
  --ground: #05070f;
  --grid: #0f1a3c;
  --ink: #eef6ff;
  --dim: #8fa3d6;
  --player: #19f0ff;
  --enemy: #ffb800;
  --weak: #ff2f87;
  --ally: #5b8cff;
  --rival: #7dff3a;
  --pu: #ffffff;
  --pad: clamp(96px, min(34vw, 38vh), 168px);
  --btn: clamp(56px, 16vw, 84px);
  --font-display: "Chakra Petch", "Arial Narrow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  position: relative;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-mono);
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* HUD */
.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
  gap: 8px 16px; padding: 12px 16px; pointer-events: none;
}
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat.mid { align-items: center; text-align: center; }
.stat.end { align-items: flex-end; }
.lab { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.val { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.val.small { font-size: 13px; font-weight: 500; color: var(--dim); }
.chain { height: 16px; font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--enemy); }
.teams { display: flex; gap: 10px; align-items: center; height: 14px; }
.team { display: flex; gap: 2px; }
.pip { width: 11px; height: 11px; background: var(--c); clip-path: polygon(100% 50%, 8% 0, 8% 100%); }
.pip.spent { opacity: .2; }
.boostrow { display: flex; align-items: center; gap: 8px; }
.meter { width: 88px; height: 6px; background: var(--grid); border-radius: 1px; overflow: hidden; }
.meter i { display: block; width: 100%; height: 100%; transform-origin: left; transform: scaleX(var(--p, 1)); background: var(--dim); }
.meter.ready i { background: var(--pu); }
.meter.live i { background: var(--ink); }
.boost {
  display: none; position: absolute; bottom: calc(16px + 2 * (var(--btn) + 10px)); right: calc(16px + var(--pad) + 8px); z-index: 3;   /* just left of the right pad; a column of three: sludge, bomb, boost (top) */
  width: var(--btn); aspect-ratio: 1; padding: 0; border-radius: 50%;
  border: 0; background: rgba(6, 10, 26, .6); color: var(--dim);
  font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.is-touch .boost { display: block; }
.boost::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--dim) calc(var(--p, 1) * 360deg), var(--grid) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}
.boost.ready { color: var(--pu); }
.boost.ready::before { background: var(--pu); }
.boost.live { background: var(--ink); color: var(--ground); }
.boost.live::before { background: conic-gradient(var(--ink) calc(var(--p, 1) * 360deg), var(--grid) 0); }
.boost:focus-visible { outline: 2px solid var(--weak); outline-offset: 3px; }
.bomb { bottom: calc(16px + var(--btn) + 10px); line-height: 1.05; }   /* middle of the column */
.bomb b { display: block; font-size: 18px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.bomb.ready { color: var(--weak); }
.bomb.ready::before { background: var(--weak); }
.bomb.charging { color: var(--dim); }
.bombs { min-width: 88px; font-size: 12px; letter-spacing: .25em; color: var(--weak); text-align: left; }
.fx { min-height: 14px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--pu); text-align: right; }
.lives { display: flex; gap: 6px; align-items: center; height: 24px; }
.life { width: 16px; height: 16px; background: var(--player); clip-path: polygon(100% 50%, 8% 0, 8% 100%); }
.life.spent { opacity: .2; }
.snd {
  pointer-events: auto; font: inherit; font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim); background: none; border: 1px solid var(--grid); border-radius: 2px;
  padding: 6px 10px; min-height: 32px; cursor: pointer;
}
.snd:focus-visible, .btn:focus-visible { outline: 2px solid var(--weak); outline-offset: 3px; }

/* Thumbpads, shown on touch devices only */
.pad {
  display: none; position: absolute; bottom: 16px; z-index: 3;
  width: var(--pad); aspect-ratio: 1;
  border-radius: 50%; border: 2px solid var(--grid); background: rgba(6, 10, 26, .6);
  touch-action: none;
}
.is-touch .pad { display: block; }
.pad.l { left: 16px; }
.pad.r { right: 16px; }
.pad .tag { position: absolute; left: 0; right: 0; top: 12px; text-align: center; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); pointer-events: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 38%; height: 38%; margin: -19% 0 0 -19%; border-radius: 50%; background: var(--ink); opacity: .45; pointer-events: none; }
.pad.active { border-color: var(--dim); }
.pad.active .knob { opacity: .85; }

/* Panel */
.overlay { position: absolute; inset: 0; z-index: 10; display: flex; padding: 16px; background: rgba(4, 6, 16, .86); overflow: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.panel { width: 100%; max-width: 400px; margin: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.pcol { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; min-width: 0; }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--weak); }
h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 14vw, 68px); line-height: .95; letter-spacing: .02em; text-transform: uppercase; text-wrap: balance; text-shadow: 0 0 22px rgba(25, 240, 255, .6), 0 0 3px rgba(25, 240, 255, .8); }
.panel p { margin: 0; font-size: 14px; line-height: 1.55; max-width: 44ch; }
.panel .controls { color: var(--dim); font-size: 13px; }
.diagram { width: 100%; max-width: 260px; height: auto; }
.d-p { fill: rgba(25, 240, 255, .18); stroke: var(--player); stroke-width: 2.5; stroke-linejoin: round; }
.d-e { fill: rgba(255, 184, 0, .18); stroke: var(--enemy); stroke-width: 2.5; stroke-linejoin: round; }
.d-w { stroke: var(--weak); stroke-width: 5; }
.d-t { stroke: var(--dim); stroke-width: 2; stroke-linecap: round; opacity: .6; fill: none; }
.stats { font-family: var(--font-display); font-weight: 500; font-size: 18px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.btn {
  font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ground); background: var(--enemy); border: 0; border-radius: 2px; padding: 14px 26px; min-height: 48px; cursor: pointer;
}
.only-touch { display: none; }
@media (orientation: landscape) and (max-height: 560px) {
  /* Short screens: title and Launch on the left, the explanation on the right, so Launch never falls below the fold */
  .overlay { padding: 10px 16px; }
  .panel { max-width: 820px; display: grid; grid-template-columns: 1fr 1.15fr; column-gap: 28px; row-gap: 10px; align-items: center; justify-items: start; }
  .pcol { display: contents; }
  .eyebrow { grid-area: 1 / 1; }
  h1 { grid-area: 2 / 1; font-size: clamp(34px, 11vh, 52px); }
  .diagram { grid-area: 3 / 1; max-width: 190px; }
  #go { grid-area: 4 / 1; }
  #ovText { grid-area: 1 / 2 / 4 / 3; }
  #ctl { grid-area: 4 / 2; }
  #ovStats { grid-area: 4 / 2; }
  .panel p { font-size: 12px; line-height: 1.42; max-width: none; }
  .panel .controls { font-size: 11.5px; }
  .stats { font-size: 15px; }
  .btn { min-height: 44px; padding: 10px 22px; font-size: 15px; }
}
@media (orientation: landscape) and (max-height: 340px) { .diagram { display: none; } .panel p { font-size: 11.5px; } }
}
.is-touch .only-touch { display: block; }
.is-touch .only-desk { display: none; }
.sludge { bottom: 16px; font-size: 10px; letter-spacing: .08em; }   /* bottom of the column, directly left of the right pad; hold to spray */
.sludge.ready { color: var(--player); }
.sludge.ready::before { background: var(--player); }
.sludge.live { background: var(--player); color: var(--ground); }
.sludge.live::before { background: conic-gradient(var(--ground) calc(var(--p, 1) * 360deg), var(--grid) 0); }
