/* Dark Gloss GUI — molded dark plastic, hot LED accents, self-hosted Outfit.
   Token spec: reports/ChromaShield_Style_Guide.md (Claude Design 3a FINAL). */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #1a1815;
  --panel: rgba(43, 39, 35, 0.96);
  --panel-grad: linear-gradient(180deg, #3b3631 0%, #2b2723 55%, #221f1b 100%);
  --panel-flat: linear-gradient(180deg, #3b3631, #26221e);
  --well: #12100d;
  --line: #3b3631;
  --text: #f3e9d8;
  --dim: #a99d90;
  --label: #988c7e;
  --accent: #ff8c26;
  --led: linear-gradient(180deg, #ffb35c, #ff8c26);
  --led-btn: linear-gradient(180deg, #ffb35c 0%, #ff8c26 45%, #f06e00 100%);
  --led-hi: #ffb35c;
  --led-edge: #8f4200;
  --led-ink: #2b1608;
  --gold: #ffd166;
  --ice: #45b8ff;
  --ice-hi: #7fd0ff;
  --plastic-btn: linear-gradient(180deg, #4a443e 0%, #322d28 50%, #26221e 100%);
  --shadow-panel: inset 0 2px 1px rgba(255, 255, 255, 0.22), inset 0 -6px 10px rgba(0, 0, 0, 0.5), 0 10px 26px rgba(0, 0, 0, 0.5);
  --shadow-well: inset 0 4px 8px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.08);
  --font-display: 'Outfit', Verdana, "DejaVu Sans", Tahoma, sans-serif;
  --scrollbar-track: rgba(10, 9, 7, 0.78);
  --scrollbar-thumb: rgba(122, 108, 92, 0.78);
  --scrollbar-thumb-hover: rgba(255, 140, 38, 0.88);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border: 1px solid rgba(59, 54, 49, 0.58);
  border-radius: 999px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.38);
}

*::-webkit-scrollbar-thumb {
  min-width: 32px;
  min-height: 32px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 45%),
    var(--scrollbar-thumb);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 45%),
    var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  font-family: 'Outfit', Verdana, "DejaVu Sans", Tahoma, sans-serif;
  color: var(--text);
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

#game.mouse-flight-active {
  cursor: none;
}

.mouse-flight-capture {
  position: fixed;
  left: 50%;
  bottom: max(18px, calc(var(--safe-bottom) + 18px));
  z-index: 5;
  min-height: 44px;
  max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 32px);
  padding: 10px 16px;
  transform: translateX(-50%);
  color: var(--led-ink);
  background: var(--led-btn);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -4px 6px rgba(140, 60, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.6);
  font: 700 11px/1.2 var(--font-display);
  letter-spacing: 0.8px;
  text-align: center;
  cursor: pointer;
}

.mouse-flight-capture[hidden] {
  display: none;
}

.mouse-flight-capture:focus-visible {
  outline: 3px solid #7fd0ff;
  outline-offset: 3px;
}

/* Gameplay focus is programmatic (`tabindex=-1`) so keyboard controls keep
   working after leaving the lobby. The browser's default orange focus ring
   otherwise becomes a false arena perimeter around both renderers. */
canvas[tabindex="-1"]:focus {
  outline: none;
}

#lobby {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 8px)
           calc(var(--safe-bottom) + 8px) calc(var(--safe-left) + 8px);
  background: rgba(10, 9, 7, 0.55);
}

#lobby.hidden { display: none; }

.server-update-notice[hidden] { display: none; }

.server-update-notice {
  color: #f8f1e4;
  background:
    linear-gradient(125deg, rgba(255, 140, 38, 0.14), transparent 38%),
    linear-gradient(145deg, rgba(34, 30, 24, 0.98), rgba(14, 12, 9, 0.98));
  border: 1px solid rgba(255, 140, 38, 0.78);
  border-left: 4px solid #ff8c26;
  border-radius: 10px;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 22px rgba(255, 140, 38, 0.1);
}

.server-update-notice h2 {
  margin: 0 0 5px;
  color: #ffb35c;
  font-size: clamp(12px, 2.4vw, 15px);
  letter-spacing: 1.8px;
}

.server-update-notice p {
  margin: 0 0 6px;
  color: #dfd2bd;
  font-size: 12px;
  line-height: 1.45;
}

.server-update-notice strong {
  display: block;
  color: #7fd0ff;
  font-size: 12px;
  line-height: 1.4;
}

.server-update-lobby {
  margin: 14px 0 16px;
  padding: 13px 15px;
}

.server-update-arena {
  position: fixed;
  left: 50%;
  bottom: max(72px, calc(var(--safe-bottom) + 72px));
  z-index: 17;
  width: min(680px, calc(100vw - var(--safe-left) - var(--safe-right) - 24px));
  padding: 11px 14px;
  transform: translateX(-50%);
  pointer-events: none;
}

#lobby:not(.hidden) ~ #serverUpdateArenaNotice {
  display: none;
}

#lobby.hidden ~ #touchControls.tablet-mode ~ #serverUpdateArenaNotice {
  bottom: max(176px, calc(var(--safe-bottom) + 176px));
}

.panel {
  width: min(2040px, 100%);
  min-width: 0;
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 36px);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 36px);
  padding: clamp(16px, 3.5vw, 26px) clamp(16px, 4vw, 30px);
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, #3b3631 0%, #2b2723 55%, #221f1b 100%);
  border: 0;
  border-radius: 22px;
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.22), inset 0 -6px 10px rgba(0, 0, 0, 0.5), 0 24px 80px rgba(0, 0, 0, 0.5);
}

#lobby:not(.hidden) .panel {
  animation: lobby-enter 220ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

@keyframes lobby-enter {
  from { transform: translateY(10px) scale(0.992); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* The renderer toggle rides beside the product title rather than stacking
   above it, which buys back a whole row of height above the fold. It wraps
   under the title when the two no longer fit side by side. */
.lobby-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 2px;
}

.lobby-title-row h1 {
  min-width: 0;
  margin: 0;
}

.renderer-switch {
  display: inline-flex;
  max-width: 100%;
  margin: 0;
  padding: 3px;
  gap: 3px;
  background: var(--well);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-well);
}

.renderer-switch a {
  min-width: 0;
  padding: 7px 13px;
  color: var(--dim);
  /* The lit indicator has to read as a pill seated in the pill-shaped groove
     behind it; a rounded rectangle fights the curve it sits inside. */
  border-radius: 999px;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
}

.renderer-switch a:hover { color: var(--text); }

.renderer-switch a[aria-current="page"] {
  color: var(--led-ink);
  background: var(--led);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 12px rgba(255, 140, 38, 0.35);
}

h1 {
  margin: 0 0 2px;
  max-width: 100%;
  font-size: clamp(22px, 6.7vw, 30px);
  letter-spacing: clamp(1.2px, 0.7vw, 3px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

h1 .arena { color: var(--accent); text-shadow: 0 0 18px rgba(255, 140, 38, 0.45); }

.tagline {
  margin-bottom: 18px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(560px, 1fr);
  align-items: start;
  min-width: 0;
  gap: 26px;
}

.col {
  min-width: 0;
}

.pilot-loadout-card {
  padding: 11px 12px 10px;
  background: var(--panel-flat);
  border: 0;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -3px 6px rgba(0, 0, 0, 0.35);
}

.pilot-name-heading {
  margin: 0 0 4px;
  padding: 0;
  border: 0;
}

.pilot-name-heading label {
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}

.pilot-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.pilot-name-row > *,
.ship-heading-row > *,
#newMatchSettings,
.setup-disclosure {
  max-width: 100%;
  min-width: 0;
}

.pilot-name-field {
  min-width: 0;
}

.pilot-name-row #saveName {
  min-height: 36px;
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.pilot-loadout-card #identityHint {
  min-height: 0;
  margin-top: 5px;
  font-size: 10px;
}

.ship-heading-row {
  display: flex;
  min-width: 0;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.ship-heading-row h2 {
  flex: 1 1 auto;
  margin: 0;
  padding-block: 7px 6px;
  border: 0;
}

.ship-heading-row .ship-random-setting {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.ship-heading-row .ship-random-option {
  grid-template-columns: 18px minmax(0, 1fr);
  min-height: 36px;
  gap: 7px;
  font-size: 10px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.ship-heading-row .ship-random-option input {
  width: 18px;
  height: 18px;
}

.random-fleet-preview {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  grid-template-columns: minmax(198px, 0.95fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 7px 0 2px;
  padding: 7px 9px;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 22% 50%, rgba(255, 220, 180, 0.2), transparent 45%),
    linear-gradient(115deg, rgba(43, 37, 30, 0.98), rgba(22, 19, 15, 0.98));
  border: 1px solid #4a443e;
  border-radius: 10px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 8px 22px rgba(0, 0, 0, 0.16);
  text-align: left;
}

.random-fleet-preview[hidden] { display: none; }

.random-fleet-preview:hover,
.random-fleet-preview:focus-visible {
  border-color: #ffb35c;
  background:
    radial-gradient(circle at 22% 50%, rgba(255, 220, 180, 0.28), transparent 47%),
    linear-gradient(115deg, rgba(52, 45, 36, 0.99), rgba(27, 23, 18, 0.99));
}

.random-fleet-mosaic {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  padding-left: 2px;
}

.random-fleet-thumb {
  position: relative;
  display: grid;
  width: 46px;
  height: 36px;
  flex: 0 0 46px;
  margin-left: -9px;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #4a443e, #201c18 70%);
  border: 1px solid rgba(223, 205, 180, 0.46);
  border-radius: 6px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.38);
}

.random-fleet-thumb:first-child { margin-left: 0; }
.random-fleet-thumb:nth-child(1) { transform: rotate(-5deg); }
.random-fleet-thumb:nth-child(2) { transform: translateY(2px) rotate(3deg); }
.random-fleet-thumb:nth-child(3) { z-index: 2; transform: translateY(-2px); }
.random-fleet-thumb:nth-child(4) { transform: translateY(2px) rotate(-3deg); }
.random-fleet-thumb:nth-child(5) { transform: rotate(5deg); }

.random-fleet-preview-media {
  display: block;
  width: 100%;
  height: 100%;
}

.random-fleet-thumb img.random-fleet-preview-media {
  transform: scale(1.42);
  object-fit: cover;
}

.random-fleet-preview-media[hidden] { display: none; }

.random-fleet-thumb-fallback {
  display: none;
  color: #dfd2bd;
  font-size: 14px;
  letter-spacing: 0.6px;
  text-shadow: 0 0 10px #7fd0ff;
}

.random-fleet-thumb.preview-missing .random-fleet-thumb-fallback { display: block; }

.random-fleet-copy {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.random-fleet-copy strong {
  color: #fff;
  font-size: 11px;
  letter-spacing: 1.35px;
}

.random-fleet-copy > span {
  min-width: 0;
  color: #9a8d7d;
  font-size: 9px;
  font-weight: normal;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.random-fleet-action {
  position: relative;
  z-index: 1;
  padding: 5px 7px;
  color: #d1c4ae;
  background: rgba(255, 220, 180, 0.14);
  border: 1px solid rgba(255, 179, 92, 0.36);
  border-radius: 999px;
  font-size: 8px;
  letter-spacing: 0.8px;
}

.pilot-loadout-card .ship-picker {
  margin-top: 6px;
  padding-bottom: 6px;
}

.pilot-loadout-card #shipModelHint {
  margin-top: 1px;
  font-size: 10px;
}

.pilot-loadout-card + .match-browser-status {
  margin-top: 9px;
}

h2 {
  margin: 18px 0 10px;
  padding-bottom: 6px;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.col h2:first-child { margin-top: 0; }

.setup-disclosure {
  min-width: 0;
  margin-top: 10px;
  background: var(--panel-flat);
  border: 0;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -3px 6px rgba(0, 0, 0, 0.35);
}

.reference-col > .setup-disclosure:first-child {
  margin-top: 0;
}

.setup-disclosure > summary {
  position: relative;
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 10px 42px 10px 12px;
  color: #c9bba6;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1.15px;
  line-height: 1.25;
  list-style: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}

.setup-disclosure-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  fill: none;
  overflow: visible;
  pointer-events: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.setup-disclosure-icon .setup-icon-primary {
  stroke: var(--accent);
}

.setup-disclosure-icon .setup-icon-secondary {
  stroke: #c9bba6;
}

.custom-match-setting-icon {
  display: inline-block;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin: 0 8px 0 0;
  padding: 3px;
  fill: none;
  overflow: visible;
  vertical-align: middle;
  background: radial-gradient(circle at 35% 28%, rgba(107, 97, 88, 0.24), rgba(25, 21, 17, 0.72));
  border: 1px solid rgba(107, 97, 88, 0.66);
  border-radius: 7px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 0 10px rgba(255, 140, 38, 0.035);
  pointer-events: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.custom-match-setting-icon .setup-icon-primary {
  stroke: var(--accent);
}

.custom-match-setting-icon .setup-icon-secondary {
  stroke: #c9bba6;
}

.setup-disclosure > summary::-webkit-details-marker {
  display: none;
}

.setup-disclosure > summary::after {
  position: absolute;
  top: 50%;
  right: 13px;
  display: grid;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  place-items: center;
  color: var(--accent);
  background: rgba(255, 140, 38, 0.08);
  border: 1px solid rgba(255, 140, 38, 0.28);
  border-radius: 50%;
  content: "+";
  font-size: 16px;
  line-height: 1;
}

.setup-disclosure > summary:hover {
  color: #fff;
  background: rgba(62, 56, 50, 0.42);
}

.setup-disclosure[open] {
  border-color: #4a443e;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03), 0 10px 28px rgba(0, 0, 0, 0.16);
}

.setup-disclosure[open] > summary {
  color: #fff;
  background: rgba(62, 56, 50, 0.34);
  border-bottom: 1px solid var(--line);
}

.setup-disclosure[open] > summary::after {
  content: "−";
}

.setup-disclosure-body {
  min-width: 0;
  padding: 11px 12px 13px;
  animation: disclosure-enter 160ms ease-out both;
}

.setup-disclosure-body > h2:first-child,
.setup-disclosure-body > section:first-child > h2:first-child {
  margin-top: 0;
}

.setup-disclosure-body > .tablet-mode-setting:first-child,
.setup-disclosure-body > .key-bindings:first-child {
  margin-top: 0;
}

.setup-disclosure .keys {
  line-height: 1.72;
}

@keyframes disclosure-enter {
  from { transform: translateY(-4px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

label {
  display: block;
  margin: 10px 0 4px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.35;
}

input[type="text"], input[type="search"], select {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  color: var(--text);
  background: var(--well);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-well);
  font: inherit;
  font-size: 14px;
}

.ship-picker[hidden],
.ship-manual-selection[hidden] { display: none; }

.ship-picker-enhanced > label[for="shipModel"] { display: none; }

.ship-picker {
  display: flex;
  gap: 7px;
  min-width: 0;
  margin-top: 5px;
  padding-bottom: 9px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}

.ship-choice {
  display: grid;
  flex: 0 0 112px;
  min-width: 0;
  padding: 5px;
  gap: 5px;
  color: var(--dim);
  background: #201c18;
  border: 1px solid var(--line);
  border-radius: 9px;
  line-height: 1.2;
  scroll-snap-align: start;
  text-align: center;
}

.ship-choice:hover { filter: brightness(1.14); }

.ship-choice[aria-checked="true"] {
  color: var(--text);
  background: #322d28;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 140, 38, 0.28), 0 0 18px rgba(255, 140, 38, 0.08);
}

.ship-preview-frame {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #3b3631 0, #221e1a 52%, #0e0c09 100%);
  border-radius: 6px;
}

.ship-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ship-preview-image[hidden] { display: none; }

.classic-ship-preview {
  overflow: visible;
}

.classic-ship-preview-glow,
.classic-ship-preview-body {
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.classic-ship-preview-glow {
  fill: none;
  opacity: 0.2;
  stroke: #2d63ff;
  stroke-width: 13;
}

.classic-ship-preview-body {
  fill: #2d63ff;
  stroke: #ffffff;
  stroke-width: 5;
}

.random-fleet-thumb .classic-ship-preview {
  transform: scale(1.08);
}

.ship-preview-fallback {
  display: none;
  color: #a59d90;
  font-size: clamp(18px, 7vw, 30px);
  letter-spacing: 1px;
  text-shadow: 0 0 16px rgba(255, 179, 92, 0.55);
}

.ship-choice.preview-missing .ship-preview-fallback { display: block; }

.ship-choice-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 10px;
  letter-spacing: 0.35px;
}

.ship-random-setting,
.tablet-mode-setting {
  margin-top: 14px;
  padding: 9px 11px 10px;
  background: #201c18;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.ship-random-option,
.tablet-mode-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  margin: 0;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.ship-random-option input,
.tablet-mode-option input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.ship-random-setting .hint,
.tablet-mode-setting .hint {
  margin: 2px 0 0 32px;
}

.customize-tablet-controls {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 10px 12px;
  color: var(--led-ink);
  background: var(--led-btn);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -4px 6px rgba(140, 60, 0, 0.4), 0 0 16px rgba(255, 140, 38, 0.25);
  font-size: 10px;
  letter-spacing: 0.8px;
  line-height: 1.25;
  touch-action: manipulation;
}

.customize-tablet-controls:hover,
.customize-tablet-controls:focus-visible {
  filter: brightness(1.08);
}

#lobby.touch-layout-blocked .panel {
  opacity: 0.28;
  filter: saturate(0.55) blur(1px);
  pointer-events: none;
}

.cheats-warning-dialog {
  width: min(460px, calc(100vw - var(--safe-left) - var(--safe-right) - 28px));
  max-width: 100%;
  margin: auto;
  padding: 0;
  overflow: visible;
  color: var(--text);
  background: transparent;
  border: 0;
}

.cheats-warning-dialog::backdrop {
  background: rgba(5, 4, 3, 0.86);
  backdrop-filter: blur(5px);
}

.cheats-warning-dialog-card {
  padding: clamp(18px, 4vw, 26px);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 138, 50, 0.19), transparent 42%),
    var(--panel-grad);
  border: 1px solid rgba(255, 166, 72, 0.76);
  border-radius: 22px;
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.18), inset 0 -6px 10px rgba(0, 0, 0, 0.5), 0 28px 90px rgba(0, 0, 0, 0.72), 0 0 34px rgba(255, 118, 45, 0.12);
}

.cheats-warning-dialog h2 {
  margin: 0 0 10px;
  color: #ffad61;
  border: 0;
  font-size: clamp(17px, 4.5vw, 22px);
  letter-spacing: 1.25px;
}

.cheats-warning-dialog p {
  margin: 0;
  color: #d8cdbb;
  font-size: 12px;
  line-height: 1.55;
}

.cheats-warning-dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.cheats-warning-dialog-actions button {
  min-width: 0;
  min-height: 48px;
  padding: 10px;
  overflow-wrap: anywhere;
  color: var(--text);
  background: var(--plastic-btn);
  border: 0;
  box-shadow: 0 4px 0 var(--well), inset 0 2px 1px rgba(255, 255, 255, 0.25), inset 0 -4px 6px rgba(0, 0, 0, 0.45);
  font-size: 10px;
  letter-spacing: 0.7px;
  touch-action: manipulation;
}

.cheats-warning-dialog-actions #cheatsWarningConfirm {
  color: #2b1608;
  background: linear-gradient(180deg, #ffc07f, #ff963f 55%, #f06e00 100%);
  box-shadow: 0 4px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.5), inset 0 -4px 6px rgba(140, 60, 0, 0.4);
}

.tablet-setup-dialog {
  width: min(440px, calc(100vw - var(--safe-left) - var(--safe-right) - 28px));
  max-width: 100%;
  margin: auto;
  padding: 0;
  overflow: visible;
  color: var(--text);
  background: transparent;
  border: 0;
}

.tablet-setup-dialog::backdrop {
  background: rgba(5, 4, 3, 0.8);
  backdrop-filter: blur(4px);
}

.tablet-setup-dialog-card {
  padding: clamp(18px, 4vw, 26px);
  background: var(--panel-grad);
  border: 0;
  border-radius: 22px;
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.22), inset 0 -6px 10px rgba(0, 0, 0, 0.5), 0 28px 90px rgba(0, 0, 0, 0.7), 0 0 32px rgba(255, 140, 38, 0.1);
}

.tablet-setup-dialog h2 {
  margin: 0 0 10px;
  color: var(--accent);
  border: 0;
  font-size: clamp(17px, 4.5vw, 22px);
  letter-spacing: 1.4px;
}

.tablet-setup-dialog p {
  margin: 0;
  color: #c9bba6;
  font-size: 12px;
  line-height: 1.55;
}

.tablet-setup-dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.tablet-setup-dialog-actions button {
  min-width: 0;
  min-height: 48px;
  padding: 10px;
  overflow-wrap: anywhere;
  color: var(--led-ink);
  background: var(--led-btn);
  border: 0;
  box-shadow: 0 4px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -4px 6px rgba(140, 60, 0, 0.4);
  font-size: 10px;
  letter-spacing: 0.7px;
  touch-action: manipulation;
}

.tablet-setup-dialog-actions #tabletSetupCustomize,
.tablet-setup-dialog-actions #tabletSetupWithout {
  color: var(--text);
  background: var(--plastic-btn);
  box-shadow: 0 4px 0 var(--well), inset 0 2px 1px rgba(255, 255, 255, 0.25), inset 0 -4px 6px rgba(0, 0, 0, 0.45);
}

.tablet-setup-dialog-actions #tabletSetupWithout {
  grid-column: 1 / -1;
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent);
}

output {
  color: var(--accent);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

button {
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

#lobbyDirectionArrowToggle,
#lobbyAnimatedSpaceToggle,
#lobbyAsteroidLabelToggle,
#lobbyNameOverlayToggle {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: #c9bba6;
  background: #12100d;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-align: left;
}

#lobbyDirectionArrowToggle:hover,
#lobbyDirectionArrowToggle.active,
#lobbyAnimatedSpaceToggle:hover,
#lobbyAnimatedSpaceToggle.active,
#lobbyAsteroidLabelToggle:hover,
#lobbyAsteroidLabelToggle.active,
#lobbyNameOverlayToggle:hover,
#lobbyNameOverlayToggle.active {
  color: var(--text);
  border-color: var(--led-hi);
}

#lobbyDirectionArrowToggle.active,
#lobbyAnimatedSpaceToggle.active,
#lobbyAsteroidLabelToggle.active,
#lobbyNameOverlayToggle.active {
  background: #331a06;
  box-shadow: inset 0 0 0 1px rgba(255, 140, 38, 0.28), 0 0 16px rgba(255, 140, 38, 0.1);
}

#lobbyDirectionArrowToggle b,
#lobbyAnimatedSpaceToggle b,
#lobbyAsteroidLabelToggle b,
#lobbyNameOverlayToggle b { color: var(--dim); }
#lobbyDirectionArrowToggle.active b,
#lobbyAnimatedSpaceToggle.active b,
#lobbyAsteroidLabelToggle.active b,
#lobbyNameOverlayToggle.active b { color: var(--led-hi); }

#lobbyAnimatedSpaceToggle,
#lobbyAsteroidLabelToggle,
#lobbyNameOverlayToggle { margin-top: 10px; }

.arena-top-controls {
  position: fixed;
  top: max(12px, calc(var(--safe-top) + 12px));
  right: max(12px, calc(var(--safe-right) + 12px));
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 16px);
}

.arena-display-toggles {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: rgba(10, 9, 7, 0.9);
  border: 1px solid rgba(125, 114, 100, 0.34);
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.38);
}

.arena-display-toggles button {
  position: relative;
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  color: #c9bba6;
  background: rgba(24, 20, 16, 0.72);
  border: 1px solid rgba(125, 114, 100, 0.48);
  border-radius: 8px;
  font-size: 10px;
  letter-spacing: 0.55px;
  line-height: 1.2;
  touch-action: manipulation;
}

.arena-display-toggles button::before {
  content: attr(data-display-abbr);
  font-size: 10px;
  font-weight: 800;
}

#arenaMuteToggle::before {
  content: none;
}

#arenaMuteToggle > .arena-mute-icon {
  display: block;
  width: 32px;
  height: 32px;
  pointer-events: none;
}

.arena-display-toggles button > span,
.arena-display-toggles button > b {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.arena-display-toggles button:hover,
.arena-display-toggles button.active {
  color: var(--text);
  border-color: rgba(255, 179, 92, 0.9);
}

.arena-display-toggles button.active {
  background: rgba(51, 26, 6, 0.94);
  box-shadow: inset 0 0 0 1px rgba(255, 140, 38, 0.2), 0 0 12px rgba(255, 140, 38, 0.2);
}

.arena-display-toggles button.active::after,
.arena-display-toggles button.latched::after {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  content: "";
  background: var(--led-hi);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 140, 38, 0.9);
}

.arena-display-toggles button.latched {
  color: var(--led-ink);
  background: var(--led);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 12px rgba(255, 140, 38, 0.35);
}

.arena-display-toggles button.latched::after {
  background: var(--led-ink);
  box-shadow: none;
}

.arena-lobby-button {
  width: 78px;
  min-width: 78px;
  height: 52px;
  min-height: 52px;
  padding: 0 12px;
  color: #eee3d1;
  background: rgba(45, 39, 32, 0.94);
  border: 1px solid rgba(243, 233, 216, 0.64);
  border-radius: 10px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.38);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  touch-action: manipulation;
}

.arena-lobby-button:hover,
.arena-lobby-button:active {
  color: #fff;
  background: rgba(59, 54, 49, 0.98);
  border-color: rgba(255, 179, 92, 0.9);
}

#lobby:not(.hidden) ~ #arenaTopControls {
  display: none;
}

:where(a, button, input, select, summary):focus-visible {
  outline: 3px solid #7fd0ff;
  outline-offset: 3px;
}

.match-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.match-actions button,
.tutorial-action button,
#newMatchSettings #createBtn {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 8px;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.2;
  touch-action: manipulation;
}

#joinBtn,
#createBtn {
  color: var(--led-ink);
  background: var(--led-btn);
  box-shadow: 0 5px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -4px 6px rgba(140, 60, 0, 0.4), 0 0 18px rgba(255, 140, 38, 0.35);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

#joinBtn:active:not(:disabled),
#createBtn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -4px 6px rgba(140, 60, 0, 0.4), 0 0 18px rgba(255, 140, 38, 0.35);
}

#tutorialBtn {
  color: var(--text);
  background: var(--plastic-btn);
  box-shadow: 0 4px 0 var(--well), inset 0 2px 1px rgba(255, 255, 255, 0.25), inset 0 -4px 6px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.7px;
}

#tutorialBtn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--well), inset 0 2px 1px rgba(255, 255, 255, 0.25), inset 0 -4px 6px rgba(0, 0, 0, 0.45);
}

.tutorial-action {
  margin: 0 0 14px;
}

.tutorial-action button {
  margin: 0;
}

.tutorial-action .hint {
  margin-top: 6px;
}

.match-actions button:hover:not(:disabled),
.tutorial-action button:hover:not(:disabled),
#newMatchSettings #createBtn:hover:not(:disabled) { filter: brightness(1.12); }

.match-actions button:disabled,
.tutorial-action button:disabled,
#newMatchSettings #createBtn:disabled,
#joinBtn:disabled {
  color: #a59d90;
  background: #3a352f;
  box-shadow: 0 3px 0 var(--well), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: not-allowed;
}

.match-actions button[aria-busy="true"],
.tutorial-action button[aria-busy="true"],
#newMatchSettings #createBtn[aria-busy="true"] {
  cursor: wait;
}

#newMatchSettings #createBtn {
  margin-top: 8px;
}

.new-match-controls {
  min-width: 0;
}

.match-mode-picker[hidden] {
  display: none;
}

.campaign-flight-plan-field[hidden],
.campaign-flight-plan-picker[hidden],
.campaign-flight-plan-hud[hidden],
.campaign-milestone-draft-hud[hidden],
.campaign-milestone-draft-overlay[hidden] {
  display: none;
}

.campaign-flight-plan-field {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin-top: 10px;
}

.campaign-flight-plan-art {
  grid-row: 1 / span 3;
  width: 42px;
  height: 34px;
  color: var(--flight-plan-color, var(--accent));
  overflow: visible;
}

.campaign-flight-plan-art-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.campaign-flight-plan-choice-benefit,
.campaign-flight-plan-choice-cost {
  font-size: 9px;
  line-height: 1.35;
}

.campaign-flight-plan-choice-benefit { color: #a5ffd1; }
.campaign-flight-plan-choice-cost { color: #ffb0b9; }

[data-campaign-flight-plan="standard"] { --flight-plan-color: #8ddfff; }
[data-campaign-flight-plan="redline"] { --flight-plan-color: #ff6b4a; }
[data-campaign-flight-plan="guardian"] { --flight-plan-color: #69e6a6; }
[data-campaign-flight-plan="longline"] { --flight-plan-color: #c18cff; }
[data-campaign-flight-plan="custom"] { --flight-plan-color: #ffd166; }
[data-campaign-flight-plan="legacy"] { --flight-plan-color: #aab2c5; }

.campaign-flight-plan-hud {
  position: fixed;
  z-index: 11;
  top: calc(var(--safe-top) + 8px);
  left: calc(var(--safe-left) + 8px);
  max-width: min(290px, calc(100vw - var(--safe-left) - var(--safe-right) - 16px));
  padding: 5px 8px;
  pointer-events: none;
  color: #f5ecdc;
  background: rgba(14, 12, 9, 0.86);
  border: 1px solid var(--flight-plan-color, rgba(141, 223, 255, 0.72));
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.campaign-flight-plan-hud-label {
  margin-right: 5px;
  color: rgba(233, 222, 203, 0.72);
  font-size: 7px;
}

.campaign-milestone-draft-hud {
  position: fixed;
  z-index: 11;
  top: calc(var(--safe-top) + 39px);
  left: calc(var(--safe-left) + 8px);
  max-width: min(520px, calc(100vw - var(--safe-left) - var(--safe-right) - 16px));
  padding: 5px 8px;
  overflow: hidden;
  pointer-events: none;
  color: #f5ecdc;
  background: rgba(14, 12, 9, 0.86);
  border: 1px solid rgba(255, 140, 38, 0.72);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.campaign-milestone-draft-hud-label {
  margin-right: 5px;
  color: rgba(255, 207, 158, 0.76);
  font-size: 7px;
}

.campaign-milestone-draft-overlay {
  position: fixed;
  z-index: 34;
  top: calc(var(--safe-top) + 70px);
  left: 50%;
  display: grid;
  width: min(920px, calc(100vw - var(--safe-left) - var(--safe-right) - 24px));
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 116px);
  box-sizing: border-box;
  gap: 8px;
  padding: clamp(12px, 2vw, 20px);
  overflow: hidden;
  pointer-events: none;
  color: #f5ecdc;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 140, 38, 0.18), transparent 50%),
    rgba(13, 11, 9, 0.95);
  border: 2px solid rgba(255, 140, 38, 0.8);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.62), 0 0 24px rgba(255, 140, 38, 0.13);
  text-align: center;
  transform: translateX(-50%);
}

.campaign-milestone-draft-kicker,
.campaign-milestone-draft-title,
.campaign-milestone-draft-prompt,
.campaign-milestone-draft-status {
  margin: 0;
}

.campaign-milestone-draft-kicker {
  color: #ff8c26;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.campaign-milestone-draft-title {
  font-size: clamp(15px, 2.1vw, 24px);
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.campaign-milestone-draft-prompt,
.campaign-milestone-draft-status {
  color: #beb09a;
  font-size: clamp(9px, 1.2vw, 12px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.campaign-milestone-draft-status {
  color: #ffc76b;
  letter-spacing: 0.08em;
}

.campaign-milestone-draft-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  pointer-events: none;
}

.campaign-milestone-draft-card {
  display: grid;
  min-width: 0;
  min-height: 142px;
  grid-template-rows: auto auto 1fr auto auto;
  align-content: start;
  gap: 5px;
  padding: 10px;
  pointer-events: auto;
  color: #f3e9d8;
  background: rgba(39, 34, 27, 0.96);
  border: 1px solid #5a534b;
  border-radius: 11px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
  font: inherit;
  text-align: left;
  touch-action: manipulation;
}

.campaign-milestone-draft-card:hover:not(:disabled) {
  border-color: #ffb35c;
  filter: brightness(1.08);
}

.campaign-milestone-draft-card:focus-visible {
  outline: 3px solid #45b8ff;
  outline-offset: 2px;
}

.campaign-milestone-draft-card.pending,
.campaign-milestone-draft-card.selected,
.campaign-milestone-draft-card.winner {
  outline: 3px solid rgba(255, 140, 38, 0.9);
  outline-offset: 2px;
}

.campaign-milestone-draft-card.selected,
.campaign-milestone-draft-card.winner {
  border-color: #ff8c26;
  box-shadow: inset 0 0 0 1px rgba(255, 140, 38, 0.65);
}

.campaign-milestone-draft-card:disabled {
  pointer-events: none;
  cursor: default;
  opacity: 0.78;
}

.campaign-milestone-draft-overlay[data-campaign-milestone-draft-state="locked"]
  .campaign-milestone-draft-card:not(.winner) {
  opacity: 0.42;
}

.campaign-milestone-draft-mark {
  color: #ff8c26;
  font-size: 24px;
  line-height: 1;
  text-align: center;
}

.campaign-milestone-draft-card-title {
  color: #ffffff;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
}

.campaign-milestone-draft-benefit,
.campaign-milestone-draft-cost,
.campaign-milestone-draft-tally,
.campaign-milestone-draft-selection {
  font-size: 9px;
  line-height: 1.3;
}

.campaign-milestone-draft-benefit { color: #a5ffd1; }
.campaign-milestone-draft-cost { color: #ffb0b9; }
.campaign-milestone-draft-tally {
  color: #b8aa94;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.campaign-milestone-draft-selection {
  min-height: 12px;
  color: #ff8c26;
  font-weight: 900;
  letter-spacing: 0.08em;
}

@media (max-width: 720px), (max-height: 620px) {
  .campaign-milestone-draft-overlay {
    top: calc(var(--safe-top) + 58px);
    width: min(680px, calc(100vw - var(--safe-left) - var(--safe-right) - 16px));
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 76px);
    gap: 5px;
    padding: 9px;
  }

  .campaign-milestone-draft-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .campaign-milestone-draft-card {
    min-height: 96px;
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 2px 6px;
    padding: 7px;
  }

  .campaign-milestone-draft-mark {
    grid-row: 1 / span 2;
    font-size: 20px;
  }

  .campaign-milestone-draft-card-title { text-align: left; }
  .campaign-milestone-draft-benefit,
  .campaign-milestone-draft-cost,
  .campaign-milestone-draft-tally,
  .campaign-milestone-draft-selection { font-size: 8px; }
  .campaign-milestone-draft-benefit,
  .campaign-milestone-draft-cost,
  .campaign-milestone-draft-tally,
  .campaign-milestone-draft-selection { grid-column: 1 / -1; }
}

.match-ruleset-picker[hidden] { display: none; }

.match-mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}

.match-mode-choice {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 132px;
  grid-template-rows: 58px auto auto;
  align-content: start;
  gap: 6px;
  padding: 10px;
  overflow: hidden;
  color: #c9bba6;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 220, 180, 0.2), transparent 58%),
    #26221e;
  border: 1px solid #4a443e;
  border-radius: 10px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
  line-height: 1.25;
  text-align: left;
  touch-action: manipulation;
}

.match-mode-choice:hover {
  color: var(--text);
  border-color: #6b6158;
  filter: brightness(1.08);
}

.match-mode-choice[aria-checked="true"] {
  color: var(--text);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 140, 38, 0.19), transparent 60%),
    #322d28;
  border-color: var(--accent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 140, 38, 0.22),
    0 0 18px rgba(255, 140, 38, 0.09);
}

.match-mode-choice:focus-visible {
  outline: 3px solid #7fd0ff;
  outline-offset: 2px;
}

.match-mode-art {
  display: block;
  width: 100%;
  height: 58px;
  fill: none;
  overflow: visible;
  pointer-events: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.match-mode-art-primary {
  stroke: var(--accent);
}

.match-mode-art-secondary {
  stroke: #7fd0ff;
}

.match-mode-choice-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.match-mode-choice-copy strong {
  color: inherit;
  font-size: 12px;
  letter-spacing: 0.75px;
  text-transform: uppercase;
}

.match-mode-choice-copy > span {
  color: var(--dim);
  font-size: 9px;
  font-weight: normal;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.match-mode-choice-status {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 3px 5px;
  opacity: 0;
  color: var(--led-ink);
  background: var(--led);
  border-radius: 999px;
  font-size: 7px;
  letter-spacing: 0.55px;
  transition: opacity 120ms ease;
}

.match-mode-choice[aria-checked="true"] .match-mode-choice-status {
  opacity: 1;
}

/* Each ruleset ships an authored solid-fill glyph with its own viewBox, so
   the artwork is tinted through currentColor rather than stroked. */
.match-ruleset-art {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--accent);
  fill: currentColor;
  pointer-events: none;
  stroke: none;
}


.custom-match-settings {
  min-width: 0;
}

.custom-match-settings[hidden] {
  display: none;
}

.overall-difficulty-settings {
  margin: 10px 0 8px;
  padding: 12px 13px 13px;
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 140, 38, 0.12), transparent 58%),
    rgba(44, 38, 31, 0.76);
  border: 1px solid rgba(255, 140, 38, 0.52);
  border-radius: 10px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 0 18px rgba(255, 140, 38, 0.035);
}

.overall-difficulty-settings[hidden],
.individual-custom-match-settings[hidden] {
  display: none;
}

.overall-difficulty-settings > label {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: bold;
  line-height: 1.35;
}

.overall-difficulty-settings > input[type="range"] {
  margin-top: 5px;
}

.overall-difficulty-scale {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -5px 2px 8px;
  color: #c9bba6;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.55px;
  text-transform: uppercase;
}

.overall-difficulty-scale span:last-child {
  text-align: right;
}

.overall-difficulty-settings .hint {
  margin-bottom: 0;
}

.individual-settings-toggle {
  display: grid;
  min-height: 48px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 7px 0 4px;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(59, 54, 49, 0.58);
  border: 1px solid rgba(107, 97, 88, 0.68);
  border-radius: 9px;
  font-size: 11px;
  font-weight: bold;
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
}

.individual-settings-toggle:hover {
  border-color: rgba(255, 140, 38, 0.72);
}

.individual-settings-toggle input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.individual-settings-toggle > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.individual-custom-match-settings {
  min-width: 0;
  margin-top: 8px;
}

.individual-custom-match-settings > summary {
  min-height: 44px;
  padding: 13px 10px;
  color: var(--text);
  background: #322d28;
  border: 1px solid #4a443e;
  border-radius: 8px;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.7px;
  line-height: 1.35;
  list-style-position: inside;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}

.individual-custom-match-settings > summary::marker {
  color: var(--accent);
}

.individual-custom-match-settings[open] > summary {
  margin-bottom: 8px;
  border-color: var(--accent);
}

.individual-custom-match-settings-body {
  min-width: 0;
  padding: 0 2px 2px;
}

.custom-match-reset {
  width: 100%;
  min-height: 44px;
  margin: 6px 0 0;
  padding: 9px 12px;
  color: var(--text);
  background: var(--plastic-btn);
  border: 0;
  box-shadow: 0 3px 0 var(--well), inset 0 1px 1px rgba(255, 255, 255, 0.22), inset 0 -3px 5px rgba(0, 0, 0, 0.45);
  line-height: 1.2;
  white-space: normal;
  touch-action: manipulation;
}

.custom-match-reset:hover:not(:disabled) {
  filter: brightness(1.12);
}

.custom-match-reset:disabled {
  opacity: 0.48;
}

.custom-match-reset-hint {
  margin-bottom: 13px;
}

.leaderboard-eligibility-settings {
  margin: 16px 0 12px;
  padding: 10px 11px 13px;
  background: rgba(24, 72, 61, 0.18);
  border-color: rgba(86, 230, 174, 0.55);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.cheats-settings {
  margin-bottom: 0;
}

.leaderboard-eligibility-settings > legend {
  color: #7df0be;
}

.leaderboard-eligibility-status {
  margin: 1px 0 0;
  color: #9cf3ce;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.55px;
  line-height: 1.45;
}

.leaderboard-eligibility-defaults {
  margin: 5px 0 10px;
}

.cheats-toggle-option {
  display: grid;
  min-height: 44px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: bold;
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
}

.cheats-toggle-option input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: #ff963f;
  cursor: pointer;
}

.cheats-toggle-option > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cheats-controls {
  min-width: 0;
  margin-top: 12px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 166, 72, 0.34);
}

.cheats-controls[hidden] {
  display: none;
}

.cheats-controls [data-cheat-control]:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.powerup-mix-settings {
  min-width: 0;
  margin: 14px 0;
  padding: 10px 11px 12px;
  background: rgba(62, 48, 112, 0.24);
  border: 1px solid rgba(177, 139, 255, 0.62);
  border-radius: 8px;
}

.powerup-mix-legend {
  margin: 0 0 5px;
  color: #d9c5ff;
  font-size: 11px;
  font-weight: bold;
}

.powerup-mix-toggle {
  display: grid;
  min-height: 44px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: bold;
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
}

.powerup-mix-toggle input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: #b18bff;
}

.powerup-mix-controls {
  min-width: 0;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(177, 139, 255, 0.36);
}

.powerup-mix-controls[hidden] {
  display: none;
}

.powerup-mix-status,
.custom-setup-code-status {
  margin: 0 0 9px;
  color: #cbb5ff;
  font-size: 10px;
  line-height: 1.45;
}

.powerup-mix-list {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.powerup-mix-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(90px, 0.9fr) minmax(100px, 1.35fr) 74px 52px;
  align-items: center;
  gap: 8px;
}

.powerup-mix-label {
  min-width: 0;
  margin: 0;
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.powerup-mix-range {
  min-width: 0;
  width: 100%;
  margin: 0;
}

.powerup-mix-number {
  width: 100%;
  min-height: 44px;
  min-width: 0;
  margin: 0;
  padding-block: 8px;
  touch-action: manipulation;
}

.powerup-mix-value {
  min-width: 0;
  color: #d9c5ff;
  font-size: 9px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.custom-setup-code-tools {
  min-width: 0;
  margin-top: 10px;
}

.custom-setup-code-tools > summary {
  min-height: 44px;
  padding: 13px 10px;
  color: var(--text);
  background: #322d28;
  border: 1px solid #4a443e;
  border-radius: 8px;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.7px;
  line-height: 1.35;
  list-style-position: inside;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}

.custom-setup-code-tools > summary::marker {
  color: var(--accent);
}

.custom-setup-code-tools[open] > summary {
  margin-bottom: 8px;
  border-color: var(--accent);
}

.custom-setup-code-body {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 2px;
}

.custom-setup-code-body label {
  margin: 2px 0 0;
}

.custom-setup-code-body textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  resize: vertical;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  line-height: 1.4;
}

.custom-setup-code-body button {
  width: 100%;
  min-height: 44px;
  white-space: normal;
}

.custom-setup-code-body [data-stale="true"],
.custom-setup-code-tools[data-stale="true"] .custom-setup-code-status {
  color: #ffbd72;
  border-color: rgba(255, 166, 72, 0.72);
}

@media (max-width: 580px) {
  .powerup-mix-row {
    grid-template-columns: minmax(0, 1fr) 72px 50px;
  }

  .powerup-mix-label {
    grid-column: 1 / -1;
  }
}

.leaderboard-eligibility-settings[data-leaderboard-eligible="false"] {
  background: rgba(114, 58, 15, 0.22);
  border-color: rgba(255, 166, 72, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 166, 72, 0.11),
    0 0 18px rgba(255, 118, 45, 0.06);
}

.leaderboard-eligibility-settings[data-leaderboard-eligible="false"] > legend,
.leaderboard-eligibility-settings[data-leaderboard-eligible="false"]
  .leaderboard-eligibility-status {
  color: #ffad61;
}

.new-match-controls.campaign-mode [data-custom-match-setting] {
  opacity: 0.46;
  cursor: not-allowed;
}

.round-difficulty-ramp-settings {
  margin: 16px 0 12px;
  padding: 10px 11px 12px;
  background: rgba(74, 68, 62, 0.2);
  border-color: rgba(255, 179, 92, 0.55);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.round-difficulty-ramp-settings > legend {
  color: #c5b7a1;
}

.round-difficulty-ramp-settings .match-ramp-option:first-of-type {
  margin-top: 2px;
}

.round-difficulty-ramp-settings .match-ramp-hint:last-child {
  margin-bottom: 0;
}

.match-ramp-option {
  display: grid;
  min-height: 44px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 4px;
  color: var(--text);
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
}

.match-ramp-option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.match-ramp-option > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.match-ramp-hint {
  margin: -4px 0 2px 31px;
}

.leaderboard-time-filter {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid rgba(107, 97, 88, 0.52);
  border-radius: 9px;
  background: rgba(28, 24, 19, 0.68);
}

.leaderboard-time-filter > label,
.leaderboard-custom-range label {
  margin: 0;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.leaderboard-time-filter select,
.leaderboard-custom-range input,
.leaderboard-custom-range button {
  min-height: 44px;
}

.leaderboard-custom-range input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  color: var(--text);
  color-scheme: dark;
  background: #12100d;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
}

.leaderboard-custom-range {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.leaderboard-custom-range[hidden] {
  display: none;
}

.leaderboard-custom-range label {
  display: grid;
  gap: 4px;
}

.leaderboard-custom-range button {
  padding-inline: 14px;
  color: var(--led-ink);
  background: var(--led-btn);
  box-shadow: 0 3px 0 var(--led-edge), inset 0 1px 1px rgba(255, 255, 255, 0.5), inset 0 -3px 5px rgba(140, 60, 0, 0.4);
}

.leaderboard-range-status,
.leaderboard-coverage-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.45;
}

.leaderboard-coverage-note:empty {
  display: none;
}

.leaderboard-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.leaderboard-tabs button {
  min-height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  background: var(--well);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.7);
}

.leaderboard-tabs button[aria-selected="true"] {
  color: var(--led-ink);
  border-color: transparent;
  background: var(--led);
  box-shadow: 0 0 14px rgba(255, 140, 38, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.leaderboard-panel[hidden] {
  display: none;
}

/* Controls tablist. Four input schemes, each with a decorative scheme icon
   above its name so the strip stays readable when the label wraps. */
.control-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.control-tabs button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 6px 4px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  color: var(--dim);
  background: var(--well);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.7);
  line-height: 1.1;
}

.control-tabs button[aria-selected="true"] {
  color: var(--led-ink);
  border-color: transparent;
  background: var(--led);
  box-shadow: 0 0 14px rgba(255, 140, 38, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.control-tab-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  fill: none;
  overflow: visible;
  pointer-events: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

/* Icons track the tab's text color: dark LED ink when selected, dim otherwise. */
.control-tab-icon .setup-icon-primary {
  stroke: currentColor;
}

.control-tab-icon .setup-icon-secondary {
  stroke: currentColor;
  opacity: 0.7;
}

/* A tab that is not selected dims its icon with the label, so the selected
   scheme reads as the only active one. */
.control-tabs button:not([aria-selected="true"]) .control-tab-icon .setup-icon-primary,
.control-tabs button:not([aria-selected="true"]) .control-tab-icon .setup-icon-secondary {
  stroke: currentColor;
}

.control-panel[hidden] {
  display: none;
}

.leaderboard-record-note {
  margin: -2px 0 9px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.45;
}

.leaderboard-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-radius: 7px;
}

.leaderboard-table-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#leaderboard {
  min-width: 980px;
}

#leaderboard th,
#leaderboard td {
  overflow-wrap: normal;
  white-space: nowrap;
}

.campaign-grade-summary {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: #e4d8c4;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.campaign-grade-count {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.campaign-grade-count strong {
  color: #9a8d7d;
  font-size: 8px;
}

.campaign-grade-count.cleared strong { color: #54ffa1; }
.campaign-grade-count.dominated strong { color: #ff8c26; }

.campaign-grade-summary-unavailable,
.campaign-grade-summary-empty {
  color: var(--dim);
  white-space: normal;
}

.leaderboard-panel time {
  white-space: nowrap;
}

.campaign-leaderboard-heading-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.campaign-leaderboard-heading-row h2 {
  margin: 0;
}

#expeditionLeaderboard {
  min-width: 690px;
}

#rivalLeaderboard {
  min-width: 760px;
}

#heistLeaderboard {
  min-width: 690px;
}

@media (max-width: 560px) {
  .leaderboard-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leaderboard-tabs button {
    min-height: 40px;
    padding-inline: 5px;
    font-size: 9px;
  }

  .campaign-leaderboard-heading-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.leaderboard-sort-button {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 5px 4px 5px 8px;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  touch-action: manipulation;
}

.leaderboard-sort-button:hover,
.leaderboard-sort-button:focus-visible {
  color: var(--text);
  border-color: rgba(255, 179, 92, 0.54);
  background: rgba(255, 140, 38, 0.08);
}

th[aria-sort="descending"] .leaderboard-sort-button {
  color: var(--accent);
}

th[aria-sort="descending"] .leaderboard-sort-button::after {
  content: "▼";
  font-size: 8px;
}

#saveName {
  margin-top: 6px;
  padding: 8px 14px;
  color: var(--text);
  background: var(--plastic-btn);
  box-shadow: 0 3px 0 var(--well), inset 0 1px 1px rgba(255, 255, 255, 0.22), inset 0 -3px 5px rgba(0, 0, 0, 0.45);
}

fieldset {
  min-width: 0;
  margin: 18px 0 0;
  padding: 10px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

#newMatchSettings {
  margin-top: 10px;
  padding: 0;
}

legend {
  padding: 0 7px;
  color: var(--dim);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.match-browser-status {
  min-height: 32px;
  padding: 0 2px 7px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.4;
}

.join-match-section[hidden] {
  display: none;
}

.match-list {
  display: grid;
  max-height: 176px;
  gap: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.join-match-section h2 {
  margin-top: 7px;
}

.join-match-section > .hint {
  margin-top: 5px;
  font-size: 10px;
}

.match-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 7px 9px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  color: var(--text);
  background: #221e1a;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.match-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 140, 38, 0.28);
}

.match-card.full {
  cursor: not-allowed;
  opacity: 0.68;
}

.match-card input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.match-card-copy {
  min-width: 0;
}

.match-card-title {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: bold;
  overflow-wrap: anywhere;
}

.match-card-meta {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.match-card-state {
  padding: 3px 6px;
  color: #8fffb0;
  background: rgba(58, 190, 100, 0.12);
  border: 1px solid rgba(105, 255, 148, 0.35);
  border-radius: 999px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.match-card.full .match-card-state {
  color: #ff9ca5;
  background: rgba(255, 90, 105, 0.1);
  border-color: rgba(255, 108, 120, 0.34);
}

.tutorial-card {
  position: fixed;
  top: calc(var(--safe-top) + 102px);
  left: calc(var(--safe-left) + 12px);
  z-index: 8;
  width: min(360px, calc(100vw - var(--safe-left) - var(--safe-right) - 24px));
  padding: 12px 14px 14px;
  color: var(--text);
  background: rgba(16, 13, 10, 0.94);
  border: 1px solid rgba(255, 140, 38, 0.68);
  border-radius: 12px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.tutorial-card[hidden],
.tutorial-complete-actions[hidden] {
  display: none !important;
}

.powerup-discovery-banner {
  position: fixed;
  top: calc(var(--safe-top) + 98px);
  left: 50%;
  z-index: 18;
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: center;
  gap: 3px 12px;
  width: min(430px, calc(100vw - var(--safe-left) - var(--safe-right) - 28px));
  padding: 10px 14px 11px;
  transform: translate(-50%, -8px) scale(0.98);
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 140, 38, 0.22), transparent 48%),
    rgba(21, 18, 14, 0.96);
  border: 1px solid rgba(255, 140, 38, 0.82);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 9px 32px rgba(0, 0, 0, 0.48),
    0 0 24px rgba(255, 140, 38, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease-out, transform 180ms ease-out;
}

.powerup-discovery-banner[hidden] {
  display: none !important;
}

.powerup-discovery-banner.is-visible {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

.powerup-discovery-title {
  grid-column: 1;
  color: var(--accent);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1.1px;
  line-height: 1.2;
  text-transform: uppercase;
}

.powerup-discovery-label {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  letter-spacing: 0.35px;
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.powerup-discovery-progress {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  min-width: 78px;
  padding: 6px 8px;
  color: #ffcf9e;
  background: rgba(255, 140, 38, 0.1);
  border: 1px solid rgba(255, 140, 38, 0.44);
  border-radius: 999px;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.55px;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.powerup-discovery-banner.is-complete {
  background:
    radial-gradient(circle at 18% 0%, rgba(104, 230, 255, 0.24), transparent 50%),
    rgba(21, 18, 14, 0.97);
  border-color: rgba(127, 208, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 9px 32px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(69, 184, 255, 0.24);
}

.powerup-discovery-banner.is-complete .powerup-discovery-title,
.powerup-discovery-banner.is-complete .powerup-discovery-progress {
  color: #cfe9ff;
  border-color: rgba(127, 208, 255, 0.52);
  background: rgba(69, 184, 255, 0.1);
}

.cursed-courier-warning {
  position: fixed;
  top: calc(var(--safe-top) + 76px);
  left: 50%;
  z-index: 17;
  display: flex;
  width: max-content;
  max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 24px);
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 7px 12px;
  transform: translateX(-50%);
  pointer-events: none;
  color: #f4e9ff;
  background: rgba(24, 8, 43, 0.94);
  border: 1px solid rgba(197, 122, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.48), 0 0 18px rgba(181, 93, 255, 0.24);
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease-out, visibility 120ms ease-out;
}

.cursed-courier-warning[hidden] { display: none !important; }

.cursed-courier-warning.is-visible {
  opacity: 1;
  visibility: visible;
}

.powerup-discovery-banner.is-visible ~ .cursed-courier-warning {
  top: calc(var(--safe-top) + 156px);
}

.cursed-courier-warning.is-shielded,
.cursed-courier-warning[data-cursed-courier-state="shielded"] {
  color: #ddfff0;
  background: rgba(5, 35, 30, 0.94);
  border-color: rgba(84, 255, 161, 0.92);
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.48), 0 0 18px rgba(84, 255, 161, 0.2);
}

.cursed-courier-warning-arrow {
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  transform: rotate(var(--cursed-courier-angle, 0rad));
  transform-origin: 50% 50%;
  place-items: center;
  color: #d58cff;
  font-size: 20px;
  line-height: 1;
  text-shadow: 0 0 9px rgba(207, 125, 255, 0.9);
  transition: transform 90ms linear;
}

.cursed-courier-warning.is-shielded .cursed-courier-warning-arrow,
.cursed-courier-warning[data-cursed-courier-state="shielded"] .cursed-courier-warning-arrow {
  color: #73ffb3;
  text-shadow: 0 0 9px rgba(84, 255, 161, 0.82);
}

.cursed-courier-warning-label {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tutorial-card-topline {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.tutorial-card progress {
  width: 100%;
  height: 7px;
  accent-color: var(--accent);
}

.tutorial-card-main {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  margin-top: 9px;
}

.tutorial-card-copy {
  min-width: 0;
}

.tutorial-illustration {
  display: block;
  width: 112px;
  height: 72px;
  overflow: hidden;
  color: #f3e9d8;
  background:
    radial-gradient(circle at 28% 35%, rgba(255, 220, 180, 0.25), transparent 42%),
    rgba(8, 7, 5, 0.82);
  border: 1px solid rgba(127, 208, 255, 0.24);
  border-radius: 9px;
  box-shadow: inset 0 0 18px rgba(69, 184, 255, 0.06);
}

.tutorial-illustration :where(path, circle, ellipse, rect) {
  vector-effect: non-scaling-stroke;
}

.tutorial-illustration .ti-backdrop {
  fill: rgba(243, 233, 216, 0.62);
}

.tutorial-illustration .ti-yellow { --ti-tone: #ffd233; }
.tutorial-illustration .ti-cyan { --ti-tone: #35d6ff; }
.tutorial-illustration .ti-alert { --ti-tone: #ff7b88; }
.tutorial-illustration .ti-super { --ti-tone: #eaf8ff; }

.tutorial-illustration .ti-ship-hull {
  fill: #e4d8c4;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.tutorial-illustration .ti-ship-wing {
  fill: #7a6e60;
  stroke: #d1c4ae;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.tutorial-illustration .ti-cockpit {
  fill: #322d28;
  stroke: #7fd0ff;
  stroke-width: 1.5;
}

.tutorial-illustration .ti-flame {
  fill: #ffb22e;
  stroke: #ffcf9e;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.tutorial-illustration .ti-ghost { opacity: 0.46; }

.tutorial-illustration .ti-shield,
.tutorial-illustration .ti-reticle {
  fill: var(--ti-tone, #ffd233);
  fill-opacity: 0.13;
  stroke: var(--ti-tone, #ffd233);
  stroke-width: 4;
}

.tutorial-illustration .ti-asteroid {
  fill: var(--ti-tone, #ffd233);
  stroke: var(--ti-tone, #ffd233);
  stroke-width: 2.3;
  stroke-linejoin: round;
}

.tutorial-illustration .ti-crater {
  fill: #12100d;
  fill-opacity: 0.42;
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 1.2;
}

.tutorial-illustration :where(.ti-arrow, .ti-motion, .ti-wrap, .ti-approach,
  .ti-deflect, .ti-recharge-mark, .ti-drain, .ti-drain-line, .ti-fragment-path,
  .ti-shot-trail, .ti-shield-ray, .ti-crack, .ti-burst, .ti-mine, .ti-check,
  .ti-celebration) {
  fill: none;
  stroke: var(--ti-tone, #7fd0ff);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutorial-illustration .ti-arrowhead {
  fill: var(--ti-tone, #7fd0ff);
  stroke: none;
}

.tutorial-illustration .ti-motion,
.tutorial-illustration .ti-approach,
.tutorial-illustration .ti-deflect,
.tutorial-illustration .ti-recharge-mark {
  stroke-dasharray: 7 6;
}

.tutorial-illustration .ti-arena-edge {
  fill: none;
  stroke: rgba(243, 233, 216, 0.54);
  stroke-width: 2;
  stroke-dasharray: 4 5;
}

.tutorial-illustration .ti-aim {
  fill: none;
  stroke: rgba(255, 140, 38, 0.75);
  stroke-width: 2;
  stroke-dasharray: 3 6;
}

.tutorial-illustration .ti-mine circle {
  fill: var(--ti-tone, #ffd233);
  fill-opacity: 0.62;
  stroke: var(--ti-tone, #ffd233);
  stroke-width: 2.5;
}

.tutorial-illustration .ti-gauge-shell {
  fill: rgba(8, 7, 5, 0.9);
  stroke: rgba(243, 233, 216, 0.72);
  stroke-width: 2;
}

.tutorial-illustration .ti-gauge-fill {
  fill: var(--ti-tone, #ffd233);
  stroke: none;
}

.tutorial-illustration .ti-shot {
  fill: var(--ti-tone, #ffd233);
  stroke: #ffdcb8;
  stroke-width: 2;
}

.tutorial-illustration .ti-super-pickup circle {
  fill: rgba(243, 233, 216, 0.16);
  stroke: #eaf8ff;
  stroke-width: 3;
}

.tutorial-illustration .ti-super-pickup path {
  fill: rgba(243, 233, 216, 0.3);
  stroke: #eaf8ff;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.tutorial-illustration .ti-check {
  stroke: #64f39a;
  stroke-width: 4;
}

.tutorial-card h2 {
  margin: 0 0 5px;
  padding: 0;
  color: #fff;
  border: 0;
  font-size: 16px;
  letter-spacing: 0.5px;
  text-transform: none;
}

.tutorial-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.round-elimination-choice {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9;
  width: min(430px, calc(100vw - var(--safe-left) - var(--safe-right) - 24px));
  padding: 18px;
  transform: translate(-50%, -50%);
  color: var(--text);
  background: rgba(16, 13, 10, 0.97);
  border: 1px solid rgba(255, 140, 38, 0.78);
  border-radius: 14px;
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.62);
  text-align: center;
}

.round-elimination-choice[hidden] {
  display: none;
}

.round-elimination-choice h2 {
  margin: 0 0 9px;
  color: var(--accent);
  border: 0;
}

.round-elimination-choice p {
  margin: 0 0 16px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

.round-elimination-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.round-elimination-actions button {
  min-height: 48px;
}

.tutorial-control-hint {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.input-guidance {
  display: block;
  margin-top: 6px;
  color: #c9bba6;
}

.input-guidance[hidden] {
  display: none !important;
}

.tutorial-complete-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  margin-top: 11px;
  pointer-events: auto;
}

.tutorial-complete-actions button {
  min-height: 44px;
  padding: 8px;
  color: var(--led-ink);
  background: var(--led-btn);
  box-shadow: 0 4px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -4px 6px rgba(140, 60, 0, 0.4);
  font-size: 10px;
  line-height: 1.25;
}

#tutorialReturn {
  color: var(--text);
  background: var(--plastic-btn);
  box-shadow: 0 4px 0 var(--well), inset 0 2px 1px rgba(255, 255, 255, 0.25), inset 0 -4px 6px rgba(0, 0, 0, 0.45);
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

th, td {
  padding: 4px 6px;
  overflow-wrap: anywhere;
  border-bottom: 1px solid #2a2621;
  text-align: left;
}

th {
  color: var(--dim);
  font-size: 10px;
  font-weight: normal;
  text-transform: uppercase;
}

th:first-child, td:first-child { width: 28px; }
td.num, th.num { text-align: right; }

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 14px;
  font-size: 12px;
}

.stats-grid .v {
  color: var(--gold);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stats-grid .stats-group-title {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .09em;
}

.stats-grid .stats-group-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.stats-grid .stats-empty {
  grid-column: 1 / -1;
  color: var(--dim);
}

/* Live Challenges use one shared DOM presenter in both renderers. The badge
   system is intentionally procedural/two-color: no gameplay art or model
   dependency can make the private stats panel fail to render. */
.official-challenge-slot,
.player-stats-content {
  display: contents;
}

.official-challenge-panel {
  --challenge-a: #ffb23f;
  --challenge-b: #ff5c58;
  grid-column: 1 / -1;
  position: relative;
  min-width: 0;
  margin: 0 0 10px;
  padding: 13px;
  overflow: hidden;
  background:
    linear-gradient(140deg, color-mix(in srgb, var(--challenge-a) 17%, transparent),
      transparent 48%),
    rgba(18, 15, 12, 0.88);
  border: 1px solid color-mix(in srgb, var(--challenge-b) 64%, #ffffff 10%);
  border-radius: 11px;
  box-shadow: inset 0 0 26px color-mix(in srgb, var(--challenge-a) 8%, transparent);
}

.official-challenge-theme-ember {
  --challenge-a: #ffcb45;
  --challenge-b: #ff574d;
}

.official-challenge-theme-ion {
  --challenge-a: #58efff;
  --challenge-b: #6e7dff;
}

.official-challenge-theme-aegis {
  --challenge-a: #73ffac;
  --challenge-b: #a25cff;
}

.official-challenge-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.official-challenge-glyph {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: var(--led-ink);
  background: linear-gradient(135deg, var(--challenge-a), var(--challenge-b));
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 10px;
  box-shadow: 0 0 16px color-mix(in srgb, var(--challenge-a) 44%, transparent);
  font-size: 22px;
}

.official-challenge-heading-copy {
  min-width: 0;
}

.official-challenge-kicker,
.official-challenge-title,
.official-challenge-description,
.official-challenge-time,
.official-challenge-reward,
.official-challenge-eligibility,
.official-challenge-opt-in-rule,
.official-challenge-state,
.official-challenge-action-status,
.official-challenge-badges-title,
.official-challenge-badges-empty {
  margin: 0;
}

.official-challenge-kicker {
  color: var(--challenge-a);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .15em;
}

.official-challenge-title {
  margin-top: 2px;
  color: #f8f1e4;
  font-size: 15px;
  line-height: 1.15;
}

.official-challenge-description {
  margin-top: 9px;
  color: #c5b7a1;
  font-size: 10px;
  line-height: 1.45;
}

.official-challenge-goal {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  color: #e4d8c4;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.official-challenge-progress-copy {
  color: var(--challenge-a);
  font-variant-numeric: tabular-nums;
}

.official-challenge-progress {
  width: 100%;
  height: 11px;
  margin: 6px 0 0;
  overflow: hidden;
  accent-color: var(--challenge-a);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.official-challenge-progress::-webkit-progress-bar {
  background: rgba(0, 0, 0, 0.42);
}

.official-challenge-progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--challenge-a), var(--challenge-b));
}

.official-challenge-progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--challenge-a), var(--challenge-b));
}

.official-challenge-reward,
.official-challenge-time,
.official-challenge-eligibility,
.official-challenge-opt-in-rule,
.official-challenge-action-status,
.official-challenge-badges-empty {
  margin-top: 7px;
  color: var(--label);
  font-size: 8px;
  line-height: 1.4;
}

.official-challenge-reward {
  color: #e4d8c4;
  font-weight: bold;
  letter-spacing: .05em;
}

.official-challenge-reward-glyph {
  color: var(--challenge-a);
}

.official-challenge-state {
  margin-top: 9px;
  color: var(--challenge-a);
  font-size: 9px;
  font-weight: bold;
  letter-spacing: .08em;
}

.official-challenge-opt-in {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 8px 11px;
  color: var(--led-ink);
  background: linear-gradient(110deg, var(--challenge-a), var(--challenge-b));
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
}

.official-challenge-opt-in:focus-visible {
  outline: 3px solid #7fd0ff;
  outline-offset: 2px;
}

.official-challenge-opt-in:disabled {
  cursor: wait;
  filter: saturate(.45);
  opacity: .68;
}

.official-challenge-badges {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--challenge-a) 22%, var(--line));
}

.official-challenge-badges-title {
  color: #ada08b;
  font-size: 8px;
  letter-spacing: .1em;
}

.official-challenge-badge-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.official-challenge-badge {
  min-width: 0;
  padding: 7px 5px;
  background: color-mix(in srgb, var(--challenge-a) 8%, rgba(12, 10, 8, .9));
  border: 1px solid color-mix(in srgb, var(--challenge-b) 48%, var(--line));
  border-radius: 8px;
}

.official-challenge-badge-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 6px;
  align-items: center;
}

.official-challenge-badge-glyph {
  grid-row: 1 / span 2;
  color: var(--challenge-a);
  font-size: 19px;
  text-shadow: 0 0 9px color-mix(in srgb, var(--challenge-a) 50%, transparent);
}

.official-challenge-badge-label,
.official-challenge-badge-stars {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 7px;
  font-weight: bold;
  line-height: 1.2;
}

.official-challenge-badge-stars {
  color: var(--challenge-a);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .official-challenge-badge-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .official-challenge-panel[data-state="completed"] .official-challenge-glyph,
  .official-challenge-badge-glyph {
    animation: official-challenge-shimmer 2.8s ease-in-out infinite;
  }
}

@keyframes official-challenge-shimmer {
  0%, 100% { filter: brightness(.92); }
  50% { filter: brightness(1.24); }
}

.stats-grid .match-history-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.match-history-order {
  color: #897d6c;
  font-size: 8px;
  font-weight: normal;
  letter-spacing: .07em;
  text-align: right;
}

.match-history-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.match-history-card {
  min-width: 0;
  overflow: hidden;
  background: rgba(14, 12, 9, 0.68);
  border: 1px solid #423c36;
  border-radius: 8px;
}

.match-history-card[open] {
  background:
    linear-gradient(140deg, rgba(255, 220, 180, 0.12), transparent 46%),
    rgba(14, 12, 9, 0.82);
  border-color: #57504a;
}

.match-history-card summary {
  min-width: 0;
  padding: 8px 9px;
  cursor: pointer;
  color: #e4d8c4;
  font-size: 10px;
  line-height: 1.35;
  user-select: none;
}

.match-history-card summary::marker {
  color: var(--accent);
}

.match-history-card summary:focus-visible {
  outline: 2px solid rgba(255, 140, 38, 0.72);
  outline-offset: -2px;
}

.match-history-card summary::after {
  display: block;
  clear: both;
  content: '';
}

.match-history-mode {
  margin-right: 6px;
  color: #ada08b;
  font-weight: bold;
  letter-spacing: .06em;
}

.match-history-result {
  padding: 2px 5px;
  color: #9a8d7d;
  background: rgba(122, 112, 100, 0.12);
  border: 1px solid rgba(122, 112, 100, 0.28);
  border-radius: 999px;
  font-size: 8px;
  font-weight: bold;
  letter-spacing: .06em;
}

.match-history-result.won {
  color: #a9f4c4;
  background: rgba(75, 211, 126, 0.1);
  border-color: rgba(75, 211, 126, 0.38);
}

.match-history-score {
  float: right;
  margin-left: 8px;
  color: var(--gold);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.match-history-card time {
  display: block;
  margin: 3px 0 0 17px;
  color: var(--label);
  font-size: 9px;
}

.match-history-body {
  padding: 0 9px 9px;
  border-top: 1px solid rgba(66, 60, 54, 0.64);
}

.match-history-grade {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px;
  color: var(--label);
  background: rgba(47, 41, 33, 0.72);
  border-radius: 5px;
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.match-history-grade > strong {
  color: #f5ecdc;
  font-size: 9px;
  letter-spacing: normal;
  text-transform: none;
}

.match-history-grade-status {
  grid-template-columns: minmax(0, 1fr);
}

.match-history-grade > .match-history-grade-badge {
  padding: 2px 6px;
  color: var(--match-grade-color);
  background: var(--match-grade-fill);
  border: 1px solid var(--match-grade-color);
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.match-history-grade-description {
  min-width: 0;
  color: #ada08b;
  font-size: 9px;
  letter-spacing: normal;
  line-height: 1.35;
  text-transform: none;
}

.match-history-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 8px 0;
}

.match-history-facts > div {
  min-width: 0;
  padding: 5px 6px;
  background: rgba(47, 41, 33, 0.72);
  border-radius: 5px;
}

.match-history-facts span,
.match-history-facts strong {
  display: block;
  overflow-wrap: anywhere;
}

.match-history-facts span {
  color: var(--label);
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.match-history-facts strong {
  margin-top: 2px;
  color: #f5ecdc;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.match-history-breakdown {
  padding-top: 7px;
  border-top: 1px solid rgba(66, 60, 54, 0.64);
}

.match-history-breakdown-title,
.match-history-overlap-title {
  color: var(--label);
  font-size: 8px;
  font-weight: bold;
  letter-spacing: .08em;
}

.match-history-breakdown dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  margin: 5px 0 0;
  font-size: 9px;
}

.match-history-breakdown dt,
.match-history-breakdown dd {
  min-width: 0;
  margin: 0;
  padding: 3px 5px;
  border-bottom: 1px solid rgba(59, 54, 49, 0.58);
}

.match-history-breakdown dt {
  color: #ada08b;
  overflow-wrap: anywhere;
}

.match-history-breakdown dd {
  color: #f5ecdc;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.match-history-total {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
  padding: 5px 6px;
  color: #dfd2bd;
  background: rgba(255, 140, 38, 0.08);
  border: 1px solid rgba(255, 140, 38, 0.22);
  border-radius: 5px;
  font-size: 9px;
  text-transform: uppercase;
}

.match-history-total strong {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.match-history-overlap-title {
  margin-top: 8px;
  color: #897d6e;
}

.match-history-overlaps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
}

.match-history-overlaps > div {
  min-width: 0;
  padding: 5px 6px;
  background: rgba(32, 28, 23, 0.82);
  border-radius: 5px;
}

.match-history-overlaps span,
.match-history-overlaps strong {
  display: block;
  overflow-wrap: anywhere;
}

.match-history-overlaps span {
  color: var(--label);
  font-size: 8px;
}

.match-history-overlaps strong {
  margin-top: 2px;
  color: #b8aa94;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.match-history-overlaps small {
  color: var(--label);
  font-size: 8px;
  font-weight: normal;
}

.match-history-unavailable {
  margin: 7px 0 0;
  color: #897d6c;
  font-size: 9px;
  line-height: 1.4;
}

/* Achievement badge grid — mounted under the RECORDS stats group. */
.achievement-panel {
  grid-column: 1 / -1;
}

.achievement-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .09em;
}

.achievement-count {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.achievement-grid {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.achievement-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
}

.achievement-cell-body {
  display: contents;
}

.achievement-icon {
  width: 40px;
  height: 40px;
  max-width: 100%;
  object-fit: contain;
}

.achievement-label {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.achievement-earned .achievement-label {
  color: var(--gold);
}

.achievement-locked {
  opacity: .85;
}

.achievement-locked .achievement-icon {
  filter: grayscale(1) brightness(.4);
  opacity: .55;
}

.achievement-locked .achievement-label {
  color: var(--dim);
}

.achievement-blurb {
  color: var(--dim);
  font-size: 10px;
  line-height: 1.35;
}

.keys {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.9;
}

.key-cap {
  display: inline-block;
  padding: 1px 7px;
  color: var(--text);
  background: var(--plastic-btn);
  border: 1px solid var(--well);
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--well), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-family: inherit;
  font-weight: bold;
  line-height: 1.45;
  text-align: center;
}

.key-bindings {
  margin-top: 14px;
}

.gamepad-bindings {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(110, 100, 90, 0.34);
}

.gamepad-connection-status {
  margin: 2px 0 7px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.4;
}

.gamepad-connection-status[data-gamepad-connected="true"] {
  color: #7fffc2;
}

.key-bindings .hint {
  margin-top: 0;
}

.key-binding-list {
  display: grid;
  min-width: 0;
  margin: 10px 0;
  padding: 0;
  gap: 7px;
  list-style: none;
}

.key-binding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  padding: 7px;
  gap: 8px;
  background: #201c18;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.key-binding-action {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
}

.control-action-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  order: -1;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: radial-gradient(circle at 36% 28%, #453f38, #26221e 72%);
  border: 1px solid #524b44;
  border-radius: 10px;
  box-shadow: inset 0 0 12px rgba(255, 220, 180, 0.12);
}

.control-action-svg,
.control-action-image {
  display: block;
  width: 78%;
  height: 78%;
  pointer-events: none;
}

.control-action-image {
  object-fit: contain;
}

.control-action-svg {
  overflow: visible;
}

.control-action-svg .control-icon-primary {
  fill: currentColor;
  stroke: rgba(255, 255, 255, 0.84);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.control-action-svg .control-icon-accent,
.control-action-svg .control-icon-detail {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-action-svg .control-icon-detail {
  stroke: rgba(223, 205, 180, 0.74);
  stroke-width: 2.4;
}

.control-action-authored {
  filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.72));
}

.control-action-rotate {
  width: 74%;
  height: 74%;
}

.control-action-thrust,
.control-action-tractor {
  width: 80%;
  height: 80%;
}

.control-action-bomb {
  width: 84%;
  height: 84%;
}

.control-action-image-flipped {
  transform: scaleX(-1);
}

.key-binding-row-shield {
  background: linear-gradient(90deg, var(--key-binding-color-soft), #201c18 62%);
  border-color: var(--key-binding-color);
  box-shadow: inset 3px 0 var(--key-binding-color), 0 0 12px var(--key-binding-color-faint);
}

.key-binding-row-shield-yellow {
  --key-binding-color: #ffd233;
  --key-binding-color-soft: rgba(255, 210, 51, 0.17);
  --key-binding-color-faint: rgba(255, 210, 51, 0.09);
}

.key-binding-row-shield-cyan {
  --key-binding-color: #35d6ff;
  --key-binding-color-soft: rgba(53, 214, 255, 0.17);
  --key-binding-color-faint: rgba(53, 214, 255, 0.09);
}

.key-binding-row-shield-green {
  --key-binding-color: #4dee6a;
  --key-binding-color-soft: rgba(77, 238, 106, 0.17);
  --key-binding-color-faint: rgba(77, 238, 106, 0.09);
}

.key-binding-row-shield-orange {
  --key-binding-color: #ff8c2e;
  --key-binding-color-soft: rgba(255, 140, 46, 0.17);
  --key-binding-color-faint: rgba(255, 140, 46, 0.09);
}

.key-binding-row-shield-pink {
  --key-binding-color: #ff5ad1;
  --key-binding-color-soft: rgba(255, 90, 209, 0.17);
  --key-binding-color-faint: rgba(255, 90, 209, 0.09);
}

.key-binding-row-shield .control-action-icon {
  color: var(--key-binding-color);
  background: var(--key-binding-color-soft);
  border-color: var(--key-binding-color);
  box-shadow: 0 0 12px var(--key-binding-color-faint);
}

.key-binding-row-shield .control-action-shield .control-icon-accent {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2;
}

.key-binding-row-shield .key-binding-assign:not([aria-pressed="true"]) {
  color: #2b1608;
  background: var(--key-binding-color);
  border-color: var(--key-binding-color);
  box-shadow: 0 0 10px var(--key-binding-color-faint);
}

.key-binding-actions {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto;
  min-width: 0;
  gap: 7px;
}

.gamepad-binding-actions,
.mouse-binding-actions {
  grid-template-columns: minmax(112px, 1fr) auto auto;
}

.key-binding-assign,
.key-binding-default,
.key-binding-reset-all {
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  color: var(--text);
  background: var(--plastic-btn);
  border: 1px solid transparent;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.22), inset 0 -3px 5px rgba(0, 0, 0, 0.4);
  line-height: 1.2;
  white-space: normal;
}

.gamepad-binding-clear {
  color: #ffd9e5;
  border-color: rgba(255, 110, 157, 0.42);
}

.key-binding-assign {
  color: var(--led-ink);
  background: var(--led-btn);
  border-color: transparent;
  box-shadow: 0 3px 0 var(--led-edge), inset 0 1px 1px rgba(255, 255, 255, 0.5), inset 0 -3px 5px rgba(140, 60, 0, 0.4);
  font-size: 14px;
}

.key-binding-assign[aria-pressed="true"] {
  color: #2b1608;
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 140, 38, 0.32), 0 0 16px rgba(255, 140, 38, 0.18);
  font-size: 11px;
}

.key-binding-default,
.key-binding-reset-all {
  padding-inline: 6px;
  font-size: 11px;
  white-space: nowrap;
}

.key-binding-assign:hover:not(:disabled),
.key-binding-default:hover:not(:disabled),
.key-binding-reset-all:hover:not(:disabled) {
  filter: brightness(1.12);
}

.key-binding-default:disabled,
.key-binding-reset-all:disabled {
  opacity: 0.48;
}

.key-binding-reset-all {
  width: 100%;
}

.key-binding-status {
  min-height: 1.4em;
  margin-top: 9px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.4;
}

.pickup-icon {
  display: inline-flex;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  align-items: center;
  justify-content: center;
}

.powerup-icon-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.powerup-codex-intro,
.powerup-codex-note {
  margin: 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

.pickup-codex-search {
  display: grid;
  min-width: 0;
  gap: 5px;
  margin: 10px 0 13px;
  padding: 10px;
  background: rgba(28, 24, 19, 0.72);
  border: 1px solid rgba(107, 97, 88, 0.52);
  border-radius: 9px;
}

.pickup-codex-search label {
  margin: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.pickup-codex-search input {
  min-height: 44px;
}

.pickup-codex-search input:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#pickupCodexSearchStatus,
.pickup-codex-empty {
  margin: 0;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.4;
}

.pickup-codex-section + .pickup-codex-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(107, 97, 88, 0.48);
}

.pickup-codex-section h2 {
  margin-top: 0;
}

.pickup-codex-section[hidden],
.powerup-codex-list li[hidden],
.pickup-codex-empty[hidden] {
  display: none;
}

.powerup-codex-list {
  display: grid;
  min-width: 0;
  margin: 10px 0;
  padding: 0;
  gap: 7px;
  list-style: none;
}

.powerup-codex-list li {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  min-width: 0;
  min-height: 62px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 3px;
  color: var(--dim);
  background: rgba(37, 32, 26, 0.5);
  border: 1px solid rgba(72, 65, 58, 0.38);
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.45;
}

.powerup-codex-list strong {
  color: var(--text);
}

.treasure-icon-canvas {
  display: block;
  width: 62px;
  height: 62px;
}

.match-pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 18px) calc(var(--safe-right) + 18px)
    calc(var(--safe-bottom) + 18px) calc(var(--safe-left) + 18px);
  pointer-events: none;
  background: rgba(5, 4, 3, 0.52);
  backdrop-filter: blur(2px);
}

.match-pause-overlay[hidden] {
  display: none;
}

.match-pause-card {
  width: min(440px, 100%);
  padding: 22px 24px;
  text-align: center;
  background: rgba(24, 20, 16, 0.94);
  border: 2px solid rgba(255, 140, 38, 0.82);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.72), 0 0 28px rgba(255, 140, 38, 0.12);
}

.match-pause-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  color: var(--led-ink);
  background: var(--led);
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 0 14px rgba(255, 140, 38, 0.4);
  font: 700 24px/1 var(--font-display);
  letter-spacing: -5px;
  padding-right: 5px;
}

.match-pause-card h2 {
  margin: 0 0 8px;
  color: var(--accent);
  border: 0;
  font-size: clamp(20px, 4vw, 28px);
  letter-spacing: 1.8px;
}

.match-pause-card p {
  margin: 0;
  color: #eee3d1;
  font-size: 13px;
  line-height: 1.55;
}

.match-exit-dialog {
  width: min(460px, calc(100vw - var(--safe-left) - var(--safe-right) - 28px));
  max-width: 100%;
  margin: auto;
  padding: 0;
  overflow: visible;
  color: var(--text);
  background: transparent;
  border: 0;
}

.match-exit-dialog::backdrop {
  background: rgba(5, 4, 3, 0.86);
  backdrop-filter: blur(5px);
}

.match-exit-dialog-card {
  padding: clamp(18px, 4vw, 26px);
  background: var(--panel-grad);
  border: 0;
  border-radius: 22px;
  box-shadow: inset 0 2px 1px rgba(255, 255, 255, 0.22), inset 0 -6px 10px rgba(0, 0, 0, 0.5), 0 28px 90px rgba(0, 0, 0, 0.72), 0 0 32px rgba(255, 140, 38, 0.1);
}

.match-exit-dialog h2 {
  margin: 0 0 10px;
  color: var(--accent);
  border: 0;
  font-size: clamp(17px, 4.5vw, 22px);
  letter-spacing: 1.4px;
}

.match-exit-dialog p {
  margin: 0;
  color: #c9bba6;
  font-size: 12px;
  line-height: 1.55;
}

.match-exit-dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.match-exit-dialog-actions button {
  min-width: 0;
  min-height: 48px;
  padding: 10px;
  overflow-wrap: anywhere;
  color: var(--led-ink);
  background: var(--led-btn);
  border: 0;
  box-shadow: 0 4px 0 var(--led-edge), inset 0 2px 1px rgba(255, 255, 255, 0.55), inset 0 -4px 6px rgba(140, 60, 0, 0.4);
  font-size: 10px;
  letter-spacing: 0.7px;
  touch-action: manipulation;
}

.match-exit-dialog-actions #matchExitConfirm {
  color: var(--text);
  background: #4a1930;
  border: 1px solid rgba(255, 118, 156, 0.66);
  box-shadow: 0 4px 0 #2a0d1b, inset 0 2px 1px rgba(255, 255, 255, 0.18), inset 0 -4px 6px rgba(0, 0, 0, 0.5);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: max(26px, var(--safe-bottom));
  z-index: 20;
  max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 24px);
  padding: 10px 18px;
  transform: translateX(-50%);
  overflow-wrap: anywhere;
  color: var(--text);
  background: var(--panel-flat);
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 10px 26px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

#toast.show { opacity: 1; }

.hint {
  margin-top: 8px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.4;
}

.tagline, .hint, label, .keys { overflow-wrap: anywhere; }

@media (max-width: 1400px) {
  .cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 620px) {
  .cursed-courier-warning {
    top: calc(var(--safe-top) + 72px);
    max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 16px);
    gap: 6px;
    padding: 6px 9px;
  }

  .cursed-courier-warning-label {
    font-size: 9px;
    letter-spacing: 0.055em;
  }

  .powerup-discovery-banner.is-visible ~ .cursed-courier-warning {
    top: calc(var(--safe-top) + 136px);
  }

  .powerup-discovery-banner {
    top: calc(var(--safe-top) + 74px);
    gap: 3px 8px;
    padding: 9px 11px 10px;
  }

  .powerup-discovery-progress {
    min-width: 66px;
    padding-inline: 6px;
    font-size: 9px;
  }
  #lobby {
    align-items: stretch;
  }

  .panel {
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 16px);
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
    margin: auto 0;
    padding: 16px;
  }

  .tagline { margin-bottom: 12px; }
  .cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .match-list { max-height: 144px; }
  table { font-size: 10px; }
  th, td { padding-inline: 3px; }
}

@media (max-width: 460px) {
  .key-binding-row { grid-template-columns: 1fr; }
  .key-binding-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .gamepad-binding-actions,
  .mouse-binding-actions { grid-template-columns: minmax(0, 1fr) auto auto; }

  .join-match-section > .hint {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .pilot-loadout-card {
    padding: 9px 10px 8px;
  }

  .pilot-name-row #saveName {
    padding-inline: 10px;
    font-size: 12px;
  }

  .ship-heading-row .ship-random-option {
    letter-spacing: -0.1px;
  }

  .random-fleet-preview {
    min-height: 52px;
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 7px;
    padding: 6px 7px;
  }

  .random-fleet-thumb {
    width: 34px;
    height: 29px;
    flex-basis: 34px;
    margin-left: -7px;
  }

  .random-fleet-copy strong { font-size: 10px; }
  .random-fleet-copy > span { font-size: 8px; }
  .random-fleet-action { display: none; }

  .ship-choice {
    flex-basis: 104px;
  }

  .stats-grid .match-history-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .match-history-order { text-align: left; }

  .match-history-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .match-history-grade-description {
    grid-column: 1 / -1;
  }

  .match-history-breakdown dl {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .match-history-overlaps {
    grid-template-columns: 1fr;
  }

  .arena-display-toggles {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 2px;
    padding: 2px;
  }

  .arena-top-controls {
    right: max(8px, calc(var(--safe-right) + 8px));
    align-items: flex-start;
    gap: 4px;
  }

  .arena-lobby-button {
    width: 64px;
    min-width: 64px;
    padding-inline: 4px;
  }

  .server-update-arena {
    padding: 9px 11px;
  }

  .server-update-arena p {
    font-size: 10px;
    line-height: 1.35;
  }

  .server-update-arena strong {
    font-size: 10px;
  }
}

@media (max-width: 360px) {
  .renderer-switch {
    display: flex;
    width: 100%;
  }

  .renderer-switch a {
    flex: 1 1 0;
    padding-inline: 6px;
    letter-spacing: 0.6px;
  }

  h2 { letter-spacing: 1.4px; }
  .stats-grid { gap-inline: 8px; }
  .match-actions { grid-template-columns: 1fr; }
  .round-elimination-actions { grid-template-columns: 1fr; }
  .match-mode-picker { grid-template-columns: 1fr; }
  .tutorial-complete-actions { grid-template-columns: 1fr; }
  .cheats-warning-dialog-actions { grid-template-columns: 1fr; }
  .tablet-setup-dialog-actions { grid-template-columns: 1fr; }
  .match-exit-dialog-actions { grid-template-columns: 1fr; }
  .leaderboard-custom-range { grid-template-columns: 1fr; }
  .key-binding-row { grid-template-columns: 1fr; }
  .key-binding-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .gamepad-binding-actions { grid-template-columns: minmax(0, 1fr) auto auto; }
}

@media (max-height: 560px) {
  .tutorial-card {
    max-width: 330px;
    padding-block: 9px 10px;
  }

  .tutorial-card-main {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px;
    margin-top: 6px;
  }

  .tutorial-illustration {
    width: 88px;
    height: 56px;
  }

  .tutorial-control-hint { margin-top: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  #toast,
  .powerup-discovery-banner,
  .cursed-courier-warning,
  .cursed-courier-warning-arrow { transition: none; }
  #lobby:not(.hidden) .panel,
  .setup-disclosure-body {
    animation: none;
  }

  #lobby.touch-layout-blocked .panel {
    filter: saturate(0.55);
  }
}

/* ---------- Invite codes, held seats, goal ladder, codex discovery ---------- */

.join-by-code {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.join-by-code label {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.join-by-code input {
  min-height: 44px;
  text-transform: uppercase;
}

.join-by-code input:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.join-by-code button {
  min-height: 44px;
  padding-inline: 14px;
}

.join-by-code-status {
  margin: 6px 0 0;
  color: var(--accent);
}

.join-by-code-status:empty {
  display: none;
}

.hold-seat-option {
  display: grid;
  min-height: 44px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  color: var(--text);
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
}

.hold-seat-option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.hold-seat-option > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* One next goal fills the collapsed HOW TO FLY slot for experienced pilots. */
.pilot-goal {
  margin: 8px 0 12px;
  padding: 9px 11px;
  color: var(--text);
  background: rgba(37, 32, 26, 0.5);
  border: 1px solid rgba(255, 140, 38, 0.38);
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.45;
}

.pilot-goal[hidden] {
  display: none;
}

/* Codex discovery: unfound treasures stay as dimmed silhouettes. */
.treasure-codex-discovery {
  margin: 0 0 4px;
  color: var(--dim);
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 0.4px;
}

.treasure-codex-discovery[hidden] {
  display: none;
}

.treasure-codex-group-heading .treasure-codex-discovery {
  margin-left: 8px;
}

.powerup-codex-list li.treasure-codex-undiscovered {
  color: var(--dim);
  border-style: dashed;
}

.powerup-codex-list li.powerup-codex-undiscovered {
  color: var(--dim);
  border-style: dashed;
}

.powerup-codex-unknown-icon {
  display: grid;
  place-items: center;
  color: rgba(201, 187, 166, 0.62);
  background: radial-gradient(circle, rgba(122, 112, 100, 0.3), rgba(37, 32, 26, 0.25));
  border: 2px dashed rgba(154, 141, 125, 0.5);
  border-radius: 50%;
  font-size: 26px;
  font-weight: bold;
}

.powerup-codex-unknown-icon::before { content: "?"; }

/* Actual server package version, placed below the start-page panel so it can
   identify a deployment without competing with any control or status. */
.lobby-version-stamp {
  box-sizing: border-box;
  width: min(2040px, calc(100% - 24px));
  margin: 7px auto max(8px, env(safe-area-inset-bottom));
  padding-right: 3px;
  color: var(--label);
  font: 700 9px/1.2 var(--font-display);
  letter-spacing: 0.12em;
  text-align: right;
  text-transform: uppercase;
  user-select: text;
}

/* The stamp doubles as the changelog link. An overlay enlarges its pointer
   target without disturbing layout — the lobby is a fixed, non-scrolling
   column whose panel already fills the viewport, so giving the stamp real
   height would push the panel on short screens. The overlay grows mostly
   upward into the gap above (the panel's bottom padding, which holds no
   controls) because space below the stamp is clipped by the viewport edge.
   That clears WCAG 2.5.8's 24x24 minimum with room to spare; the style
   guide's 44px rule governs primary controls, not this deliberately tiny
   stamp. */
.lobby-version-link {
  position: relative;
  display: inline-block;
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

.lobby-version-link::after {
  position: absolute;
  inset: -14px -16px -16px;
  content: "";
}

/* The stamp is uppercase; its screen-reader hint must not be. */
#buildVersionHint {
  text-transform: none;
}

.lobby-version-link:hover,
.lobby-version-link:focus-visible {
  color: var(--led-hi);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.treasure-codex-undiscovered strong {
  color: var(--dim);
  letter-spacing: 2px;
}

.treasure-codex-undiscovered .treasure-icon-canvas {
  filter: grayscale(1) brightness(0.3);
  opacity: 0.75;
}

/* ── Launch console ───────────────────────────────────────────────────────
   Game type, Campaign setup, and START share one recessed strip. The two
   five-card grids this replaced pushed the primary action below the fold;
   the copy they carried now lives in the dropdown rows and the readout. */
.launch-console {
  margin-top: 2px;
  padding: 10px;
  background: var(--well);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-well);
}

.launch-console-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, 0.8fr);
  align-items: stretch;
  gap: 8px;
}

/* Only Campaign has a setup field. Every other ruleset drops the cell rather
   than showing a disabled placeholder, so the row rebalances to two. */
.new-match-controls.expedition-ruleset .launch-console-row,
.new-match-controls.rival-ruleset .launch-console-row,
.new-match-controls.heist-ruleset .launch-console-row,
.new-match-controls.teams-ruleset .launch-console-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr);
}

/* The pickers enhance in place inside their original roots; making those
   transparent lets each dropdown sit directly in the console grid. */
.launch-console-mount {
  display: contents;
}

.launch-console-row > .campaign-flight-plan-field {
  display: grid;
  min-width: 0;
  margin: 0;
  gap: 0;
}

/* Must out-specify the rule above, or a hidden setup field keeps its grid
   cell and pushes START onto a second row. */
.launch-console-row > .campaign-flight-plan-field[hidden] {
  display: none;
}

.launch-console-field {
  position: relative;
  display: grid;
  min-width: 0;
}

.launch-console-trigger {
  display: grid;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 52px;
  gap: 9px;
  padding: 7px 11px;
  color: var(--text);
  background: var(--panel-flat);
  border: 1px solid #4a443e;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font: inherit;
  text-align: left;
}

.launch-console-trigger:hover:not(:disabled) {
  border-color: #6b6158;
}

.launch-console-field.disabled .launch-console-trigger,
.launch-console-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.launch-console-trigger-icon {
  display: block;
  width: 38px;
  height: 26px;
}

/* The ruleset glyphs are square, so their slot is too — same row height, no
   letterboxing. Flight Plan art keeps the wider landscape slot. */
[data-launch-console-field="match-ruleset"] .launch-console-trigger {
  grid-template-columns: 26px minmax(0, 1fr) auto;
}

[data-launch-console-field="match-ruleset"] .launch-console-trigger-icon {
  width: 26px;
}

[data-launch-console-field="match-ruleset"] .launch-console-option {
  grid-template-columns: 26px minmax(0, 1fr) auto;
}

.launch-console-trigger-icon .match-ruleset-art,
.launch-console-option .match-ruleset-art {
  width: 100%;
  height: 100%;
  stroke-width: 3;
}

.launch-console-trigger-icon .campaign-flight-plan-art,
.launch-console-option .campaign-flight-plan-art {
  grid-row: auto;
  width: 100%;
  height: 100%;
}

.launch-console-trigger-icon .campaign-flight-plan-art-line,
.launch-console-option .campaign-flight-plan-art-line {
  stroke-width: 3.5;
}

.launch-console-trigger-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.launch-console-trigger-label {
  color: var(--label);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.launch-console-trigger-value {
  overflow: hidden;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

[data-launch-console-field="match-ruleset"] .launch-console-trigger-value {
  text-transform: uppercase;
}

.launch-console-trigger-chevron {
  color: var(--accent);
  font-size: 13px;
}

/* Fixed, not absolute: the lobby panel is a scroll container, so an absolute
   popover would be clipped by it. JS pins this to the trigger on open. */
.launch-console-listbox {
  position: fixed;
  z-index: 40;
  display: grid;
  width: min(430px, calc(100vw - 32px));
  max-height: min(60vh, 420px);
  overflow-y: auto;
  gap: 5px;
  padding: 7px;
  background: var(--panel-flat);
  border: 1px solid #6b6158;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.launch-console-listbox[hidden] {
  display: none;
}

.launch-console-option {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: #c9bba6;
  background: #201c18;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.launch-console-option .campaign-flight-plan-art {
  width: 34px;
  height: 24px;
}

[data-launch-console-field="match-ruleset"] .launch-console-option .match-ruleset-art {
  width: 26px;
  height: 26px;
}

.launch-console-option.active,
.launch-console-option:hover {
  border-color: #6b6158;
}

.launch-console-option.selected {
  color: var(--text);
  background: #322d28;
  border-color: var(--accent);
}

.launch-console-option[data-campaign-flight-plan].selected {
  border-color: var(--flight-plan-color, var(--accent));
}

.launch-console-option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.launch-console-option-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.launch-console-option-heading {
  display: flex;
  align-items: center;
  gap: 7px;
}

.launch-console-option-copy strong {
  font-size: 11px;
  letter-spacing: 0.75px;
  text-transform: uppercase;
}

.launch-console-option[data-campaign-flight-plan] .launch-console-option-copy strong {
  letter-spacing: 0.08em;
  text-transform: none;
}

.launch-console-option-requirement {
  padding: 2px 5px;
  color: #ffcf9e;
  background: rgba(255, 140, 38, 0.1);
  border: 1px solid rgba(255, 140, 38, 0.48);
  border-radius: 999px;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.45px;
}

.launch-console-option-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0 5px;
  color: var(--dim);
  font-size: 9px;
  font-weight: 400;
  line-height: 1.35;
}

.launch-console-option-status {
  align-self: start;
  padding: 3px 5px;
  color: var(--led-ink);
  background: var(--led);
  border-radius: 999px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.55px;
}

.launch-console-option[data-campaign-flight-plan] .launch-console-option-status {
  color: #1b130a;
  background: var(--flight-plan-color, var(--accent));
}

.launch-console-option:not(.selected) .launch-console-option-status {
  display: none;
}

.launch-console-row > #createBtn,
#newMatchSettings .launch-console-row > #createBtn {
  min-height: 52px;
  /* The stacked layout spaced START off the picker above it; in the row that
     margin would make the button the tallest cell and misalign all three. */
  margin: 0;
  padding: 10px 14px;
}

/* One line that always describes exactly what START will launch. */
.launch-console-readout {
  margin: 8px 0 0;
  padding: 7px 10px;
  overflow-wrap: anywhere;
  color: #ffcf9e;
  background: rgba(255, 140, 38, 0.07);
  border: 1px solid rgba(255, 140, 38, 0.28);
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.launch-console-readout:empty {
  display: none;
}

/* ── Compact match browser ────────────────────────────────────────────────
   Demoted below the console, so each running match is one scannable line and
   the three join controls share a row. */
.match-card {
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
}

/* Title and every meta fragment collapse onto a single ellipsised line. */
.match-card-copy {
  display: flex;
  align-items: baseline;
  gap: 0 5px;
  overflow: hidden;
  white-space: nowrap;
}

.match-card-title {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 700;
  overflow-wrap: normal;
}

.match-card-copy > .match-card-meta {
  margin-top: 0;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
}

.match-card-copy > .match-card-meta:empty {
  display: none;
}

/* Separators are presentational, so they live in CSS rather than the row's
   accessible name. */
.match-card-copy > .match-card-meta::before {
  margin-right: 5px;
  color: var(--label);
  content: "·";
}

.match-card-copy > .match-card-title + .match-card-meta::before {
  content: "—";
}

.join-actions-fused {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
  gap: 8px;
}

.join-actions-fused #joinByCode {
  min-height: 44px;
  text-transform: uppercase;
}

.join-actions-fused #joinByCode::placeholder {
  color: var(--label);
  letter-spacing: 0.06em;
}

@media (max-width: 900px) {
  .launch-console-row,
  .new-match-controls.expedition-ruleset .launch-console-row,
  .new-match-controls.rival-ruleset .launch-console-row,
  .new-match-controls.heist-ruleset .launch-console-row,
  .new-match-controls.teams-ruleset .launch-console-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .launch-console-listbox {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .join-actions-fused {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .join-actions-fused #joinBtn {
    grid-column: 1 / -1;
  }
}
