:root {
  --bg-1: #04101f;
  --bg-2: #0d2446;
  --bg-3: #1b3f6b;
  --panel: rgba(7, 20, 39, 0.76);
  --line: rgba(121, 207, 255, 0.26);
  --text: #ecf7ff;
  --muted: #9fc4df;
  --accent: #ffd166;
  --accent-2: #63d7ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

body {
  background:
    radial-gradient(circle at 18% 18%, rgba(99, 215, 255, 0.18), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(255, 209, 102, 0.14), transparent 20%),
    radial-gradient(circle at 50% 100%, rgba(61, 107, 181, 0.3), transparent 38%),
    linear-gradient(180deg, var(--bg-3), var(--bg-2) 42%, var(--bg-1) 100%);
  overflow: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 30% 70%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(2px 2px at 80% 80%, rgba(255, 255, 255, 0.5), transparent);
  opacity: 0.3;
  pointer-events: none;
}

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(120px, 1fr);
  grid-template-areas:
    "topbar"
    "canvas";
  gap: 8px;
  padding: 8px;
}

.panel {
  background: linear-gradient(180deg, rgba(10, 28, 52, 0.82), var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.topbar {
  grid-area: topbar;
  padding: 4px 6px;
  display: grid;
  grid-template-columns: auto auto auto auto auto auto auto;
  gap: 0;
  align-items: stretch;
}

.topbar-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 8px;
  min-width: 0;
  align-self: stretch;
}

.topbar-col + .topbar-col {
  border-left: 1px solid rgba(99, 215, 255, 0.14);
}

.topbar-head {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.topbar h1 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.topbar h2 {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  white-space: nowrap;
}

.credits {
  margin: 0;
  font-size: 0.6rem;
  color: var(--muted);
  opacity: 0.6;
  white-space: normal;
  overflow-wrap: break-word;
}

.timestamp {
  margin: 0;
  color: var(--muted);
  font-size: 0.65rem;
}

.stale-badge {
  font-size: 0.7rem;
  font-weight: bold;
  color: #f6b84c;
  background: rgba(246, 184, 76, 0.12);
  border: 1px solid rgba(246, 184, 76, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
  margin: 2px 0;
  animation: stale-pulse 2s ease-in-out infinite;
}

@keyframes stale-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.head-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  width: 100%;
}

.head-actions #resetViewButton {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.8rem;
  border-radius: 7px;
}

.social-links {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s, color 0.15s;
  padding: 3px 6px;
  border-radius: 8px;
  min-width: 0;
  white-space: nowrap;
}

.social-link:hover {
  opacity: 1;
  color: var(--text);
}

.social-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.title-toggle {
  cursor: pointer;
  border-bottom: 0;
  pointer-events: auto;
}

.title-toggle:hover {
  opacity: 0.8;
}

.col-body label,
.col-vessel-filters > label,
.col-vessel-pick label,
.col-selection .selection-heading {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  margin: 0;
}

.col-body select,
.col-body button,
.col-vessel-pick select,
.col-vessel-pick button {
  font-size: 0.72rem;
  padding: 2px 6px;
}

.col-vessel-filters {
  max-width: 260px;
}

.type-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-height: 90px;
  overflow-y: auto;
  padding: 2px 0;
}

.type-chip-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--chip-color, #8a9ab0) 45%, transparent);
  border-radius: 10px;
  padding: 2px 9px 2px 6px;
  color: color-mix(in srgb, var(--chip-color, #8a9ab0) 65%, var(--muted));
  opacity: 0.48;
  transition: opacity 0.12s, background 0.12s;
  white-space: nowrap;
  user-select: none;
  line-height: 1.5;
}

.type-chip-label:has(input:checked) {
  opacity: 1;
  background: color-mix(in srgb, var(--chip-color, #8a9ab0) 13%, transparent);
  border-color: color-mix(in srgb, var(--chip-color, #8a9ab0) 75%, transparent);
  color: var(--chip-color, #8a9ab0);
}

.type-chip-label:hover { opacity: 0.75; }
.type-chip-label:has(input:checked):hover { opacity: 0.92; }

.type-chip-label input[type=checkbox] { display: none; }

.col-selection {
  overflow-y: auto;
  max-height: 100px;
}

.selection-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  max-width: 280px;
  min-width: 160px;
  width: auto;
  padding: 6px 10px;
  overflow-y: auto;
  max-height: 40%;
  z-index: 20;
  pointer-events: auto;
}

.selection-heading {
  margin: 0 0 3px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-2);
}

#infoContent {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.3;
}

.view-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 2px;
}

.view-toggle {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 4px;
  opacity: 0.38;
  border-color: rgba(201, 224, 255, 0.18);
  color: var(--muted);
  transition: opacity 0.12s;
  cursor: pointer;
}

.view-toggle.active {
  opacity: 1;
  border-color: rgba(201, 224, 255, 0.42);
  color: var(--text);
}

.col-timewarp {
  min-width: 130px;
}

.warp-btn-row {
  display: flex;
  gap: 3px;
}

.warp-btn-row button {
  flex: 1;
  font-size: 0.72rem;
  padding: 2px 4px;
}

#warpReverseButton.warp-reverse-active {
  background: linear-gradient(180deg, rgba(140, 40, 40, 0.95), rgba(90, 20, 20, 0.95));
  border-color: rgba(255, 99, 99, 0.7);
  color: #ff9999;
}

.warp-btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 100%;
}

.warp-btn {
  font-size: 0.72rem;
  padding: 2px 4px;
}

.warp-btn.warp-active {
  background: linear-gradient(180deg, rgba(40, 90, 140, 0.95), rgba(20, 55, 90, 0.95));
  border-color: rgba(99, 215, 255, 0.7);
  color: #63d7ff;
}

.canvas-wrap {
  grid-area: canvas;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(99, 215, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(6, 18, 35, 0.35), rgba(2, 7, 16, 0.78));
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
}

.clock-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(4, 14, 30, 0.82);
  border: 1px solid rgba(99, 215, 255, 0.3);
  border-radius: 10px;
  padding: 6px 14px;
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.clock-date {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

#clockTime {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.clock-warp-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.05em;
}

.clock-badge--warp {
  background: rgba(30, 16, 4, 0.88);
  border-color: rgba(246, 184, 76, 0.5);
}

.clock-badge--warp #clockTime {
  color: #f6c47a;
}

.clock-badge--warp .clock-warp-label {
  color: #f6b84c;
}

.debug-toggle {
  display: none;
  position: fixed;
  bottom: 12px;
  right: 12px;
  width: 120px;
  z-index: 100;
  font-size: 0.85rem;
  opacity: 0;
}

.debug-panel {
  position: fixed;
  bottom: 60px;
  right: 12px;
  width: 400px;
  max-height: 400px;
  background: linear-gradient(180deg, rgba(10, 28, 52, 0.95), rgba(7, 20, 39, 0.95));
  border: 1px solid rgba(99, 215, 255, 0.24);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  display: none;
  z-index: 100;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
}

.debug-panel.visible {
  display: block;
}

.debug-panel h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--accent-2);
  border-bottom: 1px solid rgba(99, 215, 255, 0.16);
  padding-bottom: 6px;
}

.debug-section {
  margin-bottom: 12px;
  font-size: 0.8rem;
}

.debug-item {
  margin: 4px 0;
  padding: 4px 0;
  border-bottom: 1px solid rgba(201, 224, 255, 0.08);
  color: var(--muted);
  word-break: break-all;
}

.debug-item strong {
  color: var(--text);
}

/* .eclipse-toggle replaced by col-eclipse in topbar — now merged into col-overpass */

.eclipse-panel {
  position: fixed;
  top: var(--popup-top, 160px);
  right: 12px;
  width: 480px;
  max-height: 520px;
  background: linear-gradient(180deg, rgba(10, 28, 52, 0.95), rgba(7, 20, 39, 0.95));
  border: 1px solid rgba(99, 215, 255, 0.24);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  display: none;
  z-index: 100;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
}

.eclipse-panel.visible {
  display: block;
}

.eclipse-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(99, 215, 255, 0.16);
  padding-bottom: 6px;
}

.eclipse-panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent-2);
}

/* Shared close button for eclipse and overpass panels */
.panel-close {
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  line-height: 1;
  border-radius: 5px;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  flex-shrink: 0;
}

.panel-close:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  transform: none;
  box-shadow: none;
}

.eclipse-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  align-items: center;
  margin-bottom: 10px;
}

.eclipse-controls label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.eclipse-controls select,
.eclipse-controls input {
  font-size: 0.78rem;
}

.eclipse-controls input[type="number"] {
  width: 100%;
  color: var(--text);
  background: #0b1e38;
  border: 1px solid rgba(99, 215, 255, 0.24);
  border-radius: 6px;
  padding: 3px 8px;
}

.eclipse-controls button {
  grid-column: 1 / -1;
}

.eclipse-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.eclipse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.eclipse-table th {
  text-align: left;
  padding: 3px 6px;
  color: var(--accent-2);
  border-bottom: 1px solid rgba(99, 215, 255, 0.2);
  white-space: nowrap;
}

.eclipse-table td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(201, 224, 255, 0.07);
  color: var(--muted);
}

.eclipse-table td:first-child {
  color: var(--text);
}

.eclipse-time-link {
  cursor: pointer;
  line-height: 1.35;
}
.eclipse-time-link:hover {
  color: #7cf !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.eclipse-time-link small {
  display: block;
  opacity: 0.6;
  font-size: 0.82em;
}

.col-overpass {
  min-width: 90px;
}

.col-overpass label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f6b84c;
  margin: 0;
}

.col-section-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 2px 0 0;
  line-height: 1;
}

.col-section-label--eclipse {
  color: var(--accent-2);
}

.col-section-label--overpass {
  color: #9ee09e;
}

.site-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

.col-overpass button {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 7px;
  white-space: nowrap;
}

.col-overpass button.site-markers-active {
  background: linear-gradient(180deg, rgba(90, 55, 10, 0.88), rgba(60, 35, 5, 0.88));
  border-color: rgba(246, 184, 76, 0.55);
  color: #f6c47a;
}

#launchSiteLabelsContainer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.launch-site-label {
  position: absolute;
  font-size: 0.68rem;
  color: #f6d490;
  background: rgba(18, 10, 2, 0.78);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -100%);
  margin-top: -6px;
  display: none;
  border: 1px solid rgba(246, 184, 76, 0.22);
  line-height: 1.5;
}

.overpass-panel {
  position: fixed;
  top: var(--popup-top, 160px);
  right: 12px;
  width: 480px;
  max-height: 520px;
  background: linear-gradient(180deg, rgba(28, 18, 6, 0.95), rgba(18, 10, 2, 0.95));
  border: 1px solid rgba(246, 184, 76, 0.28);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  display: none;
  z-index: 100;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
}

.overpass-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(246, 184, 76, 0.2);
  padding-bottom: 6px;
}

.overpass-panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #f6b84c;
}

.overpass-panel.visible {
  display: block;
}

.overpass-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  align-items: center;
  margin-bottom: 10px;
}

.overpass-controls label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.overpass-controls select {
  font-size: 0.78rem;
}

.overpass-controls button {
  grid-column: 1 / -1;
}

.overpass-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.overpass-result {
  font-size: 0.85rem;
  line-height: 1.6;
}

.overpass-result .result-time {
  color: #f6c47a;
  font-size: 1rem;
  font-weight: bold;
  display: block;
  margin-bottom: 4px;
}

.overpass-result .result-detail {
  color: var(--muted);
  font-size: 0.78rem;
}

.overpass-count {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 4px 0;
}

.overpass-pass-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}

.overpass-pass-row {
  display: grid;
  grid-template-columns: 1.4em 1fr auto auto auto;
  gap: 4px;
  align-items: baseline;
  font-size: 0.75rem;
  line-height: 1.6;
  padding: 2px 0;
  border-bottom: 1px solid rgba(99,215,255,0.08);
}

.overpass-pass-row.has-site {
  grid-template-columns: 1.4em 1fr auto auto auto auto;
}

.pass-site { color: #f6b84c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; }

.overpass-mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.overpass-tab {
  flex: 1;
  width: auto;
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--muted);
  background: rgba(18, 43, 72, 0.55);
  border: 1px solid rgba(99, 215, 255, 0.14);
}

.overpass-tab.active {
  color: #f6b84c;
  background: rgba(40, 26, 8, 0.85);
  border-color: rgba(246, 184, 76, 0.4);
}

.overpass-mode-panel {
  display: none;
}

.overpass-mode-panel.active {
  display: block;
}

.overpass-pass-row:last-child { border-bottom: none; }
.pass-num { color: var(--muted); }
.pass-time { color: #f6c47a; font-weight: bold; white-space: nowrap; }
.pass-wait { color: var(--muted); white-space: nowrap; }
.pass-heading { color: #9ee09e; font-weight: bold; white-space: nowrap; }
.pass-dist { color: var(--muted); white-space: nowrap; }

.overpass-unreachable {
  font-size: 0.85rem;
  color: #f4766c;
  margin: 0;
}

button {
  width: 100%;
  color: var(--text);
  background: linear-gradient(180deg, rgba(18, 43, 72, 0.88), rgba(11, 27, 46, 0.88));
  border: 1px solid rgba(99, 215, 255, 0.24);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
}

select {
  width: 100%;
  color: var(--text);
  background: #0b1e38;
  border: 1px solid rgba(99, 215, 255, 0.24);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
}

select option {
  background: #0b1e38;
  color: var(--text);
}

button {
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.2), 0 10px 24px rgba(15, 35, 58, 0.35);
  transform: translateY(-1px);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

#vesselTooltip {
  position: fixed;
  background: rgba(4, 14, 30, 0.9);
  border: 1px solid rgba(99, 215, 255, 0.32);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 0.78rem;
  color: var(--text);
  pointer-events: none;
  display: none;
  z-index: 50;
  white-space: pre-line;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  min-width: 180px;
}

/* ── Active Mission List panel ─────────────────────────────── */
.mission-panel {
  position: fixed;
  top: var(--popup-top, 160px);
  right: 12px;
  width: 560px;
  max-height: 72vh;
  background: linear-gradient(180deg, rgba(4, 18, 34, 0.97), rgba(4, 14, 26, 0.97));
  border: 1px solid rgba(74, 222, 128, 0.28);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  display: none;
  z-index: 100;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.mission-panel.visible {
  display: block;
}

.mission-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(74, 222, 128, 0.2);
  padding-bottom: 7px;
}

.mission-panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #4ade80;
  letter-spacing: 0.03em;
}

.mission-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.mission-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 3px solid var(--mtype-color, #4ade80);
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  background: rgba(255, 255, 255, 0.02);
}

.mission-card:hover {
  background: rgba(255, 255, 255, 0.055);
}

.mission-card--selected {
  border-color: var(--mtype-color, #4ade80);
  background: rgba(74, 222, 128, 0.06);
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.18);
}

.mission-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.mission-type-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 1px 6px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--mtype-color, #4ade80) 18%, transparent);
  color: var(--mtype-color, #4ade80);
  border: 1px solid color-mix(in srgb, var(--mtype-color, #4ade80) 40%, transparent);
  flex-shrink: 0;
  white-space: nowrap;
}

.mission-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mission-card-loc {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.mission-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.mission-stat-val {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mission-card-desc {
  font-size: 0.73rem;
  color: rgba(159, 196, 223, 0.75);
  line-height: 1.45;
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.mission-selected-label {
  font-size: 0.6rem;
  color: #4ade80;
  letter-spacing: 0.08em;
  margin-left: auto;
  white-space: nowrap;
}

/* ── YouTube promo popup (bottom-left) ─────────────────────── */
.yt-promo {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  pointer-events: auto;
  animation: ytPromoSlideIn 0.5s ease-out;
}

@keyframes ytPromoSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.yt-promo-close {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 10;
  width: 20px;
  height: 20px;
  background: rgba(4, 14, 30, 0.7);
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  line-height: 20px;
  text-align: center;
  padding: 0;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
}
.yt-promo-close:hover {
  opacity: 1;
  color: var(--text);
}

.yt-promo-thumb {
  position: relative;
  display: block;
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
}
.yt-promo-thumb img {
  width: 100%;
  border-radius: 6px;
  display: block;
}
.yt-promo-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.2s;
}
.yt-promo-thumb:hover .yt-promo-play {
  opacity: 1;
}

.yt-promo-text {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.yt-promo-channel {
  display: flex;
  align-items: center;
  gap: 7px;
}

.yt-promo-channel-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ff4444;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: text-decoration 0.15s;
}
.yt-promo-channel-name:hover {
  text-decoration: underline;
}

.yt-promo-icon-link {
  display: inline-flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
}
.yt-promo-icon-link:hover {
  opacity: 1;
  transform: scale(1.15);
}

.yt-promo-icon {
  width: 18px;
  height: 18px;
  fill: #ff4444;
  flex-shrink: 0;
}

/* ── UIv2 compact-mode toggle button ───────────────────────── */
.uiv2-toggle,
.uiv2-menu-btn {
  display: none; /* hidden on desktop */
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "topbar"
      "canvas";
  }

  /* ── Topbar: shorter + tighter (1c) ────────────────────── */
  .topbar {
    grid-template-columns: 1fr;
    overflow-y: auto;
    max-height: 25vh;
  }

  .topbar-col + .topbar-col {
    border-left: none;
    border-top: 1px solid rgba(99, 215, 255, 0.14);
    padding-top: 4px;
  }

  .canvas-wrap {
    min-height: 48vh;
  }

  /* ── Selection overlay: smaller on mobile (1a) ─────────── */
  .selection-overlay {
    max-width: min(240px, calc(100vw - 64px));
    max-height: 28vh;
    font-size: 0.82rem;
  }

  /* ── Clock badge: smaller on mobile (1a) ───────────────── */
  .clock-badge {
    padding: 3px 8px;
  }
  #clockTime {
    font-size: 0.9rem;
  }
  .clock-date {
    font-size: 0.68rem;
  }

  /* ── Eclipse + overpass panels: fit screen width (1b) ──── */
  .eclipse-panel,
  .overpass-panel {
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 60vh;
  }

  .debug-panel {
    width: calc(100% - 24px);
    left: 12px;
    right: 12px;
    bottom: auto;
    top: auto;
    max-height: 240px;
  }

  /* ── UIv2 compact-mode toggle button: show on mobile ───── */
  .uiv2-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    font-size: 0.72rem;
    border-radius: 7px;
    width: 100%;
  }

  /* ── UIv2 active: collapse topbar to head-only strip ───── */
  body.ui-v2 .topbar {
    max-height: none;
    overflow: hidden;
  }
  body.ui-v2 .topbar-col:not(.topbar-head) {
    display: none;
  }
  /* Controls open: show all cols again */
  body.ui-v2 .topbar.controls-open .topbar-col {
    display: block;
  }
  /* Re-stack topbar when controls are open via panel */
  body.ui-v2 .topbar.controls-open {
    max-height: 70vh;
    overflow-y: auto;
  }
  /* Topbar head becomes a compact horizontal action bar */
  body.ui-v2 .topbar-head {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 6px;
  }
  body.ui-v2 .topbar-head h1,
  body.ui-v2 .topbar-head h2,
  body.ui-v2 .topbar-head .credits,
  body.ui-v2 .topbar-head .timestamp,
  body.ui-v2 .topbar-head .social-links,
  body.ui-v2 .topbar-head #staleWarning {
    display: none;
  }
  body.ui-v2 .topbar-head .head-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 0;
    width: auto;
  }
  body.ui-v2 .topbar-head .head-actions button {
    width: auto;
  }
  /* Show the ☰ controls menu button only in UIv2 mode */
  body.ui-v2 .uiv2-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    font-size: 0.72rem;
    border-radius: 7px;
  }
}

@media (max-width: 1450px) {
  .social-links {
    flex-direction: column;
    align-items: flex-start;
  }
}
