:root {
  --bg: #0b1220;
  --panel: rgba(15, 23, 42, .92);
  --panel-border: rgba(148, 163, 184, .18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dark: #0ea5e9;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); overflow: hidden; }

#map { position: absolute; inset: 0; }
.leaflet-container { background: #0d1526; font-family: var(--font); }

/* ---------- left panel ---------- */
#panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 300px; z-index: 1200;
  background: var(--panel); border-right: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .25s ease;
}
#panel.open { transform: translateX(0); }
@media (max-width: 760px) { #panel { width: 86vw; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--panel-border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 30% 30%, #bae6fd, var(--accent) 55%, #1e3a8a);
  box-shadow: 0 0 14px rgba(56, 189, 248, .55);
}
.brand h1 { margin: 0; font-size: 17px; line-height: 1.1; }
.brand p { margin: 2px 0 0; font-size: 11px; color: var(--muted); }

#panelClose {
  background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1;
}
#panelClose:hover { color: var(--text); }

#panel section { padding: 12px 16px; border-bottom: 1px solid var(--panel-border); }
#panel h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

#satSelect {
  width: 100%; padding: 8px 10px; border-radius: 8px; font: 500 12.5px var(--font);
  background: rgba(255,255,255,.05); color: var(--text);
  border: 1px solid var(--panel-border);
}
.custom-row { display: flex; gap: 6px; margin-top: 8px; }
#noradInput {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; font: 500 12.5px var(--font);
  background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--panel-border);
}
#applyBtn {
  border: 1px solid var(--accent); background: var(--accent); color: #082f49;
  font: 700 12px var(--font); padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
#applyBtn:hover { filter: brightness(1.1); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  border: 1px solid var(--panel-border); background: rgba(255,255,255,.05);
  color: var(--text); font: 500 12px var(--font); padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.chips button:hover { background: rgba(255,255,255,.1); }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #082f49; }

.check {
  display: flex; align-items: center; gap: 8px; padding: 5px 4px; cursor: pointer; font-size: 13px;
}
.check input { accent-color: var(--accent); }

#panel footer { margin-top: auto; padding: 12px 16px; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
#panel footer a { color: #7cb0ff; text-decoration: none; }

#panelToggle {
  position: absolute; top: 12px; left: 12px; z-index: 1200;
  background: var(--panel); color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 8px; font-size: 18px; width: 40px; height: 40px; cursor: pointer;
  display: block;
}
#panel.open ~ #panelToggle { display: none; }
.leaflet-top.leaflet-left { margin-top: 56px; }

/* ---------- readout ---------- */
#readout {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 1150;
  width: min(640px, calc(100vw - 48px));
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px;
  padding: 12px 16px; backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.ro-title { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.ro-row { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--muted); }
.ro-grid {
  display: grid; grid-template-columns: repeat(4, auto); gap: 2px 18px;
  margin-top: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.ro-wide { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.ro-status { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.ro-status.warn { color: #fca5a5; }
@media (max-width: 520px) {
  .ro-grid { grid-template-columns: repeat(2, auto); }
}

/* ---------- markers ---------- */
.sat-icon { position: relative; }
.sat-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #e2e8f0; border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(56,189,248,.35), 0 0 12px rgba(56,189,248,.85);
  animation: pulse 1.6s infinite;
}
.sun-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef3c7, #f59e0b);
  border: 2px solid #fbbf24;
  box-shadow: 0 0 14px rgba(251,191,36,.8);
}
.moon-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #cbd5e1; border: 2px solid #e2e8f0;
  box-shadow: 0 0 10px rgba(203,213,225,.7);
}
.planet-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85);
}
.p-mercury { background: #a3a3a3; box-shadow: 0 0 8px rgba(163,163,163,.85); }
.p-venus { background: #fcd34d; box-shadow: 0 0 8px rgba(252,211,77,.85); }
.p-mars { background: #f87171; box-shadow: 0 0 8px rgba(248,113,113,.85); }
.p-jupiter { background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,.85); }
.p-saturn { background: #fde68a; box-shadow: 0 0 8px rgba(253,230,138,.85); }
.p-uranus { background: #7dd3fc; box-shadow: 0 0 8px rgba(125,211,252,.85); }
.p-neptune { background: #60a5fa; box-shadow: 0 0 8px rgba(96,165,250,.85); }
.p-pluto { background: #d9b38c; box-shadow: 0 0 8px rgba(217,179,140,.85); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56,189,248,.5), 0 0 12px rgba(56,189,248,.85); }
  70% { box-shadow: 0 0 0 10px rgba(56,189,248,0), 0 0 12px rgba(56,189,248,.85); }
  100% { box-shadow: 0 0 0 0 rgba(56,189,248,0), 0 0 12px rgba(56,189,248,.85); }
}
