/* ============================================================
   ISS Live Tracker — design system
   Light SaaS-dashboard canvas, single accent, restrained motion.
   ============================================================ */

:root {
  /* canvas */
  --bg: #f6f7f9;
  --surface-0: #ffffff;
  --surface-1: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e9ebef;

  /* ink */
  --text: #0f172a;
  --muted: #64748b;
  --faint: #64708a; /* darkened from #94a3b8 — that failed WCAG AA (2.56:1 on white); this passes at ~4.97:1 */

  /* stroke */
  --line: #e5e7eb;
  --line-strong: #d6dae1;

  /* accents */
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-dim: rgba(37, 99, 235, 0.08);
  --accent-line: rgba(37, 99, 235, 0.32);
  --cyan: #0ea5e9;
  --green: #16a34a;
  --green-dim: rgba(22, 163, 74, 0.1);
  --amber: #d97706;
  --red: #dc2626;
  --violet: #7c3aed;

  /* typography */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* metrics */
  --pad: 16px;
  --gap: 14px;
  --radius: 12px;
  --radius-sm: 8px;
  --content-max: 1900px;
  --side: 344px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 20px rgba(15, 23, 42, 0.06);
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --banner-err-bg: #fef2f2;
  --banner-err-border: #fecaca;
  --banner-err-text: #b91c1c;
  --banner-warn-bg: #fffbeb;
  --banner-warn-border: #fde68a;
  --banner-warn-text: #92400e;
}

:root[data-theme="dark"] {
  --bg: #090c11;
  --surface-0: #0f141c;
  --surface-1: #121824;
  --surface-2: #161d2a;
  --surface-3: #1c2433;
  --text: #e8ecf2;
  --muted: #8b96a8;
  --faint: #5b6579;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --accent: #3e9dff;
  --accent-ink: #04101c;
  --accent-dim: rgba(62, 157, 255, 0.14);
  --accent-line: rgba(62, 157, 255, 0.38);
  --cyan: #22d3ee;
  --green: #2dd4a7;
  --green-dim: rgba(45, 212, 167, 0.14);
  --amber: #eab308;
  --red: #f0555a;
  --violet: #8b8cf5;
  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --topbar-bg: rgba(9, 12, 17, 0.86);
  --banner-err-bg: rgba(240, 85, 90, 0.1);
  --banner-err-border: rgba(240, 85, 90, 0.28);
  --banner-err-text: #ffb2b4;
  --banner-warn-bg: rgba(234, 179, 8, 0.1);
  --banner-warn-border: rgba(234, 179, 8, 0.3);
  --banner-warn-text: #f4cd6a;
}

/* Light is the default for every visitor regardless of OS/browser
   preference — dark only applies with an explicit data-theme="dark",
   set by the toggle in theme.js. No prefers-color-scheme fallback. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: max(12px, env(safe-area-inset-top)) var(--pad) 12px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 1001;
}

.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.brand-logo { width: 38px; height: 38px; flex: none; }
.brand h1, .brand .brand-title {
  font-size: clamp(15px, 4.2vw, 18px);
  letter-spacing: -0.01em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.brand h1 span, .brand .brand-title span { color: var(--muted); font-weight: 500; }
.subtitle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: clamp(10px, 2.6vw, 11.5px);
  color: var(--faint);
  font-family: var(--mono);
  letter-spacing: 0.2px;
}
.sub-pill {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  background: var(--accent-dim);
  border-radius: 4px;
  padding: 1.5px 6px;
  letter-spacing: 0.5px;
}

.status-row {
  order: 3;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.status-row #status-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  background: var(--faint);
}
.dot.connecting { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14); animation: pulse 1.4s infinite; }
.dot.live { background: var(--green); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14); }
.dot.error { background: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14); }
@keyframes pulse { 50% { opacity: 0.4; } }

.clocks { margin-left: auto; text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.clock-utc {
  font-family: var(--mono);
  font-size: clamp(14px, 3.6vw, 15px);
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.clock-utc::before {
  content: "UTC";
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 7px;
  vertical-align: 2px;
}
.clock-local {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.clock-local::before {
  content: "LOCAL";
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--faint);
  margin-right: 5px;
}

.control-label { display: none; }

.menu-toggle {
  appearance: none;
  cursor: pointer;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  color: var(--text);
  box-shadow: var(--shadow-1);
  transition: background 0.15s, border-color 0.15s;
}
.menu-toggle:hover { background: var(--surface-2); border-color: var(--accent-line); }
.menu-toggle-bars { position: relative; width: 16px; height: 12px; }
.menu-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.15s ease;
}
.menu-toggle-bars span:nth-child(1) { top: 0; }
.menu-toggle-bars span:nth-child(2) { top: 5px; }
.menu-toggle-bars span:nth-child(3) { top: 10px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

@media (max-width: 1023.98px) {
  .topbar-controls {
    position: absolute;
    top: 100%;
    left: var(--pad);
    right: var(--pad);
    margin: 8px 0 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 10px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.22s ease, opacity 0.18s ease;
  }
  .topbar-controls.open {
    max-height: min(70vh, 480px);
    opacity: 1;
    overflow-y: auto;
    pointer-events: auto;
  }
  .topbar-controls .sat-select,
  .topbar-controls .install-btn,
  .topbar-controls .icon-btn,
  .topbar-controls .ar-open-btn {
    width: 100%;
    max-width: none;
  }
  .topbar-controls .icon-btn {
    height: 42px;
    justify-content: flex-start;
    padding: 0 13px;
    gap: 10px;
  }
  .topbar-controls .control-label { display: inline; font-size: 13px; font-weight: 600; }
  .topbar-controls .install-btn { justify-content: flex-start; }
}

@media (min-width: 1024px) {
  .menu-toggle { display: none; }
}

/* AR viewfinder button */
.ar-open-btn {
  appearance: none;
  cursor: pointer;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  color: var(--text);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 4px 13px 4px 4px;
  min-height: 34px;
  box-shadow: var(--shadow-1);
  transition: background 0.15s, border-color 0.15s, transform 0.06s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ar-open-btn:hover { border-color: var(--accent-line); background: var(--accent-dim); }
.ar-open-btn:active { transform: scale(0.97); }
.ar-open-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--accent-ink);
  background: var(--accent);
}
.ar-open-label { line-height: 1; }

/* ============================================================
   Icon button (theme toggle, notify) + satellite select
   ============================================================ */
.icon-btn {
  appearance: none;
  cursor: pointer;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  box-shadow: var(--shadow-1);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.icon-btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--accent-line); color: var(--text); }
.icon-btn.active { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent); }

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.sat-select {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  max-width: 150px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 26px 0 12px;
  border-radius: 9px;
  height: 34px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 14px;
}
.sat-select:hover { border-color: var(--accent-line); }
.sat-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sat-select span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.install-btn { display: inline-flex; }
.install-btn[hidden] { display: none; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  appearance: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  padding: 8px 14px;
  border-radius: 9px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: rgba(37, 99, 235, 0.18);
  touch-action: manipulation;
}
.btn svg { flex: none; }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: scale(0.98); }
.btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-line);
  color: var(--accent);
}
.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15), 0 4px 10px rgba(37, 99, 235, 0.2);
}
.btn.accent:hover { filter: brightness(0.9); }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

/* ============================================================
   Pass share / calendar / reminder controls
   ============================================================ */
.pass-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 2px; }
.pass-actions .btn { flex: 1 1 auto; justify-content: center; }
.pass-pop-wrap { position: relative; display: inline-flex; flex: 1 1 auto; }
.pass-actions .pass-pop-wrap .btn,
.vt-actions .pass-pop-wrap .btn,
.cp-actions .pass-pop-wrap .btn { width: 100%; }
.pass-pop-input { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; margin: 0; }
.pass-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  min-width: 200px;
  max-width: 260px;
  background: var(--surface-1, #fff);
  border: 1px solid var(--line-strong, #d6dae1);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
}
.pass-pop[hidden] { display: none; }
.pass-pop-item {
  appearance: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #0f172a);
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: block;
  text-decoration: none;
  white-space: nowrap;
}
.pass-pop-item:hover,
.pass-pop-item:focus-visible {
  background: var(--accent-soft, #eff4ff);
  color: var(--accent, #2563eb);
  outline: none;
}
.pass-row.shared td,
.pass-row.shared { background: var(--accent-soft, #eff4ff); }
.cp-shared-row td { background: var(--accent-soft, #eff4ff); }
.pass-note-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-radius: 10px;
  background: var(--accent-soft, #eff4ff);
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 12px;
}
.pass-note-inline .btn { min-height: 30px; padding: 5px 12px; font-size: 12px; }

/* ============================================================
   Banner
   ============================================================ */
.banner {
  padding: 9px var(--pad);
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
  font-size: 13px;
  background: var(--banner-err-bg);
  border-bottom: 1px solid var(--banner-err-border);
  color: var(--banner-err-text);
}
.banner.warn { background: var(--banner-warn-bg); border-color: var(--banner-warn-border); color: var(--banner-warn-text); }

/* ============================================================
   Layout
   ============================================================ */
main, .panels {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  padding: var(--pad);
  min-height: 0;
}
.map-panel, .side-panel { min-width: 0; }

/* ============================================================
   Map
   ============================================================ */
.map-panel {
  position: relative;
  height: 46vh;
  height: 46dvh;
  min-height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  background: var(--surface-0);
}
#map { position: relative; width: 100%; height: 100%; min-height: 0; background: #d6eef2; }
/* Leaflet basemap */
.leaflet-container { font-family: Inter, system-ui, sans-serif; background: #d6eef2; }
.leaflet-container a { color: var(--accent); }
.leaflet-container .leaflet-interactive { outline: none; }

/* ISS marker */
.iss-pin { background: none; border: none; }
.iss-pin .iss-glow {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px;
  margin-left: -23px; margin-top: -23px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.16), transparent 70%);
  animation: iss-glow-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes iss-glow-pulse {
  0% { transform: scale(0.7); opacity: 0.9; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { opacity: 0; }
}
.iss-pin .iss-glyph {
  position: absolute; left: 50%; top: 50%; width: 24px; height: 56px;
  margin-left: -12px; margin-top: -28px;
  transform: rotate(var(--iss-head-rot, 0deg));
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.35));
  transition: filter 0.6s ease;
}
.iss-pin .iss-glyph svg { width: 100%; height: 100%; display: block; overflow: visible; }
.iss-pin .iss-pill {
  position: absolute; left: 50%; top: 50%;
  margin-left: 24px; margin-top: -10px;
  background: var(--surface-1); color: var(--text);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; line-height: 1;
  padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-1);
  white-space: nowrap;
  transition: background 0.6s ease, color 0.6s ease, border-color 0.6s ease;
}

/* Dim the marker on the night side so it visually blends with the
   terminator shading instead of looking equally bright everywhere. */
.iss-pin.night .iss-glow { opacity: 0.35; }
.iss-pin.night .iss-glyph {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)) brightness(0.55) saturate(0.7);
}
.iss-pin.night .iss-pill {
  background: rgba(9, 12, 17, 0.82);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.16);
}

/* sun marker */
.sun-pin { background: none; border: none; }
.sun-core { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #f59e0b 0 6px, rgba(245, 158, 11, 0.45) 7px 13px, rgba(245, 158, 11, 0.12) 14px 23px, transparent 24px); }

/* user location marker */
.user-pin { background: var(--green); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.22), 0 1px 4px rgba(15, 23, 42, 0.25); }

/* track direction chevrons */
.track-chev { background: none; border: none; opacity: 0.95; }
.track-chev-in { display: block; filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.8)); }
.track-chev.future .track-chev-in { color: var(--accent); }

/* degraded map fallback */
.map-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; padding: 0 24px; }
.map-attr {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 600;
  font-size: 10px;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.82);
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
}
/* time scrubber */
.time-scrub {
  position: absolute;
  left: 10px;
  bottom: 34px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, calc(100% - 20px));
  padding: 6px 10px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
}
.time-scrub .btn { min-height: 30px; padding: 3px 12px; font-size: 12px; flex: none; }
.time-scrub input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); cursor: pointer; }
.scrub-label { flex: none; min-width: 64px; text-align: right; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--muted); }
.time-scrub.is-sim { border-color: var(--amber); }
.time-scrub.is-sim .scrub-label { color: var(--amber); }
.clocks.is-sim .clock-utc::after {
  content: "SIM";
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--amber);
  vertical-align: middle;
}
.map-zoom {
  display: flex;
  gap: 6px;
}
.map-zoom .btn {
  min-width: 34px;
  width: 34px;
  padding: 6px 0;
  justify-content: center;
  font-size: 16px;
  color: var(--text);
}

/* map tools */
.map-tools {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 1000;
  max-width: calc(100% - 20px);
}
.map-tools .btn {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: var(--line-strong);
  font-size: 12.5px;
  min-height: 34px;
  padding: 6px 12px;
}
.map-tools .btn:hover { border-color: var(--accent-line); }


/* ============================================================
   Cards
   ============================================================ */
.side-panel { display: flex; flex-direction: column; gap: var(--gap); }

.card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
  box-shadow: var(--shadow-1);
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin-bottom: 14px;
}
.card h2 svg { color: var(--accent); flex: none; }
.card h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  margin-left: 2px;
}

.meta { font-size: 12px; margin-bottom: 10px; color: var(--muted); line-height: 1.55; }

/* telemetry */
.tele-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tele {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-width: 0;
  transition: border-color 0.15s;
}
.tele:hover { border-color: var(--line-strong); }
.tele.wide { grid-column: 1 / -1; }
.tele label {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--faint);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tele span {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.tele span.sunlit.yes { color: var(--amber); }
.tele span.sunlit.no { color: var(--accent); }

.tele-sub { margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.tele-sub div { margin-top: 3px; font-family: var(--mono); overflow-wrap: anywhere; }
.tele-sub b { color: var(--text); font-weight: 600; }
.dim { color: var(--faint); font-size: 11px !important; }

.next-pass { font-size: 13px; margin-bottom: 12px; min-height: 32px; line-height: 1.55; overflow-wrap: anywhere; color: var(--muted); }
.next-pass b { color: var(--green); font-family: var(--mono); font-weight: 600; }

.pass-controls { display: flex; flex-direction: column; gap: 8px; }
.coord-inputs { display: flex; gap: 6px; }
.coord-inputs input {
  flex: 1;
  min-width: 0;
  width: 0;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  padding: 8px 10px;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.coord-inputs input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.coord-inputs input::placeholder { color: var(--faint); }

/* ============================================================
   Panels row
   ============================================================ */
.panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  padding: 0 var(--pad) var(--pad);
  padding-bottom: max(var(--pad), env(safe-area-inset-bottom));
}

/* people */
.people-list { list-style: none; }
.people-list li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.people-list li:last-child { border-bottom: none; }
.crew-group { padding: 8px 0 !important; }
.crew-craft {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--violet);
  margin-bottom: 9px;
}
.crew-craft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }
.crew-names { display: flex; flex-wrap: wrap; gap: 6px; }
.crew-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px 3px 4px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.crew-badge:hover, .crew-badge.open { border-color: var(--accent-line); }

.crew-popover {
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + 7px);
  min-width: 210px;
  max-width: 260px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  box-shadow: var(--shadow-1);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
  text-align: left;
  white-space: normal;
  cursor: default;
}
.crew-popover b { color: var(--text); display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.crew-popover[hidden] { display: none; }
.crew-popover .cp-row { display: flex; justify-content: space-between; gap: 10px; }
.crew-popover .cp-row + .cp-row { margin-top: 2px; }
.crew-popover .cp-label { color: var(--faint); }
.flag-chip {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--muted);
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  width: 25px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* passes */
.pass-list { list-style: none; max-height: 340px; overflow-y: auto; padding-right: 3px; }
.pass-row {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: var(--surface-2);
  transition: border-color 0.15s;
}
.pass-row:hover { border-color: var(--line-strong); }
.pass-row.visible { border-left: 2px solid var(--green); }
.pass-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.pass-arrow {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 6px;
  line-height: 18px;
}
.pass-main strong { font-size: 15.5px; font-family: var(--mono); font-weight: 600; color: var(--text); }
.pass-date { color: var(--muted); font-size: 12px; }
.pass-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 5px; font-size: 12px; color: var(--muted); }
.pass-meta span { display: inline-flex; align-items: center; gap: 4px; }
.pass-vis.on { color: var(--green); }
.pass-vis.off { color: var(--faint); }
.pass-cloud { display: inline-flex; align-items: center; gap: 4px; }
.pass-cloud.clear { color: var(--green); }
.pass-cloud.partial { color: var(--amber); }
.pass-cloud.cloudy { color: var(--faint); }
.pass-mag { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.best-pass-mag { font-family: var(--mono); color: var(--accent); }
.best-pass-mag[hidden] { display: none; }
.pass-list .loading, .pass-list .hint, .pass-list .error, .people-list .loading, .people-list .error { color: var(--muted); font-size: 13px; border: none; }
.pass-list .error, .people-list .error { color: var(--red); }

/* best pass this week */
.best-pass {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--accent-line);
  background: linear-gradient(160deg, var(--accent-dim), transparent 65%);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.best-pass-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.best-pass-badge svg { width: 12px; height: 12px; }
.best-pass-body { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; }
.best-pass-elev-wrap { flex: none; text-align: center; }
.best-pass-elev { display: block; font-size: 26px; font-weight: 800; font-family: var(--mono); color: var(--accent); line-height: 1; }
.best-pass-elev-label { display: block; font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }
.best-pass-info { flex: 1 1 auto; min-width: 0; }
.best-pass-when { font-size: 14.5px; font-weight: 700; color: var(--text); }
.best-pass-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.best-pass-sub span { display: inline-flex; align-items: center; gap: 4px; }
.best-pass.clear .best-pass-sub #best-pass-cloud { color: var(--green); }
.best-pass.partial .best-pass-sub #best-pass-cloud { color: var(--amber); }
.best-pass.cloudy .best-pass-sub #best-pass-cloud { color: var(--faint); }

.pass-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pass-icon-btn {
  appearance: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  color: var(--faint);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pass-icon-btn:hover { background: var(--surface-1); border-color: var(--line-strong); color: var(--text); }
.pass-icon-btn[aria-expanded="true"] { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent); }
.pass-icon-btn svg { width: 14px; height: 14px; }

.pass-chart-wrap {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sp-svg { width: 130px; height: 130px; flex: none; }
.sp-ring { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.sp-axis { stroke: var(--line); stroke-width: 1; }
.sp-dir { fill: var(--faint); font-size: 9px; font-family: var(--sans); font-weight: 700; }
.sp-path { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-dot { stroke: var(--surface-2); stroke-width: 1.5; }
.sp-rise, .sp-set { fill: var(--muted); }
.sp-culm { fill: var(--accent); }
.sp-tag { fill: var(--faint); font-size: 8.5px; font-family: var(--sans); font-weight: 600; }
.pass-chart-legend { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.pass-chart-legend b { color: var(--text); }

/* launches */
.launch-list { list-style: none; }
.launch-row {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: var(--surface-2);
  transition: border-color 0.15s;
}
.launch-row:hover { border-color: var(--line-strong); }
.launch-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.launch-main strong { font-size: 13.5px; font-weight: 600; color: var(--text); }
.launch-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 7px;
  flex: none;
}
.launch-status.go { color: var(--green); border-color: rgba(22, 163, 74, 0.35); background: var(--green-dim); }
.launch-status.hold { color: var(--amber); border-color: rgba(217, 119, 6, 0.35); }
.launch-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.launch-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* pass alerts */
.alerts-prefs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.alerts-prefs label { display: grid; gap: 3px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.alerts-prefs select {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
.alerts-actions { margin-bottom: 8px; }
.alerts-actions .btn { width: 100%; justify-content: center; }
.alerts-actions .btn.active { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
#alerts-status[data-kind="ok"] { color: var(--green); }
#alerts-status[data-kind="warn"] { color: var(--amber); }
@media (max-width: 520px) { .alerts-prefs { grid-template-columns: 1fr; } }

/* sighting log */
.sighting-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sighting-actions .btn { flex: 1 1 auto; justify-content: center; }
.sighting-actions .btn.logged { color: var(--green); border-color: rgba(22, 163, 74, 0.35); background: var(--green-dim); }
.sighting-actions [hidden] { display: none; }
.sighting-list { list-style: none; }
.sighting-row {
  position: relative;
  padding: 8px 38px 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: var(--surface-2);
}
.sighting-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.sighting-main strong { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sighting-when { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.sighting-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.sighting-del { position: absolute; top: 8px; right: 8px; }
.sighting-empty { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ============================================================
   Live card
   ============================================================ */
.rec-badge {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 1.2px;
  animation: pulse 1.6s infinite;
  vertical-align: 2px;
}
.video-player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 9px; border: 1px solid var(--line); }
.video-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-links { font-size: 13px; margin: 6px 0; }

/* ============================================================
   FAQ
   ============================================================ */
.faq {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 8px var(--pad) var(--pad);
}
.faq h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--muted);
  margin-bottom: 14px;
}
.faq-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.faq-item {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
}
.faq-item h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.faq-item p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

@media (min-width: 720px) {
  .faq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1366px) {
  .faq-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  padding: 20px var(--pad);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}
.footer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 10px;
}
.footer-mark { width: 18px; height: 18px; flex: none; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); text-decoration: underline; }
.footer-badges { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.footer-badges img { display: block; max-width: 255px; height: auto; border-radius: 4px; }
.footer-nav { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 16px 0 6px; padding: 0; font-size: 14px; }
.footer-nav a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.footer-guides { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.footer-guides b { color: var(--text); }

/* ============================================================
   Content / guide pages (standalone articles — spot-the-station-down,
   /guides/*). No app JS on these pages, light theme only by design.
   ============================================================ */
.content-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px var(--pad);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.content-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.content-brand .brand-logo { width: 30px; height: 30px; flex: none; }
.content-brand-name { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.content-brand-name b { font-weight: 500; color: var(--muted); }

.crumbs { margin: 4px 0 18px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; font-size: 12.5px; color: var(--faint); }
.crumbs li { display: flex; align-items: center; gap: 6px; margin: 0; }
.crumbs li::after { content: "/"; opacity: .55; }
.crumbs li:last-child::after { content: none; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 500; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--text); font-weight: 600; }

.content-wrap { display: block; max-width: 720px; margin: 0 auto; padding: 40px var(--pad) 60px; }
.content-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 4px 11px;
  margin-bottom: 14px;
}
.content-wrap h1 {
  font-size: clamp(24px, 4.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 10px;
}
.content-meta { font-size: 12.5px; color: var(--faint); margin-bottom: 26px; }
.content-wrap h2 { font-size: 19px; font-weight: 700; color: var(--text); margin: 32px 0 12px; letter-spacing: -0.01em; }
.content-wrap h3 { font-size: 15.5px; font-weight: 700; color: var(--text); margin: 20px 0 8px; }
.content-wrap p { font-size: 15px; line-height: 1.75; color: var(--muted); margin-bottom: 14px; }
.content-wrap p strong, .content-wrap li strong { color: var(--text); }
.content-wrap a { font-weight: 600; }
.content-wrap ul, .content-wrap ol { margin: 0 0 16px 20px; font-size: 15px; line-height: 1.75; color: var(--muted); }
.content-wrap li { margin-bottom: 6px; }
.content-wrap li::marker { color: var(--accent); }
.content-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 18px 20px;
  margin: 28px 0;
}
.content-cta p { margin: 0; font-size: 14px; color: var(--text); font-weight: 600; }
.content-cta .btn { flex: none; }
.content-callout {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
  margin: 18px 0;
}
.content-callout strong { color: var(--text); }
.content-guides-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 24px;
  border: none;
  padding: 0;
}
.content-guides-nav b { color: var(--text); display: none; }
.content-guides-nav a {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-1);
  text-decoration: none;
}
.content-guides-nav a:hover { color: var(--accent); border-color: var(--accent-line); }

.content-table-wrap {
  overflow-x: auto;
  margin: 6px 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}
.content-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
.content-table caption { font-size: 12.5px; color: var(--faint); padding: 12px 12px 4px; text-align: left; }
.content-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  background: var(--surface-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.content-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--muted); }
.content-table tbody tr:last-child td { border-bottom: none; }

.content-figure { margin: 8px 0 24px; }
.content-art { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-1); padding: 6px; }
.content-art svg { display: block; width: 100%; height: auto; }
.content-figure figcaption { font-size: 12.5px; color: var(--faint); margin-top: 8px; line-height: 1.55; }

.content-code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 8px 0 18px;
  white-space: pre;
}
.content-code code { font-family: inherit; color: var(--text); }

@media (min-width: 720px) {
  .content-wrap { padding-top: 52px; }
}

/* ============================================================
   Satellite landing pages (/tiangong-tracker, /hubble-tracker, ...)
   — the live app shell with a short unique intro up top instead of
   the homepage's plain brand row, so each page has real topical
   content and its own real <h1>.
   ============================================================ */
.tracker-hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 26px var(--pad) 4px;
}
.tracker-hero h1 {
  font-size: clamp(21px, 3.4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.28;
  color: var(--text);
  margin: 10px 0 8px;
}
.tracker-hero p { font-size: 14px; line-height: 1.65; color: var(--muted); max-width: 700px; }
.tracker-hero p a { font-weight: 600; }
.content-wrap.tracker-about { padding-top: 8px; }

/* ============================================================
   Buy Me a Coffee floating bubble
   ============================================================ */
.bmc-bubble {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1500;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffdd00;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.22), 0 2px 6px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.bmc-bubble:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28), 0 3px 8px rgba(15, 23, 42, 0.16);
}
.bmc-bubble:active { transform: scale(0.96); }
.bmc-bubble img { width: 28px; height: 28px; display: block; }

/* Hide while the AR camera or satellite search modal is open — both are
   full-screen layers and the bubble would otherwise float on top of them. */
body.ar-open .bmc-bubble,
body.sat-modal-open .bmc-bubble {
  display: none;
}

@media (max-width: 640px) {
  .bmc-bubble { right: 14px; bottom: 14px; width: 50px; height: 50px; }
  .bmc-bubble img { width: 25px; height: 25px; }
}

/* ============================================================
   AR sky-finder overlay (stays dark — camera viewfinder)
   ============================================================ */
body.ar-open { overflow: hidden; }
.ar-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #05070a;
  overflow: hidden;
}
.ar-camera { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #020307; }
.ar-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, transparent 32%, rgba(0, 0, 0, 0.2) 62%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 26%, transparent 62%, rgba(0, 0, 0, 0.6));
  pointer-events: none;
}
.ar-hud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  color: #fff;
}
.ar-top { width: 100%; display: flex; align-items: center; gap: 10px; }
.ar-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(9, 13, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ar-rec {
  color: #7cb8ff;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 1px;
  border: 1px solid rgba(124, 184, 255, 0.4);
  background: rgba(37, 99, 235, 0.18);
  border-radius: 5px;
  padding: 1px 6px;
}
.ar-status {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #bcd3e6;
  text-align: right;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ar-stage { position: relative; flex: 1 1 auto; width: 100%; min-height: 0; }
.ar-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.3);
}
.ar-crosshair::before,
.ar-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
}
.ar-crosshair::before { left: 50%; top: -8px; height: 16px; width: 2px; transform: translateX(-50%); }
.ar-crosshair::after { top: 50%; left: -8px; width: 16px; height: 2px; transform: translateY(-50%); }
.ar-marker {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  filter: drop-shadow(0 0 10px rgba(22, 163, 74, 0.85));
  pointer-events: none;
}
.ar-marker.at-edge { opacity: 0.8; filter: drop-shadow(0 0 8px rgba(14, 165, 233, 0.75)); }
.ar-marker.at-edge .ar-marker-core {
  background: rgba(9, 13, 20, 0.72);
  border: 2.5px dashed rgba(14, 165, 233, 0.85);
  color: #9ff0ff;
  box-shadow: 0 0 0 5px rgba(14, 165, 233, 0.16);
}
.ar-marker-core {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--green);
  border: 2.5px solid #ffffff;
  color: #05301f;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.22);
}
.ar-marker.aligned .ar-marker-core { animation: ar-pulse 1.1s ease-in-out infinite; }
.ar-marker-flag {
  font-size: 11px;
  font-weight: 700;
  color: #eafff5;
  background: rgba(10, 40, 30, 0.8);
  border: 1px solid rgba(22, 163, 74, 0.55);
  border-radius: 999px;
  padding: 2px 9px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}
@keyframes ar-pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.22); }
  50% { box-shadow: 0 0 0 20px rgba(22, 163, 74, 0.05); }
}
.ar-marker.hidden, .ar-guide.hidden { display: none; }
.ar-guide {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 5;
}
.ar-guide-arrow {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.24) 0%, rgba(14, 165, 233, 0.07) 55%, transparent 75%);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #9ff0ff;
  transition: transform 0.15s ease-out, opacity 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ar-guide-arrow svg { flex: none; }
.ar-guide-info {
  font-size: 13px;
  font-weight: 700;
  color: #eaf6ff;
  background: rgba(9, 13, 20, 0.66);
  border: 1px solid rgba(14, 165, 233, 0.4);
  border-radius: 999px;
  padding: 4px 14px;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}
.ar-compass {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 110px;
  height: 110px;
}
.ar-bottom { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ar-coords { display: flex; gap: 6px; width: 100%; max-width: 420px; align-items: center; }
.ar-coord {
  flex: 1;
  min-width: 0;
  background: rgba(9, 13, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 15px;
  font-family: var(--mono);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ar-coord:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28); }
.ar-tele {
  width: 100%;
  max-width: 420px;
  text-align: center;
  font-size: 12.5px;
  color: #eaf6ff;
  background: rgba(9, 13, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 6px 14px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.ar-tele b { color: #7cb8ff; }
.ar-hint {
  max-width: 440px;
  text-align: center;
  font-size: 11.5px;
  color: #bcd3e6;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.ar-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(9, 13, 20, 0.65);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3010;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ar-close:hover { background: rgba(30, 41, 59, 0.8); border-color: var(--accent); }

/* ============================================================
   3D globe view (alternate to the 2D Leaflet map)
   ============================================================ */
.globe-canvas { position: absolute; inset: 0; width: 100%; height: 100%; background: #05070d; }
.globe-canvas[hidden] { display: none; }
.globe-mount { position: absolute; inset: 0; }
.globe-mount canvas { outline: none; }
.globe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9fb3cc;
  font-size: 13px;
  background: #05070d;
  text-align: center;
  padding: 0 20px;
}
.globe-loading[hidden] { display: none; }

#view-toggle[aria-pressed="true"] { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent); }
.map-panel.is-3d #footprint-toggle,
.map-panel.is-3d .map-zoom {
  display: none;
}

.globe-iss-marker { position: relative; width: 1px; height: 1px; pointer-events: none; }
.globe-iss-glow {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px;
  margin-left: -14px; margin-top: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 157, 255, 0.55), transparent 70%);
  animation: iss-glow-pulse 2.6s ease-out infinite;
}
.globe-iss-dot {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px;
  margin-left: -5px; margin-top: -5px;
  border-radius: 50%;
  background: #3e9dff;
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(62, 157, 255, 0.9);
}
.globe-iss-pill {
  position: absolute; left: 50%; top: 50%;
  margin-left: 12px; margin-top: -10px;
  background: rgba(9, 12, 17, 0.78);
  color: #eaf3ff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  white-space: nowrap;
}

/* ============================================================
   Satellite search modal
   ============================================================ */
body.sat-modal-open { overflow: hidden; }
.sat-modal { position: fixed; inset: 0; z-index: 2500; }
.sat-modal[hidden] { display: none; }
.sat-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 12, 17, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sat-modal-card {
  position: relative;
  width: min(480px, calc(100% - 32px));
  max-height: min(72vh, 560px);
  margin: max(60px, 8vh) auto 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}
.sat-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  flex: none;
}
.sat-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
}
.sat-search-input::placeholder { color: var(--faint); }
.sat-modal-body { padding: 10px 14px 14px; overflow-y: auto; }
.sat-modal-heading {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--faint);
  margin: 4px 2px 8px;
}
.sat-modal-list { display: flex; flex-direction: column; gap: 4px; }
.sat-modal-item {
  appearance: none;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-family: var(--sans);
  color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.sat-modal-item:hover, .sat-modal-item:focus-visible { background: var(--surface-2); border-color: var(--line-strong); }
.sat-modal-item-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sat-modal-item-id { flex: none; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.sat-modal-status { padding: 14px 2px; font-size: 13px; color: var(--muted); text-align: center; }
.sat-modal-status[hidden] { display: none; }
.sat-modal-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--faint); }
.sat-modal-foot a { color: var(--faint); text-decoration: underline; }

/* ============================================================
   AR QR popover (desktop -> phone bridge)
   ============================================================ */
body.ar-qr-open { overflow: hidden; }
.ar-qr-popover { position: fixed; inset: 0; z-index: 2600; }
.ar-qr-popover[hidden] { display: none; }
.ar-qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 12, 17, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.ar-qr-card {
  position: relative;
  width: min(300px, calc(100% - 32px));
  margin: max(70px, 12vh) auto 0;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
  padding: 18px;
  text-align: center;
}
.ar-qr-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
}
.ar-qr-card h3 { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 22px 4px 0; }
.ar-qr-hint { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.ar-qr-canvas-wrap {
  width: 180px;
  height: 180px;
  margin: 0 auto 10px;
  padding: 8px;
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ar-qr-canvas-wrap svg { width: 100%; height: 100%; display: block; }
.ar-qr-status { font-size: 12px; color: var(--faint); }
.ar-qr-status[hidden] { display: none; }
.ar-qr-url {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  word-break: break-all;
  margin: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 540px) {
  .map-panel { height: 50vh; height: 50dvh; }
  .tele-grid { gap: 8px; }
}

@media (min-width: 720px) {
  .ar-compass { width: 130px; height: 130px; }
  .map-panel { height: 56vh; height: 56dvh; min-height: 380px; }
  .tele span { font-size: 14px; }
  .panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  :root { --side: 360px; }
  .topbar { flex-wrap: nowrap; }
  .status-row { order: 0; width: auto; margin-left: auto; max-width: 260px; }
  .clocks { margin-left: 0; }
  main { grid-template-columns: minmax(0, 1fr) var(--side); }
  .map-panel {
    height: calc(100vh - 190px);
    height: calc(100dvh - 190px);
    min-height: 460px;
  }
  .side-panel {
    position: sticky;
    top: 2px;
    align-self: start;
    max-height: calc(100dvh - 6px);
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
  }
  .tele span { font-size: 15px; }
  .card { padding: 18px; }
}

@media (min-width: 1200px) {
  .pass-main strong { font-size: 16px; }
}

@media (min-width: 1366px) {
  .panels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tele span { font-size: 15.5px; }
}

@media (min-width: 1440px) {
  .map-panel { height: calc(100vh - 180px); height: calc(100dvh - 180px); }
  .card { padding: 20px; }
}

@media (min-width: 1920px) {
  :root { --side: 400px; }
  body { font-size: 15px; }
  .topbar { padding: 14px 24px; gap: 18px; }
  .brand-logo { width: 46px; height: 46px; }
  .brand h1 { font-size: 22px; }
  .subtitle { font-size: 13px; }
  .clock-utc { font-size: 18px; }
  .clock-local { font-size: 13px; }
  .status-row { font-size: 14px; }
  .map-panel { height: calc(100vh - 200px); height: calc(100dvh - 200px); min-height: 720px; }
  main { gap: 20px; padding: 20px; }
  .panels { gap: 20px; padding: 0 20px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .card { padding: 26px; }
  .card h2 { font-size: 12px; }
  .tele-grid { gap: 10px; }
  .tele { padding: 12px 14px; }
  .tele label { font-size: 10.5px; }
  .tele span { font-size: 18px; }
  .tele-sub { font-size: 13px; }
  .next-pass { font-size: 15px; }
  .btn { font-size: 14px; min-height: 42px; padding: 10px 18px; }
  .coord-inputs input { padding: 11px; font-size: 17px; }
  .meta { font-size: 13px; }
  .people-list li { font-size: 14px; }
  .crew-badge { font-size: 13px; padding: 4px 12px 4px 5px; }
  .pass-main strong { font-size: 18px; }
  .pass-date, .pass-meta, .pass-arrow { font-size: 13px; }
  .pass-list { max-height: 420px; }
  .footer { font-size: 13px; padding: 22px 24px; }
}

@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
  .coord-inputs input { min-height: 44px; }
  .brand-logo { width: 42px; height: 42px; }
  .icon-btn, .menu-toggle { width: 44px; height: 44px; }
  .topbar-controls .icon-btn { height: 44px; }
  .sat-select { min-height: 44px; }
  .map-tools .btn { min-height: 44px; }
  .map-zoom .btn { min-width: 44px; width: 44px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .map-panel { height: 64vh; height: 64dvh; min-height: 260px; }
  .topbar { padding-top: 8px; padding-bottom: 8px; }
  .subtitle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
