/* SolarSystemExplorer — Cribbed from geo/body explorer for consistency. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #050616; color: #e6e8f0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100%; }

/* ===== Topbar ===== */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: #0b0f1f;
  border-bottom: 1px solid #1c2236;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.app-brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.app-logo { width: 28px; height: 28px; object-fit: contain; }
.app-title { font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }
.hint { font-size: 12px; color: #8e92a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-sep { width: 1px; height: 22px; background: #2a3148; margin: 0 4px; }
.action-btn {
  background: #161b2e; color: #cfd3e5;
  border: 1px solid #2a3148; border-radius: 5px;
  padding: 5px 10px; font-size: 12px; cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.action-btn:hover { background: #1d2440; }
.action-btn.toggle { color: #8a90a8; }
.action-btn.toggle.on { background: #1d3a5a; color: #e6f0ff; border-color: #3a78b4; }

/* ===== Canvas ===== */
#canvas-area { position: relative; flex: 1 1 auto; min-height: 0; background: #050616; }
#scene-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.loading {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 14px; color: #8e92a8;
}

.hover-tip {
  position: absolute; pointer-events: none;
  background: rgba(20, 24, 40, 0.92); border: 1px solid #2a3148; color: #e6e8f0;
  padding: 4px 7px; border-radius: 4px; font-size: 12px;
  transform: translate(10px, 10px);
  z-index: 5;
}
.hover-tip .tip-name { font-weight: 600; }
.hover-tip .tip-sub  { color: #8e92a8; font-size: 11px; margin-top: 1px; }

/* ===== Floating panels ===== */
.floating-panel {
  position: absolute; z-index: 4;
  background: rgba(12, 16, 30, 0.94);
  border: 1px solid #2a3148; border-radius: 7px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 80px);
}
/* HTML [hidden] would normally apply display:none, but the class rule above
   wins on specificity — restore the hide behaviour explicitly. */
.floating-panel[hidden] { display: none; }
.panel-header {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px; background: #131a30;
  border-bottom: 1px solid #2a3148;
  border-radius: 7px 7px 0 0; cursor: grab;
  user-select: none;
}
.panel-header-title { font-size: 12px; font-weight: 600; color: #cfd3e5; }
.panel-header-spacer { flex: 1 1 auto; }
.panel-header-btn {
  background: transparent; border: 0; color: #8e92a8;
  font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 5px;
}
.panel-header-btn:hover { color: #fff; }
.panel-header-search {
  background: #0b0f1f; border: 1px solid #2a3148; color: #cfd3e5;
  border-radius: 4px; padding: 3px 7px; font-size: 11px; width: 110px;
}
.panel-body { padding: 9px 11px; overflow-y: auto; }

/* Default positions */
.overlays-panel { top: 56px; right: 12px; width: 248px; }
.info-panel { top: 56px; left: 12px; width: 440px; max-height: calc(100vh - 160px); }
.library-panel { top: 56px; left: 12px; width: 268px; max-height: calc(100vh - 80px); }
.quiz-panel {
  width: 480px; min-width: 320px; min-height: 240px;
  max-height: calc(100vh - 200px);
  top: auto; bottom: 88px;
  left: calc(50% - 240px); right: auto;
}

/* When the bodies (library) panel is visible, info pops in next to it. */
.info-panel { left: 296px; }

/* When the bodies panel is closed, info expands into the freed space. */
#canvas-area:has(#library-panel[hidden]) .info-panel {
  left: 12px;
  width: 880px;
}

/* ===== Overlay checkboxes ===== */
.panel-sub-title {
  font-size: 10px; color: #6b7090; text-transform: uppercase; letter-spacing: 0.7px;
  margin: 10px 0 4px;
}
.panel-sub-title:first-child { margin-top: 0; }
.ov-check {
  display: flex; align-items: center; gap: 7px; padding: 3px 0;
  font-size: 12px; color: #cfd3e5; cursor: pointer;
}
.ov-check input { margin: 0; }

/* ===== Library accordion ===== */
.country-library { display: flex; flex-direction: column; gap: 1px; }
.solar-accordion { display: flex; flex-direction: column; gap: 2px; }
.lib-cat-section { display: flex; flex-direction: column; }
.lib-cat-head {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  background: transparent; border: none;
  color: #8e92a8;
  padding: 5px 6px;
  font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.7px;
  cursor: pointer;
  text-align: left;
}
.lib-cat-head:hover { color: #cfd3e5; }
.lib-cat-caret {
  display: inline-block;
  transition: transform 150ms;
  color: #6b7090;
  font-size: 9px;
}
.lib-cat-section.open .lib-cat-caret { transform: rotate(90deg); }
.lib-cat-name { flex: 1 1 auto; }
.lib-cat-count {
  color: #6b7090; font-size: 10px;
  background: #161b2e; border: 1px solid #2a3148;
  padding: 1px 7px; border-radius: 8px;
}
.lib-cat-body { display: flex; flex-direction: column; gap: 1px; padding-left: 4px; }
.lib-cat-body[hidden] { display: none; }
.library-row {
  padding: 5px 8px; border-radius: 5px; border: 1px solid transparent;
  cursor: pointer; transition: background 120ms, border-color 120ms;
}
.library-row:hover { background: rgba(68,170,255,0.07); border-color: rgba(68,170,255,0.25); }
.library-row.selected {
  background: #1f3a5a; border-color: #3a78b4;
  border-left: 3px solid #66bbff;
}
.library-row.selected .library-name { color: #fff; font-weight: 700; }
.library-name { font-size: 12.5px; color: #e6e8f0; }
.library-sub  { font-size: 10.5px; color: #8e92a8; margin-top: 1px; }
.library-moon { padding-left: 18px; }
.lib-moon-wrap { margin-top: 2px; margin-bottom: 4px; }

/* ===== Info card ===== */
.info-empty { color: #8e92a8; font-size: 12px; font-style: italic; }
.info-hero { margin-bottom: 8px; }
.info-hero-title { font-size: 18px; font-weight: 700; color: #fff; }
.info-hero-sub { font-size: 12px; color: #8e92a8; font-style: italic; }
.info-hero-kind {
  display: inline-block; margin-top: 3px;
  font-size: 10px; color: #66bbff; background: rgba(102,187,255,0.10);
  border: 1px solid rgba(102,187,255,0.30);
  padding: 2px 7px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.6px;
}
.info-summary { font-size: 12.5px; color: #cfd3e5; line-height: 1.45; margin: 6px 0 10px; }
.info-grid { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; }
.info-stat {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11.5px; padding: 3px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.info-stat-label { color: #8e92a8; }
.info-stat-value { color: #e6e8f0; text-align: right; }
.info-section-title {
  font-size: 11px; color: #6b7090; text-transform: uppercase; letter-spacing: 0.7px;
  margin: 12px 0 5px;
}
.info-facts, .info-missions { margin: 0 0 4px 16px; padding: 0; }
.info-facts li, .info-missions li { font-size: 12px; color: #cfd3e5; margin: 3px 0; line-height: 1.4; }
.info-moons { display: flex; flex-wrap: wrap; gap: 4px; }
.info-moon-chip {
  background: #1a2238; color: #cfe; border: 1px solid #3a4868;
  border-radius: 4px; font-size: 11px; padding: 3px 7px; cursor: pointer;
}
.info-moon-chip:hover { background: #233055; border-color: #4a6088; }

/* Info mini 3D preview */
.info-3d-mount {
  width: 100%; height: 180px;
  background: radial-gradient(ellipse at center, #0a1024 0%, #050616 100%);
  border-radius: 6px; margin-bottom: 10px; overflow: hidden;
  border: 1px solid #1c2236;
}

/* Feature chips list */
.info-features { display: flex; flex-direction: column; gap: 3px; }
.info-feature-chip {
  background: #1a2238; color: #e6e8f0; border: 1px solid #3a4868;
  border-radius: 4px; font-size: 11.5px; padding: 5px 8px; cursor: pointer;
  text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.info-feature-chip:hover { background: #233055; border-color: #4a6088; }
.info-feature-chip-type {
  font-size: 10px; color: #8a90a8;
  background: rgba(120,160,220,0.08); border: 1px solid rgba(120,160,220,0.2);
  padding: 1px 6px; border-radius: 3px; text-transform: lowercase; letter-spacing: 0.3px;
}

/* Selected feature card inside info panel */
.info-feature-card {
  background: rgba(50, 40, 16, 0.18);
  border: 1px solid rgba(255, 200, 100, 0.20);
  border-radius: 6px; padding: 8px 10px; margin: 8px 0 10px;
}
.info-feature-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.info-feature-name { font-size: 14px; font-weight: 600; color: #ffe5a0; }
.info-feature-type {
  font-size: 10px; color: #ffce6a; text-transform: uppercase; letter-spacing: 0.6px;
  background: rgba(255, 200, 100, 0.1); border: 1px solid rgba(255, 200, 100, 0.3);
  padding: 2px 6px; border-radius: 3px;
}
.info-feature-summary { font-size: 12px; color: #cfd3e5; line-height: 1.45; margin: 6px 0 4px; }
.info-feature-image {
  margin: 8px 0 4px;
  border: 1px solid rgba(255, 200, 100, 0.20);
  border-radius: 5px; overflow: hidden;
  background: #050616;
}
.info-feature-image img {
  display: block; width: 100%; height: auto; max-height: 260px; object-fit: cover;
}
.info-feature-caption {
  font-size: 11px; color: #8e92a8; font-style: italic;
  padding: 5px 8px;
  border-top: 1px solid rgba(255, 200, 100, 0.10);
}
.info-feature-details { font-size: 12px; color: #cfd3e5; line-height: 1.45; margin: 6px 0 4px; }
.info-feature-wiki {
  display: inline-block; margin-top: 6px;
  font-size: 11px; color: #66bbff; text-decoration: none;
}
.info-feature-wiki:hover { text-decoration: underline; }
.info-back-btn {
  background: #1a2238; color: #cfd3e5; border: 1px solid #3a4868;
  border-radius: 4px; font-size: 11px; padding: 4px 9px; cursor: pointer;
  margin-top: 6px;
}
.info-back-btn:hover { background: #233055; border-color: #4a6088; }

/* ===== Timebar ===== */
.timebar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: rgba(12, 16, 30, 0.94);
  border: 1px solid #2a3148; border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  padding: 8px 12px;
  z-index: 4;
  max-width: calc(100vw - 32px);
}
.tb-btn {
  background: #161b2e; color: #cfd3e5;
  border: 1px solid #2a3148; border-radius: 5px;
  padding: 4px 10px; font-size: 13px; line-height: 1; cursor: pointer;
  transition: background 120ms, border-color 120ms;
  min-width: 34px;
}
.tb-btn:hover { background: #1d2440; border-color: #3a4868; }
.tb-btn-sm { padding: 3px 8px; font-size: 11px; min-width: 0; }
.tb-group { display: flex; align-items: center; gap: 8px; }
.tb-group-wide { flex: 1 1 auto; min-width: 240px; }
.tb-label { font-size: 11px; color: #8e92a8; text-transform: uppercase; letter-spacing: 0.6px; }
.tb-range { -webkit-appearance: none; appearance: none; height: 4px; background: #2a3148; border-radius: 2px; outline: none; width: 160px; }
.tb-group-wide .tb-range { width: 100%; min-width: 180px; }
.tb-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: #66bbff; border: 1px solid #1d3a5a; cursor: pointer;
}
.tb-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #66bbff; border: 1px solid #1d3a5a; cursor: pointer;
}
.tb-readout {
  font-size: 12px; color: #e6e8f0; font-variant-numeric: tabular-nums;
  min-width: 70px; text-align: right;
}

/* Label checkboxes locked while the quiz is open (they'd reveal answers). */
.ov-check.quiz-disabled { opacity: 0.45; cursor: not-allowed; }
.ov-check.quiz-disabled input { cursor: not-allowed; }

/* ===== Quiz ===== */
.quiz-body { display: flex; flex-direction: column; gap: 11px; }

.quiz-home { display: flex; flex-direction: column; gap: 10px; }
.quiz-title { font-size: 16px; font-weight: 600; color: #fff; }
.quiz-sub   { font-size: 12.5px; color: #8e92a8; line-height: 1.45; }

.quiz-mode-list { display: flex; flex-direction: column; gap: 6px; }
.quiz-mode-btn {
  background: #161b2e; border: 1px solid #2a3148; color: #cfd3e5;
  border-radius: 6px; padding: 8px 11px; cursor: pointer;
  text-align: left; display: flex; flex-direction: column; gap: 2px;
}
.quiz-mode-btn:hover { background: #1d2440; border-color: #3a78b4; }
.quiz-mode-name { font-size: 13px; font-weight: 600; color: #e6f0ff; }
.quiz-mode-desc { font-size: 11px; color: #8e92a8; font-weight: 400; }

.quiz-status {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: #8e92a8;
}
.quiz-status strong { color: #cfd3e5; }

.quiz-q {
  background: rgba(10, 14, 30, 0.6);
  border-left: 3px solid #66bbff;
  border-radius: 4px;
  padding: 9px 11px;
  font-size: 13px; color: #fff; line-height: 1.45;
}
.quiz-q em { font-style: italic; color: #aaddff; font-weight: 400; }

.quiz-clues { margin: 0 0 0 18px; padding: 0; font-size: 12px; color: #cfd3e5; }
.quiz-clues li { margin: 2px 0; }

.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.quiz-choice {
  background: #1a2238; border: 1px solid #3a4868;
  color: #e6e8f0; border-radius: 6px;
  padding: 8px 10px; font-size: 12.5px;
  cursor: pointer; text-align: left;
}
.quiz-choice:hover  { background: #233055; border-color: #4a6088; }
.quiz-choice.correct { background: #1a3a1c; border-color: #4a8c52; color: #b6f9b6; }
.quiz-choice.wrong   { background: #3a1a1c; border-color: #8c4a52; color: #f9b6b6; }
.quiz-choice:disabled { cursor: default; }

.quiz-find-hint { font-size: 12px; color: #8eb7e0; font-style: italic; }

.quiz-feedback {
  min-height: 18px; font-size: 12px;
  padding: 6px 8px; border-radius: 4px;
  background: transparent; color: #cfd3e5;
}
.quiz-feedback.ok { background: rgba(20, 51, 31, 0.7); color: #b6f9b6; border-left: 3px solid #5aaa5a; }
.quiz-feedback.no { background: rgba(51, 17, 17, 0.7); color: #f9b6b6; border-left: 3px solid #aa5a5a; }

.quiz-controls { display: flex; gap: 8px; justify-content: flex-end; }
.quiz-btn {
  background: #161b2e; border: 1px solid #2a3148;
  color: #cfd3e5; border-radius: 5px;
  padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.quiz-btn:hover { background: #1d2440; border-color: #3a78b4; }
.quiz-btn.primary { background: #1d3a5a; border-color: #3a78b4; color: #e6f0ff; }
.quiz-btn.primary:hover { background: #244a72; }

.quiz-results { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.quiz-score   { font-size: 28px; font-weight: 700; color: #fff; }
.quiz-pct     { font-size: 16px; color: #8e92a8; font-weight: 400; }
.quiz-verdict { font-size: 13px; color: #cfd3e5; font-style: italic; }
