:root {
  --bg: #02030a;
  --panel: rgba(12, 16, 28, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e8edf7;
  --muted: #8f9ab0;
  --accent: #5ec8ff;
  --pin: #ffb547;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
canvas#globe { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.muted { color: var(--muted); }

.top { position: fixed; top: 16px; left: 16px; right: 16px; display: flex; gap: 16px; align-items: flex-start;
  justify-content: space-between; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: 0.02em; }
#clock { font-size: 13px; font-variant-numeric: tabular-nums; }

.search { position: relative; width: min(360px, 60vw); }
#search { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 15px; outline: none; backdrop-filter: blur(10px); }
#search:focus { border-color: var(--accent); }
#results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: rgba(12, 16, 28, 0.94); border: 1px solid var(--line); border-radius: 12px; max-height: 50vh; overflow-y: auto; }
#results li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
#results li.active, #results li:hover { background: rgba(94, 200, 255, 0.16); }
#results .kind { color: var(--muted); font-size: 12px; white-space: nowrap; }

aside { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(12px); padding: 14px 16px; }

#card { left: 16px; bottom: 64px; width: min(320px, calc(100vw - 32px)); }
#card-title { font-size: 20px; font-weight: 600; padding-right: 24px; }
#card-sub { margin-top: 2px; }
#card-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0; font-size: 14px; }
#card-facts dt { color: var(--muted); }
#card-facts dd { margin: 0; font-variant-numeric: tabular-nums; }

#pins-panel { right: 16px; bottom: 64px; width: 240px; max-height: 45vh; display: flex; flex-direction: column; }
.panel-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
#pins { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#pins li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
#pins li .name { flex: 1; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pins li .name:hover { color: var(--accent); }
#pins li .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pin); flex: none; }
.hint { font-size: 12px; margin: 8px 0 0; }

.btn { width: 100%; padding: 9px; border-radius: 10px; border: 1px solid var(--accent); background: rgba(94, 200, 255, 0.12);
  color: var(--text); font-size: 14px; cursor: pointer; }
.btn:hover { background: rgba(94, 200, 255, 0.25); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn + .btn { margin-top: 8px; }
#card-model { font-size: 12px; color: var(--muted); margin: -4px 0 12px; display: grid; gap: 3px; }
#card-model .kind { font-size: 13px; font-weight: 600; color: var(--text); }
#card-model .kind.real::before { content: "● "; color: #4ade80; }
#card-model .kind.relative::before { content: "● "; color: #fbbf24; }
#card-model .kind.standin::before { content: "● "; color: var(--muted); }
#card-model a { color: var(--accent); }
.btn.on { background: var(--accent); color: #02030a; }
.icon { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.icon:hover, .link:hover { color: var(--text); }
.link { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; }
#pins li .icon { position: static; font-size: 16px; padding: 0 2px; }

.hint-bar { position: fixed; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 12px; pointer-events: none; }
.hint-bar .credits { font-size: 11px; opacity: 0.8; pointer-events: auto; }
.hint-bar a { color: inherit; }
.hint-bar a:hover { color: var(--text); }

/* Satellites panel: one row per colour group, click to show/hide */
#sats-panel { right: 16px; top: 76px; width: 260px; }
#sats-panel summary { cursor: pointer; list-style: none; margin-bottom: 0; }
#sats-panel summary::-webkit-details-marker { display: none; }
#sats-panel details[open] summary { margin-bottom: 6px; }
#sats-total { font-weight: 400; font-size: 12px; font-variant-numeric: tabular-nums; }
#sats-groups { list-style: none; margin: 0; padding: 0; }
#sats-groups label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }
#sats-groups input { display: none; }
#sats-groups .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#sats-groups .name { flex: 1; }
#sats-groups .count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#sats-groups input:not(:checked) ~ * { opacity: 0.35; }
#sats-groups input:not(:checked) ~ .dot { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--muted); }

#sat-tip { position: fixed; pointer-events: none; padding: 4px 8px; border-radius: 8px; font-size: 12px; white-space: nowrap;
  background: rgba(12, 16, 28, 0.9); border: 1px solid var(--line); transform: translate(12px, -50%); }

/* Selected satellite gets a label like a pin, in the accent colour */
.label.sat { font-weight: 600; }
.label.sat::after { background: transparent; width: 14px; height: 14px; margin-left: -7px; bottom: -3px;
  box-shadow: 0 0 0 2px var(--accent), 0 0 12px var(--accent); }

/* Pin labels float over the canvas and follow the globe */
#labels { position: fixed; inset: 0; pointer-events: none; }
.label { position: absolute; transform: translate(-50%, -100%); padding-bottom: 10px; pointer-events: auto; cursor: pointer;
  white-space: nowrap; font-size: 12px; font-weight: 500; text-shadow: 0 1px 3px #000, 0 0 8px #000; transition: opacity 0.2s; }
.label::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  background: var(--pin); box-shadow: 0 0 0 2px rgba(0,0,0,0.5), 0 0 10px var(--pin); }
.label.hidden { opacity: 0; pointer-events: none; }
.label.focus::after { background: var(--accent); box-shadow: 0 0 0 2px rgba(0,0,0,0.5), 0 0 12px var(--accent); }

@media (max-width: 640px) {
  .top { flex-direction: column; }
  .search { width: 100%; }
  #pins-panel { display: none; }
  #sats-panel { top: auto; bottom: 64px; left: 16px; right: 16px; width: auto; }
  #sats-panel details:not([open]) { font-size: 14px; }
  #card { bottom: 64px; z-index: 2; }
  .hint-bar .hints { display: none; }
}
@media (max-height: 700px) and (min-width: 641px) {
  #pins-panel { max-height: 22vh; }
}

/* Location chip under the clock */
.chip { margin-top: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-size: 13px; cursor: pointer; backdrop-filter: blur(10px); }
.chip:hover { border-color: var(--accent); }

/* Passes panel */
#passes { left: 16px; top: 116px; width: min(360px, calc(100vw - 32px)); max-height: calc(100vh - 380px); min-height: 180px;
  display: flex; flex-direction: column; z-index: 3; }
#passes[hidden] { display: none; }
#passes .hint { margin: 0 0 8px; }
#passes-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#passes-list li { padding: 8px; border-radius: 10px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
#passes-list li:hover { background: rgba(94, 200, 255, 0.12); }
#passes-list .when { font-weight: 600; font-variant-numeric: tabular-nums; }
#passes-list .who { color: var(--accent); font-size: 13px; text-align: right; }
#passes-list .how { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
#passes-list .empty { cursor: default; color: var(--muted); font-size: 13px; }
.passes-actions { margin-top: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.passes-actions .link { font-size: 12px; color: var(--accent); padding: 0; }

/* Time bar */
#timebar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 52px; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(12px);
  width: min(620px, calc(100vw - 32px)); z-index: 1; }
#t-speeds { display: flex; gap: 2px; }
.tb { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 8px; padding: 4px 8px; font-size: 13px;
  cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb:hover { color: var(--text); }
.tb.on { color: #02030a; background: var(--accent); }
#t-play { width: 34px; color: var(--text); }
#t-slider { flex: 1; min-width: 60px; accent-color: var(--accent); }
#t-label { font-size: 12px; color: var(--muted); min-width: 118px; text-align: right; font-variant-numeric: tabular-nums; }
#t-live { color: var(--accent); border-color: var(--accent); }
.label.home { transform: translate(-50%, 0); padding: 12px 0 0; color: #bbf7d0; z-index: 1; }
.label.home::after { bottom: auto; top: -4px; background: #4ade80; box-shadow: 0 0 0 2px rgba(0,0,0,0.5), 0 0 10px #4ade80; }

@media (max-width: 1180px) and (min-width: 641px) {
  #card, #pins-panel { bottom: 116px; }
}
@media (max-width: 640px) {
  #timebar { bottom: 122px; gap: 4px; padding: 6px 8px; flex-wrap: wrap; }
  #t-label { min-width: 0; }
  #passes { top: auto; bottom: 64px; max-height: 60vh; }
}
