/* ===== MyStuffDB · Solar System Explorer ===== */
:root {
  --bg: #05060d;
  --panel: rgba(14, 18, 34, 0.82);
  --panel-solid: #0e1222;
  --stroke: rgba(120, 150, 220, 0.22);
  --text: #e8edff;
  --muted: #9fb0d8;
  --accent: #5b8cff;
  --accent-2: #ffb84d;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #0a1030 0%, #05060d 60%, #02030a 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; touch-action: none; }

/* Cinematic vignette — darkens the corners, draws the eye to centre */
#vignette {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse 75% 75% at 50% 50%,
    rgba(0,0,0,0) 55%, rgba(0,0,0,0.28) 82%, rgba(0,0,0,0.62) 100%);
  mix-blend-mode: multiply;
}

/* ---- Brand ---- */
#brand {
  position: fixed; top: 18px; left: 22px; z-index: 20;
  pointer-events: none; user-select: none;
}
#brand h1 {
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: 0.3px;
  background: linear-gradient(90deg, #fff, #aac4ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 18px rgba(90, 140, 255, 0.25);
}
.brand__tag { font-size: 11.5px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }
.brand__home { display: inline-block; margin-bottom: 4px; font-size: 12px; color: var(--muted); text-decoration: none; transition: color .15s; }
.brand__home:hover { color: var(--accent); }

/* ---- Icon button ---- */
.icon-btn {
  position: fixed; top: 18px; right: 22px; z-index: 20;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--stroke); backdrop-filter: blur(10px);
  font-size: 18px; font-weight: 700; box-shadow: var(--shadow);
  transition: transform 0.15s, background 0.2s;
}
.icon-btn:hover { transform: scale(1.08); background: rgba(40, 52, 90, 0.9); }
#lib-btn { right: 70px; }   /* sits just left of the help button */

/* ---- Floating labels ---- */
#labels { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.label {
  position: absolute; left: 0; top: 0;
  pointer-events: auto;
  background: rgba(10, 14, 30, 0.55);
  border: 1px solid var(--stroke);
  color: var(--text); font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap;
  backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.05s linear;
  letter-spacing: 0.3px;
}
.label:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- Bottom dock ---- */
#dock {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--stroke);
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
  max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center;
}
.dock__group { display: flex; align-items: center; gap: 9px; }
.dock__group + .dock__group { border-left: 1px solid var(--stroke); padding-left: 18px; }
.dock__btn {
  width: 38px; height: 38px; border-radius: 10px; font-size: 15px;
  background: rgba(40, 52, 90, 0.6); border: 1px solid var(--stroke); color: var(--text);
  transition: background 0.15s, transform 0.1s;
}
.dock__btn:hover { background: var(--accent); transform: translateY(-1px); }
.dock__btn.paused { background: var(--accent-2); color: #1a1300; }

.dock__speed label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
#speed { width: 130px; accent-color: var(--accent); cursor: pointer; }
#speed-val { font-size: 12px; font-weight: 700; min-width: 46px; color: var(--accent-2); text-align: right; }

.dock__toggles { gap: 14px; }
.chk { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.chk input { accent-color: var(--accent); cursor: pointer; }

#goto {
  background: rgba(40, 52, 90, 0.6); color: var(--text);
  border: 1px solid var(--stroke); border-radius: 9px;
  padding: 8px 10px; font-size: 12.5px; cursor: pointer;
}
#goto option { background: var(--panel-solid); }

/* ---- Info panel ---- */
#info {
  position: fixed; top: 0; right: 0; z-index: 25;
  width: 380px; max-width: 92vw; height: 100%;
  background: var(--panel); border-left: 1px solid var(--stroke);
  backdrop-filter: blur(18px); box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
  padding: 26px 24px 40px; overflow-y: auto;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
#info.hidden { transform: translateX(105%); }
#info-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(40, 52, 90, 0.6); border: 1px solid var(--stroke);
  color: var(--text); font-size: 20px; line-height: 1;
}
#info-close:hover { background: #c0392b; }
#info-head h2 { margin: 6px 0 2px; font-size: 28px; }
#info-sub { margin: 0 0 18px; color: var(--accent-2); font-size: 13px; font-weight: 600; }

#info-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.stat {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke);
  border-radius: 10px; padding: 9px 11px; display: flex; flex-direction: column; gap: 3px;
}
.stat span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.stat b { font-size: 13px; font-weight: 600; }

#info-desc { font-size: 14px; line-height: 1.6; color: #dbe4ff; margin: 0 0 18px; }
#info-facts h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); margin: 0 0 8px; }
#info-facts ul { margin: 0; padding-left: 18px; }
#info-facts li { font-size: 13px; line-height: 1.55; color: #cdd8f5; margin-bottom: 7px; }

/* ---- Help modal ---- */
.modal {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(2, 4, 12, 0.7); backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal__box {
  position: relative; width: 460px; max-width: 92vw;
  background: var(--panel-solid); border: 1px solid var(--stroke);
  border-radius: 18px; padding: 30px 30px 26px; box-shadow: var(--shadow);
}
.modal__box h2 { margin: 0 0 16px; font-size: 22px; }
.modal__box ul { margin: 0 0 16px; padding-left: 20px; }
.modal__box li { font-size: 14px; line-height: 1.7; color: #d3ddf8; }
.modal__note {
  font-size: 13px; line-height: 1.6; color: var(--muted);
  background: rgba(91, 140, 255, 0.08); border: 1px solid var(--stroke);
  border-radius: 10px; padding: 12px 14px; margin: 0 0 18px;
}
#help-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px;
  border-radius: 50%; background: rgba(40, 52, 90, 0.6); border: 1px solid var(--stroke);
  color: var(--text); font-size: 18px;
}
.btn-primary {
  width: 100%; padding: 12px; border-radius: 11px; border: none;
  background: linear-gradient(90deg, var(--accent), #7aa2ff); color: #fff;
  font-size: 15px; font-weight: 700; transition: filter 0.15s, transform 0.1s;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ---- "Read the full chapter" button in the side panel ---- */
.btn-read { width: 100%; margin: 4px 0 22px; padding: 11px; font-size: 14px; }

/* ---- Library (contents) ---- */
.library__box { width: 760px; max-width: 94vw; max-height: 86vh; overflow-y: auto; }
.library__intro { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.library__group {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--accent); margin: 20px 0 10px; border-bottom: 1px solid var(--stroke); padding-bottom: 6px;
}
.library__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lib-card {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 12px 13px; color: var(--text);
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.lib-card:hover { transform: translateY(-2px); background: rgba(91, 140, 255, 0.14); border-color: var(--accent); }
.lib-card .ic { font-size: 22px; }
.lib-card .nm { font-size: 13.5px; font-weight: 700; }
.lib-card .ds { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* ---- Reader (full chapter) ---- */
.reader {
  position: fixed; inset: 0; z-index: 45;
  background: linear-gradient(180deg, rgba(6, 9, 20, 0.97), rgba(3, 5, 12, 0.98));
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  transition: opacity 0.3s, transform 0.3s;
}
.reader.hidden { opacity: 0; pointer-events: none; transform: translateY(12px); }
.reader__bar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; border-bottom: 1px solid var(--stroke);
  background: rgba(10, 14, 30, 0.7); flex-shrink: 0;
}
.reader__bar #reader-title { flex: 1; font-weight: 700; font-size: 15px; letter-spacing: 0.3px; }
.reader__bar button {
  background: rgba(40, 52, 90, 0.6); border: 1px solid var(--stroke); color: var(--text);
  border-radius: 9px; padding: 7px 12px; font-size: 14px;
}
.reader__bar #reader-close { width: 36px; padding: 7px 0; font-size: 20px; line-height: 1; }
.reader__bar button:hover { background: var(--accent); }
.reader__body { overflow-y: auto; padding: 34px 24px 80px; }
.article { max-width: 760px; margin: 0 auto; }

.article__hero { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.article__hero .icon { font-size: 34px; }
.article h1 { font-size: 34px; margin: 0; line-height: 1.1; }
.article__sub { color: var(--accent-2); font-weight: 600; font-size: 14px; margin: 4px 0 24px; }
.article h2 {
  font-size: 21px; margin: 30px 0 12px; color: #fff;
  border-left: 3px solid var(--accent); padding-left: 12px;
}
.article p { font-size: 15.5px; line-height: 1.75; color: #d7e1fb; margin: 0 0 14px; }
.article__cta {
  display: inline-flex; align-items: center; gap: 8px; margin: 6px 0 10px;
  padding: 10px 18px; border-radius: 11px; border: none; cursor: pointer;
  background: linear-gradient(90deg, var(--accent), #7aa2ff); color: #fff; font-weight: 700; font-size: 14px;
}
.article__cta:hover { filter: brightness(1.1); }

/* fact box */
.article__facts {
  background: rgba(91, 140, 255, 0.08); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 16px 20px; margin: 20px 0;
}
.article__facts h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); }
.article__facts ul { margin: 0; padding-left: 18px; }
.article__facts li { font-size: 14px; line-height: 1.6; color: #cdd8f5; margin-bottom: 6px; }

/* quick stats grid in article */
.article__stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; margin: 8px 0 22px; }

/* moons + timeline */
.body-list { list-style: none; padding: 0; margin: 0 0 10px; }
.body-list li { padding: 9px 0; border-bottom: 1px solid var(--stroke); font-size: 14.5px; }
.body-list li b { color: #fff; }
.body-list li span { color: var(--muted); }
.timeline { margin: 4px 0 10px; border-left: 2px solid var(--stroke); padding-left: 18px; }
.timeline .ev { position: relative; padding: 0 0 16px; }
.timeline .ev::before {
  content: ''; position: absolute; left: -25px; top: 4px;
  width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.timeline .yr { font-weight: 700; color: var(--accent-2); font-size: 14px; }
.timeline .nm { font-weight: 700; font-size: 14.5px; }
.timeline .ds { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ---- Quiz ---- */
.quiz { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--stroke); border-radius: 14px; padding: 22px; margin-top: 26px; }
.quiz__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.quiz__head h2 { border: none; padding: 0; margin: 0; }
.quiz__score { font-size: 13px; font-weight: 700; color: var(--accent-2); }
.quiz__q { margin: 18px 0 0; }
.quiz__q > p { font-weight: 600; font-size: 15px; margin: 0 0 10px; color: #eaf0ff; }
.quiz__opts { display: grid; gap: 8px; }
.opt {
  text-align: left; padding: 11px 14px; border-radius: 10px; font-size: 14px;
  background: rgba(40, 52, 90, 0.4); border: 1px solid var(--stroke); color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.opt:hover:not(:disabled) { background: rgba(91, 140, 255, 0.18); border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt.correct { background: rgba(46, 160, 90, 0.32); border-color: #38c172; }
.opt.wrong { background: rgba(192, 57, 43, 0.3); border-color: #e74c3c; }
.quiz__why {
  margin: 9px 0 0; font-size: 13.5px; line-height: 1.55; color: #cdd8f5;
  background: rgba(91, 140, 255, 0.08); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 9px 12px; display: none;
}
.quiz__why.show { display: block; }

/* glossary */
.glossary dt { font-weight: 700; color: #fff; font-size: 15px; margin-top: 16px; }
.glossary dd { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: #cdd8f5; }

@media (max-width: 720px) {
  .article h1 { font-size: 26px; }
  .reader__body { padding: 22px 16px 70px; }
}

/* ---- Loader ---- */
#loader {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, #0a1030, #02030a);
  transition: opacity 0.6s; gap: 0;
}
#loader.done { opacity: 0; pointer-events: none; }
.loader__orbit {
  width: 90px; height: 90px; border: 2px solid rgba(120, 150, 220, 0.2);
  border-radius: 50%; position: relative; margin-bottom: 26px;
  animation: spin 2.4s linear infinite;
}
.loader__orbit span {
  position: absolute; top: -7px; left: 50%; width: 13px; height: 13px;
  margin-left: -6px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 16px var(--accent-2);
}
#loader-text { color: var(--muted); font-size: 14px; letter-spacing: 0.5px; margin: 0 0 16px; }
.loader__bar { width: 220px; height: 4px; border-radius: 4px; background: rgba(120, 150, 220, 0.15); overflow: hidden; }
#loader-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.3s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Mobile ---- */
@media (max-width: 720px) {
  #brand h1 { font-size: 17px; }
  .brand__tag { display: none; }
  #dock { gap: 10px; padding: 9px 12px; bottom: 10px; }
  .dock__group + .dock__group { padding-left: 10px; }
  .dock__toggles { width: 100%; justify-content: center; border-left: none; padding-left: 0; }
  #speed { width: 90px; }
  #info { width: 100%; }
}
