:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #f4f8ff;
  --muted: #91a5ba;
  --cyan: #65dfff;
  --mint: #72f3bd;
  --glass: rgba(5, 12, 22, 0.72);
  --line: rgba(151, 205, 255, 0.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #02050a; }
body { min-height: 100vh; overflow: hidden; color: var(--ink); }
button, input, select { font: inherit; }
.shell {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 70% 30%, rgba(39, 101, 165, 0.12), transparent 37%),
    radial-gradient(circle at 58% 44%, #102138 0, #050b13 36%, #02050a 72%);
}
header {
  position: fixed;
  z-index: 3;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 4rem);
  pointer-events: none;
}
.brand, .status-wrap { pointer-events: auto; }
.brand {
  max-width: min(42rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem 1rem;
  border: 1px solid rgba(151, 205, 255, 0.24);
  border-radius: 0.9rem;
  background: rgba(3, 11, 20, 0.88);
  backdrop-filter: blur(18px) saturate(120%);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.38);
}
.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--cyan);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3.7vw, 3.7rem);
  font-weight: 520;
  letter-spacing: -0.055em;
  line-height: 0.95;
}
h1 span { color: #8297ad; font-weight: 350; }
.brand > p:last-child { max-width: 36rem; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.status-wrap { display: grid; justify-items: end; gap: 0.4rem; }
.status, .engine {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--glass);
  font-size: 0.68rem;
  backdrop-filter: blur(16px);
}
.status::before {
  content: "";
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0.8rem var(--mint);
}
.utc, .engine { color: #8196aa; font: 600 0.62rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
#location-map {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: #02050a;
  opacity: 0;
  transition: opacity 220ms linear;
}
#location-map[hidden] { display: none; }
#location-map .maplibregl-canvas { cursor: grab; }
#location-map .maplibregl-ctrl-top-right { top: 44%; right: 0.75rem; transform: translateY(-50%); }
#location-map .maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(151, 205, 255, 0.38);
  border-radius: 0.65rem;
  background: #091522;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.45);
}
#location-map .maplibregl-ctrl-group button { background-color: #091522; }
#location-map .maplibregl-ctrl-group button:hover { background-color: #17334b; }
#location-map .maplibregl-ctrl-group button + button { border-top-color: rgba(151, 205, 255, 0.3); }
#location-map .maplibregl-ctrl-icon { filter: invert(1) brightness(1.8); }
#location-map .maplibregl-ctrl-bottom-right { bottom: 3.4rem; right: 0.75rem; }
#location-map .maplibregl-ctrl-attrib {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: rgba(5, 12, 22, 0.82);
  color: #9cb1c5;
}
#location-map .maplibregl-ctrl-attrib a { color: #a9e9ff; }
.street-zoom-hint {
  position: fixed;
  z-index: 3;
  right: clamp(1rem, 4vw, 4rem);
  bottom: clamp(11.5rem, 23vh, 13rem);
  margin: 0;
  padding: 0.48rem 0.7rem;
  border: 1px solid rgba(151, 205, 255, 0.3);
  border-radius: 0.65rem;
  background: rgba(5, 12, 22, 0.9);
  color: #d7e7f4;
  font-size: 0.65rem;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.38);
  pointer-events: none;
}
#location-map[hidden] + .street-zoom-hint,
.stage:not([data-globe-phase="street"]) .street-zoom-hint { display: none; }
.stage > canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  outline: none;
  transition: opacity 220ms linear;
}
.stage > canvas[hidden] { display: none !important; }
.stage > .scene-overlay { z-index: 2; }
canvas:active { cursor: grabbing; }
canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--cyan); }
.panel {
  position: fixed;
  z-index: 3;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(120%);
  box-shadow: 0 1.4rem 4rem rgba(0, 0, 0, 0.45);
}
.layers {
  left: clamp(1rem, 4vw, 4rem);
  bottom: clamp(4.5rem, 7vh, 6.5rem);
  width: min(23rem, calc(100vw - 2rem));
  max-height: 58vh;
  overflow: auto;
  padding: 1rem;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  color: #d8e6f4;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.panel-title span {
  max-width: 15rem;
  color: #8098ae;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0;
  text-align: right;
  text-transform: none;
}
.layer-groups { display: grid; gap: 0.65rem; }
fieldset { margin: 0; padding: 0; border: 0; }
legend {
  margin-bottom: 0.35rem;
  color: #657d94;
  font-size: 0.57rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.layer-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.38rem 0.65rem; }
.layer-list label {
  display: flex;
  align-items: flex-start;
  gap: 0.38rem;
  min-width: 0;
  color: #a9bed1;
  font-size: 0.64rem;
  line-height: 1.25;
}
.layer-list input { margin: 0.08rem 0 0; accent-color: var(--cyan); }
.layer-list small { display: block; color: #61768a; font-size: 0.54rem; }
.layer-list label.unavailable { color: #657384; }
.layer-list label.stale small { color: #d6a462; }
.selection { min-height: 1rem; margin: 0.75rem 0 0; color: #7991a8; font-size: 0.6rem; }
.controls {
  right: clamp(1rem, 4vw, 4rem);
  bottom: clamp(4.5rem, 7vh, 6.5rem);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: min(35rem, calc(100vw - 2rem));
  padding: 0.72rem;
}
.controls button, .controls select {
  min-height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(110, 180, 235, 0.08);
  color: #d7e7f4;
  cursor: pointer;
}
.controls button { min-width: 2.35rem; }
.controls label { min-width: 0; color: #8196aa; font-size: 0.58rem; }
.controls .time { flex: 1; }
.controls output { float: right; color: #d4e7f6; font-family: ui-monospace, monospace; }
.controls input[type="range"] { width: 100%; accent-color: var(--cyan); }
.controls select {
  width: 7.4rem;
  padding: 0 0.35rem;
  font-size: 0.62rem;
  color-scheme: dark;
  background-color: #0b1726;
  color: #f4f8ff;
}
.controls select:hover { border-color: rgba(151, 205, 255, 0.48); background-color: #10243a; }
.controls select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.controls select option { background: #0b1726; color: #f4f8ff; }
.controls select option:checked { background: #174a70; color: #ffffff; }
.controls select option:disabled { background: #0b1726; color: #91a5ba; }
footer {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: 0.75rem;
  width: min(56rem, calc(100vw - 2rem));
  transform: translateX(-50%);
  color: #61768a;
  font-size: 0.59rem;
  line-height: 1.45;
  text-align: center;
}
footer strong { color: #8499ae; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  header { padding: 0.85rem; }
  h1 { font-size: 1.65rem; }
  .brand > p:last-child { max-width: 13rem; margin-top: 0.55rem; font-size: 0.65rem; }
  .status-wrap { max-width: 10.5rem; }
  .status { font-size: 0.56rem; text-align: right; }
  .status-wrap .utc { display: none; }
  .engine { font-size: 0.52rem; }
  .layers {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 9.4rem;
    width: auto;
    max-height: 18vh;
    padding: 0.65rem;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .panel-title { margin-bottom: 0.45rem; }
  .panel-title span { max-width: 13rem; }
  .layer-groups { display: block; overflow: visible; padding-bottom: 0.2rem; }
  fieldset { min-width: 0; margin-bottom: 0.6rem; }
  .layer-list { grid-template-columns: 1fr 1fr; gap: 0.25rem; }
  .selection { margin-top: 0.45rem; }
  .controls {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 3.35rem;
    width: auto;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(5, 2.25rem) minmax(0, 1fr);
    gap: 0.35rem;
    padding: 0.45rem;
  }
  .controls button { min-width: 2.25rem; min-height: 2.25rem; padding: 0.25rem; }
  .time-slider { min-width: 0; }
  .time-slider input { width: 100%; min-width: 0; }
  .time-slider { grid-column: 6; }
  .quality-select { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.35rem; }
  .quality-select select { flex: 1; min-width: 0; }
  #location-map .maplibregl-ctrl-bottom-right { bottom: 9.2rem; }
  #location-map .maplibregl-ctrl-top-right { top: 40%; right: 0.65rem; }
  .street-zoom-hint { right: 0.65rem; bottom: 13rem; max-width: calc(100vw - 1.3rem); }
  footer { left: 0.7rem; right: 0.7rem; bottom: 0.25rem; font-size: 0.47rem; line-height: 1.3; max-height: 2.7rem; overflow-y: auto; }
  .layer-list label { font-size: 0.68rem; }
  .layer-list small { font-size: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  canvas { cursor: default; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
}
