:root {
  --bg: #05070d;
  --panel: rgba(12, 17, 30, 0.72);
  --panel-solid: #0e1424;
  --panel-border: rgba(160, 185, 255, 0.14);
  --text: #e8ecf6;
  --text-dim: #9aa6c0;
  --accent: #ffc76b;
  --accent-2: #8fb8ff;
  --danger: #ff8a7a;
  --radius: 14px;
  --gutter: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

svg {
  fill: currentColor;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#sky.dragging {
  cursor: grabbing;
}

/* ---------- Loading ---------- */
.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--bg);
  z-index: 50;
  transition: opacity 0.6s;
  color: var(--text-dim);
}

.loading.done {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: 64px;
  height: 64px;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(0.85);
    opacity: 0.6;
  }
}

/* ---------- Shared controls ---------- */
.panel,
.chip,
.icon-btn,
.timebar,
.dropdown,
.compass-widget {
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  cursor: pointer;
  white-space: nowrap;
}

.chip svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--accent);
}

.chip:hover:not(:disabled),
.icon-btn:hover:not(:disabled) {
  border-color: rgba(160, 185, 255, 0.35);
}

.chip:disabled,
.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.chip.small {
  padding: 4px 10px;
  font-size: 12px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn.small {
  width: 28px;
  height: 28px;
  font-size: 18px;
  background: transparent;
  border-color: transparent;
}

.icon-btn[aria-pressed="true"] {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* A panel too tall for the screen keeps its head (title, close button) and foot
   (buttons) in view, and scrolls only what's between. */
.panel.split {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.split > .panel-head {
  align-items: flex-start;
  padding: 12px 10px 10px 16px;
  border-bottom: 1px solid var(--panel-border);
}

.split > .panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px 16px 12px;
}

.split > .panel-foot {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--panel-border);
}

.split > .panel-foot:empty {
  display: none;
}

.panel h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  max-height: 50vh;
  overflow: auto;
  z-index: 30;
}

.dropdown li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.dropdown li small {
  color: var(--text-dim);
}

.dropdown li[aria-selected="true"],
.dropdown li:hover {
  background: rgba(143, 184, 255, 0.14);
}

input[type="search"],
input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  outline: none;
}

input[type="search"]:focus,
input[type="number"]:focus,
input[type="text"]:focus {
  border-color: var(--accent-2);
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: max(var(--gutter), env(safe-area-inset-top, 0px));
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

#location-btn {
  max-width: 40vw;
}

#location-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.search {
  position: relative;
  flex: 0 1 280px;
  min-width: 120px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ---------- Compass & zoom ---------- */
.nav {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--timebar-h, 120px) + var(--gutter) * 2 + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 6;
}

.zoom,
.altitude {
  display: flex;
  align-items: center;
  gap: 6px;
}

#alt-label,
#fov-label {
  min-width: 34px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.compass-widget {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.compass-widget svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.compass-bg {
  fill: var(--panel);
  stroke: var(--panel-border);
}

.compass-ring {
  fill: none;
  stroke: rgba(160, 185, 255, 0.25);
}

.compass-fov {
  fill: rgba(143, 184, 255, 0.14);
  stroke: rgba(143, 184, 255, 0.3);
  stroke-width: 0.6;
}

.compass-widget .tick {
  stroke: rgba(200, 210, 235, 0.35);
  stroke-width: 0.8;
}

.compass-widget .tick.major {
  stroke: rgba(220, 228, 245, 0.7);
  stroke-width: 1.2;
}

.compass-widget .dir {
  cursor: pointer;
}

.compass-widget .dir text {
  fill: var(--text);
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.compass-widget .dir.minor text {
  font-size: 6.5px;
  font-weight: 500;
  fill: var(--text-dim);
}

.compass-widget .dir.north text {
  fill: #ff8a7a;
}

.compass-widget .hit {
  fill: transparent;
}

.compass-widget .dir:hover .hit,
.compass-widget .body:hover .hit {
  fill: rgba(143, 184, 255, 0.2);
}

.compass-widget .body {
  cursor: pointer;
}

.compass-widget .body.sun .disc {
  fill: #ffd27a;
  stroke: #7a4b00;
  stroke-width: 0.8;
}

.compass-widget .body.moon .disc {
  fill: #e8ecf6;
  stroke: #3a4157;
  stroke-width: 0.8;
}

/* (On the Moon, the Earth takes the Moon's place on the rim.) */
.compass-widget .body.moon.earth .disc {
  fill: #6fb4ff;
  stroke: #12305a;
}

.compass-widget .body.below .disc {
  opacity: 0.4;
}

.compass-pointer {
  fill: var(--accent);
}

.compass-heading {
  fill: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.compass-sub {
  fill: var(--text-dim);
  font-size: 7px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

/* ---------- Info panel ---------- */
.info-panel {
  position: fixed;
  top: calc(max(var(--gutter), env(safe-area-inset-top, 0px)) + 52px);
  left: var(--gutter);
  width: 300px;
  max-height: calc(100vh - var(--timebar-h, 120px) - 100px);
  z-index: 8;
}

/* On a big screen, room enough for the longer rows (a moon's next events, its
   distance from its planet) to sit on one line. */
@media (min-width: 1000px) {
  .info-panel {
    width: 380px;
  }
}

.info-panel.collapsed {
  display: none;
}

#info-title {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding-top: 2px;
}

#info-title .info-heading {
  min-width: 0;
}

/* Back to the overview: beside the title, lined up with its first line. */
.info-back {
  flex: none;
  margin: -1px 0 0 -8px;
}

/* And straight to the overview, from a long trail: at the end of the title, by the close button. */
.info-overview {
  flex: none;
  margin: -1px -6px 0 auto;
}

#info-title .kind {
  margin: 0;
}

.info-panel h3 {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 600;
}

.info-panel .kind {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 12px;
}

.info-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin: 8px 0;
  font-size: 13px;
}

.info-panel dt {
  color: var(--text-dim);
}

.info-panel dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.info-panel .section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
}

/* (The header's line is enough above the first one.) */
.info-panel .section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.info-panel .section h4 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.info-panel .note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.info-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.info-head .phase-icon {
  width: 44px;
  height: 44px;
  flex: none;
}

/* Tonight's plan: each thing's name and best time on one line, the rest quieter underneath. */
.plan-head {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 2px;
  font-size: 11px;
  color: var(--text-dim);
}

.plan {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.plan li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  padding: 5px 0;
}

.plan li + li {
  border-top: 1px solid rgba(160, 185, 255, 0.07);
}

.plan-time {
  font-variant-numeric: tabular-nums;
}

.plan-more {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-dim);
}

.info-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.daylight-bar {
  position: relative;
  height: 10px;
  margin: 8px 0 2px;
  border-radius: 5px;
  overflow: hidden;
  background: #0a0f1c;
}

.daylight-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
}

.daylight-bar .now {
  width: 2px;
  background: #fff;
}

/* ---------- Layers panel ---------- */
.layers-panel {
  position: fixed;
  top: calc(max(var(--gutter), env(safe-area-inset-top, 0px)) + 52px);
  right: var(--gutter);
  width: 270px;
  max-height: calc(100vh - 240px);
  z-index: 12;
}

.layers-panel h3 {
  margin: 12px 0 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.layers-panel h3:first-child {
  margin-top: 0;
}

.layers-panel .version {
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
}

.layers-panel .version a {
  color: inherit;
  text-decoration: underline dotted rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
}

.layers-panel .version a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  appearance: none;
  width: 30px;
  height: 18px;
  flex: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cfd6e6;
  transition: transform 0.15s;
}

.toggle input:checked {
  background: var(--accent-2);
}

.toggle input:checked::after {
  transform: translateX(12px);
  background: #fff;
}

.swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  flex: none;
  margin-left: auto;
}

/* ---------- Time bar ---------- */
.timebar {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--gutter) + var(--safe-b));
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  z-index: 10;
  max-width: 1080px;
  margin: 0 auto;
}

.time-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tracks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.track-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.track-label {
  height: 22px;
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.track-wrap {
  position: relative;
  padding-bottom: 14px;
}

.track {
  position: relative;
  height: 22px;
  border-radius: 7px;
  background: #1a2238;
  cursor: pointer;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.track:focus-visible {
  outline: 2px solid var(--accent-2);
}

.track .thumb {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: #fff;
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, 0.6),
    0 0 8px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.track.active .thumb {
  width: 6px;
  margin-left: -3px;
}

/* Each slider lights up what it sets, and the other way round: the time of day
   slider and the clock, the year slider and the date. */
#time-clock,
#time-date,
.track-label,
.track .thumb {
  transition:
    color 0.15s,
    background-color 0.15s;
}

.timebar:has(#day-track:hover, #day-track.active, #day-track:focus-visible) :is(#time-clock, #day-label),
.timebar:has(#year-track:hover, #year-track.active, #year-track:focus-visible) :is(#time-date, #year-label) {
  color: var(--accent);
}

.timebar:has(.clock-row:hover) #day-track .thumb,
.timebar:has(.date-row:hover) #year-track .thumb {
  background: var(--accent);
}

.ticks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 13px;
  pointer-events: none;
}

.ticks span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Solstices, equinoxes and eclipses along the tracks: dots you can hover and click.
   Above the thumb, so they stay clickable. */
.marks {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* On the top edge of the track, so the rest of it is free to click and drag */
.mark {
  position: absolute;
  top: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.55);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.12s;
}

/* A bigger target than the dot for fingers, reaching up and sideways but not into the track */
.mark::before {
  content: "";
  position: absolute;
  inset: -7px -5px 2px;
}

.mark:hover,
.mark:focus-visible {
  transform: scale(1.4);
}

.mark.season.equinox {
  background: #8be08b;
}

.mark.season.summer {
  background: #ffe066;
}

.mark.season.winter {
  background: #7ec8ff;
}

/* A dark Sun in a gold ring, or a copper Moon */
.mark.eclipse {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
}

.mark.eclipse.sun {
  background: #10131c;
  border: 2px solid #ffd27a;
  box-shadow: 0 0 5px rgba(255, 210, 122, 0.8);
}

.mark.eclipse.moon {
  background: radial-gradient(circle at 40% 40%, #d0743f, #7a2e14);
}

/* How long an eclipse lasts, along the time track */
.marks .span {
  position: absolute;
  bottom: 2px;
  height: 4px;
  border-radius: 2px;
}

.span.eclipse.sun {
  background: rgba(16, 19, 28, 0.75);
  box-shadow: 0 0 0 1px rgba(255, 210, 122, 0.7);
}

.span.eclipse.moon {
  background: rgba(208, 116, 63, 0.85);
}

.time-readout {
  display: grid;
  justify-items: stretch;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

/* The time with its time zone beside it, then the date with its season at the
   far end (so the badge doesn't jump about as the date changes width). */
.clock-row,
.date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

.date-row {
  justify-content: space-between;
}

.zone {
  display: grid;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--text-dim);
}

.zone > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

#time-clock {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

#time-date {
  font-size: 16px;
  font-weight: 500;
}

.speed {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.speed .icon-btn {
  width: 32px;
  height: 32px;
}

.speed .play {
  color: var(--accent);
}

#now {
  margin-left: auto;
}

.rate-label {
  min-width: 76px;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- Labels ---------- */
#labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

/* Up above the Earth, pointing your phone at the real sky, the compass and
   looking up no longer make sense (the zoom stays, under the height) */
body:not(.aloft) #orient-btn,
body:not(.aloft) #reset-zoom,
body.aloft #sensor-btn,
body.aloft #look-up,
body.aloft .compass-widget {
  display: none;
}

/* Controls swapping between the ground and space fade in rather than pop */
@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

body.aloft .altitude,
body.aloft #orient-btn,
body.aloft #reset-zoom,
body:not(.aloft) .compass-widget,
body:not(.aloft) #look-up {
  animation: appear 0.5s ease;
}

.rise-btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* Your spot on the Earth, seen from above: a ring, with the place's name beside it */
.label.you {
  color: var(--accent);
  font-weight: 600;
  padding-left: 16px;
}

.label.you::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-sizing: border-box;
}

.label {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-size: 12px;
  color: rgba(230, 236, 250, 0.85);
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.9),
    0 1px 3px rgba(0, 0, 0, 0.6);
  will-change: transform;
}

.label.body {
  font-size: 13px;
  font-weight: 600;
  color: #ffe2a8;
}

.label.body.small {
  font-size: 11px;
  font-weight: 500;
}

.label.sun {
  color: #ffd27a;
}

.label.moon {
  color: #eef2ff;
}

.label.dim {
  opacity: 0.55;
}

.label.star {
  font-size: 11px;
  color: rgba(200, 215, 245, 0.8);
}

/* Clusters, nebulae and galaxies: soft pink, like a faint glow. */
.label.deepsky {
  font-size: 11px;
  font-style: italic;
  color: rgba(244, 191, 208, 0.85);
}

.label.constellation {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(140, 170, 230, 0.75);
}

.label.compass {
  font-size: 15px;
  font-weight: 700;
  color: #ff9c7a;
}

.label.compass.minor {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 170, 140, 0.75);
}

/* Things on the land: mountains in green, towns in lavender, landmarks in cyan. */
.label.feature {
  font-size: 11px;
  font-weight: 500;
}

.label.peak {
  color: #8fe39a;
}

.label.place {
  color: #dcc2ff;
}

.label.place.city {
  font-size: 13px;
  font-weight: 600;
}

.label.place.village {
  font-size: 10px;
}

.label.landmark {
  font-size: 10px;
  color: #86dcff;
}

.label.feature.selected {
  margin-left: -6px;
  padding: 1px 6px;
  border-radius: 9px;
  font-weight: 700;
  background: rgba(10, 18, 30, 0.75);
  box-shadow: 0 0 0 1px currentColor;
  text-shadow: none;
}

.label.hour {
  font-size: 10px;
  color: rgba(255, 200, 120, 0.85);
}

.label.path {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

/* Orbits' names, in the colours of their lines (see ORBIT_COLORS in orbits.js) */
.label.orbit {
  font-size: 10px;
  font-style: italic;
  opacity: 0.9;
}
.label.orbit.moon {
  color: #c9d6ff;
}
.label.orbit.earth {
  color: rgba(111, 211, 255, 0.95);
}
.label.orbit.Mercury {
  color: #c2b8ad;
}
.label.orbit.Venus {
  color: #f2dc9b;
}
.label.orbit.Mars {
  color: #ff8a65;
}
.label.orbit.Jupiter {
  color: #e6b98c;
}
.label.orbit.Saturn {
  color: #d8c070;
}
.label.orbit.Uranus {
  color: #8fe3e6;
}
.label.orbit.Neptune {
  color: #7d96ff;
}

/* The first of each month, along the Earth's orbit */
.label.month {
  font-size: 10px;
  color: rgba(111, 211, 255, 0.85);
}

.label.selected-ring {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 199, 107, 0.5);
}

/* ---------- Location dialog ---------- */
.dialog {
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--text);
  width: min(760px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 2 * var(--gutter));
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.dialog-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
}

.loc-search {
  position: relative;
}

#map {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  border-radius: 10px;
  cursor: crosshair;
  background: #0b2440;
  touch-action: none;
}

#map.panning {
  cursor: grabbing;
}

.map-wrap {
  position: relative;
}

.map-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-zoom .icon-btn {
  background: var(--panel);
  border-color: var(--panel-border);
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.loc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.loc-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
  width: 130px;
}

.loc-row .coords {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.loc-row .coords label {
  width: auto;
}

.coords-field {
  display: flex;
  gap: 6px;
}

.coords-read {
  min-height: 1.3em;
}

#coords-input[aria-invalid] {
  border-color: #e07a6a;
}

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  :root {
    --gutter: 8px;
  }

  .timebar {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 8px 12px;
  }

  .time-main {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 10px;
  }

  #time-clock {
    font-size: 22px;
  }

  /* Full width, so the season badge and Now line up at the right. */
  .time-readout,
  .speed {
    flex: 1 1 100%;
  }

  .search {
    flex: 1 1 auto;
  }

  /* Just the pin, leaving the room to the search box. */
  #location-btn {
    flex: none;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
  }

  #location-btn svg {
    width: 18px;
    height: 18px;
  }

  #location-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .info-panel {
    top: calc(max(var(--gutter), env(safe-area-inset-top, 0px)) + 48px);
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
  }

  .rate-label {
    min-width: 0;
  }

  .layers-panel {
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    max-height: calc(100vh - 290px);
  }

  .compass-widget {
    width: 96px;
    height: 96px;
  }

  .info-panel {
    max-height: min(40vh, calc(100vh - var(--timebar-h, 200px) - 230px));
  }
}

/* Labels over a daylight sky */
.label.lit {
  /* Dark text on a bright sky reads best with a soft light halo, not a shadow. */
  text-shadow:
    0 0 3px rgba(255, 255, 255, 0.6),
    0 0 1px rgba(255, 255, 255, 0.5);
}

.label.lit.constellation {
  color: rgba(25, 45, 105, 0.65);
}

.label.lit.deepsky {
  color: rgba(120, 30, 70, 0.85);
}

.label.lit.star {
  color: rgba(20, 35, 85, 0.8);
}

.label.lit.hour {
  color: rgba(140, 70, 0, 0.9);
}

.label.lit.feature {
  font-weight: 600;
}

.label.lit.peak {
  color: #17632a;
}

.label.lit.place {
  color: #5b2a8c;
}

.label.lit.landmark {
  color: #0b5873;
}

.label.lit.feature.selected {
  background: rgba(255, 255, 255, 0.75);
}

.label.lit.compass {
  color: #b0401c;
}

.label.lit.compass.minor {
  color: rgba(150, 60, 30, 0.85);
}

.label.lit.body {
  color: #7a4a00;
}

.label.lit.moon {
  color: #2f3a5c;
}

.label.lit.path {
  color: rgba(30, 35, 60, 0.7);
}

/* Clickable names in the info panel */
.jump {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline dotted rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
}

.jump:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* A name and the ’s after it, kept on one line */
.nowrap {
  white-space: nowrap;
}

button.info-head {
  width: 100%;
  margin: 0 -6px;
  padding: 4px 6px;
  border-radius: 10px;
  text-decoration: none;
}

button.info-head:hover {
  background: rgba(143, 184, 255, 0.1);
  color: inherit;
}

.look-up[aria-pressed="true"],
.glasses-btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* Through eclipse glasses only the Sun and the Moon in front of it show, so only their names do. */
#labels.glasses .label:not(.sun):not(.moon) {
  display: none;
}

/* Season badge next to the clock */
.season-badge {
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 16px;
  border: 1px solid currentColor;
}

/* Solstice and equinox days stand out */
.season-badge.event {
  background: color-mix(in srgb, currentColor 22%, transparent);
}

.season-badge.spring {
  color: #8be08b;
}

.season-badge.summer {
  color: #ffc76b;
}

.season-badge.autumn {
  color: #ff9c6b;
}

.season-badge.winter {
  color: #8fc8ff;
}

.season-badge.tropical {
  color: #6fe0c8;
}

/* Point your phone at the sky; short messages */
.sensor-btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.toast {
  /* A card across the middle of the screen, a third of the way down: clear of the
     panels, and of whatever you've just arrived at in the middle of the view. */
  position: fixed;
  top: max(30vh, calc(110px + env(safe-area-inset-top, 0px)));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(26rem, calc(100vw - var(--gutter) * 2));
  margin: 0;
  padding: 14px 20px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  /* (Nearly solid: on a phone it can sit over the info panel.) */
  background: color-mix(in srgb, var(--panel-solid) 94%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
  /* (Above the info panel, below the dropdowns.) */
  z-index: 9;
  pointer-events: none;
}

/* South up: the arrow points down */
.orient-btn.south svg {
  transform: rotate(180deg);
}
