/* ── Mobile / tablet layout (active when body.mobile is set) ──────────────── */

/* Hide desktop-only panels */
body.mobile #slider-panel  { display: none; }
body.mobile #hint          { display: none; }
body.mobile #dev-panel     { display: none; }
body.mobile #zoom-display  { display: none; }
body.mobile #app-title     { display: none; }
body.mobile #moon-data-panel { display: none; }

/* ── Moon info button ─────────────────────────────────────────────────────── */
#moon-info-btn {
  display: none;
}

/* ── Mobile moon data panel ───────────────────────────────────────────────── */
#mobile-moon-panel {
  display: none;
}

body.mobile #mobile-moon-panel {
  position: fixed;
  bottom: 80px;
  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;
  display: none;
  flex-direction: column;
  gap: 7px;
  font-family: 'Assistant', sans-serif;
  direction: rtl;
  min-width: 160px;
  pointer-events: none;
}

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

/* Info panel: hidden by default, shown briefly on tap */
body.mobile #info-panel {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  bottom: 60px;
}
body.mobile #info-panel.tap-show {
  opacity: 1;
}

/* Trivia panel: full width, above drawer, scrollable */
body.mobile #trivia-panel {
  left: 10px;
  right: 10px;
  width: auto;
  bottom: 70px;
  transform: translateY(20px);
  max-width: none;
  max-height: 42vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.mobile #trivia-panel.visible {
  transform: translateY(0);
}
body.mobile #trivia-text {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding-bottom: 4px;
}

/* Measure panel: compact, bottom-left, away from top buttons */
body.mobile #measure-panel {
  top: auto;
  bottom: 60px;
  left: 10px;
  right: auto;
  width: auto;
  max-width: min(260px, calc(100vw - 24px));
  transform: none;
}

/* Orient button: below measure-btn in top-right cluster */
body.mobile #orient-btn {
  display: flex;
  position: fixed;
  top: 140px;
  right: 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: 18px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  bottom: auto;
  left: auto;
}

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

/* Orient popup: floats to the left of the button cluster */
body.mobile #mobile-orient-popup {
  position: fixed;
  top: 120px;
  right: 60px;
  z-index: 60;
  background: rgba(4, 8, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

body.mobile #mobile-orient-popup.open {
  display: flex;
}

/* Phase bar: move to top on mobile */
body.mobile #phase-bar {
  bottom: auto;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
}
body.mobile #darkness-wrap {
  bottom: auto;
  top: 116px;
  left: 50%;
  transform: translateX(-50%);
}

/* Search: 25% narrower on mobile */
body.mobile #search-wrap {
  width: calc((100vw - 100px) * 0.75);
  opacity: 1;
}

/* Float buttons: top-right cluster */
body.mobile #music-btn {
  top: 14px;
  right: 14px;
  bottom: auto;
  left: auto;
}
body.mobile #auto-rotate-btn {
  top: 56px;
  right: 14px;
  bottom: auto;
  left: auto;
}
body.mobile #measure-btn {
  top: 98px;
  right: 14px;
  bottom: auto;
  left: auto;
}
body.mobile #moon-info-btn {
  display: flex;
  position: fixed;
  top: 182px;
  right: 14px;
  bottom: auto;
  left: auto;
  z-index: 60;
  align-items: center;
  justify-content: center;
  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.55);
  font-style: normal;
  font-size: 16px;
  font-family: 'Bookerly', Georgia, serif;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

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

body.mobile #night-btn {
  position: fixed;
  top: 224px;
  right: 14px;
  bottom: auto;
  left: auto;
}

/* Labels: half size on mobile, generous tap padding */
body.mobile .moon-label .heb {
  font-size: calc(var(--label-size, 14) * 0.4px * var(--label-scale, 1));
  padding: 8px 6px;
}
body.mobile .moon-label .lat {
  font-size: calc(var(--label-size, 14) * 0.325px * var(--label-scale, 1));
}
body.mobile .moon-label .dot {
  width: 5px;
  height: 5px;
}

/* ── Desktop/mobile content switching ────────────────────────────────────── */
.mobile-only { display: none; }
body.mobile .mobile-only { display: inline; }
body.mobile .desktop-only { display: none; }

/* ── Welcome screen ───────────────────────────────────────────────────────── */
body.mobile #welcome-box {
  padding: 24px 20px 24px;
  gap: 14px;
  border-radius: 16px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile #welcome-logo {
  font-size: 36px;
}

body.mobile #welcome-title {
  font-size: 17px;
}


body.mobile #splash-subtitle {
  font-size: 21px;
}

body.mobile #splash-sub,
body.mobile #splash-version {
  font-size: 15px;
}

body.mobile #mobile-zoom {
  display: block;
  position: fixed;
  top: 32px;
  transform: translateY(-50%);
  left: 10px;
  z-index: 60;
  font-family: 'Roboto Slab', serif;
  font-size: 13px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  letter-spacing: 0.04em;
}

body.mobile #welcome-grid {
  grid-template-columns: 1fr;
  gap: 7px;
}

body.mobile .wc-item {
  padding: 7px 10px;
}

body.mobile .wc-text {
  font-size: 11px;
}


body.mobile #welcome-note {
  font-size: 13px;
}

body.mobile #welcome-btn {
  font-size: 15px;
  padding: 10px 32px;
  width: 100%;
}

/* Tighter Hebrew/Latin spacing on mobile */
body.mobile .moon-label .lat {
  margin-top: -5px;
}

/* ── Scope + filter row ───────────────────────────────────────────────────── */
#drawer-filter-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  direction: rtl;
}

#mobile-scope-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Filter panel inside drawer ───────────────────────────────────────────── */
body.mobile #filter-panel {
  position: static;
  transform: none;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 28px;
  direction: rtl;
  justify-content: start;
}

body.mobile .filter-title {
  grid-column: 1 / -1;
  text-align: right;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 2px;
}

/* Crater + sub-checkbox side by side in one grid cell */
body.mobile .filter-crater-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  direction: rtl;
}

body.mobile .filter-sub {
  padding-right: 0;
  font-size: 10px;
  white-space: nowrap;
}

/* ── Bottom drawer ────────────────────────────────────────────────────────── */
#mobile-drawer {
  display: none;
}

body.mobile #mobile-drawer {
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 65;
  background: rgba(4, 8, 22, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px 18px 0 0;
  transform: translateY(calc(100% - 48px));
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 72vh;
}

body.mobile #mobile-drawer.open {
  transform: translateY(0);
}

#drawer-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 8px;
  cursor: pointer;
  flex-shrink: 0;
  gap: 6px;
}

#drawer-handle-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
}

#drawer-handle-label {
  font-family: 'Assistant', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.08em;
}

#drawer-body {
  overflow-y: auto;
  padding: 12px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Drawer section headers */
.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-section-title {
  font-family: 'Assistant', sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  direction: rtl;
}

/* Horizontal slider rows inside drawer */
.drawer-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  direction: rtl;
}

.drawer-slider-row span {
  font-family: 'Assistant', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  min-width: 72px;
}

.drawer-slider-row input[type="range"] {
  flex: 1;
  height: 4px;
  accent-color: #60a5fa;
  cursor: pointer;
}

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

/* ── Drawer reset button ──────────────────────────────────────────────────── */
.drawer-reset-row {
  display: flex;
  direction: rtl;
  justify-content: flex-start;
}

#drawer-reset-btn {
  font-family: 'Assistant', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  letter-spacing: 0.04em;
}

#drawer-reset-btn:active {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
}
