/* Split out of index.html — main stylesheet */
  :root {
    --bg: #02040a;
    --panel: rgba(6, 10, 20, 0.72);
    --panel-border: rgba(120, 200, 255, 0.18);
    --accent: #4ad6ff;        /* hologram blue */
    --accent-soft: rgba(74, 214, 255, 0.12);
    --amber: #ffb347;          /* Star Wars amber */
    --text: #cfe5ff;
    --text-dim: #6a89a8;
    --grid: rgba(74, 214, 255, 0.06);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    width: 100%; height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
  }
  #canvas-wrap { position: fixed; inset: 0; }
  canvas { display: block; outline: none; }

  /* Ambient scanline / grain overlay for that sci-fi HUD feel */
  #hud-grain {
    position: fixed; inset: 0; pointer-events: none; z-index: 5;
    background:
      repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0, rgba(255,255,255,0.012) 1px, transparent 1px, transparent 3px),
      radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
    mix-blend-mode: screen;
  }

  .panel {
    position: fixed;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 2px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 10px 40px rgba(0,0,0,0.5);
    z-index: 10;
  }
  .panel::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 30px rgba(74, 214, 255, 0.04);
    pointer-events: none;
  }

  /* ---------- TITLE (top-left) ---------- */
  #title {
    top: 16px; left: 16px;
    padding: 14px 18px 12px;
    min-width: 280px;
    max-width: 340px;
  }
  #title h1 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 15px;
    letter-spacing: 0.22em;
    color: var(--accent);
    text-shadow: 0 0 8px rgba(74, 214, 255, 0.5);
  }
  #title .sub {
    font-size: 10px; letter-spacing: 0.18em;
    color: var(--text-dim);
    margin-top: 4px;
    text-transform: uppercase;
  }
  #title .stats {
    display: flex; gap: 14px; margin-top: 10px;
    font-size: 10px; letter-spacing: 0.1em;
    color: var(--text-dim);
    text-transform: uppercase;
  }
  #title .stats b {
    color: var(--amber); font-weight: 500;
    font-family: 'Orbitron', sans-serif;
  }

  /* ---------- SEARCH (top-center) ---------- */
  #search-wrap {
    top: 16px; left: 50%; transform: translateX(-50%);
    padding: 0;
    display: flex; align-items: center;
  }
  #search-wrap::before {
    content: '⌕'; color: var(--accent);
    padding: 0 10px 0 14px;
    font-size: 16px;
  }
  #search {
    background: transparent; border: none; outline: none;
    color: var(--text); font-family: inherit;
    font-size: 12px; letter-spacing: 0.1em;
    padding: 12px 16px 12px 0;
    width: 280px;
  }
  #search::placeholder { color: var(--text-dim); letter-spacing: 0.15em; }
  #search-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-top: none;
    max-height: 300px; overflow-y: auto;
    display: none;
  }
  #search-results.open { display: block; }
  .search-item {
    padding: 8px 14px;
    font-size: 11px; letter-spacing: 0.06em;
    cursor: pointer;
    border-bottom: 1px solid rgba(74, 214, 255, 0.05);
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px;
  }
  .search-item:hover { background: var(--accent-soft); color: var(--accent); }
  .search-item .region {
    font-size: 9px; color: var(--text-dim); text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  /* ---------- REGIONS / FILTERS (left) ---------- */
  #regions {
    top: 180px; left: 16px;
    padding: 12px 14px;
    width: 240px;
  }
  #regions h2, #info h2, #controls-help h2, #time-panel h2 {
    font-family: 'Orbitron', sans-serif; font-weight: 700;
    font-size: 10px; letter-spacing: 0.3em;
    color: var(--text-dim); text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--panel-border);
  }
  .region-row {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 2px;
    font-size: 11px; letter-spacing: 0.05em;
    cursor: pointer;
    color: var(--text);
    transition: color 0.15s;
  }
  .region-row:hover { color: var(--accent); }
  .region-row.off { color: var(--text-dim); }
  .region-dot {
    width: 10px; height: 10px; border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
    flex-shrink: 0;
  }
  .region-row.off .region-dot { opacity: 0.25; box-shadow: none; }
  .region-row .count {
    margin-left: auto;
    font-size: 9px; color: var(--text-dim);
    font-family: 'Orbitron', sans-serif;
  }

  /* ---------- INFO (top-right) ---------- */
  #info {
    top: 16px; right: 16px;
    padding: 14px 16px;
    width: 280px;
    display: none;
  }
  #info.visible { display: block; }
  #info .pname {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px; font-weight: 700;
    color: var(--amber);
    letter-spacing: 0.08em;
    text-shadow: 0 0 10px rgba(255, 179, 71, 0.35);
    margin-bottom: 10px;
  }
  #info .row {
    display: flex; justify-content: space-between;
    padding: 4px 0;
    font-size: 11px; letter-spacing: 0.06em;
    border-bottom: 1px dashed rgba(74, 214, 255, 0.08);
  }
  #info .row:last-child { border-bottom: none; }
  #info .row .label {
    color: var(--text-dim); text-transform: uppercase;
    font-size: 9px; letter-spacing: 0.2em;
  }
  #info .row .value { color: var(--text); font-family: 'JetBrains Mono', monospace; }
  #info .close {
    position: absolute; top: 10px; right: 12px;
    color: var(--text-dim); cursor: pointer;
    font-size: 14px; line-height: 1;
  }
  #info .close:hover { color: var(--accent); }
  #info button.focus-btn {
    margin-top: 12px; width: 100%;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px; letter-spacing: 0.25em;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s;
  }
  #info button.focus-btn:hover {
    background: var(--accent-soft);
    box-shadow: 0 0 20px rgba(74,214,255,0.25);
  }

  /* ---------- TIME / 4D CONTROL (bottom) ---------- */
  #time-panel {
    bottom: 16px; left: 50%; transform: translateX(-50%);
    padding: 12px 20px 14px;
    width: min(640px, calc(100vw - 300px));
  }
  #time-panel .row {
    display: flex; align-items: center; gap: 14px;
    margin-top: 6px;
  }
  #time-slider {
    flex: 1; -webkit-appearance: none; appearance: none;
    height: 2px; background: rgba(74,214,255,0.2);
    outline: none; border-radius: 1px;
  }
  #time-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
    cursor: pointer;
  }
  #time-slider::-moz-range-thumb {
    width: 14px; height: 14px;
    background: var(--accent); border: none;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
    cursor: pointer;
  }
  #time-value {
    font-family: 'Orbitron', sans-serif;
    color: var(--amber);
    font-size: 11px; letter-spacing: 0.15em;
    min-width: 90px; text-align: right;
  }
  .btn {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text);
    padding: 6px 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px; letter-spacing: 0.2em;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s;
  }
  .btn:hover, .btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
  }

  /* ---------- CONTROLS HELP (bottom-right) ---------- */
  #controls-help {
    bottom: 16px; right: 16px;
    padding: 12px 14px;
    width: 220px;
    font-size: 10px;
  }
  #controls-help .kb-row {
    display: flex; justify-content: space-between;
    padding: 3px 0;
    color: var(--text-dim);
    letter-spacing: 0.06em;
  }
  #controls-help .kb-row .key {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent);
    font-size: 9px; letter-spacing: 0.15em;
    padding: 1px 6px;
    border: 1px solid var(--panel-border);
    border-radius: 2px;
    margin-left: 8px;
    min-width: 50px; text-align: center;
  }

  /* ---------- HOVER TOOLTIP ---------- */
  #tooltip {
    position: fixed;
    background: var(--panel);
    border: 1px solid var(--accent);
    padding: 6px 10px;
    font-size: 11px; letter-spacing: 0.08em;
    color: var(--text);
    pointer-events: none;
    z-index: 20;
    display: none;
    white-space: nowrap;
    box-shadow: 0 0 20px rgba(74, 214, 255, 0.2);
  }
  #tooltip .t-region {
    font-size: 9px; color: var(--text-dim);
    text-transform: uppercase;
    margin-top: 2px;
  }

  /* ---------- LOADING ---------- */
  #loading {
    position: fixed; inset: 0; display: flex;
    align-items: center; justify-content: center;
    flex-direction: column;
    background: var(--bg); z-index: 100;
    transition: opacity 0.6s;
  }
  #loading.hidden { opacity: 0; pointer-events: none; }
  #loading .spinner {
    width: 60px; height: 60px;
    border: 1px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    box-shadow: 0 0 30px rgba(74, 214, 255, 0.3);
  }
  #loading .lt {
    margin-top: 24px;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px; letter-spacing: 0.4em;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(74, 214, 255, 0.5);
  }
  #loading .ls {
    margin-top: 6px;
    font-size: 10px; letter-spacing: 0.2em;
    color: var(--text-dim);
  }
  /* Asset-load progress bar under the status ticker. Width is driven by
     #loading-bar's inline style via JS — every loaded ship GLB pushes it
     closer to 100%. Keeps slow connections from staring at a frozen
     spinner. */
  #loading .lprog {
    margin-top: 14px;
    width: 220px; height: 2px;
    background: rgba(74, 214, 255, 0.12);
    border-radius: 1px;
    overflow: hidden;
  }
  #loading-bar {
    width: 0%; height: 100%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(74, 214, 255, 0.6);
    transition: width 0.35s ease-out;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Crosshair reticle */
  #reticle {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 28px; height: 28px;
    pointer-events: none; z-index: 6;
    opacity: 0; transition: opacity 0.3s;
  }
  #reticle.on { opacity: 0.4; }
  #reticle::before, #reticle::after {
    content: ''; position: absolute; background: var(--accent);
    box-shadow: 0 0 4px var(--accent);
  }
  #reticle::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
  #reticle::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }

  /* ---------- DYNAMIC PLANET LABELS ---------- */
  #labels-layer {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 7;
    overflow: hidden;
  }
  .dyn-label {
    position: absolute;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: rgba(207, 229, 255, 0.9);
    text-shadow:
      0 0 6px rgba(74, 214, 255, 0.55),
      0 0 2px rgba(0, 0, 0, 0.95),
      1px 1px 2px rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -220%);
    white-space: nowrap;
    padding: 1px 6px;
    display: none;
    will-change: transform, opacity;
  }
  .dyn-label::before {
    content: '';
    position: absolute;
    left: 50%; bottom: -8px;
    width: 1px; height: 8px;
    background: linear-gradient(to bottom, rgba(74, 214, 255, 0.4), transparent);
    transform: translateX(-50%);
  }
  .dyn-label.famous {
    color: rgba(255, 210, 122, 0.98);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-shadow:
      0 0 8px rgba(255, 179, 71, 0.65),
      0 0 2px rgba(0, 0, 0, 0.95),
      1px 1px 2px rgba(0, 0, 0, 0.9);
  }
  .dyn-label.famous::before {
    background: linear-gradient(to bottom, rgba(255, 179, 71, 0.5), transparent);
  }
  .dyn-label.unnamed {
    color: rgba(150, 170, 190, 0.55);
    font-size: 9px;
    font-weight: 300;
    font-style: italic;
    letter-spacing: 0.08em;
    text-shadow:
      0 0 4px rgba(100, 130, 160, 0.35),
      0 0 2px rgba(0, 0, 0, 0.9);
  }
  .dyn-label.unnamed::before { background: transparent; }

  /* =========================================================
     SHIP MODE COCKPIT — in-universe flight HUD
     ========================================================= */
  :root {
    --hud-good:   #5fff8a;
    --hud-danger: #ff4848;
    --hud-deep:   rgba(6, 14, 28, 0.88);
    --hud-bright: rgba(10, 24, 44, 0.92);
  }

  #cockpit {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 55;
    display: none;
    color: var(--accent);
    font-family: 'Orbitron', sans-serif;
  }
  #cockpit.active { display: block; }

  /* Hyperspace FX overlay — full-screen canvas drawn only during a jump. */
  #hyperspace-fx {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 90;
    display: block;
    opacity: 0;
    transition: opacity 0.25s ease-out;
    mix-blend-mode: screen;
  }
  #hyperspace-fx.active { opacity: 1; }
  /* Boost speed-lines — always in the DOM, but the draw loop only renders
     streaks when ship.boostVis > 0 (see updateSpeedLines in flight.js).
     Sits under the hyperspace canvas so a jump fades over it cleanly.
     Screen-blend keeps streaks bright over the starfield without looking
     painted-on. */
  #speedlines-fx {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 85;
    display: block;
    mix-blend-mode: screen;
  }
  /* Central white flash when hyperspace engages/disengages */
  #hyperspace-flash {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 95;
    background: radial-gradient(circle at 50% 50%,
      rgba(220, 240, 255, 0.95) 0%,
      rgba(160, 200, 255, 0.55) 18%,
      rgba(60, 120, 220, 0.08) 45%,
      rgba(0, 0, 0, 0) 70%);
    opacity: 0;
    transition: opacity 0.15s ease-out;
  }
  #hyperspace-flash.active { opacity: 1; }
  /* Jump engage toast — shows target + "ENGAGE" countdown briefly */
  #hyperspace-toast {
    position: fixed;
    top: 52%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 110;
    padding: 10px 24px;
    background: rgba(6, 14, 28, 0.82);
    border: 1px solid rgba(120, 190, 255, 0.8);
    border-radius: 2px;
    color: #bfe5ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    letter-spacing: 4px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s ease-out;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(120, 190, 255, 0.9);
  }
  #hyperspace-toast.active { opacity: 1; }
  /* Reject toast — shown when a jump is denied (too close to target etc.).
     Red-amber alert styling, auto-fades after ~1.6s. */
  #hyperspace-reject {
    position: fixed;
    top: 52%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 111;
    padding: 10px 26px;
    background: rgba(34, 6, 6, 0.88);
    border: 1px solid rgba(255, 120, 90, 0.9);
    border-radius: 2px;
    color: #ffc48a;
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    letter-spacing: 4px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.18s ease-out;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(255, 130, 80, 0.85);
    box-shadow: 0 0 18px rgba(255, 100, 60, 0.35), inset 0 0 12px rgba(255, 100, 60, 0.12);
  }
  #hyperspace-reject.active { opacity: 1; animation: hs-reject-shake 0.45s ease-out 1; }
  #hyperspace-reject .hs-sub {
    display: block;
    font-size: 18px;
    letter-spacing: 6px;
    color: #ff7a4e;
    margin-top: 4px;
    text-shadow: 0 0 14px rgba(255, 120, 60, 0.9);
  }
  @keyframes hs-reject-shake {
    0%, 100% { transform: translate(-50%, -50%); }
    20%      { transform: translate(calc(-50% - 6px), -50%); }
    40%      { transform: translate(calc(-50% + 6px), -50%); }
    60%      { transform: translate(calc(-50% - 3px), -50%); }
    80%      { transform: translate(calc(-50% + 3px), -50%); }
  }
  #hyperspace-toast .hs-target {
    display: block;
    font-size: 20px;
    letter-spacing: 6px;
    color: #ffd27a;
    margin-top: 4px;
    text-shadow: 0 0 12px rgba(255, 200, 120, 0.9);
  }
  body.ship-mode { cursor: none; }
  body.ship-mode.nav-open { cursor: default; }
  @media (hover: hover) and (pointer: fine) {
    body.ship-mode.experience-overlay-open,
    body.ship-mode.experience-overlay-open #experience-shell,
    body.ship-mode.experience-overlay-open #experience-shell * {
      cursor: url('../assets/ui/cockpit-cursor.svg') 3 2, default !important;
    }
  }

  /* ============================================================
     HYPERJUMP PROMPT (inside target-lock panel) — only visible
     when a target is locked + ship mode is active. Pulses amber
     so the pilot can't miss it.
     ============================================================ */
  /* ============================================================
     HYPERJUMP PROMPT — lives inside the target-lock panel.
     Flat, no pulse animation (matches minimal HUD aesthetic).
     ============================================================ */
  .hj-prompt {
    display: none;
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 179, 71, 0.55);
    border-radius: 2px;
    background: rgba(255, 179, 71, 0.10);
    align-items: center;
    gap: 10px;
    color: #ffd27a;
  }
  .hj-prompt.active { display: flex; }
  .hj-prompt .hj-key {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 3px 7px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    border: 1px solid #ffb347;
    border-radius: 2px;
    background: rgba(255, 179, 71, 0.22);
    color: #ffe2ae;
  }
  .hj-prompt .hj-label {
    font-family: 'Orbitron', monospace;
    letter-spacing: 2.2px;
    font-size: 9.5px;
    font-weight: 500;
    color: #ffd27a;
  }
  /* Interlock state — pilot is inside minimum jump range */
  .hj-prompt.interlock {
    border-color: rgba(255, 90, 80, 0.65);
    background: rgba(255, 90, 80, 0.10);
    color: #ff9a80;
  }
  .hj-prompt.interlock .hj-key {
    border-color: #ff8a74;
    background: rgba(255, 90, 80, 0.22);
    color: #ffcabf;
  }
  .hj-prompt.interlock .hj-label { color: #ff9a80; }

  /* ============================================================
     NAV COMPUTER LAUNCHER BUTTON (right console)
     ============================================================ */
  .nav-launch {
    display: flex; flex-direction: column;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(74, 214, 255, 0.40);
    border-radius: 4px;
    background: linear-gradient(135deg, rgba(74, 214, 255, 0.12), rgba(74, 214, 255, 0.02));
    color: var(--accent);
    font-family: 'Orbitron', monospace;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: 0 0 12px rgba(74, 214, 255, 0.08);
    position: relative;
  }
  .nav-launch:hover {
    background: linear-gradient(135deg, rgba(74, 214, 255, 0.22), rgba(74, 214, 255, 0.06));
    box-shadow: 0 0 18px rgba(74, 214, 255, 0.28);
    border-color: rgba(74, 214, 255, 0.65);
  }
  .nav-launch .nav-launch-key {
    position: absolute;
    top: 8px; right: 10px;
    padding: 2px 7px;
    border: 1px solid rgba(74, 214, 255, 0.6);
    border-radius: 3px;
    background: rgba(74, 214, 255, 0.15);
    font-size: 11px;
    letter-spacing: 1px;
    color: #a2e4ff;
  }
  .nav-launch .nav-launch-label {
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 600;
    color: #c3ecff;
  }
  .nav-launch .nav-launch-sub {
    margin-top: 4px;
    font-size: 9px;
    letter-spacing: 1.5px;
    color: rgba(160, 200, 220, 0.7);
  }

  /* ============================================================
     NAV COMPUTER MODAL
     ============================================================ */
  #nav-computer {
    position: fixed; inset: 0;
    z-index: 60;
    display: none;
    align-items: center; justify-content: center;
    background: rgba(2, 6, 14, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto;
    animation: nc-fadein 0.18s ease-out;
  }
  #nav-computer.active { display: flex; }
  @keyframes nc-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  .nc-panel {
    width: min(1040px, 94vw);
    height: min(680px, 86vh);
    background:
      linear-gradient(180deg, rgba(8, 18, 32, 0.96), rgba(4, 10, 20, 0.98)),
      repeating-linear-gradient(0deg, transparent 0, transparent 28px,
        rgba(74, 214, 255, 0.04) 28px, rgba(74, 214, 255, 0.04) 29px);
    border: 1px solid rgba(74, 214, 255, 0.35);
    border-radius: 6px;
    box-shadow:
      0 0 40px rgba(74, 214, 255, 0.12),
      inset 0 0 30px rgba(0, 0, 0, 0.55);
    display: flex; flex-direction: column;
    font-family: 'JetBrains Mono', monospace;
    color: #c3ecff;
    overflow: hidden;
  }
  .nc-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(74, 214, 255, 0.22);
    background: linear-gradient(180deg, rgba(74, 214, 255, 0.05), transparent);
  }
  .nc-hdr-left { display: flex; flex-direction: column; gap: 2px; }
  .nc-title {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    letter-spacing: 4px;
    font-size: 15px;
    color: var(--accent);
    text-shadow: 0 0 8px rgba(74, 214, 255, 0.3);
  }
  .nc-sub {
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(160, 200, 220, 0.7);
  }
  .nc-close {
    width: 34px; height: 34px;
    background: transparent;
    border: 1px solid rgba(74, 214, 255, 0.35);
    border-radius: 4px;
    color: #a2e4ff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s;
  }
  .nc-close:hover { background: rgba(74, 214, 255, 0.12); border-color: var(--accent); color: #fff; }
  .nc-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 1px;
    background: rgba(74, 214, 255, 0.12);
    overflow: hidden;
  }
  .nc-left, .nc-right {
    display: flex; flex-direction: column;
    background: rgba(4, 10, 18, 0.88);
    padding: 18px 22px;
    overflow: hidden;
  }
  .nc-search {
    position: relative;
    display: flex; align-items: center;
    padding: 0 0 0 38px;
    border: 1px solid rgba(74, 214, 255, 0.35);
    border-radius: 4px;
    background: rgba(6, 14, 24, 0.8);
  }
  .nc-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 14px rgba(74, 214, 255, 0.3);
  }
  .nc-search-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: rgba(160, 200, 220, 0.55);
  }
  .nc-search input {
    flex: 1;
    padding: 12px 10px;
    border: none; outline: none;
    background: transparent;
    color: #eaf8ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    letter-spacing: 1.5px;
  }
  .nc-search input::placeholder {
    color: rgba(160, 200, 220, 0.42);
    font-size: 11px;
    letter-spacing: 1.5px;
  }
  .nc-clear {
    background: none; border: none;
    color: rgba(160, 200, 220, 0.6);
    font-size: 16px;
    cursor: pointer;
    padding: 0 12px;
    height: 36px;
  }
  .nc-clear:hover { color: #fff; }
  .nc-filter-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 2px 8px;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: rgba(160, 200, 220, 0.7);
  }
  .nc-toggle { position: relative; display: inline-block; width: 34px; height: 18px; }
  .nc-toggle input { opacity: 0; width: 0; height: 0; }
  .nc-toggle-ui {
    position: absolute; inset: 0;
    background: rgba(74, 214, 255, 0.14);
    border: 1px solid rgba(74, 214, 255, 0.35);
    border-radius: 10px;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
  }
  .nc-toggle-ui::before {
    content: ''; position: absolute;
    width: 12px; height: 12px;
    top: 2px; left: 2px;
    background: rgba(160, 200, 220, 0.75);
    border-radius: 50%;
    transition: transform 0.15s, background 0.15s;
  }
  .nc-toggle input:checked + .nc-toggle-ui {
    background: rgba(74, 214, 255, 0.4);
    border-color: var(--accent);
  }
  .nc-toggle input:checked + .nc-toggle-ui::before {
    transform: translateX(16px);
    background: #fff;
    box-shadow: 0 0 6px rgba(74, 214, 255, 0.6);
  }
  .nc-results {
    flex: 1;
    margin-top: 8px;
    padding-right: 6px;
    overflow-y: auto;
    border-top: 1px solid rgba(74, 214, 255, 0.14);
    border-bottom: 1px solid rgba(74, 214, 255, 0.14);
  }
  .nc-results::-webkit-scrollbar { width: 6px; }
  .nc-results::-webkit-scrollbar-track { background: rgba(74, 214, 255, 0.05); }
  .nc-results::-webkit-scrollbar-thumb { background: rgba(74, 214, 255, 0.4); border-radius: 3px; }
  .nc-row {
    display: flex; align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-bottom: 1px solid rgba(74, 214, 255, 0.06);
    cursor: pointer;
    transition: background 0.1s;
  }
  .nc-row:hover, .nc-row.sel {
    background: rgba(74, 214, 255, 0.09);
  }
  .nc-row.sel {
    background: rgba(74, 214, 255, 0.18);
    border-left: 2px solid var(--accent);
    padding-left: 8px;
  }
  .nc-row.famous .nc-row-name { color: #ffd27a; }
  .nc-row-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
  }
  .nc-row-name {
    flex: 1;
    font-size: 12px;
    letter-spacing: 1px;
    color: #eaf8ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nc-row-region {
    font-size: 9px;
    letter-spacing: 1.2px;
    color: rgba(160, 200, 220, 0.55);
    text-transform: uppercase;
  }
  .nc-row-dist {
    font-size: 10px;
    letter-spacing: 1px;
    color: #ffb347;
    min-width: 48px;
    text-align: right;
  }
  .nc-row-empty {
    padding: 20px 10px;
    text-align: center;
    color: rgba(160, 200, 220, 0.55);
    font-size: 11px;
    letter-spacing: 1.5px;
  }
  .nc-tips {
    display: flex; justify-content: space-between;
    padding: 10px 2px 0;
    font-size: 9px;
    letter-spacing: 1.2px;
    color: rgba(160, 200, 220, 0.55);
  }
  .nc-tips kbd {
    display: inline-block;
    padding: 2px 5px;
    margin: 0 3px;
    border: 1px solid rgba(74, 214, 255, 0.3);
    border-radius: 3px;
    background: rgba(74, 214, 255, 0.08);
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: #a2e4ff;
  }
  /* Right panel — detail + actions */
  .nc-detail {
    flex: 1;
    padding: 16px;
    border: 1px solid rgba(74, 214, 255, 0.18);
    border-radius: 4px;
    background: rgba(6, 14, 24, 0.6);
    overflow-y: auto;
  }
  .nc-detail-empty {
    padding: 40px 10px;
    text-align: center;
    font-size: 11px;
    letter-spacing: 2px;
    color: rgba(160, 200, 220, 0.45);
  }
  .nc-detail h4 {
    margin: 0 0 4px;
    font-family: 'Orbitron', monospace;
    font-size: 20px;
    letter-spacing: 3px;
    font-weight: 700;
    color: #ffd27a;
    text-shadow: 0 0 10px rgba(255, 179, 71, 0.3);
  }
  .nc-detail .nc-detail-sub {
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(160, 200, 220, 0.6);
    margin-bottom: 14px;
    text-transform: uppercase;
  }
  .nc-detail-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    font-size: 11px;
    letter-spacing: 1.2px;
  }
  .nc-detail-grid dt {
    color: rgba(160, 200, 220, 0.6);
  }
  .nc-detail-grid dd {
    margin: 0;
    color: #eaf8ff;
  }
  .nc-detail-coord {
    margin-top: 14px;
    padding: 8px 10px;
    background: rgba(74, 214, 255, 0.06);
    border: 1px dashed rgba(74, 214, 255, 0.22);
    border-radius: 3px;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #a2e4ff;
  }
  .nc-actions {
    display: flex; flex-direction: column;
    gap: 10px;
    margin-top: 18px;
  }
  .nc-btn {
    padding: 14px 16px;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Orbitron', monospace;
    text-align: left;
    transition: all 0.15s;
    display: flex; flex-direction: column;
    gap: 3px;
    background: transparent;
  }
  .nc-btn .nc-btn-line {
    font-size: 13px;
    letter-spacing: 3px;
    font-weight: 700;
  }
  .nc-btn .nc-btn-sub {
    font-size: 9px;
    letter-spacing: 1.8px;
    opacity: 0.7;
    font-weight: 400;
  }
  .nc-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.4);
  }
  .nc-btn-autopilot {
    border-color: rgba(74, 214, 255, 0.5);
    background: linear-gradient(135deg, rgba(74, 214, 255, 0.10), rgba(74, 214, 255, 0.02));
    color: #a2e4ff;
  }
  .nc-btn-autopilot:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(74, 214, 255, 0.22), rgba(74, 214, 255, 0.06));
    box-shadow: 0 0 14px rgba(74, 214, 255, 0.3);
    color: #fff;
  }
  .nc-btn-jump {
    border-color: rgba(255, 179, 71, 0.55);
    background: linear-gradient(135deg, rgba(255, 179, 71, 0.10), rgba(255, 179, 71, 0.02));
    color: #ffd27a;
  }
  .nc-btn-jump:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(255, 179, 71, 0.25), rgba(255, 179, 71, 0.06));
    box-shadow: 0 0 14px rgba(255, 179, 71, 0.35);
    color: #fff;
  }
  .nc-btn-cancel {
    border-color: rgba(255, 85, 56, 0.5);
    background: linear-gradient(135deg, rgba(255, 85, 56, 0.10), rgba(255, 85, 56, 0.02));
    color: #ff9a80;
  }
  .nc-btn-cancel:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(255, 85, 56, 0.22), rgba(255, 85, 56, 0.06));
    box-shadow: 0 0 14px rgba(255, 85, 56, 0.3);
    color: #fff;
  }
  .nc-btn-battle {
    border-color: rgba(124, 255, 132, 0.55);
    background: linear-gradient(135deg, rgba(124, 255, 132, 0.10), rgba(255, 60, 50, 0.04));
    color: #a9ffb4;
  }
  .nc-btn-battle:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(124, 255, 132, 0.22), rgba(255, 60, 50, 0.08));
    box-shadow: 0 0 14px rgba(124, 255, 132, 0.35);
    color: #fff;
  }

  /* ============================================================
     AUTOPILOT STATUS INDICATOR (while autopilot is flying)
     ============================================================ */
  #autopilot-indicator {
    position: fixed;
    top: 60px; left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 12px;
    border: 1px solid rgba(74, 214, 255, 0.55);
    border-radius: 4px;
    background: linear-gradient(180deg, rgba(8, 22, 38, 0.92), rgba(4, 12, 22, 0.92));
    box-shadow: 0 0 16px rgba(74, 214, 255, 0.25);
    font-family: 'JetBrains Mono', monospace;
    color: #c3ecff;
    z-index: 25;
    pointer-events: auto;
  }
  #autopilot-indicator.active { display: flex; }
  #autopilot-indicator .ap-icon {
    color: var(--accent);
    animation: ap-spin 3.5s linear infinite;
  }
  @keyframes ap-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }
  #autopilot-indicator .ap-label {
    font-size: 11px;
    letter-spacing: 2.5px;
    color: var(--accent);
  }
  #autopilot-indicator .ap-label b {
    color: #ffd27a;
    font-weight: 600;
  }
  #autopilot-indicator .ap-sub {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: rgba(160, 200, 220, 0.7);
  }
  .ap-cancel {
    margin-left: 8px;
    padding: 5px 10px;
    border: 1px solid rgba(255, 85, 56, 0.5);
    background: rgba(255, 85, 56, 0.1);
    color: #ff9a80;
    font-family: 'Orbitron', monospace;
    font-size: 9px;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
  }
  .ap-cancel:hover {
    background: rgba(255, 85, 56, 0.22);
    color: #fff;
    box-shadow: 0 0 8px rgba(255, 85, 56, 0.4);
  }
  body.ship-mode #title,
  body.ship-mode #search-wrap,
  body.ship-mode #regions,
  body.ship-mode #info,
  body.ship-mode #time-panel,
  body.ship-mode #controls-help,
  body.ship-mode #labels-layer,
  body.ship-mode #reticle { display: none !important; }

  /* HUD hide toggle — bound to the C / VIEW button. Wipes the
     entire cockpit HUD plus all flight overlays so you get a clean
     view of space. Re-press C to bring everything back. */
  body.hud-hidden #cockpit,
  body.hud-hidden #autopilot-indicator,
  body.hud-hidden #hud-grain,
  body.hud-hidden #hj-prompt,
  body.hud-hidden #land-prompt,
  body.hud-hidden #cp-boost,
  body.hud-hidden #controls-hint { display: none !important; }

  /* ============================================================
     JEDI COMM — incoming-transmission card that pops up when a
     wandering Jedi decants alongside the player on a hyperjump
     arrival. Soft purple glow to differentiate from the standard
     blue/amber HUD. Auto-fades after ~7s.
     ============================================================ */
  #jedi-comm {
    position: fixed;
    left: 50%;
    top: 16%;
    transform: translateX(-50%) translateY(-12px);
    z-index: 4500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
    font-family: 'Orbitron', 'JetBrains Mono', monospace;
    color: #e6d8ff;
  }
  #jedi-comm.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  #jedi-comm .jc-frame {
    min-width: 360px;
    max-width: 520px;
    padding: 14px 22px 16px;
    border: 1px solid rgba(184, 141, 255, 0.55);
    background: linear-gradient(180deg,
      rgba(40, 24, 70, 0.85),
      rgba(18, 10, 36, 0.92));
    box-shadow:
      0 0 26px rgba(184, 141, 255, 0.35),
      inset 0 0 18px rgba(120, 80, 200, 0.25);
    backdrop-filter: blur(2px);
  }
  #jedi-comm .jc-tag {
    font-size: 10px;
    letter-spacing: 4px;
    color: #c9a8ff;
    margin-bottom: 6px;
    text-transform: uppercase;
  }
  #jedi-comm .jc-name {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #f4ecff;
    text-shadow: 0 0 12px rgba(184, 141, 255, 0.55);
    margin-bottom: 8px;
  }
  #jedi-comm .jc-msg {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #d6c5ff;
    font-style: italic;
    line-height: 1.4;
  }
  /* Hide the comm card when ship mode is off or HUD-hidden. */
  body:not(.ship-mode) #jedi-comm,
  body.hud-hidden #jedi-comm,
  body.landed-mode #jedi-comm { display: none !important; }

  /* Canopy vignette — kept subtle; heavy framing comes from the SVG canopy */
  #cockpit::before {
    content: ''; position: absolute; inset: 0;
    background:
      radial-gradient(ellipse 70% 95% at 50% 40%, transparent 60%, rgba(0,5,12,0.35) 92%, rgba(0,5,12,0.55) 100%),
      repeating-linear-gradient(0deg, rgba(74,214,255,0.012) 0, rgba(74,214,255,0.012) 1px, transparent 1px, transparent 3px);
    pointer-events: none;
  }

  /* ============================================================
     SHIP HUD — minimal combat overlay
     Clean data-forward layout with corner brackets, cardinal
     clusters, and a center reticle. No decorative chrome, no
     idle animations. Cyan-300 primary, amber-400 target lock,
     red for interlocks.
     ============================================================ */
  :root {
    --hud-cy:   #4ad6ff;
    --hud-cy2:  rgba(74, 214, 255, 0.55);
    --hud-cy3:  rgba(74, 214, 255, 0.18);
    --hud-amb:  #ffb347;
    --hud-amb2: rgba(255, 179, 71, 0.55);
    --hud-red:  #ff6a4a;
    --hud-red2: rgba(255, 106, 74, 0.55);
    --hud-dim:  #6fa0b0;
    --hud-bg:   rgba(6, 14, 22, 0.55);
    --hud-bg2:  rgba(4, 10, 16, 0.72);
  }

  /* --- Fonts, shared panel chrome -------------------------------------- */
  #cockpit .hud-panel {
    position: absolute;
    padding: 9px 12px 10px 12px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 10px;
    letter-spacing: 1.4px;
    color: #c7e9f7;
    background: var(--hud-bg);
    border: 1px solid var(--hud-cy2);
    border-radius: 2px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    box-shadow: inset 0 0 10px rgba(74, 214, 255, 0.08);
  }
  #cockpit .hud-panel::before,
  #cockpit .hud-panel::after {
    content: '';
    position: absolute;
    width: 10px; height: 10px;
    border: 1px solid var(--hud-cy);
    pointer-events: none;
  }
  #cockpit .hud-panel::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
  #cockpit .hud-panel::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

  #cockpit .hud-hdr {
    display: flex; align-items: center; justify-content: space-between;
    font-family: 'Orbitron', 'JetBrains Mono', sans-serif;
    font-size: 9px;
    letter-spacing: 2.4px;
    color: var(--hud-cy);
    padding-bottom: 5px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--hud-cy3);
    text-transform: uppercase;
  }
  #cockpit .hud-hdr .hdr-id {
    color: var(--hud-amb);
    font-size: 8px;
    letter-spacing: 1.8px;
    opacity: 0.85;
  }

  #cockpit .hud-row {
    display: flex; justify-content: space-between;
    font-variant-numeric: tabular-nums;
    line-height: 1.6;
  }
  #cockpit .hud-row .lbl { color: var(--hud-dim); }
  #cockpit .hud-row b    { color: #e8f6ff; font-weight: 500; }

  /* --- Corner brackets (pure decoration, full-viewport) ---------------- */
  #cockpit .hud-bracket {
    position: absolute;
    width: 42px; height: 42px;
    border: 1px solid var(--hud-cy2);
    pointer-events: none;
  }
  #cockpit .hud-bracket.tl { top: 22px;    left: 22px;    border-right: none;  border-bottom: none; }
  #cockpit .hud-bracket.tr { top: 22px;    right: 22px;   border-left: none;   border-bottom: none; }
  #cockpit .hud-bracket.bl { bottom: 22px; left: 22px;    border-right: none;  border-top: none;    }
  #cockpit .hud-bracket.br { bottom: 22px; right: 22px;   border-left: none;   border-top: none;    }

  /* --- Top-left: nav data -------------------------------------------- */
  #hud-nav {
    top: 28px; left: 28px;
    min-width: 228px;
  }

  /* --- Top-right: target lock ---------------------------------------- */
  #hud-target-panel {
    top: 28px; right: 28px;
    min-width: 236px;
    border-color: var(--hud-amb2);
  }
  #hud-target-panel .hud-hdr { color: var(--hud-amb); border-bottom-color: rgba(255, 179, 71, 0.2); }
  #hud-target-panel .hud-hdr .hdr-id { color: #ffd27a; }
  #hud-target-panel::before,
  #hud-target-panel::after { border-color: var(--hud-amb); }
  #hud-target-panel .tgt-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    letter-spacing: 2.2px;
    color: #ffd27a;
    line-height: 1.15;
    margin-bottom: 2px;
  }
  #hud-target-panel .tgt-sub {
    font-size: 9px;
    color: #e6c88a;
    opacity: 0.75;
    letter-spacing: 1.8px;
    margin-bottom: 8px;
  }

  /* --- Top-center: compass strip + heading --------------------------- */
  #hud-compass {
    top: 28px;
    left: 50%; transform: translateX(-50%);
    width: 460px;
    padding: 8px 12px 6px 12px;
  }
  #hud-compass .heading-block {
    display: flex; flex-direction: column; align-items: center;
    padding-bottom: 6px; margin-bottom: 6px;
    border-bottom: 1px solid var(--hud-cy3);
  }
  #hud-compass .heading-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px; letter-spacing: 4px;
    color: var(--hud-cy);
  }
  #hud-compass .heading-lbl {
    font-size: 8px; letter-spacing: 2.5px; color: var(--hud-dim);
  }
  #hud-compass .compass-viewport {
    position: relative; height: 18px;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
  }
  #hud-compass-track {
    position: absolute;
    top: 3px; left: 50%;
    display: flex;
    transform: translateX(-50%);
    white-space: nowrap;
    will-change: transform;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 1.4px;
    color: #a9d4e8;
  }
  #hud-compass-track > span {
    display: inline-block;
    width: 26px;
    text-align: center;
  }
  #hud-compass-track > span.cardinal {
    color: var(--hud-cy);
    font-family: 'Orbitron', monospace;
    font-weight: 700;
  }
  #hud-compass .compass-needle {
    position: absolute;
    top: -3px; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid var(--hud-amb);
  }

  /* --- Bottom-left: throttle block ----------------------------------- */
  #hud-throttle {
    bottom: 28px; left: 28px;
    min-width: 228px;
  }
  #hud-throttle .thr-bar-wrap {
    position: relative;
    height: 14px;
    border: 1px solid var(--hud-cy3);
    background: rgba(0, 0, 0, 0.35);
    margin-top: 2px;
  }
  #hud-throttle-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(74,214,255,0.8), rgba(74,214,255,0.45));
    box-shadow: 0 0 10px rgba(74,214,255,0.35);
  }
  #hud-throttle .thr-ticks {
    position: absolute; inset: 0;
    display: flex; justify-content: space-between;
    pointer-events: none;
  }
  #hud-throttle .thr-ticks i {
    width: 1px; height: 100%;
    background: var(--hud-cy3);
  }
  #hud-throttle .thr-foot {
    display: flex; justify-content: space-between;
    margin-top: 4px;
    font-size: 9px;
    color: var(--hud-dim);
  }
  #hud-throttle-pct {
    color: var(--hud-cy);
    font-family: 'Orbitron', monospace;
    letter-spacing: 2.2px;
  }

  /* --- Bottom-center: velocity + altitude cluster -------------------- */
  #hud-telemetry {
    bottom: 28px;
    left: 50%; transform: translateX(-50%);
    display: flex; gap: 1px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  #hud-telemetry::before, #hud-telemetry::after { display: none; }
  #hud-telemetry .tg {
    padding: 10px 18px 8px 18px;
    background: var(--hud-bg2);
    border: 1px solid var(--hud-cy2);
    text-align: center;
    min-width: 98px;
  }
  #hud-telemetry .tg-lbl {
    font-size: 8px; letter-spacing: 2.4px;
    color: var(--hud-dim);
    margin-bottom: 4px;
  }
  #hud-telemetry .tg-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    letter-spacing: 2.5px;
    color: var(--hud-cy);
    font-variant-numeric: tabular-nums;
  }
  #hud-telemetry .tg-unit {
    font-size: 8px;
    letter-spacing: 1.8px;
    color: var(--hud-dim);
    margin-left: 2px;
  }

  /* --- Bottom-right: radar ------------------------------------------- */
  #hud-radar {
    bottom: 28px; right: 28px;
    padding: 10px 12px 8px 12px;
  }
  #hud-radar .radar-hdr {
    display: flex; justify-content: space-between; align-items: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 2.4px;
    color: var(--hud-cy);
    margin-bottom: 6px;
  }
  #hud-radar #cp-dash-radar-status { font-size: 9px; letter-spacing: 1.8px; color: var(--hud-amb); }
  #hud-radar #cp-dash-tgt-count { font-size: 9px; color: var(--hud-dim); margin-top: 4px; text-align: right; }
  #hud-radar svg { display: block; }
  #hud-radar .radar-ring { fill: none; stroke: var(--hud-cy2); stroke-width: 1; }
  #hud-radar .radar-ring.dim { stroke: var(--hud-cy3); }
  #hud-radar .radar-cross { stroke: var(--hud-cy3); stroke-width: 1; }
  #hud-radar .radar-ship { fill: var(--hud-cy); }
  #hud-radar .radar-star { fill: var(--hud-cy); }
  /* Ship blips on the main radar — coloured by faction. */
  #hud-radar .radar-fleet-imperial { fill: #ff5840; }
  #hud-radar .radar-fleet-rebel    { fill: #6cff8a; }
  #hud-radar .radar-fleet-neutral  { fill: #ffd27a; }
  #hud-radar .radar-fleet-jedi     { fill: #b88dff; }
  #hud-radar .radar-fleet-capital  { stroke: #fff; stroke-width: 0.6; }

  /* --- Center reticle + pitch ladder --------------------------------- */
  #cp-reticle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 220px; height: 220px;
    pointer-events: none;
  }
  #cp-reticle svg { width: 100%; height: 100%; overflow: visible; }
  #cp-reticle .rct    { stroke: var(--hud-cy); fill: none; stroke-width: 1.4; }
  #cp-reticle .rct-dim{ stroke: var(--hud-cy2); fill: none; stroke-width: 1; }
  #cp-reticle .rct-fill { fill: var(--hud-cy); }
  #cp-reticle .hud-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 6px; letter-spacing: 2px;
    fill: var(--hud-cy);
  }

  /* Pitch ladder sits inside the reticle SVG, translated by JS each frame */
  #cp-pitch-ladder {
    position: absolute; inset: 0;
    overflow: visible;
    pointer-events: none;
  }
  #cp-pitch-ladder .pitch {
    stroke: var(--hud-cy2);
    stroke-width: 1;
    fill: none;
  }
  #cp-pitch-ladder .pitch-tick[data-step="0"] .pitch {
    stroke: var(--hud-cy);
    stroke-width: 1.6;
  }
  #cp-pitch-ladder .pitch-lbl {
    font-family: 'JetBrains Mono', monospace;
    font-size: 7px;
    fill: var(--hud-cy2);
    letter-spacing: 1px;
  }

  /* --- Boost indicator (below reticle) ------------------------------- */
  #cp-boost {
    position: absolute;
    top: calc(50% + 140px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center; gap: 8px;
    padding: 4px 12px;
    border: 1px solid var(--hud-amb);
    background: rgba(255, 179, 71, 0.14);
    color: var(--hud-amb);
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    letter-spacing: 3px;
    box-shadow: 0 0 10px rgba(255,179,71,0.28);
  }
  #cp-boost.active { display: inline-flex; }
  #cp-boost .b-dot {
    width: 6px; height: 6px;
    background: var(--hud-amb);
    border-radius: 50%;
  }

  /* --- Weapons panel (bottom-center, sits left of telemetry) ---------
       Hidden by default; only appears while body.combat-active is set,
       which the weapons HUD updater drives off spaceBattle.active so
       the chrome doesn't clutter the cockpit when you're just flying
       between systems. */
  #hud-weapons {
    position: absolute;
    bottom: 78px;
    left: calc(50% - 280px);
    transform: translateX(-100%);
    min-width: 170px;
    padding: 8px 10px;
    display: none;
  }
  body.ship-mode.combat-active #hud-weapons { display: block; }
  #hud-weapons .weap-row {
    display: flex; align-items: center; gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1.4px;
    color: var(--hud-cy2);
    margin-top: 4px;
  }
  #hud-weapons .weap-key {
    display: inline-block;
    min-width: 30px;
    padding: 1px 5px;
    text-align: center;
    border: 1px solid var(--hud-cy3);
    background: rgba(74,214,255,0.08);
    color: var(--hud-cy);
    font-family: 'Orbitron', monospace;
    font-size: 9px;
    letter-spacing: 1px;
    border-radius: 2px;
  }
  #hud-weapons .weap-lbl { flex: 1; color: var(--hud-cy); }
  #hud-weapons .weap-state,
  #hud-weapons .weap-ammo {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    color: var(--hud-amb);
    letter-spacing: 1.6px;
  }
  #hud-weapons .weap-state.cool { color: var(--hud-dim); }
  #hud-weapons .weap-ammo.empty { color: #ff5840; }
  #hud-weapons .weap-lock-wrap {
    margin-top: 6px;
    height: 4px;
    background: rgba(74,214,255,0.08);
    border: 1px solid var(--hud-cy3);
    overflow: hidden;
  }
  #hud-weapons .weap-lock-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--hud-amb), #ff8848);
    transition: width 60ms linear;
  }
  #hud-weapons.locked .weap-lock-fill {
    background: linear-gradient(90deg, #ff5840, #ff8848);
    box-shadow: 0 0 10px rgba(255,88,64,0.55);
  }
  #hud-weapons .weap-lock-lbl {
    margin-top: 3px;
    font-family: 'Orbitron', monospace;
    font-size: 8.5px;
    letter-spacing: 1.6px;
    color: var(--hud-dim);
    text-align: right;
  }
  #hud-weapons.tracking .weap-lock-lbl { color: var(--hud-amb); }
  #hud-weapons.locked   .weap-lock-lbl { color: #ff5840; animation: weap-blink 0.6s steps(2) infinite; }
  @keyframes weap-blink { 50% { opacity: 0.45; } }

  /* --- Keybind helper (bottom strip) --------------------------------- */
  #cp-exit {
    position: absolute;
    bottom: 6px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 14px;
    padding: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    letter-spacing: 1.6px;
    color: var(--hud-dim);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--hud-cy3);
    border-radius: 2px;
    pointer-events: auto;
  }
  #cp-exit > div { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
  #cp-exit strong {
    color: var(--hud-cy);
    font-family: 'Orbitron', monospace;
    font-size: 8.5px;
    padding: 2px 5px;
    border: 1px solid var(--hud-cy3);
    border-radius: 2px;
    background: rgba(74,214,255,0.06);
  }
  #cp-exit .kb-hot strong {
    color: var(--hud-amb);
    border-color: rgba(255, 179, 71, 0.35);
    background: rgba(255, 179, 71, 0.08);
  }

  /* --- In third-person view, soften the reticle so it reads as an aim
         assist rather than a cockpit HUD element, and fade the corner
         brackets slightly so the exterior ship sits cleanly in frame. */
  body.tpv #cp-reticle { opacity: 0.65; }
  body.tpv #cockpit .hud-bracket { opacity: 0.55; }

  /* --- First-person holographic cockpit (cockpit.js renders the 3D
         console + instruments). Fade the 2D corner brackets and hide the
         flat SVG reticle so the WebGL canopy + boresight read cleanly. */
  body.fpv #cockpit .hud-bracket { opacity: 0.25; }
  body.fpv #cp-reticle { opacity: 0; }

  /* --- Hidden dashboard stubs: legacy cp-dash-* IDs kept to avoid
         null references in the JS. They live inside a 0x0 wrapper. */
  #cp-dash-stubs {
    position: absolute;
    width: 0; height: 0; overflow: hidden;
    visibility: hidden;
    pointer-events: none;
  }

  /* ============================================================
     Responsive: tighter HUD on narrow viewports
     ============================================================ */
  @media (max-width: 900px) {
    #hud-nav, #hud-target-panel, #hud-throttle { min-width: 180px; }
    #hud-compass { width: 320px; }
    #cp-reticle { width: 160px; height: 160px; }
    #cp-exit { font-size: 7px; gap: 8px; padding: 3px 6px; }
    #cp-exit > div { gap: 3px; }
  }

  /* Allow view-control row to wrap on narrow screens */
  #time-panel .row { flex-wrap: wrap; }

  /* Responsive adjustments */
  @media (max-width: 900px) {
    #regions { display: none; }
    #controls-help { display: none; }
    #time-panel { width: calc(100vw - 32px); }
    #search { width: 180px; }
    #info { width: 240px; }
  }

  /* ============================================================
     STRIP GALAXY-OVERVIEW UI
     This app is now a pure ship-flying experience. The old map /
     orbit / play-time panels are hidden unconditionally. DOM is
     left in place so JS that references these elements still
     finds them (no null-ref crashes); they just never render.
     ============================================================ */
  #title,
  #search-wrap,
  #regions,
  #info,
  #time-panel,
  #controls-help,
  #labels-layer,
  #reticle,
  #tooltip { display: none !important; }

  /* ============================================================
     HANGAR BAY · SHIP-SELECT SCREEN
     First thing the player sees. Shows the selected ship in a
     hangar bay backdrop (deck grid + side bay struts + overhead
     spot lighting). Arrows cycle through the roster; LAUNCH
     commits the ship and boots the cockpit.
     ============================================================ */
  #hangar {
    position: fixed; inset: 0; z-index: 40;
    background: radial-gradient(ellipse at 50% 55%,
      #141820 0%, #0a0d12 50%, #020306 100%);
    color: #cfe5ff;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.6s ease;
  }
  #hangar.launching { opacity: 0; pointer-events: none; }
  #hangar.hidden    { display: none; }

  #hangar-canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    display: block;
  }

  /* Scanline + vignette overlay for CRT-viewport feel */
  #hangar::before {
    content: ''; position: absolute; inset: 0;
    pointer-events: none; z-index: 2;
    background: repeating-linear-gradient(0deg,
      rgba(255,255,255,0) 0px, rgba(255,255,255,0) 3px,
      rgba(0,0,0,0.12) 3px, rgba(0,0,0,0.12) 4px);
    mix-blend-mode: overlay;
    opacity: 0.5;
  }
  #hangar::after {
    content: ''; position: absolute; inset: 0;
    pointer-events: none; z-index: 3;
    background: radial-gradient(ellipse 120% 90% at 50% 55%,
      transparent 55%, rgba(0,0,0,0.55) 100%);
  }

  /* Header */
  #hangar-header {
    position: absolute; top: 36px; left: 50%;
    transform: translateX(-50%);
    text-align: center; z-index: 5;
  }
  #hangar-header h1 {
    margin: 0;
    font-size: 22px; letter-spacing: 0.5em;
    color: #ffc879; font-weight: 700;
    text-shadow: 0 0 16px rgba(255,180,80,0.45);
  }
  #hangar-header .sub {
    margin-top: 8px;
    font-size: 10px; letter-spacing: 0.45em;
    color: rgba(220,200,160,0.65);
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
  }
  #hangar-header .brand {
    margin-top: 4px;
    font-size: 9px; letter-spacing: 0.35em;
    color: rgba(140,180,220,0.55);
    font-family: 'JetBrains Mono', monospace;
  }

  /* Ship info panel on the right */
  #hangar-panel {
    position: absolute;
    right: 40px; top: 40px; bottom: 40px;
    width: 440px;
    padding: 28px 32px 32px;
    display: flex; flex-direction: column;
    background: linear-gradient(160deg,
      rgba(18,12,8,0.82),
      rgba(12,8,6,0.92));
    border: 1px solid rgba(220,160,80,0.42);
    box-shadow: 0 0 32px rgba(0,0,0,0.5),
                inset 0 1px 0 rgba(255,210,140,0.18);
    z-index: 5;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto;
  }
  #hangar-panel .hs-idx {
    font-size: 12px; letter-spacing: 0.4em;
    color: rgba(220,160,80,0.75);
    font-family: 'JetBrains Mono', monospace;
  }
  #hangar-panel .hs-name {
    margin-top: 8px;
    font-size: 34px; letter-spacing: 0.26em;
    color: #ffd49c; font-weight: 700;
    text-shadow: 0 0 14px rgba(255,180,90,0.35);
    line-height: 1.1;
  }
  #hangar-panel .hs-class {
    margin-top: 6px;
    font-size: 11px; letter-spacing: 0.3em;
    color: #e0c08c;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
  }
  #hangar-panel .hs-faction {
    display: inline-block;
    margin-top: 14px;
    padding: 4px 12px;
    font-size: 10px; letter-spacing: 0.35em;
    color: #ffb247;
    border: 1px solid rgba(255,178,71,0.5);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
  }
  #hangar-panel .hs-desc {
    margin-top: 18px;
    font-size: 13px; line-height: 1.6;
    letter-spacing: 0.04em;
    color: rgba(230,220,200,0.85);
    font-family: 'JetBrains Mono', monospace;
  }
  /* Second paragraph — canon-accurate ship lore (manufacturer, battles,
     notable pilots). Visually distinct from the punchy .hs-desc blurb
     above: dimmer amber, smaller, and prefixed by a thin amber rule so
     the reader's eye registers it as "extended intel". */
  #hangar-panel .hs-lore {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(220,160,80,0.18);
    font-size: 11px; line-height: 1.65;
    letter-spacing: 0.05em;
    color: rgba(210,190,160,0.7);
    font-family: 'JetBrains Mono', monospace;
    font-style: italic;
  }
  #hangar-panel .hs-stats {
    margin-top: auto;
    padding-top: 22px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #hangar-panel .stat {
    display: grid;
    grid-template-columns: 110px 1fr 32px;
    align-items: center; gap: 12px;
    font-size: 10px; letter-spacing: 0.22em;
    color: rgba(220,200,160,0.8);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
  }
  #hangar-panel .stat .bar {
    height: 7px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(220,160,80,0.2);
    position: relative;
    overflow: hidden;
  }
  #hangar-panel .stat .bar .fill {
    position: absolute; inset: 0 auto 0 0;
    background: linear-gradient(to right,
      #ffb247 0%, #ffd49c 60%, #ffe8c0 100%);
    box-shadow: 0 0 6px rgba(255,180,90,0.55);
    transition: width 0.5s cubic-bezier(.2,.7,.2,1);
  }
  #hangar-panel .stat .num {
    font-weight: 700; color: #ffd49c;
    text-align: right;
  }
  #hangar-panel .stat.decorative .bar .fill {
    background: linear-gradient(to right,
      rgba(120,160,180,0.55), rgba(170,210,230,0.85));
    box-shadow: 0 0 6px rgba(120,200,230,0.4);
  }

  /* Left/right navigation arrows */
  .hangar-arrow {
    position: absolute; top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 52px; height: 88px;
    background: rgba(12,8,4,0.7);
    border: 1px solid rgba(220,160,80,0.45);
    color: #ffd49c; font-size: 32px; line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Orbitron', sans-serif; font-weight: 700;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
  }
  .hangar-arrow:hover {
    background: rgba(40,24,10,0.85);
    border-color: #ffb247;
    box-shadow: 0 0 18px rgba(255,178,71,0.35);
  }
  .hangar-arrow:active { transform: translateY(-50%) scale(0.94); }
  #hangar-prev { left: 36px; }
  /* Positioned just left of the info panel (right:40px + width:440px). */
  #hangar-next { left: calc(100% - 40px - 440px - 24px - 52px); }

  /* Bay indicator dots under the ship */
  #hangar-bay-dots {
    position: absolute; bottom: 120px; left: 50%;
    transform: translateX(-50%); z-index: 5;
    display: flex; gap: 12px;
  }
  .bay-dot {
    width: 10px; height: 10px;
    border: 1px solid rgba(220,160,80,0.55);
    background: transparent;
    transform: rotate(45deg);
    transition: all 0.2s;
    cursor: pointer;
  }
  .bay-dot.active {
    background: #ffb247;
    box-shadow: 0 0 10px rgba(255,178,71,0.7);
    border-color: #ffb247;
  }

  /* Launch button */
  #hangar-launch {
    position: absolute; bottom: 40px; left: 50%;
    transform: translateX(-50%); z-index: 6;
    padding: 14px 48px;
    background: linear-gradient(to bottom,
      rgba(60,30,10,0.9), rgba(30,15,5,0.95));
    border: 1px solid #ffb247;
    color: #ffe8c0;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px; font-weight: 700;
    letter-spacing: 0.55em;
    cursor: pointer;
    box-shadow: 0 0 24px rgba(255,178,71,0.35),
                inset 0 0 18px rgba(255,178,71,0.15);
    text-shadow: 0 0 10px rgba(255,220,160,0.5);
    transition: all 0.18s;
  }
  #hangar-launch:hover {
    background: linear-gradient(to bottom,
      rgba(80,40,14,0.95), rgba(50,24,8,0.98));
    box-shadow: 0 0 36px rgba(255,178,71,0.55),
                inset 0 0 24px rgba(255,178,71,0.25);
    letter-spacing: 0.6em;
  }
  #hangar-launch:active { transform: translateX(-50%) scale(0.97); }

  /* Hint row at bottom left */
  #hangar-hint {
    position: absolute; bottom: 46px; left: 36px;
    z-index: 5;
    font-size: 9px; letter-spacing: 0.25em;
    color: rgba(200,180,140,0.5);
    font-family: 'JetBrains Mono', monospace;
  }
  #hangar-hint kbd {
    display: inline-block;
    margin: 0 4px;
    padding: 2px 6px;
    border: 1px solid rgba(220,160,80,0.4);
    color: #e0c08c;
    font-family: inherit;
    font-size: 8px;
    letter-spacing: 0.2em;
  }

/* ---------------------------------------------------------------
   Landed mode — when the player is on a planet in the procedural
   hangar, hide all flight HUD/cockpit chrome so the hangar scene
   reads as a full-screen environment. Flight state is preserved
   under the hood (landed.js just swaps the render target), so on
   takeoff the cockpit flashes back in unchanged.
   --------------------------------------------------------------- */
body.landed-mode #cockpit,
body.landed-mode #cockpit.active,
body.landed-mode #target-hud,
body.landed-mode #course-line,
body.landed-mode #hud-heading,
body.landed-mode #nav-modal,
body.landed-mode #hangar-panel,
body.landed-mode #ship-banner,
body.landed-mode #controls-hint {
  display: none !important;
}

/* ==========================================================
   PORTRAIT GATE — rotate-to-landscape prompt for phones.
   Only ever shown on coarse-pointer devices (touchscreens),
   and only when the viewport is taller than it is wide. CSS
   alone handles show/hide so the moment the user rotates
   back to portrait we can reassert the prompt.
   ========================================================== */
#portrait-gate {
  position: fixed; inset: 0;
  display: none;
  z-index: 50000;                 /* above everything else */
  background: radial-gradient(120% 80% at 50% 30%, rgba(20, 40, 70, 0.94), #02040a 70%);
  color: #cfe5ff;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Orbitron', 'JetBrains Mono', monospace;
  pointer-events: auto;
}
#portrait-gate .pg-inner {
  padding: 32px 28px;
  max-width: 360px;
}
#portrait-gate .pg-phone {
  width: 120px; height: auto; color: #4ad6ff;
  filter: drop-shadow(0 0 18px rgba(74, 214, 255, 0.55));
  animation: pg-rotate 2.6s ease-in-out infinite;
  transform-origin: 60px 100px;
}
@keyframes pg-rotate {
  0%   { transform: rotate(0deg); }
  45%  { transform: rotate(0deg); }
  70%  { transform: rotate(-90deg); }
  100% { transform: rotate(-90deg); }
}
#portrait-gate .pg-title {
  margin-top: 22px;
  font-size: 18px; letter-spacing: 3px; font-weight: 700;
  color: #ffd27a;
  text-shadow: 0 0 10px rgba(255, 179, 71, 0.5);
}
#portrait-gate .pg-sub {
  margin-top: 10px;
  font-size: 13px; letter-spacing: 1.5px;
  color: #8fb4d8;
  font-family: 'JetBrains Mono', monospace;
}
/* Show gate only on coarse-pointer (touch) devices in portrait. */
@media (orientation: portrait) and (pointer: coarse) {
  #portrait-gate { display: flex; }
}
/* Desktop developer override — never show the gate on a mouse. */
@media (hover: hover) and (pointer: fine) {
  #portrait-gate { display: none !important; }
}

/* ==========================================================
   TOUCH UI — virtual joystick + action buttons shown on
   touch devices. body.touch-ui is set from js/mobile.js and
   driven by a one-shot coarse-pointer detect at boot.
   ========================================================== */
#touch-ui {
  display: none;
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 4500;                 /* above HUD, below nav modal + gate */
  font-family: 'Orbitron', 'JetBrains Mono', monospace;
  color: #cfe5ff;
  -webkit-user-select: none;
  user-select: none;
}
body.touch-ui.ship-mode #touch-ui { display: block; }
body.touch-ui.ship-mode.nav-open #touch-ui,
body.touch-ui.ship-mode.experience-overlay-open #touch-ui,
body.touch-ui.landed-mode #touch-ui { display: none; }

/* ---- Look joystick ---- */
#touch-ui .tui-look {
  position: absolute;
  left: calc(env(safe-area-inset-left, 0px) + 28px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  width: 150px; height: 150px;
  pointer-events: auto;
  touch-action: none;
}
#touch-ui .tui-look-base {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(74, 214, 255, 0.55);
  background: radial-gradient(circle at 50% 50%, rgba(74,214,255,0.10), rgba(6,10,20,0.55) 70%);
  box-shadow: 0 0 22px rgba(74, 214, 255, 0.22), inset 0 0 30px rgba(0,0,0,0.55);
}
#touch-ui .tui-look-knob {
  position: absolute;
  width: 56px; height: 56px;
  left: 50%; top: 50%;
  margin-left: -28px; margin-top: -28px;
  border-radius: 50%;
  border: 2px solid #4ad6ff;
  background: radial-gradient(circle at 35% 30%, rgba(120, 220, 255, 0.55), rgba(30, 70, 120, 0.8));
  box-shadow: 0 0 20px rgba(74, 214, 255, 0.45);
  transition: transform 0.08s ease-out;
  pointer-events: none;
}
#touch-ui .tui-look-hint {
  position: absolute; bottom: -22px; left: 0; right: 0;
  text-align: center; font-size: 10px; letter-spacing: 3px;
  color: rgba(160, 200, 230, 0.65);
}

/* ---- Right-side action stack (THRUST/BOOST/BRAKE) ---- */
#touch-ui .tui-right {
  position: absolute;
  right: calc(env(safe-area-inset-right, 0px) + 18px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}
#touch-ui .tui-btn {
  width: 96px; height: 60px;
  border-radius: 12px;
  border: 1.5px solid rgba(74, 214, 255, 0.55);
  background: linear-gradient(135deg, rgba(74, 214, 255, 0.14), rgba(6, 10, 20, 0.7));
  color: #cfe5ff;
  font-family: inherit;
  font-size: 13px; letter-spacing: 2px;
  font-weight: 600;
  box-shadow: 0 0 14px rgba(74, 214, 255, 0.22);
  padding: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
#touch-ui .tui-btn.pressed {
  background: linear-gradient(135deg, rgba(74, 214, 255, 0.40), rgba(20, 50, 90, 0.75));
  box-shadow: 0 0 22px rgba(74, 214, 255, 0.55), inset 0 0 14px rgba(74, 214, 255, 0.35);
  color: #fff;
  transform: translateY(1px);
}
#touch-ui .tui-btn-boost {
  border-color: rgba(255, 179, 71, 0.6);
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.14), rgba(6, 10, 20, 0.7));
  color: #ffd27a;
  box-shadow: 0 0 14px rgba(255, 179, 71, 0.22);
}
#touch-ui .tui-btn-boost.pressed {
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.45), rgba(90, 50, 20, 0.75));
  box-shadow: 0 0 22px rgba(255, 179, 71, 0.55), inset 0 0 14px rgba(255, 179, 71, 0.35);
  color: #fff;
}
#touch-ui .tui-btn-brake {
  border-color: rgba(255, 85, 56, 0.55);
  background: linear-gradient(135deg, rgba(255, 85, 56, 0.14), rgba(6, 10, 20, 0.7));
  color: #ff9a80;
}
#touch-ui .tui-btn-brake.pressed {
  background: linear-gradient(135deg, rgba(255, 85, 56, 0.4), rgba(90, 20, 20, 0.75));
  box-shadow: 0 0 22px rgba(255, 85, 56, 0.5), inset 0 0 14px rgba(255, 85, 56, 0.35);
  color: #fff;
}

/* ---- Top-right action chips (NAV/JUMP/LAND/VIEW) ---- */
#touch-ui .tui-top {
  position: absolute;
  right: calc(env(safe-area-inset-right, 0px) + 18px);
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  display: flex;
  gap: 8px;
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 60vw;
}
#touch-ui .tui-chip {
  min-width: 58px; height: 40px; padding: 0 14px;
  border-radius: 8px;
  border: 1.5px solid rgba(74, 214, 255, 0.55);
  background: rgba(6, 10, 20, 0.72);
  color: #cfe5ff;
  font-family: inherit;
  font-size: 12px; letter-spacing: 2px; font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 12px rgba(74, 214, 255, 0.18);
}
#touch-ui .tui-chip:active,
#touch-ui .tui-chip.pressed {
  background: rgba(74, 214, 255, 0.25);
  color: #fff;
}
#touch-ui .tui-chip-view {
  border-color: rgba(255, 179, 71, 0.55);
  color: #ffd27a;
}

/* ---- Top-left combat stack (FIRE / TORP) — opposite the top-right
       NAV/HYPER/LAND chips. FIRE pulses while held; TORP has its own
       lock-acquired colour so the player can see when the torpedo is
       ready to launch. Ammo counter sits beneath the TORP label.
       Visible only while a space battle is active (body.combat-active),
       matching the desktop weapons HUD gate. */
#touch-ui .tui-combat {
  position: absolute;
  left: calc(env(safe-area-inset-left, 0px) + 18px);
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  display: none;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}
body.touch-ui.ship-mode.combat-active #touch-ui .tui-combat { display: flex; }
#touch-ui .tui-combat .tui-btn {
  width: 84px; height: 50px;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1.05;
}
#touch-ui .tui-btn-fire {
  border-color: rgba(255, 88, 64, 0.6);
  background: linear-gradient(135deg, rgba(255, 88, 64, 0.16), rgba(20, 6, 6, 0.7));
  color: #ff9a80;
  box-shadow: 0 0 12px rgba(255, 88, 64, 0.22);
}
#touch-ui .tui-btn-fire.pressed {
  background: linear-gradient(135deg, rgba(255, 88, 64, 0.55), rgba(80, 12, 12, 0.85));
  box-shadow: 0 0 22px rgba(255, 88, 64, 0.65), inset 0 0 12px rgba(255, 88, 64, 0.4);
  color: #fff;
}
#touch-ui .tui-btn-torp {
  border-color: rgba(255, 179, 71, 0.55);
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.14), rgba(20, 14, 6, 0.7));
  color: #ffd27a;
}
#touch-ui .tui-btn-torp.tracking {
  border-color: rgba(255, 179, 71, 0.85);
  box-shadow: 0 0 14px rgba(255, 179, 71, 0.35);
}
#touch-ui .tui-btn-torp.locked {
  border-color: #ff5840;
  background: linear-gradient(135deg, rgba(255, 88, 64, 0.45), rgba(80, 12, 12, 0.9));
  box-shadow: 0 0 22px rgba(255, 88, 64, 0.65);
  color: #fff;
  animation: weap-blink 0.6s steps(2) infinite;
}
#touch-ui .tui-btn-torp .tui-btn-sub {
  font-size: 10px; letter-spacing: 1.2px;
  color: var(--hud-amb, #ffd27a);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}
#touch-ui .tui-btn-torp.empty .tui-btn-sub { color: #ff5840; }

/* Touch takeoff button — hidden except in landed mode on touch devices. */
#tui-takeoff {
  display: none;
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 18px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 4600;
  padding: 16px 28px;
  border-radius: 10px;
  border: 1.5px solid #ffb247;
  background: linear-gradient(135deg, rgba(255,178,71,0.22), rgba(60,30,10,0.9));
  color: #ffe8c0;
  font-family: 'Orbitron', 'JetBrains Mono', monospace;
  font-size: 14px; letter-spacing: 4px; font-weight: 700;
  box-shadow: 0 0 22px rgba(255, 178, 71, 0.4);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
body.touch-ui.landed-mode #tui-takeoff { display: block; }
#tui-takeoff:active { transform: translateY(2px); }

/* ==========================================================
   MOBILE-RESPONSIVE TWEAKS — shrink the cockpit HUD and
   make the hangar usable on small landscape screens.
   ========================================================== */
@media (max-width: 960px) and (orientation: landscape) {
  /* Hangar header lives top-left; compress it so the ship
     silhouette + arrows aren't crowded on phone-landscape. */
  #hangar-header { top: 12px; }
  #hangar-header h1 { font-size: 18px; letter-spacing: 4px; }
  #hangar-header .sub,
  #hangar-header .brand { font-size: 9px; letter-spacing: 0.25em; }
  .hangar-arrow {
    width: 52px; height: 64px;
    font-size: 26px;
    -webkit-tap-highlight-color: transparent;
  }
  #hangar-prev { left: 12px; }
  /* Next arrow needs to hug the panel's left edge regardless of
     desktop's hardcoded 440px panel width — on mobile the panel is
     ~40vw, so anchor to right: instead of calc(100% - …). */
  #hangar-next {
    left: auto;
    right: calc(40vw + 18px);
  }
  #hangar-panel {
    max-width: 38vw;
    right: 12px; top: 12px;
    padding: 12px 14px;
    font-size: 11px;
  }
  #hangar-panel .hs-name { font-size: 16px !important; letter-spacing: 2px !important; }
  #hangar-panel .hs-class,
  #hangar-panel .hs-desc,
  #hangar-panel .hs-lore { font-size: 10px !important; }
  #hangar-panel .hs-stats { gap: 4px !important; }
  #hangar-bay-dots { bottom: 72px; }
  #hangar-launch {
    bottom: 16px;
    padding: 10px 32px; font-size: 13px; letter-spacing: 4px;
  }
  /* Cockpit HUD — the 8px corner brackets + 12-14px readouts
     work fine at this scale; we just need to stop the side
     panels from devouring the centre of the screen. */
  #cockpit .hud-panel { font-size: 11px; }
  #cockpit .tgt-name { font-size: 14px; }
  #hud-compass { transform: scale(0.85); transform-origin: top center; }
  #autopilot-indicator { font-size: 11px; padding: 8px 10px; }
  /* Hide the keybind strip / controls hint — keys aren't real on mobile. */
  #controls-hint, #cockpit-keybinds, #keybinds-strip { display: none !important; }
  /* ----- Nav computer mobile layout -----
     Full-screen panel, no border radius. Header collapses to a tight
     top strip. Body is one column: search → filter → scrollable
     results take all remaining height → compact detail strip → action
     buttons at the bottom in a horizontal row (NOT stacked vertically
     like desktop, which would push the buttons off-screen). The
     keyboard-only nav-tips row is hidden — it just confused players
     reading "↑↓ navigate · Enter select" on a touchscreen. */
  #nav-computer .nc-panel {
    width: 100vw;
    height: 100vh;       /* fallback */
    height: 100dvh;      /* shrinks when iOS keyboard pops up */
    max-width: none; max-height: none;
    border-radius: 0;
  }
  #nav-computer .nc-header {
    padding: 6px 12px;
  }
  #nav-computer .nc-title { font-size: 12px; letter-spacing: 2px; }
  #nav-computer .nc-sub   { font-size: 9px;  letter-spacing: 1px; }
  #nav-computer .nc-close { width: 36px; height: 36px; font-size: 18px; }

  #nav-computer .nc-body {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  #nav-computer .nc-left,
  #nav-computer .nc-right {
    width: 100%; max-width: none;
    padding: 8px 10px;
  }
  #nav-computer .nc-left {
    flex: 1 1 auto;
    min-height: 0;       /* required so the inner overflow:auto works */
  }
  #nav-computer .nc-right {
    flex: 0 0 auto;
    border-top: 1px solid rgba(74, 214, 255, 0.18);
  }
  #nav-computer .nc-search { padding-left: 32px; }
  #nav-computer #nc-input {
    font-size: 16px;     /* prevents iOS focus-zoom */
    padding: 8px 6px;
  }
  #nav-computer .nc-search-icon { left: 8px; width: 14px; height: 14px; }
  #nav-computer .nc-filter-bar { padding: 4px 2px; font-size: 10px; }
  #nav-computer .nc-tips        { display: none !important; }
  #nav-computer .nc-results { margin-top: 4px; }
  #nav-computer .nc-row { padding: 10px 12px; font-size: 12px; }

  /* Detail card — strip down to a single row: name + key info, no
     dl-grid — there isn't room. Hide if nothing's selected. */
  #nav-computer .nc-detail {
    padding: 6px 4px;
    font-size: 10px;
    max-height: 80px;
    overflow: hidden;
  }
  #nav-computer .nc-detail h4 { font-size: 13px; margin-bottom: 2px; }
  #nav-computer .nc-detail .nc-detail-sub { font-size: 9px; margin-bottom: 4px; }
  #nav-computer .nc-detail-grid { font-size: 9px; gap: 2px 8px; }
  #nav-computer .nc-detail-coord { display: none; }

  /* Action buttons go horizontal — three or four small buttons that
     fit on one row instead of the desktop vertical stack. */
  #nav-computer .nc-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
  }
  #nav-computer .nc-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 4px 6px;
  }
  #nav-computer .nc-btn-line { font-size: 11px; letter-spacing: 1px; }
  #nav-computer .nc-btn-sub  { font-size: 8px;  letter-spacing: 0.5px; }
}
@media (max-width: 960px) and (orientation: landscape) and (pointer: coarse) {
  /* Hangar hint is keyboard-only. */
  #hangar-hint { display: none !important; }
}

/* ============================================================
   TOUCH-COCKPIT CLEANUP — when the user is in ship mode on a
   touch device, every HUD element that overlaps a touch
   control gets hidden. Keep just the bare essentials (reticle,
   compact coords, hyperjump prompt) so the touch joystick +
   thrust stack + chips have unobstructed real estate.
   ============================================================ */
body.touch-ui.ship-mode #hud-throttle,
body.touch-ui.ship-mode #hud-radar,
body.touch-ui.ship-mode #hud-compass,
body.touch-ui.ship-mode #hud-telemetry,
body.touch-ui.ship-mode #hud-target-panel,
body.touch-ui.ship-mode #cp-boost,
body.touch-ui.ship-mode #hud-weapons,
body.touch-ui.ship-mode #controls-hint {
  display: none !important;
}

/* On touch, compact the nav-data card down to a tiny coords-only chip
   in the top-left and shrink the reticle so it doesn't dominate. */
@media (orientation: landscape) and (pointer: coarse) {
  body.ship-mode #hud-nav {
    top: 8px; left: 8px;
    padding: 6px 10px !important;
    font-size: 9px !important;
  }
  body.ship-mode #hud-nav .hud-title,
  body.ship-mode #hud-nav .hud-num { display: none !important; }
  body.ship-mode #hud-nav .hud-row { line-height: 1.2; }
  body.ship-mode #hud-nav .hud-row .lbl { font-size: 8px !important; }
  body.ship-mode #hud-nav b { font-size: 9px !important; }
  /* Drop the centre reticle scale a hair — leaves more clean view. */
  body.ship-mode #cp-reticle { transform: translate(-50%, -50%) scale(0.7); }
  /* Hyperjump prompt — float it just above the centre, not at the
     target panel which we've now hidden. */
  body.ship-mode #hj-prompt {
    position: fixed;
    top: 12%; right: auto; left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
  }
  /* Pitch-ladder labels (PORT / STBD) in the reticle clutter the
     centre view on small screens — hide them. */
  body.ship-mode #cp-reticle .pitch-side-label,
  body.ship-mode #cp-reticle text { display: none !important; }
}
/* Prevent iOS rubber-banding around the game surface. A later accessibility
   override restores native two-finger pinch zoom while keeping page pan off. */
html, body {
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
#canvas-wrap,
#canvas-wrap canvas,
#hangar-canvas {
  touch-action: none;
}
.nc-results { touch-action: pan-y; }

/* ============================================================
   LAUNCH POLISH · accessibility, hierarchy, and social-first
   responsive layouts. These overrides intentionally preserve the
   existing element ids and runtime layout hooks.
   ============================================================ */

/* Keyboard users need a visible location even inside the holographic UI. */
:where(button, input, [tabindex]):focus-visible {
  outline: 2px solid #ffd27a;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(255, 210, 122, 0.18);
}

/* The surrounding game chrome stays non-selectable, but actual prose and
   form values can be copied, selected, and zoomed like normal page content. */
:where(input, textarea, [contenteditable="true"], .hs-desc, .hs-lore,
  #planet-info-panel, #planet-info-desc, .nc-detail) {
  -webkit-user-select: text;
  user-select: text;
}

/* Keep single-finger game input intact while allowing the browser's native
   two-finger page zoom. The viewport meta no longer suppresses scaling. */
#canvas-wrap,
#canvas-wrap canvas,
#hangar-canvas { touch-action: pinch-zoom; }

#info .close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
}

/* Ship-specific subcopy is updated by mobile.js for every input mode. */
#hangar-launch {
  min-width: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
#hangar-launch .hangar-launch-label {
  padding-left: 0.55em;
}
#hangar-launch .hangar-launch-copy {
  max-width: 230px;
  overflow: hidden;
  color: rgba(224, 192, 140, 0.72);
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

#hangar-panel,
.nc-results,
.nc-detail,
#planet-info-panel,
#planet-info-desc {
  overscroll-behavior: contain;
  scrollbar-color: rgba(74, 214, 255, 0.42) rgba(74, 214, 255, 0.06);
  scrollbar-width: thin;
}

/* Give the flight view a clear information hierarchy: target and velocity
   remain primary while reference telemetry recedes without losing data. */
#hud-target-panel {
  background: rgba(12, 16, 22, 0.82) !important;
  box-shadow: inset 0 0 14px rgba(255, 179, 71, 0.09), 0 8px 30px rgba(0, 0, 0, 0.25) !important;
}
#hud-telemetry { opacity: 0.94; }
#hud-compass   { opacity: 0.86; }
#hud-nav       { opacity: 0.70; }
#hud-throttle  { opacity: 0.72; }
#hud-radar     { opacity: 0.68; }
body.combat-active #hud-radar { opacity: 0.88; }
#hud-nav .hud-row:not(:last-child) { opacity: 0.72; }
#cp-exit {
  max-width: calc(100vw - 48px);
  gap: 9px;
  opacity: 0.58;
}

/* The nav computer is a task surface, not translucent cockpit glass. */
#nav-computer {
  background: rgba(0, 3, 10, 0.84);
  backdrop-filter: blur(10px) saturate(0.72);
  -webkit-backdrop-filter: blur(10px) saturate(0.72);
}
.nc-panel {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.82),
    0 24px 80px rgba(0, 0, 0, 0.78),
    0 0 40px rgba(74, 214, 255, 0.12),
    inset 0 0 30px rgba(0, 0, 0, 0.62);
}
.nc-left,
.nc-right { background: rgba(3, 9, 17, 0.97); }

/* In portrait the prompt is a compact, nonblocking recommendation. The
   player can inspect and change ships; only active flight becomes gated. */
@media (orientation: portrait) and (pointer: coarse) {
  #portrait-gate {
    inset: auto max(12px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    z-index: 46;
    min-height: 54px;
    border: 1px solid rgba(74, 214, 255, 0.34);
    border-radius: 5px;
    background: rgba(3, 10, 19, 0.92);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.58), inset 0 0 20px rgba(74, 214, 255, 0.05);
    pointer-events: none;
  }
  #portrait-gate .pg-inner {
    width: 100%;
    max-width: none;
    padding: 9px 12px;
  }
  #portrait-gate .pg-phone { display: none; }
  #portrait-gate .pg-title {
    margin: 0;
    font-size: 10px;
    letter-spacing: 2px;
  }
  #portrait-gate .pg-sub {
    margin-top: 4px;
    font-size: 9px;
    letter-spacing: 0.7px;
    line-height: 1.35;
  }

  body.touch-ui.ship-mode:not(.landed-mode) #portrait-gate {
    inset: 0;
    z-index: 50000;
    min-height: 100%;
    border: 0;
    border-radius: 0;
    background: radial-gradient(120% 80% at 50% 30%, rgba(20, 40, 70, 0.97), #02040a 70%);
    pointer-events: auto;
  }
  body.touch-ui.ship-mode:not(.landed-mode) #touch-ui { display: none !important; }
  body.touch-ui.ship-mode:not(.landed-mode) #experience-dock { display: none !important; }
  body.touch-ui.ship-mode:not(.landed-mode) #portrait-gate .pg-inner {
    width: auto;
    max-width: 360px;
    padding: 32px 28px;
  }
  body.touch-ui.ship-mode:not(.landed-mode) #portrait-gate .pg-phone {
    display: inline-block;
  }
  body.touch-ui.ship-mode:not(.landed-mode) #portrait-gate .pg-title {
    margin-top: 22px;
    font-size: 18px;
    letter-spacing: 3px;
  }
  body.touch-ui.ship-mode:not(.landed-mode) #portrait-gate .pg-sub {
    margin-top: 10px;
    font-size: 13px;
    letter-spacing: 1.5px;
  }
  body.landed-mode #portrait-gate { display: none !important; }
}

/* Portrait hangar: reserve the upper stage for the ship, keep all navigation
   targets inside the viewport, and turn the dossier into a concise card. */
@media (max-width: 600px) and (orientation: portrait) {
  #hangar-header {
    top: max(15px, env(safe-area-inset-top));
    left: 16px;
    right: 16px;
    width: auto;
    transform: none;
  }
  #hangar-header h1 {
    font-size: 18px;
    letter-spacing: 0.34em;
  }
  #hangar-header .sub {
    margin-top: 7px;
    font-size: 10px;
    letter-spacing: 0.2em;
  }
  #hangar-header .brand {
    margin-top: 5px;
    font-size: 8px;
    letter-spacing: 0.12em;
    line-height: 1.4;
  }
  .hangar-arrow {
    top: 31%;
    width: 44px;
    height: 58px;
    font-size: 24px;
  }
  #hangar-prev { left: 12px; }
  #hangar-next { right: 12px; left: auto; }
  #hangar-panel {
    top: min(43dvh, 360px);
    right: 14px;
    bottom: 210px;
    left: 14px;
    width: auto;
    min-height: 210px;
    padding: 14px 16px;
    background: linear-gradient(160deg, rgba(18, 12, 8, 0.92), rgba(8, 6, 5, 0.96));
  }
  #hangar-panel .hs-idx { font-size: 9px; }
  #hangar-panel .hs-name {
    margin-top: 5px;
    font-size: 20px;
    letter-spacing: 0.16em;
  }
  #hangar-panel .hs-class { margin-top: 4px; font-size: 9px; }
  #hangar-panel .hs-faction { margin-top: 8px; padding: 3px 8px; font-size: 8px; }
  #hangar-panel .hs-desc {
    display: -webkit-box;
    margin-top: 10px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  #hangar-panel .hs-lore { display: none !important; }
  #hangar-panel .hs-stats {
    margin-top: 10px;
    padding-top: 0;
    gap: 5px;
  }
  #hangar-panel .stat {
    grid-template-columns: 76px 1fr 24px;
    gap: 7px;
    font-size: 8px;
    letter-spacing: 0.12em;
  }
  #hangar-panel .stat:nth-child(n+5) { display: none; }
  #hangar-bay-dots {
    bottom: 155px;
    max-width: calc(100vw - 40px);
    gap: 7px;
  }
  .bay-dot { width: 8px; height: 8px; }
  #hangar-launch {
    bottom: 78px;
    width: min(270px, calc(100vw - 52px));
    min-width: 0;
    padding: 11px 20px;
    font-size: 13px;
    letter-spacing: 0.4em;
  }
  #hangar-hint { display: none; }
}

/* Small landscape is the actual cockpit target. The right dossier becomes a
   compact summary and the ship stage gets its own centre line. */
@media (max-width: 960px) and (orientation: landscape) {
  #hangar-header {
    left: 30vw;
    width: 56vw;
  }
  #hangar-header .sub,
  #hangar-header .brand {
    line-height: 1.35;
    white-space: normal;
  }
  #hangar-panel {
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: 38vw;
    max-width: none;
    padding: 10px 12px;
  }
  #hangar-panel .hs-idx { font-size: 8px; }
  #hangar-panel .hs-faction { margin-top: 6px; padding: 2px 7px; font-size: 8px; }
  #hangar-panel .hs-desc {
    display: -webkit-box;
    margin-top: 7px;
    overflow: hidden;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  #hangar-panel .hs-lore { display: none !important; }
  #hangar-panel .hs-stats { margin-top: 7px; padding-top: 0; gap: 4px !important; }
  #hangar-panel .stat {
    grid-template-columns: 68px 1fr 20px;
    gap: 5px;
    font-size: 7.5px;
    letter-spacing: 0.1em;
  }
  #hangar-panel .stat:nth-child(n+5) { display: none; }
  #hangar-prev { left: 10px; }
  #hangar-next { right: calc(40vw + 8px); left: auto; }
  #hangar-bay-dots { bottom: 64px; left: 30vw; gap: 7px; }
  .bay-dot { width: 8px; height: 8px; }
  #hangar-launch {
    bottom: 12px;
    left: 30vw;
    min-width: 220px;
    padding: 9px 22px;
    font-size: 12px;
  }
}

/* Portrait nav computer mirrors the landscape full-screen treatment but
   allocates a scrollable upper half to results and a compact action tray. */
@media (max-width: 700px) and (orientation: portrait) {
  #nav-computer { align-items: stretch; }
  #nav-computer .nc-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
  #nav-computer .nc-header { padding: max(10px, env(safe-area-inset-top)) 12px 9px; }
  #nav-computer .nc-title { font-size: 13px; letter-spacing: 2.4px; }
  #nav-computer .nc-sub { font-size: 9px; letter-spacing: 0.8px; }
  #nav-computer .nc-close { width: 42px; height: 42px; }
  #nav-computer .nc-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 0;
  }
  #nav-computer .nc-left,
  #nav-computer .nc-right {
    width: 100%;
    max-width: none;
    padding: 10px 12px;
  }
  #nav-computer .nc-left {
    flex: 1 1 52%;
    min-height: 250px;
  }
  #nav-computer .nc-right {
    flex: 0 1 43%;
    min-height: 0;
    overflow-y: auto;
    border-top: 1px solid rgba(74, 214, 255, 0.18);
  }
  #nav-computer .nc-search { padding-left: 34px; }
  #nav-computer #nc-input { padding: 10px 6px; font-size: 16px; }
  #nav-computer .nc-filter-bar { padding: 6px 2px; }
  #nav-computer .nc-tips { display: none; }
  #nav-computer .nc-results { margin-top: 3px; }
  #nav-computer .nc-row { min-height: 44px; padding: 10px 8px; }
  #nav-computer .nc-row-region { display: none; }
  #nav-computer .nc-detail {
    flex: 0 1 auto;
    max-height: 126px;
    padding: 10px;
    overflow-y: auto;
  }
  #nav-computer .nc-detail-empty { padding: 20px 8px; }
  #nav-computer .nc-detail h4 { font-size: 15px; }
  #nav-computer .nc-detail-coord { display: none; }
  #nav-computer .nc-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 8px;
  }
  #nav-computer .nc-btn {
    min-height: 52px;
    padding: 8px;
  }
  #nav-computer .nc-btn-line { font-size: 10px; letter-spacing: 1px; }
  #nav-computer .nc-btn-sub { font-size: 8px; letter-spacing: 0.25px; }
}

/* Landed dossiers are generated with inline desktop dimensions. Stronger
   responsive overrides keep both cards independently scrollable. */
#planet-info-panel,
#planet-info-desc { touch-action: pan-y pinch-zoom; }
.planet-info-close { min-width: 40px !important; min-height: 40px !important; }

@media (max-width: 700px) and (orientation: portrait) {
  #planet-info-panel,
  #planet-info-desc {
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    overflow-y: auto !important;
  }
  #planet-info-panel {
    top: max(64px, calc(env(safe-area-inset-top) + 50px)) !important;
    max-height: calc(54dvh - 70px) !important;
  }
  #planet-info-desc {
    top: 55dvh !important;
    max-height: calc(44dvh - env(safe-area-inset-bottom)) !important;
  }
  #planet-info-hint {
    top: auto !important;
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    left: 12px !important;
    line-height: 1.5 !important;
    text-align: center !important;
    white-space: normal !important;
  }
  #landed-toast {
    top: max(12px, env(safe-area-inset-top)) !important;
    width: calc(100vw - 24px) !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
  }
}

@media (max-width: 960px) and (orientation: landscape) {
  #planet-info-panel,
  #planet-info-desc {
    top: 50px !important;
    bottom: 8px !important;
    width: min(38vw, 310px) !important;
    max-height: calc(100dvh - 58px) !important;
    overflow-y: auto !important;
  }
  #planet-info-panel { right: 8px !important; }
  #planet-info-desc { left: 8px !important; }
  #planet-info-hint { top: 8px !important; right: 8px !important; }
  #landed-toast {
    top: 8px !important;
    max-width: 48vw !important;
    min-width: 0 !important;
    padding: 8px 14px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #hyperspace-fx,
  #speedlines-fx { opacity: 0 !important; }
  #hyperspace-flash { background: rgba(120, 170, 230, 0.14); }
}

/* ============================================================
   EXPERIENCE SHELL · missions, sharing, pause, and onboarding
   Generated at runtime by experience.js and deliberately styled as
   restrained cockpit instrumentation rather than a second design system.
   ============================================================ */
#experience-shell {
  font-family: 'JetBrains Mono', monospace;
}

#experience-dock {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 58;
  display: none;
  align-items: stretch;
  gap: 2px;
  padding: 4px;
  transform: translateX(-50%);
  border: 1px solid rgba(74, 214, 255, 0.30);
  border-radius: 4px;
  background: rgba(3, 10, 18, 0.86);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.56), inset 0 0 18px rgba(74, 214, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}
body.ship-mode:not(.landed-mode):not(.nav-open):not(.experience-overlay-open):not(.experience-hyperspace) #experience-dock {
  display: flex;
}
body.pointer-locked #experience-dock { display: none !important; }
body.ship-mode.landed-mode:not(.experience-overlay-open) #experience-dock {
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: auto;
  display: flex;
  transform: none;
}
body.touch-ui.ship-mode.landed-mode:not(.experience-overlay-open) #experience-dock {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  z-index: 4601;
}
body.ship-mode.landed-mode #experience-dock button:not([data-action="menu"]) {
  display: none;
}
#experience-dock button {
  min-width: 58px;
  min-height: 46px;
  padding: 6px 7px 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: rgba(185, 224, 239, 0.72);
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
#experience-dock button > span {
  display: block;
  margin-bottom: 3px;
  color: #4ad6ff;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  line-height: 1;
}
#experience-dock button:hover,
#experience-dock button[aria-pressed="true"] {
  border-color: rgba(74, 214, 255, 0.38);
  background: rgba(74, 214, 255, 0.10);
  color: #effbff;
}
#experience-dock button[aria-pressed="true"] > span { color: #ffd27a; }

#experience-command-hint {
  position: fixed;
  bottom: 12px;
  left: 50%;
  z-index: 57;
  display: none;
  align-items: center;
  gap: 14px;
  padding: 5px 9px;
  transform: translateX(-50%);
  border: 1px solid rgba(74, 214, 255, 0.30);
  border-radius: 3px;
  background: rgba(3, 10, 18, 0.82);
  color: rgba(210, 235, 245, 0.78);
  font-size: 8px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
body.ship-mode:not(.landed-mode):not(.nav-open):not(.experience-overlay-open):not(.experience-hyperspace):not(.experience-clean) #experience-command-hint {
  display: flex;
}
body.ship-mode:not(.pointer-locked) #experience-command-hint { bottom: 76px; }
body.touch-ui #experience-command-hint { display: none !important; }
#experience-command-hint span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
#experience-command-hint kbd,
.tutorial-keyboard-guide kbd {
  padding: 2px 4px;
  border: 1px solid rgba(74, 214, 255, 0.30);
  border-radius: 2px;
  background: rgba(74, 214, 255, 0.07);
  color: #8ce6ff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  font-weight: 600;
  line-height: 1.1;
}

/* The dock replaces the old wall of keycaps. All controls remain available
   in the pause reference, while the flight view gets breathing room. */
body.ship-mode #cp-exit { display: none !important; }
body.ship-mode #hud-telemetry { bottom: 82px; }

#experience-toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  z-index: 60020;
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 14px;
  transform: translate(-50%, -14px);
  border: 1px solid rgba(74, 214, 255, 0.38);
  border-radius: 3px;
  background: rgba(3, 10, 18, 0.96);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.62);
  color: #c7e9f7;
  font-size: 10px;
  letter-spacing: 0.1em;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
#experience-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
#experience-toast[data-tone="warn"] { border-color: rgba(255, 179, 71, 0.62); color: #ffd99a; }
#experience-toast[data-tone="success"] { border-color: rgba(95, 255, 138, 0.55); color: #afffc3; }

.experience-overlay {
  position: fixed;
  inset: 0;
  z-index: 60000;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow-y: auto;
  background: rgba(0, 3, 9, 0.88);
  backdrop-filter: blur(14px) saturate(0.68);
  -webkit-backdrop-filter: blur(14px) saturate(0.68);
  color: #c7e9f7;
  pointer-events: auto;
}
.experience-overlay[hidden],
.experience-tutorial[hidden],
.tutorial-step[hidden] { display: none !important; }

.experience-card {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 28px;
  overflow-y: auto;
  border: 1px solid rgba(74, 214, 255, 0.38);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(8, 19, 32, 0.99), rgba(3, 9, 17, 0.99)),
    repeating-linear-gradient(0deg, transparent 0, transparent 28px,
      rgba(74, 214, 255, 0.035) 28px, rgba(74, 214, 255, 0.035) 29px);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.82), inset 0 0 30px rgba(0, 0, 0, 0.42);
  scrollbar-color: rgba(74, 214, 255, 0.42) transparent;
  scrollbar-width: thin;
}
.experience-card-wide { width: min(820px, 100%); }
.experience-card h2 {
  margin: 3px 0 20px;
  color: #eaf8ff;
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.22em;
}
.experience-card h3 {
  color: #ffd27a;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
}
.experience-eyebrow {
  color: #4ad6ff;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 0.28em;
}
.experience-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(74, 214, 255, 0.34);
  border-radius: 3px;
  background: rgba(74, 214, 255, 0.05);
  color: #a2e4ff;
  font-size: 20px;
  cursor: pointer;
}

.experience-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.experience-menu-grid button,
.experience-mission button,
.experience-list button,
.experience-primary,
.tutorial-actions button {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(74, 214, 255, 0.30);
  border-radius: 3px;
  background: rgba(74, 214, 255, 0.055);
  color: #b9e8fa;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 0.13em;
  line-height: 1.35;
  cursor: pointer;
}
.experience-menu-grid button:hover,
.experience-mission button:hover,
.experience-list button:hover,
.tutorial-actions button:hover {
  border-color: rgba(74, 214, 255, 0.65);
  background: rgba(74, 214, 255, 0.14);
  color: #fff;
}
.experience-primary {
  border-color: rgba(255, 179, 71, 0.60) !important;
  background: rgba(255, 179, 71, 0.10) !important;
  color: #ffd99a !important;
}

.experience-settings {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(74, 214, 255, 0.16);
}
.experience-settings label {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(170, 209, 224, 0.72);
  font-size: 8px;
  letter-spacing: 0.12em;
}
.experience-settings select {
  min-height: 38px;
  max-width: 142px;
  border: 1px solid rgba(74, 214, 255, 0.28);
  border-radius: 2px;
  background: #07121e;
  color: #d8f4ff;
  font-family: inherit;
}
.experience-settings input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #4ad6ff;
}
.experience-mission-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.experience-mission {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(74, 214, 255, 0.18);
  border-radius: 4px;
  background: rgba(2, 8, 15, 0.74);
}
.experience-mission.active { border-color: rgba(255, 179, 71, 0.54); background: rgba(255, 179, 71, 0.06); }
.experience-mission.complete { border-color: rgba(95, 255, 138, 0.35); }
.experience-mission > div > span {
  color: #4ad6ff;
  font-size: 7px;
  letter-spacing: 0.16em;
}
.experience-mission.active > div > span { color: #ffd27a; }
.experience-mission.complete > div > span { color: #7dff9f; }
.experience-mission h3 { margin-top: 5px; }
.experience-mission p {
  flex: 1;
  color: rgba(190, 219, 232, 0.70);
  font-size: 9px;
  line-height: 1.5;
  -webkit-user-select: text;
  user-select: text;
}
.experience-mission strong {
  color: #eaf8ff;
  font-size: 8px;
  font-weight: 500;
  line-height: 1.45;
}

.experience-log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.experience-log-grid > section {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(74, 214, 255, 0.14);
  background: rgba(2, 8, 15, 0.48);
}
.experience-log-grid h3 { margin-bottom: 10px; }
.experience-list {
  display: flex;
  max-height: 154px;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
.experience-list > p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(176, 208, 222, 0.65);
  font-size: 8px;
  line-height: 1.45;
}
.experience-list > p strong { color: #d8f4ff; font-weight: 500; }
.experience-list > p span { color: rgba(255, 210, 122, 0.70); }
.experience-list button { width: 100%; text-align: left; }

.experience-controls-list {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) 1.3fr;
  margin-bottom: 18px;
  border-top: 1px solid rgba(74, 214, 255, 0.16);
}
.experience-controls-list dt,
.experience-controls-list dd {
  padding: 7px 4px;
  border-bottom: 1px solid rgba(74, 214, 255, 0.09);
  font-size: 9px;
  line-height: 1.35;
}
.experience-controls-list dt { color: #ffd27a; }
.experience-controls-list dd { color: rgba(194, 226, 239, 0.75); }

.experience-tutorial {
  position: fixed;
  bottom: 82px;
  left: 50%;
  z-index: 70;
  width: min(520px, calc(100vw - 32px));
  padding: 16px 18px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 179, 71, 0.55);
  border-radius: 5px;
  background: rgba(5, 11, 19, 0.96);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.68), inset 0 0 24px rgba(255, 179, 71, 0.04);
  color: #d8edf7;
  pointer-events: auto;
}
.tutorial-step {
  padding-right: 18px;
  -webkit-user-select: text;
  user-select: text;
}
.tutorial-count {
  color: #ffd27a;
  font-size: 8px;
  letter-spacing: 0.2em;
}
.tutorial-step h2 {
  margin: 4px 0 6px;
  color: #f3fbff;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  letter-spacing: 0.16em;
}
.tutorial-step p {
  color: rgba(193, 220, 232, 0.76);
  font-size: 10px;
  line-height: 1.5;
}
.tutorial-keyboard-guide {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: 11px 0 -3px;
  color: rgba(181, 214, 227, 0.62);
  font-size: 7px;
  letter-spacing: 0.12em;
}
.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 12px;
}
.tutorial-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-width: 112px;
  gap: 12px;
}
.tutorial-actions kbd {
  padding: 2px 5px;
  border: 1px solid rgba(176, 218, 235, 0.28);
  border-radius: 2px;
  background: rgba(185, 224, 240, 0.07);
  color: rgba(213, 239, 249, 0.72);
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
}
.tutorial-actions .experience-primary kbd {
  border-color: rgba(255, 210, 122, 0.42);
  background: rgba(255, 210, 122, 0.09);
  color: #ffd27a;
}

#hangar-featured-mission {
  position: absolute;
  top: 112px;
  left: 50%;
  z-index: 6;
  min-height: 38px;
  padding: 8px 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(74, 214, 255, 0.35);
  border-radius: 3px;
  background: rgba(4, 12, 20, 0.76);
  color: #a2e4ff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.16em;
  cursor: pointer;
}
#hangar-featured-mission:hover {
  border-color: rgba(255, 179, 71, 0.68);
  color: #ffd27a;
}
.experience-bookmark { border-color: rgba(184, 141, 255, 0.52) !important; color: #d5bdff !important; }

/* Cinematic mode removes the interface. Keep one subtle, discoverable escape
   control as a fallback alongside the H shortcut and Escape behavior. */
body.experience-clean #cockpit,
body.experience-clean #autopilot-indicator,
body.experience-clean #hud-grain,
body.experience-clean #hj-prompt,
body.experience-clean #land-prompt,
body.experience-clean #cp-boost,
body.experience-clean #controls-hint,
body.experience-clean #jedi-comm,
body.experience-clean #touch-ui { display: none !important; }
body.experience-clean.ship-mode:not(.landed-mode):not(.nav-open):not(.experience-overlay-open):not(.experience-hyperspace) #experience-dock {
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  bottom: auto;
  left: auto;
  display: flex;
  padding: 0;
  transform: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  opacity: 0.38;
}
body.experience-clean #experience-dock > button:not([data-action="clean"]) { display: none; }
body.experience-clean #experience-dock [data-action="clean"] {
  border-color: rgba(74, 214, 255, 0.28);
  background: rgba(2, 8, 15, 0.64);
}
body.experience-clean #experience-dock [data-action="clean"]::after {
  content: 'EXIT';
  display: block;
  margin-top: 2px;
}

/* Hyperspace gets the full frame; the target toast and jump canvas sit above
   this rule and remain visible. */
body.experience-hyperspace #cockpit,
body.experience-hyperspace #autopilot-indicator,
body.experience-hyperspace #experience-dock,
body.experience-hyperspace #touch-ui,
body.experience-hyperspace #jedi-comm { display: none !important; }

@media (max-width: 700px) and (orientation: portrait) {
  .experience-overlay {
    place-items: start stretch;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }
  .experience-card,
  .experience-card-wide {
    width: 100%;
    max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
    padding: 20px 16px;
  }
  .experience-card h2 { padding-right: 46px; font-size: 19px; }
  .experience-menu-grid,
  .experience-settings,
  .experience-log-grid { grid-template-columns: 1fr; }
  .experience-settings { gap: 2px; }
  .experience-settings select { min-width: 150px; }
  .experience-mission-list {
    grid-template-columns: 1fr;
    max-height: 42dvh;
    overflow-y: auto;
  }
  .experience-log-grid > section { padding: 12px; }
  .experience-tutorial {
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 64px));
    width: calc(100vw - 24px);
    padding: 14px;
  }
  #hangar-featured-mission {
    top: 104px;
    min-height: 44px;
    max-width: calc(100vw - 36px);
    white-space: nowrap;
  }
}

@media (max-width: 960px) and (orientation: landscape) {
  #experience-command-hint {
    gap: 8px;
    padding: 4px 6px;
    font-size: 7px;
  }
  #experience-dock {
    bottom: max(6px, env(safe-area-inset-bottom));
    gap: 1px;
    padding: 2px;
  }
  #experience-dock button {
    min-width: 50px;
    min-height: 44px;
    padding: 4px 5px;
    font-size: 6.5px;
  }
  #experience-dock button > span { font-size: 11px; }
  .experience-overlay {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .experience-card,
  .experience-card-wide {
    width: min(900px, 100%);
    max-height: calc(100dvh - 16px);
    padding: 16px 18px;
  }
  .experience-card h2 { margin-bottom: 12px; font-size: 18px; }
  .experience-menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .experience-settings { margin-top: 10px; padding-top: 8px; }
  .experience-mission { padding: 10px; }
  .experience-log-grid { margin-top: 10px; }
  .experience-list { max-height: 92px; }
  .experience-controls-list dt,
  .experience-controls-list dd { padding: 4px; }
  .experience-tutorial {
    bottom: 60px;
    width: min(520px, calc(100vw - 24px));
    padding: 11px 14px;
  }
  .tutorial-step h2 { font-size: 13px; }
  .tutorial-step p { font-size: 9px; }
  .tutorial-actions { margin-top: 7px; }
  #hangar-featured-mission {
    top: 70px;
    left: 30vw;
    min-height: 44px;
  }
}

/* Both the OS preference and the in-app preference disable interface motion. */
html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
}
html.reduced-motion #hyperspace-fx,
html.reduced-motion #speedlines-fx { opacity: 0 !important; }
html.reduced-motion #hyperspace-flash { background: rgba(120, 170, 230, 0.14); }
