/* ── Splash screen ───────────────────────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  opacity: 1;
  transition: opacity 0.9s ease;
  pointer-events: none;
}

#splash.fade-out {
  opacity: 0;
}

#splash-moon {
  display: block;
  max-height: 33vh;
  width: auto;
  object-fit: contain;
  animation: splash-moon-pulse 3s ease-in-out infinite;
}

@keyframes splash-moon-pulse {
  0%   { opacity: 0.85; }
  50%  { opacity: 1;    }
  100% { opacity: 0.85; }
}

#splash-clipart {
  margin-top: 24px;
  height: clamp(100px, 18vh, 180px);
  width: auto;
  filter: opacity(0.85);
}

#splash-subtitle {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.02em;
}

#splash-sub {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.01em;
}

#splash-version {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.18);
}

/* Loading dots */
#splash-loading {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}

#splash-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: splash-dot 1.2s ease-in-out infinite;
}

#splash-loading span:nth-child(2) { animation-delay: 0.2s; }
#splash-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes splash-dot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40%            { opacity: 1;   transform: scale(1.2); }
}

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

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
}

/* CSS2DRenderer overlay must also be above stars */
body > div[style*="position: absolute"] {
  z-index: 2;
}

body, html {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  width: 100%;
  height: 100%;
}

/* Scope wrap — hosts canvas + label renderer, transform applied here for flip/rotate */
#scope-wrap {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-origin: center center;
  transition: transform 0.3s ease;
}

/* Make sure canvas is above stars */
#moon-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* Telescope selector buttons */
#scope-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.scope-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.scope-btn:hover {
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.3);
}

.scope-btn.active {
  color: #60a5fa;
  border-color: rgba(96,165,250,0.5);
  background: rgba(96,165,250,0.08);
}

.moon-label {
  font-family: Assistant, sans-serif;
  pointer-events: none;
  user-select: none;
  text-align: center;
  opacity: var(--label-opacity, 1);
  transition: opacity 0.3s ease;
  cursor: pointer;
}

/* While measure tool is active, labels must not intercept taps */
body.measuring .moon-label { pointer-events: none !important; }

/* Counter-transform label text so it stays readable when scope is flipped.
   CSS2DRenderer owns the inline transform on .moon-label (for positioning),
   so we must target the child text spans instead. */
body.scope-mirror  .moon-label .heb,
body.scope-mirror  .moon-label .lat  { transform: scaleX(-1); }
body.scope-flip180 .moon-label .heb,
body.scope-flip180 .moon-label .lat  { transform: rotate(180deg); }

.moon-label .heb {
  display: block;
  color: var(--label-color, #fff);
  font-size: calc(var(--label-size, 14) * 0.8px * var(--label-scale, 1));
  font-weight: var(--label-weight, 400);
  font-style: var(--label-italic, normal);
  direction: rtl;
  white-space: nowrap;
  line-height: 1.1;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

.moon-label .lat {
  display: block;
  font-family: 'Roboto Slab', serif;
  font-size: calc(var(--label-size, 14) * 0.65px * var(--label-scale, 1));
  font-weight: 300;
  color: #ffffff;
  direction: ltr;
  white-space: nowrap;
  line-height: 1.1;
  margin-top: -1px;
  text-shadow: 0 1px 4px rgba(0,0,0,1), 0 0 10px rgba(0,0,0,1);
}

.moon-label .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--label-color, #fff);
  margin: 3px auto 0;
  box-shadow: 0 0 4px var(--label-color, #fff);
}

/* Shift crater labels so the crater rim stays visible */
.moon-label.crater-label {
  margin-top: 10px;
  margin-left: 10px;
}

/* Desktop opacity slider in scope-col */
#label-opacity {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 70px;
  cursor: pointer;
  accent-color: #60a5fa;
}

#reset-opacity {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 10px;
  cursor: pointer;
  line-height: 1;
}

#info-panel {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 60;
  background: rgba(5, 10, 25, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 20px;
  pointer-events: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  font-family: 'Assistant', sans-serif;
}

.info-coords {
  font-family: 'Roboto Slab', serif;
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.06em;
  padding-left: 4px;
  flex-shrink: 0;
}

.info-place {
  display: flex;
  flex-direction: row;
  align-items: center;
  border-left: 1px solid rgba(255,255,255,0.12);
  margin-left: 18px;
  padding-left: 18px;
}

#info-heb {
  font-size: 12px;
  font-weight: 400;
  color: #fff;
  margin-right: 12px;
  direction: rtl;
}

#info-lat-name {
  font-family: 'Roboto Slab', serif;
  font-size: 11px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.38);
  margin-right: 12px;
}

#info-meta {
  font-family: 'Roboto Slab', serif;
  font-size: 11px;
  font-weight: 300;
  color: rgba(96, 165, 250, 0.7);
}

#slider-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 128px;
  background: rgba(5, 10, 20, 0.8);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  z-index: 50;
}

/* Left column: scope buttons */
#scope-col {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-right: 1px solid rgba(255,255,255,0.07);
  padding: 12px 0;
}

/* Right column: existing sliders */
#sliders-col {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
}

.panel-label {
  color: rgba(255, 255, 255, 0.35);
  font-size: 9px;
  font-family: Assistant, sans-serif;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#label-scale {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 88px;
  cursor: pointer;
  accent-color: #60a5fa;
}

#reset-scale {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  padding: 3px 7px;
  cursor: pointer;
  font-size: 11px;
  font-family: Assistant, sans-serif;
}

#reset-scale:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

#zoom-display {
  position: fixed;
  bottom: 14px;
  right: 144px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(5, 10, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 5px 10px;
  font-family: 'Roboto Slab', serif;
  font-size: 12px;
  font-weight: 300;
  cursor: text;
  transition: border-color 0.2s;
}

#zoom-display:hover {
  border-color: rgba(96, 165, 250, 0.4);
}

#zoom-display.editing {
  border-color: rgba(96, 165, 250, 0.7);
}

#zoom-label {
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Assistant', sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
}

#zoom-input {
  width: 38px;
  background: none;
  border: none;
  outline: none;
  color: #60a5fa;
  font-family: 'Roboto Slab', serif;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
  -moz-appearance: textfield;
  padding: 0;
  cursor: text;
}

#zoom-input::-webkit-inner-spin-button,
#zoom-input::-webkit-outer-spin-button { -webkit-appearance: none; }

#zoom-unit {
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
}

#hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  font-family: Assistant, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
}

/* Floating moon data panel — toggled by ℹ button, desktop + mobile */
#mobile-moon-panel {
  display: none;
  position: fixed;
  bottom: 230px;
  left: 14px;
  z-index: 60;
  background: rgba(5, 10, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 10px 14px;
  flex-direction: column;
  gap: 7px;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  min-width: 160px;
  pointer-events: none;
}

#mobile-moon-panel.open {
  display: flex;
}

/* Desktop: hide info button — panel is always visible */
#moon-info-btn { display: none; }

#music-btn {
  position: fixed;
  bottom: 182px;
  left: 14px;
  z-index: 60;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(5, 10, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.35);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

#music-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
}

#music-btn.active {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.08);
}

#measure-btn {
  position: fixed;
  bottom: 140px;
  left: 14px;
  z-index: 60;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(5, 10, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.35);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

#measure-btn:hover:not(:disabled) {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
}

#measure-btn.active {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.08);
}

#measure-btn:disabled {
  opacity: 0.2;
  cursor: default;
}

#night-btn {
  position: fixed;
  bottom: 98px;
  left: 14px;
  z-index: 60;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(5, 10, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

#night-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
}

#night-btn.active {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.08);
}

/* ── Night mode ───────────────────────────────────────────────────────────── */
body {
  transition: filter 0.4s ease;
}
body.night-mode {
  filter: sepia(1) hue-rotate(-40deg) saturate(2.5) brightness(0.45);
}

/* Mobile-only orient button and popup — hidden on desktop */
#orient-btn, #mobile-orient-popup { display: none; }

/* Measure panel */
#measure-panel {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  background: rgba(4, 8, 22, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 12px;
  padding: 12px 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  min-width: 300px;
  pointer-events: auto;
}

#measure-title {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: rgba(251, 191, 36, 0.7);
  text-transform: uppercase;
  margin-bottom: 2px;
}

#measure-pt1,
#measure-pt2 {
  font-family: 'Roboto Slab', serif;
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.04em;
  direction: ltr;
}

#measure-pt1 {
  color: rgba(255, 255, 255, 0.5);
}

#measure-dist {
  font-size: 22px;
  font-weight: 600;
  color: #fbbf24;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

#measure-clear {
  margin-top: 6px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Assistant', sans-serif;
  font-size: 11px;
  padding: 3px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

#measure-clear:hover {
  color: #fff;
  border-color: rgba(251, 191, 36, 0.4);
}

#mobile-zoom {
  display: none;
}

#auto-rotate-btn {
  position: fixed;
  bottom: 56px;
  left: 14px;
  z-index: 60;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(5, 10, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.35);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

#auto-rotate-btn:hover:not(:disabled) {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
}

#auto-rotate-btn:disabled {
  opacity: 0.2;
  cursor: default;
}

#auto-rotate-btn.active {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.08);
  animation: spin-slow 3s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.panel-divider {
  width: 32px;
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 4px 0;
}

.panel-value {
  color: rgba(255,255,255,0.55);
  font-size: 9px;
  font-family: 'Roboto Slab', serif;
  font-weight: 300;
  letter-spacing: 0.03em;
  min-width: 32px;
  text-align: center;
}

#brightness-slider,
#contrast-slider,
#warmth-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 63px;
  cursor: pointer;
  accent-color: #60a5fa;
}

#warmth-slider {
  accent-color: #fb923c;
}

.reset-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.35);
  border-radius: 3px;
  padding: 2px 5px;
  cursor: pointer;
  font-size: 10px;
  font-family: 'Assistant', sans-serif;
}

.reset-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}

#orient-dial {
  touch-action: none;
}
#orient-dial:active {
  cursor: grabbing;
}

#filter-panel {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(5, 10, 20, 0.80);
  border-right: 1px solid rgba(255,255,255,0.07);
  border-radius: 0 8px 8px 0;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 50;
  direction: rtl;
}

.filter-title {
  color: rgba(255,255,255,0.35);
  font-size: 9px;
  font-family: 'Assistant', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  white-space: nowrap;
  user-select: none;
}

.filter-item input[type="checkbox"] {
  accent-color: #60a5fa;
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.filter-item:hover {
  color: #fff;
}

.type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-sub {
  padding-right: 16px;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: -2px;
}

/* ── App title ───────────────────────────────────────────────────────────── */
#app-title {
  position: fixed;
  top: 14px;
  right: 144px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  pointer-events: none;
  direction: rtl;
}

.app-title-main {
  font-family: 'Assistant', sans-serif;
  font-size: 19px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
  text-align: right;
  width: 100%;
}

.app-title-sub {
  font-family: 'Assistant', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.28);
  letter-spacing: 0.01em;
  text-align: right;
  width: 100%;
}

/* ── Dev panel ───────────────────────────────────────────────────────────── */
#dev-panel {
  position: fixed;
  top: 60px;
  right: 74px;
  z-index: 200;
  background: rgba(0, 5, 15, 0.93);
  border: 1px solid rgba(255, 220, 100, 0.3);
  border-radius: 10px;
  padding: 14px 16px;
  color: #fff;
  font-family: 'Roboto Slab', serif;
  font-size: 12px;
  font-weight: 300;
  min-width: 260px;
  direction: ltr;
}

.dev-title {
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 10px;
  font-family: 'Assistant', sans-serif;
}

.dev-title kbd {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
}

.dev-section {
  color: rgba(255,220,100,0.6);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 10px 0 6px;
}

.dev-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
}

.dev-row input[type="range"] {
  flex: 1;
  accent-color: #60a5fa;
  height: 3px;
}

.dev-row span {
  min-width: 36px;
  text-align: right;
  color: #60a5fa;
  font-size: 11px;
}

.dev-copy-btn {
  margin-top: 10px;
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  font-family: 'Assistant', sans-serif;
  font-size: 12px;
  padding: 5px;
  cursor: pointer;
}

.dev-copy-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ── Phase mode bar ──────────────────────────────────────────────────────── */
#phase-bar {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
}

.phase-toggle-btn {
  background: rgba(5, 10, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.55);
  font-family: 'Assistant', sans-serif;
  font-size: 13px;
  padding: 7px 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.phase-toggle-btn:hover {
  color: #fff;
  border-color: rgba(255, 220, 100, 0.45);
  background: rgba(5, 10, 25, 0.92);
}

#phase-controls {
  align-items: center;
  gap: 10px;
  background: rgba(5, 10, 25, 0.88);
  border: 1px solid rgba(255, 220, 100, 0.3);
  border-radius: 24px;
  padding: 6px 16px;
}

.phase-nav-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phase-nav-btn:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(255, 220, 100, 0.6);
  background: rgba(255, 220, 100, 0.08);
}

.phase-nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

#phase-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  gap: 2px;
}

#phase-name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

#phase-day {
  color: rgba(255, 220, 100, 0.7);
  font-size: 11px;
  font-family: 'Assistant', sans-serif;
  font-weight: 400;
}

.phase-side-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-right: 6px;
}

.phase-exit-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-family: 'Assistant', sans-serif;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.phase-exit-btn:hover {
  color: #fff;
  border-color: rgba(96, 165, 250, 0.5);
}

/* Darkness slider */
#darkness-wrap {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  align-items: center;
  gap: 10px;
  background: rgba(5, 10, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 6px 16px;
  direction: rtl;
}

.darkness-label {
  color: rgba(255, 255, 255, 0.45);
  font-family: 'Assistant', sans-serif;
  font-size: 12px;
  white-space: nowrap;
}

#darkness-slider {
  width: 120px;
  accent-color: #444;
  cursor: pointer;
}

/* ── Search box ───────────────────────────────────────────────────────────── */
#search-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  opacity: 0.28;
  transition: opacity 0.25s ease;
  width: 260px;
}

#search-wrap.focused,
#search-wrap:hover {
  opacity: 1;
}

#search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(5, 10, 25, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 8px 14px;
  color: #fff;
  font-family: 'Assistant', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: rgba(96, 165, 250, 0.6);
  border-radius: 8px 8px 0 0;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-family: 'Assistant', sans-serif;
}

#search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(5, 10, 25, 0.95);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.search-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.12s;
  direction: rtl;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover,
.search-item.active {
  background: rgba(96, 165, 250, 0.12);
}

.si-heb {
  font-family: 'Assistant', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.si-lat {
  font-family: 'Roboto Slab', serif;
  font-size: 10px;
  font-weight: 300;
  color: rgba(255,255,255,0.45);
  direction: ltr;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.si-type {
  font-family: 'Assistant', sans-serif;
  font-size: 10px;
  color: rgba(96, 165, 250, 0.7);
  flex-shrink: 0;
  margin-right: auto;
}

/* ── Welcome overlay ─────────────────────────────────────────────────────── */
#welcome {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  opacity: 0;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(4px);
}

#welcome.visible {
  opacity: 1;
}

#welcome-box {
  background: rgba(4, 10, 28, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 36px 40px 32px;
  max-width: 560px;
  width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
}

#welcome-logo {
  font-size: 48px;
  line-height: 1;
}

#welcome-title {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  margin: 0;
  line-height: 1.3;
}

#welcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  width: 100%;
}

.wc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.wc-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.wc-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

.wc-text b {
  color: #fff;
  font-weight: 600;
}

#welcome-btn {
  margin-top: 4px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.08));
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 24px;
  color: #fff;
  font-family: 'Assistant', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 11px 40px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

#welcome-btn:hover {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.35), rgba(96, 165, 250, 0.15));
  border-color: rgba(96, 165, 250, 0.7);
  transform: translateY(-1px);
}

#welcome-note {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 220, 100, 0.9);
  background: rgba(255, 220, 100, 0.06);
  border: 1px solid rgba(255, 220, 100, 0.15);
  border-radius: 10px;
  padding: 9px 16px;
  text-align: center;
  line-height: 1.5;
  width: 100%;
  box-sizing: border-box;
  animation: note-blink 1.2s ease-in-out infinite;
}

@keyframes note-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

#welcome-no-show {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  user-select: none;
}

#welcome-no-show input[type="checkbox"] {
  accent-color: #60a5fa;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

#welcome-no-show:hover {
  color: rgba(255, 255, 255, 0.7);
}

#welcome-credit {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 0.04em;
}

/* ── Trivia panel ─────────────────────────────────────────────────────────── */
#trivia-panel {
  position: fixed;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 70;
  background: rgba(4, 8, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 18px 22px 20px;
  width: 420px;
  max-width: calc(100vw - 120px);
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  direction: rtl;
  font-family: 'Assistant', sans-serif;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

#trivia-panel.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

#trivia-close {
  position: absolute;
  top: 10px;
  left: 12px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.15s;
}

#trivia-close:hover {
  color: rgba(255, 255, 255, 0.8);
}

#trivia-badge {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(96, 165, 250, 0.65);
  margin-bottom: 5px;
  text-transform: uppercase;
}

#trivia-name-heb {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 2px;
}

#trivia-name-lat {
  font-family: 'Roboto Slab', serif;
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.35);
  direction: ltr;
  text-align: right;
  margin-bottom: 12px;
}

#trivia-text {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.78);
  direction: rtl;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 4px;
}

/* ── Moon data panel (desktop only, top-left) ────────────────────────────── */
#moon-data-panel {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  background: rgba(5, 10, 20, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  pointer-events: none;
  min-width: 148px;
}

.mdp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mdp-icon {
  font-size: 13px;
  width: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.mdp-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.06em;
  flex: 1;
}

.mdp-value {
  font-family: 'Roboto Slab', serif;
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.mdp-sub {
  font-size: 9px;
  font-family: 'Assistant', sans-serif;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.04em;
}

.mdp-row-date {
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 2px;
}

.mdp-row-date .mdp-value {
  font-family: 'Assistant', sans-serif;
  font-weight: 400;
}

.mdp-accuracy-note {
  font-family: 'Assistant', sans-serif;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 2px;
  direction: rtl;
}

body.mobile #moon-data-panel { display: none; }

#moon-city-select,
#moon-city-select-mobile {
  background: #0d1520;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.65);
  font-family: 'Assistant', sans-serif;
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  text-align: left;
  direction: ltr;
}

#moon-city-select:focus,
#moon-city-select-mobile:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.4);
}

#moon-city-select option,
#moon-city-select-mobile option {
  background: #0d1520;
  color: rgba(255, 255, 255, 0.75);
  direction: rtl;
  text-align: right;
}
