/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Screen-reader-only utility ─────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

body {
  background: #000;
  overflow: hidden;
  height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #ccc;
  -webkit-tap-highlight-color: transparent;
}

/* ── Canvas ─────────────────────────────────────────────────────────────────── */
#canvas {
  display: block;
  width: 100%;
  height: 100dvh;
  touch-action: none;
}

/* "Loading the stars…" over the map until the catalogue arrives */
#sky-loading {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(8,12,28,0.85);
  border: 0.5px solid rgba(100,160,255,0.25);
  color: #bcd;
  font-size: 13px;
  pointer-events: none;
  z-index: 5;
  animation: sky-loading-pulse 1.6s ease-in-out infinite;
}
#sky-loading[hidden] { display: none; }
#sky-loading.sky-loading-error { color: #fbb; border-color: rgba(255,120,120,0.4); animation: none; pointer-events: auto; }
@keyframes sky-loading-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { #sky-loading { animation: none; } }

/* Data credits, at the foot of the layers panel */
#data-credits { font-size: 10.5px; line-height: 1.45; color: #889; padding: 0.9rem 4px 4px; margin-top: 0.5rem; border-top: 0.5px solid rgba(100,160,255,0.1); }
#data-credits a, .hl-credit a, .osm-credit { color: #9ab; text-decoration: underline; text-underline-offset: 2px; }
.hl-credit { font-size: 10.5px; color: #889; margin-top: 6px; }
.osm-credit { font-size: 9.5px; margin-left: 6px; opacity: 0.85; }

/* ── Top bar ─────────────────────────────────────────────────────────────────── */
#topbar {
  position: absolute;
  top: 0.65rem;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0 0.5rem;
  pointer-events: none;
  z-index: 10;
}

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

/* ── Date/time control ──────────────────────────────────────────────────────── */
.ctrl {
  background: rgba(10, 15, 30, 0.88);
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
}

label {
  font-size: 11px;
  color: #aaa;
  user-select: none;
  white-space: nowrap;
}

input[type=date] {
  background: transparent;
  border: none;
  color: #ddd;
  font-size: 12px;
  cursor: pointer;
  color-scheme: dark;
  min-width: 0;
  flex-shrink: 1;
}

input[type=range] {
  background: transparent;
  border: none;
  width: 90px;
  accent-color: #7af;
  cursor: pointer;
  flex-shrink: 1;
}

#time-val {
  font-size: 12px;
  min-width: 36px;
  color: #ddd;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── Time slider twilight track ─────────────────────────────────────────────── */
#time-slider-wrap {
  position: relative;
  display: flex;
  align-items: center;
  /* Takes what room the bar has, so the bar never runs off a narrow screen */
  flex: 1 1 130px;
  min-width: 70px;
}

#twilight-track {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 9px;          /* Moon strip (top 2px), twilight, cloud strip (bottom 2px) */
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.18);
  pointer-events: none;
  /* default until JS paints it */
  background: rgba(8,12,35,0.6);
}

#time-slider-wrap input[type=range] {
  position: relative;   /* sits above the track */
  z-index: 1;
  width: 100%;
  background: transparent;
  /* Our own look, so the browser's slider bar doesn't cover the twilight,
     Moon and cloud strips underneath: a see-through track and a round handle */
  -webkit-appearance: none;
  appearance: none;
  height: 28px;           /* comfortable to grab on a phone */
  margin: 0;
  cursor: pointer;
}
#time-slider-wrap input[type=range]::-webkit-slider-runnable-track { height: 9px; background: transparent; border: none; }
#time-slider-wrap input[type=range]::-moz-range-track             { height: 9px; background: transparent; border: none; }
#time-slider-wrap input[type=range]::-moz-range-progress          { background: transparent; }
#time-slider-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin-top: -3.5px;     /* centre on the 9px track */
  border-radius: 50%;
  background: #e4ecff;
  border: 2px solid #7af;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.55);
}
#time-slider-wrap input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #e4ecff;
  border: 2px solid #7af;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.55);
}
#time-slider-wrap input[type=range]:focus { outline: none; }
#time-slider-wrap input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px #000, 0 0 0 4px #fff; }
#time-slider-wrap input[type=range]:focus-visible::-moz-range-thumb     { box-shadow: 0 0 0 2px #000, 0 0 0 4px #fff; }

/* ── Magnitude limit slider row ─────────────────────────────────────────────── */
.mag-limit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.10);
  width: 100%;
  box-sizing: border-box;
}

.mag-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: rgba(180,200,255,0.7);
}

.mag-limit-row label {
  white-space: nowrap;
  flex-shrink: 0;
  color: rgba(180,200,255,0.7);
  font-size: 11px;
}

.mag-limit-row input[type=range] {
  flex: 1;
  min-width: 60px;
  accent-color: #7af;
}

#mag-limit-val {
  font-size: 11px;
  min-width: 22px;
  text-align: right;
  color: #bcd;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── Play button ────────────────────────────────────────────────────────────── */
.play-btn {
  background: rgba(100, 180, 255, 0.12);
  border: 0.5px solid rgba(100, 180, 255, 0.28);
  border-radius: 6px;
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7af;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.play-btn svg { width: 12px; height: 12px; }
.play-btn .btn-label { display: none; }   /* always icon-only */
.play-btn.on,
.play-btn:hover { background: rgba(100,180,255,0.22); border-color: rgba(100,180,255,0.5); }

/* ── Speed selector ─────────────────────────────────────────────────────────── */
#speed-select {
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.14);
  border-radius: 5px;
  color: #aaa;
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
  color-scheme: dark;
  flex-shrink: 0;
  height: 26px;
  font-family: inherit;
}
#speed-select:focus { outline: none; border-color: rgba(100,180,255,0.4); }

/* ── Location + geolocation — merged bottom-RIGHT box ───────────────────────── */
#loc-geo {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  z-index: 15;
  pointer-events: all;
}

#loc-display {
  font-size: 11px;
  color: rgba(140,180,255,0.72);
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(8,12,28,0.82);
  border: 0.5px solid rgba(100,160,255,0.18);
  border-radius: 8px;
  padding: 5px 10px;
  white-space: nowrap;
}
#loc-display svg { opacity: 0.65; flex-shrink: 0; }

/* "Book a space" - above the location, only while a class is on sale (scripts/book-cta.js) */
#book-cta {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(79,70,229,0.92);
  border: 0.5px solid rgba(165,180,252,0.45);
  border-radius: 8px;
  padding: 6px 12px;
  text-decoration: none;
  white-space: nowrap;
}
#book-cta[hidden] { display: none; }

/* Tonight's cloud / aurora verdict (scripts/conditions.js) */
#cond-chip {
  font-size: 12px;
  font-family: inherit;
  color: #dde;
  background: rgba(8,12,28,0.88);
  border: 0.5px solid rgba(100,160,255,0.3);
  border-radius: 8px;
  padding: 6px 11px;
  cursor: pointer;
  white-space: nowrap;
}
#cond-chip[hidden] { display: none; }
#cond-chip:hover, #cond-chip:focus-visible { border-color: rgba(100,160,255,0.6); }
#book-cta:hover, #book-cta:focus-visible { background: rgba(99,102,241,0.95); }
#book-cta .book-cta-when { font-weight: 400; opacity: 0.85; }

#geo-nudge {
  background: rgba(8,12,28,0.88);
  border: 0.5px solid rgba(100,160,255,0.28);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 11.5px;
  color: #99b;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 5px;
  transition: border-color 0.2s, color 0.2s;
  font-family: inherit;
  line-height: 1;
  pointer-events: all;
}
#geo-nudge:hover { color: #bbd; border-color: rgba(100,160,255,0.55); }

/* ── Zoom controls — bottom-LEFT ─────────────────────────────────────────────── */
#view-controls {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 15;
}
#view-controls .icon-btn { width: 40px; height: 40px; color: #9ab; }
#view-controls .icon-btn:disabled { opacity: 0.35; cursor: default; }
#view-controls .icon-btn:disabled:hover { background: rgba(10,15,30,0.88); color: #9ab; }

/* ── Icon buttons (events + hamburger) ──────────────────────────────────────── */
.icon-btn {
  background: rgba(10,15,30,0.88);
  border: 0.5px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  flex-shrink: 0;
  padding: 0;
}
.icon-btn[hidden] { display: none; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.on { background: rgba(100,180,255,0.18); color: #7af; border-color: rgba(100,180,255,0.35); }
.icon-btn:hover:not(.on) { background: rgba(255,255,255,0.07); color: #bbb; }

/* ── Controls slide-out panel (LEFT) ────────────────────────────────────────── */
#controls-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 230px;
  height: 100dvh;
  background: rgba(5,9,22,0.97);
  border-right: 0.5px solid rgba(100,160,255,0.18);
  display: flex;
  flex-direction: column;
  z-index: 35;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
#controls-panel.open { transform: translateX(0); }

#controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.85rem 0.7rem;
  border-bottom: 0.5px solid rgba(100,160,255,0.12);
  flex-shrink: 0;
}
#controls-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: #cce;
  letter-spacing: 0.01em;
}

#controls-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,160,255,0.2) transparent;
}

.ctrl-section-title {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(140,160,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 2px 2px;
}

/* ── Toggle buttons (inside controls panel) ─────────────────────────────────── */
.toggle-btn {
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  padding: 7px 10px;
  color: #778;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.toggle-btn svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.toggle-btn.on { background: rgba(100,180,255,0.14); color: #8bf; border-color: rgba(100,180,255,0.32); }
.toggle-btn.on svg { opacity: 1; }
.toggle-btn:hover:not(.on) { background: rgba(255,255,255,0.07); color: #aab; }
.toggle-btn:active { transform: scale(0.98); }

/* ── Consistent panel close button ──────────────────────────────────────────── */
.panel-close {
  background: rgba(255,255,255,0.07);
  border: 0.5px solid rgba(255,255,255,0.13);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #889;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.panel-close svg { width: 12px; height: 12px; }
.panel-close:hover { background: rgba(255,80,80,0.18); color: #f99; border-color: rgba(255,80,80,0.3); }

/* ── Info card ──────────────────────────────────────────────────────────────── */
#info-box {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(7,11,26,0.97);
  border: 0.5px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 12px 16px 14px;
  min-width: 260px;
  max-width: min(92vw, 420px);
  display: none;
  pointer-events: all;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 55;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}

#info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  border-bottom: 0.5px solid rgba(255,255,255,0.09);
  padding-bottom: 8px;
}
#info-name {
  font-size: 15px;
  color: #dde;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

.info-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: #99a;
  line-height: 1.85;
  flex-wrap: wrap;
}
.info-tag {
  font-size: 10px;
  color: rgba(120,160,255,0.62);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 72px;
}
.info-desc {
  font-size: 11px;
  color: #889;
  line-height: 1.6;
  margin-top: 6px;
  font-style: italic;
  border-top: 0.5px solid rgba(255,255,255,0.07);
  padding-top: 6px;
}
.info-peak {
  font-size: 12px;
  font-weight: 700;
  color: #fa8;
  text-align: center;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
/* "Right now" visibility verdict (visibilityNow in app.js) */
.info-vis {
  font-size: 11.5px;
  border-radius: 4px;
  padding: 3px 7px;
  margin: 2px 0 6px;
  border: 0.5px solid currentColor;
}
.info-vis-easy  { color: #8e8; background: rgba(80,200,80,0.08); }
.info-vis-ok    { color: #cd8; background: rgba(200,220,80,0.08); }
.info-vis-bino  { color: #fc7; background: rgba(255,190,80,0.08); }
.info-vis-scope { color: #f9a; background: rgba(255,120,140,0.08); }
.info-vis-down  { color: #99a; background: rgba(150,150,170,0.08); }
.info-retrograde {
  font-size: 11px;
  font-weight: 600;
  color: #f88;
  background: rgba(255,80,60,0.1);
  border: 0.5px solid rgba(255,80,60,0.25);
  border-radius: 4px;
  padding: 3px 7px;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.info-jup-moons {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 0.5px solid rgba(255,255,255,0.07);
}

/* ── Events panel (RIGHT) ───────────────────────────────────────────────────── */
#events-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 400px;
  height: 100dvh;
  background: rgba(5,9,22,0.97);
  border-left: 0.5px solid rgba(100,160,255,0.18);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
#events-panel.open { transform: translateX(0); }

/* Controls (left, z-index 35) and Events (right, z-index 30) are on opposite sides — no overlap */

#events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 0.5px solid rgba(100,160,255,0.12);
  flex-shrink: 0;
}
#events-header h2 { font-size: 15px; font-weight: 600; color: #cce; }

#events-content {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,160,255,0.25) transparent;
}
#events-content::-webkit-scrollbar { width: 4px; }
#events-content::-webkit-scrollbar-thumb { background: rgba(100,160,255,0.25); border-radius: 2px; }

/* Event content styles */
.evt-section { padding: 0.6rem 1rem; border-bottom: 0.5px solid rgba(255,255,255,0.05); }
.evt-section-title {
  font-size: 11.5px; font-weight: 700;
  color: rgba(140,180,255,0.75);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 0.45rem;
}
.evt-subtitle { font-weight:400; text-transform:none; letter-spacing:0; color:rgba(140,180,255,0.4); font-size:10px; }
.evt-row { padding: 3px 0; display: flex; flex-direction: column; gap: 1px; }
.evt-name { font-size: 12px; color: #bbc; font-weight: 500; }
.evt-cal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 24px;
  height: 24px;
  margin-left: 6px;
  padding: 0;
  background: rgba(100,180,255,0.08);
  border: 0.5px solid rgba(100,180,255,0.25);
  border-radius: 5px;
  color: #8bd;
  cursor: pointer;
}
.evt-cal svg { width: 13px; height: 13px; }
.evt-cal:hover, .evt-cal:focus-visible { background: rgba(100,180,255,0.2); color: #bdf; }
.evt-date { font-size: 11px; color: #889; }
.evt-desc { font-size: 10.5px; color: rgba(140,160,180,0.55); font-style: italic; }
.evt-riserow { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; border-bottom: 0.5px solid rgba(255,255,255,0.04); }
.evt-body { font-size: 12px; color: #bbc; }
.evt-riseset { font-size: 11px; color: #889; font-variant-numeric: tabular-nums; }
.evt-soon { color: #8ef; font-weight: 600; font-size: 10px; background: rgba(100,200,255,0.12); padding: 0 5px; border-radius: 4px; vertical-align: middle; }
.evt-in   { color: #aaa; font-size: 10px; background: rgba(255,255,255,0.05); padding: 0 5px; border-radius: 4px; vertical-align: middle; }
.evt-loading { padding: 2rem 1rem; text-align: center; color: rgba(140,180,255,0.38); font-size: 12px; }
.evt-none { font-size: 11px; color: rgba(140,160,180,0.4); font-style: italic; padding: 2px 0; }

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #topbar { top: 0.4rem; gap: 0.3rem; }
  /* Buttons on one row, the date/time bar full width on the row below it */
  .ctrl { padding: 4px 7px; gap: 4px; order: 2; flex: 1 1 100%; }
  /* "Time" hidden visually (the clock beside it says it); still read out */
  .ctrl > label[for="time-in"] {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  input[type=date] { flex-shrink: 0; }
  label { font-size: 10px; }
  input[type=date] { font-size: 11px; max-width: 110px; }
  input[type=range] { width: 65px; }
  #time-val { font-size: 11px; min-width: 32px; }
  #speed-select { font-size: 10px; max-width: 50px; flex-shrink: 0; }
  .play-btn { width: 24px; height: 24px; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 14px; height: 14px; }
  #controls-panel { width: 200px; }
  #events-panel { max-width: 100%; }
  #info-box { min-width: 0; width: calc(100vw - 2rem); bottom: 0.75rem; }
  .info-tag { min-width: 60px; }
  #loc-geo { bottom: 0.75rem; right: 0.75rem; }
  #loc-display { font-size: 10px; padding: 4px 8px; }
  #book-cta { font-size: 11px; padding: 5px 10px; }
  #book-cta .book-cta-when { display: none; }   /* just "Book a space" on a phone */
  #geo-nudge { font-size: 10.5px; padding: 5px 9px; }
}

@media (max-width: 380px) {
  input[type=date] { max-width: 90px; }
  input[type=range] { width: 50px; }
  #speed-select { display: none; }
}

@media (max-height: 500px) {
  #topbar { top: 0.3rem; gap: 0.2rem; }
  .ctrl { padding: 3px 6px; }
}

/* ── Red light mode ─────────────────────────────────────────────────────────── */
body.redlight { filter: url(#redlight-filter); }
/* SVG filter injected by share.js would be ideal but CSS filter is simpler: */
body.redlight { filter: saturate(0) sepia(1) hue-rotate(320deg) brightness(0.75); }
body.redlight #info-box,
body.redlight #controls-panel,
body.redlight #events-panel,
body.redlight #search-overlay,
body.redlight #highlights-card,
body.redlight #altgraph-modal,
body.redlight .sfb-card,
body.redlight #dark-timer-widget { filter: none; background: rgba(20,0,0,0.97) !important; border-color: rgba(180,30,30,0.4) !important; }
body.redlight .toggle-btn.on  { background: rgba(180,30,30,0.25) !important; color: #f88 !important; border-color: rgba(180,30,30,0.5) !important; }
body.redlight .ctrl-section-title { color: rgba(200,80,80,0.6) !important; }

/* ── Info card altitude button ───────────────────────────────────────────────── */
#info-altgraph-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  background: rgba(100,180,255,0.1);
  border: 0.5px solid rgba(100,180,255,0.25);
  border-radius: 6px;
  color: #7af;
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  width: 100%;
  justify-content: center;
}
#info-altgraph-btn svg { width: 13px; height: 13px; }
#info-altgraph-btn:hover { background: rgba(100,180,255,0.2); }

/* ── Altitude graph modal ────────────────────────────────────────────────────── */
#altgraph-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 60;
  display: none;          /* hidden by default — no pointer-event blocking */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s;
  backdrop-filter: blur(4px);
}
#altgraph-modal.active {
  display: flex;          /* shown as flex when active */
  opacity: 1;
}
#altgraph-inner {
  background: rgba(5,9,22,0.98);
  border: 0.5px solid rgba(100,160,255,0.25);
  border-radius: 14px;
  padding: 0 0 12px;
  width: min(520px, 96vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
#altgraph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
  font-size: 13px;
  color: #cce;
  font-weight: 500;
}
#altgraph-canvas {
  display: block;
  width: 100%;
  height: 180px;
  margin: 0;
}
#altgraph-legend {
  font-size: 10px;
  color: rgba(140,180,255,0.45);
  text-align: center;
  padding: 4px 0 0;
}

/* ── Search overlay ──────────────────────────────────────────────────────────── */
#search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,8,0.6);
  z-index: 65;
  display: none;          /* hidden by default — no pointer-event blocking */
  align-items: flex-start;
  justify-content: center;
  padding-top: max(4rem, env(safe-area-inset-top, 0) + 3.5rem);
  opacity: 0;
  transition: opacity 0.2s;
  backdrop-filter: blur(6px);
}
#search-overlay.active {
  display: flex;          /* shown as flex when active */
  opacity: 1;
}
#search-box {
  background: rgba(5,9,22,0.98);
  border: 0.5px solid rgba(100,160,255,0.28);
  border-radius: 14px;
  width: min(500px, 94vw);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.8);
}
#search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 16px;
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
}
#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #dde;
  font-size: 15px;
  font-family: inherit;
  caret-color: #7af;
}
#search-input::placeholder { color: rgba(140,180,255,0.35); }
#search-results {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,160,255,0.2) transparent;
}
.search-result {
  padding: 9px 16px;
  cursor: pointer;
  border-bottom: 0.5px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
  outline: none;
}
.search-result:hover,
.search-result:focus,
.search-result.focused {
  background: rgba(100,160,255,0.15);
  outline: none;
}
.search-result.focused {
  background: rgba(100,180,255,0.2);
  border-left: 2px solid rgba(100,200,255,0.7);
  padding-left: 14px;   /* compensate for the border */
}
.search-label { display: block; font-size: 13px; color: #ccd; font-weight: 500; }
.search-sub   { display: block; font-size: 11px; color: #889; margin-top: 1px; }
.search-noresult { padding: 14px 16px; color: rgba(140,180,255,0.35); font-size: 12px; font-style: italic; }

/* ── Star hops (scripts/star-hops.js) ───────────────────────────────────────── */
.sfb-card {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(92vw, 340px);
  max-height: 70dvh;
  overflow-y: auto;
  background: rgba(5,9,22,0.96);
  border: 0.5px solid rgba(100,160,255,0.22);
  border-radius: 12px;
  padding: 10px 14px 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 46;
  color: #ccd;
}
.sfb-card[hidden] { display: none; }
.sfb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.sfb-card-head h2 { font-size: 13px; font-weight: 600; color: #cde; }
.sfb-card-intro { font-size: 11.5px; color: #99a; margin-bottom: 8px; }
#hops-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.hop-pick {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 10px;
  background: rgba(100,160,255,0.06);
  border: 0.5px solid rgba(100,160,255,0.2);
  border-radius: 8px;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}
.hop-pick:hover, .hop-pick:focus-visible { background: rgba(100,160,255,0.15); border-color: rgba(100,160,255,0.45); }
.hop-pick.hop-down { opacity: 0.6; }
.hop-title { font-size: 12.5px; font-weight: 600; color: #dde; }
.hop-blurb { font-size: 11px; color: #99a; }
.hop-note  { font-size: 10.5px; color: #c9a; font-style: italic; }
#hop-step  { font-size: 11px; font-weight: 600; color: #fd6; margin: 2px 0 4px; }
#hop-text  { font-size: 12.5px; line-height: 1.45; color: #ccd; }
.hop-nav   { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.hop-nav button {
  flex: 1;
  padding: 7px 10px;
  border-radius: 7px;
  border: 0.5px solid rgba(100,160,255,0.3);
  background: rgba(100,160,255,0.1);
  color: #bde;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.hop-nav button:hover:not(:disabled), .hop-nav button:focus-visible { background: rgba(100,160,255,0.22); }
.hop-nav button:disabled { opacity: 0.35; cursor: default; }
#hop-next { background: rgba(255,210,80,0.14); border-color: rgba(255,210,80,0.4); color: #fd8; }

/* ── Change place (scripts/place.js) ─────────────────────────────────────────── */
#loc-buttons { display: flex; gap: 5px; justify-content: flex-end; }
#loc-display { cursor: pointer; }
#place-btn {
  background: rgba(8,12,28,0.88);
  border: 0.5px solid rgba(100,160,255,0.28);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 11.5px;
  color: #99b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  line-height: 1;
}
#place-btn:hover, #place-btn[aria-expanded="true"] { color: #bbd; border-color: rgba(100,160,255,0.55); }
#place-form { display: flex; gap: 6px; }
#place-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 7px;
  border: 0.5px solid rgba(100,160,255,0.3);
  background: rgba(255,255,255,0.05);
  color: #dde;
  font-family: inherit;
  font-size: 13px;
}
#place-input:focus { outline: none; border-color: rgba(100,180,255,0.6); }
#place-find, .place-gps {
  padding: 7px 12px;
  border-radius: 7px;
  border: 0.5px solid rgba(255,210,80,0.4);
  background: rgba(255,210,80,0.14);
  color: #fd8;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
#place-status { font-size: 11.5px; color: #c9a; margin: 6px 0 2px; min-height: 0; }
#place-status:empty { display: none; }
.place-list { list-style: none; display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.place-subhead { font-size: 11px; font-weight: 600; color: #889; margin-top: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.place-gps {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 10px;
  border-color: rgba(100,160,255,0.3); background: rgba(100,160,255,0.1); color: #bde;
}
.place-gps[hidden] { display: none; }
.place-credit { font-size: 10px; color: #667; margin-top: 8px; }
.place-credit a { color: #889; }

/* ── Binocular view (scripts/fov.js) ─────────────────────────────────────────── */
.hop-pick.fov-current { border-color: rgba(255,210,80,0.55); background: rgba(255,210,80,0.1); }
#fov-custom-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: #99a; }
#fov-custom-form label { flex: 1 1 100%; }
#fov-custom {
  flex: 1; min-width: 0; padding: 6px 9px; border-radius: 7px;
  border: 0.5px solid rgba(100,160,255,0.3); background: rgba(255,255,255,0.05);
  color: #dde; font-family: inherit; font-size: 13px;
}
#fov-custom-form button {
  padding: 6px 12px; border-radius: 7px; border: 0.5px solid rgba(255,210,80,0.4);
  background: rgba(255,210,80,0.14); color: #fd8; font-family: inherit; font-size: 12px; cursor: pointer;
}

/* ── My horizon (scripts/horizon.js) ─────────────────────────────────────────── */
#horizon-rows { display: grid; gap: 4px; margin: 4px 0 8px; }
.horizon-row { display: grid; grid-template-columns: 2.4em 1fr 2.8em; align-items: center; gap: 8px; font-size: 12px; }
.horizon-row label { font-weight: 600; color: #bcd; }
.horizon-row input[type=range] { width: 100%; accent-color: #7c9; }
.horizon-row output { text-align: right; color: #9ab; font-variant-numeric: tabular-nums; }
.horizon-toggle { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #bcd; cursor: pointer; }

/* ── First-night tour (scripts/tour.js) ──────────────────────────────────────── */
/* At the top, so the thing being looked at (turned to the bottom) stays in view */
#tour-card { top: 4.4rem; bottom: auto; }
#tour-step { font-size: 11px; font-weight: 600; color: #fd6; margin: 2px 0 4px; }
#tour-text { font-size: 12.5px; line-height: 1.5; color: #ccd; }
#tour-extra { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#tour-extra[hidden] { display: none; }
#tour-extra button {
  padding: 5px 10px; border-radius: 999px; border: 0.5px solid rgba(100,160,255,0.35);
  background: rgba(100,160,255,0.1); color: #bde; font-family: inherit; font-size: 11.5px; cursor: pointer;
}
#tour-extra button:hover, #tour-extra button:focus-visible { background: rgba(100,160,255,0.22); }
#tour-next, #tour-offer-start { background: rgba(255,210,80,0.14); border-color: rgba(255,210,80,0.4); color: #fd8; }
#tour-offer-text { font-size: 12.5px; line-height: 1.45; color: #dde; }
.help-link {
  background: none; border: none; padding: 0; font: inherit; color: #fd8; text-decoration: underline; cursor: pointer;
}

/* ── Tonight's highlights card ───────────────────────────────────────────────── */
#highlights-card {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 45;
  display: none;            /* hidden by default; JS sets display:block before .active */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s, transform 0.35s;
  pointer-events: none;
}
#highlights-card.active { opacity: 1; transform: translateY(0); pointer-events: all; }
#highlights-inner {
  background: rgba(5,9,22,0.96);
  border: 0.5px solid rgba(100,160,255,0.22);
  border-radius: 12px;
  padding: 10px 14px 12px;
  min-width: 220px;
  max-width: 300px;
  max-height: 72vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  scrollbar-width: thin;
  scrollbar-color: rgba(100,160,255,0.25) transparent;
}
#highlights-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #cce;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
  background: rgba(5,9,22,0.98);
  z-index: 1;
  padding-bottom: 2px;
}
/* One-sentence sky summary headline */
#highlights-headline {
  font-size: 12.5px;
  font-weight: 500;
  color: #ccd;
  line-height: 1.5;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
  font-style: italic;
}

#highlights-list { list-style: none; }
#highlights-list li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  color: #99a;
  line-height: 1.65;
  padding: 1px 0;
}
.hl-icon { flex-shrink: 0; font-size: 13px; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: rgba(20,30,55,0.96);
  border: 0.5px solid rgba(100,160,255,0.3);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12.5px;
  color: #cce;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Mobile additions ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #highlights-card { right: 0.75rem; bottom: 5rem; max-width: calc(100vw - 1.5rem); }
  #search-overlay  { padding-top: 3rem; }
  #altgraph-inner  { border-radius: 0; width: 100%; }
  #toast           { bottom: 4rem; }
}

/* ── High contrast mode ──────────────────────────────────────────────────────── */
/* Canvas rendering is controlled by JS (highContrast flag exposed to app.js).   */
/* UI elements get stronger contrast here via CSS.                                */
body.highcontrast {
  --hc-text:    #ffffff;
  --hc-border:  rgba(255,255,255,0.7);
  --hc-accent:  #ffff00;
}
body.highcontrast .ctrl,
body.highcontrast .icon-btn,
body.highcontrast .toggle-btn,
body.highcontrast #controls-panel,
body.highcontrast #events-panel,
body.highcontrast #info-box,
body.highcontrast #dark-timer-widget {
  border-color: var(--hc-border) !important;
}
body.highcontrast .toggle-btn      { color: #ddd; }
/* Dark background ensures yellow text (#ffff00) meets WCAG AA contrast (≥4.5:1) */
body.highcontrast .toggle-btn.on   { color: var(--hc-accent); background: rgba(0,0,0,0.5) !important; border-color: var(--hc-accent) !important; }
body.highcontrast .ctrl-section-title { color: rgba(255,255,200,0.8) !important; }
body.highcontrast #info-name       { color: #ffffff; }
body.highcontrast .info-tag        { color: var(--hc-accent); }
body.highcontrast .info-row        { color: #e0e0e0; }
body.highcontrast #controls-header h2,
body.highcontrast #events-header h2 { color: #ffffff; }
body.highcontrast .evt-name        { color: #e8e8e8; }
body.highcontrast .evt-section-title { color: #ffff88; }

/* ── Keyboard canvas focus ring ──────────────────────────────────────────────── */
#canvas:focus {
  outline: 3px solid rgba(255,220,40,0.9);
  outline-offset: -3px;
}
#canvas.sky-focused {
  outline: 3px solid rgba(255,220,40,0.9);
  outline-offset: -3px;
}
/* Suppress the outline when focused by mouse/touch (only show for keyboard) */
#canvas:focus:not(:focus-visible) { outline: none; }

/* ── Reduced motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* Disable all CSS transitions and animations */
  *,
  *::before,
  *::after {
    animation-duration:        0.01ms !important;
    animation-iteration-count: 1      !important;
    transition-duration:       0.01ms !important;
    scroll-behavior:           auto   !important;
  }

  /* Panel slides become instant */
  #controls-panel,
  #events-panel {
    transition: none !important;
  }

  /* Overlays appear/disappear instantly — no fade */
  #search-overlay,
  #altgraph-modal,
  #highlights-card,
  #toast {
    transition: none !important;
  }

  /* Info card, toast fade */
  #info-box { transition: none !important; }

  /* Dark timer */
  #dark-timer-widget { transition: none !important; }
}

/* ── Narrate button speaking state ───────────────────────────────────────────── */
#btn-narrate.on {
  animation: narrate-pulse 1.2s ease-in-out infinite;
  color: #7af;
  border-color: rgba(100,180,255,0.5);
}
@keyframes narrate-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  #btn-narrate.on { animation: none; }
}

/* ── Difficulty badge ────────────────────────────────────────────────────────── */
.diff-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.diff-naked    { background: rgba(60,200,80,0.15);  color: #6e6; border: 1px solid rgba(80,210,100,0.3); }
.diff-bino     { background: rgba(60,150,255,0.15); color: #8cf; border: 1px solid rgba(80,160,255,0.3); }
.diff-scope-sm { background: rgba(220,155,40,0.15); color: #fb6; border: 1px solid rgba(230,165,50,0.3); }
.diff-scope-lg { background: rgba(190,80,255,0.12); color: #c8f; border: 1px solid rgba(190,80,255,0.3); }

/* ── Constellation mythology snippet ────────────────────────────────────────── */
.info-myth {
  font-size: 10.5px;
  color: #8a9;
  line-height: 1.55;
  margin-top: 7px;
  padding: 5px 8px;
  border-left: 2px solid rgba(140,180,220,0.25);
  font-style: italic;
}

/* ── Special stars (variable / double) info card enrichment ─────────────────── */
.info-special-hdr {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(180,210,255,0.7);
  margin-bottom: 4px;
  margin-top: 2px;
}
.info-special-desc {
  font-size: 11px;
  color: #8ac;
  line-height: 1.6;
  margin-top: 5px;
  font-style: italic;
}

/* ── Events panel tag badges ─────────────────────────────────────────────────── */
.evt-tag-occ {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(255,100,100,0.18);
  color: #f99;
  border: 1px solid rgba(255,100,100,0.3);
}
.evt-tag-near {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(100,180,255,0.15);
  color: #8cf;
  border: 1px solid rgba(100,180,255,0.3);
}

/* ── Dark adaptation timer widget ────────────────────────────────────────────── */
#dark-timer-widget {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: rgba(8,5,10,0.97);
  border: 1px solid rgba(200,60,60,0.35);
  border-radius: 16px;
  padding: 14px 18px 16px;
  min-width: 230px;
  max-width: min(90vw, 280px);
  z-index: 56;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.8), 0 0 40px rgba(180,0,0,0.15);
}
#dark-timer-widget.dt-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}
#dt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
#dt-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(220,80,80,0.9);
  letter-spacing: 0.04em;
}
#dt-display {
  font-size: 2.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(220,60,60,0.8);
  text-align: center;
  letter-spacing: 0.06em;
  line-height: 1;
  margin: 4px 0 8px;
  transition: opacity 0.5s;
}
#dt-display.dt-done {
  font-size: 1.4rem;
  color: rgba(80,200,80,0.9);
}
#dt-hint {
  font-size: 10px;
  color: rgba(160,80,80,0.75);
  line-height: 1.5;
  text-align: center;
  margin-bottom: 12px;
}
#dt-controls {
  display: flex;
  gap: 8px;
}
#dt-controls button {
  flex: 1;
  padding: 6px 0;
  border-radius: 8px;
  border: 1px solid rgba(200,60,60,0.35);
  background: rgba(180,40,40,0.18);
  color: rgba(220,120,120,0.9);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
#dt-controls button:hover { background: rgba(180,40,40,0.32); }
#dt-controls button:disabled { opacity: 0.35; cursor: default; }

/* Red-light mode keeps the timer visually consistent */
body.redlight #dark-timer-widget {
  background: rgba(18,2,2,0.98);
  border-color: rgba(180,30,30,0.5);
}

/* ── Controls panel footer (What's New button) ──────────────────────────────── */
#controls-footer {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem 0.85rem;
  border-top: 0.5px solid rgba(100,160,255,0.1);
}
#controls-footer .toggle-btn {
  color: rgba(140,160,200,0.6);
  border-color: rgba(255,255,255,0.06);
  font-size: 11px;
  position: relative;   /* anchor for .rn-dot */
}
#controls-footer .toggle-btn:hover:not(.on) { color: #99b; }
#controls-footer .toggle-btn.on { color: #8bf; }

/* Pulsing "new" dot badge */
.rn-dot {
  position: absolute;
  top: 5px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7af;
  box-shadow: 0 0 6px rgba(100,180,255,0.7);
  animation: rn-pulse 2s ease-in-out infinite;
}
@keyframes rn-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}
@media (prefers-reduced-motion: reduce) { .rn-dot { animation: none; } }

/* ── Release notes panel ─────────────────────────────────────────────────────── */
#rn-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 92vw;
  height: 100dvh;
  background: rgba(5,9,22,0.98);
  border-right: 0.5px solid rgba(100,160,255,0.18);
  display: flex;
  flex-direction: column;
  z-index: 40;             /* above controls panel (35), below modals (55+) */
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 4px 0 32px rgba(0,0,0,0.6);
}
#rn-panel.open { transform: translateX(0); }

#rn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.9rem 0.75rem;
  border-bottom: 0.5px solid rgba(100,160,255,0.12);
  flex-shrink: 0;
}
#rn-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: #cce;
  letter-spacing: 0.01em;
}
#rn-title svg { opacity: 0.7; }

#rn-content {
  overflow-y: auto;
  flex: 1;
  padding: 0.75rem 0.9rem 2rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,160,255,0.2) transparent;
}
#rn-content::-webkit-scrollbar { width: 4px; }
#rn-content::-webkit-scrollbar-thumb { background: rgba(100,160,255,0.2); border-radius: 2px; }

/* Version block */
.rn-release {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.rn-release:last-child { border-bottom: none; margin-bottom: 0; }
.rn-release.rn-latest .rn-version { color: #8cf; }

.rn-release-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.rn-version {
  font-size: 15px;
  font-weight: 700;
  color: #99b;
  letter-spacing: 0.02em;
}
.rn-date {
  font-size: 11px;
  color: rgba(140,160,200,0.5);
  margin-left: auto;
}
.rn-badge-new {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #7af;
  background: rgba(100,180,255,0.15);
  border: 1px solid rgba(100,180,255,0.35);
  border-radius: 999px;
  padding: 1px 6px;
  text-transform: uppercase;
}

/* Item list */
.rn-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.rn-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12px;
  color: #99a;
  line-height: 1.55;
}
.rn-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 13px;
  margin-top: 0.5px;
}
.rn-item strong { color: #ccd; font-weight: 600; }
.rn-item em     { color: #8af; font-style: normal; }
.rn-item code   { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 10.5px;
                  background: rgba(255,255,255,0.07); padding: 1px 4px; border-radius: 3px; color: #adf; }

/* Red-light / high-contrast overrides */
body.redlight #rn-panel { filter: none; background: rgba(20,0,0,0.98) !important; border-color: rgba(180,30,30,0.4) !important; }
body.highcontrast #rn-panel { border-color: var(--hc-border) !important; }
@media (prefers-reduced-motion: reduce) { #rn-panel { transition: none !important; } }

/* ── How to use flyout (RIGHT) ───────────────────────────────────────────────── */
#help-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 92vw;
  height: 100dvh;
  background: rgba(5,9,22,0.98);
  border-left: 0.5px solid rgba(100,160,255,0.18);
  display: flex;
  flex-direction: column;
  z-index: 40;             /* above events panel (30), below modals (55+) */
  transform: translateX(100%);
  visibility: hidden;      /* off-screen, and out of reach of screen readers */
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), visibility 0s 0.28s;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: -4px 0 32px rgba(0,0,0,0.6);
}
#help-panel.open { transform: translateX(0); visibility: visible; transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); }

#help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.9rem 0.75rem;
  border-bottom: 0.5px solid rgba(100,160,255,0.12);
  flex-shrink: 0;
}
#help-title { font-size: 14px; font-weight: 600; color: #cce; letter-spacing: 0.01em; margin: 0; }

#help-content {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0.9rem 2rem;
  font-size: 12.5px;
  line-height: 1.55;
  color: #aab;
  scrollbar-width: thin;
  scrollbar-color: rgba(100,160,255,0.2) transparent;
}
#help-content::-webkit-scrollbar { width: 4px; }
#help-content::-webkit-scrollbar-thumb { background: rgba(100,160,255,0.2); border-radius: 2px; }
#help-content section { padding: 0.6rem 0; border-bottom: 0.5px solid rgba(255,255,255,0.06); }
#help-content section:last-child { border-bottom: none; }
#help-content h3 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #8cf; margin: 0 0 0.4rem; }
#help-content p { margin: 0 0 0.45rem; }
#help-content p:last-child { margin-bottom: 0; }
#help-content ul { list-style: none; margin: 0; padding: 0; }
#help-content li { position: relative; padding-left: 12px; margin-bottom: 0.35rem; }
#help-content li::before { content: '•'; position: absolute; left: 0; color: rgba(140,180,255,0.5); }
#help-content strong { color: #dde; font-weight: 600; }
#help-content kbd {
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 10.5px; color: #cde;
  background: rgba(255,255,255,0.07); border: 0.5px solid rgba(255,255,255,0.2);
  border-radius: 4px; padding: 0 4px;
}
#help-content .help-icons li { display: flex; gap: 8px; align-items: flex-start; padding-left: 0; }
#help-content .help-icons li::before { content: none; }
.help-icon {
  flex: 0 0 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  border: 0.5px solid rgba(255,255,255,0.18); border-radius: 6px; color: #9ab; font-size: 12px;
}
.help-icon svg { width: 13px; height: 13px; }

body.redlight #help-panel { filter: none; background: rgba(20,0,0,0.98) !important; border-color: rgba(180,30,30,0.4) !important; }
body.redlight #help-content h3 { color: #f88; }
body.highcontrast #help-panel { border-color: var(--hc-border) !important; }
body.highcontrast #help-content { color: var(--hc-text); }
@media (prefers-reduced-motion: reduce) { #help-panel, #help-panel.open { transition: none !important; } }

/* ── Prefers-color-scheme: light fallback ────────────────────────────────────── */
/* The app is inherently a dark-sky tool; light mode simply reduces contrast-clash
   on OLED displays and in daytime planning contexts. We keep the dark sky canvas
   but lighten UI chrome slightly. */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: dark light;
  }
  /* UI panels get a slightly warmer dark tint instead of near-black */
  #controls-panel,
  #events-panel,
  #info-box,
  #altgraph-modal #altgraph-inner,
  #search-box {
    background: rgba(12,16,34,0.98);
  }
  /* Make the topbar controls slightly more readable in sunlight */
  #topbar {
    background: linear-gradient(to bottom, rgba(0,5,18,0.72) 0%, transparent 100%);
  }
  input[type=date],
  #time-val,
  label {
    color: #dde;
  }
}
