@font-face {
  font-family: 'PixelDisplay';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./assets/fonts/pixel-display.ttf) format('truetype');
}
@font-face {
  font-family: 'PixelUI';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./assets/fonts/pixel-ui.ttf) format('truetype');
}
@font-face {
  font-family: 'PixelBold';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(./assets/fonts/pixel-bold.ttf) format('truetype');
}

:root {
  color-scheme: dark;
  --ink: #071117;
  --panel: #0b1a23;
  --panel-hi: #122836;
  --white: #f2f6f0;
  --orange: #ff6b38;
  --orange-hi: #ff9e75;
  --orange-lo: #9c2c08;
  --gold: #ffd447;
  --cyan: #38e8ff;
  --emerald: #6df07a;
  --muted: #93aeb9;
  --frame: #365566;
  --shadow: #03080b;
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
  image-rendering: pixelated;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--white);
  font-family: 'PixelUI', monospace;
  font-size: 18px;
  letter-spacing: 0.4px;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button, a, input { -webkit-tap-highlight-color: transparent; }
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
}
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px dashed var(--gold);
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

#app {
  position: relative;
  min-height: 700px;
  height: 100svh;
  overflow: hidden;
}

#world {
  position: absolute;
  inset: 0 0 0 32%;
  overflow: hidden;
  background: #276aa1;
}
#scene {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  display: block;
}
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, #071117 0%, #071117f8 30%, #071117cc 46%, #07111715 76%),
    linear-gradient(0deg, #071117 0%, transparent 24%, #07111766 100%);
}

/* Authentic CRT Scanline Overlay */
.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16) 0px,
    rgba(0, 0, 0, 0.16) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Reusable 8-Bit Beveled Pixel Frame & Buttons */
.pixel-box {
  background: rgba(9, 21, 29, 0.92);
  border: 2px solid var(--frame);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.08),
    inset -2px -2px 0 rgba(0, 0, 0, 0.55),
    4px 4px 0 var(--shadow);
}

.pixel-btn {
  background: var(--panel-hi);
  border: 2px solid var(--frame);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.18),
    inset -2px -2px 0 rgba(0, 0, 0, 0.55),
    3px 3px 0 var(--shadow);
}
.pixel-btn:hover {
  border-color: var(--orange);
  background: #1a3749;
}
.pixel-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

/* Topbar */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 82px;
  padding: 0 3.5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font: 400 26px/1 'PixelDisplay', monospace;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 var(--shadow);
}
.brand em {
  font-style: normal;
  color: var(--orange);
}
.brand svg {
  width: 36px;
  height: 36px;
  color: var(--orange);
  filter: drop-shadow(3px 3px 0 var(--shadow));
}
.brand small {
  display: block;
  font: 400 14px/1.1 'PixelUI', monospace;
  letter-spacing: 2px;
  margin-top: 4px;
  color: var(--cyan);
}
.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.room-pill {
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 15px/1 'PixelUI', monospace;
  letter-spacing: 1px;
  color: #e6f2f7;
}
.net-dot {
  width: 8px;
  height: 8px;
  background: var(--emerald);
  border: 1px solid #000;
  display: inline-block;
}
.net-dot.local {
  background: var(--gold);
}
.icon-button {
  height: 38px;
  min-width: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.icon-button span {
  font: 400 15px/1 'PixelUI', monospace;
  color: var(--gold);
}

/* Pixel Hangar Homepage */
.menu {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.menu button, .menu a, .menu input { pointer-events: auto; }

.hangar-panel {
  position: absolute;
  top: 88px;
  left: 3.5%;
  width: 548px;
  background: rgba(9, 20, 28, 0.95);
  border: 3px solid var(--frame);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.09),
    inset -3px -3px 0 rgba(0, 0, 0, 0.65),
    8px 8px 0 var(--shadow);
}

.pixel-window-bar {
  height: 30px;
  background: #173140;
  border-bottom: 3px solid var(--frame);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 400 14px/1 'PixelUI', monospace;
  color: #cbe2ec;
  letter-spacing: 1px;
}
.win-leds {
  display: flex;
  gap: 5px;
}
.win-leds i {
  width: 8px;
  height: 8px;
  display: block;
  border: 1px solid #000;
}
.win-leds i:nth-child(1) { background: var(--orange); }
.win-leds i:nth-child(2) { background: var(--gold); }
.win-leds i:nth-child(3) { background: var(--emerald); }
.win-ver { color: var(--gold); }

.hangar-body {
  padding: 18px 20px 18px;
}

.eyebrow {
  font: 400 15px/1 'PixelUI', monospace;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
}
.live-dot {
  width: 8px;
  height: 8px;
  background: var(--orange);
  border: 1px solid #000;
  display: inline-block;
  flex: none;
  animation: pixelBlink 1s steps(2, start) infinite;
}
@keyframes pixelBlink {
  to { visibility: hidden; }
}
.line { width: 22px; height: 2px; background: var(--frame); }

h1 {
  font: 400 clamp(38px, 4.1vw, 56px)/1.06 'PixelDisplay', monospace;
  margin: 12px 0 10px;
  text-shadow: 4px 4px 0 var(--shadow);
  letter-spacing: 1px;
}
h1 em {
  font-style: normal;
  color: var(--orange);
}
.lead {
  font: 400 18px/1.38 'PixelUI', monospace;
  color: #bdd1da;
  margin: 0 0 14px;
}

/* Pilot Loadout Bay */
.pilot-card {
  background: #061016;
  border: 2px solid #284252;
  padding: 12px 13px;
  margin-bottom: 12px;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.7);
}
.pilot-row {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 14px;
  align-items: end;
}
.field-wrap label, .field-label {
  display: block;
  font: 400 14px/1 'PixelUI', monospace;
  letter-spacing: 1.2px;
  color: var(--gold);
  margin-bottom: 7px;
}
.input-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.prompt-tag {
  height: 38px;
  padding: 0 8px;
  background: #142a37;
  border: 2px solid var(--frame);
  display: grid;
  place-items: center;
  font: 400 16px/1 'PixelDisplay', monospace;
  color: var(--orange);
}
.input-group input, .dialog-form input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 2px solid var(--frame);
  background: #040a0e;
  color: #ffffff;
  font: 400 19px/1 'PixelUI', monospace;
  letter-spacing: 0.8px;
}
.input-group input::placeholder, .dialog-form input::placeholder {
  color: #54707d;
}
.dice-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  color: #d9eaf2;
}

.skin-picker {
  display: flex;
  gap: 6px;
  height: 38px;
  align-items: center;
}
.skin-swatch {
  width: 32px;
  height: 32px;
  border: 2px solid #2b4554;
  padding: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 2px 2px 0 var(--shadow);
}
.skin-swatch:hover { transform: translateY(-2px); border-color: #fff; }
.skin-swatch.active {
  border: 2px solid #ffffff;
  outline: 2px solid var(--orange);
  transform: translateY(-2px);
}
.skin-swatch i {
  position: absolute;
  inset: 0;
  display: block;
}
.skin-swatch b {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
}

/* Arcade Cartridge Mode Selector */
.mode-picker {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 13px;
}
.pixel-slot {
  text-align: left;
  border: 2px solid #2c4654;
  padding: 9px 10px 10px;
  background: #0c1d27;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.08),
    3px 3px 0 var(--shadow);
}
.pixel-slot:hover {
  border-color: #698fa3;
  background: #132a38;
}
.pixel-slot.selected {
  border-color: var(--orange);
  background: #1c2329;
  box-shadow:
    inset 2px 2px 0 rgba(255, 158, 117, 0.25),
    3px 3px 0 var(--shadow);
}
.mode-top {
  display: flex;
  justify-content: space-between;
  color: #6e8c99;
  font: 400 13px/1 'PixelUI', monospace;
  margin-bottom: 7px;
}
.slot-cursor { opacity: 0; }
.selected .mode-top { color: var(--gold); }
.selected .slot-cursor {
  opacity: 1;
  color: var(--orange);
  animation: pixelBlink 0.9s steps(2, start) infinite;
}
.mode strong {
  display: block;
  font: 400 13px/1.2 'PixelDisplay', monospace;
  margin-bottom: 4px;
  color: #ffffff;
}
.mode small {
  font: 400 14px/1.1 'PixelUI', monospace;
  color: #9bb4bf;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chunky 8-Bit Arcade CTA Button */
.pixel-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--orange);
  color: #0b1317;
  padding: 14px 18px;
  border: 2px solid #000;
  box-shadow:
    inset 3px 3px 0 var(--orange-hi),
    inset -3px -3px 0 var(--orange-lo),
    5px 5px 0 var(--shadow);
}
.pixel-cta b {
  font: 400 16px/1 'PixelDisplay', monospace;
  letter-spacing: 1px;
}
.pixel-cta span {
  font: 400 16px/1 'PixelUI', monospace;
  background: rgba(0, 0, 0, 0.22);
  padding: 3px 7px;
  color: #fff8e7;
}
.pixel-cta:hover { background: #ff7e50; }
.pixel-cta:active {
  transform: translate(3px, 3px);
  box-shadow:
    inset 2px 2px 0 var(--orange-hi),
    2px 2px 0 var(--shadow);
}
.pixel-cta:disabled {
  opacity: 0.6;
  cursor: wait;
}

.under-start {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  align-items: center;
  font: 400 15px/1 'PixelUI', monospace;
  color: #9bb5c0;
}
.under-start .live-dot {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  background: var(--emerald);
}
.under-links {
  display: flex;
  gap: 12px;
}
.under-links button {
  font: 400 15px/1 'PixelUI', monospace;
  color: var(--gold);
  background: none;
  padding: 2px 0;
}
.under-links button:hover { color: #fff; text-decoration: underline; }

/* Right-side Pixel Aircraft Spec Card */
.pixel-hud-card {
  position: absolute;
  right: 4.5%;
  top: 34%;
  background: rgba(8, 20, 28, 0.88);
  border: 2px solid var(--frame);
  padding: 12px 16px;
  box-shadow: 5px 5px 0 var(--shadow);
}
.spec-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 2px solid var(--orange);
}
.spec-corner.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.spec-corner.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.aircraft-label small {
  font: 400 14px/1 'PixelUI', monospace;
  letter-spacing: 1.5px;
  color: var(--cyan);
}
.aircraft-label strong {
  display: block;
  font: 400 24px/1.2 'PixelDisplay', monospace;
  margin-top: 6px;
  text-shadow: 2px 2px 0 #000;
}
.aircraft-label strong span { color: var(--orange); }
.spec-bars {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font: 400 14px/1 'PixelUI', monospace;
  color: #b7ced8;
}
.spec-bars i {
  font-style: normal;
  color: var(--emerald);
  letter-spacing: 1px;
}

/* Pixel Arcade Footer Bar */
.menu-footer {
  position: absolute;
  bottom: 0;
  left: 3.5%;
  right: 3.5%;
  height: 68px;
  border-top: 2px solid var(--frame);
  background: rgba(7, 17, 23, 0.88);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 4;
}
.footer-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 400 14px/1.25 'PixelUI', monospace;
  color: #d6e4ea;
}
.menu-footer b { font-weight: 400; color: var(--muted); }
.menu-footer .footer-num {
  font: 400 28px/1 'PixelDisplay', monospace;
  color: var(--orange);
  text-shadow: 2px 2px 0 #000;
}
.footer-middle {
  color: #9cb6c2 !important;
  font: 400 15px/1 'PixelUI', monospace !important;
  display: flex;
  align-items: center;
}
.footer-middle i { color: var(--orange); font-style: normal; margin: 0 8px; }
.record-btn {
  height: 40px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 15px/1 'PixelUI', monospace;
  color: #d8e6ec;
}
.record-btn strong {
  font: 400 20px/1 'PixelDisplay', monospace;
  color: var(--gold);
}

/* Game State Visibility */
.game-only { display: none !important; }
[data-state=playing] .game-only,
[data-state=paused] .game-only,
[data-state=result] .game-only { display: flex !important; }
[data-state]:not([data-state=menu]) #menu { display: none; }
[data-state]:not([data-state=menu]) #world { left: 0; }
[data-state]:not([data-state=menu]) .shade {
  background: linear-gradient(180deg, rgba(7, 17, 23, 0.65) 0%, transparent 18%, transparent 80%, rgba(7, 17, 23, 0.65) 100%);
}
[data-state]:not([data-state=menu]) .scanlines { opacity: 0.45; }
[data-state]:not([data-state=menu]) .topbar { height: 68px; }
[data-state]:not([data-state=menu]) .brand { font-size: 20px; }
[data-state]:not([data-state=menu]) .brand small { display: none; }
[data-state]:not([data-state=menu]) .brand svg { width: 28px; height: 28px; }

[data-gamemode=io] .classic-only { display: none !important; }
[data-gamemode=mission] .io-only,
[data-gamemode=free] .io-only { display: none !important; }

/* In-Game Pixel HUD */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
#hud button, #hud input, .io-respawn { pointer-events: auto; }

/* Classic Mission HUD */
.mission-hud {
  position: absolute;
  top: 80px;
  left: 3.5%;
  min-width: 190px;
  padding: 10px 13px;
  flex-direction: column;
}
.mission-hud small { font: 400 14px/1 'PixelUI', monospace; color: var(--cyan); }
#progress { font: 400 28px/1.1 'PixelDisplay', monospace; margin-top: 6px; }
#progress span { font: 400 15px/1 'PixelUI', monospace; color: #c7dbe3; }

.progress-track, .hull-track, .xp-track {
  height: 8px;
  background: #040a0e;
  border: 1px solid #2b4656;
}
.progress-track { margin-top: 8px; }
.progress-track i, .hull-track i, .xp-track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--orange);
}

.flight-hud {
  position: absolute;
  right: 3.5%;
  top: 80px;
  padding: 10px 14px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#time { font: 400 30px/1 'PixelDisplay', monospace; color: #fff; }
.flight-hud small { font: 400 14px/1 'PixelUI', monospace; color: var(--muted); }
.flight-hud strong { font: 400 16px/1 'PixelDisplay', monospace; color: var(--gold); margin-top: 4px; }

/* .IO Left HUD: Rank + Score + Kill Feed */
.io-left-hud {
  position: absolute;
  top: 76px;
  left: 3.5%;
  width: 256px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.io-pilot-box { padding: 10px 12px; }
.io-rank-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.io-lvl-badge {
  background: var(--orange);
  color: #081014;
  font: 400 12px/1 'PixelDisplay', monospace;
  padding: 4px 6px;
  border: 1px solid #000;
}
.io-rank-head small {
  font: 400 15px/1 'PixelUI', monospace;
  letter-spacing: 1px;
  color: var(--cyan);
}
.io-score-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 7px;
}
.io-score-row strong {
  font: 400 26px/1 'PixelDisplay', monospace;
  color: #ffffff;
  text-shadow: 2px 2px 0 #000;
}
.io-score-row span {
  font: 400 14px/1 'PixelUI', monospace;
  color: var(--muted);
}
.io-score-row em {
  font-style: normal;
  margin-left: auto;
  font: 400 15px/1 'PixelUI', monospace;
  color: var(--gold);
}
.streak-tag {
  background: #2b2108;
  color: var(--gold) !important;
  border: 1px solid var(--gold);
  padding: 2px 5px;
}
.xp-track i { background: var(--gold); }

.io-buffs {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  flex-wrap: wrap;
}
.buff-pill {
  font: 400 13px/1 'PixelUI', monospace;
  padding: 3px 6px;
  border: 1px solid #000;
}
.buff-pill.shield {
  background: #0b2b36;
  color: var(--cyan);
  border-color: var(--cyan);
}
.buff-pill.overdrive {
  background: #0e2e17;
  color: var(--emerald);
  border-color: var(--emerald);
}

.kill-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.kill-feed li {
  background: rgba(7, 17, 24, 0.9);
  border: 2px solid #274150;
  border-left: 4px solid var(--orange);
  padding: 4px 8px;
  font: 400 15px/1.2 'PixelUI', monospace;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #dce8ed;
  box-shadow: 3px 3px 0 var(--shadow);
}
.kill-feed li.king-kill {
  border-color: var(--gold);
  background: rgba(34, 26, 7, 0.92);
}
.kill-feed b { font-weight: 400; color: #fff; }
.kill-feed .kf-sep { color: var(--orange); }

/* .IO Top-Right Leaderboard */
.io-leaderboard {
  position: absolute;
  top: 76px;
  right: 3.5%;
  width: 244px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
}
.lb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 2px solid #233b49;
}
.lb-header strong {
  font: 400 13px/1 'PixelDisplay', monospace;
  color: var(--gold);
}
.lb-header span {
  font: 400 14px/1 'PixelUI', monospace;
  color: var(--cyan);
}
.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.lb-list li {
  display: grid;
  grid-template-columns: 20px 8px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 3px 5px;
  font: 400 16px/1.1 'PixelUI', monospace;
  color: #d6e5ec;
}
.lb-list li.me {
  background: #2b1812;
  border: 1px solid var(--orange);
  color: #ffffff;
}
.lb-list li.king .lb-rank { color: var(--gold); }
.lb-rank {
  font: 400 12px/1 'PixelDisplay', monospace;
  color: #84a0ac;
  text-align: center;
}
.lb-dot {
  width: 8px;
  height: 8px;
  border: 1px solid #000;
}
.lb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score {
  font: 400 13px/1 'PixelDisplay', monospace;
  color: #ffbe8a;
}
.lb-list li.king .lb-score { color: var(--gold); }

/* Bottom-Left Square Pixel Radar + Telemetry */
.bottom-left-cluster {
  position: absolute;
  left: 3.5%;
  bottom: 66px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.radar-box {
  position: relative;
  width: 116px;
  height: 116px;
  background: #06131c;
  box-shadow: 4px 4px 0 var(--shadow);
  flex: none;
}
#radar {
  width: 100%;
  height: 100%;
  display: block;
}
.radar-n {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font: 400 11px/1 'PixelDisplay', monospace;
  color: var(--gold);
  background: #061118;
  padding: 2px 4px;
  border: 1px solid #2b4757;
}

.telemetry {
  display: flex;
  gap: 20px;
  padding: 9px 14px;
  align-items: flex-start;
}
.telemetry small {
  display: block;
  font: 400 13px/1 'PixelUI', monospace;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 5px;
}
.telemetry span {
  font: 400 20px/1 'PixelDisplay', monospace;
  color: #ffffff;
}
.hull-track { width: 78px; margin-top: 5px; }
.hull-track i { width: 100%; background: var(--emerald); }

.view-switch { position: absolute; right: 3.5%; bottom: 68px; }
.view-switch button {
  padding: 10px 13px;
  font: 400 15px/1 'PixelUI', monospace;
  letter-spacing: 1px;
}
kbd {
  font: 400 13px/1 'PixelUI', monospace;
  padding: 2px 5px;
  border: 1px solid var(--frame);
  color: var(--gold);
  background: #061017;
  box-shadow: 2px 2px 0 #000;
}
.view-switch kbd { margin-left: 8px; }

.keyboard-hints {
  position: absolute;
  bottom: 20px;
  left: 3.5%;
  display: flex;
  gap: 16px;
  font: 400 15px/1 'PixelUI', monospace;
  color: #c6d8e0;
  align-items: center;
}
.keyboard-hints kbd { margin-right: 4px; }

#message {
  position: absolute;
  top: 19%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font: 400 15px/1.3 'PixelDisplay', monospace;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #000;
  color: var(--gold);
  background: rgba(6, 15, 21, 0.72);
  padding: 4px 10px;
  white-space: nowrap;
}
#message:empty { display: none; }

/* .IO Pixel Respawn Card */
.io-respawn {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 12, 17, 0.68);
  z-index: 6;
}
.pixel-modal-box {
  width: min(430px, calc(100% - 28px));
  background: #0b1922;
  border: 3px solid var(--orange);
  padding: 22px 24px;
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.1),
    8px 8px 0 var(--shadow);
}
.respawn-card h3 {
  font: 400 24px/1.2 'PixelDisplay', monospace;
  margin: 10px 0 14px;
  color: #ffffff;
  text-shadow: 3px 3px 0 #000;
}
.respawn-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 2px solid #243d4b;
  border-bottom: 2px solid #243d4b;
  margin-bottom: 12px;
}
.respawn-stats small {
  display: block;
  font: 400 13px/1 'PixelUI', monospace;
  color: var(--muted);
  margin-bottom: 4px;
}
.respawn-stats strong {
  font: 400 24px/1 'PixelDisplay', monospace;
  color: var(--gold);
}
.respawn-note {
  font: 400 16px/1.35 'PixelUI', monospace;
  color: #c2d6df;
  margin: 0 0 14px;
}

/* Pixel Touch Controls */
#touch {
  display: none !important;
  position: absolute;
  bottom: 26px;
  left: 4.5%;
  right: 4.5%;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}
.joystick {
  width: 110px;
  height: 110px;
  border: 3px solid var(--frame);
  background: rgba(8, 24, 34, 0.72);
  box-shadow: 4px 4px 0 var(--shadow);
  position: relative;
  touch-action: none;
  pointer-events: auto;
}
.joystick:before, .joystick:after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.18);
  left: 50%;
  top: 10%;
  height: 80%;
  width: 2px;
}
.joystick:after { transform: rotate(90deg); }
.stick {
  position: absolute;
  inset: 33px;
  border: 2px solid #fff;
  background: rgba(255, 107, 56, 0.55);
  box-shadow: 2px 2px 0 #000;
  z-index: 1;
}
.joystick > span {
  position: absolute;
  bottom: -20px;
  width: 100%;
  text-align: center;
  font: 400 13px/1 'PixelUI', monospace;
}
.touch-actions {
  display: grid;
  grid-template-columns: 76px 76px;
  gap: 8px;
  pointer-events: auto;
}
.touch-actions button {
  height: 50px;
  font: 400 12px/1 'PixelDisplay', monospace;
  touch-action: none;
}
.touch-actions button.active { background: var(--orange); color: #081014; }
.touch-actions .fire {
  background: var(--orange);
  color: #081014;
  border-color: #000;
}

/* Pixel Dialogs */
dialog {
  background: #0b1922;
  color: var(--white);
  border: 3px solid var(--frame);
  padding: 28px;
  max-width: 600px;
  width: calc(100% - 28px);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.08),
    10px 10px 0 var(--shadow);
}
dialog::backdrop {
  background: rgba(3, 9, 14, 0.82);
}
dialog h2 {
  font: 400 28px/1.15 'PixelDisplay', monospace;
  margin: 10px 0;
  color: var(--gold);
  text-shadow: 3px 3px 0 #000;
}
dialog p {
  color: #bfd3dc;
  font: 400 18px/1.45 'PixelUI', monospace;
}
.close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 36px;
  height: 36px;
  font: 400 22px/1 'PixelDisplay', monospace;
  color: var(--white);
}
.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 20px;
}
.dialog-form label {
  font: 400 14px/1 'PixelUI', monospace;
  letter-spacing: 1px;
  color: var(--gold);
  margin-top: 4px;
}
.copy-btn {
  flex: none;
  padding: 0 12px;
  height: 38px;
  font: 400 12px/1 'PixelDisplay', monospace;
  color: var(--gold);
}
.form-hint { font: 400 16px/1.35 'PixelUI', monospace; color: #95aeb9; }

.instructions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin: 18px 0;
}
.instructions b {
  font: 400 13px/1.2 'PixelDisplay', monospace;
  color: var(--orange);
  display: block;
}
.instructions p { font: 400 17px/1.35 'PixelUI', monospace; margin: 6px 0 0; }
.secondary {
  width: 100%;
  padding: 11px;
  margin-top: 8px;
  font: 400 17px/1 'PixelUI', monospace;
}
#pause-dialog, #result, #room-dialog { max-width: 460px; }
.result-stats { display: flex; gap: 32px; padding: 14px 0 20px; flex-wrap: wrap; }
.record-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.result-stats small { font: 400 14px/1 'PixelUI', monospace; color: var(--muted); display: block; margin-bottom: 5px; }
.result-stats strong { font: 400 32px/1 'PixelDisplay', monospace; color: var(--gold); }
.credit { font: 400 15px/1.4 'PixelUI', monospace; }
.credit a { color: var(--orange); }

#loading {
  position: absolute;
  inset: 0;
  background: var(--ink);
  display: grid;
  place-items: center;
  z-index: 20;
  font: 400 16px/1 'PixelDisplay', monospace;
  color: var(--gold);
  letter-spacing: 2px;
}

/* Responsive Breakpoints */
@media (max-height: 800px) and (min-width: 801px) {
  #app { min-height: 620px; }
  .hangar-panel { top: 76px; width: 520px; }
  .hangar-body { padding: 13px 16px 14px; }
  h1 { font-size: 38px; margin: 8px 0; }
  .lead { font-size: 16px; margin-bottom: 10px; }
  .pilot-card { padding: 9px 11px; margin-bottom: 9px; }
  .pixel-slot { padding: 7px 9px; }
  .pixel-cta { padding: 12px 16px; }
  .menu-footer { height: 56px; }
}

@media (max-width: 980px) {
  .hangar-panel { left: 4%; width: 470px; }
  .pixel-hud-card { right: 3.5%; top: 26%; }
  .footer-middle { display: none !important; }
  .io-leaderboard { width: 204px; }
  .io-left-hud { width: 218px; }
}

@media (pointer: coarse) {
  [data-state=playing] #touch,
  [data-state=paused] #touch { display: flex !important; }
  .keyboard-hints { display: none; }
  .bottom-left-cluster { bottom: 176px; }
  .view-switch { bottom: 184px; }
  .view-switch kbd { display: none; }
}

@media (max-width: 640px) {
  #app { min-height: 0; height: 100svh; overflow-y: auto; }
  .topbar { height: 66px; padding: 0 4%; }
  .brand { font-size: 19px; }
  .brand svg { width: 26px; height: 26px; }
  .brand small { display: none; }
  .room-pill { height: 32px; padding: 0 8px; font-size: 13px; }
  .icon-button { height: 32px; min-width: 32px; padding: 0 7px; }
  #world { inset: 46px -12% 45% 0; }
  .shade {
    background: linear-gradient(0deg, #071117 36%, #071117f2 55%, #07111766 78%, #07111799 100%);
  }
  .pixel-hud-card { top: 74px; left: 4%; right: auto; padding: 8px 11px; }
  .aircraft-label strong { font-size: 17px; }
  .spec-bars { display: none; }
  .hangar-panel { top: 146px; left: 4%; width: 92%; margin-bottom: 30px; }
  .hangar-body { padding: 14px; }
  h1 { font-size: 34px; }
  .lead { font-size: 16px; }
  .lead br.desktop { display: none; }
  .pilot-row { grid-template-columns: 1fr; gap: 10px; }
  .mode-picker { grid-template-columns: 1fr; gap: 6px; }
  .pixel-slot { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; }
  .mode-top { margin-bottom: 0; margin-right: 8px; }
  .menu-footer { display: none; }

  [data-state]:not([data-state=menu]) { overflow: hidden; }
  [data-state]:not([data-state=menu]) #world { inset: 0; }
  .io-left-hud { top: 72px; left: 3%; width: 178px; }
  .io-pilot-box { padding: 7px 9px; }
  .io-score-row strong { font-size: 20px; }
  .kill-feed li { font-size: 13px; padding: 3px 6px; }
  .io-leaderboard { top: 72px; right: 3%; width: 164px; padding: 7px 8px; }
  .lb-list li { font-size: 14px; grid-template-columns: 16px 6px 1fr auto; gap: 4px; }
  .lb-list li:nth-child(n+6):not(.me) { display: none; }
  .radar-box { width: 78px; height: 78px; }
  .bottom-left-cluster { left: 3%; bottom: 168px; gap: 10px; }
  .telemetry { gap: 11px; padding: 7px 10px; }
  .telemetry span { font-size: 16px; }
  .hull-track { width: 44px; }
  .telemetry div:last-child { display: none; }
  .view-switch { right: 3%; bottom: 196px; }
  .instructions { grid-template-columns: 1fr; }
  dialog { padding: 20px 16px; }
}

@media (max-height: 550px) and (orientation: landscape) {
  .io-left-hud { top: 64px; width: 190px; }
  .kill-feed { display: none; }
  .io-leaderboard { top: 64px; width: 182px; }
  .lb-list li:nth-child(n+5):not(.me) { display: none; }
  .bottom-left-cluster { bottom: 20px; left: 23%; gap: 12px; }
  .radar-box { width: 74px; height: 74px; }
  .view-switch { bottom: 22px; right: 23%; }
  #touch { bottom: 16px; }
  .joystick { width: 88px; height: 88px; }
  .stick { inset: 26px; }
  .touch-actions button { height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, .live-dot, .slot-cursor { animation: none !important; transition: none !important; }
}
