﻿:root {
  color-scheme: dark;
  --bg: #080d16;
  --card: #101a2b;
  --card-border: #223552;
  --text: #ebf0f7;
  --muted: #9db0ce;
  --accent: #5f8fff;
  --accent-strong: #3a6ef2;
  --danger: #ff7373;
  --success: #67c98e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #11213b, var(--bg) 60%);
  color: var(--text);
}

a {
  color: #9fc0ff;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.card {
  width: min(96vw, 480px);
  background: rgba(16, 26, 43, 0.95);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.15rem 1.2rem;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.35);
}

.card h1,
.card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
}

.muted {
  color: var(--muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #2f4362;
  background: #0b1220;
  color: var(--text);
  padding: 0.58rem 0.68rem;
}

input:focus-visible {
  outline: 2px solid #6e9fff;
  outline-offset: 1px;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 0.58rem 0.78rem;
  background: #243958;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  background: #2b4570;
}

.btn.primary {
  background: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.message {
  margin: 0;
  border-radius: 8px;
  padding: 0.52rem 0.62rem;
  font-size: 0.9rem;
}

.message.error {
  background: rgba(255, 115, 115, 0.12);
  border: 1px solid rgba(255, 115, 115, 0.4);
  color: #ffd2d2;
}

.message.success {
  background: rgba(103, 201, 142, 0.12);
  border: 1px solid rgba(103, 201, 142, 0.45);
  color: #d9ffe7;
}

.top-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 2;
  padding: 0.55rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(5, 11, 22, 0.85);
  border-bottom: 1px solid #203656;
  backdrop-filter: blur(4px);
}

.top-nav .group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-pill {
  border: 1px solid #355688;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.77rem;
  color: #c9ddff;
}

.status-pill.good {
  border-color: rgba(103, 201, 142, 0.65);
  color: #dafbe7;
}

.status-pill.bad {
  border-color: rgba(255, 115, 115, 0.65);
  color: #ffd4d4;
}

.page-shell {
  min-height: 100vh;
  padding-top: 3.5rem;
}

.settings-panel {
  width: min(96vw, 560px);
  margin: 0 auto;
}

.game-layout {
  min-height: 100vh;
}

#game-canvas {
  width: 100%;
  height: calc(100vh - 3.5rem);
  display: block;
}

.context-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: stretch;
  z-index: 8;
  pointer-events: none;
}

.context-actions[hidden] {
  display: none !important;
}

.context-actions:not([hidden]) {
  pointer-events: auto;
}

.context-actions--floating {
  position: fixed;
  left: 50%;
  bottom: 1.35rem;
  transform: translateX(-50%);
  width: min(16rem, 72vw);
  z-index: 8;
}

.context-actions--embedded {
  position: static;
  transform: none;
  width: auto;
  margin: 0 0 0.15rem;
}

.context-action {
  margin: 0;
  border-radius: 8px;
  padding: 0.48rem 0.7rem;
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.context-action[hidden] {
  display: none !important;
}

.context-action--dock {
  border: 1px solid rgba(90, 210, 160, 0.55);
  background: linear-gradient(180deg, rgba(18, 48, 40, 0.94), rgba(8, 24, 20, 0.96));
  color: #d8ffe8;
}

.context-action--jump {
  border: 1px solid rgba(230, 150, 80, 0.6);
  background: linear-gradient(180deg, rgba(48, 28, 12, 0.94), rgba(24, 12, 6, 0.96));
  color: #ffe8d0;
}

.context-action--dock:hover,
.context-action--dock:focus-visible {
  border-color: rgba(120, 230, 180, 0.85);
  outline: none;
}

.context-action--jump:hover,
.context-action--jump:focus-visible {
  border-color: rgba(255, 180, 100, 0.85);
  outline: none;
}

.chat-panel {
  position: fixed;
  right: 0.85rem;
  bottom: 0.85rem;
  z-index: 9;
  width: min(320px, calc(100vw - 1.4rem));
  max-height: min(42vh, 360px);
  display: none;
  flex-direction: column;
  border: 1px solid rgba(70, 110, 90, 0.45);
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(10, 22, 18, 0.92), rgba(8, 14, 16, 0.94));
  color: #e6f0ea;
  font-family: "Sora", "Segoe UI", sans-serif;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.chat-panel.is-open {
  display: flex;
}

.chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid rgba(70, 110, 90, 0.35);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #9ecbb0;
}

.chat-panel__close {
  display: inline-block;
  border: 1px solid rgba(90, 140, 110, 0.45);
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  background: rgba(12, 28, 22, 0.85);
  color: #d8f0e0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-panel__close:hover,
.chat-panel__close:focus-visible {
  border-color: rgba(140, 200, 160, 0.75);
  outline: none;
}

.chat-panel__log {
  flex: 1 1 auto;
  min-height: 8rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.35;
}

.chat-panel__line {
  margin: 0 0 0.35rem;
  word-break: break-word;
}

.chat-panel__line .chat-alias {
  color: #c8f0d4;
  font-weight: 600;
}

.chat-panel__line .chat-meta {
  color: #7a9a88;
  font-size: 0.72rem;
}

.chat-panel__form {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem 0.55rem;
  border-top: 1px solid rgba(70, 110, 90, 0.35);
}

.chat-panel__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(70, 110, 90, 0.5);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  background: rgba(6, 14, 12, 0.85);
  color: #e6f0ea;
  font: inherit;
  font-size: 0.82rem;
}

.chat-panel__input:focus {
  outline: 1px solid rgba(120, 200, 150, 0.55);
  border-color: rgba(120, 200, 150, 0.55);
}

.dock-inline--jump {
  margin: 0 0 0.85rem;
}

.dock-pilots-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 3rem;
  margin-bottom: 0.35rem;
}

.dock-pilot-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid rgba(70, 110, 90, 0.35);
  border-radius: 6px;
  background: rgba(8, 18, 14, 0.65);
  font-size: 0.82rem;
}

.dock-overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: 3.5rem;
  bottom: 0;
  z-index: 7;
  overflow: auto;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(40, 70, 55, 0.45), transparent 45%),
    radial-gradient(ellipse at 80% 100%, rgba(30, 45, 40, 0.35), transparent 40%),
    linear-gradient(165deg, #0c1412 0%, #101816 38%, #0a1010 100%);
  color: #e6f0ea;
}

@media (max-width: 720px) {
  .chat-panel.is-open {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: calc(3.4rem + env(safe-area-inset-bottom, 0px));
    max-height: min(42vh, 280px);
    z-index: 14;
  }

  body:not(.panel-fly-open) .context-actions--floating {
    bottom: calc(3.6rem + env(safe-area-inset-bottom, 0px));
  }

  body.panel-chat-open .context-actions--floating {
    bottom: calc(42vh + 3.8rem);
  }

  body.is-docked .chat-panel.is-open {
    z-index: 16;
  }

  .chat-panel__close {
    display: inline-block;
  }
}

.mobile-tray {
  display: none;
}

.mobile-tray.is-active {
  position: fixed;
  left: 50%;
  bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 0.28rem;
  padding: 0.28rem;
  border: 1px solid rgba(70, 110, 140, 0.5);
  border-radius: 999px;
  background: rgba(6, 12, 22, 0.92);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.mobile-tray__btn {
  border: 0;
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  min-width: 3.1rem;
  background: transparent;
  color: #9db4d4;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.mobile-tray__btn[aria-pressed="true"] {
  background: rgba(70, 120, 190, 0.35);
  color: #e8f2ff;
}

.mobile-tray__btn:focus-visible {
  outline: 1px solid rgba(140, 180, 230, 0.8);
}

.dock-overlay__inner {
  width: min(1100px, 96vw);
  margin: 0 auto;
  padding: 1.1rem 0.85rem 2rem;
}

.dock-overlay__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.55rem;
}

.dock-overlay__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8fbba0;
}

.dock-overlay__header h2 {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 700;
  color: #f2fff7;
}

.dock-credits {
  margin: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(120, 180, 140, 0.35);
  border-radius: 8px;
  background: rgba(12, 28, 22, 0.75);
  font-size: 0.88rem;
  font-weight: 600;
  color: #c8f0d4;
  white-space: nowrap;
}

.dock-status {
  margin: 0 0 0.85rem;
  min-height: 1.2em;
  font-size: 0.86rem;
  color: #a8c4b4;
}

.dock-status.is-error {
  color: #ff9a8a;
}

.dock-status.is-success {
  color: #9eecc0;
}

.dock-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.dock-card {
  border: 1px solid rgba(70, 110, 90, 0.45);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  background: rgba(10, 22, 18, 0.72);
}

.dock-card--market {
  grid-column: 1 / -1;
}

.dock-card h3 {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  color: #d8efe0;
}

.dock-card label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: #a8c4b4;
}

.dock-card select,
.dock-card input {
  width: 100%;
  margin-top: 0.2rem;
  border-radius: 7px;
  border: 1px solid #2f4a3c;
  background: #0a1410;
  color: var(--text);
  padding: 0.38rem 0.46rem;
}

.dock-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: flex-end;
  margin: 0.35rem 0;
}

.dock-inline .btn {
  padding: 0.42rem 0.6rem;
  font-size: 0.78rem;
}

.dock-inline--create label {
  min-width: 6.5rem;
  flex: 1 1 6.5rem;
}

.dock-hangar-list,
.dock-market-list {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  max-height: 12rem;
  overflow: auto;
}

.dock-hangar-row,
.dock-market-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  border: 1px solid rgba(60, 100, 80, 0.4);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  background: rgba(6, 16, 12, 0.65);
  font-size: 0.78rem;
}

button.dock-hangar-row {
  width: 100%;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

button.dock-hangar-row:hover,
button.dock-hangar-row:focus-visible {
  border-color: rgba(120, 200, 170, 0.75);
  background: rgba(14, 36, 26, 0.85);
  outline: none;
}

.dock-hangar-row.is-active {
  border-color: rgba(110, 210, 150, 0.65);
  background: rgba(18, 42, 30, 0.75);
}

.dock-hangar-row.is-selected {
  border-color: rgba(140, 210, 170, 0.85);
  box-shadow: inset 0 0 0 1px rgba(140, 210, 170, 0.35);
}

.dock-card--preview {
  margin-bottom: 0.7rem;
  padding: 0.75rem 0.8rem 0.65rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(70, 120, 100, 0.22), transparent 55%),
    rgba(8, 18, 15, 0.88);
}

.dock-preview__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.dock-preview__header h3 {
  margin: 0;
}

.dock-preview__label {
  margin: 0;
  font-size: 0.82rem;
  color: #b7d8c6;
  text-align: right;
}

.dock-preview__stage {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(90, 140, 110, 0.35);
  background:
    radial-gradient(circle at 50% 70%, rgba(40, 80, 60, 0.35), transparent 50%),
    linear-gradient(180deg, #0a1210 0%, #121c18 100%);
  aspect-ratio: 16 / 9;
  max-height: min(42vh, 360px);
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.dock-preview__stage.is-dragging {
  cursor: grabbing;
}

#dock-ship-preview {
  display: block;
  width: 100%;
  height: 100%;
}

.dock-preview__hint {
  position: absolute;
  left: 0.65rem;
  bottom: 0.45rem;
  margin: 0;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(6, 14, 12, 0.65);
  font-size: 0.72rem;
  color: #9ebfad;
  pointer-events: none;
}

.dock-market-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
}

.dock-market-row-actions input {
  width: 4.5rem;
  margin: 0;
}

.dock-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #8aa898;
}

body.is-docked #game-canvas,
body.is-docked #hit-flash,
body.is-docked #vitals-hud,
body.is-docked #canvas-hint,
body.is-docked #hud-panel,
body.is-docked #touch-controls,
body.is-docked #context-actions {
  display: none !important;
}

body.is-docked .ship-console,
body.is-docked .ops-panel {
  display: none;
}

body.is-docked .mobile-tray__btn[data-panel="fly"],
body.is-docked .mobile-tray__btn[data-panel="hull"],
body.is-docked .mobile-tray__btn[data-panel="status"] {
  display: none;
}

@media (max-width: 820px) {
  .dock-grid {
    grid-template-columns: 1fr;
  }

  .dock-overlay__header {
    flex-direction: column;
    align-items: stretch;
  }
}

.ship-console {
  position: fixed;
  left: 0.7rem;
  top: 4rem;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  max-height: calc(100vh - 8.5rem);
  pointer-events: none;
}

.ship-console__rail,
.ship-console__stage,
.ship-console__panel,
.ship-console__tab,
.ship-console__close {
  pointer-events: auto;
}

.ship-console__rail {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.28rem;
  border: 1px solid #2e4569;
  border-radius: 12px;
  background: rgba(8, 16, 31, 0.9);
  backdrop-filter: blur(5px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.ship-console__tab {
  border: 0;
  border-radius: 8px;
  min-width: 3.4rem;
  padding: 0.48rem 0.55rem;
  background: transparent;
  color: #9db4d4;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.ship-console__tab[aria-pressed="true"] {
  background: rgba(70, 120, 190, 0.35);
  color: #e8f2ff;
}

.ship-console__tab:focus-visible {
  outline: 1px solid rgba(140, 180, 230, 0.8);
}

.ship-console__stage {
  min-width: 0;
}

.ship-console__panel {
  width: min(46vw, 560px);
  max-height: calc(100vh - 8.5rem);
  display: flex;
  flex-direction: column;
  border: 1px solid #2e4569;
  border-radius: 12px;
  background: rgba(8, 16, 31, 0.92);
  backdrop-filter: blur(5px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.ship-console__panel[hidden] {
  display: none !important;
}

.ship-console__panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid rgba(72, 107, 156, 0.45);
}

.ship-console__panel-header h3 {
  margin: 0;
  font-size: 0.92rem;
  color: #e7f0ff;
}

.ship-console__close {
  border: 1px solid #3a5988;
  border-radius: 7px;
  background: rgba(20, 37, 66, 0.85);
  color: #dce8ff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.42rem;
  cursor: pointer;
}

.ship-console__panel-body {
  padding: 0.62rem 0.72rem;
  overflow: auto;
  max-height: calc(100vh - 12rem);
}

.ship-console__panel.ops-panel {
  position: static;
  left: auto;
  top: auto;
  width: min(46vw, 560px);
  max-height: calc(100vh - 8.5rem);
  overflow: hidden;
}

.ship-console__panel.hud {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  width: min(92vw, 340px);
  max-height: calc(100vh - 8.5rem);
  overflow: hidden;
}

.hud {
  /* flight help lives in ship-console; keep class hooks for mobile */
}

.ops-panel {
  /* ops lives in ship-console; keep class hooks for mobile */
}

.ops-panel details {
  border: 1px solid #2e4569;
  border-radius: 10px;
  background: rgba(8, 16, 31, 0.8);
  backdrop-filter: blur(4px);
}

.ops-panel summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  padding: 0.62rem 0.72rem;
  border-bottom: 1px solid rgba(72, 107, 156, 0.45);
}

.ops-panel summary::-webkit-details-marker {
  display: none;
}

.ops-panel__content {
  display: grid;
  gap: 0.6rem;
}

.ops-status {
  margin: 0;
  font-size: 0.8rem;
  color: #c9dbff;
}

.ops-status.error {
  color: #ffc6c6;
}

.ops-status.success {
  color: #ccffe0;
}

.ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.ops-card {
  border: 1px solid #2d466d;
  border-radius: 9px;
  padding: 0.52rem 0.56rem;
  background: rgba(8, 20, 39, 0.7);
}

.ops-card h4 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
}

.ops-card p {
  margin: 0.18rem 0;
  font-size: 0.8rem;
}

.ops-card label {
  font-size: 0.78rem;
  margin-bottom: 0.28rem;
}

.ops-card input,
.ops-card select {
  width: 100%;
  border-radius: 7px;
  border: 1px solid #2f4362;
  background: #0b1220;
  color: var(--text);
  padding: 0.36rem 0.44rem;
}

.ops-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  align-items: flex-end;
  margin: 0.3rem 0;
}

.ops-inline .btn {
  padding: 0.4rem 0.54rem;
  font-size: 0.75rem;
}

.ops-market-list {
  display: grid;
  gap: 0.35rem;
}

.ops-market-row {
  border: 1px solid #2a4367;
  border-radius: 8px;
  padding: 0.38rem 0.45rem;
  background: rgba(7, 17, 34, 0.72);
  font-size: 0.76rem;
}

.ops-market-row-header {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ops-market-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.3rem;
}

.ops-market-row-actions input {
  width: 90px;
}

.ops-market-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #a5badb;
}

.vitals-hud {
  position: fixed;
  left: 0.7rem;
  bottom: 0.85rem;
  z-index: 6;
  width: min(16rem, 46vw);
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(90, 130, 190, 0.4);
  border-radius: 10px;
  background: rgba(6, 14, 28, 0.78);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.vitals-hud__row {
  display: grid;
  grid-template-columns: 3.4rem 1fr 3.4rem;
  gap: 0.35rem;
  align-items: center;
  margin: 0.18rem 0;
}

.vitals-hud__row--offline {
  opacity: 0.45;
}

.vitals-hud__label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b7cceb;
}

.vitals-hud__track {
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(20, 36, 64, 0.95);
  overflow: hidden;
  border: 1px solid rgba(70, 100, 150, 0.35);
}

.vitals-hud__fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 180ms ease-out;
}

.vitals-hud__row--speed {
  grid-template-columns: 3.4rem 1fr 4.6rem;
}

.vitals-hud__fill--hull {
  background: linear-gradient(90deg, #c94a3a, #e8a35a);
}

.vitals-hud__fill--speed {
  background: linear-gradient(90deg, #2a8f7a, #7dffc8);
}

.vitals-hud__fill--shield {
  background: linear-gradient(90deg, #2f6fd4, #6ec8ff);
}

.vitals-hud__fill--armor {
  background: linear-gradient(90deg, #6d6a62, #b7b1a4);
}

.vitals-hud__value {
  font-size: 0.72rem;
  text-align: right;
  color: #e8f0ff;
  font-variant-numeric: tabular-nums;
}

.vitals-hud__banner {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #ffd0b8;
}
.vitals-hud__lock {
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
  color: #ffb087;
  pointer-events: none;
}

.vitals-hud__lock.is-in-range {
  color: #9dffc2;
}

.vitals-hud__lock.is-blocked {
  color: #ffc27a;
}

.touch-controls.is-visible .touch-btn--target {
  background: rgba(28, 52, 88, 0.88);
  border-color: #7aa4e0;
}

.touch-controls.is-visible .touch-btn--target.is-locked {
  background: rgba(120, 58, 28, 0.9);
  border-color: #ff9a5c;
  color: #ffe0c8;
}


.vitals-hud__modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  margin-top: 0.4rem;
  pointer-events: auto;
}

.vitals-hud__mode {
  margin: 0;
  padding: 0.28rem 0.2rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(110, 150, 210, 0.4);
  background: rgba(10, 22, 42, 0.75);
  color: #c7d8f5;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}

.vitals-hud__mode.is-active {
  border-color: #f0a35a;
  background: rgba(90, 42, 18, 0.88);
  color: #ffe1c2;
}

.vitals-hud__mode[data-combat-mode="defense"].is-active {
  border-color: #6ec8ff;
  background: rgba(22, 52, 88, 0.9);
  color: #d7ecff;
}

.vitals-hud__mode[data-combat-mode="offense"].is-active {
  border-color: #ff6a5c;
  background: rgba(96, 24, 24, 0.92);
  color: #ffd4ce;
}


.hit-flash {
  position: fixed;
  inset: 56px 0 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(255, 60, 40, 0.08), rgba(180, 20, 10, 0.42));
  transition: opacity 120ms ease-out;
}

.hit-flash.is-on {
  opacity: 1;
}

body.has-onscreen-controls .vitals-hud {
  bottom: 11.2rem;
}

.nav-maps {
  position: fixed;
  left: 50%;
  top: 4.1rem;
  transform: translateX(-50%);
  z-index: 12;
  width: min(960px, 96vw);
  max-height: calc(100vh - 5rem);
  display: none;
  flex-direction: column;
  border: 1px solid rgba(90, 140, 110, 0.45);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(40, 80, 60, 0.35), transparent 50%),
    rgba(7, 14, 12, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.nav-maps.is-open,
.nav-maps:not([hidden]) {
  display: flex;
}

.nav-maps[hidden] {
  display: none !important;
}

.nav-maps__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(80, 120, 100, 0.35);
  flex-wrap: wrap;
}

.nav-maps__header h2 {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  color: #e8fff2;
}

.nav-maps__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: #8fbba0;
}

.nav-maps__tabs {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.18rem;
  border-radius: 999px;
  background: rgba(10, 22, 18, 0.8);
  border: 1px solid rgba(70, 110, 90, 0.45);
}

.nav-maps__tab {
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: transparent;
  color: #a8c4b4;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.nav-maps__tab.is-active {
  background: rgba(70, 140, 110, 0.35);
  color: #e8fff2;
}

.nav-maps__stage {
  flex: 1 1 auto;
  min-height: min(58vh, 520px);
  height: min(58vh, 520px);
}

#nav-maps-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#nav-maps-canvas:active {
  cursor: grabbing;
}

.nav-maps__hint {
  margin: 0;
  padding: 0.45rem 0.85rem 0.65rem;
  font-size: 0.74rem;
  color: #8aa898;
  border-top: 1px solid rgba(80, 120, 100, 0.25);
}

.nav-maps__hint kbd {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border: 1px solid rgba(120, 170, 140, 0.45);
  border-radius: 4px;
  background: rgba(20, 36, 28, 0.9);
  font-size: 0.72rem;
}


.touch-controls {
  display: none;
}

.touch-controls.is-visible {
  position: fixed;
  inset: auto 0.5rem 0.55rem 0.5rem;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem;
  pointer-events: none;
}

.touch-controls.is-visible .touch-controls__left,
.touch-controls.is-visible .touch-controls__right {
  pointer-events: auto;
}

.touch-controls.is-visible .touch-controls__label {
  margin: 0 0 0.28rem;
  font-size: 0.78rem;
  color: #d4e3ff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.touch-controls.is-visible .touch-pad {
  width: 134px;
  height: 134px;
  border-radius: 50%;
  border: 1px solid #3b567f;
  background: rgba(6, 14, 30, 0.62);
  backdrop-filter: blur(3px);
  position: relative;
  touch-action: none;
  user-select: none;
}

.touch-controls.is-visible .touch-pad__thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid #7fa1d3;
  background: rgba(125, 168, 234, 0.34);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: transform 90ms linear;
  will-change: transform;
}

.touch-controls.is-visible .touch-controls__right {
  display: grid;
  gap: 0.35rem;
}

.touch-controls.is-visible .touch-controls__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.touch-controls.is-visible .touch-btn {
  border: 1px solid #35588a;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  min-width: 88px;
  font-size: 0.79rem;
  color: #e7f0ff;
  background: rgba(13, 30, 56, 0.78);
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}

.touch-controls.is-visible .touch-btn.active,
.touch-controls.is-visible .touch-btn:active {
  background: rgba(72, 126, 221, 0.9);
  border-color: #77a7f2;
}

.touch-controls.is-visible .touch-btn--fire {
  grid-column: 1 / -1;
  background: rgba(120, 36, 28, 0.88);
  border-color: #d4784a;
}

.canvas-hint {
  position: fixed;
  left: 50%;
  bottom: 4.6rem; /* clear floating Dock/Jump context-actions */
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(90, 130, 190, 0.45);
  background: rgba(6, 14, 28, 0.72);
  color: #d7e6ff;
  font-size: 0.8rem;
  pointer-events: none;
  opacity: 0.92;
}

.canvas-hint.is-hidden {
  display: none;
}

body.has-onscreen-controls .canvas-hint {
  bottom: 11.5rem;
}

@media (pointer: coarse), (max-width: 900px) {
  .top-nav .group a.btn[href="/"] {
    display: none;
  }

  .top-nav strong {
    font-size: 0.82rem;
  }

  .ship-console {
    left: 0.45rem;
    right: 0.45rem;
    top: 3.55rem;
    max-height: min(58vh, 24rem);
  }

  .ship-console__rail {
    display: none;
  }

  .ship-console__stage {
    width: 100%;
  }

  .ship-console__panel,
  .ship-console__panel.ops-panel,
  .ship-console__panel.hud {
    display: none;
    width: 100%;
    max-width: none;
    max-height: min(58vh, 24rem);
    z-index: 13;
  }

  body.panel-ops-open #console-panel-ops,
  body.panel-status-open #console-panel-status {
    display: flex !important;
  }

  body.panel-ops-open #console-panel-ops .ship-console__panel-header,
  body.panel-status-open #console-panel-status .ship-console__panel-header {
    display: none;
  }

  .ops-grid {
    grid-template-columns: 1fr;
  }

  .ops-card label {
    font-size: 0.75rem;
  }

  .nav-maps {
    top: 3.6rem;
    width: min(100vw - 0.6rem, 960px);
    max-height: calc(100vh - 4.4rem);
  }

  .nav-maps__stage {
    min-height: min(48vh, 420px);
    height: min(48vh, 420px);
  }


  .touch-controls {
    position: fixed;
    inset: auto 0.5rem calc(3.55rem + env(safe-area-inset-bottom, 0px)) 0.5rem;
    z-index: 5;
    display: none;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.8rem;
    pointer-events: none;
  }

  body.panel-fly-open .touch-controls {
    display: flex;
  }

  body.panel-chat-open .touch-controls {
    display: none;
  }

  .touch-controls__left,
  .touch-controls__right {
    pointer-events: auto;
  }

  .touch-controls__label {
    margin: 0 0 0.28rem;
    font-size: 0.78rem;
    color: #d4e3ff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .touch-pad {
    width: 118px;
    height: 118px;
    border-radius: 50%;
    border: 1px solid #3b567f;
    background: rgba(6, 14, 30, 0.62);
    backdrop-filter: blur(3px);
    position: relative;
    touch-action: none;
    user-select: none;
  }

  .touch-pad__thumb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid #7fa1d3;
    background: rgba(125, 168, 234, 0.34);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: transform 90ms linear;
    will-change: transform;
  }

  .touch-controls__right {
    display: grid;
    gap: 0.3rem;
  }

  .touch-controls__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
  }

  .touch-btn {
    border: 1px solid #35588a;
    border-radius: 10px;
    padding: 0.48rem 0.55rem;
    min-width: 78px;
    font-size: 0.74rem;
    color: #e7f0ff;
    background: rgba(13, 30, 56, 0.78);
    touch-action: manipulation;
    user-select: none;
  }

  .touch-btn.active,
  .touch-btn:active {
    background: rgba(72, 126, 221, 0.9);
    border-color: #77a7f2;
  }

  .touch-btn--target {
    background: rgba(28, 52, 88, 0.88);
    border-color: #7aa4e0;
  }

  .touch-btn--target.is-locked {
    background: rgba(120, 58, 28, 0.9);
    border-color: #ff9a5c;
    color: #ffe0c8;
  }

  .touch-btn--fire {
    grid-column: 1 / -1;
    background: rgba(120, 36, 28, 0.88);
    border-color: #d4784a;
  }

  .context-actions--embedded .context-action {
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
    min-width: 0;
    box-shadow: none;
  }

  body:not(.panel-fly-open) .context-actions--floating {
    bottom: calc(3.7rem + env(safe-area-inset-bottom, 0px));
    width: min(42vw, 9.75rem);
  }

  body.panel-chat-open .context-actions--floating {
    bottom: calc(42vh + 3.8rem);
  }

  .canvas-hint {
    display: none;
  }

  .vitals-hud {
    left: 0.45rem;
    bottom: calc(12.2rem + env(safe-area-inset-bottom, 0px));
    width: min(11.5rem, 46vw);
    padding: 0.42rem 0.5rem;
    display: none;
  }

  body.panel-hull-open .vitals-hud {
    display: block;
  }

  body:not(.panel-fly-open).panel-hull-open .vitals-hud {
    bottom: calc(3.7rem + env(safe-area-inset-bottom, 0px));
  }

  .vitals-hud__row--offline {
    display: none;
  }
}
