:root {
  color: #eaf5ff;
  background: #030510;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body,
#app,
.game-shell,
#game-container {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 0;
  min-height: 0;
  min-height: 100dvh;
  overscroll-behavior: none;
}

.game-shell {
  position: relative;
  background: radial-gradient(circle at center, #0b1830, #030510 68%);
}

#game-container,
#game-container canvas {
  display: block;
}

.join-overlay,
.death-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(1, 4, 12, 0.66);
  backdrop-filter: blur(6px);
}

.join-overlay {
  min-height: 100dvh;
  overflow: auto;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.join-card {
  width: min(420px, calc(100vw - 48px));
  padding: 34px;
  border: 1px solid rgba(100, 219, 255, 0.38);
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(9, 20, 38, 0.96), rgba(4, 9, 20, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52), inset 0 0 30px rgba(57, 183, 255, 0.04);
}

.eyebrow,
.panel-title,
.hud-heading,
.boundary-warning {
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 8px;
  color: #65d8ff;
  font-size: 11px;
}

h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 300;
  letter-spacing: -0.04em;
}

.join-copy {
  margin: 10px 0 28px;
  color: #91a1b8;
  line-height: 1.55;
}

.join-card label {
  display: block;
  margin-bottom: 8px;
  color: #8ea1ba;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.join-card input + label {
  margin-top: 14px;
}

.join-card input,
.join-card button {
  width: 100%;
  border-radius: 3px;
  font: inherit;
}

.join-card input {
  padding: 13px 14px;
  border: 1px solid #263952;
  outline: none;
  color: #f2fbff;
  background: #050c19;
}

.join-card input:focus {
  border-color: #50d7ff;
  box-shadow: 0 0 0 3px rgba(80, 215, 255, 0.1);
}

.join-card button {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid #57e5c2;
  color: #04130f;
  background: #57e5c2;
  cursor: pointer;
  font-weight: 700;
}

.join-card button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.join-card .mode-button {
  margin-top: 10px;
  border-color: transparent;
  color: #91a1b8;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
}

.join-card .mode-button:hover {
  color: #dcecff;
}

.join-card .admin-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 12px;
  border: 1px solid #3f7184;
  border-radius: 3px;
  color: #6ee5fb;
  text-decoration: none;
}

.error-message,
.status-message {
  margin: 14px 0 0;
  font-size: 12px;
}

.error-message {
  color: #ff7588;
}

.status-message {
  color: #78cce9;
}

.hud {
  position: absolute;
  z-index: 10;
  border: 1px solid rgba(101, 150, 194, 0.28);
  border-radius: 3px;
  color: #cad9e8;
  background: rgba(4, 10, 22, 0.76);
  box-shadow: inset 0 0 24px rgba(73, 174, 255, 0.025);
  backdrop-filter: blur(5px);
  pointer-events: none;
}

html[data-quality="balanced"] .game-shell *,
html[data-quality="economy"] .game-shell * {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-quality="economy"] .sentry-warning,
html[data-quality="economy"] .sensor-collision-warning { animation: none; }
.performance-diagnostics { padding: 12px; border: 1px solid #385365; margin: 12px 0; overflow-wrap: anywhere; }
.performance-diagnostics p { margin: 8px 0; }
.performance-diagnostics small { display: block; margin-top: 8px; }

.status-panel {
  top: 20px;
  left: 20px;
  width: 260px;
  padding: 15px;
}

.hud-heading,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #f2fbff;
  font-size: 11px;
}

.leave-button {
  width: 25px;
  height: 25px;
  border: 1px solid #3f526a;
  border-radius: 50%;
  color: #9aabc1;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.meter-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  margin-top: 10px;
  color: #8295ac;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.meter-row strong {
  color: #dcecff;
  font-size: 10px;
}

.meter,
.cargo-meter {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  background: #101b2a;
}

.meter i,
.cargo-meter i {
  display: block;
  height: 100%;
  transition: width 150ms linear;
}

.shield-meter {
  background: #48d8ff;
  box-shadow: 0 0 10px #48d8ff;
}

.meter-row.inactive .shield-meter {
  opacity: 0.25;
  box-shadow: none;
}

.meter-row.inactive > span,
.meter-row.inactive > strong {
  color: #718096;
}

.hull-meter {
  background: #ff6377;
  box-shadow: 0 0 10px rgba(255, 99, 119, 0.5);
}

.telemetry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  margin-top: 14px;
  color: #8295ac;
  font-size: 10px;
}

.telemetry strong {
  color: #d7e5f5;
}

.telemetry strong.active,
.protection {
  color: #58ebc7;
}

.telemetry strong.credits {
  color: #ffbf69;
}

.power-state.online { color: #57e5c2; }
.power-state.offline { color: #7e8ba0; }
.power-state.starting { color: #ffbf69; }

.signature-state.reduced { color: #57e5c2; }
.signature-state.stabilizing { color: #ffbf69; }
.signature-state.detectable { color: #ff7588; }

.power-toggle {
  width: 100%;
  margin-top: 13px;
  padding: 8px 10px;
  border: 1px solid #ff7588;
  border-radius: 3px;
  color: #ffd4da;
  background: rgba(75, 18, 30, 0.55);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  pointer-events: auto;
}

.power-toggle.offline {
  border-color: #57e5c2;
  color: #b9fff9;
  background: rgba(16, 62, 59, 0.55);
}

.power-toggle.starting {
  border-color: #ffbf69;
  color: #ffdb9d;
  background: rgba(74, 48, 16, 0.55);
}

.power-toggle:disabled {
  cursor: wait;
  opacity: 0.72;
}

.anchored-state {
  margin: 10px 0 0;
  color: #57e5c2;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fuel-row {
  margin-top: 12px;
}

.flight-fuel-meter {
  background: #53f2c5;
  box-shadow: 0 0 10px rgba(83, 242, 197, 0.48);
}

.hyperdrive-fuel-meter {
  background: #58cfff;
  box-shadow: 0 0 10px rgba(88, 207, 255, 0.52);
}

.protection {
  margin: 12px 0 0;
  font-size: 10px;
}

.cargo-panel {
  right: 20px;
  bottom: 20px;
  width: 220px;
  padding: 14px;
}

.law-panel {
  top: 235px;
  right: 20px;
  width: 230px;
  padding: 14px;
}

.law-panel p {
  margin: 10px 0 0;
  color: #ffbf69;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: center;
}

.legal-state.clean { color: #53f2c5; }
.legal-state.aggressor { color: #ff9f43; }
.legal-state.wanted,
.legal-state.outlaw {
  color: #ff536b;
  text-shadow: 0 0 8px rgba(255, 83, 107, 0.5);
}

.law-reputation {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 8px;
  color: #8295ac;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.law-reputation strong {
  color: #d7e5f5;
}

.cargo-meter {
  margin-bottom: 10px;
}

.cargo-meter i {
  background: linear-gradient(90deg, #8496a8, #52dceb, #d479ff);
}

.cargo-panel dl,
.cargo-panel dl div {
  margin: 0;
}

.cargo-panel dl div {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  color: #9bacc0;
  font-size: 11px;
}

.cargo-panel dt {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cargo-panel dd {
  color: #e6f3ff;
}

.ore {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
}

.ore.iron { background: #9aa8b6; }
.ore.crystal { background: #50e3ff; }
.ore.iridium { background: #d479ff; }
.ore.nebularine { background: #ff4fe1; box-shadow: 0 0 8px rgba(255, 79, 225, 0.72); }

.contraband-cargo {
  color: #ff9bee;
  background: linear-gradient(90deg, rgba(255, 79, 225, 0.08), transparent);
}

.contraband-button,
.contraband-context-action {
  border-color: rgba(255, 79, 225, 0.72);
  color: #ffd5f8;
  background: rgba(69, 9, 61, 0.72);
}

.contraband-context-action {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 18;
  min-height: 44px;
  padding: 10px 18px;
  transform: translateX(-50%);
  border-style: solid;
  border-width: 1px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.controls-panel {
  left: 20px;
  bottom: 20px;
  padding: 11px 14px;
  font-size: 10px;
}

.station-panel {
  left: 50%;
  bottom: 20px;
  width: 390px;
  padding: 14px;
  transform: translateX(-50%);
  border-color: rgba(83, 242, 197, 0.36);
}

.station-prices {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  color: #8295ac;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.station-prices strong {
  color: #d7e5f5;
  font-size: 10px;
  text-align: right;
}

.station-action {
  margin: 11px 0 0;
  color: #ffbf69;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-align: center;
}

.station-action.available {
  color: #b9fff9;
  text-shadow: 0 0 8px rgba(82, 239, 228, 0.45);
}

.fitting-open-button {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #57e5c2;
  border-radius: 3px;
  color: #b9fff9;
  background: rgba(16, 62, 59, 0.55);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  pointer-events: auto;
}

.game-panel-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(1, 4, 12, 0.72);
  backdrop-filter: blur(7px);
}

.game-panel-shell {
  display: flex;
  flex-direction: column;
  width: min(900px, calc(100vw - 60px));
  max-height: calc(100vh - 60px);
  max-height: calc(100dvh - 60px);
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(87, 229, 194, 0.5);
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(8, 21, 38, 0.98), rgba(3, 9, 20, 0.98));
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.65);
  outline: none;
}

.game-panel-heading,
.game-panel-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.game-panel-heading > div {
  display: grid;
  flex: 1;
  justify-content: start;
  gap: 4px;
}
.game-panel-heading span { letter-spacing: 0.14em; text-transform: uppercase; }
.game-panel-heading small { color: #8295ac; font-size: 10px; }
.game-panel-heading strong { color: #ffbf69; }
.game-panel-close,
.game-panel-back {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid #52677e;
  border-radius: 50%;
  color: #dcecff;
  background: transparent;
  cursor: pointer;
}

.game-panel-content {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.game-panel-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(101, 150, 194, 0.2);
}

.game-panel-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 7px;
  margin: 18px 0;
  padding-bottom: 10px;
  overflow-x: auto;
  background: rgba(5, 13, 26, 0.98);
}

.game-panel-tabs button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #334b64;
  border-radius: 3px;
  color: #9fb2c7;
  background: #07111f;
  cursor: pointer;
  white-space: nowrap;
}

.game-panel-tabs button.active {
  border-color: #57e5c2;
  color: #b9fff9;
  background: rgba(16, 62, 59, 0.55);
}

.game-panel-tabs button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.panel-section {
  padding: 8px 0;
}

.panel-data-grid {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 11px 22px;
  color: #8295ac;
  font-size: 11px;
}

.panel-data-grid strong {
  color: #d7e5f5;
  text-align: right;
}

.panel-action-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.panel-action-row button,
.danger-action {
  min-height: 44px;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #57e5c2;
  border-radius: 3px;
  color: #b9fff9;
  background: rgba(16, 62, 59, 0.55);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.panel-action-row button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.danger-action {
  width: 100%;
  margin-top: 12px;
  border-color: #ff7588;
  color: #ffd4da;
  background: rgba(75, 18, 30, 0.55);
}

.cargo-detail dl,
.cargo-detail dl div {
  margin: 0;
}

.cargo-detail dl div {
  display: flex;
  justify-content: space-between;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(101, 150, 194, 0.16);
}

.cargo-detail dt {
  display: flex;
  align-items: center;
  gap: 9px;
}

.fitting-modal {
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.fitting-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 28px;
  margin-top: 22px;
}

.fitting-layout h2 {
  margin: 0 0 14px;
  color: #8ea1ba;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.module-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(101, 150, 194, 0.2);
}

.module-card div { display: grid; gap: 4px; }
.module-card span,
.fitting-layout p { color: #8295ac; font-size: 10px; }
.module-card button,
.fitting-layout > section > button {
  padding: 8px 11px;
  border: 1px solid #57e5c2;
  border-radius: 3px;
  color: #04130f;
  background: #57e5c2;
  cursor: pointer;
  font-weight: 700;
}
.module-card button:disabled,
.fitting-layout > section > button:disabled { cursor: not-allowed; opacity: 0.42; }

.fitting-slot {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #8295ac;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.fitting-slot select {
  padding: 10px;
  border: 1px solid #334b64;
  border-radius: 3px;
  color: #eaf5ff;
  background: #050c19;
}

.fitting-budget {
  display: flex;
  justify-content: space-between;
  margin: 16px 0;
  color: #57e5c2;
  font-size: 11px;
}
.fitting-budget .exceeded { color: #ff7588; }
.fitting-feedback { color: #b9fff9 !important; }

.market-list { display: grid; gap: 10px; margin-top: 16px; }
.market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(101, 150, 194, 0.2);
}
.market-row > div:first-child { display: grid; gap: 4px; }
.market-row span { color: #8295ac; font-size: 10px; }
.market-row input {
  box-sizing: border-box;
  width: 72px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid #334b64;
  border-radius: 3px;
  color: #eaf5ff;
  background: #050c19;
}
.market-row .panel-action-row { grid-column: 1 / -1; margin-top: 0; }

.contraband-notice {
  padding: 10px 12px;
  border-left: 3px solid #ff4fe1;
  color: #eab6e2;
  background: rgba(74, 8, 63, 0.34);
  font-size: 11px;
  line-height: 1.45;
}

.contraband-row { border-color: rgba(255, 79, 225, 0.28); }
.contraband-row .panel-action-row button { border-color: #ff4fe1; color: #ffd5f8; background: rgba(69, 9, 61, 0.72); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.controls-panel p {
  margin: 3px 0;
  color: #8294aa;
}

kbd {
  color: #e5f3ff;
  font-family: inherit;
}

.weapon-mode {
  display: inline-block;
  margin-top: 7px;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.weapon-mode.combat { color: #ff667c; }
.weapon-mode.mining { color: #52efe4; }

.mining-target {
  display: block;
  margin-top: 5px;
  color: #71849a;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.mining-target.locked {
  color: #b9fff9;
  text-shadow: 0 0 8px rgba(82, 239, 228, 0.45);
}

.sensor-scan-button {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  border: 1px solid rgba(103, 220, 255, 0.62);
  color: #bfefff;
  background: rgba(8, 42, 61, 0.78);
  font: inherit;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.sensor-scan-button.active,
.touch-utility.sensor-scan.active {
  border-color: #70f4dc;
  color: #dcfff8;
  box-shadow: 0 0 18px rgba(82, 239, 228, 0.28);
}

.sensor-scan-button:disabled,
.touch-utility.sensor-scan:disabled {
  cursor: default;
  opacity: 0.48;
}

.sensor-scan-status {
  display: block;
  margin-top: 5px;
  color: #75a8c4;
  font-size: 8px;
  letter-spacing: 0.08em;
}

.module-card small {
  color: #72b6c9;
  font-size: 9px;
}

.boundary-warning {
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 12;
  transform: translateX(-50%);
  padding: 9px 14px;
  border: 1px solid rgba(255, 78, 104, 0.7);
  color: #ff7186;
  background: rgba(37, 6, 14, 0.8);
  font-size: 10px;
}

.contraband-warning {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 13;
  padding: 8px 12px;
  border: 1px solid rgba(255, 79, 225, 0.72);
  color: #ffd5f8;
  background: rgba(57, 5, 50, 0.88);
  box-shadow: 0 0 18px rgba(255, 79, 225, 0.16);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.1em;
  white-space: nowrap;
  pointer-events: none;
}

.sensor-collision-warning {
  position: absolute;
  top: 62px;
  left: 50%;
  z-index: 13;
  transform: translateX(-50%);
  padding: 9px 14px;
  border: 1px solid rgba(255, 79, 104, 0.82);
  color: #ffe3e8;
  background: rgba(54, 5, 16, 0.9);
  box-shadow: 0 0 24px rgba(255, 79, 104, 0.24);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  white-space: nowrap;
  pointer-events: none;
  animation: sentry-pulse 550ms ease-in-out infinite alternate;
}

.sentry-warning {
  position: absolute;
  top: 78px;
  left: 50%;
  z-index: 13;
  transform: translateX(-50%);
  padding: 10px 16px;
  border: 1px solid rgba(255, 52, 85, 0.82);
  color: #ffd7de;
  background: rgba(48, 3, 13, 0.88);
  box-shadow: 0 0 22px rgba(255, 52, 85, 0.22);
  font-size: 10px;
  letter-spacing: 0.12em;
  animation: sentry-pulse 700ms ease-in-out infinite alternate;
}

.sentry-warning.sensor-offset { top: 104px; }

@keyframes sentry-pulse {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

.death-overlay {
  color: #ff6c7f;
  pointer-events: none;
}

.death-overlay strong,
.death-overlay span {
  position: absolute;
}

.death-overlay strong {
  margin-top: -30px;
  font-size: 24px;
  letter-spacing: 0.16em;
}

.death-overlay span {
  margin-top: 34px;
  color: #d7dfeb;
}

@media (max-width: 900px) {
  .status-panel { width: 220px; }
  .controls-panel { max-width: 330px; }
  .cargo-panel { width: 190px; }
  .law-panel { right: 20px; width: 190px; }
  .station-panel { bottom: 118px; width: 350px; }
  .fitting-layout { grid-template-columns: 1fr; }
}

.mobile-hud,
.mobile-controls,
.orientation-gate {
  display: none;
}

.touch-game .desktop-hud {
  display: none;
}

.touch-game .mobile-hud {
  display: grid;
}

.touch-game .mobile-controls {
  display: block;
}

.mobile-hud {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 18;
  grid-template-columns: repeat(4, minmax(48px, 66px)) minmax(92px, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: calc(54px + env(safe-area-inset-top));
  padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 6px calc(8px + env(safe-area-inset-left));
  border-bottom: 1px solid rgba(101, 150, 194, 0.34);
  background: rgba(3, 9, 20, 0.88);
  backdrop-filter: blur(7px);
}

.mobile-vital {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 5px;
  min-width: 0;
  color: #8295ac;
  font-size: 8px;
  letter-spacing: 0.08em;
}

.mobile-vital strong {
  color: #dcecff;
  font-size: 9px;
}

.mobile-vital i {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  background: #101b2a;
}

.mobile-vital b {
  display: block;
  height: 100%;
}

.mobile-vital.shield b { background: #48d8ff; }
.mobile-vital.hull b { background: #ff6377; }
.mobile-vital.flight b { background: #53f2c5; }
.mobile-vital.flux b { background: #58cfff; }

.mobile-telemetry {
  display: grid;
  gap: 3px;
  justify-items: end;
  color: #d7e5f5;
  font-size: 9px;
}

.mobile-telemetry strong {
  font-size: 8px;
  letter-spacing: 0.06em;
}

.mobile-surface-mode {
  position: absolute;
  top: calc(58px + env(safe-area-inset-top));
  left: 50%;
  margin: 0;
  padding: 4px 9px;
  transform: translateX(-50%);
  border: 1px solid rgba(83, 242, 197, 0.44);
  background: rgba(3, 13, 24, 0.84);
  color: #76fbd7;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
}

.mobile-header-actions {
  display: flex;
  gap: 5px;
}

.mobile-menu-button,
.mobile-fullscreen-button {
  width: 44px;
  height: 44px;
  border: 1px solid #49617a;
  border-radius: 50%;
  color: #dcecff;
  background: rgba(7, 17, 31, 0.92);
  cursor: pointer;
  font-size: 19px;
}

.mobile-fullscreen-button {
  border-color: rgba(87, 229, 194, 0.58);
  color: #9fffe7;
}

.fullscreen-fallback {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(87, 229, 194, 0.34);
  color: #b8c9da;
  background: rgba(5, 20, 29, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.mobile-controls {
  position: absolute;
  inset: 0;
  z-index: 16;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-joystick {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: calc(12px + env(safe-area-inset-left));
  width: 116px;
  height: 116px;
  border: 1px solid rgba(102, 180, 218, 0.46);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 35, 58, 0.66), rgba(3, 9, 20, 0.45));
  box-shadow: inset 0 0 24px rgba(80, 215, 255, 0.08);
  pointer-events: auto;
  touch-action: none;
}

.joystick-axis {
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(112, 168, 205, 0.22);
  transform: translate(-50%, -50%);
}

.joystick-axis.horizontal { width: 76%; height: 1px; }
.joystick-axis.vertical { width: 1px; height: 76%; }

.joystick-direction {
  position: absolute;
  color: rgba(155, 218, 244, 0.72);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.joystick-direction.north { top: 7px; left: 50%; transform: translateX(-50%); }
.joystick-direction.east { top: 50%; right: 7px; transform: translateY(-50%); }
.joystick-direction.south { bottom: 7px; left: 50%; transform: translateX(-50%); }
.joystick-direction.west { top: 50%; left: 7px; transform: translateY(-50%); }

.touch-joystick i {
  position: absolute;
  top: calc(50% - 23px);
  left: calc(50% - 23px);
  width: 46px;
  height: 46px;
  border: 1px solid #65d8ff;
  border-radius: 50%;
  background: rgba(23, 79, 107, 0.82);
  box-shadow: 0 0 14px rgba(80, 215, 255, 0.2);
}

.touch-action-cluster {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 54px 78px;
  grid-template-rows: 50px 78px;
  gap: 7px;
  align-items: end;
  pointer-events: auto;
}

.touch-button,
.touch-brake-button,
.touch-utility,
.touch-station-action {
  border: 1px solid rgba(87, 229, 194, 0.58);
  color: #d8fffa;
  background: rgba(7, 34, 38, 0.78);
  cursor: pointer;
  font: inherit;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.07em;
  touch-action: none;
}

.touch-brake-button {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: calc(136px + env(safe-area-inset-left));
  width: 62px;
  min-height: 48px;
  border-color: rgba(255, 190, 95, 0.7);
  border-radius: 50%;
  color: #fff0cf;
  background: rgba(72, 43, 12, 0.76);
  pointer-events: auto;
}

.touch-station-action.contraband {
  border-color: rgba(255, 79, 225, 0.8);
  color: #ffd5f8;
  background: rgba(69, 9, 61, 0.82);
  box-shadow: 0 0 18px rgba(255, 79, 225, 0.2);
}

.touch-brake-button:active {
  border-color: #ffd27a;
  background: rgba(118, 67, 14, 0.9);
}

.touch-brake-button:disabled,
.touch-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.touch-button {
  min-width: 50px;
  min-height: 50px;
  border-radius: 50%;
}

.touch-button.primary {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 78px;
  height: 78px;
  align-self: end;
  border-color: #ff667c;
  color: #ffe5e9;
  background: rgba(83, 14, 30, 0.76);
  box-shadow: 0 0 18px rgba(255, 102, 124, 0.16);
}

.touch-button.mode { grid-column: 1; grid-row: 1; }
.touch-button.hyperdrive { grid-column: 1; grid-row: 2; }

.touch-utility-cluster {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.touch-utility {
  min-width: 58px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 3px;
}

.touch-utility.power.online {
  border-color: #ff7588;
  color: #ffd4da;
  background: rgba(75, 18, 30, 0.65);
}

.touch-utility.power:disabled { opacity: 0.55; }

.touch-utility.sensor-scan {
  border-color: rgba(103, 220, 255, 0.62);
  color: #c8f3ff;
  background: rgba(8, 42, 61, 0.78);
}

.touch-station-action {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 50%;
  min-width: 176px;
  min-height: 46px;
  padding: 9px 12px;
  transform: translateX(-50%);
  border-radius: 3px;
  pointer-events: auto;
}

.orientation-gate {
  position: absolute;
  inset: 0;
  z-index: 100;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: max(28px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  color: #dcecff;
  background: radial-gradient(circle at center, rgba(11, 31, 54, 0.98), rgba(2, 7, 16, 0.99));
  text-align: center;
}

.orientation-gate div {
  color: #57e5c2;
  font-size: 58px;
  line-height: 1;
}

.orientation-gate strong {
  font-size: 18px;
  letter-spacing: 0.14em;
}

.orientation-gate span {
  max-width: 360px;
  color: #91a1b8;
  line-height: 1.5;
}

.touch-game .boundary-warning { top: calc(62px + env(safe-area-inset-top)); }
.touch-game .contraband-warning {
  top: calc(62px + env(safe-area-inset-top));
  right: calc(8px + env(safe-area-inset-right));
  max-width: 45vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.touch-game .sensor-collision-warning { top: calc(90px + env(safe-area-inset-top)); }
.touch-game .sentry-warning { top: calc(108px + env(safe-area-inset-top)); }
.touch-game .sentry-warning.sensor-offset { top: calc(136px + env(safe-area-inset-top)); }

.touch-game .game-panel-shell {
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
}

.touch-game .game-panel-heading {
  min-height: 44px;
}

.touch-game .game-panel-heading button,
.touch-game .game-panel-tabs button,
.touch-game .module-card button,
.touch-game .fitting-layout > section > button,
.touch-game .fitting-slot select {
  min-height: 44px;
}

.touch-game .game-panel-content {
  flex: 1;
}

.touch-game .fitting-layout {
  margin-top: 14px;
}

.touch-game .fitting-layout h2 {
  margin-bottom: 8px;
}

.touch-game .module-card {
  min-height: 54px;
  padding: 7px 0;
}

.portrait-blocked .orientation-gate {
  display: grid;
}

@media (max-width: 520px), (max-height: 620px) {
  .join-overlay {
    align-items: start;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .join-card {
    width: min(420px, 100%);
    padding: 22px;
  }

  .join-copy {
    margin-bottom: 18px;
  }
}

@media (orientation: landscape) and (hover: none),
  (orientation: landscape) and (pointer: coarse) {
  .mobile-hud,
  .mobile-controls {
    display: grid;
  }
}

@media (max-width: 720px) and (orientation: landscape) {
  .mobile-hud {
    grid-template-columns: repeat(4, minmax(40px, 56px)) minmax(78px, 1fr) auto;
    gap: 5px;
  }

  .touch-joystick {
    width: 108px;
    height: 108px;
  }

  .touch-brake-button {
    left: calc(128px + env(safe-area-inset-left));
  }

  .touch-utility-cluster {
    top: calc(60px + env(safe-area-inset-top));
  }

  .game-panel-tabs {
    margin: 10px 0;
  }

  .panel-action-row {
    margin-top: 14px;
  }
}

/* Alpha universe: shared desktop/touch surfaces and persistent danger priority. */
:root { --ui-scale: 1; }
.universe-panel { font-size: calc(14px * var(--ui-scale)); line-height: 1.5; color: #dbe8ee; }
.universe-panel p, .universe-panel small { color: #b1c5ce; }
.universe-panel button, .universe-panel input, .universe-panel select { min-height: 44px; font: inherit; }
.universe-panel button { color: #d6fff4; background: #10272e; border: 1px solid #34616a; border-radius: 8px; padding: 10px 14px; cursor: pointer; }
.universe-panel button:disabled { opacity: .45; cursor: default; }
.universe-panel button.selected { border-color: #53f2c5; background: #193e42; }
.universe-panel input, .universe-panel select { color: #edf9ff; background: #08171f; border: 1px solid #436570; border-radius: 6px; padding: 8px; min-width: 0; }
.system-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.system-cards button { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.galaxy-map { display: flex; justify-content: space-around; align-items: center; padding: 24px 8px; border: 1px solid #28414e; background: radial-gradient(ellipse at center,#172c3f,#071018); border-radius: 12px; }
.destination-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 12px 0; }
.destination-list button { display:flex; justify-content:space-between; gap:8px; text-align:left; }
.contract-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 1px solid #304c5d; border-radius: 10px; margin: 10px 0; padding: 14px; }
.contract-card strong { flex-basis: 100%; }
.fleet-member { display:flex; flex-wrap:wrap; gap:8px; align-items:center; border-bottom:1px solid #2a414b; padding:8px 0; }
.inline-form { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0; }
.inline-form label { flex-basis:100%; }
.inline-form input { flex:1; }
.setting-row { display:flex; flex-wrap:wrap; align-items:center; gap:16px; min-height:52px; }
.setting-row input[type=checkbox] { width:24px; }
.chat-history { max-height:220px; overflow:auto; border:1px solid #2c4651; border-radius:8px; padding:12px; overflow-wrap:anywhere; }
.chat-history article { border-bottom:1px solid #2c4651; padding:8px 0; }
.chat-history p { margin:4px 0; }
.universe-shortcuts { position:absolute; top:12px; left:50%; transform:translateX(-50%); display:flex; gap:6px; align-items:center; z-index:15; }
.universe-shortcuts span { color:#91c6bf; font-size:12px; padding:0 10px; }
.universe-shortcuts button { min-height:44px; min-width:44px; background:#0a2029e8; border:1px solid #34535e; color:#bdfce6; border-radius:7px; padding:8px 12px; cursor:pointer; }
.flight-companion { position:absolute; bottom:100px; left:50%; transform:translateX(-50%); z-index:16; width:min(460px,40vw); pointer-events:none; text-align:center; color:#e0f8f0; font-size:12px; }
.flight-companion button { pointer-events:auto; min-height:44px; min-width:44px; color:#d1fff0; background:#0c303b; border:1px solid #488d87; border-radius:8px; padding:8px; }
.flight-companion p { margin:6px 0; padding:8px; background:#06121cdb; border:1px solid #244b56; border-radius:8px; }
.navigation-target { display:flex; align-items:center; justify-content:center; gap:8px; }
.navigation-target b { display:inline-block; color:#6bffcf; font-size:22px; }
.tutorial-tip { font-size:calc(12px * var(--ui-scale)); line-height:1.4; }
.jump-action { width:100%; }
.command-toast { position:absolute; left:50%; bottom:22px; transform:translateX(-50%); max-width:80%; z-index:65; color:#ceffee; background:#123b36f2; border:1px solid #4d9b84; border-radius:8px; padding:12px 20px; font-size:14px; pointer-events:none; }
.reconnection-status { position:absolute; top:12px; left:50%; transform:translateX(-50%); z-index:70; max-width:85%; padding:12px; color:#ffe1ab; background:#33291eef; }
.latency-indicator { position:absolute; bottom:7px; left:12px; font-size:11px; color:#829fa9; z-index:16; }
.flight-alerts { position:absolute; top:66px; left:50%; transform:translateX(-50%); z-index:45; display:flex; flex-direction:column; gap:5px; width:min(480px,45vw); pointer-events:none; }
.flight-alerts > div { position:static !important; transform:none !important; max-width:none !important; width:auto !important; margin:0; white-space:normal !important; font-size:12px; text-align:center; padding:8px 10px; }
.death-overlay { z-index:60 !important; }
.panel-safety { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; color:#e8cc91; padding:10px 0; font-size:13px; }
.panel-safety button { min-height:44px; color:#b7f3da; background:#183337; border:1px solid #42756e; border-radius:6px; }
.game-panel-content { font-size:calc(14px * var(--ui-scale)); }
.game-panel-content small, .game-panel-content p { font-size:inherit; line-height:1.45; }
.game-panel-nav { flex-wrap:wrap; }
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
@media (max-width: 840px) {
  .system-cards { grid-template-columns:1fr; }
  .system-cards button { flex-direction:row; flex-wrap:wrap; align-items:center; }
  .system-cards small { flex-basis:100%; }
  .destination-list { grid-template-columns:1fr; }
  .galaxy-map { font-size:12px; padding:16px 4px; }
  .contract-card { padding:10px; }
}
.touch-game .universe-shortcuts { display:none; }
.touch-game .flight-companion { width:calc(100% - 320px); max-width:350px; bottom:70px; font-size:12px; }
.touch-game .flight-companion .tutorial-tip { padding:6px; }
.touch-game .flight-alerts { top:63px; width:calc(100% - 290px); max-width:430px; }
.touch-game .flight-alerts > div { padding:6px; font-size:12px; }
.touch-game .command-toast { bottom:8px; font-size:12px; padding:8px 12px; }
.touch-game .game-panel-overlay { padding-top:65px; }
.touch-game .mobile-vital { font-size:11px; }
.touch-game .mobile-vital strong { font-size:12px; }
.touch-game .mobile-telemetry, .touch-game .mobile-status { font-size:12px; }
.touch-game .game-panel-content { font-size:calc(14px * var(--ui-scale)); }
.touch-game .navigation-target { flex-wrap:wrap; font-size:12px; padding:4px; }
.touch-game .latency-indicator { bottom:auto; top:48px; left:10px; font-size:10px; }
.game-panel-heading button, .game-panel-tabs button { min-width:44px; min-height:44px; }
.sector-chart { display:block; width:100%; height:300px; border:1px solid #304855; border-radius:12px; background:radial-gradient(ellipse,#101f38,#040811); }
.map-controls { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:12px 0; }
.map-controls button { min-width:44px; }
.touch-game .sector-chart { height: max(140px, calc(100dvh - 210px)); }
.touch-game .sector-chart text { font-size: calc(6000px / var(--map-zoom, 1)); }
