:root {
  --bg: #0e1014;
  --panel: #14171d;
  --panel-2: #1a1e26;
  --panel-3: #222732;
  --line: #272c36;
  --ink: #e8e4da;
  --ink-dim: #9aa0ab;
  --ink-faint: #626975;
  --accent: #e6a53d;
  --accent-ink: #0e1014;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100vh; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; }
.mono { font-family: "IBM Plex Mono", monospace; }

/* ---------- Sidebar ---------- */
#sidebar { width: 290px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 16px 18px 16px; border-bottom: 1px solid var(--line); }
.brand-logo { width: 100%; max-width: 156px; height: auto; display: block; }
.brand-text { text-align: center; }
.brand-text h1 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.01em; line-height: 1.12; }
.brand-text p { margin: 7px 0 0; font-family: "IBM Plex Mono", monospace; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-dim); line-height: 1.4; }
.toolbar { padding: 16px 18px 8px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-family: "IBM Plex Mono", monospace; font-size: 9.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
#hours { appearance: none; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px; padding: 9px 12px;
  font-family: "IBM Plex Mono", monospace; font-size: 13px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%),
                    linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px; background-repeat: no-repeat; }
#hours:focus { outline: none; border-color: var(--accent); }
#bands { flex: 1; overflow-y: auto; padding: 6px 12px 14px; }
#bands::-webkit-scrollbar { width: 9px; }
#bands::-webkit-scrollbar-thumb { background: var(--line); }
#bands::-webkit-scrollbar-thumb:hover { background: var(--panel-3); }
.grp { margin-top: 10px; }
.grp-head { width: 100%; display: flex; align-items: center; gap: 9px; background: none;
  border: 0; cursor: pointer; color: var(--ink-dim); padding: 7px 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; border-bottom: 1px solid var(--line); }
.grp-head:hover { color: var(--ink); }
.grp-marker { width: 8px; height: 8px; flex-shrink: 0; }
.grp-title { flex: 1; text-align: left; }
.grp-chev { transition: transform .2s ease; opacity: .55; font-size: 8px; }
.grp.collapsed .grp-chev { transform: rotate(-90deg); }
.grp-body { display: grid; gap: 3px; overflow: hidden; padding-top: 5px;
  max-height: 640px; transition: max-height .28s ease; }
.grp.collapsed .grp-body { max-height: 0; padding-top: 0; }
.band { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  cursor: pointer; background: transparent; border: 1px solid transparent;
  border-left: 3px solid transparent; border-radius: 3px; padding: 8px 10px;
  color: var(--ink-dim); font-family: "Bricolage Grotesque", sans-serif; font-size: 13px;
  transition: background .14s, color .14s, border-color .14s; }
.band:hover { background: var(--panel-2); color: var(--ink); }
.band .code { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; font-weight: 600;
  color: var(--ink-faint); min-width: 30px; text-align: center; padding: 3px 4px;
  border-radius: 2px; background: var(--panel-2); border: 1px solid var(--line); }
.band.active { color: var(--ink); font-weight: 600; background: var(--panel-2);
  border-left-color: var(--accent); }
.band.active .code { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.side-foot { display: flex; align-items: center; gap: 9px; padding: 11px 18px;
  border-top: 1px solid var(--line); font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; color: var(--ink-dim); }
.blip { width: 7px; height: 7px; background: var(--accent); animation: blink 2s steps(1) infinite; }
@keyframes blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: .25; } }

/* ---------- Main / viewer ---------- */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #000; }
#viewer { position: relative; flex: 1; overflow: hidden; background: #05070a; }

#panes { position: absolute; inset: 0; display: flex; }
.pane { position: relative; flex: 1; overflow: hidden; min-width: 0;
  border-left: 1px solid transparent; }
#viewer.compare .pane[data-pane="R"] { border-left: 1px solid var(--line); }
.scene { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.scene img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  user-select: none; -webkit-user-drag: none; }
.scene .ov { pointer-events: none; }
#viewer.no-overlay .ov { display: none; }
#panes { cursor: grab; }
#panes.grabbing { cursor: grabbing; }

.plabel { position: absolute; top: 12px; left: 12px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .03em;
  color: var(--ink); background: rgba(14,16,20,.78); border: 1px solid var(--line);
  border-radius: 2px; padding: 4px 9px; pointer-events: none; display: none; }
#viewer.compare .plabel { display: block; }

.cbar { position: absolute; bottom: 12px; left: 12px; width: 280px; height: auto;
  background: rgba(14,16,20,.82); padding: 5px 6px; border: 1px solid var(--line);
  border-radius: 2px; pointer-events: none; }

.rband { position: absolute; top: 10px; left: 12px; z-index: 3; display: none;
  appearance: none; background: rgba(14,16,20,.88); color: var(--ink);
  border: 1px solid var(--accent); border-radius: 3px; padding: 5px 26px 5px 9px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%),
                    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
  background-size: 5px 5px; background-repeat: no-repeat; }
#viewer.compare .pane[data-pane="R"] .rband { display: block; }

/* viewer control buttons (top-left) — uniform aligned row */
#vctl { position: absolute; top: 22px; left: 14px; z-index: 5; display: flex; align-items: center; gap: 6px; }
.vbtn { height: 28px; display: inline-flex; align-items: center; white-space: nowrap;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-dim); background: rgba(14,16,20,.82); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 10px; cursor: pointer; transition: color .12s, border-color .12s, background .12s; }
.vbtn:hover { color: var(--ink); border-color: var(--panel-3); }
.vbtn.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
#placesPanel { position: absolute; top: 34px; left: 0; z-index: 6; display: flex; flex-direction: column;
  gap: 11px; background: rgba(14,16,20,.97); border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-dim);
  min-width: 216px; max-height: 76vh; overflow-y: auto; }
#placesPanel[hidden] { display: none; }
#placesPanel input { accent-color: var(--accent); cursor: pointer; }
.pcat { border-bottom: 1px solid var(--line); padding-bottom: 11px; }
.pcat:last-child { border-bottom: 0; padding-bottom: 0; }
.pcat-head { display: flex; align-items: center; gap: 8px; }
.pcat-label { flex: 1; cursor: pointer; color: var(--ink); letter-spacing: .04em; }
.pcat-count { color: var(--ink-faint); font-size: 10px; }
.pcat-exp { background: none; border: 0; color: var(--ink-faint); cursor: pointer; font-size: 9px;
  padding: 2px 4px; transition: transform .15s; }
.pcat-exp.open { transform: rotate(180deg); }
.pcat-list { display: flex; flex-direction: column; gap: 6px; margin: 9px 0 1px 21px;
  max-height: 188px; overflow-y: auto; }
.pcat-list label { display: flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
/* nudge the left plabel down so it clears the control row */
.pane[data-pane="L"] .plabel { top: 58px; }

/* toggleable place labels (cities/towns/lakes) */
.places { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.place { position: absolute; transform: translateY(-50%); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.place .pdot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,.7); }
.place .plbl { font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .01em;
  background: rgba(8,10,14,.62); padding: 1px 5px; border-radius: 3px; text-shadow: 0 1px 2px #000; }
.place.major .pdot { width: 6px; height: 6px; background: #fff; }
.place.major .plbl { color: #fff; font-weight: 600; }
.place.community .pdot { background: #5ad6b0; }
.place.community .plbl { color: #b7f0de; }
.place.lake .pdot { background: #38c6ec; }
.place.lake .plbl { color: #8fe3ff; font-style: italic; }

#clockbar { position: absolute; top: 22px; right: 16px; z-index: 4;
  display: flex; align-items: center; gap: 6px; }
#tz { height: 28px; font-family: "IBM Plex Mono", monospace; font-size: 10px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim);
  background: rgba(14,16,20,.82); border: 1px solid var(--line); border-radius: 3px;
  padding: 0 6px; cursor: pointer; transition: color .12s, border-color .12s; }
#tz:hover { color: var(--ink); border-color: var(--panel-3); }
#stamp { height: 28px; display: inline-flex; align-items: center;
  font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: .02em;
  color: var(--ink); background: rgba(14,16,20,.82); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 11px; }
#nextpull { position: absolute; bottom: 14px; right: 16px; z-index: 4;
  display: flex; align-items: center; gap: 8px; font-family: "IBM Plex Mono", monospace;
  font-size: 11px; letter-spacing: .08em; color: var(--ink-dim);
  background: rgba(14,16,20,.82); border: 1px solid var(--line); border-radius: 2px; padding: 5px 10px; }
#nextpull::before { content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: blink 2s steps(1) infinite; }
#latlon { position: fixed; z-index: 9; display: none; pointer-events: none;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent);
  background: rgba(14,16,20,.9); border: 1px solid var(--line); border-radius: 2px; padding: 3px 7px; }

/* ---------- Controls / transport ---------- */
#controls { display: flex; align-items: center; gap: 14px; padding: 11px 16px;
  background: var(--panel); border-top: 1px solid var(--line); }
.transport { display: flex; align-items: center; gap: 6px; }
#prev, #next { width: 30px; height: 30px; border-radius: 3px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim);
  font-size: 9px; display: grid; place-items: center; transition: color .12s, border-color .12s; }
#prev:hover, #next:hover { color: var(--ink); border-color: var(--panel-3); }
#prev { transform: scaleX(-1); }
#play { width: 36px; height: 36px; border-radius: 3px; cursor: pointer;
  background: var(--accent); border: 1px solid var(--accent); color: var(--accent-ink);
  font-size: 12px; display: grid; place-items: center; transition: filter .12s; }
#play:hover { filter: brightness(1.08); }
#timeline { flex: 1; height: 30px; display: flex; gap: 2px; align-items: stretch;
  cursor: pointer; touch-action: none; user-select: none; }
.cell { flex: 1; min-width: 2px; background: var(--panel-2);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cell.fill { background: var(--panel-3); }
.cell.on { background: var(--accent); border-color: var(--accent); }
.cell:first-child { border-left: 1px solid var(--line); }
.cell:last-child { border-right: 1px solid var(--line); }
#frameno { font-size: 11px; color: var(--ink-dim); min-width: 48px; text-align: right; letter-spacing: .02em; }
.speed { display: flex; align-items: center; gap: 9px; }
.speed span { font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: .14em; color: var(--ink-faint); }
.speed input { width: 84px; -webkit-appearance: none; appearance: none; height: 4px;
  background: var(--line); border-radius: 0; cursor: pointer; }
.speed input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 16px;
  border-radius: 2px; background: var(--ink-dim); border: none; }
.speed input::-webkit-slider-thumb:hover { background: var(--ink); }

/* ---------- Mobile / narrow (image-first stacked layout) ---------- */
@media (max-width: 760px) {
  html, body { height: 100vh; height: 100dvh; -webkit-text-size-adjust: 100%; }
  body { flex-direction: column; }

  /* the satellite loop is the hero: viewer on top, band picker below */
  main { order: 1; flex: 0 0 auto; }
  #viewer { flex: none; height: 50dvh; min-height: 240px; }
  #sidebar { order: 2; width: 100%; flex: 1 1 auto; min-height: 0;
    border-right: 0; border-top: 1px solid var(--line); }

  /* slim brand bar (logo beside title instead of stacked) */
  .brand { flex-direction: row; align-items: center; gap: 11px; padding: 10px 14px; }
  .brand-logo { width: 38px; }
  .brand-text { text-align: left; }
  .brand-text h1 { font-size: 14px; }
  .brand-text p { margin-top: 2px; font-size: 10px; }
  .toolbar { padding: 10px 14px 4px; }

  /* compact overlay controls; drop desktop-only affordances */
  #vctl { top: 10px; left: 10px; gap: 5px; flex-wrap: wrap; max-width: 58%; }
  #clockbar { top: 10px; right: 10px; gap: 5px; }
  .vbtn, #tz { height: 26px; font-size: 10px; padding: 0 8px; }
  #stamp { height: 26px; font-size: 11px; padding: 0 8px; }
  #compareToggle, #zoomReset, #gifBtn { display: none; }   /* no pinch-zoom / side-by-side / GIF on phones */
  #nextpull { bottom: 10px; right: 10px; font-size: 10px; padding: 4px 8px; }
  .cbar { width: 150px; bottom: 10px; left: 10px; }

  /* transport: keep scrubber + play; speed uses the (now halved) default */
  #controls { gap: 10px; padding: 9px 12px; }
  .speed { display: none; }
  #frameno { min-width: 42px; }
}

/* respect users who ask for less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
