:root {
  --bg: rgba(10, 16, 26, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --text: #e8edf5;
  --dim: #94a1b5;
  --accent: #39e6c4;
  --radius: 10px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #05080d;
  overflow: hidden;
}

#globe {
  position: fixed;
  inset: 0;
}

#globe canvas {
  display: block;
  cursor: grab;
}

.tooltip {
  position: absolute;
  z-index: 2;
  max-width: 260px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 12.5px;
  pointer-events: none;
}

#nav {
  position: fixed;
  right: 14px;
  bottom: 22px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Step aside when the detail panel is open. */
#right:not([hidden]) ~ #nav {
  right: 408px;
}

#nav button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: var(--bg);
  backdrop-filter: blur(10px);
  font-weight: 600;
  font-size: 15px;
}

#nav button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #04221c;
}

#nav button.turned {
  border-color: #ff5a4f;
  box-shadow: 0 0 0 1px #ff5a4f;
}

#needle {
  display: inline-block;
  color: #ff5a4f;
}

input[type='range'] {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

#credits {
  position: fixed;
  left: 318px;
  bottom: 4px;
  z-index: 2;
  font-size: 10px;
  color: var(--dim);
  opacity: 0.8;
  pointer-events: none;
}

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

button {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
}

button:hover {
  background: rgba(255, 255, 255, 0.14);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04221c;
  font-weight: 600;
}

select,
input[type='date'] {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
  color-scheme: dark;
}

a {
  color: var(--accent);
}

/* ---------- top bar ---------- */

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: linear-gradient(rgba(5, 8, 13, 0.9), rgba(5, 8, 13, 0));
  z-index: 5;
  pointer-events: none;
}

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

/* The title is the way back to the opening card. */
a.brand {
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
}

a.brand:hover h1 {
  color: var(--accent);
}

#welcome .actions.last {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 0;
}

#welcome-back {
  flex: 1 1 110px;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.3;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.02em;
}

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

#status {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 11.5px;
  white-space: nowrap;
}

.pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
}

.pill.ok i {
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.pill.err i {
  background: #ff5a4f;
}

#clock {
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- side panels ---------- */

#left,
#right {
  position: fixed;
  top: 64px;
  bottom: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  z-index: 4;
  overflow-y: auto;
  scrollbar-width: thin;
}

#left {
  left: 14px;
  width: 290px;
  display: flex;
  flex-direction: column;
}

/* The menu slides away rather than vanishing, and what sat beside it
   moves into the room it leaves. */
#left {
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0s;
}

#left.closed {
  transform: translateX(calc(-100% - 20px));
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0s 0.25s;
}

#ticker,
#credits,
#legend {
  transition: left 0.25s ease;
}

#left.closed ~ #ticker,
#left.closed ~ #credits {
  left: 14px;
}

@media (prefers-reduced-motion: reduce) {
  #left,
  #left.closed,
  #ticker,
  #credits,
  #legend {
    transition: none;
  }
}

#right {
  right: 14px;
  width: 380px;
  padding: 16px;
}

#left details {
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--line);
}

#left details:not([open]) {
  padding-bottom: 10px;
}

summary {
  cursor: pointer;
  list-style: none;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '▾';
  margin-left: auto;
  transition: transform 0.15s;
}

details:not([open]) > summary::after {
  transform: rotate(-90deg);
}

details[open] > summary {
  margin-bottom: 8px;
}

.mini {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

.mini button {
  padding: 2px 8px;
  font-size: 12px;
}

.legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

.legend li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.legend i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c);
  transform: translateY(1px);
}

h2 {
  margin: 0 0 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
  font-weight: 600;
}

.count {
  color: var(--text);
  letter-spacing: 0;
}

.hint {
  overflow-wrap: anywhere;
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.4;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.row select {
  min-width: 0;
  max-width: 64%;
}

.row.date {
  justify-content: flex-start;
}

.row.date input {
  flex: 1;
  min-width: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  cursor: pointer;
}

#chips,
#place-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 99px;
  padding: 3px 10px 3px 8px;
  font-size: 12.5px;
}

.chip i,
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
}

.chip.off {
  opacity: 0.4;
}

/* Changing places are diamonds, on the globe and in the panels. */
.diamond {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 1px;
  background: var(--c);
  transform: rotate(45deg);
  flex: none;
}

#place-chips .chip i {
  border-radius: 1px;
  transform: rotate(45deg);
  width: 8px;
  height: 8px;
}

/* ---------- detail panel ---------- */

#close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  background: none;
  font-size: 15px;
}

#detail h3 {
  margin: 6px 28px 10px 0;
  font-size: 18px;
  line-height: 1.25;
}

#detail h4 {
  margin: 18px 0 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--dim);
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
}

dt {
  color: var(--dim);
}

dd {
  margin: 0;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.card .src {
  font-weight: 600;
}

.card p {
  margin: 3px 0;
  color: var(--dim);
  line-height: 1.4;
}

.note {
  color: var(--dim);
  line-height: 1.5;
  margin: 0;
}

.links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.links li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
}

.links li:hover {
  background: rgba(255, 255, 255, 0.07);
}

.links .km {
  margin-left: auto;
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
}

.scene {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  align-items: start;
}

.scene img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
}

.scene .when {
  font-weight: 600;
}

.scene .rel.before {
  color: #8fb8ff;
}

.scene .rel.after {
  color: #ffc98a;
}

.scene .meta {
  color: var(--dim);
  font-size: 12px;
  margin: 2px 0 6px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12.5px;
}

.pair {
  border-color: rgba(57, 230, 196, 0.5);
}

.spinner {
  color: var(--dim);
}

/* ---------- before/after slider ---------- */

#split {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

#split-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1px;
  background: #fff;
  pointer-events: auto;
  cursor: ew-resize;
  touch-action: none;
}

#split-handle::after {
  content: '⇔';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #05080d;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 16px;
}

#split-handle span {
  position: absolute;
  top: 72px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
}

/* The dates sit under the reports bar while it is showing. */
body:has(#ticker:not([hidden])) #split-handle span {
  top: 106px;
}

#split-before {
  right: 12px;
}

#split-after {
  left: 12px;
}

[hidden] {
  display: none !important;
}

/* ---------- native controls on a dark page ---------- */

/* Everything the browser draws itself (dropdown lists, tick boxes, the
   date picker, the search field's own parts, scrollbars) follows the dark
   theme, so light text never lands on a white native background. */
:root {
  color-scheme: dark;
}

/* A dropdown's list takes the dropdown's background: it must be solid. */
select {
  background-color: #141b27;
}

option,
optgroup {
  background-color: #0f1622;
  color: var(--text);
}

::placeholder {
  color: var(--dim);
  opacity: 1;
}

input[type='checkbox'] {
  accent-color: var(--accent);
}

* {
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

button:disabled {
  color: var(--dim);
  cursor: default;
}

/* Labels on the globe and the credits stay readable over bright ground. */
.glabels span {
  background: rgba(10, 16, 26, 0.9);
}

#credits {
  text-shadow: 0 0 3px #000, 0 0 2px #000;
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .brand p,
  #clock {
    display: none;
  }

  .brand h1 {
    font-size: 15px;
    white-space: nowrap;
  }

  /* Status shrinks to its four lights. */
  .pill {
    font-size: 0;
    gap: 0;
    padding: 5px;
  }

  #credits {
    left: 10px;
    right: 10px;
  }

  #right:not([hidden]) ~ #nav {
    display: none;
  }

  #left {
    width: auto;
    right: 14px;
    max-width: 320px;
  }

  #right {
    left: 8px;
    right: 8px;
    width: auto;
    top: auto;
    bottom: 8px;
    max-height: 56vh;
  }
}

/* ---------- search ---------- */

#search {
  position: relative;
  flex: 0 1 340px;
  margin-left: 14px;
}

#search-box {
  width: 100%;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--bg);
  backdrop-filter: blur(10px);
  outline: none;
}

#search-box:focus {
  border-color: var(--accent);
}

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(10, 16, 26, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
}

#search-results h5 {
  margin: 6px 8px 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
}

#search-results .hit {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

#search-results .hit.on,
#search-results .hit:hover {
  background: rgba(255, 255, 255, 0.09);
}

#search-results .hit small {
  margin-left: auto;
  color: var(--dim);
  white-space: nowrap;
}

#search-results p {
  margin: 8px;
  color: var(--dim);
}

/* ---------- replay ---------- */

#replay {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 3;
  width: min(520px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

#replay-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  flex: none;
}

.replay-body {
  flex: 1;
  min-width: 0;
}

#replay-caption {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 7px;
}

#replay-bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  touch-action: none;
}

/* The event timeline: a taller line to drag, with the event's own stretch,
   NISAR's passes as ticks and a handle. */
#replay.timeline {
  width: min(680px, calc(100vw - 32px));
}

#replay.timeline #replay-bar {
  height: 8px;
  margin: 8px 0 5px;
  cursor: ew-resize;
}

#replay.timeline #replay-fill {
  background: rgba(255, 255, 255, 0.16);
}

#replay-span,
#replay-knob,
#replay-marks,
#replay-live {
  display: none;
}

#replay.timeline #replay-span {
  display: block;
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.55);
}

#replay.timeline #replay-fill {
  position: absolute;
  top: 0;
  left: 0;
}

#replay.timeline #replay-marks {
  display: block;
  position: absolute;
  inset: 0;
}

#replay-marks i {
  position: absolute;
  top: -5px;
  width: 2px;
  height: 18px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--accent);
}

#replay.timeline #replay-knob {
  display: block;
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10, 16, 26, 0.7);
}

#replay.timeline #replay-live {
  display: block;
  flex: none;
  font-size: 12px;
  padding: 4px 9px;
  white-space: nowrap;
}

#replay-live.on {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5);
  cursor: default;
}

#replay-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent);
}

.parts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.parts li {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  padding: 4px 0;
  line-height: 1.4;
}

.parts small {
  color: var(--dim);
}

.badge {
  align-self: start;
  text-align: center;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 0;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--dim);
}

.badge.observed {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5);
}

.badge.analysis {
  color: #8fb8ff;
  border-color: rgba(143, 184, 255, 0.5);
}

.badge.computed {
  color: #ffc98a;
  border-color: rgba(255, 201, 138, 0.5);
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c);
  margin-right: 6px;
}

/* ---------- first-visit hint ---------- */

#welcome {
  position: fixed;
  left: 50%;
  top: 108px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  background: var(--bg);
  border: 1px solid rgba(57, 230, 196, 0.5);
  border-radius: 99px;
  backdrop-filter: blur(10px);
  font-size: 13px;
  max-width: calc(100vw - 32px);
}

#welcome button {
  border: 0;
  background: none;
  padding: 2px 6px;
}

@media (max-width: 760px) {
  #search {
    flex: 1;
    margin-left: 6px;
  }

  #status {
    display: none;
  }

  #welcome {
    border-radius: var(--radius);
  }
}

/* A short message that goes away by itself (a link that leads nowhere). */
#notice {
  position: fixed;
  left: 50%;
  top: 110px;
  transform: translateX(-50%);
  z-index: 7;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  background: var(--bg-solid, #0a101a);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  font-size: 13.5px;
  line-height: 1.45;
  cursor: pointer;
}

#notice[hidden] {
  display: none;
}

/* ---------- time-lapse and its chart ---------- */

#here {
  position: fixed;
  z-index: 3;
  transform: translate(-50%, -135%);
  display: flex;
  border-radius: 99px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

#here[hidden] {
  display: none;
}

#here button {
  background: var(--accent);
  border: 0;
  border-radius: 0;
  color: #04221c;
  font-weight: 600;
  padding: 6px 12px;
  white-space: nowrap;
}

#here #here-x {
  padding: 6px 11px 6px 9px;
  border-left: 1px solid rgba(4, 34, 28, 0.25);
}

#lapse {
  margin-bottom: 10px;
}

.seg {
  gap: 0;
  margin: 8px 0;
}

.seg button {
  border-radius: 0;
  margin-left: -1px;
}

.seg button:first-child {
  border-radius: 6px 0 0 6px;
  margin-left: 0;
}

.seg button:last-child {
  border-radius: 0 6px 6px 0;
}

.seg button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #04221c;
  font-weight: 600;
}

.chart {
  position: relative;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart .grid {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--dim);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart .end {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.chart .active {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1;
}

.chart .cross {
  stroke: var(--accent);
  stroke-width: 1;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 4px;
}

.chart-legend i,
.chart-tip i {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 1px;
  margin-right: 6px;
  vertical-align: middle;
}

.chart-tip {
  position: absolute;
  top: 26px;
  pointer-events: none;
  background: rgba(10, 16, 26, 0.96);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.chart-tip .when {
  color: var(--dim);
  margin-bottom: 2px;
}

.chart-tip b {
  display: inline-block;
  min-width: 26px;
  font-variant-numeric: tabular-nums;
}

.chart-tip span {
  color: var(--dim);
  margin-left: 4px;
}

.chart-table summary {
  font-size: 11px;
  margin-top: 4px;
}

.chart-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart-table th,
.chart-table td {
  text-align: left;
  padding: 2px 6px 2px 0;
  border-bottom: 1px solid var(--line);
}

.chart-table th {
  color: var(--dim);
  font-weight: 500;
}

/* ---------- alerts ticker ---------- */

#ticker {
  position: fixed;
  top: 62px;
  left: 318px;
  right: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

#right:not([hidden]) ~ #ticker {
  right: 408px;
}

#ticker .badge {
  padding: 2px 8px;
  white-space: nowrap;
}

#ticker-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: none;
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ticker-text:not(:disabled):hover {
  color: var(--accent);
}

#ticker-count,
#ticker-feeds {
  color: var(--dim);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#ticker button:not(#ticker-text) {
  padding: 2px 8px;
}

.countdown {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.card .badge {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  font-weight: 500;
}

@media (max-width: 760px) {
  #ticker {
    left: 8px;
    right: 8px;
  }

  #ticker-feeds,
  #ticker-count {
    display: none;
  }
}

ul.plain {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.note + .note {
  margin-top: 8px;
}

/* ---------- stories ---------- */

#stories {
  display: grid;
  gap: 5px;
}

#stories button {
  text-align: left;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: baseline;
  line-height: 1.3;
}

#stories small {
  color: var(--accent);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.story {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.story h4 .badge {
  display: inline-block;
  padding: 0 6px;
  margin-left: 4px;
  letter-spacing: 0.03em;
}

#story-next {
  margin-top: 10px;
  width: 100%;
  text-align: left;
}

.facts {
  margin-top: 8px;
}

.facts li {
  grid-template-columns: 74px 1fr;
}

/* ---------- share, layer groups ---------- */

#share {
  position: absolute;
  top: 9px;
  right: 40px;
  padding: 2px 9px;
  font-size: 12px;
}

#overlays h5 {
  margin: 8px 0 2px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  font-weight: 600;
}

.article b {
  font-weight: 500;
  display: block;
}

.article small {
  color: var(--dim);
}

/* Calibrated measurements from tools/measure.py */
.measured {
  border-color: rgba(57, 230, 196, 0.45);
}

.measured-svg {
  width: 100%;
  height: auto;
  display: block;
  margin: 6px 0;
  background: #0a101a;
  border-radius: 6px;
}

.measured-svg .grid {
  stroke: rgba(255, 255, 255, 0.08);
}

.measured-svg .mark {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-dasharray: 3 3;
}

.measured-svg .tick {
  fill: var(--dim);
  font-size: 10px;
}

.measured-svg .end {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
}

/* Live sky and wildlife */
#species-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

#wildlife-month {
  font-weight: 600;
  margin-left: auto;
}

/* Data labels pinned to the globe */
.glabels {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.glabels span {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(10, 16, 26, 0.72);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  color: var(--c);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.35s;
  will-change: transform;
}

/* ---------- event card, plain-text account, folded sections ---------- */

#card {
  position: fixed;
  top: 108px;
  right: 14px;
  width: 340px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  z-index: 4;
}

#card h3 {
  margin: 4px 26px 2px 0;
  font-size: 16.5px;
  line-height: 1.25;
}

#card h4 {
  margin: 12px 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
}

#card .when {
  margin: 0;
  color: var(--dim);
  font-size: 12.5px;
}

#card-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: none;
  font-size: 14px;
}

.nisar-line {
  margin: 12px 0 10px;
  padding: 7px 10px;
  border-left: 3px solid var(--accent);
  background: rgba(57, 230, 196, 0.08);
  border-radius: 0 6px 6px 0;
  line-height: 1.4;
}

/* The calibrated value, when there is one, sits right under it. */
.nisar-line + .measured-line {
  margin-top: -4px;
  border-left-color: #f2c14e;
  background: rgba(242, 193, 78, 0.08);
}

.prose p {
  margin: 0 0 10px;
  line-height: 1.55;
}

.src {
  color: var(--accent);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

#tip {
  position: fixed;
  z-index: 6;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 300px;
  padding: 8px 10px;
  background: rgba(10, 16, 26, 0.97);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  pointer-events: none;
}

#tip img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #000;
  border-radius: 5px;
  flex: none;
}

#timeline svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 4px;
}

#timeline .row,
#timeline .tick {
  fill: var(--dim);
  font-size: 10.5px;
}

#timeline .rail {
  stroke: rgba(255, 255, 255, 0.1);
}

#timeline .today {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-dasharray: 2 3;
}

#timeline .pass {
  stroke: var(--accent);
  stroke-width: 2;
}

#timeline .pass.next {
  stroke-dasharray: 3 2;
  opacity: 0.7;
}

.fold {
  border-top: 1px solid var(--line);
  padding: 10px 0 2px;
  margin-top: 10px;
}

.fold > summary {
  font-size: 12px;
}

.fold.inner {
  border-top: 0;
  margin-top: 4px;
}

#right:not([hidden]) ~ #card {
  display: none;
}

@media (max-width: 760px) {
  #card {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 52vh;
  }
}

/* The zoom buttons step aside for the card. */
#card:not([hidden]) ~ #nav {
  right: 368px;
}

@media (max-width: 760px) {
  #card:not([hidden]) ~ #nav {
    display: none;
  }
}

/* ---------- the key to the picture on the globe ---------- */

#legend {
  position: fixed;
  left: 318px;
  /* From the top down: folded, its title stays where it was. */
  top: 108px;
  max-height: calc(100vh - 108px - 124px);
  overflow-y: auto;
  width: 262px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  z-index: 3;
  font-size: 12.5px;
  line-height: 1.4;
}

#legend p {
  margin: 3px 0 6px;
  color: var(--dim);
}

#legend ul {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}

#legend li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 1px 0;
}

#legend li i {
  flex: none;
  width: 22px;
  height: 10px;
  border-radius: 2px;
  background: var(--c);
  transform: translateY(1px);
}

#legend small {
  color: var(--dim);
}

/* NASA's own legend for a map layer, shown while the layer is on. Its
   pictures are drawn for a light page, so they sit on a light card. */
.layer-day {
  display: block;
  margin: 2px 0 6px 26px;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.35;
}

.layer-day[hidden] {
  display: none;
}

#overlays .fills {
  color: var(--dim);
  font-size: 11px;
  margin-left: 2px;
}

.layer-key {
  margin: 2px 0 8px 22px;
}

.layer-key img {
  display: block;
  max-width: 100%;
  padding: 4px 6px;
  background: #f4f6fa;
  border-radius: 6px;
}

.layer-key small {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  line-height: 1.35;
}

/* The key to the event dots, in the menu. */
#event-key i {
  flex: none;
  width: 22px;
  height: 12px;
  background: none;
  position: relative;
}

#event-key i::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  transform: translate(-50%, -50%);
}

#event-key i.big::before {
  width: 12px;
  height: 12px;
}

#event-key i.ring::before {
  box-shadow: 0 0 0 2px var(--bg-solid, #0a101a), 0 0 0 3.5px #fff;
}

#event-key i.ring.nisar::before {
  box-shadow: 0 0 0 2px var(--bg-solid, #0a101a), 0 0 0 3.5px var(--accent);
}

#event-key i.ring.pulse::before {
  box-shadow: 0 0 0 4px rgba(148, 161, 181, 0.35), 0 0 0 5px var(--dim);
}

#event-key i.ring.pulse.soft::before {
  box-shadow: 0 0 0 4px rgba(148, 161, 181, 0.12), 0 0 0 5px rgba(148, 161, 181, 0.45);
}

#event-key i.line::before {
  width: 22px;
  height: 2px;
  border-radius: 0;
  box-shadow: none;
}

#event-key i.line::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  transform: translate(-50%, -50%);
}

/* Marks of the open event: a dot, a glowing spot, a line, an outline. */
#legend li i.dot,
#legend li i.glow {
  width: 10px;
  height: 10px;
  margin: 0 6px;
  border-radius: 50%;
}

#legend li i.glow {
  box-shadow: 0 0 7px 2px var(--c);
}

#legend li i.line,
#legend li i.bands,
#legend li i.dash {
  height: 3px;
  transform: translateY(-3px);
}

#legend li i.dash {
  background: repeating-linear-gradient(90deg, var(--c) 0 6px, transparent 6px 10px);
}

#legend li i.outline {
  background: transparent;
  border: 2px solid var(--c);
}

#legend .also {
  display: block;
  margin: 8px 0 3px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}



#left.closed ~ #legend {
  left: 14px;
}

/* The key under the event timeline. */
#replay-key {
  display: none;
}

#replay.timeline #replay-key {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--dim);
  font-size: 11px;
  white-space: nowrap;
}

#replay-key i {
  display: inline-block;
  vertical-align: middle;
  margin: 0 4px 0 8px;
}

.key-event {
  width: 16px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.55);
}

.key-pass {
  width: 2px;
  height: 12px;
  background: var(--accent);
}

@media (max-width: 760px) {
  #legend {
    left: 8px;
    right: 8px;
    bottom: auto;
    top: 104px;
    width: auto;
  }

  #replay-key span:nth-child(2) {
    display: none;
  }
}

/* The zoom buttons sit above the bar at the bottom when it is showing. */
body:has(#replay:not([hidden])) #nav {
  bottom: 124px;
}

/* ---------- the opening card ---------- */

#welcome {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: min(480px, calc(100vw - 32px));
  max-width: none;
  padding: 12px 22px 10px;
  border-radius: var(--radius);
  border-color: rgba(57, 230, 196, 0.45);
  background: rgba(10, 16, 26, 0.9);
  z-index: 6;
  font-size: 14.5px;
  line-height: 1.5;
}

#welcome h2 {
  margin: 0 0 8px;
  font-size: 21px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  font-weight: 700;
}

#welcome p {
  margin: 0 0 10px;
  color: var(--text);
}

/* The live way in: the strongest recent event NISAR has since seen. */
#spotlight {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid rgba(57, 230, 196, 0.45);
  border-left-width: 3px;
  border-radius: 8px;
  background: rgba(57, 230, 196, 0.07);
  line-height: 1.4;
}

#spotlight[hidden],
#proof[hidden] {
  display: none;
}

/* The lead cases: measured, so they come before the live way in. */
#proof {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  line-height: 1.4;
}

#proof .actions {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#proof .actions button {
  margin: 0;
}

#proof small,
#spotlight small {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10.5px;
  font-weight: 600;
}

/* The menu button says what it is, and is marked while the opening card
   points at it. */
#menu span {
  margin-left: 4px;
  font-size: 13px;
}

body:has(#welcome:not([hidden])) #menu {
  box-shadow: 0 0 0 2px var(--accent);
}

@media (max-width: 760px) {
  #menu span {
    display: none;
  }
}

#spotlight-title .dot {
  margin-right: 7px;
}

#spotlight button {
  justify-self: start;
  margin-top: 6px;
}

#welcome .actions {
  font-size: 14px;
  margin-bottom: 8px;
}

#welcome button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  padding: 7px 14px;
}

#welcome button.primary {
  background: var(--accent);
  border-color: var(--accent);
}

#welcome .hint {
  margin: 0;
  color: var(--dim);
}

.prose .badge {
  display: inline-block;
  padding: 0 6px;
  margin-right: 2px;
}

#welcome ol {
  margin: 0 0 10px;
  padding-left: 20px;
  color: var(--text);
}

#welcome li {
  padding: 2px 0;
}

/* On a wide screen the opening card stands beside the globe, not on it:
   the turning globe with its radar strips and live events is the first
   thing seen. It starts below the reports bar and scrolls if the window is
   short. */
@media (min-width: 1100px) {
  #welcome {
    left: 24px;
    top: 108px;
    transform: none;
    width: min(440px, 36vw);
    max-height: calc(100vh - 108px - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

/* A short window: the same card, set a little tighter. */
@media (min-width: 1100px) and (max-height: 820px) {
  #welcome {
    padding: 16px 20px 12px;
    font-size: 13.5px;
    line-height: 1.42;
  }

  #welcome h2 {
    font-size: 19px;
    margin-bottom: 6px;
  }

  #welcome ol {
    margin: 8px 0 6px;
  }
}

/* ---------- after the review: room for the bar, phones, the key ---------- */

/* The bar stays clear of the details panel. */
#right:not([hidden]) ~ #replay {
  left: calc((100vw - 408px) / 2);
  width: min(680px, calc(100vw - 440px));
}

/* With the menu open as well, it sits in the room between the two. */
@media (min-width: 1160px) {
  #left:not(.closed) ~ #right:not([hidden]) ~ #replay {
    left: calc(318px + (100vw - 318px - 424px) / 2);
    width: min(680px, calc(100vw - 318px - 440px));
  }
}

/* The passes of a place, opened inside an event, offer the way back to
   the event's own timeline. */
#replay-back {
  display: none;
}

#replay.back #replay-back {
  display: block;
  flex: none;
  font-size: 12px;
  padding: 4px 9px;
  white-space: nowrap;
}

#replay-key-event[hidden] {
  display: none;
}

#legend summary {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
  color: var(--text);
}

#legend details[open] > summary {
  margin-bottom: 4px;
}

li[role='button']:focus-visible,
button:focus-visible,
#replay-bar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  /* The card and the panel sit above the bar instead of on top of it. */
  body:has(#replay:not([hidden])) #card,
  body:has(#replay:not([hidden])) #right {
    bottom: 116px;
  }

  #right {
    max-height: 45vh;
  }

  #card {
    max-height: 46vh;
  }

  #right:not([hidden]) ~ #replay {
    left: 50%;
    width: calc(100vw - 16px);
  }

  #replay,
  #replay.timeline {
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  /* The reports bar would be squeezed to nothing beside a panel. */
  #right:not([hidden]) ~ #ticker,
  #card:not([hidden]) ~ #ticker {
    display: none;
  }

  #credits {
    display: none;
  }
}

/* The prediction check: small tables of computed numbers. */
.forecast-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.forecast-table caption {
  text-align: left;
  color: var(--dim);
  font-size: 11.5px;
  padding-bottom: 4px;
}
.forecast-table th,
.forecast-table td {
  padding: 3px 6px 3px 0;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.forecast-table th[scope='row'],
.forecast-table th:first-child {
  text-align: left;
  font-weight: 500;
  white-space: normal;
}
.forecast-table th[scope='col'] {
  color: var(--dim);
  font-weight: 500;
}
.forecast-table tr.best th,
.forecast-table tr.best td {
  color: #fff;
  font-weight: 600;
}

/* The pass table has to fit the panel: dates left, tags under them. */
.forecast-table.passes td:first-child {
  text-align: left;
  white-space: normal;
}
.forecast-table.passes th[scope='col'] {
  white-space: normal;
  vertical-align: bottom;
}
.forecast-table.passes .tag {
  display: block;
  width: fit-content;
  margin: 2px 0 0;
}

/* A wide table scrolls inside its card and never runs out of it. */
.card.forecast {
  overflow-x: auto;
}

.forecast-table tr[data-pass] {
  cursor: pointer;
}
.forecast-table tr[data-pass]:hover td,
.forecast-table tr[data-pass].on td {
  background: rgba(57, 230, 196, 0.1);
}
.kinds {
  margin: 2px 0 8px;
  font-size: 12px;
  color: var(--dim);
}
.kinds b {
  color: var(--text);
  display: inline-block;
  min-width: 44px;
}

.forecast-table .tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 4px;
  white-space: nowrap;
}

/* Animal figurines in the species buttons, lists and the sighting card. */
img.figure {
  width: 22px;
  height: 22px;
  flex: none;
  vertical-align: -6px;
  margin: -4px 2px -4px -2px;
}
img.figure.big {
  width: 44px;
  height: 44px;
  vertical-align: -12px;
  margin: -10px 6px -6px -4px;
}
.chip.off img.figure {
  filter: grayscale(1);
  opacity: 0.5;
}
