/* hub.css — the Mission Map, "Space Route" direction (Code Lab Map
   Explorations, option 1a): deep-space navy, worlds as galaxy sectors,
   levels as planets on a dashed star-route. The editor (style.css) shares
   the dark family now — entering a level is flying down to the planet. */

@font-face {
  font-family: 'Fredoka';
  src: url('vendor/fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('vendor/fonts/nunito-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --space: #141736;          /* deep space */
  --panel: #1b1f45;          /* raised cards */
  --ink: #ffffff;
  --muted: #a9a4e8;          /* lavender text */
  --faint: #c9c5f2;
  --border: rgba(255, 255, 255, 0.14);
  --chipbg: rgba(255, 255, 255, 0.08);

  --purple: #5b4fd8;         /* logo / brand */
  --purple-deep: #3d33a8;
  --gold: #ffd44d;           /* current mission / stars */
  --route: #8b83e8;          /* dashed route */
  --go: #2fae6f;             /* done planets / start buttons */
  --go-hover: #249159;
  --planet-current: #6a5cf0;
  --planet-current-crater: #5546d6;
  --planet-current-halo: #c9c2ff;
  --planet-done-ring: #8fe0b8;
  --planet-locked: #3a3d63;
  --planet-locked-crater: #2e3152;
  --planet-locked-ring: #565a8c;
  --planet-far: #2e3152;

  /* per-world accents for the detail card (bright-on-dark) */
  --w1: #a78bfa; --w2: #38d9f5; --w3: #4ade80; --w4: #fbbf24;

  /* privacy page (shares this sheet) */
  --text: #e9ecfb;
  --accent: #38d9f5;

  --display: 'Fredoka', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
  background-color: var(--space);
  /* starfield: two repeating white layers + one sparse gold layer */
  background-image:
    radial-gradient(1.6px 1.6px at 22px 34px, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 180px 140px, rgba(255, 255, 255, 0.85) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 120px 250px, rgba(255, 255, 255, 0.7) 50%, transparent 51%),
    radial-gradient(2px 2px at 260px 60px, rgba(255, 212, 77, 0.9) 50%, transparent 51%);
  background-size: 310px 290px, 270px 310px, 330px 350px, 520px 480px;
}
/* nebula glows floating behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 420px 300px at 12% 8%, rgba(91, 79, 216, 0.22), transparent 70%),
    radial-gradient(ellipse 520px 360px at 88% 78%, rgba(42, 157, 110, 0.16), transparent 70%),
    radial-gradient(ellipse 360px 220px at 72% 12%, rgba(216, 79, 174, 0.13), transparent 70%);
}

.wrap { max-width: 780px; margin: 0 auto; padding: 26px 18px 60px; }

/* ---------- header: logo tile + title + progress pill ---------- */

.lab-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
#mascot {
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  background: var(--purple);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--purple-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
#mascot svg { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  #mascot svg { animation: bob 3.2s ease-in-out infinite; }
  @keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
}
.head-text { flex: 1; min-width: 220px; }
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: 0.02em;
  margin: 0;
  color: #fff;
}
.sub { color: var(--muted); margin: 2px 0 4px; font-size: 14.5px; font-weight: 600; }
#progress-line { color: var(--faint); font-size: 13px; font-weight: 700; margin: 0; }

.progress-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--chipbg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px;
}
.progress-pill .stars {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  color: var(--gold);
  white-space: nowrap;
}
.progress-pill .pill-sub { font-size: 12.5px; color: var(--faint); font-weight: 700; white-space: nowrap; }

/* ---------- world sectors ---------- */

.world {
  position: relative;
  padding: 10px 4px 6px;
  margin-bottom: 30px;
}
.world-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.sector-chip {
  font-family: var(--display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--space);
  background: var(--gold);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.world-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 25px;
  margin: 0;
  color: #fff;
}
.world-head p { margin: 0 0 4px; color: var(--muted); font-size: 13.5px; font-weight: 600; flex-basis: 100%; }

/* Season 2 teaser sector: dim and clearly "not yet" — the paywall is
   announced here on day one so the certificate never feels like a
   bait-and-switch. */
.world.ghost {
  border: 2px dashed rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 18px 20px 20px;
  background: rgba(255, 255, 255, 0.03);
}
.world.ghost .world-head h2 { color: var(--faint); }
.world.ghost .sector-chip { background: var(--planet-locked); color: var(--faint); }
.soon-chip {
  font-family: var(--display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(255, 212, 77, 0.12);
  border: 1px solid rgba(255, 212, 77, 0.45);
  border-radius: 999px;
  padding: 2px 12px;
  align-self: center;
}
.ghost-body { text-align: center; padding-top: 6px; }
.ghost-nodes { display: flex; justify-content: center; gap: 34px; margin: 10px 0 18px; }
.ghost-nodes span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--planet-far);
  border: 3px dashed var(--planet-locked-ring);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0.85;
}
.ghost-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.waitlist-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  margin: 4px auto 0;
  max-width: 480px;
  position: relative;
}
.waitlist-form input[type="email"] {
  flex: 1 1 200px;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--chipbg);
  color: var(--ink);
}
.waitlist-form input[type="email"]::placeholder { color: var(--muted); }
.waitlist-form input[type="email"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.waitlist-form .btn {
  flex: 0 0 auto;
  cursor: pointer;
  font: inherit;
}
.waitlist-form .btn:disabled {
  opacity: 0.7;
  cursor: default;
}
.waitlist-form .form-status {
  flex: 1 1 100%;
  margin: 2px 0 0;
  font-size: 13px;
  min-height: 1.3em;
}
.waitlist-form .form-status[data-kind="ok"] { color: var(--go); }
.waitlist-form .form-status[data-kind="error"] { color: #ff8a8a; }
.waitlist-form .form-status[data-kind="pending"] { color: var(--muted); }

/* ---------- the route + planet nodes ---------- */

.trail { position: relative; }
.trail svg.path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.trail svg.path path {
  fill: none;
  stroke: var(--route);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 2 14;
  opacity: 0.85;
}

.node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 150px;
  border: none;
  background: none;
  padding: 0;
  font-family: var(--body);
  cursor: pointer;
}
.node .bubble {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--space);
  background: var(--gold);
  border-radius: 999px;
  padding: 3px 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  z-index: 2;
}
@media (prefers-reduced-motion: no-preference) {
  .node .bubble { animation: hop 1.4s ease-in-out infinite; }
  @keyframes hop {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
  }
}

/* planet = svg drawn by hub.js; number/lock/mini badges overlay it */
.node .dot {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  color: #fff;
  position: relative;
  transition: transform 0.12s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.node .dot svg.planet {
  position: absolute;
  inset: -18px;              /* room for the ring to overhang */
  width: calc(100% + 36px);
  height: calc(100% + 36px);
  pointer-events: none;
}
.node:hover .dot { transform: scale(1.07); }
/* the planet svg is absolutely positioned, so the number needs its own
   stacking position or the planet paints over it */
.node .dot .num { position: relative; z-index: 1; }
.node .dot .mini {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 2;
}
.node.current .dot {
  width: 86px;
  height: 86px;
  font-size: 27px;
}
@media (prefers-reduced-motion: no-preference) {
  .node.current .dot svg.planet { animation: drift 3.4s ease-in-out infinite; }
  @keyframes drift {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
  }
}
.node.locked { cursor: pointer; }
.node.locked .dot { color: rgba(255, 255, 255, 0.75); font-size: 19px; text-shadow: none; }
/* locked planets keep their identity colour but sit dormant in the dark */
.node.locked .dot svg.planet { filter: saturate(0.35) brightness(0.5); }
.node.locked .label { color: #6b6f9a; }
.node .label {
  margin-top: 9px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.node.locked.shake .dot { animation: shake 0.35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- certificate banner (all missions complete) ---------- */

.cert-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 16px 20px;
  margin-bottom: 22px;
  box-shadow: 0 6px 24px rgba(255, 212, 77, 0.18);
}
.cert-banner .cb-emoji { font-size: 34px; }
.cert-banner .cb-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; }
.cert-banner .cb-text strong { font-family: var(--display); font-weight: 600; font-size: 17px; color: #fff; }
.cert-banner .cb-text span { color: var(--muted); font-size: 13.5px; }

/* ---------- level detail card ---------- */

[hidden] { display: none !important; } /* our display rules must not beat the hidden attribute */
#detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 7, 20, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.detail-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  border-top: 8px solid var(--region, var(--purple));
  max-width: 440px;
  width: 100%;
  padding: 22px 24px 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  position: relative;
}
.detail-card[data-world="1"] { --region: var(--w1); }
.detail-card[data-world="2"] { --region: var(--w2); }
.detail-card[data-world="3"] { --region: var(--w3); }
.detail-card[data-world="4"] { --region: var(--w4); }
.detail-card .close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}
.detail-card .tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--region, var(--muted));
  background: var(--chipbg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  margin: 0 0 10px;
}
.detail-card h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  margin: 0 0 6px;
  color: #fff;
}
.detail-card .goal { margin: 0 0 12px; font-size: 15px; color: var(--text); }
.detail-card .ai-idea {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--faint);
  background: rgba(139, 131, 232, 0.12);
  border-radius: 10px;
}
.detail-card .ai-idea strong { color: #fff; }
.detail-card .links { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.btn {
  display: inline-block;
  text-align: center;
  padding: 11px 18px;
  border-radius: 14px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  border: 2px solid var(--border);
  color: var(--ink);
  background: var(--chipbg);
}
.btn:hover { border-color: var(--accent); }
.btn.start {
  background: var(--go);
  border-color: var(--go);
  border-bottom: 4px solid var(--go-hover);
  color: #fff;
}
.btn.start:hover { background: var(--go-hover); }

/* ---------- workbench + footer ---------- */

.workbench {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed var(--border);
  border-radius: 20px;
  padding: 16px 20px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.wb-icon { font-size: 30px; }
.wb-text { flex: 1; min-width: 200px; }
.wb-text h3 { font-family: var(--display); font-weight: 600; margin: 0; font-size: 18px; color: #fff; }
.wb-text p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.foot { font-size: 12.5px; color: var(--muted); margin-top: 26px; }
.foot a { color: var(--faint); }

/* Reset-progress confirm — centered so a footer click can't accidentally wipe progress. */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 7, 20, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.confirm-card {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.confirm-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-family: var(--display);
  font-weight: 600;
  color: #fff;
}
.confirm-card p {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.confirm-actions .btn {
  cursor: pointer;
  font-size: 14.5px;
  padding: 10px 16px;
}
.confirm-actions .confirm-danger {
  background: #f87171;
  border-color: #f87171;
  color: #16101c;
}
.confirm-actions .confirm-danger:hover {
  background: #ef4444;
  border-color: #ef4444;
}

/* ---------- toast ---------- */

#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #050714;
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: min(92vw, 480px);
  z-index: 60;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .lab-header { gap: 12px; }
  #mascot { width: 64px; height: 64px; border-radius: 16px; }
  h1 { font-size: 26px; }
  .node { width: 120px; }
  .progress-pill { padding: 6px 14px; }
}

/* ---------- privacy page ---------- */

.privacy { max-width: 640px; margin: 0 auto; padding: 28px 20px 60px; }
.privacy h1 { font-family: var(--display, inherit); font-size: 26px; margin: 0 0 8px; color: #fff; }
.privacy h2 { font-size: 17px; margin: 28px 0 8px; color: var(--text); }
.privacy p, .privacy li { color: var(--muted); font-size: 15px; line-height: 1.55; }
.privacy ul { padding-left: 1.2em; }
.privacy a { color: var(--accent); }
.privacy .back {
  display: inline-block;
  margin-bottom: 18px;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
}
