:root {
  color-scheme: dark;
  background: #030812;
  color: #d7efff;
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --cyan: #70dcff;
  --cyan-bright: #a7efff;
  --muted: #7893aa;
  --panel: rgba(7, 17, 30, .72);
  --line: rgba(117, 190, 225, .17);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #030812; }
button { font: inherit; }
#viewport {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 53% 48%, rgba(12, 35, 63, .20), transparent 43%),
    radial-gradient(ellipse at 82% 12%, rgba(36, 30, 77, .15), transparent 32%),
    #030812;
}
#viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(0, 3, 10, .28) 100%);
}
canvas { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing; }
canvas.has-target { cursor: pointer; }
[hidden] { display: none !important; }

#status {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #c9edff;
  pointer-events: none;
}
.loader-orbit { width: 38px; height: 38px; border: 1px solid rgba(105, 209, 255, .25); border-top-color: #8be5ff; border-radius: 50%; animation: orbit-spin 1.4s linear infinite; position: relative; }
.loader-orbit::before { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #b7f3ff; box-shadow: 0 0 12px #63d9ff; top: -2px; left: 16px; }
.loader-orbit i { position: absolute; inset: 6px; border: 1px solid rgba(105, 209, 255, .16); border-radius: 50%; }
.loading-title { margin-top: 8px; font-size: 13px; letter-spacing: .12em; }
.loading-subtitle { color: #607d96; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .2em; }
@keyframes orbit-spin { to { transform: rotate(360deg); } }

#hud { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.brand { position: absolute; top: max(25px, env(safe-area-inset-top)); left: clamp(20px, 3.1vw, 54px); display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 25px; height: 25px; display: grid; place-items: center; position: relative; border: 1px solid rgba(111, 207, 245, .42); border-radius: 50%; transform: rotate(-28deg); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 31px; height: 11px; border: 1px solid rgba(111, 207, 245, .42); border-radius: 50%; }
.brand-mark::after { transform: rotate(60deg); opacity: .55; }
.brand-mark i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #a8edff; box-shadow: 0 0 9px #57d8ff; }
.brand h1 { margin: 0; color: #edf8ff; font-size: 17px; font-weight: 650; letter-spacing: .13em; line-height: 1.2; }
.brand-subtitle { display: block; margin-top: 5px; color: #7795ae; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .2em; }
.brand-subtitle b { color: #55c7ed; font-weight: 400; }

.system-status { position: absolute; top: max(29px, env(safe-area-inset-top)); right: clamp(20px, 3.1vw, 54px); display: flex; align-items: center; gap: 9px; color: #8ca8bf; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.system-status b { color: #d4efff; font-weight: 600; }
.celestial-status { color: #9bb7d1; letter-spacing: .16em; }
.live-indicator, .tiny-pulse { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #5ce4bd; box-shadow: 0 0 9px rgba(92, 228, 189, .8); }
.status-divider { width: 1px; height: 12px; background: rgba(134, 182, 211, .25); margin: 0 4px; }

.overview-panel, .detail-panel {
  position: absolute;
  width: 218px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(10, 25, 42, .78), rgba(4, 12, 23, .55));
  box-shadow: 0 14px 50px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(193, 230, 255, .035);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}
.overview-panel { left: clamp(20px, 3.1vw, 54px); top: 112px; padding: 16px 16px 13px; }
.panel-heading, .detail-heading { display: flex; align-items: center; gap: 8px; color: #8daec6; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .15em; }
.panel-cross { color: #65d7ff; font-size: 15px; line-height: 8px; }
.total-stat { display: flex; align-items: baseline; gap: 10px; margin: 15px 0 13px; }
.total-stat strong { color: #e6f7ff; font: 300 34px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.06em; }
.total-stat span { color: #6f8ba3; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.orbit-stats { display: grid; gap: 9px; padding: 12px 0; border-top: 1px solid rgba(117, 190, 225, .12); border-bottom: 1px solid rgba(117, 190, 225, .12); }
.orbit-stat { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; color: #a6bfd2; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.orbit-stat b { color: #d6efff; font-weight: 500; }
.orbit-dot { width: 5px; height: 5px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.orbit-dot.leo { color: #49dfff; background: #49dfff; }
.orbit-dot.meo { color: #518dff; background: #518dff; }
.orbit-dot.geo { color: #b697ff; background: #b697ff; }
.panel-foot { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: #68869f; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.tiny-pulse { width: 5px; height: 5px; }

.detail-panel { right: clamp(20px, 3.1vw, 54px); top: 50%; transform: translateY(-50%); width: 226px; padding: 16px; }
.detail-signal { width: 7px; height: 7px; border-radius: 50%; background: #8deaff; box-shadow: 0 0 12px #50d6ff; }
.detail-panel strong { display: block; margin-top: 16px; color: #e6f7ff; font: 600 17px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.detail-panel .detail-description { display: block; margin-top: 6px; color: #91abc0; font-size: 10px; line-height: 1.6; }
.detail-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 15px; padding-top: 11px; border-top: 1px solid rgba(117, 190, 225, .13); color: #6e8ba4; font: 7px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.detail-foot span:last-child { color: #67d9bd; }

.bottom-controls { position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: auto; max-width: calc(100% - 28px); }
.toolbar { display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; max-width: 100%; }
nav, .tool-button, .playback-controls { border: 1px solid rgba(115, 185, 220, .2); border-radius: 10px; background: rgba(6, 17, 30, .82); box-shadow: 0 8px 30px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(210, 239, 255, .035); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
nav { display: flex; gap: 2px; padding: 3px; }
button { appearance: none; border: 0; border-radius: 7px; background: transparent; color: #91abc1; min-height: 36px; padding: 0 12px; font-size: 10px; font-weight: 650; cursor: pointer; transition: color .18s ease, background .18s ease, border-color .18s ease; }
button[aria-pressed="true"] { color: #e1f8ff; background: rgba(62, 145, 181, .28); box-shadow: inset 0 0 0 1px rgba(103, 212, 247, .12); }
button:hover, button:focus-visible { color: #fff; }
button:focus-visible { outline: 1px solid #8eeaff; outline-offset: 2px; }
.tool-button { display: inline-flex; align-items: center; gap: 9px; padding: 0 13px; min-height: 42px; }
.tool-button.primary-tool { color: #d6f4ff; border-color: rgba(105, 207, 246, .32); }
.tool-button.primary-tool span { color: #6edbff; font-size: 13px; }
.toggle-indicator { width: 5px; height: 5px; border-radius: 50%; background: #54dbba; box-shadow: 0 0 7px #54dbba; }
#orbit-toggle[aria-pressed="false"] .toggle-indicator,
#celestial-toggle[aria-pressed="false"] .toggle-indicator,
#auto-orbit[aria-pressed="false"] .toggle-indicator { background: #64788a; box-shadow: none; }
.playback-controls { display: flex; align-items: center; gap: 10px; padding: 4px 7px 4px 12px; }
.playback-label { color: #627f98; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; }
.play-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 29px; padding: 0 9px; color: #b8d7e9; background: rgba(42, 87, 113, .24); font-size: 9px; }
.play-icon { color: #83e5ff; font-size: 11px; }
.speed-control { display: flex; gap: 2px; padding-left: 8px; border-left: 1px solid rgba(117, 190, 225, .15); }
.speed-control button { min-height: 27px; min-width: 37px; padding: 0 7px; color: #7895ad; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.speed-control button[aria-pressed="true"] { color: #bdeeff; background: rgba(59, 140, 176, .22); }
.bottom-left-hint { position: absolute; left: clamp(20px, 3.1vw, 54px); bottom: max(34px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 9px; color: #5f7a91; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.bottom-left-hint b { color: #4e9ab8; font-weight: 400; padding: 0 3px; }
.mouse-glyph { width: 13px; height: 18px; border: 1px solid rgba(120, 174, 203, .55); border-radius: 7px; position: relative; }
.mouse-glyph i { position: absolute; left: 5px; top: 3px; width: 1px; height: 4px; background: #7fdfff; }

@media (max-width: 760px) {
  .brand { top: max(17px, env(safe-area-inset-top)); left: 17px; gap: 9px; }
  .brand h1 { font-size: 15px; }
  .brand-mark { width: 21px; height: 21px; }
  .brand-mark::before { width: 27px; }
  .system-status { top: max(22px, env(safe-area-inset-top)); right: 16px; font-size: 7px; gap: 6px; }
  .system-status > span:nth-of-type(2) { display: none; }
  .overview-panel { top: 82px; left: 16px; width: 164px; padding: 11px; }
  .total-stat { margin: 10px 0; }
  .total-stat strong { font-size: 27px; }
  .total-stat span { font-size: 7px; }
  .orbit-stats { gap: 7px; padding: 9px 0; }
  .panel-foot { margin-top: 9px; font-size: 7px; }
  .detail-panel { right: 14px; top: auto; bottom: 120px; transform: none; width: 185px; padding: 12px; }
  .detail-panel strong { margin-top: 10px; font-size: 14px; }
  .detail-foot { font-size: 6px; }
  .bottom-controls { bottom: max(12px, env(safe-area-inset-bottom)); gap: 7px; width: calc(100% - 20px); }
  .toolbar { gap: 5px; max-width: 100%; flex-wrap: wrap; justify-content: center; }
  nav { padding: 2px; }
  button { min-height: 34px; padding: 0 9px; font-size: 9px; }
  .tool-button { min-height: 38px; padding: 0 9px; gap: 5px; }
  .playback-controls { gap: 6px; padding: 3px 5px 3px 9px; }
  .playback-label { display: none; }
  .bottom-left-hint { display: none; }
}
@media (max-width: 430px) {
  .overview-panel { width: 145px; top: 77px; }
  .panel-heading { font-size: 7px; }
  .orbit-stat { font-size: 9px; }
  .system-status { top: auto; bottom: 102px; right: 14px; }
  .celestial-status, .celestial-divider { display: none; }
  .toolbar { flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 18px); }
  .detail-panel { bottom: 130px; }
  .speed-control button { min-width: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Solar-system controls and cinematic scene polish */
#celestial-toggle[aria-pressed="true"] { color: #d8efff; border-color: rgba(125, 180, 230, .28); }
#auto-orbit[aria-pressed="true"] { color: #d8efff; border-color: rgba(91, 220, 190, .28); }
#moon-view { border-color: rgba(150, 171, 220, .24); }
#viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 34%, rgba(1, 5, 14, .12) 68%, rgba(1, 3, 10, .44) 100%),
    linear-gradient(180deg, rgba(2, 6, 15, .12), transparent 22%, transparent 72%, rgba(2, 6, 15, .22));
}
@media (max-width: 760px) {
  .celestial-status, .celestial-divider { display: none; }
  .bottom-controls { bottom: max(10px, env(safe-area-inset-bottom)); gap: 6px; }
  .toolbar { gap: 4px; }
  .tool-button { padding-inline: 8px; }
}
@media (max-width: 430px) {
  #celestial-toggle, #auto-orbit, #moon-view, #earth-view { min-height: 32px; font-size: 8px; padding-inline: 7px; }
  .bottom-controls { max-width: calc(100% - 10px); }
}
