:root {
  --bg: #05071a;
  --panel: rgba(12, 16, 44, 0.92);
  --ink: #f4f6ff;
  --muted: #a4acd6;
  --accent: #ffc45c;
  --aircraft: #6edcff;
  --satellite: #b496ff;
  --station: #ffc45c;
  --train: #96ffc8;
  --launch: #ff8264;
  --line: rgba(120, 132, 200, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#camera, #sky { position: fixed; inset: 0; width: 100%; height: 100%; }
#camera { object-fit: cover; background: radial-gradient(ellipse at 50% 120%, #2a1b4e, #05071a 70%); }
#sky { touch-action: none; }

/* Start screen */
.start { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(ellipse at 50% 110%, #3a2464 0%, #0e1236 45%, #05071a 80%); z-index: 20; }
.start-inner { max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.start h1 { font-size: clamp(30px, 8vw, 40px); line-height: 1.1; margin: 8px 0 0; }
.start p { color: var(--muted); margin: 0; }
.fine { font-size: 13px; color: var(--muted); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; justify-content: center; }
.logo-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 196, 92, .18), 0 0 24px var(--accent); }

.btn { border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 700; }
.btn.primary { background: var(--accent); color: #0a0c1e; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.big { padding: 18px 34px; font-size: 18px; box-shadow: 0 10px 30px rgba(255, 196, 92, .25); }
.btn:disabled { opacity: .6; }

/* Live chrome */
.topbar { position: fixed; top: calc(var(--safe-top) + 10px); left: 12px; right: 12px; display: flex;
  justify-content: space-between; align-items: center; gap: 8px; z-index: 5; }
.status { display: flex; align-items: center; gap: 8px; background: var(--panel); padding: 8px 12px;
  border-radius: 999px; font-size: 14px; min-width: 0; }
#status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: #5dff9e; box-shadow: 0 0 8px #5dff9e; }
.top-actions { display: flex; gap: 6px; flex: none; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px;
  font-size: 14px; font-weight: 600; }
.chip.toggle:not(.on) { opacity: .5; }
.filters { position: fixed; top: calc(var(--safe-top) + 58px); left: 12px; display: flex; gap: 6px; z-index: 5; }

.reticle { position: fixed; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border: 2px solid rgba(255, 255, 255, .75); border-radius: 50%; pointer-events: none; z-index: 4; }
.reticle span { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: #fff; }
.hint { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 110px); transform: translateX(-50%);
  background: var(--panel); padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--muted);
  z-index: 5; white-space: nowrap; }
.bottombar { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 22px); display: flex;
  justify-content: center; z-index: 5; }

/* Sheets */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto; z-index: 10;
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
  padding: 22px 16px calc(var(--safe-bottom) + 22px); animation: up .22s ease-out; }
@media (min-width: 640px) { .sheet { left: 50%; width: 520px; transform: translateX(-50%); } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 640px) { @keyframes up { from { opacity: 0; } } }
.sheet h2 { margin: 0 0 4px; font-size: 22px; }
.sheet h3 { margin: 18px 0 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sheet-close { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 28px;
  color: var(--muted); line-height: 1; padding: 6px 10px; }
.kind { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .08em; padding: 3px 10px;
  border-radius: 999px; color: #0a0c1e; margin-bottom: 8px; }
.sub { color: var(--muted); margin: 0 0 12px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px; }
.fact { background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 10px; }
.fact b { display: block; font-size: 17px; }
.fact span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.alts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.alt { display: flex; justify-content: space-between; gap: 10px; text-align: left; width: 100%;
  background: rgba(255, 255, 255, .04); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; }
.alt small { color: var(--muted); }
.conf { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions .btn { flex: 1 1 auto; }
.card-preview { display: block; width: 100%; max-width: 300px; margin: 6px auto 12px; border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5); background: #0e1236; aspect-ratio: 9 / 16; object-fit: cover; }
.card-preview.square { aspect-ratio: 1; max-width: 340px; }
.seg { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li { background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 10px 12px; }
.list small { color: var(--muted); display: block; }
.empty { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin: 14px 0; font-size: 15px; }
.row input { width: 100%; }
.toast { position: fixed; left: 50%; top: calc(var(--safe-top) + 64px); transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: #0a0c1e; padding: 10px 16px; border-radius: 999px; font-weight: 600;
  font-size: 14px; max-width: calc(100vw - 32px); text-align: center; }
