* { box-sizing: border-box; margin: 0; padding: 0; }

#status-pills {
  position: fixed;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 200;
}

#panel-stack {
  position: fixed;
  bottom: 5.5rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 0.3rem;
  z-index: 100;
  pointer-events: none;
  /* A fixed height (not max-height) is what makes flex-wrap kick in: once a
     column of panels fills this height, the next panel starts a new column
     to the right instead of overflowing past the compass — scales to any
     number of simultaneously open panels without needing a scrollbar (which
     pointer-events:none would make unusable anyway) or ad-hoc per-panel
     compacting. */
  height: calc(65vh - 4rem);
}

/* The two cross-section sub-toggles. js/scale.js moves this container into
   #panel-stack, directly after the Earth scale panel, so it docks under that
   panel's content and tracks it — instead of sitting at a fixed top:50% where
   a tall scale panel would render on top of it. Shown only while Scale is on
   (js/app.js onScale). */
#scale-area-toggles {
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  pointer-events: auto;
}

#scale-area-toggles .vr-label { display: inline; }

/* Oblateness sub-toggle + slider, docked under the info box (js/oblateness.js). */
#oblateness-subtoggle { pointer-events: auto; }
#oblateness-subtoggle .vr-label { display: inline; }

/* Geomagnetic "Show aurora" sub-toggle, docked under its info box (js/geomagnetic.js). */
#geomag-aurora-toggle { pointer-events: auto; }
#geomag-aurora-toggle .vr-label { display: inline; }

@media (max-width: 700px) {
  /* The info box's own inline min/max-width would otherwise eat most of a
     phone screen and sit under the side-by-side globes. */
  #oblateness-info, #geomag-info { min-width: 0 !important; max-width: 15rem !important; }
}

.oblateness-slider {
  width: 100%;
  accent-color: #58a6ff;
  cursor: pointer;
}

body {
  background: #000;
  font-family: system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── Detailed map ── */
#detailed-map {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 1;
}
#detailed-map-spinner {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  pointer-events: none;
}
.spinner-ring {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: detailed-map-spin 0.8s linear infinite;
}
@keyframes detailed-map-spin {
  to { transform: rotate(360deg); }
}
/* Earthquake pulse marker (2D detailed map) -- see js/detailed-map-earthquakes.js */
.eq-pulse-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}
.eq-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border-width: 2px;
  border-style: solid;
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 0.9;
  animation: eq-pulse 2.5s ease-out infinite;
  pointer-events: none;
}
.eq-pulse-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.5);
  transform: translate(-50%, -50%);
}
@keyframes eq-pulse {
  0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(5); opacity: 0; }
}
/* ── Watermark ── */
#watermark {
  position: fixed;
  bottom: 8px;
  left: 70%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
  user-select: none;
  z-index: 50;
}

/* ── Compass ── */
#compass {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: border-color 0.2s;
  z-index: 100;
}

#compass:hover { border-color: rgba(255,255,255,0.6); }

#compass-needle {
  position: absolute;
  width: 3px;
  height: 34px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #ff4444 50%, #888 50%);
  transform-origin: center center;
}

.compass-n {
  position: absolute;
  top: 3px;
  font-size: 9px;
  font-weight: bold;
  color: #ff4444;
  pointer-events: none;
}

.compass-s {
  position: absolute;
  bottom: 3px;
  font-size: 9px;
  color: #666;
  pointer-events: none;
}

/* ── Toggle groups ── */
#toggle-groups {
  position: absolute;
  top: 6.3rem;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 100;
}

#toggle-groups::-webkit-scrollbar {
  display: none;
}

#toggle-groups.collapsed {
  display: none;
}

.toggle-group {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-group-label {
  font-size: 10px;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 4px;
}

.toggle-group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.toggle-group-grid .float-toggle:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.toggle-group-grid .float-toggle {
  padding: 8px 10px;
  gap: 6px;
}

.float-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: border-color 0.2s;
  color: #8b949e;
  font-size: 15px;
}

.float-toggle:hover { border-color: rgba(255,255,255,0.55); }

.toggle-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.float-toggle:hover .toggle-icon { transform: scale(1.15); }

.toggle-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid #58a6ff;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

.float-toggle:hover .toggle-icon::after {
  animation: toggle-pulse-ring 1.3s ease-out infinite;
}

@keyframes toggle-pulse-ring {
  0%   { opacity: 1;   transform: scale(0.6); }
  100% { opacity: 0;   transform: scale(2.2); }
}

.float-toggle.active {
  border-color: rgba(88,166,255,0.6);
  color: #c9d1d9;
}

/* Applied to every toggle except spacetime-toggle itself while Spacetime
   mode is active -- at Spacetime's solar-system-scale camera distance,
   every other toggle's effect (surface overlays, ISS, satellites,
   meteors, Kármán line, etc.) is an invisible speck, so further clicks
   would do something with no visible effect. pointer-events:none makes
   the click itself inert (no JS click-guard needed anywhere else). */
.float-toggle.disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
}

.toggle-track {
  width: 38px;
  height: 22px;
  background: #30363d;
  border-radius: 11px;
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b949e;
  transition: transform 0.25s, background 0.25s;
}

.float-toggle.active .toggle-track { background: #58a6ff; }
.float-toggle.active .toggle-thumb {
  transform: translateX(16px);
  background: #fff;
}

.vr-label {
  display: none;
  font-size: 11px;
  color: #c9d1d9;
  white-space: nowrap;
}
body.vr-active .vr-label { display: inline; }
body.vr-active .toggle-group-grid { grid-template-columns: 1fr; }
body.vr-active .toggle-group-grid .float-toggle:last-child:nth-child(odd) { grid-column: auto; }

/* The default light scrollbar clashes with these boxes' dark background --
   darkened to match rather than standing out. */
#sun-oscillation-info-box, #spacetime-scale-box { scrollbar-color: #555 #111; }
#sun-oscillation-info-box::-webkit-scrollbar, #spacetime-scale-box::-webkit-scrollbar { width: 8px; }
#sun-oscillation-info-box::-webkit-scrollbar-track, #spacetime-scale-box::-webkit-scrollbar-track { background: #111; border-radius: 4px; }
#sun-oscillation-info-box::-webkit-scrollbar-thumb, #spacetime-scale-box::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }
#sun-oscillation-info-box::-webkit-scrollbar-thumb:hover, #spacetime-scale-box::-webkit-scrollbar-thumb:hover { background: #777; }

/* Dock chevron (js/dock-toggle.js) -- hidden above the mobile breakpoint,
   matching js/panel-collapse.js's own MOBILE_BREAKPOINT (700). Above that
   width panels have room and this control would just be visual noise. */
.dock-chevron { display: none; }

@media (max-width: 700px) {
  /* Dock the info panels along the bottom edge instead of filling the tall
     left column -- on a phone that column sits right on top of the centred
     globe. height:auto drops the flex-wrap (no room for a 2nd column on a
     phone anyway); panels just stack upward from the bottom. */
  #panel-stack {
    height: auto;
    bottom: 1.25rem;
  }

  .dockable { position: relative; }
  .dock-chevron {
    display: block;
    position: absolute;
    top: 0.4rem;
    right: 0.6rem;
    background: none;
    border: none;
    color: #aaa;
    font: 16px system-ui, sans-serif;
    line-height: 1;
    cursor: pointer;
  }
  .dock-chevron:hover { color: #fff; }
  /* Collapses the panel down to just the chevron button itself, in place --
     same idea as js/panel-collapse.js's own hamburger toggle for the whole
     menu grid (2.2rem square), just per-panel. Every panel this attaches to
     sets its own inline min-width/padding, hence the !important pile-up. */
  .dockable.collapsed {
    width: 2.2rem !important;
    min-width: 2.2rem !important;
    max-width: 2.2rem !important;
    height: 2.2rem !important;
    min-height: 2.2rem !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .dockable.collapsed > *:not(.dock-chevron) { display: none !important; }
  .dockable.collapsed .dock-chevron {
    position: static;
    display: block !important;
  }
}
