/* Gravity Wars UI: "cartoon space party" (docs/ARCHITECTURE.md §8.7).
   Sizes are in rem and the root font-size scales with the viewport, so the
   whole UI is readable from 1280×720 to 4K. Sections: tokens, base, backdrop,
   components, logo, screens, HUD, animations, responsive, reduced motion. */

/* ── Font ─────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Fredoka";
  src: url("assets/fonts/Fredoka.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* ── Tokens ───────────────────────────────────────────────────────────── */

:root {
  --space-0: #0b1026;
  --space-1: #1a1446;
  --ink: #140f2e;
  --panel: rgba(21, 26, 58, 0.86);
  --panel-top: rgba(38, 44, 96, 0.9);
  --panel-line: rgba(255, 255, 255, 0.13);
  --text: #f6f4ff;
  --text-dim: #b3afe0;
  --text-faint: #8580bb;
  --gold: #fbbf24;
  --cyan: #67e8f9;
  --pink: #f472b6;
  --violet: #8b5cf6;
  --green: #4ade80;
  --red: #ff5a5f;
  --radius: 1.1rem;
  --radius-lg: 1.45rem;
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ring: 0 0 0 0.16rem var(--ink), 0 0 0 0.38rem var(--cyan), 0 0 1.5rem 0.3rem rgba(103, 232, 249, 0.5);
  color-scheme: dark;
  font-size: clamp(15px, min(1.1vw, 1.95vh), 46px);
}

/* ── Base ─────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--space-0);
  color: var(--text);
  font-family: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

canvas#game {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

body.no-scene canvas#game {
  visibility: hidden;
}

body[data-screen="game"] canvas#game {
  cursor: crosshair;
}

#ui {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.icon {
  width: 1.2em;
  height: 1.2em;
  flex: none;
  display: inline-block;
  vertical-align: -0.2em;
}

input {
  user-select: text;
}

::selection {
  background: rgba(103, 232, 249, 0.45);
  color: #fff;
}

/* ── Backdrop (used when no renderer is drawing) ──────────────────────── */

.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(55% 45% at 18% 22%, rgba(139, 92, 246, 0.3), transparent 70%),
    radial-gradient(45% 40% at 82% 70%, rgba(244, 114, 182, 0.2), transparent 70%),
    radial-gradient(40% 35% at 60% 15%, rgba(103, 232, 249, 0.12), transparent 70%),
    linear-gradient(180deg, var(--space-0) 0%, var(--space-1) 100%);
}

.starfield__far,
.starfield__near {
  position: absolute;
  inset: -100% 0 0 -100%;
  background-repeat: repeat;
  animation: drift 160s linear infinite;
}

.starfield__far {
  opacity: 0.55;
  background-size: 260px 260px;
  background-image:
    radial-gradient(1.2px 1.2px at 18px 32px, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 120px 80px, #cfe3ff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 200px 150px, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 60px 210px, #ffe7c2 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 230px 20px, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 150px 240px, #cfe3ff 50%, transparent 52%);
}

.starfield__near {
  animation-duration: 90s;
  background-size: 420px 420px;
  background-image:
    radial-gradient(2px 2px at 40px 60px, #fff 50%, transparent 55%),
    radial-gradient(2.4px 2.4px at 300px 120px, #ffe9a8 50%, transparent 55%),
    radial-gradient(1.8px 1.8px at 180px 330px, #b9f6ff 50%, transparent 55%),
    radial-gradient(2.2px 2.2px at 380px 260px, #fff 50%, transparent 55%);
}

.starfield__planet {
  position: absolute;
  right: -9vmin;
  bottom: -16vmin;
  width: 52vmin;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffd9f1 0%, #f472b6 22%, #b0357e 62%, #5e1b4f 100%);
  border: 0.6vmin solid var(--ink);
  box-shadow:
    inset -5vmin -4vmin 0 rgba(20, 15, 46, 0.32),
    0 0 8vmin rgba(244, 114, 182, 0.35);
}

.starfield__planet::after {
  content: "";
  position: absolute;
  inset: 38% -24%;
  border-radius: 50%;
  border: 1.6vmin solid rgba(251, 191, 36, 0.85);
  border-top-color: transparent;
  transform: rotate(-18deg);
}

/* ── Layout shell ─────────────────────────────────────────────────────── */

.screen-host,
.overlays {
  position: absolute;
  inset: 0;
}

.overlays {
  z-index: 10;
}

.screen {
  position: absolute;
  inset: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: max(1.1rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(0.7rem, env(safe-area-inset-bottom))
    max(1.5rem, env(safe-area-inset-left));
  pointer-events: auto;
  overflow: hidden;
  animation: screen-in 0.4s var(--ease-out) both;
}

/* A soft vignette keeps panels readable over the busy attract-mode match. */
.screen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(11, 16, 38, 0.25) 0%, rgba(11, 16, 38, 0.78) 100%);
}

.screen--menu::before {
  background: radial-gradient(ellipse at 50% 40%, rgba(11, 16, 38, 0.05) 0%, rgba(11, 16, 38, 0.6) 100%);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.topbar > :first-child {
  justify-self: start;
}

.topbar__title {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0.1em 0 var(--ink);
}

.topbar__title .icon {
  color: var(--gold);
  filter: drop-shadow(0 0.08em 0 var(--ink));
}

.topbar__right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.fps-meter {
  position: absolute;
  left: 0.6rem;
  bottom: 0.5rem;
  z-index: 30;
  padding: 0.15rem 0.5rem;
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.55);
  font: 600 0.75rem/1.2 ui-monospace, monospace;
  color: var(--green);
}

/* ── Focus ────────────────────────────────────────────────────────────── */

:focus {
  outline: none;
}

html[data-nav="keys"] :focus,
html[data-nav="pad"] :focus {
  box-shadow: var(--ring);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  --bg: #8b7bff;
  --bg2: #5b47e6;
  --edge: #3426a3;
  --fg: #fff;
  --lift: 0 0.28rem 0 var(--edge), 0 0.55rem 1rem rgba(5, 3, 20, 0.45);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.6em 1.25em;
  border: 0.15rem solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  box-shadow: var(--lift), inset 0 0.13rem 0 rgba(255, 255, 255, 0.35);
  color: var(--fg);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow: 0 0.07em 0 rgba(20, 15, 46, 0.4);
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.16s var(--ease-back),
    box-shadow 0.16s,
    filter 0.16s;
}

.btn::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 0.12rem;
  height: 36%;
  border-radius: 999px;
  background: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.btn .icon {
  filter: drop-shadow(0 0.06em 0 rgba(20, 15, 46, 0.35));
}

.btn:hover {
  transform: translateY(-0.1rem) scale(1.03);
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(0.2rem);
  box-shadow: 0 0.06rem 0 var(--edge), 0 0.2rem 0.5rem rgba(5, 3, 20, 0.4), inset 0 0.13rem 0 rgba(255, 255, 255, 0.25);
}

html[data-nav="keys"] .btn:focus,
html[data-nav="pad"] .btn:focus {
  z-index: 1;
  transform: scale(1.07);
  box-shadow: var(--lift), var(--ring);
}

.btn--primary {
  --bg: #ffe066;
  --bg2: #fbbf24;
  --edge: #b45309;
  --fg: #2a1700;
  text-shadow: 0 0.06em 0 rgba(255, 255, 255, 0.45);
}

.btn--accent {
  --bg: #8ff3ff;
  --bg2: #22c3e6;
  --edge: #0e6d87;
  --fg: #052631;
  text-shadow: 0 0.06em 0 rgba(255, 255, 255, 0.4);
}

.btn--danger {
  --bg: #ff8a8e;
  --bg2: #ef4452;
  --edge: #9f1239;
}

.btn--ghost {
  --bg: rgba(255, 255, 255, 0.12);
  --bg2: rgba(255, 255, 255, 0.05);
  --edge: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
}

.btn--ghost::after {
  opacity: 0.35;
}

.btn--lg {
  padding: 0.68em 1.5em;
  font-size: 1.28rem;
}

.btn--sm {
  padding: 0.45em 0.95em;
  font-size: 0.9rem;
}

.btn--icon {
  padding: 0.42em;
  font-size: 0.95rem;
}

.btn--icon::after {
  left: 22%;
  right: 22%;
}

.btn:disabled {
  filter: grayscale(0.7) brightness(0.7);
  cursor: not-allowed;
}

/* A toggled-on primary button (Ready ✓) turns green. */
.btn--primary.is-on {
  --bg: #9ff5b9;
  --bg2: #22c55e;
  --edge: #166534;
  --fg: #052e16;
}

.btn.is-waiting {
  filter: saturate(0.3) brightness(0.8);
}

.btn.is-waiting:hover {
  filter: saturate(0.45) brightness(0.9);
}

/* ── Panels, chips, tags ──────────────────────────────────────────────── */

.panel {
  position: relative;
  padding: 1rem 1.1rem;
  border: 0.12rem solid var(--panel-line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-top), var(--panel) 30%);
  box-shadow:
    0 0.5rem 1.4rem rgba(4, 2, 20, 0.5),
    inset 0 0.1rem 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px) saturate(1.2);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.panel__title {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ece9ff;
}

.panel__title .icon {
  color: var(--gold);
}

.panel__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.panel__count {
  white-space: nowrap;
  padding: 0.18em 0.65em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.18em 0.6em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chip, #fff) 22%, transparent);
  border: 0.1rem solid color-mix(in srgb, var(--chip, #fff) 60%, transparent);
  font-size: 0.8rem;
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.12em 0.5em;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
}

.tag--you {
  background: var(--cyan);
  color: var(--ink);
}

.tag--host {
  background: var(--gold);
  color: var(--ink);
}

.launch {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.launch__status {
  color: var(--text-dim);
  font-weight: 600;
  text-align: right;
}

.launch__status.is-ready {
  color: var(--green);
}

/* ── Option rows: pickers, toggles, sliders ───────────────────────────── */

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 2.55rem;
  padding: 0.35rem 0.45rem 0.35rem 0.8rem;
  border: 0.1rem solid rgba(255, 255, 255, 0.06);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.16s var(--ease-back),
    box-shadow 0.15s;
}

.opt:hover {
  background: rgba(255, 255, 255, 0.09);
}

html[data-nav="keys"] .opt:focus,
html[data-nav="pad"] .opt:focus {
  background: rgba(103, 232, 249, 0.12);
  transform: scale(1.02);
}

.opt__label {
  display: flex;
  align-items: center;
  gap: 0.55em;
  min-width: 0;
  color: #dedaff;
  font-weight: 500;
}

.opt__label .icon {
  color: var(--cyan);
}

.opt__control {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.opt__value {
  min-width: 6.4em;
  overflow: hidden;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opt__value.is-next {
  animation: value-next 0.28s var(--ease-out);
}

.opt__value.is-prev {
  animation: value-prev 0.28s var(--ease-out);
}

.opt__arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.15s var(--ease-back);
}

.opt__arrow .icon {
  width: 1rem;
  height: 1rem;
}

.opt__arrow:hover:not(:disabled) {
  background: var(--cyan);
  color: var(--ink);
  transform: scale(1.12);
}

.opt__arrow:disabled {
  opacity: 0.22;
  cursor: default;
}

.opt__swatch {
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 0.12rem solid var(--ink);
  border-radius: 50%;
  background: var(--swatch, #fff);
  box-shadow: 0 0 0 0.1rem rgba(255, 255, 255, 0.35);
}

.opt__swatch--icon {
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--swatch, #fff);
  filter: drop-shadow(0 0.08rem 0 var(--ink));
}

.opt--mini {
  min-height: 2.05rem;
  padding: 0.2rem 0.3rem;
  gap: 0.3rem;
  font-size: 0.88rem;
}

.opt--mini .opt__control {
  flex: 1;
  justify-content: space-between;
}

.opt--mini .opt__value {
  flex: 1;
  min-width: 0;
}

.opt--mini .opt__arrow {
  width: 1.5rem;
  height: 1.5rem;
}

.opt--readonly {
  cursor: default;
}

.opt--readonly .opt__value {
  min-width: 0;
  padding-right: 0.5rem;
  color: #fff;
}

.switch {
  position: relative;
  flex: none;
  width: 2.8rem;
  height: 1.55rem;
  border: 0.12rem solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.2s;
}

.switch__knob {
  position: absolute;
  top: 0.1rem;
  left: 0.1rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.12rem 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.28s var(--ease-back);
}

.opt--toggle.is-on .switch {
  background: var(--green);
}

.opt--toggle.is-on .switch__knob {
  transform: translateX(1.25rem);
}

.opt--toggle .opt__value {
  min-width: 2.4em;
}

.slider__track {
  position: relative;
  width: 9rem;
  height: 0.75rem;
  border: 0.1rem solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  touch-action: none;
}

.slider__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  transform: scaleX(var(--value, 0));
  transform-origin: left;
}

.slider__knob {
  position: absolute;
  top: 50%;
  left: calc(var(--value, 0) * 100%);
  width: 1.3rem;
  height: 1.3rem;
  margin: -0.65rem 0 0 -0.65rem;
  border: 0.14rem solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.15rem 0 rgba(0, 0, 0, 0.3);
}

.opt--slider .opt__value {
  min-width: 3.3em;
  font-variant-numeric: tabular-nums;
}

/* ── Text fields ──────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field__label {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.field__input {
  width: 100%;
  min-width: 0;
  padding: 0.55em 0.8em;
  border: 0.14rem solid rgba(255, 255, 255, 0.16);
  border-radius: 0.95rem;
  background: rgba(5, 4, 22, 0.55);
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.field__input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.field__input:focus,
html[data-nav] .field__input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 0.25rem rgba(103, 232, 249, 0.25);
}

.field--code .field__input {
  padding: 0.35em 0.4em;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  text-transform: uppercase;
}

/* ── Prompts & key glyphs ─────────────────────────────────────────────── */

.prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.5rem;
  padding-top: 0.2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.prompt,
.glyphs {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.prompt__label {
  margin-left: 0.15rem;
}

.key {
  display: inline-block;
  min-width: 1.75em;
  padding: 0.12em 0.45em;
  border: 0.1rem solid var(--ink);
  border-radius: 0.4rem;
  background: linear-gradient(#f6f4ff, #c9c4f0);
  box-shadow: 0 0.14rem 0 var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.pad-btn {
  display: inline-grid;
  place-items: center;
  min-width: 1.65em;
  height: 1.65em;
  padding: 0 0.1em;
  border: 0.1rem solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 0.14rem 0 var(--ink);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  text-shadow: 0 0.06em 0 rgba(0, 0, 0, 0.4);
}

.pad-btn--a {
  background: #22c55e;
}

.pad-btn--b {
  background: #ef4444;
}

.pad-btn--x {
  background: #3b82f6;
}

.pad-btn--y {
  background: #eab308;
}

.pad-btn--wide {
  padding: 0 0.5em;
  border-radius: 0.5rem;
  background: #4b5584;
}

/* ── Mode cards & arena picker ────────────────────────────────────────── */

.mode-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.5rem 0.3rem 0.45rem;
  border: 0.14rem solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-back),
    background 0.15s,
    border-color 0.15s;
}

.mode-card:hover:not(:disabled) {
  transform: translateY(-0.12rem);
  background: rgba(255, 255, 255, 0.09);
}

html[data-nav="keys"] .mode-card:focus,
html[data-nav="pad"] .mode-card:focus {
  transform: scale(1.06);
}

.mode-card__icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 0.14rem solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #514aa3, #241d5e);
  box-shadow: 0 0.18rem 0 var(--ink);
  color: var(--text-dim);
}

.mode-card__icon .icon {
  width: 1.45rem;
  height: 1.45rem;
}

.mode-card__name {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.12;
  text-align: center;
}

.mode-card.is-selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.3), rgba(251, 191, 36, 0.06));
  box-shadow: 0 0 1.1rem rgba(251, 191, 36, 0.28);
}

.mode-card.is-selected .mode-card__icon {
  background: radial-gradient(circle at 35% 30%, #fff1b0, #f59e0b);
  color: var(--ink);
  animation: wiggle 0.5s var(--ease-back);
}

.mode-card:disabled {
  cursor: default;
  opacity: 0.55;
}

.mode-card:disabled.is-selected {
  opacity: 1;
}

.match-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
}

.match-panel__tagline {
  margin-top: -0.2rem;
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.match-panel .opt {
  min-height: 2.2rem;
  padding: 0.18rem 0.35rem 0.18rem 0.75rem;
}

.match-panel .opt__arrow {
  width: 1.65rem;
  height: 1.65rem;
}

.match-panel__options {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-height: 0;
  overflow: auto;
  padding: 0.3rem;
  margin: -0.3rem;
}

.level-pick {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  align-items: center;
  gap: 0.9rem;
  padding: 0.5rem;
  border: 0.1rem solid rgba(255, 255, 255, 0.06);
  border-radius: 1.05rem;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.16s var(--ease-back);
}

.level-pick:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-nav="keys"] .level-pick:focus,
html[data-nav="pad"] .level-pick:focus {
  background: rgba(103, 232, 249, 0.1);
  transform: scale(1.015);
}

.level-pick.is-readonly {
  cursor: default;
}

.level-pick__media {
  position: relative;
}

.level-pick__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 0.14rem solid var(--ink);
  border-radius: 0.8rem;
  box-shadow:
    0 0.22rem 0 var(--ink),
    0 0.5rem 1rem rgba(0, 0, 0, 0.4);
  background: var(--space-0);
}

.level-pick__thumb.is-next {
  animation: thumb-next 0.32s var(--ease-out);
}

.level-pick__thumb.is-prev {
  animation: thumb-prev 0.32s var(--ease-out);
}

.level-pick__canvas,
.arena-card__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.level-pick__random,
.arena-card__random {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at 50% 55%, rgba(251, 191, 36, 0.35), transparent 55%),
    radial-gradient(circle at 25% 30%, rgba(139, 92, 246, 0.6), transparent 60%),
    linear-gradient(135deg, #2c1f6e, #0b1026);
  color: var(--gold);
  font-size: 3.4rem;
  font-weight: 700;
  text-shadow: 0 0.08em 0 var(--ink);
}

.level-pick__random span {
  animation: spin-slow 6s linear infinite;
}

.level-pick.is-random .level-pick__random,
.arena-card__random {
  display: grid;
}

.level-pick.is-random .level-pick__canvas {
  visibility: hidden;
}

.level-pick__arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0.13rem solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.15rem 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  transform: translateY(-50%);
  transition: transform 0.15s var(--ease-back);
}

.level-pick__arrow .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.level-pick__arrow:hover {
  transform: translateY(-50%) scale(1.15);
}

.level-pick__arrow.is-prev {
  left: -0.55rem;
}

.level-pick__arrow.is-next {
  right: -0.55rem;
}

.level-pick__name {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.15;
}

.level-pick__blurb {
  margin: 0.2rem 0 0.45rem;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.3;
}

.level-pick__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 600;
}

.level-pick__meta .dot {
  opacity: 0.5;
}

.arena-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.8rem;
  padding: 0.4rem;
}

.arena-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.45rem;
  border: 0.14rem solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s var(--ease-back);
}

.arena-card:hover,
html[data-nav="keys"] .arena-card:focus,
html[data-nav="pad"] .arena-card:focus {
  transform: scale(1.05);
}

.arena-card.is-selected {
  border-color: var(--gold);
}

.arena-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 0.12rem solid var(--ink);
  border-radius: 0.7rem;
}

/* ── Ship portraits ───────────────────────────────────────────────────── */

.ship-avatar {
  --ship: #fff;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ship-avatar path,
.ship-avatar circle {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
}

.ship-avatar__body,
.ship-avatar__fin {
  fill: var(--ship);
}

.ship-avatar__fin {
  filter: brightness(0.72);
}

.ship-avatar__shade {
  fill: rgba(20, 15, 46, 0.25);
  stroke: none !important;
}

.ship-avatar__glass {
  fill: #bdf4ff;
}

.ship-avatar__shine {
  fill: #fff;
  stroke: none !important;
}

.ship-avatar__flame {
  fill: #fbbf24;
  stroke-width: 2.5 !important;
  transform-origin: 32px 47px;
  animation: flame 0.18s ease-in-out infinite alternate;
}

/* ── Modals & toasts ──────────────────────────────────────────────────── */

.modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(6, 5, 24, 0.62);
  backdrop-filter: blur(5px);
  pointer-events: auto;
  animation: fade-in 0.2s ease-out;
}

.modal__card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(30rem, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 1.3rem 1.4rem;
  border: 0.16rem solid rgba(255, 255, 255, 0.18);
  border-radius: 1.6rem;
  background: linear-gradient(180deg, #282d68, #171b45);
  box-shadow:
    0 0.4rem 0 var(--ink),
    0 1.4rem 3rem rgba(0, 0, 0, 0.55);
  animation: pop-in 0.38s var(--ease-back);
}

.modal__card--narrow {
  width: min(26rem, 100%);
}

.modal__card--wide {
  width: min(64rem, 100%);
}

.modal__title {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-size: 1.6rem;
  font-weight: 700;
  text-shadow: 0 0.08em 0 var(--ink);
}

.modal__title .icon {
  color: var(--gold);
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.modal__text {
  color: var(--text-dim);
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.7rem;
}

.device-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toasts {
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 90vw;
  padding: 0.55rem 1.15rem 0.55rem 0.8rem;
  border: 0.14rem solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #1f2458;
  box-shadow:
    0 0.3rem 0 var(--ink),
    0 0.8rem 1.6rem rgba(0, 0, 0, 0.4);
  font-weight: 600;
  animation: toast-drop 0.42s var(--ease-back);
}

.toast .icon {
  color: var(--cyan);
}

.toast--error {
  border-color: #ff7a7f;
}

.toast--error .icon {
  color: #ff7a7f;
}

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

.toast--success .icon {
  color: var(--green);
}

.toast.is-leaving {
  animation: toast-up 0.35s ease-in forwards;
}

/* In a match the top centre belongs to the clock and score chips, so
   notices ("Ace left", "Bo is back") stack under the ping chip instead. */
body[data-screen="game"] .toasts {
  top: 2.9rem;
  left: 0.9rem;
  align-items: flex-start;
  transform: none;
}

body[data-screen="game"] .toast {
  padding: 0.35rem 0.9rem 0.35rem 0.6rem;
  font-size: 0.85rem;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 0.35rem solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ── Logo ─────────────────────────────────────────────────────────────── */

.logo {
  position: relative;
  isolation: isolate;
  display: inline-block;
  font-size: 6.4rem;
  line-height: 0.9;
  text-align: center;
  transform: rotate(-4deg);
}

.logo__words {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo__word {
  display: block;
  white-space: nowrap;
}

.logo__word--top {
  font-size: 0.78em;
  letter-spacing: 0.02em;
}

.logo__word--bottom {
  font-size: 1.25em;
  letter-spacing: 0.04em;
  margin-top: -0.06em;
}

/* The letter itself is the outline/shadow layer; ::after paints the gradient fill on top. */
.logo__letter {
  position: relative;
  display: inline-block;
  color: var(--ink);
  font-weight: 700;
  -webkit-text-stroke: 0.15em var(--ink);
  text-shadow:
    0 0.1em 0 var(--ink),
    0 0.16em 0.14em rgba(0, 0, 0, 0.5);
  animation: letter-bounce 3.2s var(--ease-back) infinite;
  animation-delay: calc(var(--i) * 0.09s);
}

.logo__letter::after {
  content: attr(data-char);
  position: absolute;
  left: 0;
  top: 0;
  -webkit-text-stroke: 0;
  text-shadow: none;
  color: transparent;
  background: linear-gradient(180deg, #e8fdff 0%, #67e8f9 40%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.logo__word--bottom .logo__letter {
  animation-delay: calc(var(--i) * 0.09s + 0.5s);
}

.logo__word--bottom .logo__letter::after {
  background-image: linear-gradient(180deg, #fff6c4 0%, #fbbf24 45%, #f9733f 100%);
}

/* The orbiting planet: x and y swing on offset sine waves (an ellipse) and it
   hops behind the words on the far side of its orbit. */
.logo__orbit {
  position: absolute;
  left: 50%;
  top: 70%;
  z-index: 2;
  width: 0;
  height: 0;
  animation:
    orbit-x 3.4s ease-in-out infinite alternate,
    orbit-z 6.8s step-end infinite;
}

.logo__orbit-y {
  position: absolute;
  animation: orbit-y 3.4s ease-in-out infinite alternate;
  animation-delay: -1.7s;
}

.logo__planet {
  position: absolute;
  left: -0.24em;
  top: -0.24em;
  width: 0.48em;
  height: 0.48em;
  border: 0.045em solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffe1f3 0%, #f472b6 35%, #a21caf 100%);
  box-shadow: inset -0.06em -0.05em 0 rgba(20, 15, 46, 0.3);
}

.logo__planet::before {
  content: "";
  position: absolute;
  inset: 32% -42%;
  border: 0.035em solid var(--gold);
  border-radius: 50%;
  transform: rotate(-20deg);
  clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}

.logo__planet-face {
  position: absolute;
  left: 26%;
  top: 38%;
  width: 48%;
  height: 26%;
  background:
    radial-gradient(circle at 20% 30%, var(--ink) 0 18%, transparent 20%),
    radial-gradient(circle at 80% 30%, var(--ink) 0 18%, transparent 20%),
    radial-gradient(ellipse at 50% 55%, transparent 0 30%, var(--ink) 32% 42%, transparent 44%) 50% 100% / 60% 80% no-repeat;
}

/* ── Menu screen ──────────────────────────────────────────────────────── */

.screen--menu {
  align-items: center;
}

.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  margin: auto;
}

.menu__tagline {
  margin: 0.2rem 0 0.4rem;
  padding: 0.35em 1.1em;
  border: 0.1rem solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(11, 16, 38, 0.6);
  color: #dcd7ff;
  font-size: 1.02rem;
  text-align: center;
}

.menu__tiles {
  display: flex;
  gap: 1.2rem;
}

.play-tile {
  --bg: #ffe066;
  --bg2: #fbbf24;
  --edge: #b45309;
  --fg: #2a1700;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.95rem;
  width: 19.5rem;
  padding: 1.05rem 1.3rem;
  border: 0.18rem solid var(--ink);
  border-radius: 1.6rem;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  box-shadow:
    0 0.4rem 0 var(--edge),
    0 0.45rem 0 0.12rem var(--ink),
    0 1rem 2rem rgba(5, 3, 20, 0.5);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-back),
    box-shadow 0.18s;
}

.play-tile::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 30%;
  top: 0.18rem;
  height: 32%;
  border-radius: 999px;
  background: linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.play-tile--online {
  --bg: #9af5ff;
  --bg2: #8b5cf6;
  --edge: #4c1d95;
  --fg: #fff;
}

.play-tile:hover {
  transform: translateY(-0.18rem) rotate(-1deg) scale(1.03);
}

html[data-nav="keys"] .play-tile:focus,
html[data-nav="pad"] .play-tile:focus {
  transform: scale(1.07);
  box-shadow:
    0 0.4rem 0 var(--edge),
    var(--ring);
}

.play-tile__icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  border: 0.15rem solid var(--ink);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0.2rem 0 rgba(20, 15, 46, 0.5);
}

.play-tile__icon .icon {
  width: 2.2rem;
  height: 2.2rem;
  color: var(--ink);
}

.play-tile__title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.05;
}

.play-tile--online .play-tile__title,
.play-tile--online .play-tile__text {
  text-shadow: 0 0.08em 0 rgba(20, 15, 46, 0.55);
}

.play-tile__text {
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.9;
}

.menu__row {
  display: flex;
  gap: 0.9rem;
}

.menu__footer {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-faint);
  font-size: 0.82rem;
  pointer-events: none;
}

.menu__devices {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Couch lobby ──────────────────────────────────────────────────────── */

.local__body,
.lobby__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1.2rem;
}

.local__pilots,
.lobby__pilots {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.slots {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.slot {
  --pc: #94a3b8;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  min-height: 0;
  padding: 0.55rem;
  border: 0.15rem solid color-mix(in srgb, var(--pc) 75%, var(--ink));
  border-radius: 1.15rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 34%, #1d2152) 0%, #1a1e4a 62%);
  box-shadow:
    0 0.28rem 0 var(--ink),
    0 0.6rem 1.2rem rgba(0, 0, 0, 0.35);
  animation: slot-in 0.45s var(--ease-back) both;
}

.slot__stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-content: center;
  gap: 0.45rem;
  border-radius: 0.9rem;
  background: radial-gradient(ellipse 60% 55% at 50% 42%, color-mix(in srgb, var(--pc) 38%, transparent), transparent 75%);
}

.slot__stage .slot__portrait {
  /* Shrinks when a card has many controls (a bot in a team match). */
  width: auto;
  height: 100%;
  max-height: 4.8rem;
  min-height: 2.4rem;
  aspect-ratio: 1;
}

.slot__controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slot__portrait,
.lobby-pilot__portrait {
  display: grid;
  place-items: center;
  flex: none;
  width: 3.3rem;
  height: 3.3rem;
  border: 0.14rem solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--pc) 45%, #fff), color-mix(in srgb, var(--pc) 35%, var(--ink)));
  box-shadow: inset 0 -0.3rem 0 rgba(0, 0, 0, 0.22);
}

.slot__portrait .ship-avatar,
.lobby-pilot__portrait .ship-avatar {
  width: 82%;
  height: 82%;
  animation: ship-bob 1.6s ease-in-out infinite alternate;
}

.slot__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-width: 0;
  padding: 0.2em 0.55em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  color: #e6e3ff;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.slot__remove {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 1;
  font-size: 0.72rem;
}

.slot__name,
.lobby-pilot__name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.28rem 0.5rem;
  border: 0;
  border-radius: 0.7rem;
  background: rgba(0, 0, 0, 0.26);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
  text-shadow: 0 0.08em 0 var(--ink);
  cursor: pointer;
  transition: background 0.15s;
}

.slot__name:hover,
.lobby-pilot__name:hover {
  background: rgba(0, 0, 0, 0.4);
}

.slot__name-text,
.lobby-pilot__name-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot__name .icon,
.lobby-pilot__name .icon {
  width: 0.9em;
  height: 0.9em;
  opacity: 0.55;
}

.slot .opt {
  background: rgba(0, 0, 0, 0.2);
}

.slot--empty {
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 0.16rem dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.025);
  box-shadow: none;
  color: var(--text-faint);
  text-align: center;
}

.slot__plus {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.slot__plus .icon {
  width: 1.3rem;
  height: 1.3rem;
}

.slot__hint {
  font-size: 0.82rem;
  line-height: 1.6;
}

.slot__hint.is-dim {
  opacity: 0.55;
}

.slot--empty:has(.btn) .slot__plus {
  animation: pulse 1.6s ease-in-out infinite;
  color: var(--cyan);
}

/* ── Ship classes: hull art, tags and the class picker ─────────────────── */

.class-art {
  display: block;
  flex: none;
}

.slot__portrait .class-art,
.lobby-pilot__portrait .class-art {
  width: 86% !important;
  height: 86% !important;
  animation: ship-bob 1.6s ease-in-out infinite alternate;
}

.classpick {
  --cc: #94a3b8;
  justify-content: flex-start;
  gap: 0.2rem;
  min-height: 2.6rem;
  padding: 0.25rem 0.3rem;
  border-color: color-mix(in srgb, var(--cc) 45%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--cc) 20%, transparent), rgba(0, 0, 0, 0.2)) !important;
}

.classpick.is-readonly {
  display: flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border: 0.1rem solid color-mix(in srgb, var(--cc) 45%, transparent);
  border-radius: 0.95rem;
}

.classpick__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  line-height: 1.12;
  text-align: center;
}

.classpick__text.is-next {
  animation: value-next 0.28s var(--ease-out);
}

.classpick__text.is-prev {
  animation: value-prev 0.28s var(--ease-out);
}

.classpick__name {
  max-width: 100%;
  overflow: hidden;
  color: color-mix(in srgb, var(--cc) 45%, #fff);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classpick__sub {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classpick__role::after {
  content: " · ";
}

.classpick__role,
.class-tag__role {
  color: var(--text-dim);
  font-size: 0.9em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.classpick__trait {
  color: var(--cc);
  font-weight: 600;
}

.lobby-pilot__controls .classpick {
  width: 10.5rem;
}

.class-tag {
  --cc: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-width: 0;
  white-space: nowrap;
}

.class-tag__name {
  color: color-mix(in srgb, var(--cc) 55%, #fff);
  font-weight: 700;
}

/* ── Online menu ──────────────────────────────────────────────────────── */

.online__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  width: min(54rem, 100%);
  margin: 0 auto;
}

.online__name-row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

.online__name-row .field {
  flex: 1;
}

.online__name-row .btn {
  margin-bottom: 0.15rem;
}

.online__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.online-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

.online-card__icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 0.14rem solid var(--ink);
  border-radius: 0.95rem;
  background: linear-gradient(160deg, #ffe066, #fbbf24);
  box-shadow: 0 0.2rem 0 var(--ink);
  color: var(--ink);
}

.online-card--join .online-card__icon {
  background: linear-gradient(160deg, #9af5ff, #22c3e6);
}

.online-card__icon .icon {
  width: 1.7rem;
  height: 1.7rem;
}

.online-card__title {
  font-size: 1.45rem;
  font-weight: 700;
}

.online-card__text {
  color: var(--text-dim);
}

.online-card > .btn {
  align-self: stretch;
  margin-top: auto;
}

.online-card__join {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  width: 100%;
  margin-top: auto;
}

.online-card__join .field {
  flex: 1;
}

.online-card__join .btn {
  margin-bottom: 0.2rem;
}

.online__status {
  min-height: 1.5em;
  font-weight: 600;
  text-align: center;
}

.online__status[data-kind="error"] {
  color: #ff9a9e;
}

.online__status[data-kind="busy"] {
  color: var(--cyan);
}

.online__status[data-kind="busy"]::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.5em;
  vertical-align: -0.1em;
  border: 0.18em solid rgba(103, 232, 249, 0.25);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ── Online lobby ─────────────────────────────────────────────────────── */

.room-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.room-info__label {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.room-code {
  display: inline-flex;
  gap: 0.22rem;
}

.room-code__char {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 2.3rem;
  border: 0.13rem solid var(--ink);
  border-radius: 0.55rem;
  background: linear-gradient(#fff, #d9d4ff);
  box-shadow: 0 0.18rem 0 var(--ink);
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 700;
  animation: slot-in 0.4s var(--ease-back) both;
}

.room-code__char:nth-child(2) {
  animation-delay: 0.05s;
}

.room-code__char:nth-child(3) {
  animation-delay: 0.1s;
}

.room-code__char:nth-child(4) {
  animation-delay: 0.15s;
}

.room-code__char:nth-child(5) {
  animation-delay: 0.2s;
}

.lobby__match {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lobby__match > .match-panel {
  flex: 1;
}

.lobby__banner {
  align-self: center;
  padding: 0.4em 1.2em;
  border: 0.12rem solid rgba(251, 191, 36, 0.6);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
  font-weight: 600;
}

.lobby-pilots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  overflow: auto;
  padding: 0.3rem;
  margin: -0.3rem;
}

.lobby-pilot {
  --pc: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.6rem;
  border: 0.12rem solid color-mix(in srgb, var(--pc) 40%, transparent);
  border-radius: 1.05rem;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc) 24%, transparent), rgba(255, 255, 255, 0.03) 65%);
  animation: slot-in 0.4s var(--ease-back) both;
}

.lobby-pilot.is-mine {
  border-color: var(--pc);
  box-shadow: 0 0 1rem color-mix(in srgb, var(--pc) 30%, transparent);
}

.lobby-pilot__portrait {
  width: 2.8rem;
  height: 2.8rem;
}

.lobby-pilot__main {
  flex: 1;
  min-width: 0;
}

.lobby-pilot__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

span.lobby-pilot__name {
  background: none;
  padding: 0;
  cursor: default;
}

.lobby-pilot__tags {
  display: inline-flex;
  gap: 0.3rem;
}

.lobby-pilot__status {
  display: block;
  margin-top: 0.1rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
}

.lobby-pilot__status[data-state="ready"] {
  color: var(--green);
}

.lobby-pilot__status[data-state="away"] {
  color: #ff9a9e;
}

.lobby-pilot__controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lobby-pilot__controls .opt--mini {
  width: 8.6rem;
}

.lobby__launch {
  justify-content: flex-end;
}

.lobby__state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(11, 16, 38, 0.55);
  backdrop-filter: blur(6px);
}

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  width: min(26rem, 100%);
  text-align: center;
  animation: pop-in 0.35s var(--ease-back);
}

.state-card__icon {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: rgba(255, 90, 95, 0.2);
  color: #ff9a9e;
}

.state-card__icon .icon {
  width: 1.8rem;
  height: 1.8rem;
}

.state-card__title {
  font-size: 1.5rem;
  font-weight: 700;
}

.state-card__text {
  color: var(--text-dim);
}

/* ── Results ──────────────────────────────────────────────────────────── */

.screen--results {
  gap: 0.8rem;
}

.screen--results::before {
  background: radial-gradient(ellipse at 50% 30%, rgba(11, 16, 38, 0.45) 0%, rgba(11, 16, 38, 0.85) 100%);
}

.results__banner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
}

.results__ships {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  height: 4.3rem;
}

.results__ship {
  width: 4.3rem;
  height: 4.3rem;
  animation: ship-bob 1.4s ease-in-out infinite alternate;
}

.results__title {
  color: var(--c);
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 1.05;
  -webkit-text-stroke: 0.1em var(--ink);
  paint-order: stroke fill;
  text-shadow:
    0 0.09em 0 var(--ink),
    0 0 1.5rem color-mix(in srgb, var(--c) 55%, transparent);
  animation: title-pop 0.75s var(--ease-back) both;
}

.results__reason {
  color: #e4e1ff;
  font-weight: 500;
}

.results__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.1rem;
}

.results__body > .panel {
  max-height: 100%;
}

.results__standings,
.results__awards {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
}

.results__teams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.results__team {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.9rem;
  border: 0.13rem solid var(--c);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 20%, transparent);
  font-weight: 600;
}

.results__team strong {
  color: var(--c);
  text-shadow: 0 0.08em 0 var(--ink);
}

.results__team-score {
  font-size: 1.2rem;
  font-weight: 700;
}

.standings__scroll {
  min-height: 0;
  overflow: auto;
}

.standings {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.3rem;
  font-variant-numeric: tabular-nums;
}

.standings th {
  padding: 0 0.5rem 0.1rem;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.standings th:nth-child(2) {
  text-align: left;
}

.standings td {
  padding: 0.38rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
  font-weight: 600;
}

.standings td:first-child {
  border-radius: 0.8rem 0 0 0.8rem;
}

.standings td:last-child {
  border-radius: 0 0.8rem 0.8rem 0;
}

.standings tr.is-first td {
  background: color-mix(in srgb, var(--c) 22%, rgba(255, 255, 255, 0.05));
}

.standings td:nth-child(2) {
  text-align: left;
}

.standings__pilot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.standings__dot,
.scoreboard__dot {
  flex: none;
  width: 0.85rem;
  height: 0.85rem;
  border: 0.1rem solid var(--ink);
  border-radius: 50%;
  background: var(--c);
}

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

.standings__tag,
.scoreboard__tag {
  width: 1em;
  height: 1em;
  color: var(--text-dim);
}

.standings__score {
  font-size: 1.15rem;
  color: var(--c);
  text-shadow: 0 0.08em 0 var(--ink);
}

.medal {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 0.12rem solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

.medal[data-place="1"] {
  background: radial-gradient(circle at 35% 30%, #fff3b0, #f59e0b);
  color: var(--ink);
}

.medal[data-place="2"] {
  background: radial-gradient(circle at 35% 30%, #ffffff, #94a3b8);
  color: var(--ink);
}

.medal[data-place="3"] {
  background: radial-gradient(circle at 35% 30%, #ffd2b0, #c2662d);
  color: var(--ink);
}

.awards {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  overflow: auto;
}

.awards__none {
  margin: 0;
  opacity: 0.7;
}

.award {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 0.12rem solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  animation: slot-in 0.5s var(--ease-back) both;
  animation-delay: calc(var(--i, 0) * 0.12s + 0.35s);
}

.award__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  border: 0.14rem solid var(--ink);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0.18rem 0 var(--ink);
  color: var(--ink);
}

.award__icon .icon {
  width: 1.45rem;
  height: 1.45rem;
}

.award__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.award__title {
  font-size: 1.02rem;
}

.award__pilot {
  color: var(--c);
  font-weight: 700;
  text-shadow: 0 0.08em 0 var(--ink);
}

.award__desc {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.results__actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.9rem;
}

.results__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: auto;
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.confetti__bit {
  position: absolute;
  top: -2rem;
  left: var(--x);
  width: 0.55rem;
  height: 0.9rem;
  border-radius: 0.15rem;
  background: var(--c);
  animation: confetti var(--t) linear var(--d) infinite;
}

/* ── Settings ─────────────────────────────────────────────────────────── */

.settings__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  align-items: start;
  gap: 1.1rem;
  overflow: auto;
  padding: 0.4rem;
  margin: -0.4rem;
}

.settings__panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.settings__panel .btn {
  align-self: flex-start;
}

.settings__hint {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ── How to play ──────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 1.1em;
  border: 0.14rem solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.16s var(--ease-back),
    background 0.15s;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.12);
}

.tab.is-active {
  border-color: var(--ink);
  background: linear-gradient(180deg, #ffe066, #fbbf24);
  box-shadow: 0 0.22rem 0 #b45309;
  color: var(--ink);
}

html[data-nav="keys"] .tab:focus,
html[data-nav="pad"] .tab:focus {
  transform: scale(1.06);
}

.howto__content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.5rem;
  margin: -0.5rem;
}

.howto__grid {
  display: grid;
  gap: 1rem;
  max-width: 78rem;
  margin: 0 auto;
  animation: screen-in 0.35s var(--ease-out) both;
}

.howto__grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.howto__grid--controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 64rem;
}

.howto__grid--powerups {
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}

.howto__grid--modes {
  grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
}

.info-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.16s var(--ease-back);
}

html[data-nav="keys"] .info-card:focus,
html[data-nav="pad"] .info-card:focus,
html[data-nav="keys"] .powerup-card:focus,
html[data-nav="pad"] .powerup-card:focus {
  transform: scale(1.02);
}

.info-card__title {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-size: 1.2rem;
  font-weight: 700;
}

.info-card__title .icon {
  color: var(--gold);
}

.info-card__badge,
.powerup-card__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border: 0.14rem solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1b0, #f59e0b);
  box-shadow: 0 0.2rem 0 var(--ink);
  color: var(--ink);
}

.info-card__badge .icon,
.powerup-card__icon .icon {
  width: 1.7rem;
  height: 1.7rem;
}

.info-card__text {
  color: var(--text-dim);
}

.info-card__tagline {
  color: var(--cyan);
  font-weight: 600;
}

.keys-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin: 0;
}

.keys-list dt {
  color: var(--text-dim);
}

.keys-list dd {
  margin: 0;
}

.keys-list .glyphs {
  flex-wrap: wrap;
}

.powerup-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: transform 0.16s var(--ease-back);
}

.powerup-card__icon {
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 45%, #fff), var(--c));
}

.powerup-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.powerup-card__body strong {
  font-size: 1.08rem;
}

.powerup-card__rarity {
  align-self: flex-start;
  padding: 0.05em 0.5em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.powerup-card.is-rare .powerup-card__rarity {
  background: var(--c);
  color: var(--ink);
}

.powerup-card.is-rare {
  border-color: color-mix(in srgb, var(--c) 60%, transparent);
}

.powerup-card__desc {
  color: var(--text-dim);
  font-size: 0.86rem;
}

/* ── Game screen & pause menu ─────────────────────────────────────────── */

.screen--game {
  padding: 0;
  pointer-events: none;
  animation: none;
}

.screen--game::before {
  display: none;
}

.pause-card .modal__actions {
  flex-direction: column;
  align-items: stretch;
}

.pause-card__sub {
  margin-top: -0.6rem;
  color: var(--text-dim);
}

.pause-card__note {
  color: var(--gold);
  font-weight: 600;
}

.controls-mini {
  display: grid;
  gap: 0.35rem;
  padding: 0.7rem 0.8rem;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.9rem;
}

.controls-mini__row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 1fr;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-dim);
}

.controls-mini__head {
  color: var(--text-faint);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── HUD ──────────────────────────────────────────────────────────────── */

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

.hud {
  font-variant-numeric: tabular-nums;
}

.hud-top {
  position: absolute;
  top: 0.7rem;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transform: translateX(-50%);
}

/* The game screen fades panels that a ship is flying behind. */
.hud-card,
.hud-clock,
.hud-teams,
.hud-chips,
.hud-feed {
  transition: opacity 0.2s ease;
}

.hud-root .is-see-through {
  opacity: 0.3;
}

.hud-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 9.5rem;
  padding: 0.3rem 1.2rem 0.4rem;
  border: 0.15rem solid rgba(255, 255, 255, 0.16);
  border-radius: 1.2rem;
  background: rgba(12, 10, 35, 0.78);
  box-shadow: 0 0.28rem 0 rgba(10, 8, 30, 0.85);
  backdrop-filter: blur(6px);
  line-height: 1.05;
}

.hud-clock__mode {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud-clock__time {
  font-size: 2.1rem;
  font-weight: 700;
  text-shadow: 0 0.08em 0 var(--ink);
}

.hud-clock__sub {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
}

.hud-clock[data-phase="countdown"] .hud-clock__time {
  opacity: 0.6;
}

.hud-clock[data-phase="urgent"] {
  border-color: var(--red);
}

.hud-clock[data-phase="urgent"] .hud-clock__time {
  color: #ff8a8e;
  animation: tick-pulse 1s ease-in-out infinite;
}

.hud-clock[data-phase="overtime"] {
  border-color: var(--gold);
  box-shadow: 0 0 1.4rem rgba(251, 191, 36, 0.45);
}

.hud-clock[data-phase="overtime"] .hud-clock__time {
  color: var(--gold);
  font-size: 1.7rem;
  animation: tick-pulse 0.8s ease-in-out infinite;
}

.hud-teams,
.hud-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.hud-team {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.18rem 0.35rem 0.18rem 0.85rem;
  border: 0.14rem solid var(--c);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 22%, rgba(12, 10, 35, 0.82));
  font-weight: 700;
}

.hud-team__name {
  font-size: 0.85rem;
  text-shadow: 0 0.08em 0 var(--ink);
}

.hud-team__score {
  min-width: 2.1rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--c);
  color: var(--ink);
  font-size: 1.2rem;
  text-align: center;
}

.hud-team.is-leading {
  box-shadow: 0 0 1.1rem color-mix(in srgb, var(--c) 60%, transparent);
  transform: scale(1.06);
}

.hud-chip-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.8rem 0.22rem 0.55rem;
  border: 0.12rem solid color-mix(in srgb, var(--c) 70%, transparent);
  border-radius: 999px;
  background: rgba(12, 10, 35, 0.75);
  font-size: 0.85rem;
  font-weight: 600;
  animation: slot-in 0.35s var(--ease-back);
}

.hud-chip-top .icon {
  color: var(--c);
}

.hud-net {
  position: absolute;
  top: 0.8rem;
  left: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(12, 10, 35, 0.7);
  font-size: 0.8rem;
  font-weight: 600;
}

.hud-net[data-quality="good"] .icon {
  color: var(--green);
}

.hud-net[data-quality="ok"] .icon {
  color: var(--gold);
}

.hud-net[data-quality="bad"] .icon {
  color: var(--red);
}

.hud-banner {
  padding: 0.4em 1.2em;
  border: 0.12rem solid rgba(251, 191, 36, 0.7);
  border-radius: 999px;
  background: rgba(30, 20, 5, 0.75);
  color: #fde68a;
  font-weight: 600;
  white-space: nowrap;
}

.hud-feed {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.feed__entry {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.7rem;
  border: 0.1rem solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(12, 10, 35, 0.72);
  font-size: 0.92rem;
  font-weight: 600;
  animation:
    feed-in 0.32s var(--ease-back),
    fade-out 0.5s ease-in 4.5s forwards;
}

.feed__entry.is-local {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(46, 38, 112, 0.88);
}

.feed__name {
  color: var(--c);
  text-shadow: 0 0.08em 0 var(--ink);
}

.feed__icon .icon {
  width: 1.15rem;
  height: 1.15rem;
  color: #e2e8f0;
}

.feed__icon.is-hot .icon {
  color: var(--gold);
  filter: drop-shadow(0 0 0.25rem rgba(251, 191, 36, 0.8));
}

.feed__assist {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.hud-announce {
  position: absolute;
  top: 22%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.announce-big,
.announce-tick {
  --c: #fff;
  color: var(--c);
  font-weight: 700;
  line-height: 1;
  -webkit-text-stroke: 0.08em var(--ink);
  paint-order: stroke fill;
  text-shadow:
    0 0.07em 0 var(--ink),
    0 0 1.6rem color-mix(in srgb, var(--c) 45%, transparent);
}

.announce-big {
  font-size: 4.4rem;
}

.announce-big.is-showing,
.announce-tick.is-showing {
  animation:
    big-in 0.5s var(--ease-back) both,
    fade-out 0.3s ease-in calc(var(--ms) - 300ms) forwards;
}

.announce-big[data-style="count"] {
  font-size: 7rem;
}

.announce-big[data-style="go"] {
  --c: var(--gold) !important;
  font-size: 7.6rem;
}

.announce-big[data-style="win"] {
  font-size: 4.6rem;
}

.announce__text {
  display: block;
}

.announce__sub {
  display: block;
  margin-top: 0.35em;
  color: #fff;
  font-size: 0.3em;
  -webkit-text-stroke: 0.12em var(--ink);
}

.announce-tick {
  --c: #ff6b70;
  font-size: 3.3rem;
}

.announce-toasts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.announce-toast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 1.2rem 0.4rem 0.5rem;
  border: 0.15rem solid var(--c);
  border-radius: 999px;
  background: rgba(12, 10, 35, 0.8);
  box-shadow: 0 0 1.3rem color-mix(in srgb, var(--c) 40%, transparent);
  text-align: left;
  animation:
    toast-in 0.42s var(--ease-back) both,
    fade-out 0.35s ease-in calc(var(--ms) - 350ms) forwards;
}

.announce-toast__icon {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 0.12rem solid var(--ink);
  border-radius: 50%;
  background: var(--c);
  color: var(--ink);
}

.announce-toast__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.announce-toast .announce__text {
  color: var(--c);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 0.08em 0 var(--ink);
}

.announce-toast .announce__sub {
  margin-top: 0.05rem;
  color: #e6e3ff;
  font-size: 0.82rem;
  -webkit-text-stroke: 0;
}

.hud-respawn {
  position: absolute;
  top: 58%;
  left: 50%;
  padding: 0.35em 1.1em;
  border-radius: 999px;
  background: rgba(12, 10, 35, 0.72);
  font-size: 1.4rem;
  font-weight: 700;
  text-shadow: 0 0.08em 0 var(--ink);
  transform: translateX(-50%);
}

.hud-cards {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 0.8rem;
}

.hud-card {
  --pc: #fff;
  --flash: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 0 1 17rem;
  min-width: 0;
  padding: 0.5rem 0.7rem 0.55rem;
  border: 0.15rem solid color-mix(in srgb, var(--pc) 75%, var(--ink));
  border-radius: 1.1rem;
  background: linear-gradient(180deg, rgba(27, 32, 72, 0.9), rgba(15, 18, 44, 0.9));
  box-shadow:
    0 0.28rem 0 rgba(10, 8, 30, 0.85),
    0 0 1.2rem color-mix(in srgb, var(--pc) 22%, transparent);
}

.hud-card__top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.hud-card__avatar {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
}

.hud-card__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--pc);
  font-weight: 700;
  text-overflow: ellipsis;
  text-shadow: 0 0.08em 0 var(--ink);
  white-space: nowrap;
}

.hud-card__score {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.hud-card__score-num {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0.08em 0 var(--ink);
}

.hud-card__score-num.is-bump {
  animation: bump 0.45s var(--ease-back);
}

.hud-card__score-label {
  color: var(--text-dim);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hud-bar {
  position: relative;
  height: 0.95rem;
  overflow: hidden;
  border: 0.12rem solid var(--ink);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
}

.hud-bar__fill,
.hud-bar__trail {
  position: absolute;
  inset: 0;
  transform-origin: left;
}

.hud-bar__fill {
  background: linear-gradient(180deg, #9ff5b9 0%, #22c55e 55%, #15803d 100%);
  transition: transform 0.12s ease-out;
}

.hud-bar__trail {
  background: #ffe2e2;
  transition: transform 0.5s ease 0.35s;
}

.hud-card.is-low .hud-bar__fill {
  background: linear-gradient(180deg, #fecaca 0%, #ef4444 55%, #b91c1c 100%);
  animation: low-hp 0.7s ease-in-out infinite alternate;
}

.hud-bar__text {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0.06em 0 var(--ink);
  transform: translateY(-50%);
}

.hud-shield {
  height: 0.38rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(103, 232, 249, 0.15);
  display: none;
}

.hud-shield.is-on {
  display: block;
}

.hud-shield__fill {
  display: block;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 0.5rem var(--cyan);
  transform-origin: left;
  transition: transform 0.15s;
}

.hud-card__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-fuel {
  display: flex;
  gap: 0.05rem;
}

.pip--fuel .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: rgba(255, 255, 255, 0.16);
  transition: color 0.2s;
}

.pip--fuel.is-on .icon {
  color: #38bdf8;
  filter: drop-shadow(0 0 0.2rem rgba(56, 189, 248, 0.7));
}

.hud-gun {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.hud-gun__pips {
  display: flex;
  gap: 0.15rem;
}

.pip--gun {
  width: 0.48rem;
  height: 0.85rem;
  border-radius: 0.2rem;
  background: rgba(255, 255, 255, 0.15);
  transform: skewX(-12deg);
}

.pip--gun.is-on {
  background: #a78bfa;
  box-shadow: 0 0 0.35rem rgba(167, 139, 250, 0.7);
}

.hud-gun__name {
  overflow: hidden;
  color: #c4b5fd;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-gun.is-super .pip--gun {
  background: var(--gold);
  box-shadow: 0 0 0.4rem var(--gold);
}

.hud-gun.is-super .hud-gun__name {
  color: var(--gold);
  animation: super-glow 0.5s ease-in-out infinite alternate;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.hud-chip .icon {
  width: 1rem;
  height: 1rem;
}

.hud-chip--bomb .icon {
  color: #a78bfa;
}

.hud-chip--lives {
  margin-left: auto;
}

.hud-chip--lives .icon {
  color: #ff5a7a;
}

.hud-card__fx {
  position: absolute;
  top: -1.15rem;
  right: 0.55rem;
  display: flex;
  gap: 0.3rem;
}

.fx {
  --fx: #fff;
  position: relative;
  display: grid;
  place-items: center;
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 50%;
  background: rgba(12, 10, 35, 0.94);
  color: var(--fx);
  animation: slot-in 0.35s var(--ease-back);
}

.fx .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.fx__ring {
  position: absolute;
  inset: -0.08rem;
  width: calc(100% + 0.16rem);
  height: calc(100% + 0.16rem);
  transform: rotate(-90deg);
}

.fx__ring circle {
  fill: none;
  stroke-width: 3.4;
}

.fx__ring-bg {
  stroke: rgba(255, 255, 255, 0.14);
}

.fx__ring-fg {
  stroke: var(--fx);
  stroke-dasharray: 100;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear;
}

.fx.is-ending {
  animation: blink 0.35s ease-in-out infinite alternate;
}

.hud-card__dead {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: inherit;
  background: rgba(10, 8, 30, 0.8);
  font-weight: 700;
}

.hud-card.is-dead .hud-card__dead,
.hud-card.is-out .hud-card__dead {
  display: flex;
}

.hud-card__dead-bar {
  width: 70%;
  height: 0.3rem;
  border-radius: 999px;
  background: var(--pc);
  transform-origin: left;
}

.hud-card.is-out {
  filter: grayscale(1);
}

.hud-card.is-out .hud-card__dead-bar {
  display: none;
}

.hud-card.is-hit {
  animation: card-hit 0.32s ease-out;
}

.hud-card.is-pickup,
.hud-card.is-weapon {
  animation: card-glow 0.6s ease-out;
}

.hud-card.is-spawn {
  animation: pop-in 0.45s var(--ease-back);
}

.hud-card.is-jugg {
  border-color: var(--gold);
  box-shadow:
    0 0.28rem 0 rgba(10, 8, 30, 0.85),
    0 0 1.6rem rgba(251, 191, 36, 0.55);
}

.hud-cards.is-many .hud-card {
  flex-basis: 12rem;
  padding: 0.4rem 0.5rem;
}

.hud-cards.is-many .hud-gun__name,
.hud-cards.is-many .hud-card__score-label {
  display: none;
}

.hud-scoreboard {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 20, 0.45);
}

.scoreboard {
  min-width: 34rem;
  max-height: 85vh;
  overflow: auto;
  padding: 1rem 1.3rem 1.1rem;
  border: 0.15rem solid rgba(255, 255, 255, 0.16);
  border-radius: 1.4rem;
  background: linear-gradient(180deg, #262b63, #171b45);
  box-shadow: 0 0.35rem 0 var(--ink);
  animation: pop-in 0.25s var(--ease-back);
}

.scoreboard__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  margin-bottom: 0.6rem;
  font-size: 1.4rem;
}

.scoreboard__title .icon {
  color: var(--gold);
}

.scoreboard__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.25rem;
}

.scoreboard__table th {
  padding: 0 0.6rem;
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scoreboard__table th:first-child {
  text-align: left;
}

.scoreboard__row td {
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.scoreboard__row td:first-child {
  border-radius: 0.7rem 0 0 0.7rem;
}

.scoreboard__row td:last-child {
  border-radius: 0 0.7rem 0.7rem 0;
}

.scoreboard__row.is-local td {
  background: color-mix(in srgb, var(--c) 25%, rgba(255, 255, 255, 0.05));
}

.scoreboard__pilot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scoreboard__num {
  text-align: center;
}

.scoreboard__tag.is-gold {
  color: var(--gold);
}

.scoreboard__away {
  color: #ff9a9e;
  font-size: 0.72rem;
}

.scoreboard__team td {
  padding: 0.55rem 0.6rem 0.1rem;
  color: var(--c);
  font-weight: 700;
}

.scoreboard__team td span {
  text-shadow: 0 0.08em 0 var(--ink);
}

.scoreboard__team strong {
  float: right;
}

/* ── Animations ───────────────────────────────────────────────────────── */

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(0.8rem) scale(0.99);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes slot-in {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(0.6rem);
  }
}

@keyframes value-next {
  from {
    opacity: 0;
    transform: translateX(0.8rem);
  }
}

@keyframes value-prev {
  from {
    opacity: 0;
    transform: translateX(-0.8rem);
  }
}

@keyframes thumb-next {
  from {
    opacity: 0.2;
    transform: translateX(1rem) rotate(2deg);
  }
}

@keyframes thumb-prev {
  from {
    opacity: 0.2;
    transform: translateX(-1rem) rotate(-2deg);
  }
}

@keyframes letter-bounce {
  0%,
  70%,
  100% {
    transform: translateY(0) rotate(0);
  }
  78% {
    transform: translateY(-0.12em) rotate(-3deg);
  }
  86% {
    transform: translateY(0.02em) rotate(1deg);
  }
}

@keyframes orbit-x {
  from {
    transform: translateX(-2.6em);
  }
  to {
    transform: translateX(2.6em);
  }
}

@keyframes orbit-y {
  from {
    transform: translateY(-0.55em) scale(0.75);
  }
  to {
    transform: translateY(0.55em) scale(1.15);
  }
}

@keyframes orbit-z {
  0% {
    z-index: 2;
  }
  50% {
    z-index: -1;
  }
}

@keyframes drift {
  to {
    transform: translate(50%, 50%);
  }
}

@keyframes wiggle {
  30% {
    transform: rotate(-12deg) scale(1.15);
  }
  60% {
    transform: rotate(8deg);
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.12);
    box-shadow: 0 0 1rem rgba(103, 232, 249, 0.45);
  }
}

@keyframes ship-bob {
  from {
    transform: translateY(-0.08rem) rotate(-4deg);
  }
  to {
    transform: translateY(0.12rem) rotate(4deg);
  }
}

@keyframes flame {
  from {
    transform: scaleY(0.8);
  }
  to {
    transform: scaleY(1.2);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-slow {
  0%,
  80% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes toast-drop {
  from {
    opacity: 0;
    transform: translateY(-1.2rem) scale(0.9);
  }
}

@keyframes toast-up {
  to {
    opacity: 0;
    transform: translateY(-1rem);
  }
}

@keyframes title-pop {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-6deg);
  }
}

@keyframes confetti {
  to {
    transform: translateY(110vh) rotate(var(--r));
  }
}

@keyframes big-in {
  from {
    opacity: 0;
    transform: scale(2.2);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.8rem) scale(0.7);
  }
}

@keyframes feed-in {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }
}

@keyframes tick-pulse {
  50% {
    transform: scale(1.12);
  }
}

@keyframes bump {
  40% {
    transform: scale(1.5);
    color: var(--gold);
  }
}

@keyframes low-hp {
  to {
    filter: brightness(1.45);
  }
}

@keyframes super-glow {
  to {
    text-shadow: 0 0 0.5rem var(--gold);
  }
}

@keyframes blink {
  to {
    opacity: 0.35;
  }
}

@keyframes card-hit {
  20% {
    transform: translateX(-0.3rem);
    box-shadow: 0 0 1.4rem rgba(255, 90, 95, 0.8);
  }
  45% {
    transform: translateX(0.25rem);
  }
  70% {
    transform: translateX(-0.12rem);
  }
}

@keyframes card-glow {
  30% {
    transform: translateY(-0.25rem) scale(1.03);
    box-shadow: 0 0 1.8rem var(--flash);
  }
}

/* ── Responsive ───────────────────────────────────────────────────────── */

/* Phones (online menus must stay usable): stack everything and scroll. */
@media (max-width: 760px) {
  :root {
    font-size: 15px;
  }

  .screen {
    gap: 0.8rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    overflow-y: auto;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .topbar__title {
    justify-self: end;
    font-size: 1.5rem;
  }

  .topbar__right {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: space-between;
  }

  .online__body {
    justify-content: flex-start;
  }

  .online__cards,
  .howto__grid--controls,
  .local__body,
  .lobby__body,
  .results__body,
  .settings__body,
  .howto__grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .local__body,
  .lobby__body,
  .results__body {
    flex: none;
  }

  .lobby-pilots,
  .match-panel__options,
  .settings__body,
  .standings__scroll,
  .awards {
    overflow: visible;
  }

  .panel__head,
  .panel__actions {
    flex-wrap: wrap;
  }

  .lobby-pilot {
    flex-wrap: wrap;
  }

  .lobby-pilot__controls {
    width: 100%;
    justify-content: flex-end;
  }

  .mode-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .level-pick {
    grid-template-columns: 9rem minmax(0, 1fr);
  }

  .lobby__launch {
    position: sticky;
    bottom: 0;
    z-index: 3;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-radius: 1.2rem;
    background: rgba(12, 10, 35, 0.92);
  }

  .menu__tiles {
    flex-direction: column;
  }

  .logo {
    font-size: 3.6rem;
  }

  .prompts {
    display: none;
  }

  .results__title {
    font-size: 2.4rem;
  }
}

/* 720p-ish heights: give the results room for every award. */
@media (max-height: 760px) and (min-width: 761px) {
  /* Lobby seat cards carry up to five controls: keep the hull portrait visible. */
  .slot {
    gap: 0.28rem;
    padding: 0.45rem;
  }

  .slot .opt--mini {
    min-height: 1.8rem;
    padding-block: 0.1rem;
  }

  .slot .classpick {
    min-height: 2.2rem;
    padding-block: 0.12rem;
  }

  .slot__stage {
    gap: 0.2rem;
  }

  .slot__name {
    padding-block: 0.18rem;
  }

  .results__ships,
  .results__ship {
    height: 3.2rem;
  }

  .results__ship {
    width: 3.2rem;
  }

  .results__title {
    font-size: 3rem;
  }

  .award {
    padding: 0.4rem 0.6rem;
  }

  .award__icon {
    width: 2.2rem;
    height: 2.2rem;
  }
}

/* Short landscape screens: tighten vertical rhythm. */
@media (max-height: 560px) {
  .logo {
    font-size: 3.8rem;
  }

  .menu {
    gap: 0.7rem;
  }
}

/* ── Reduced motion ───────────────────────────────────────────────────── */

/* Animations are decoration only (timed HUD items are removed by script), so
   they can simply be switched off. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .logo__orbit {
    transform: translateX(2.6em);
  }

  .confetti {
    display: none;
  }
}

/* ── Ship classes: HUD, respawn panel, results, how-to ─────────────────── */

.hud-card__who {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  min-width: 0;
}

.hud-card__who .hud-card__name {
  flex: 0 1 auto;
}

.hud-card__cls {
  --cc: #cbd5e1;
  flex: none;
  color: color-mix(in srgb, var(--cc) 60%, #fff);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.respawn-cls {
  --cc: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.respawn-cls__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.respawn-cls__head {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  white-space: nowrap;
}

.respawn-cls__name {
  color: color-mix(in srgb, var(--cc) 55%, #fff);
  font-weight: 700;
}

.respawn-cls__role {
  color: var(--text-dim);
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.respawn-cls__trait {
  max-width: 22rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: normal;
}

.respawn-cls__keys {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.respawn-cls__keys:empty {
  display: none;
}

.respawn-cls.is-compact {
  gap: 0.4rem;
  font-size: 0.85rem;
}

.respawn-cls.is-compact .respawn-cls__keys {
  font-size: 0.65rem;
}

.respawn-cls.is-compact .glyphs {
  font-size: 0.8em;
}

.hud-respawn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border-radius: 1.4rem;
  text-align: center;
}

.hud-respawn[hidden] {
  display: none;
}

.hud-respawn .respawn-cls {
  padding: 0.3rem 0.8rem 0.3rem 0.4rem;
  border: 0.12rem solid color-mix(in srgb, var(--cc) 50%, transparent);
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.25);
  font-size: 1rem;
  text-align: left;
}

.standings__cls {
  font-size: 0.85rem;
}

.howto__classes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 78rem;
  margin: 0 auto;
}

.howto__note {
  color: var(--text-dim);
  text-align: center;
}

.howto__grid--classes {
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  width: 100%;
}

.class-card {
  --cc: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-color: color-mix(in srgb, var(--cc) 45%, transparent);
  transition: transform 0.16s var(--ease-back);
}

html[data-nav="keys"] .class-card:focus,
html[data-nav="pad"] .class-card:focus {
  transform: scale(1.02);
}

.class-card__art {
  display: grid;
  place-items: center;
  flex: none;
  width: 4.6rem;
  height: 4.6rem;
  border: 0.14rem solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--cc) 40%, #2a2f6a), #141838);
  box-shadow: 0 0.2rem 0 var(--ink);
}

.class-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.class-card__head {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
}

.class-card__head strong {
  color: color-mix(in srgb, var(--cc) 55%, #fff);
  font-size: 1.12rem;
}

.class-card__role {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.class-card__tagline {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-style: italic;
}

.class-card__trait {
  font-size: 0.9rem;
}

.class-card__trait b {
  color: var(--cc);
}

.class-card__stats {
  color: var(--text-faint);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Narrow lobby cards: the role reads fine in sentence case and saves room. */
.classpick .classpick__role {
  font-size: 1em;
  letter-spacing: 0;
  text-transform: none;
}

.classpick .opt__arrow {
  width: 1.35rem;
  height: 1.35rem;
}

.hud-card.is-out .respawn-cls {
  display: none;
}


/* Smash-style player cursors in the couch lobby (pad-cursors.js). */
.pad-cursors {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}
.pad-cursor {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  filter: drop-shadow(0 0 0 #140f2e) drop-shadow(2px 3px 0 #140f2e) drop-shadow(0 0 8px var(--pc));
}
.pad-cursor__hand {
  position: absolute;
  left: -4px;
  top: -3px;
  width: 34px;
  height: 40px;
  background: var(--pc);
  /* An arrow pointer whose tip is the hotspot (top-left). */
  clip-path: polygon(12% 4%, 92% 58%, 58% 62%, 76% 96%, 60% 100%, 42% 68%, 14% 86%);
}
.pad-cursor__label {
  position: absolute;
  left: 26px;
  top: 26px;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: var(--pc);
  color: #140f2e;
  font-weight: 700;
  font-size: 0.85rem;
  border: 2px solid #140f2e;
}
.pad-cursor.is-pressing .pad-cursor__hand {
  animation: pad-cursor-press 160ms ease-out;
}
@keyframes pad-cursor-press {
  50% {
    transform: scale(0.8);
  }
}
.is-cursor-hover {
  outline: 3px solid var(--hover-color, #fff) !important;
  outline-offset: 2px;
  box-shadow: 0 0 16px color-mix(in srgb, var(--hover-color, #fff) 60%, transparent);
}

/* Character-select grid of class portraits. */
.class-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.class-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.2rem 0.45rem;
  border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--cc) 50%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 32%, #151a3a), #121634);
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}
.class-tile:hover,
.class-tile:focus-visible,
.class-tile.is-cursor-hover {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--cc);
}
.class-tile.is-picked {
  border-color: var(--cc);
}
.class-tile__name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--cc);
}
.class-tile__trait {
  font-size: 0.68rem;
  opacity: 0.75;
  white-space: nowrap;
}
.class-tile__tokens {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  flex-direction: column;
  display: flex;
  gap: 2px;
}
.class-token {
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--pc);
  color: #140f2e;
  border: 2px solid #140f2e;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
  animation: class-token-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes class-token-pop {
  from {
    transform: scale(0.3);
  }
}
@media (prefers-reduced-motion: reduce) {
  .class-token,
  .pad-cursor.is-pressing .pad-cursor__hand {
    animation: none;
  }
}

/* ── Story mode (docs/STORY.md §1, §7) ────────────────────────────────── */

/* The campaign's darker skin: colder, desaturated glass, tighter corners,
   arterial red and sickly green accents, terminal type for comms and data.
   Applied with .story-theme on story screens, story lobbies and the HUD. */
.story-theme {
  --panel: rgba(10, 11, 16, 0.9);
  --panel-top: rgba(24, 23, 32, 0.92);
  --panel-line: rgba(200, 192, 222, 0.11);
  --text: #ebe8f1;
  --text-dim: #a7a1b6;
  --text-faint: #6f6981;
  --radius: 0.55rem;
  --radius-lg: 0.7rem;
  --blight: #a3e635;
  --bruise: #8b2fb0;
  --blood: #e0263f;
  --signal: #9fd8e8;
  --ring: 0 0 0 0.14rem #040406, 0 0 0 0.34rem var(--signal), 0 0 1.4rem 0.2rem rgba(159, 216, 232, 0.35);
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "DejaVu Sans Mono", monospace;
}

.story-theme .panel {
  background: linear-gradient(180deg, var(--panel-top), var(--panel) 30%);
  box-shadow:
    0 0.5rem 1.4rem rgba(0, 0, 0, 0.6),
    inset 0 0.08rem 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px) saturate(0.5);
}

.story-theme .panel__title .icon,
.story-theme .topbar__title .icon {
  color: var(--blood);
}

.story-theme .btn::after {
  opacity: 0.3;
}

.story-theme .btn--primary {
  --bg: #e5485b;
  --bg2: #a1162b;
  --edge: #46060f;
  --fg: #fff3f4;
  text-shadow: 0 0.07em 0 rgba(30, 0, 6, 0.55);
}

.story-theme .btn--secondary {
  --bg: #4c4759;
  --bg2: #2b2735;
  --edge: #110e17;
}

.story-theme .btn--accent {
  --bg: #7d97a6;
  --bg2: #405563;
  --edge: #182329;
  --fg: #f1f9ff;
  text-shadow: 0 0.07em 0 rgba(0, 10, 20, 0.5);
}

/* Story screens drain the cartoon match behind them of color. */
.screen.story-theme::before {
  background: radial-gradient(ellipse at 50% 45%, rgba(4, 5, 9, 0.5) 0%, rgba(3, 4, 7, 0.9) 100%);
  backdrop-filter: saturate(0.3) brightness(0.85);
}

/* Faint scanlines over every story screen. */
.screen.story-theme::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px);
}

.campaign__caption,
.briefing__kicker,
.briefing__heading,
.map-node__status,
.comms__head,
.hud-objective__head,
.hud-boss__head,
.story-banner__kicker {
  font-family: var(--mono, ui-monospace, monospace);
  text-transform: uppercase;
}

/* ── Story: menu tile ── */

.story-tile {
  position: relative;
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 1rem;
  width: 40.2rem;
  padding: 0.85rem 1.3rem 0.85rem 1rem;
  overflow: hidden;
  border: 0.14rem solid #2a1016;
  border-radius: 0.8rem;
  background:
    radial-gradient(circle at 2.8rem 50%, rgba(255, 110, 50, 0.35), transparent 5.5rem),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    linear-gradient(100deg, #170a0e 0%, #0c0b12 55%, #0a0d12 100%);
  box-shadow:
    0 0.35rem 0 #050306,
    0 1rem 2rem rgba(0, 0, 0, 0.55),
    inset 0 0 0 0.08rem rgba(224, 38, 63, 0.25);
  color: #ece8f1;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-out),
    box-shadow 0.18s;
}

.story-tile__star {
  grid-row: 1 / span 3;
  justify-self: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #ffe1b0 0%, #ff8a3d 35%, #c2300f 75%, #4a0b05 100%);
  box-shadow:
    0 0 1.2rem 0.3rem rgba(255, 90, 40, 0.45),
    inset -0.3rem -0.3rem 0.6rem rgba(40, 0, 20, 0.7);
  animation: star-throb 2.9s ease-in-out infinite;
}

.story-tile__kicker {
  color: #e0263f;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.story-tile__title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-shadow: 0 0 1.2rem rgba(224, 38, 63, 0.35);
}

.story-tile__text {
  color: #a7a1b6;
  font-size: 0.88rem;
  font-weight: 500;
}

.story-tile__go {
  grid-column: 3;
  grid-row: 1 / span 3;
  color: #e0263f;
}

.story-tile__go .icon {
  width: 1.8rem;
  height: 1.8rem;
}

.story-tile:hover {
  transform: translateY(-0.12rem) scale(1.015);
}

html[data-nav="keys"] .story-tile:focus,
html[data-nav="pad"] .story-tile:focus {
  transform: scale(1.04);
  box-shadow:
    0 0.35rem 0 #050306,
    0 0 0 0.14rem #040406,
    0 0 0 0.36rem #e0263f,
    0 0 1.6rem 0.3rem rgba(224, 38, 63, 0.45);
}

/* ── Story: campaign map ── */

.screen--story {
  gap: 0.6rem;
}

.screen--story::before {
  display: none;
}

.campaign__map {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.campaign__nodes {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.screen--story > .topbar,
.screen--story > .campaign__body,
.screen--story > .prompts {
  position: relative;
  z-index: 2;
}

.campaign__summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.campaign__stars {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #f2d7a0;
}

.campaign__body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 1.4rem;
  pointer-events: none;
}

.campaign__left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.campaign__region {
  flex: 1;
}

.campaign__caption {
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.map-node {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}

.map-node__label {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 50%;
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  padding: 0.05rem 0.45rem;
  border-radius: 0.25rem;
  background: rgba(4, 5, 9, 0.55);
  color: #cfcadb;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-transform: uppercase;
  transform: translateX(-50%);
  transition:
    color 0.15s,
    background 0.15s;
}

.map-node__num {
  color: var(--blood);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.map-node__status {
  position: absolute;
  top: calc(100% + 1.85rem);
  left: 50%;
  color: var(--text-faint);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  white-space: nowrap;
  transform: translateX(-50%);
}

.map-node__status .star-row {
  font-size: 0.8rem;
}

.map-node[data-state="next"] .map-node__status {
  color: #ff5a6c;
  animation: blink 1.4s steps(2, jump-none) infinite;
}

.map-node[data-state="open"] .map-node__status {
  color: #b48ad0;
}

.map-node[data-state="locked"] .map-node__label {
  color: #5e5970;
}

.map-node[data-state="locked"] .map-node__num {
  color: #5e5970;
}

.map-node:hover .map-node__label,
.map-node.is-selected .map-node__label {
  background: rgba(225, 240, 250, 0.12);
  color: #fff;
}

.briefing {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: min(31rem, 40vw);
  overflow-y: auto;
  border-left: 0.2rem solid var(--blood);
  pointer-events: auto;
  animation: fade-in 0.3s ease-out;
}

.briefing[data-state="cleansed"] {
  border-left-color: var(--signal);
}

.briefing[data-state="locked"] {
  border-left-color: #3a3647;
}

.briefing__head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.briefing__kicker {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}

.briefing__status {
  color: #ff5a6c;
}

.briefing[data-state="cleansed"] .briefing__status {
  color: var(--signal);
}

.briefing[data-state="locked"] .briefing__status {
  color: var(--text-faint);
}

.briefing__title {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.briefing.is-locked .briefing__title {
  color: var(--text-faint);
}

.briefing__meta {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.briefing__players {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.briefing__threat {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.briefing__threat-label {
  margin-right: 0.3rem;
}

.briefing__pip {
  width: 0.45rem;
  height: 0.85rem;
  border-radius: 0.1rem;
  background: rgba(255, 255, 255, 0.1);
  transform: skewX(-15deg);
}

.briefing__pip.is-on {
  background: var(--blood, #e0263f);
  box-shadow: 0 0 0.4rem rgba(224, 38, 63, 0.6);
}

.briefing__blurb {
  font-size: 1rem;
  line-height: 1.4;
}

.briefing.is-locked .briefing__blurb,
.briefing__redacted {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.briefing__section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.briefing__heading {
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--panel-line);
  color: var(--text-faint);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.briefing__objectives {
  display: grid;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.briefing__objective {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
}

.briefing__obj-icon .icon,
.mission-card__obj-icon .icon {
  color: var(--signal);
}

.briefing__comms {
  display: grid;
  gap: 0.5rem;
}

.briefing__comm {
  display: grid;
  grid-template-columns: 2.7rem minmax(0, 1fr);
  align-items: start;
  gap: 0.65rem;
}

.briefing__portrait {
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid color-mix(in srgb, var(--speaker) 45%, transparent);
  border-radius: 0.3rem;
}

.briefing__comm-body {
  display: flex;
  flex-direction: column;
}

.briefing__speaker {
  color: var(--speaker);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.briefing__said {
  color: #cdc8d8;
  font-size: 0.88rem;
  line-height: 1.35;
}

.briefing__record {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.7rem;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.88rem;
}

.briefing__label {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.briefing__none {
  color: var(--text-dim);
}

.briefing__time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.briefing__diff {
  color: var(--text-dim);
}

.briefing__difficulty {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.briefing__diff-text {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.briefing__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.3rem;
}

.star-row {
  display: inline-flex;
  gap: 0.1em;
}

.star-row__star .icon {
  width: 1.05em;
  height: 1.05em;
  color: rgba(255, 255, 255, 0.16);
}

.star-row__star.is-on .icon {
  color: #f2d7a0;
  filter: drop-shadow(0 0 0.3em rgba(242, 215, 160, 0.5));
}

/* ── Story: lobby mission card ── */

.mission-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mission-card__head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.mission-card__planet {
  flex: none;
  width: 5.2rem;
  height: 5.2rem;
  border-radius: 0.5rem;
  background: radial-gradient(circle at 50% 50%, #12101a, #050508);
}

.mission-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.mission-card__kicker {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mission-card__name {
  font-size: 1.6rem;
  line-height: 1.1;
}

.mission-card__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.mission-card__new {
  color: #ff5a6c;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mission-card__blurb {
  color: #d4cfde;
}

.mission-card__objectives {
  display: grid;
  gap: 0.22rem;
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.035);
  list-style: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.mission-card__objectives li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mission-card__actions {
  display: flex;
  gap: 0.6rem;
}

/* ── Story: HUD ── */

.hud-story-left {
  position: absolute;
  top: 0.8rem;
  left: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(25rem, 31vw);
}

.hud-net:not([hidden]) ~ .hud-story-left {
  top: 2.9rem;
}

.hud-objective,
.hud-comms,
.hud-lives,
.hud-kills,
.hud-boss {
  transition: opacity 0.2s ease;
}

.hud-objective {
  padding: 0.45rem 0.75rem 0.55rem;
  border: 1px solid rgba(159, 216, 232, 0.16);
  border-left: 0.22rem solid #9fd8e8;
  border-radius: 0.4rem;
  background: rgba(6, 8, 12, 0.8);
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.45);
}

.hud-objective.is-new {
  animation: objective-in 0.7s var(--ease-out);
}

.hud-objective.is-done {
  border-left-color: #6ee7a8;
}

.hud-objective__head {
  display: flex;
  justify-content: space-between;
  color: #9fd8e8;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.hud-objective__main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.12rem 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

.hud-objective__icon .icon {
  color: #9fd8e8;
}

.hud-objective__meter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-objective__bar {
  flex: 1;
  height: 0.38rem;
  overflow: hidden;
  border-radius: 0.2rem;
  background: rgba(255, 255, 255, 0.08);
}

.hud-objective__fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3f7f93, #bdf0ff);
  box-shadow: 0 0 0.5rem rgba(159, 216, 232, 0.6);
  transform-origin: left;
  transition: transform 0.2s linear;
}

.hud-objective__label {
  color: #c7c2d2;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  white-space: nowrap;
}

.hud-comms {
  --speaker: #94a3b8;
  position: relative;
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.5rem 0.75rem 0.45rem 0.5rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--speaker) 40%, transparent);
  border-radius: 0.45rem;
  background: linear-gradient(180deg, rgba(10, 12, 18, 0.9), rgba(4, 5, 8, 0.92));
  box-shadow:
    0 0.4rem 1rem rgba(0, 0, 0, 0.5),
    0 0 1.2rem color-mix(in srgb, var(--speaker) 14%, transparent);
}

.hud-comms::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px);
}

.hud-comms.is-new-line {
  animation: comms-in 0.3s ease-out;
}

.comms__frame {
  position: relative;
  width: 4.4rem;
  height: 4.4rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--speaker) 50%, transparent);
  border-radius: 0.3rem;
  background: #050608;
}

.comms__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px),
    radial-gradient(circle, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.portrait {
  display: block;
  width: 100%;
  height: 100%;
}

.comms__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.comms__head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.comms__name {
  flex: none;
  color: var(--speaker);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.comms__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #77718a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comms__band {
  flex: none;
  color: #5f5a70;
  font-size: 0.56rem;
  white-space: nowrap;
}

.comms__line {
  min-height: 2.7em;
  margin-top: 0.2rem;
  color: #e6e2ee;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}

.comms__cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.1em;
  vertical-align: -0.15em;
  background: var(--speaker);
  animation: caret 1s steps(1) infinite;
}

.hud-comms.is-typing .comms__cursor {
  animation: none;
}

.comms__foot {
  display: flex;
  justify-content: flex-end;
  color: #5f5a70;
  font-size: 0.64rem;
}

.comms__foot .key {
  padding: 0 0.3em;
  font-size: 0.6rem;
}

html[data-nav="pad"] .comms__hint-keys,
html:not([data-nav="pad"]) .comms__hint-pad {
  display: none;
}

.comms__armed {
  color: #ff5a6c;
  font-weight: 600;
  animation: blink 0.8s steps(2, jump-none) infinite;
}

/* The Blight's voices come over a hijacked band: green-white text that tears. */
.hud-comms.is-hostile {
  background: linear-gradient(180deg, rgba(10, 14, 8, 0.92), rgba(3, 5, 3, 0.94));
}

.hud-comms.is-hostile .comms__line {
  color: #dbf7b6;
  text-shadow:
    0.06em 0 rgba(255, 0, 60, 0.4),
    -0.06em 0 rgba(0, 255, 200, 0.25);
  animation: comms-glitch 2.6s steps(1) infinite;
}

.hud-comms.is-hostile .comms__band {
  color: #ff5a6c;
}

.hud.is-story .hud-announce {
  top: 28%;
}

.hud-story-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hud-lives,
.hud-kills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.4rem;
  background: rgba(6, 8, 12, 0.8);
  font-size: 0.85rem;
  font-weight: 700;
}

.hud-lives {
  border-color: rgba(255, 77, 94, 0.35);
}

.hud-lives.is-changed {
  animation: bump 0.45s var(--ease-back);
}

.hud-lives__hearts {
  display: flex;
  gap: 0.12rem;
}

.hud-lives__heart .icon {
  width: 1.05rem;
  height: 1.05rem;
  color: #ff4d5e;
  filter: drop-shadow(0 0 0.25rem rgba(255, 77, 94, 0.6));
}

.hud-lives__heart.is-empty .icon {
  color: rgba(255, 255, 255, 0.14);
  filter: none;
}

.hud-lives__text {
  color: #ffb3bc;
  font-size: 0.78rem;
}

.hud-lives__text:empty {
  display: none;
}

.hud-lives.is-last,
.hud-lives.is-empty {
  border-color: #ff4d5e;
  box-shadow: 0 0 1rem rgba(255, 77, 94, 0.35);
}

.hud-lives.is-empty {
  animation: low-hp 0.9s ease-in-out infinite alternate;
}

.hud-kills .icon {
  color: #a3e635;
}

.hud-kills__num {
  display: inline-block;
  min-width: 1.4em;
  font-size: 1rem;
  text-align: right;
}

.hud-kills__num.is-bump {
  animation: bump 0.35s var(--ease-back);
}

.hud-kills__label {
  color: #8d879e;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud-boss {
  /* As wide as fits between the objective/comms column and the kill feed. */
  width: min(36rem, calc(100vw - 2 * (min(25rem, 31vw) + 2.4rem)));
  padding: 0.3rem 0.65rem 0.5rem;
  border: 1px solid rgba(224, 38, 63, 0.5);
  border-radius: 0.4rem;
  background: rgba(10, 4, 6, 0.84);
  box-shadow: 0 0 1.4rem rgba(224, 38, 63, 0.25);
}

.hud-boss.is-phase {
  animation: boss-phase 0.9s ease-out;
}

.hud-boss__head {
  display: flex;
  justify-content: space-between;
  color: #ffb3bc;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.hud-boss__phase {
  color: #ff5a6c;
}

.hud-boss__bar {
  position: relative;
  height: 0.8rem;
  margin-top: 0.25rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.8);
  border-radius: 0.15rem;
  background: rgba(255, 255, 255, 0.05);
}

.hud-boss__fill,
.hud-boss__trail {
  position: absolute;
  inset: 0;
  transform-origin: left;
}

.hud-boss__fill {
  background: linear-gradient(180deg, #ff7d8c 0%, #c8142e 55%, #6a0616 100%);
  transition: transform 0.12s ease-out;
}

.hud-boss__trail {
  background: rgba(255, 220, 225, 0.5);
  transition: transform 0.6s ease 0.4s;
}

.hud-boss__notch {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0.14rem;
  margin-left: -0.07rem;
  background: rgba(4, 2, 3, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 200, 210, 0.25);
}

.feed__alien {
  color: #b9e86a;
  text-shadow: 0 0.08em 0 #000;
}

.feed__count {
  color: #b9e86a;
  font-size: 0.72rem;
}

.feed__count:empty {
  display: none;
}

/* ── Story: results ── */

.story-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

.story-banner__kicker {
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.2em;
}

.story-banner__title {
  position: relative;
  color: #e9f7fc;
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0 2rem rgba(159, 216, 232, 0.45);
  animation: fade-in 0.8s ease-out both;
}

.story-banner[data-outcome="defeat"] .story-banner__title {
  color: #ff4d5e;
  text-shadow: 0 0 2rem rgba(224, 38, 63, 0.55);
}

/* Defeat tears like a dying feed: two offset copies flicker over it. */
.story-banner[data-outcome="defeat"] .story-banner__title::before,
.story-banner[data-outcome="defeat"] .story-banner__title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.story-banner[data-outcome="defeat"] .story-banner__title::before {
  color: rgba(0, 255, 210, 0.35);
  animation: tear-a 3s steps(1) infinite;
}

.story-banner[data-outcome="defeat"] .story-banner__title::after {
  color: rgba(255, 0, 80, 0.45);
  animation: tear-b 2.2s steps(1) infinite;
}

.story-banner .star-row {
  font-size: 2.1rem;
}

.story-banner__lost {
  color: var(--text-dim);
  font-size: 1.05rem;
}

.story-banner__facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.story-fact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--panel-line);
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  font-weight: 600;
}

.story-fact.is-new {
  border-color: rgba(159, 216, 232, 0.5);
  color: var(--signal);
}

.story-fact.is-signal {
  border-color: rgba(224, 38, 63, 0.5);
  color: #ffb3bc;
}

.results__column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  max-height: 100%;
}

.results__column > .panel {
  min-height: 0;
}

.story-theme .award {
  border-radius: 0.45rem;
}

.story-theme .award__icon {
  border-color: #000;
  box-shadow: none;
}

.story-log {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.story-log__lines {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: auto;
}

.story-log__line {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  align-items: start;
  gap: 0.6rem;
  animation: slot-in 0.5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 0.5s + 0.4s);
}

.story-log__portrait {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid color-mix(in srgb, var(--speaker) 45%, transparent);
  border-radius: 0.3rem;
}

.story-log__body {
  display: flex;
  flex-direction: column;
}

.story-log__name {
  color: var(--speaker);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.story-log__text {
  color: #d9d4e2;
  font-size: 0.9rem;
}

.story-log__empty {
  color: var(--text-faint);
  font-family: var(--mono);
}

.standings--story .standings__score {
  color: #b9e86a;
}

/* ── Story: how to play ── */

.howto__story {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.howto__pitch {
  border-left: 0.2rem solid var(--blood);
}

.howto__pitch-title {
  font-size: 1.5rem;
  letter-spacing: 0.04em;
}

.howto__pitch-text {
  margin-top: 0.3rem;
  color: var(--text-dim);
}

.howto__story .info-card__badge {
  background: #2b2735;
  color: var(--signal);
}

.howto__subhead {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.howto__grid--bestiary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bestiary-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-left: 0.2rem solid #5d8a1f;
}

.bestiary-card[data-kind="queen"] {
  border-left-color: var(--blood);
}

.bestiary-card__name {
  color: #c6ef8a;
  font-size: 1.05rem;
}

.bestiary-card[data-kind="queen"] .bestiary-card__name {
  color: #ff8a97;
}

.bestiary-card__note {
  color: var(--text-dim);
  font-size: 0.86rem;
}

@keyframes star-throb {
  0%,
  100% {
    box-shadow:
      0 0 1.2rem 0.3rem rgba(255, 90, 40, 0.45),
      inset -0.3rem -0.3rem 0.6rem rgba(40, 0, 20, 0.7);
  }
  12% {
    box-shadow:
      0 0 1.7rem 0.5rem rgba(255, 70, 40, 0.6),
      inset -0.3rem -0.3rem 0.6rem rgba(60, 0, 30, 0.85);
  }
  20% {
    box-shadow:
      0 0 1.3rem 0.35rem rgba(255, 90, 40, 0.5),
      inset -0.3rem -0.3rem 0.6rem rgba(40, 0, 20, 0.7);
  }
}

@keyframes objective-in {
  0% {
    opacity: 0;
    transform: translateX(-1rem);
  }
  30% {
    opacity: 1;
    box-shadow: 0 0 1.6rem rgba(159, 216, 232, 0.55);
  }
  100% {
    transform: none;
  }
}

@keyframes comms-in {
  0% {
    opacity: 0.2;
    filter: brightness(2) contrast(1.6);
  }
  100% {
    opacity: 1;
    filter: none;
  }
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

@keyframes comms-glitch {
  0%,
  88%,
  100% {
    transform: none;
  }
  90% {
    transform: translateX(0.12rem) skewX(-6deg);
  }
  93% {
    transform: translateX(-0.18rem);
    opacity: 0.7;
  }
}

@keyframes boss-phase {
  0% {
    box-shadow: 0 0 2.6rem rgba(255, 60, 80, 0.9);
    transform: scale(1.04);
  }
  100% {
    transform: none;
  }
}

@keyframes tear-a {
  0%,
  86%,
  100% {
    transform: none;
    opacity: 0;
  }
  88% {
    transform: translate(0.25rem, -0.1rem);
    opacity: 1;
    clip-path: inset(10% 0 55% 0);
  }
  92% {
    transform: translate(-0.3rem, 0.05rem);
    opacity: 1;
    clip-path: inset(60% 0 12% 0);
  }
}

@keyframes tear-b {
  0%,
  80%,
  100% {
    transform: none;
    opacity: 0;
  }
  83% {
    transform: translate(-0.25rem, 0.1rem);
    opacity: 1;
    clip-path: inset(40% 0 30% 0);
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .briefing {
    gap: 0.5rem;
  }

  .briefing__title {
    font-size: 1.7rem;
  }

  .briefing__comm:nth-child(n + 2) {
    display: none;
  }

  .story-banner__title {
    font-size: 3.2rem;
  }
}

@media (max-width: 760px) {
  .story-tile {
    width: 100%;
  }

  .campaign__body {
    flex-direction: column;
  }

  .campaign__region {
    min-height: 55vh;
  }

  .briefing {
    width: 100%;
  }

  .hud-story-left {
    width: min(20rem, 70vw);
  }
}

.bestiary-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.bestiary-card__role {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Story couch lobby: the squad's shared lives fill the second row of seats. */
.squad-info {
  grid-column: 1 / -1;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  color: var(--text-dim);
}

.squad-info__lives {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 1.05rem;
}

.squad-info__lives > span:last-child {
  color: var(--text-faint);
  font-size: 0.85rem;
}

.squad-info__hearts {
  display: flex;
  gap: 0.15rem;
}

.squad-info__hearts .icon {
  color: #ff4d5e;
  filter: drop-shadow(0 0 0.25rem rgba(255, 77, 94, 0.55));
}

.squad-info__notes {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.86rem;
}

.story-theme .slot:not(.slot--empty) {
  filter: saturate(0.7) brightness(0.92);
}
.story-theme .class-tile { filter: saturate(0.75) brightness(0.95); }

.story-theme .btn--primary.is-on {
  --bg: #d4f4fc;
  --bg2: #5fb3c9;
  --edge: #1d4c59;
  --fg: #04161c;
  text-shadow: none;
}

.story-theme .lobby-pilot {
  filter: saturate(0.7) brightness(0.92);
}

/* Story call-outs: squarer, colder plates instead of party pills. */
.story-theme .announce-toast {
  border-width: 0.1rem;
  border-radius: 0.45rem;
  background: rgba(6, 8, 12, 0.88);
}

.story-theme .announce-toast__icon {
  border-color: #000;
  border-radius: 0.35rem;
}

.story-theme .feed__entry {
  border-radius: 0.4rem;
  background: rgba(6, 8, 12, 0.78);
}

.story-theme .feed__entry.is-local {
  background: rgba(30, 34, 48, 0.9);
}

.story-theme .hud-clock {
  border-width: 0.1rem;
  border-radius: 0.5rem;
  background: rgba(6, 8, 12, 0.82);
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.45);
}

.story-theme .hud-clock__mode {
  color: #9fd8e8;
}

.story-theme .hud-card {
  border-radius: 0.6rem;
  background: linear-gradient(180deg, rgba(22, 24, 34, 0.92), rgba(8, 9, 14, 0.92));
}

.modal__card.story-theme {
  border: 1px solid rgba(200, 192, 222, 0.14);
  border-top: 0.2rem solid var(--blood);
  border-radius: 0.7rem;
  background: linear-gradient(180deg, #16151d, #0a0a0f);
  box-shadow: 0 1.4rem 3rem rgba(0, 0, 0, 0.7);
}

.modal__card.story-theme .modal__title .icon {
  color: var(--blood);
}

.modal__card.story-theme .controls-mini {
  border-radius: 0.45rem;
}

.story-theme .btn--danger {
  --bg: #6b2230;
  --bg2: #3d0f19;
  --edge: #16030a;
}

.comms__spoken {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
