:root {
  color-scheme: dark;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: #05070f;
  color: #e4ecff;
  --panel: rgba(14, 19, 34, 0.96);
  --panel-strong: rgba(18, 26, 46, 0.98);
  --panel-border: rgba(90, 120, 190, 0.35);
  --accent: #4fd1ff;
  --accent-strong: #7be0ff;
  --accent-soft: rgba(79, 209, 255, 0.2);
  --text-muted: #9fb1e6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: #05070f;
}

.hidden {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.overlay.hidden {
  display: none;
}

.map-overlay {
  z-index: 8;
}

.mission-log-overlay {
  z-index: 9;
}

.pause-menu-overlay {
  z-index: 11;
}

.pause-menu-card {
  width: min(420px, 92vw);
  background:
    radial-gradient(circle at top right, rgba(79, 209, 255, 0.16), transparent 40%),
    linear-gradient(160deg, rgba(18, 28, 52, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 26px 80px rgba(4, 8, 20, 0.7);
}

.pause-menu-card h2 {
  margin: 0;
  font-size: 28px;
}

.pause-menu-card .hud-hint {
  margin: 0;
  font-size: 13px;
}

.pause-menu-actions {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.pause-menu-actions button {
  width: 100%;
}

.pause-menu-danger {
  border-color: rgba(255, 120, 120, 0.55);
  background: linear-gradient(160deg, rgba(110, 32, 46, 0.95), rgba(54, 16, 24, 0.98));
}

.pause-menu-danger:hover {
  border-color: rgba(255, 170, 170, 0.75);
}

.login-card {
  position: relative;
  width: min(480px, 94vw);
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(79, 209, 255, 0.2), transparent 38%),
    linear-gradient(160deg, rgba(18, 29, 54, 0.98), rgba(7, 12, 22, 0.98));
  border: 1px solid rgba(102, 144, 220, 0.4);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 28px 90px rgba(4, 8, 20, 0.72);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(123, 224, 255, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%);
  pointer-events: none;
}

.login-card > * {
  position: relative;
  z-index: 1;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(79, 209, 255, 0.12);
  border: 1px solid rgba(79, 209, 255, 0.2);
  color: #c9efff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h2 {
  margin: 0;
  font-size: clamp(28px, 4.4vw, 34px);
  letter-spacing: 0.02em;
}

#loginStatusText {
  margin: 12px 0 0;
  color: #c9d5f6;
  font-size: 14px;
  line-height: 1.7;
}

.login-auth-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 22px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card input {
  background: rgba(8, 14, 28, 0.9);
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  color: #e4ecff;
  font-size: 14px;
}

.login-card input:focus {
  outline: none;
  border-color: rgba(123, 224, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(79, 209, 255, 0.14);
}

.login-card label {
  color: #bfd0fb;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card button {
  align-self: flex-start;
}

.login-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.login-federated {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(13, 23, 43, 0.96), rgba(9, 15, 28, 0.92));
  border: 1px solid rgba(90, 120, 190, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-panel-label {
  color: #d9e8ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-panel-copy {
  margin: 0;
  color: #aebfe6;
  font-size: 13px;
  line-height: 1.6;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(90, 120, 190, 0.35);
}

#googleSignIn {
  display: flex;
  justify-content: center;
}

.login-error-slot {
  min-height: 18px;
  color: #ffb5b5;
}

.pilot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pilot-chip {
  background: rgba(20, 30, 54, 0.9);
  border: 1px solid rgba(90, 120, 190, 0.35);
  color: #d4e0ff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.pilot-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.pilot-entry button {
  width: 100%;
}

.error {
  color: #ff9b9b;
  margin: 0;
}

.cockpit {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#flightCanvas {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 100%;
  display: block;
  background: radial-gradient(circle at top, #111a31, #02030a 70%);
}

#flightCanvas:focus {
  outline: none;
}

.map-card {
  width: min(860px, 92vw);
  max-height: 86vh;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(18, 28, 52, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 26px 80px rgba(4, 8, 20, 0.7);
}

.mission-log-card {
  width: min(520px, 92vw);
  max-height: 80vh;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(18, 28, 52, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 26px 80px rgba(4, 8, 20, 0.7);
}

.mission-log-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mission-log-section h3 {
  margin: 0;
  font-size: 14px;
  color: #d5defc;
}

.boarding-card {
  width: min(520px, 92vw);
  max-height: 80vh;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(18, 28, 52, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 26px 80px rgba(4, 8, 20, 0.7);
}

.boarding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.boarding-header h2 {
  margin: 0 0 6px;
}

.boarding-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mission-log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mission-log-header h2 {
  margin: 0 0 6px;
}

.mission-log-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.mission-log-section .list {
  max-height: 24vh;
  overflow-y: auto;
  padding-right: 6px;
}

.mission-log-empty {
  color: #9fb1e6;
  font-size: 13px;
  margin: 0;
}

.comms-overlay {
  z-index: 9;
}

.comms-card {
  width: min(560px, 92vw);
  max-height: 82vh;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(18, 28, 52, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 26px 80px rgba(4, 8, 20, 0.7);
}

.comms-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.comms-header h2 {
  margin: 0 0 6px;
}

.comms-card .list {
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 6px;
}

.comms-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comms-message span {
  font-size: 12px;
  color: var(--text-muted);
}

.comms-message p {
  margin: 0;
}

.comms-message.outgoing p {
  color: #e4ecff;
}

.comms-message.incoming p {
  color: #9fd6ff;
}

.comms-input {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.comms-input input {
  flex: 1;
  min-width: 220px;
  background: rgba(8, 14, 28, 0.9);
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  color: #e4ecff;
  font-size: 14px;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.map-header h2 {
  margin: 0 0 6px;
}

.map-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

#mapCanvas {
  width: 100%;
  height: min(520px, 52vh);
  border-radius: 14px;
  border: 1px solid #1e2a4d;
  background: radial-gradient(circle at top, #101c3c, #05070f 70%);
  cursor: grab;
}

#mapCanvas.is-panning {
  cursor: grabbing;
}

.map-footer {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.map-footer h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.map-route {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #d0dcff;
  display: grid;
  gap: 6px;
}

.map-details {
  min-width: 220px;
  flex: 1;
}

.map-details-content {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #d7e3ff;
}

.map-details-content .map-detail-card {
  background: rgba(10, 18, 40, 0.65);
  border: 1px solid rgba(90, 120, 190, 0.35);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.map-details-content h4 {
  margin: 0;
  font-size: 14px;
  color: #f0f5ff;
}

.map-details-content p {
  margin: 0;
  color: #cbd8ff;
}

.map-actions {
  display: grid;
  gap: 10px;
  align-content: start;
}

.hud {
  width: min(380px, 36vw);
  min-width: 300px;
  background: linear-gradient(180deg, rgba(9, 13, 24, 0.98), rgba(6, 8, 16, 0.98));
  border-left: 1px solid rgba(90, 120, 190, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 12px 10px;
  overflow: hidden;
}

.hud-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(90, 120, 190, 0.4);
  background: linear-gradient(160deg, rgba(20, 30, 54, 0.98), rgba(8, 12, 22, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hud-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

body.docked-mode .hud-scroll {
  scroll-behavior: auto;
}

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

.hud-header h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.02em;
}

.hud-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-weight: 600;
  font-size: 11px;
  color: #cfe5ff;
}

.status span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(8, 14, 28, 0.8);
  border: 1px solid rgba(79, 125, 190, 0.24);
}

.hud-section {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(90, 120, 190, 0.3);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(160deg, rgba(18, 24, 42, 0.95), rgba(8, 12, 22, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hud-section--map .mini-map {
  height: 180px;
}

.hud-section--log {
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.hud-section--split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#dockedPanel {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  z-index: 1;
  flex-shrink: 0;
  align-self: stretch;
  pointer-events: auto;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(20, 30, 54, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(90, 120, 190, 0.45);
  box-shadow: 0 26px 70px rgba(2, 6, 16, 0.7);
}

#dockedPanel.hidden {
  display: none;
}

body.docked-mode #dockedPanel {
  order: -10;
}

.docked-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.docked-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.docked-menu button {
  width: 100%;
  text-align: left;
}

.docked-menu button.active {
  border-color: rgba(90, 160, 255, 0.8);
  box-shadow: 0 0 18px rgba(79, 209, 255, 0.3);
}

.docked-section {
  margin-top: 14px;
}

.docked-modal {
  z-index: 12;
}

.docked-modal-card {
  width: min(760px, 92vw);
  max-height: 82vh;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(18, 28, 52, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 26px 80px rgba(4, 8, 20, 0.7);
}

.docked-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.docked-modal-header h3 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cfe4ff;
}

.docked-modal-header button {
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
}

.docked-modal-body {
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.docked-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hud-section h2 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cfe4ff;
}

.hud-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.hud-section-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(79, 209, 255, 0.1);
  border: 1px solid rgba(79, 209, 255, 0.2);
  color: #9fdcff;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-section.hidden {
  display: none;
}

.hud-subsection {
  margin-top: 14px;
}

.hud-subsection h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.hud-hint {
  color: #7f95c9;
  font-size: 10px;
  margin: 6px 0 0;
  line-height: 1.4;
}

.hud-emphasis {
  color: #8be7ff;
  font-size: 12px;
  margin: 4px 0 0;
}

.hud-list {
  display: grid;
  gap: 6px;
  font-size: 11px;
  line-height: 1.45;
}

.hud-list span {
  display: block;
  color: #c8d9ff;
}

.target-card {
  display: grid;
  gap: 8px;
}

.target-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.target-heading {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.target-heading strong,
.target-ship-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-ship-name {
  color: #9fb1e6;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.target-status {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(79, 209, 255, 0.12);
  border: 1px solid rgba(79, 209, 255, 0.24);
  color: #bdeeff;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.target-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #9fb1e6;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.target-meter {
  display: grid;
  gap: 4px;
}

.target-meter-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #bfd0fb;
  font-size: 10px;
}

.target-meter-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(8, 14, 28, 0.9);
  border: 1px solid rgba(79, 125, 190, 0.32);
  overflow: hidden;
}

.target-meter-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 120ms linear;
}

.target-meter-shield {
  background: linear-gradient(90deg, #4fd1ff, #8ce9ff);
}

.target-meter-hull {
  background: linear-gradient(90deg, #ff9b78, #ffd46d);
}

.hud-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.hud-control {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(8, 14, 28, 0.75);
  border: 1px solid rgba(79, 125, 190, 0.22);
  color: #c8d9ff;
  font-size: 10px;
}

.hud-control span {
  line-height: 1.35;
}

.hud-control kbd {
  min-width: 38px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(16, 28, 52, 0.95);
  border: 1px solid rgba(123, 224, 255, 0.22);
  color: #dff6ff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
}

.mini-map {
  width: 100%;
  height: 150px;
  border-radius: 10px;
  border: 1px solid rgba(90, 120, 190, 0.35);
  background: radial-gradient(circle at center, #0e1730, #070b18 70%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 18px 42px rgba(79, 125, 190, 0.08);
  display: block;
}

.ship-bars {
  display: grid;
  gap: 8px;
  margin: 6px 0 2px;
}

.ship-bar {
  display: grid;
  gap: 6px;
}

.ship-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #b6c4ea;
}

.ship-bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(10, 18, 36, 0.9);
  border: 1px solid rgba(79, 125, 190, 0.35);
  overflow: hidden;
}

.ship-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.ship-bar-fill--shield {
  background: linear-gradient(90deg, #58c4ff, #9be8ff);
  box-shadow: 0 0 10px rgba(101, 199, 255, 0.6);
}

.ship-bar-fill--armor {
  background: linear-gradient(90deg, #ffa94f, #ffd37a);
  box-shadow: 0 0 10px rgba(255, 187, 90, 0.5);
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

button {
  background: linear-gradient(160deg, rgba(32, 64, 110, 0.95), rgba(16, 28, 54, 0.98));
  border: 1px solid rgba(90, 160, 220, 0.5);
  color: #e4f6ff;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 18px rgba(5, 12, 28, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

button:hover {
  border-color: rgba(123, 224, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 24px rgba(5, 12, 28, 0.5);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  padding: 10px;
  border-radius: 12px;
  background: rgba(10, 16, 30, 0.88);
  border: 1px solid rgba(90, 120, 190, 0.35);
  font-size: 12px;
}

.list-item h4 {
  margin: 0 0 4px;
  font-size: 13px;
}

.list-item button {
  margin-top: 8px;
}

.trade-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.trade-qty {
  width: 64px;
  background: rgba(8, 14, 28, 0.9);
  border: 1px solid rgba(90, 120, 190, 0.4);
  border-radius: 10px;
  padding: 6px 8px;
  color: #e4ecff;
  font-size: 12px;
}

.mission-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 12px;
}

.mission-list .mission-item {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mission-list .mission-item.selected {
  border-color: #e5b35a;
  box-shadow: 0 0 0 1px rgba(229, 179, 90, 0.5);
}

.mission-detail {
  border-radius: 12px;
  border: 1px solid rgba(90, 120, 190, 0.4);
  background: rgba(8, 12, 22, 0.9);
  padding: 12px;
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #d9e7ff;
}

.mission-detail h4 {
  margin: 0;
  font-size: 14px;
  color: #e4f6ff;
}

.mission-detail p {
  margin: 0;
}

@media (max-width: 900px) {
  .mission-board {
    grid-template-columns: 1fr;
  }
}

.log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: #c3d9ff;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 900px) {
  .cockpit {
    flex-direction: column;
  }

  .map-card {
    padding: 16px;
  }

  .hud {
    width: 100%;
    min-width: 100%;
    border-left: none;
    border-top: 1px solid #1e2a4d;
    height: 42vh;
  }

  #flightCanvas {
    height: 58vh;
  }
}

@media (max-width: 1180px) {
  .hud-grid,
  .hud-controls-grid,
  .hud-section--split {
    grid-template-columns: minmax(0, 1fr);
  }
}

.system-chat-overlay {
  z-index: 8;
}

.system-chat-card {
  width: min(540px, 92vw);
  max-height: 70vh;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(18, 28, 52, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(60, 180, 120, 0.4);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 26px 80px rgba(4, 8, 20, 0.7);
}

.system-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.system-chat-header h2 {
  margin: 0 0 6px;
}

.system-chat-log {
  max-height: 40vh;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-chat-message {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.system-chat-message span {
  font-size: 11px;
  color: var(--text-muted);
}

.system-chat-message p {
  margin: 0;
  color: #a0f0c8;
}

.system-chat-message.self p {
  color: #e4ecff;
}

/* ─── PILLAR 1: Energy & Heat HUD ───────────────────────────────────────────── */
.energy-hud {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(6, 10, 22, 0.85);
  border: 1px solid rgba(70, 110, 190, 0.35);
  border-radius: 10px;
}

.energy-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.energy-label {
  width: 30px;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 9px;
  text-transform: uppercase;
}

.wep-label { color: #ff9b7a; }
.eng-label { color: #7adfff; }
.sys-label { color: #7affb2; }
.heat-label { color: #ffcc44; }

.energy-track {
  flex: 1;
  height: 5px;
  background: rgba(10, 16, 32, 0.9);
  border: 1px solid rgba(70, 100, 180, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.energy-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.15s ease;
}

.wep-fill { background: linear-gradient(90deg, #ff6a3d, #ff9b7a); box-shadow: 0 0 8px rgba(255, 130, 80, 0.5); }
.eng-fill { background: linear-gradient(90deg, #3db5ff, #7adfff); box-shadow: 0 0 8px rgba(80, 190, 255, 0.5); }
.sys-fill { background: linear-gradient(90deg, #3dff8a, #7affb2); box-shadow: 0 0 8px rgba(80, 255, 160, 0.5); }
.heat-fill { background: linear-gradient(90deg, #ff8c00, #ffcc44); box-shadow: 0 0 8px rgba(255, 180, 0, 0.5); }

.heat-row .energy-fill.danger {
  background: linear-gradient(90deg, #ff2200, #ff6600);
  box-shadow: 0 0 12px rgba(255, 60, 0, 0.8);
}

.energy-pct {
  width: 26px;
  font-size: 9px;
  color: #a0b8e0;
  text-align: right;
}

.cap-row {
  margin-top: 2px;
}

.cap-status {
  flex: 1;
  color: #8db0d8;
  font-size: 9px;
  width: auto;
}

/* ─── PILLAR 2: Cruise & Interdiction ─────────────────────────────────────── */
.hud-cruise {
  color: #7affb2;
}

.hud-cruise.active {
  color: #7adfff;
  text-shadow: 0 0 8px rgba(100, 220, 255, 0.7);
}

.hud-cruise.danger {
  color: #ffcc44;
  animation: blink 0.5s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0.3; }
}

.interdiction-overlay {
  z-index: 15;
  background: rgba(10, 5, 20, 0.92);
}

.interdiction-card {
  width: min(480px, 92vw);
  background: linear-gradient(160deg, rgba(40, 10, 10, 0.98), rgba(15, 5, 5, 0.98));
  border: 2px solid rgba(255, 80, 80, 0.6);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 0 40px rgba(255, 50, 50, 0.35), 0 24px 70px rgba(4, 2, 8, 0.7);
  animation: pulse-danger 1.5s ease-in-out infinite;
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 50, 50, 0.3), 0 24px 60px rgba(4, 2, 8, 0.7); }
  50% { box-shadow: 0 0 55px rgba(255, 60, 60, 0.6), 0 24px 70px rgba(4, 2, 8, 0.7); }
}

.interdiction-card h2 {
  margin: 0;
  color: #ff8080;
  text-align: center;
  font-size: 22px;
}

.interdiction-bar-wrap {
  width: 100%;
  height: 10px;
  background: rgba(20, 8, 8, 0.9);
  border: 1px solid rgba(255, 80, 80, 0.4);
  border-radius: 999px;
  overflow: hidden;
}

.interdiction-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff3030, #ff7a3d);
  border-radius: inherit;
  transition: width 0.1s linear;
  width: 100%;
  box-shadow: 0 0 10px rgba(255, 60, 40, 0.8);
}

.interdiction-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

#interdictionEvadeBtn {
  border-color: rgba(255, 200, 60, 0.7);
  color: #ffd37a;
  box-shadow: 0 0 14px rgba(255, 200, 50, 0.3);
}

.mission-log-card {
  width: min(960px, 94vw);
  max-height: 84vh;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(79, 209, 255, 0.15), transparent 38%),
    linear-gradient(160deg, rgba(16, 25, 46, 0.98), rgba(7, 11, 21, 0.99));
  border-color: rgba(100, 140, 214, 0.42);
}

.mission-log-header {
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(88, 116, 180, 0.26);
}

.mission-log-header h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
}

.mission-log-header p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: #a8badf;
}

.mission-log-section {
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 22, 40, 0.96), rgba(8, 13, 24, 0.96));
  border: 1px solid rgba(78, 108, 168, 0.26);
}

.mission-log-section h3 {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d8e6ff;
}

.mission-log-section .list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  max-height: 26vh;
  gap: 12px;
  padding-right: 4px;
}

#dockedPanel {
  width: 100%;
  max-width: none;
  max-height: none;
  padding: 20px;
  display: grid;
  gap: 18px;
  overflow: visible;
  overscroll-behavior: auto;
  scrollbar-gutter: auto;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(79, 209, 255, 0.16), transparent 38%),
    linear-gradient(160deg, rgba(17, 27, 48, 0.98), rgba(7, 11, 21, 0.99));
  border-color: rgba(100, 140, 214, 0.46);
}

.docked-header {
  align-items: flex-start;
  gap: 18px;
}

.docked-header-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.docked-header-copy h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 34px);
  letter-spacing: 0.02em;
}

.docked-header-copy .hud-hint {
  margin: 0;
  max-width: 54ch;
  font-size: 13px;
  line-height: 1.7;
  color: #aac0eb;
}

#dockedPanel .actions {
  margin-top: 0;
}

#dockedPanel .actions button {
  min-width: 120px;
}

.docked-station-summary {
  margin-top: 0;
}

.station-card {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(123, 224, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(15, 24, 42, 0.97), rgba(9, 14, 25, 0.97));
  border: 1px solid rgba(83, 114, 174, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 44px rgba(4, 8, 20, 0.44);
}

.station-card--cargo {
  background:
    radial-gradient(circle at top right, rgba(255, 190, 110, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(18, 24, 38, 0.97), rgba(9, 14, 25, 0.97));
}

.station-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.station-card-top strong {
  display: block;
  font-size: 18px;
  color: #eef7ff;
}

.station-card-top span {
  display: block;
  margin-top: 4px;
  color: #9db2dd;
  font-size: 12px;
  line-height: 1.6;
}

.station-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(79, 209, 255, 0.1);
  border: 1px solid rgba(79, 209, 255, 0.22);
  color: #bfefff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.station-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.station-card--cargo .station-meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.station-stat {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(7, 13, 24, 0.7);
  border: 1px solid rgba(77, 108, 166, 0.26);
}

.station-stat span {
  color: #8fa8da;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.station-stat strong {
  color: #ecf5ff;
  font-size: 17px;
}

.station-stat p {
  margin: 0;
  color: #9bb2de;
  font-size: 12px;
  line-height: 1.5;
}

.station-detail {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(7, 12, 22, 0.76);
  border: 1px solid rgba(77, 108, 166, 0.22);
  color: #c8d7f5;
  font-size: 12px;
  line-height: 1.6;
}

.station-detail--warning {
  color: #ffd0bf;
  background: rgba(68, 18, 18, 0.76);
  border-color: rgba(255, 138, 92, 0.32);
}

.docked-menu {
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.docked-menu button {
  min-height: 112px;
  padding: 16px 18px;
  display: grid;
  align-content: start;
  gap: 8px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(79, 209, 255, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(14, 21, 38, 0.98), rgba(8, 13, 24, 0.98));
  border: 1px solid rgba(82, 112, 170, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 16px 32px rgba(4, 8, 20, 0.34);
}

.docked-menu button.active {
  border-color: rgba(123, 224, 255, 0.64);
  box-shadow: 0 0 0 1px rgba(79, 209, 255, 0.22), 0 18px 36px rgba(4, 8, 20, 0.42);
}

.docked-service-label {
  color: #eff7ff;
  font-size: 15px;
  font-weight: 700;
}

.docked-service-copy {
  color: #9db2dd;
  font-size: 12px;
  line-height: 1.6;
}

.docked-modal-card {
  width: min(1120px, 94vw);
  max-height: 86vh;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(79, 209, 255, 0.14), transparent 36%),
    linear-gradient(160deg, rgba(16, 25, 46, 0.98), rgba(7, 11, 21, 0.99));
  border-color: rgba(100, 140, 214, 0.42);
}

.docked-modal-header {
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(88, 116, 180, 0.26);
}

.docked-modal-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.docked-modal-header h3 {
  font-size: clamp(22px, 3vw, 28px);
  text-transform: none;
  letter-spacing: 0.02em;
}

#dockedModalSubtitle {
  margin: 0;
  max-width: 56ch;
  font-size: 13px;
  line-height: 1.6;
  color: #a8badf;
}

.docked-modal-body {
  gap: 18px;
  padding-right: 6px;
}

.docked-section,
.hud-subsection {
  margin-top: 0;
}

.docked-section-header,
.service-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(88, 116, 180, 0.2);
}

.docked-section-header h3,
.service-section-head h3 {
  margin: 0;
  font-size: 20px;
}

.docked-section-header .hud-hint,
.service-section-head .hud-hint {
  font-size: 12px;
  color: #9db2dd;
}

.service-columns {
  display: grid;
  gap: 16px;
  align-items: start;
}

.service-columns--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.service-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 22, 40, 0.96), rgba(8, 13, 24, 0.96));
  border: 1px solid rgba(78, 108, 168, 0.26);
}

.service-panel-head {
  display: grid;
  gap: 4px;
}

.service-panel-head h4 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #dce9ff;
}

.service-panel .list {
  max-height: 54vh;
  overflow-y: auto;
  padding-right: 4px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.service-grid--trade {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.service-grid--ships {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.service-card {
  display: grid;
  align-content: start;
  gap: 10px;
  height: 100%;
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(123, 224, 255, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(8, 13, 24, 0.96));
  border: 1px solid rgba(80, 112, 172, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 32px rgba(4, 8, 20, 0.32);
}

.service-card--with-art {
  gap: 12px;
}

.service-card-media {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.96), rgba(7, 12, 22, 0.96));
  border: 1px solid rgba(90, 123, 188, 0.22);
}

.service-card-art-image,
.service-card-art-canvas {
  width: 100%;
  height: 120px;
  display: block;
  border-radius: inherit;
}

.service-card-art-image {
  object-fit: cover;
}

.service-card h4 {
  margin: 0;
  font-size: 15px;
  color: #eff7ff;
}

.service-card p {
  margin: 0;
  color: #afc3eb;
  line-height: 1.55;
}

.service-card .hud-hint {
  margin-top: 0;
  font-size: 11px;
}

.service-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.service-card-actions button {
  flex: 1 1 120px;
  margin-top: 0;
}

.service-card button {
  margin-top: 0;
}

.service-card--mission.selected,
.mission-list .mission-item.selected.service-card {
  border-color: rgba(255, 198, 102, 0.72);
  box-shadow:
    0 0 0 1px rgba(255, 198, 102, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 32px rgba(4, 8, 20, 0.4);
}

.trade-controls {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(80, 112, 172, 0.18);
}

.trade-controls button {
  flex: 1 1 100px;
}

.trade-qty {
  width: 76px;
}

.mission-board {
  gap: 16px;
  align-items: start;
}

.mission-list {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.mission-detail {
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 22, 40, 0.96), rgba(8, 13, 24, 0.96));
  border: 1px solid rgba(78, 108, 168, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mission-detail button {
  justify-self: start;
  margin-top: 8px;
}

.bar-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(255, 182, 92, 0.16), transparent 34%),
    linear-gradient(160deg, rgba(26, 20, 34, 0.96), rgba(11, 11, 22, 0.98));
  border: 1px solid rgba(134, 110, 168, 0.3);
}

.bar-hero-copy {
  display: grid;
  gap: 6px;
}

.bar-hero-copy h4 {
  margin: 0;
  font-size: 18px;
  color: #f4f6ff;
}

.bar-hero-copy p {
  margin: 0;
  max-width: 58ch;
  color: #b9bde1;
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 1080px) {
  .service-columns--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .docked-modal-card,
  .mission-log-card {
    width: min(96vw, 96vw);
    padding: 18px;
  }

  #dockedPanel {
    width: 100%;
    max-width: none;
    max-height: none;
    padding: 18px;
  }

  .docked-header,
  .docked-modal-header,
  .docked-section-header,
  .service-section-head,
  .bar-hero,
  .mission-log-header {
    flex-direction: column;
    align-items: stretch;
  }

  .docked-menu,
  .station-meta-grid,
  .station-card--cargo .station-meta-grid,
  .service-columns--two,
  .service-columns--three,
  .service-grid,
  .service-grid--trade,
  .service-grid--ships {
    grid-template-columns: minmax(0, 1fr);
  }

  .docked-menu button {
    min-height: 0;
  }
}


.hud-right {
  border-left: 1px solid rgba(90, 120, 190, 0.3);
  flex: 0 0 min(320px, 34vw);
}


@media (max-width: 1200px) {
  .hud-right {
    display: none;
  }
}
