:root {
  --bg: #070a14;
  --panel: rgba(16, 22, 44, 0.92);
  --panel-solid: #111831;
  --line: #26305a;
  --text: #eef2ff;
  --muted: #9aa6d1;
  --accent: #5fb0ff;
  --accent-2: #8b7bff;
  --good: #46e39a;
  --bad: #ff5d73;
  --gold: #ffd43b;
  --radius: 12px;
  /* The screen's safe areas (docs/PLATFORMS.md, "Layout"): under a notch, a
     cut-out, the status bar of the home-screen app or the home indicator.
     Everything the player reads or touches stays inside them; the tests set
     these to try insets a browser here has none of. */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  /* The site header: 48 px, under the status bar in the home-screen app (site.css). */
  --header-h: calc(48px + var(--safe-t));
  /* The smallest text: 14 px on a desktop, 15 on a tablet, 13 on a phone
     (the blobs' names on the canvas too: main.js reads it). */
  --t-min: 14px;
  --card-pad: 18px;
  color-scheme: dark;
}

/* A tablet: a touch screen at least 600 px each way. */
@media (pointer: coarse) {
  :root {
    --t-min: 15px;
  }
}

/* A phone: a touch screen under 600 px one way or the other. */
@media (pointer: coarse) and (max-width: 599px), (pointer: coarse) and (max-height: 599px) {
  :root {
    --t-min: 13px;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  touch-action: manipulation;
  cursor: pointer;
}

/* How the rooms name this player: the username, or a guest name and a way to sign in. */
.who-line {
  flex: 1;
  min-width: 0;
  font-size: max(14px, var(--t-min));
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.who-line a {
  display: inline-block;
  min-width: 44px;
  box-sizing: border-box;
  padding: 13px 2px;
  margin: -13px 0;
  text-align: center;
  color: var(--accent, #ffd166);
  font-weight: 700;
}

.board-line {
  margin: 2px 0 6px;
  font-size: 13px;
  opacity: 0.9;
}

[hidden] {
  display: none !important;
}

.page {
  padding: 8px 8px 40px;
}

/* ---------- Game layout ---------- */

/* No selection or long-press menu over the game; main.js also prevents
   Safari's pinch gesture and the context menu there. While a life runs no
   touch scrolls or zooms anything (html.if-life, below). */
.game-root {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 1400px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0b1020;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-h) - 18px);
  height: calc(100dvh - var(--header-h) - 18px);
  /* Never taller than the screen: a fixed 440 px minimum pushed the HUD and
     the results buttons below the fold on phones in landscape. */
  min-height: min(440px, calc(100vh - var(--header-h)));
  min-height: min(440px, calc(100dvh - var(--header-h)));
  max-height: 900px;
  /* The safe areas inside the stage: its sides and bottom meet the screen's
     on a touch screen (no gutter, no page below it), its top only in full
     screen and on a phone held sideways mid-life, when no header is above it. */
  --in-t: 0px;
  --in-r: var(--safe-r);
  --in-b: var(--safe-b);
  --in-l: var(--safe-l);
  /* How far the HUD keeps from those edges: what the player reads (--gap),
     touch controls a further step in (--tap), and on a phone 24 px from the
     sides, clear of the rounded corners (--corner). */
  --gap: 10px;
  --tap: 10px;
  --corner: 0px;
  --side-l: max(var(--corner), calc(var(--in-l) + var(--gap)));
  --side-r: max(var(--corner), calc(var(--in-r) + var(--gap)));
  /* The live board's size, so the toasts keep clear of it. */
  --board-w: 200px;
  --board-h: 160px;
  /* The top of the toasts, and how far they keep from the sides: between
     the score and the board, or under the board where that is too narrow. */
  --toast-top: calc(var(--in-t) + var(--gap) + 4px);
  --toast-side: calc(max(var(--side-l), var(--side-r)) + var(--board-w) + 8px);
  /* "Leave full screen" (site.css): 44 px at the top in the middle, 8 px down. */
  --exit-bottom: calc(max(8px, var(--safe-t)) + 44px);
}

/* Touch controls keep 16 px inside the safe areas, so a thumb on one never
   starts the system's edge gestures. */
@media (pointer: coarse) {
  .stage {
    --tap: 16px;
  }
}

@media (pointer: coarse) and (max-width: 599px), (pointer: coarse) and (max-height: 599px) {
  .stage {
    --gap: 8px;
    --corner: 24px;
    --board-w: 160px;
  }
}

/* Under 900 px wide the toasts go below the board, unless the screen is too
   short for that (a phone held sideways), where they stay at the top. */
@media (max-width: 899px) and (min-height: 501px) {
  .stage {
    --toast-top: calc(var(--in-t) + var(--gap) + var(--board-h) + 8px);
    --toast-side: 5%;
  }
}

/* Full screen (the site's button; main.js sets .full): the arena fills the
   screen edge to edge, with the HUD inside the safe areas. "Leave full
   screen" sits at the top in the middle: the score and the board keep to
   the corners, the toasts and the cards start below it, and on a screen
   too narrow for the board beside it, the board goes below it too. */
.game-root.full {
  border: 0;
  border-radius: 0;
}

.game-root.full .stage {
  height: 100%;
  min-height: 0;
  max-height: none;
  --in-t: var(--safe-t);
}

@media (min-height: 501px) and (min-width: 900px), (max-height: 500px) {
  .game-root.full .stage {
    --toast-top: calc(var(--exit-bottom) + 8px);
  }
}

@media (max-width: 439px) {
  .game-root.full .board {
    top: calc(var(--exit-bottom) + 8px);
  }
  .game-root.full .stage {
    --toast-top: calc(var(--exit-bottom) + 8px + var(--board-h) + 8px);
  }
}

.game-root.full .overlay {
  padding-top: calc(var(--exit-bottom) + 8px);
}

/* Where the minimap goes (the renderer draws it): its bottom-right corner. */
.mm-anchor {
  position: absolute;
  right: var(--side-r);
  bottom: calc(var(--in-b) + var(--gap));
  width: 0;
  height: 0;
  visibility: hidden;
  pointer-events: none;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* While a life runs (main.js updateTouchLock) every touch belongs to the
   game: nothing on the page pans or zooms it, the HUD buttons included. */
html.if-life,
html.if-life * {
  touch-action: none;
}

html.if-life {
  overscroll-behavior: none;
}

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

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-me {
  position: absolute;
  left: var(--side-l);
  top: calc(var(--in-t) + var(--gap));
  padding: 6px 12px 8px;
  background: rgba(8, 12, 28, 0.62);
  border: 1px solid rgba(120, 150, 255, 0.18);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.hud-pct {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.hud-pct small {
  font-size: 16px;
  margin-left: 2px;
  color: var(--muted);
}

.hud-pct.bump {
  animation: bump 0.35s ease-out;
}

@keyframes bump {
  0% {
    transform: scale(1.25);
    color: var(--good);
  }
  100% {
    transform: scale(1);
  }
}

.hud-sub {
  display: flex;
  gap: 10px;
  font-size: max(13px, var(--t-min));
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hud-sub b {
  color: var(--text);
}

.hud-rank {
  color: var(--gold);
  font-weight: 800;
}

/* The live board: a fixed width (names shorten to fit) and rows of a fixed
   height, at most 158 px tall with its seven rows (--board-h). */
.board {
  position: absolute;
  right: var(--side-r);
  top: calc(var(--in-t) + var(--gap));
  margin: 0;
  padding: 6px 8px;
  list-style: none;
  width: var(--board-w);
  background: rgba(8, 12, 28, 0.62);
  border: 1px solid rgba(120, 150, 255, 0.18);
  border-radius: 12px;
  font-size: max(13px, var(--t-min));
  line-height: 18px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.board li {
  display: grid;
  grid-template-columns: 18px 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 2px 2px;
  font-variant-numeric: tabular-nums;
}

.board li.me {
  color: #fff;
  font-weight: 800;
}

.board li.gap {
  display: block;
  text-align: center;
  color: var(--muted);
  line-height: 8px;
  padding: 0 0 4px;
}

.board .rk {
  color: var(--muted);
  text-align: right;
}

.board .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.board .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board .pc {
  color: var(--muted);
}

.board li.me .pc {
  color: var(--text);
}

.hud-buttons {
  position: absolute;
  left: max(var(--corner), calc(var(--in-l) + var(--tap)));
  bottom: calc(var(--in-b) + var(--tap));
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

/* Every button is at least 44 px, with 8 px between: thumb-sized on a touch
   screen, a touch laptop included. */
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(120, 150, 255, 0.25);
  background: rgba(8, 12, 28, 0.7);
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn[aria-pressed='false'] {
  color: var(--muted);
}

.title-audio {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.net-note {
  position: absolute;
  left: 50%;
  bottom: calc(var(--in-b) + var(--gap));
  transform: translateX(-50%);
  font-size: var(--t-min);
  color: var(--muted);
  background: rgba(8, 12, 28, 0.7);
  border: 1px solid rgba(120, 150, 255, 0.18);
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 3;
}

.net-note .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--muted);
  vertical-align: 1px;
}

.net-note.online .dot {
  background: var(--good);
  box-shadow: 0 0 6px var(--good);
}

/* ---------- Toasts ---------- */

.toasts {
  position: absolute;
  left: 50%;
  top: var(--toast-top);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 4;
  width: max-content;
  max-width: calc(100% - 2 * var(--toast-side));
}

.toast {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(10, 14, 32, 0.88);
  border: 1px solid rgba(120, 150, 255, 0.3);
  font-weight: 700;
  font-size: max(14px, var(--t-min));
  animation: toastIn 0.25s ease-out, toastOut 0.4s ease-in forwards;
  animation-delay: 0s, var(--life, 2.4s);
  text-align: center;
}

.toast.gold {
  border-color: var(--gold);
  color: var(--gold);
}

.toast.good {
  border-color: var(--good);
  color: var(--good);
}

.toast.bad {
  border-color: var(--bad);
  color: #ffc2cb;
}

@keyframes toastIn {
  from {
    transform: translateY(-10px) scale(0.9);
    opacity: 0;
  }
}

@keyframes toastOut {
  to {
    transform: translateY(-8px);
    opacity: 0;
  }
}

/* ---------- Joystick ---------- */

.joy {
  position: absolute;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  pointer-events: none;
  z-index: 2;
}

.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

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

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  /* Cards stay inside the safe areas, their buttons 16 px or more inside. */
  padding: max(14px, calc(var(--in-t) + 8px)) max(14px, calc(var(--in-r) + 8px)) max(14px, calc(var(--in-b) + 8px)) max(14px, calc(var(--in-l) + 8px));
  z-index: 5;
  overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(7, 10, 20, 0.45), rgba(7, 10, 20, 0.82));
}

.overlay.show {
  display: flex;
}

.overlay.dim {
  background: rgba(7, 10, 20, 0.55);
}

.card {
  width: min(560px, 100%);
  max-height: 100%;
  overflow-y: auto;
  margin: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: var(--card-pad);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: cardIn 0.25s ease-out;
}

@keyframes cardIn {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
  }
}

.logo {
  font-size: clamp(38px, 9vw, 58px);
  font-weight: 900;
  letter-spacing: 3px;
  text-align: center;
  margin: 2px 0 0;
  line-height: 1;
  background: linear-gradient(100deg, #5fb0ff 0%, #a78bfa 45%, #ff6b9b 80%, #ffd43b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5));
}

.tagline {
  text-align: center;
  color: var(--muted);
  margin: 6px 0 14px;
  font-size: 15px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.name-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0a0f22;
  font-size: 16px;
  font-weight: 700;
}

.btn {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 12px 18px;
  font-weight: 800;
  background: #1c2550;
  border: 1px solid var(--line);
}

.btn:hover {
  filter: brightness(1.12);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.skin:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn-play {
  background: linear-gradient(180deg, #5fb0ff, #3d7bff);
  border: 0;
  color: #fff;
  font-size: 20px;
  padding: 14px 26px;
  box-shadow: 0 6px 0 #2549a8, 0 10px 24px rgba(61, 123, 255, 0.35);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.08s;
}

.btn-play:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #2549a8;
}

.btn-wide {
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-row .btn {
  flex: 1;
}

.section-title {
  font-size: var(--t-min);
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.section-title .hint {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}

.level-box {
  margin-top: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: center;
}

.level-badge {
  grid-row: span 2;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  background: linear-gradient(160deg, #8b7bff, #3d7bff);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.level-meta {
  display: flex;
  justify-content: space-between;
  font-size: max(13px, var(--t-min));
  color: var(--muted);
  gap: 8px;
}

.level-meta b {
  color: var(--text);
}

.bar {
  height: 12px;
  background: #0a0f22;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #5fb0ff, #a78bfa);
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bar.near .bar-fill {
  background: linear-gradient(90deg, #a78bfa, #ffd43b);
  box-shadow: 0 0 12px rgba(255, 212, 59, 0.6);
}

.bar.small {
  height: 7px;
}

.streak {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: max(13px, var(--t-min));
  color: var(--muted);
  margin-top: 10px;
}

.streak svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.streak b {
  color: #ffb347;
}

.missions {
  display: grid;
  gap: 8px;
}

.mission {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 4px 10px;
  align-items: center;
  font-size: max(14px, var(--t-min));
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mission .check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--line);
  grid-row: span 2;
  display: grid;
  place-items: center;
}

.mission.done .check {
  background: var(--good);
  border-color: var(--good);
}

.mission.done .check::after {
  content: '';
  width: 5px;
  height: 10px;
  border: solid #07220f;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.mission.done .mtext {
  color: var(--muted);
  text-decoration: line-through;
}

.mission .mxp {
  font-size: var(--t-min);
  color: var(--gold);
  font-weight: 800;
}

.mission .bar {
  grid-column: 2 / span 2;
}

.skins {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}

.skin {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #0a0f22;
  padding: 0;
  overflow: hidden;
}

.skin canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.skin.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(95, 176, 255, 0.5);
}

.skin.locked canvas {
  filter: grayscale(0.9) brightness(0.45);
}

.skin .lock {
  position: absolute;
  inset: auto 0 3px 0;
  font-size: var(--t-min);
  letter-spacing: -0.3px;
  font-weight: 800;
  color: #cbd5ff;
  text-shadow: 0 1px 2px #000;
}

.skin-name {
  font-size: max(13px, var(--t-min));
  color: var(--muted);
  margin-top: 6px;
  min-height: 18px;
}

.link-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 700;
  min-height: 44px;
  padding: 12px 14px;
  font-size: max(14px, var(--t-min));
}

.status-line {
  text-align: center;
  font-size: var(--t-min);
  color: var(--muted);
  margin-top: 10px;
}

/* ---------- Death / results ---------- */

.results h2,
.paused h2 {
  margin: 0;
  font-size: 26px;
  text-align: center;
}

.results .cause,
.paused .cause {
  text-align: center;
  color: var(--muted);
  margin: 4px 0 12px;
}

/* The pause card (main.js pauseLife): short, its buttons side by side. */
.card.paused {
  width: min(420px, 100%);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}

.stat .v {
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.stat .k {
  font-size: var(--t-min);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.near-miss {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 179, 71, 0.1);
  border: 1px solid rgba(255, 179, 71, 0.45);
  color: #ffd29a;
  font-weight: 700;
  text-align: center;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
}

.badge {
  font-size: var(--t-min);
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge.gold {
  color: var(--gold);
  border-color: rgba(255, 212, 59, 0.5);
}

.badge.good {
  color: var(--good);
  border-color: rgba(70, 227, 154, 0.45);
}

.xp-gain {
  margin-top: 14px;
}

.xp-gain .level-meta {
  margin-bottom: 4px;
}

.kbd-hint {
  text-align: center;
  font-size: var(--t-min);
  color: var(--muted);
  margin-top: 8px;
}

/* Play again / Menu stay at the bottom of the card while the rest scrolls. */
.results .actions {
  position: sticky;
  bottom: calc(-1 * var(--card-pad));
  margin: 10px calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad));
  padding: 12px var(--card-pad) var(--card-pad);
  background: linear-gradient(rgba(17, 24, 49, 0.9), #111831 12px);
  border-radius: 0 0 18px 18px;
  z-index: 1;
}

.results .actions .btn-row {
  margin-top: 0;
}

.badge.more {
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  font-size: var(--t-min);
  font-weight: 800;
  min-height: 44px;
  padding: 0 16px;
}

/* Hints follow the last input used (main.js sets data-input): the keys'
   hint goes after a touch. */
html[data-input='touch'] .kbd-hint {
  display: none;
}

/* Title card: on wide screens the missions and skins get their own column
   so the whole card fits a 720 px tall window. */
@media (min-width: 800px) {
  .card.title {
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      'a b'
      'c b';
    column-gap: 28px;
    align-items: start;
  }
  .title-a {
    grid-area: a;
  }
  .title-b {
    grid-area: b;
  }
  .title-c {
    grid-area: c;
  }
  .title-b > .section-title:first-child {
    margin-top: 4px;
  }
  .card.title .skins {
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  }
}

/* Online: other humans on the live board. */
.board li.human .nm::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--good);
  vertical-align: 1px;
}

.ach-list {
  display: grid;
  gap: 6px;
}

.ach {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  opacity: 0.55;
}

.ach.got {
  opacity: 1;
  background: rgba(255, 212, 59, 0.07);
}

.ach .ico {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #1c2550;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--muted);
}

.ach.got .ico {
  background: var(--gold);
  color: #3a2a00;
}

.ach .an {
  font-weight: 800;
}

.ach .ad {
  font-size: max(13px, var(--t-min));
  color: var(--muted);
}

.today-board {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: max(14px, var(--t-min));
}

.today-board li {
  display: flex;
  justify-content: space-between;
  padding: 3px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.today-board li.me {
  color: var(--gold);
  font-weight: 800;
}

/* ---------- Ads & about ---------- */

.ad-slot:empty {
  display: none;
}

.ad-slot {
  margin: 12px auto;
  max-width: 1400px;
  min-height: 90px;
}

.about {
  max-width: 820px;
  margin: 26px auto 0;
  padding: 0 8px;
  line-height: 1.6;
  color: #d5dcf5;
}

.about h1 {
  font-size: 28px;
  margin: 0 0 8px;
}

.about h2 {
  font-size: 20px;
  margin: 22px 0 6px;
}

.about li {
  margin: 6px 0;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-size: 12px;
  background: #0d1330;
}

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

@media (max-width: 600px) {
  .page {
    padding: 0 0 30px;
  }
  .game-root {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .stage {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    min-height: 400px;
  }
  .hud-pct {
    font-size: 24px;
  }
  .stage {
    --board-w: 160px;
  }
  .hud-me {
    padding: 4px 9px 6px;
  }
  .board {
    padding: 4px 6px;
  }
  .card {
    --card-pad: 14px;
    border-radius: 16px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat {
    padding: 6px 4px;
  }
  .stat .v {
    font-size: 19px;
  }
  .results h2 {
    font-size: 22px;
  }
  .results .cause {
    margin-bottom: 8px;
  }
  .badges {
    margin-top: 8px;
    gap: 4px;
  }
  .badge {
    padding: 3px 8px;
  }
  .badge.more {
    padding: 0 14px;
  }
  .xp-gain {
    margin-top: 10px;
  }
  .toast {
    padding: 6px 12px;
  }
  /* The online/offline note sits above the buttons, clear of the minimap. */
  .net-note {
    left: var(--side-l);
    bottom: calc(var(--in-b) + var(--tap) + 44px + 8px);
    transform: none;
    padding: 3px 8px;
  }
  .btn-row .btn-play {
    flex: 1.5;
    padding: 12px 10px;
    font-size: 18px;
    white-space: nowrap;
  }
}

/* The text under the game keeps inside the safe areas (a phone held sideways). */
.about {
  padding-left: max(8px, var(--safe-l));
  padding-right: max(8px, var(--safe-r));
}

@media (max-width: 600px) {
  .about {
    padding-left: max(16px, var(--safe-l));
    padding-right: max(16px, var(--safe-r));
  }
}

/* Short screens (phones held sideways): while a life runs, the site header
   is out of the way and the stage fills the screen; on the results and the
   pause card the header (with "Full screen") is back. HUD and cards are
   compact. */
@media (max-height: 500px) {
  html.if-life .site-header {
    display: none;
  }
  html.if-life .page {
    padding: 0 0 30px;
  }
  html.if-life .game-root {
    border-radius: 0;
    border: 0;
  }
  .stage {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    min-height: 0;
  }
  html.if-life .stage {
    height: 100vh;
    height: 100dvh;
    --in-t: var(--safe-t);
  }
  .hud-me {
    padding: 3px 9px 5px;
  }
  .hud-pct {
    font-size: 22px;
  }
  .board {
    padding: 3px 6px;
  }
  .board li {
    padding: 0 2px;
  }
  .net-note {
    bottom: calc(var(--in-b) + var(--gap));
    left: 50%;
    transform: translateX(-50%);
  }
  .overlay {
    padding: calc(var(--in-t) + 8px) max(14px, calc(var(--in-r) + 8px)) calc(var(--in-b) + 8px) max(14px, calc(var(--in-l) + 8px));
  }
  .card {
    --card-pad: 12px;
  }
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
  .results h2 {
    font-size: 20px;
  }
  .results .cause {
    margin: 2px 0 6px;
  }
  .stat {
    padding: 4px;
  }
  .stat .v {
    font-size: 17px;
  }
  .xp-gain {
    margin-top: 8px;
  }
  .btn-play {
    font-size: 17px;
    padding: 10px 20px;
  }
}

/* Touch screens, tablets included: the arena fills the screen below the
   header with no gutter or band of page around it, so every touch in a life
   lands on the game. */
@media (pointer: coarse) {
  .page {
    padding: 0 0 30px;
  }
  .game-root {
    border-radius: 0;
    border-width: 0 0 1px;
  }
  .stage {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    max-height: none;
  }
}
