:root { --un: #009EDB; --ink: #f2f5fa; --mute: #b7c4d4; --glass: rgba(9, 14, 27, 0.72); --line: rgba(255, 255, 255, 0.14); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05070d; color: var(--ink); font-family: Roboto, Arial, sans-serif; overflow: hidden; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#gl { touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }
#overlay { pointer-events: none; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#hud { position: fixed; left: max(16px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); max-width: min(560px, calc(100vw - 200px));
  padding: 14px 18px 12px; border-left: 4px solid var(--un); background: linear-gradient(90deg, rgba(5, 8, 16, 0.70), rgba(5, 8, 16, 0.30)); border-radius: 0 10px 10px 0; }
.kicker { color: var(--un); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
#hud h1 { margin: 2px 0 6px; font-size: 24px; font-weight: 700; line-height: 1.15; }
#hud-time { font-size: 15px; font-weight: 500; }
#hud-sats { font-size: 15px; margin-top: 4px; color: #d6ecfa; }
#hud-sats b { font-size: 17px; color: #fff; }
#hud-view { font-size: 13px; color: var(--mute); margin-top: 2px; }
#hud-note { font-size: 12px; color: #9aaabd; margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button, #topright button, #controls button { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; min-height: 34px; }
.chips button:hover, #topright button:hover, #controls button:hover { background: rgba(255, 255, 255, 0.14); }
.chips button.on, .speeds button.on { background: var(--un); border-color: var(--un); color: #fff; font-weight: 500; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #8fd3f5; outline-offset: 2px; }

#topright { position: fixed; right: max(16px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); display: flex; gap: 8px; }
#topright button { background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

#loading { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; background: var(--glass); font-size: 13px; color: #d6ecfa; }
#loading[hidden] { display: none; }

#controls { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(920px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 16px; }
#controls .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.speeds, .views { display: flex; gap: 4px; flex-wrap: wrap; }
#controls .play { width: 44px; min-height: 44px; border-radius: 50%; background: var(--un); border-color: var(--un); color: #fff; font-size: 14px; }
.time { flex: 1 1 260px; display: flex; align-items: center; gap: 10px; }
.time input { flex: 1; accent-color: var(--un); min-height: 34px; }
#time-label { font-variant-numeric: tabular-nums; min-width: 44px; font-weight: 500; }
.date input, #loc { background: rgba(255, 255, 255, 0.08); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 14px; color-scheme: dark; min-height: 34px; }
.views { margin-left: auto; }

#settings { position: fixed; top: 0; right: 0; height: 100%; width: min(360px, 100vw); padding: 16px 18px 24px; overflow-y: auto; background: rgba(8, 12, 24, 0.94);
  border-left: 1px solid var(--line); transform: translateX(105%); transition: transform 0.25s ease; z-index: 5; }
#settings.open { transform: none; }
#settings .head { display: flex; justify-content: space-between; align-items: center; }
#settings h2 { margin: 0; font-size: 18px; }
#settings .head button { background: none; border: 0; font-size: 28px; cursor: pointer; width: 44px; height: 44px; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 14px 0 0; padding: 12px 0 0; }
legend { color: var(--un); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; padding: 0; }
fieldset label { display: block; margin: 8px 0; font-size: 14px; line-height: 1.35; cursor: pointer; }
fieldset label small { display: block; color: var(--mute); font-size: 12px; margin-left: 24px; }
fieldset.dim { opacity: 0.45; }
.hint { color: var(--mute); font-size: 12px; line-height: 1.4; margin: 6px 0; }
.slider input { width: 100%; accent-color: var(--un); margin-top: 6px; }
.tog { display: flex; gap: 8px; align-items: center; }
input[type=radio], input[type=checkbox] { accent-color: var(--un); }
#loc { width: 100%; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal[hidden] { display: none; }
.modal article { position: relative; width: min(720px, 100%); max-height: 88vh; overflow-y: auto; background: #0b1120; border: 1px solid var(--line); border-top: 4px solid var(--un); border-radius: 12px; padding: 22px 26px; line-height: 1.55; font-size: 15px; }
.modal h2 { margin: 4px 0 10px; font-size: 22px; }
.modal h3 { margin: 16px 0 4px; font-size: 15px; color: #d6ecfa; }
.modal ul { padding-left: 18px; margin: 6px 0; }
.modal li { margin: 4px 0; }
.modal a { color: #8fd3f5; }
.modal .src { font-size: 13px; }
.modal .fine { color: var(--mute); font-size: 12px; margin-top: 14px; }
.modal .close { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 28px; cursor: pointer; width: 44px; height: 44px; }

@media (max-width: 720px) {
  #hud { max-width: calc(100vw - 32px); padding: 10px 12px; top: max(58px, env(safe-area-inset-top)); }
  #hud h1 { font-size: 19px; }
  #hud-time, #hud-sats { font-size: 13px; }
  #hud-view, #hud-note { font-size: 12px; }
  #hud-note { display: none; }
  .chips button { padding: 5px 10px; font-size: 12px; }
  #controls { gap: 6px; padding: 8px; }
  .views { margin-left: 0; }
  .speeds button { padding: 6px 9px; }
}
@media (max-width: 720px) {
  #controls .row:first-child { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #controls .row:first-child::-webkit-scrollbar { display: none; }
  #controls .row:first-child > * { flex: 0 0 auto; }
  .speeds { flex-wrap: nowrap; }
  .views button:not([data-view=zenith]) { display: none; }
  .time { flex-basis: 100%; }
  .date { flex: 1; }
  .date input { width: 100%; }
}
