:root {
  --fg: #e9edf4;
  --muted: rgba(233, 237, 244, .55);
  --faint: rgba(233, 237, 244, .28);
  --glass: rgba(12, 14, 20, .52);
  --line: rgba(255, 255, 255, .08);
  --accent: #ffd9a0;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--fg); font-family: var(--font); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#stage canvas { display: block; touch-action: none; }

/* labels */
#labels { position: fixed; inset: 0; pointer-events: none; }
.label {
  position: absolute; left: 0; top: 0; pointer-events: auto; padding: 6px 8px; margin: -14px 0 0 -8px;
  display: flex; align-items: center; gap: 0; white-space: nowrap;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  transition: color .2s;
}
.label i { width: 5px; height: 5px; border-radius: 50%; box-shadow: 0 0 8px currentColor; flex: none; margin-left: 2px; }
.label span { margin-left: calc(var(--off, 6px) - 4px); text-shadow: 0 0 6px #000; }
.label.big i { opacity: 0; }
.label.moon { font-size: 9px; color: var(--faint); }
.label.moon i { width: 3px; height: 3px; }
.label:hover { color: var(--fg); }

/* top bar */
#top {
  position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(12px + var(--st)) calc(16px + var(--sr)) 0 calc(16px + var(--sl)); pointer-events: none;
}
#top > * { pointer-events: auto; }
.brand { display: flex; flex-direction: column; gap: 4px; }
.title { font-size: 11px; letter-spacing: .38em; text-transform: uppercase; font-weight: 500; }
#date { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.time { display: flex; gap: 6px; }
.time button {
  height: 30px; padding: 0 12px; border-radius: 15px; background: var(--glass); border: 1px solid var(--line);
  font-size: 11px; letter-spacing: .06em; color: var(--muted); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.time button:active { color: var(--fg); }
#play { width: 30px; padding: 0; position: relative; }
#play::before, #play::after { content: ""; position: absolute; top: 10px; width: 2px; height: 10px; background: var(--fg); border-radius: 1px; }
#play::before { left: 12px; } #play::after { left: 16px; }
#play.paused::before { left: 12px; width: 0; height: 0; background: none; border-radius: 0;
  border-left: 8px solid var(--fg); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
#play.paused::after { display: none; }
#speed { min-width: 84px; }

/* bottom nav */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 0 0 calc(10px + var(--sb));
  display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
}
.row {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 0 calc(12px + var(--sr)) 0 calc(12px + var(--sl));
  mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 24px), transparent);
}
.row::-webkit-scrollbar { display: none; }
.row:empty { display: none; }
.chip {
  flex: none; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); border: 1px solid transparent; transition: color .2s, border-color .2s, background .2s;
}
.chip.on { color: var(--accent); border-color: rgba(255, 217, 160, .35); background: rgba(255, 217, 160, .06); }
#moons .chip { height: 26px; font-size: 10px; }
.rowlabel { flex: none; align-self: center; font-size: 9px; letter-spacing: .3em; text-transform: uppercase; color: var(--faint); padding: 0 6px 0 4px; }

/* info panel */
#panel {
  position: fixed; right: calc(12px + var(--sr)); top: calc(54px + var(--st)); bottom: calc(var(--navh, 60px) + 4px);
  width: min(340px, 40vw); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  transition: opacity .35s, transform .35s; animation: rise .5s ease;
}
#panel::-webkit-scrollbar { display: none; }
#panel.hidden { opacity: 0; transform: translateX(16px); pointer-events: none; }
#panel.min { bottom: auto; }
#panel.min .pb { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.ph { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 16px 18px 10px; cursor: pointer;
  background: linear-gradient(to bottom, rgba(12,14,20,.85), rgba(12,14,20,0)); }
.kicker { font-size: 9px; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); opacity: .85; }
h1 { margin: 6px 0 0; font-size: 30px; font-weight: 200; letter-spacing: .02em; line-height: 1; }
.toggle { width: 10px; height: 10px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); transform: rotate(-135deg); margin-bottom: 6px; transition: transform .3s; }
#panel.min .toggle { transform: rotate(45deg); margin-bottom: 10px; }
.pb { padding: 0 18px 18px; }
.tag { margin: 4px 0 12px; font-size: 13px; line-height: 1.45; color: rgba(233,237,244,.82); font-weight: 300; }
.live { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); padding: 10px 0; border-top: 1px solid var(--line); }
.live b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.stats dt { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.stats dd { margin: 3px 0 0; font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.weigh { margin: 0; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.weigh b { color: var(--fg); font-weight: 500; }
h3 { margin: 6px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 9px; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--faint); }
.facts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.facts li { font-size: 12.5px; line-height: 1.5; font-weight: 300; color: rgba(233,237,244,.85); padding-left: 14px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 1px; background: var(--accent); }
.foot { margin: 16px 0 0; font-size: 10px; line-height: 1.5; color: var(--faint); }

@media (orientation: portrait) {
  #panel { left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); top: auto; width: auto; max-height: 44vh; bottom: calc(var(--navh, 60px) + 4px); }
  #panel.min { bottom: calc(var(--navh, 60px) + 4px); }
  #panel.hidden { transform: translateY(16px); }
  h1 { font-size: 26px; }
}

/* loader */
#loader { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; transition: opacity 1.2s; z-index: 5; }
#loader.done { opacity: 0; pointer-events: none; }
.lt { font-size: 12px; letter-spacing: .5em; text-transform: uppercase; color: var(--muted); padding-left: .5em; }
.track { width: 120px; height: 1px; background: var(--line); }
#bar { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .3s; }
#credit { position: fixed; left: calc(16px + var(--sl)); top: calc(46px + var(--st)); font-size: 8px; color: rgba(255,255,255,.18); letter-spacing: .04em; pointer-events: none; }
