:root {
  /* Deeper, warmer near-black — premium, not "developer dark" */
  --bg: #08090d;
  --bg-elev: #0e1018;
  --bg-card: #14171f;
  --bg-card-hover: #1a1e29;

  --border: rgba(255,255,255,0.055);
  --border-hi: rgba(255,255,255,0.13);

  /* Single accent, refined and quiet */
  --accent: #6ea0ff;
  --accent-strong: #a7c2ff;
  --accent-glow: rgba(110, 160, 255, 0.3);

  /* Sophisticated, off-white text — never icy */
  --text: #f5f6fa;
  --text-dim: #9498ab;
  --text-mute: #5a5f74;

  /* Status — muted, used only inside the simulation engine */
  --good: #6ee7b7;
  --warn: #fcd34d;
  --bad: #fca5a5;

  /* Typography: SF-style hierarchy */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Space Grotesk", system-ui, sans-serif;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  /* Legacy aliases */
  --font-space: var(--font-display);
  --mono: var(--font-mono);
  --accent-hot: #c4b5fd;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";  /* Inter stylistic alternates */
  letter-spacing: -0.005em;
  font-weight: 400;
}

#bg-canvas {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  height: 100vh;
  overflow-y: auto;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ── LANDING ──────────────────────────────────────────────── */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8rem 2rem 6rem;
  position: relative;
}
.landing__brand {
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  color: var(--text-mute);
  font-weight: 500;
  margin-bottom: 3rem;
  font-family: var(--mono);
  text-transform: uppercase;
}
.landing__title {
  font-size: clamp(2.8rem, 8.5vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  text-align: center;
  margin-bottom: 1.75rem;
  max-width: 1000px;
  font-family: var(--font-display);
  color: var(--text);
}
.landing__title em {
  font-style: normal;
  display: block;
  color: var(--text-dim);
  font-weight: 400;
  /* Refined, subtle accent — no rainbow */
}
.landing__sub {
  color: var(--text-dim);
  font-size: 1.2rem;
  max-width: 580px;
  text-align: center;
  margin-bottom: 2.5rem;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.005em;
}

/* Three-column proof points under the subhead — like Apple's product stats row */
.landing__pillars {
  display: flex;
  gap: 56px;
  margin-bottom: 4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.landing__pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.landing__pillar-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--text);
}
.landing__pillar-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 500;
}

/* CTA + progress block */
.landing__cta-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  margin-bottom: 7rem;
  width: 100%;
  max-width: 480px;
}
.landing__cta-primary {
  background: var(--text);
  color: var(--bg);
  padding: 1.1rem 2.25rem;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 16px 40px -12px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.08);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  line-height: 1;
  min-width: 280px;
  justify-content: center;
}
.landing__cta-primary strong { font-weight: 600; }
.landing__cta-primary:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 24px 56px -12px rgba(0,0,0,0.7),
    0 0 0 1px rgba(255,255,255,0.12);
}
.landing__cta-sub {
  display: none; /* moved into progress meta */
}

.landing__progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.landing__progress-numbers {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-mute);
  letter-spacing: -0.005em;
}
.landing__progress-completed { color: var(--text); font-weight: 600; font-size: 1rem; }
.landing__progress-divider { color: var(--text-mute); opacity: 0.5; }
.landing__progress-total { color: var(--text-mute); }
.landing__progress-label { margin-left: 0.5rem; }
.landing__progress-bar {
  width: 100%;
  max-width: 320px;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}
.landing__progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.landing__reset {
  font-family: var(--font);
  font-size: 0.75rem;
  color: var(--text-mute);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  transition: color 0.2s;
  letter-spacing: -0.005em;
}
.landing__reset:hover { color: var(--text-dim); }
/* Section title above the curriculum grid */
.landing__section-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-mute);
  text-align: center;
  margin-bottom: 4rem;
  font-weight: 500;
}

/* ── Curriculum grid ──────────────────────────────────────────
   Design system:
   - Spacing scale: 4 / 8 / 12 / 16 / 20 / 24 / 32 / 40 / 48
   - Card: 320px tall, hero icon block fills the top 60%
   - Internal regions: hero (188px) / body (flex) / 24px outer padding
*/
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  max-width: 1200px;
  width: 100%;
}
.concept-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 12px 12px 24px;

  display: grid;
  grid-template-rows: 188px 1fr;

  transition:
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}
.concept-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hi);
  background: var(--bg-card-hover);
  box-shadow:
    0 24px 64px -16px rgba(0,0,0,0.55),
    inset 0 0 0 1px rgba(255,255,255,0.04);
}

/* Hero block: big icon centered, number tag in top corner */
.concept-card__hero {
  position: relative;
  height: 188px;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 65% 55% at 50% 45%, rgba(110, 160, 255, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.005));
  border: 1px solid rgba(255,255,255,0.045);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background 0.4s ease;
}
.concept-card:hover .concept-card__hero {
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(110, 160, 255, 0.28), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
}
.concept-card__icon {
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 16px rgba(110, 160, 255, 0.4));
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.concept-card:hover .concept-card__icon { transform: scale(1.06); }
.concept-card__icon svg { display: block; stroke-width: 1.3; }

.concept-card__num {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--text-mute);
  font-weight: 500;
}
.concept-card__check {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--good);
  color: #052e16;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 4px 12px rgba(110, 231, 183, 0.4);
}

/* Body: phase + title + desc */
.concept-card__body {
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.concept-card__phase {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.concept-card__phase-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.concept-card__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.022em;
  color: var(--text);
  margin: 0;
}
.concept-card__desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
  letter-spacing: -0.003em;
  margin: 4px 0 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Progress states */
.concept-card--seen .concept-card__hero {
  background:
    radial-gradient(ellipse 65% 55% at 50% 45%, rgba(110, 160, 255, 0.24), transparent 70%),
    linear-gradient(180deg, rgba(110, 160, 255, 0.05), rgba(255,255,255,0.005));
  border-color: rgba(110, 160, 255, 0.16);
}
.concept-card--done {
  border-color: rgba(110, 231, 183, 0.22);
}
.concept-card--done .concept-card__hero {
  background:
    radial-gradient(ellipse 65% 55% at 50% 45%, rgba(110, 231, 183, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(110, 231, 183, 0.03), rgba(255,255,255,0.005));
  border-color: rgba(110, 231, 183, 0.18);
}
.concept-card--done .concept-card__icon {
  color: var(--good);
  filter: drop-shadow(0 4px 16px rgba(110, 231, 183, 0.4));
}
.concept-card--done .concept-card__phase {
  color: var(--good);
}

/* ── NAV ──────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  background: rgba(8,9,13,0.72);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  gap: 1rem;
  font-family: var(--font);
  letter-spacing: -0.005em;
}
.nav__back {
  font-size: 0.88rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 100px;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  font-weight: 500;
}
.nav__back:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav__crumb {
  color: var(--text-mute);
  font-size: 0.88rem;
  opacity: 0.7;
}
.nav__title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.nav__icon svg { display: block; }

/* ── LESSON ───────────────────────────────────────────────── */
.lesson {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 1fr;
  height: calc(100vh - 60px);
}
.lesson__left {
  padding: 56px 64px 48px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  max-width: 720px;
  margin: 0 auto;
  /* Soft fade-mask top and bottom so scrolled content dissolves into the
     background instead of hard-cutting at the edge */
  mask-image: linear-gradient(180deg,
    transparent 0,
    #000 28px,
    #000 calc(100% - 28px),
    transparent 100%);
  -webkit-mask-image: linear-gradient(180deg,
    transparent 0,
    #000 28px,
    #000 calc(100% - 28px),
    transparent 100%);
}
.lesson__left > * { min-width: 0; }
/* Lesson header: hero icon block + small chip */
.lesson__header {
  margin-bottom: 32px;
}
.lesson__icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(110, 160, 255, 0.22), transparent 75%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.005));
  color: var(--accent);
  border: 1px solid rgba(110, 160, 255, 0.2);
  margin-bottom: 20px;
  filter: drop-shadow(0 8px 24px rgba(110, 160, 255, 0.2));
}
.lesson__icon svg { width: 38px; height: 38px; stroke-width: 1.3; }
.lesson__chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.28em;
  font-family: var(--mono);
  color: var(--text-mute);
  text-transform: uppercase;
  font-weight: 500;
}
.lesson__h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-bottom: 16px;
  overflow-wrap: break-word;
  color: var(--text);
  /* Give the type room to breathe at the top — prevents tight line-height
     from clipping ascenders when content scrolls into the mask */
  padding-top: 4px;
}
.lesson__tagline {
  color: var(--text-dim);
  font-size: 1.15rem;
  margin-bottom: 48px;
  line-height: 1.5;
  letter-spacing: -0.008em;
  font-weight: 400;
  max-width: 580px;
}
.lesson__step-detail { margin-bottom: 32px; }
.lesson__step-num-large {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 12px;
}
.lesson__step-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  line-height: 1.18;
  overflow-wrap: break-word;
  color: var(--text);
}
.lesson__step-body {
  overflow-wrap: break-word;
  word-break: normal;
}
.lesson__step-body p {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-dim);
  margin-bottom: 16px;
  overflow-wrap: break-word;
  letter-spacing: -0.005em;
}
.lesson__step-body p strong { color: var(--text); font-weight: 600; }
.lesson__step-body p em { color: var(--accent); font-style: normal; font-weight: 500; }
.lesson__step-body p code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(255,255,255,0.05);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--accent);
  border: 1px solid rgba(255,255,255,0.05);
  word-break: break-word;
}

.lesson__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 32px 0 24px;
}
.lesson__nav .btn { flex-shrink: 0; padding: 10px 20px; border-radius: 100px; font-size: 0.88rem; }
.lesson__nav .btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.lesson__cta {
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.005em;
  border: none;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.1) inset,
    0 10px 24px -8px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.06);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s;
  font-family: inherit;
}
.lesson__cta:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 16px 32px -8px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.1);
}

.lesson__dots {
  display: flex;
  gap: 6px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.lesson__dot {
  flex: 1;
  height: 3px;
  border-radius: 100px;
  background: rgba(255,255,255,0.05);
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}
.lesson__dot.active { background: var(--accent); }
.lesson__dot:hover { background: rgba(255,255,255,0.18); }
.lesson__dot.active:hover { background: var(--accent-strong); }

.lesson__caption {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--text-mute);
  padding: 0.4rem 0.9rem;
  background: rgba(7,9,15,0.7);
  border: 1px solid var(--border);
  border-radius: 100px;
  backdrop-filter: blur(8px);
}

/* "Up next" card at end of lesson */
.lesson__upnext {
  margin: 32px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.lesson__upnext-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--text-mute);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.lesson__upnext-card {
  width: 100%;
  text-align: left;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  color: inherit;
}
.lesson__upnext-card:hover {
  border-color: var(--border-hi);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.4);
}
.lesson__upnext-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.015em;
}
.lesson__upnext-tagline {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
  letter-spacing: -0.003em;
}

/* Next-concept button shown in sandbox after passing validation */
.feedback-next {
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, rgba(110,168,255,0.12), rgba(139,92,246,0.12));
  border: 1px solid rgba(110,168,255,0.35);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: all 0.15s;
}
.feedback-next:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(110,168,255,0.2), rgba(139,92,246,0.2));
}
.feedback-next__label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.feedback-next__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.feedback-next__tagline {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.35;
}

/* Compact prev/next concept buttons in the nav bar */
.nav__nav-btn {
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  margin-left: 0.4rem;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s;
}
.nav__nav-btn:hover { border-color: var(--border-hi); color: var(--text); }
.lesson__right {
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: #0a0c14;
  background-image:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(110, 160, 255, 0.06), transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(167, 194, 255, 0.04), transparent 60%);
}
.lesson-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── SANDBOX ──────────────────────────────────────────────── */
.sandbox {
  display: grid;
  grid-template-columns: 264px 1fr 304px;
  height: calc(100vh - 60px);
}
.sandbox__palette {
  background: rgba(14, 16, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  overflow-y: auto;
}
.sandbox__section-title {
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.28em;
  color: var(--text-mute);
  margin-bottom: 16px;
  text-transform: uppercase;
  font-weight: 500;
}
.palette-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 14px;
  margin-bottom: 8px;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: grab;
  text-align: left;
  /* A press-drag on a palette item starts a node drag, not a panel scroll. */
  touch-action: none;
}
.palette-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  transform: translateX(2px);
}
.palette-item:active { cursor: grabbing; transform: scale(0.98); }
.palette-item__icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.palette-item__icon svg { width: 26px; height: 26px; }
.drag-ghost svg { width: 32px; height: 32px; }
.palette-item__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}
.palette-item__hint {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-top: 2px;
  letter-spacing: -0.003em;
}

.sandbox__canvas-wrap {
  position: relative;
  background: #0a0c14;
  background-image:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(110, 160, 255, 0.06), transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(167, 194, 255, 0.04), transparent 60%);
}
.sandbox-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  /* Let the canvas own all touch gestures (drag nodes, draw edges) instead of
     the browser hijacking them for scroll/zoom. */
  touch-action: none;
}
.sandbox__overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  gap: 1rem;
}
.sandbox__challenge {
  background: rgba(7,9,15,0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  max-width: 440px;
  color: var(--text-dim);
  pointer-events: auto;
}
.sandbox__challenge strong { color: var(--text); }
.sandbox__controls {
  display: flex;
  gap: 6px;
  pointer-events: auto;
  align-items: center;
}
.btn {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  letter-spacing: -0.005em;
  cursor: pointer;
  line-height: 1.2;
  height: 26px;
}
.btn:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.btn--primary {
  background: var(--accent);
  border: 1px solid transparent;
  color: #0a1226;
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--accent-strong);
  color: #0a1226;
  border-color: transparent;
}
.btn--danger { color: var(--bad); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: rgba(255,255,255,0.04); border-color: transparent; }

.sandbox__panel {
  background: rgba(14, 16, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  padding: 28px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.feedback {
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid;
  font-size: 0.88rem;
  line-height: 1.55;
  letter-spacing: -0.005em;
}
.feedback--good {
  background: rgba(110, 231, 183, 0.06);
  border-color: rgba(110, 231, 183, 0.22);
  color: #a3e9c8;
}
.feedback--bad {
  background: rgba(252, 165, 165, 0.06);
  border-color: rgba(252, 165, 165, 0.22);
  color: #fbb6b6;
}
.feedback--warn {
  background: rgba(252, 211, 77, 0.06);
  border-color: rgba(252, 211, 77, 0.22);
  color: #f5d875;
}
.feedback__title {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.98rem;
  letter-spacing: -0.015em;
}
.feedback__list { list-style: none; margin-top: 0.5rem; }
.feedback__list li {
  padding: 0.25rem 0 0.25rem 1rem;
  position: relative;
  overflow-wrap: break-word;
}
.feedback__list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-mute);
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  letter-spacing: -0.005em;
}
.metric:last-child { border-bottom: none; }
.metric__label { color: var(--text-mute); font-weight: 400; }
.metric__value {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

/* ── DRAG GHOST ───────────────────────────────────────────── */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  background: rgba(20, 24, 36, 0.95);
  border: 2px solid;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0.92;
  transition: transform 0.05s;
}
.drag-ghost--over {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 48px currentColor;
}

.sandbox-canvas.drag-over {
  background: radial-gradient(ellipse at center, rgba(110,168,255,0.04), transparent 70%);
}

/* ── HELP HINT ────────────────────────────────────────────── */
.sandbox__hint {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-mute);
  background: rgba(7,9,15,0.7);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.sandbox__hint kbd {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 1px 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ── RESPONSIVE ───────────────────────────────────────────── */

/* Tablets and below: stack the lesson canvas under the text */
@media (max-width: 900px) {
  .lesson {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100vh - 56px);
  }
  .lesson__left {
    padding: 1.25rem 1.25rem 1rem;
    max-height: 55vh;
  }
  .lesson__right {
    border-left: none;
    border-top: 1px solid var(--border);
    min-height: 0;
  }
  .nav__nav-btn { display: none; }
  .lesson__h1 { font-size: 1.5rem !important; }
}

/* Phones: very tight, hide some chrome */
@media (max-width: 600px) {
  .landing__title { font-size: 2rem; }
  .landing__sub { font-size: 0.95rem; margin-bottom: 1.5rem; }
  .concept-grid { grid-template-columns: 1fr; }
  .lesson { grid-template-columns: 1fr; }
  .lesson__left { padding: 1rem; max-height: 50vh; }
  .lesson__step-body p { font-size: 0.9rem; }
  .nav { padding: 0 0.8rem; gap: 0.4rem; font-size: 0.8rem; }
  .nav__nav-btn { display: none; }
}

/* Sandbox on tablets/phones: a horizontal palette strip on top, the canvas in
   the middle, and a compact metrics/feedback strip at the bottom. Fully touch-
   driven via Pointer Events — drag to place/move, tap a node then drag a ＋
   handle to connect, long-press to delete. */
@media (max-width: 900px) {
  .sandbox {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: calc(100vh - 56px);
  }

  /* Palette → horizontal scrolling row of compact icon chips. */
  .sandbox__palette {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .sandbox__palette .sandbox__section-title,
  .sandbox__howto-title,
  .sandbox__howto { display: none; }
  .palette-item {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 66px;
    margin-bottom: 0;
    padding: 8px 10px;
    text-align: center;
  }
  .palette-item:hover { transform: none; }
  .palette-item__hint { display: none; }
  .palette-item__name { font-size: 11px; }
  .palette-item__icon { width: 34px; height: 34px; }
  .palette-item__icon svg { width: 20px; height: 20px; }

  /* Metrics/feedback → bottom strip; capped so it never starves the canvas. */
  .sandbox__panel {
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 12px;
    gap: 12px;
    max-height: 34vh;
  }
  #metrics {
    display: flex;
    flex-flow: row wrap;
    gap: 6px 16px;
  }
  .metric { padding: 2px 0; border-bottom: none; gap: 6px; }

  /* The challenge card can take the full width on a narrow screen. */
  .sandbox__overlay { flex-direction: column; }
  .sandbox__challenge { max-width: none; font-size: 0.8rem; }
  .sandbox__hint { display: none; }
}

/* ── HELPERS ──────────────────────────────────────────────── */
@keyframes glow-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}
.pulse { animation: glow-pulse 2s ease-in-out infinite; }

/* Landing footer */
.landing__footer {
  margin: 4.5rem auto 3rem;
  max-width: 640px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}
.landing__footer-text {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 30rem;
}

/* ── Email capture ─────────────────────────────────────────── */
.email-form { width: 100%; max-width: 30rem; margin: 0 auto; }
.email-form__prompt {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}
.email-form__row {
  display: flex;
  gap: 0.5rem;
}
.email-form__input {
  flex: 1;
  min-width: 0;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-hi);
  border-radius: 9px;
  padding: 0.6rem 0.8rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.email-form__input::placeholder { color: var(--text-mute); }
.email-form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.email-form__btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--bg);
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  border: 1px solid var(--accent-strong);
  border-radius: 9px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.18s ease, opacity 0.16s ease;
}
.email-form__btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--accent-glow); }
.email-form__btn:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.email-form__note {
  color: var(--text-mute);
  font-size: 0.74rem;
  margin-top: 0.5rem;
  letter-spacing: 0.01em;
}
.email-form__status { font-size: 0.85rem; margin-top: 0.6rem; font-weight: 500; }
.email-form__status--ok { color: var(--good); }
.email-form__status--err { color: var(--bad); }
.email-form__done {
  color: var(--good);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* Footer composition on the landing page */
.landing__footer-signup { margin-bottom: 1.6rem; width: 100%; }

/* Capstone success card */
.feedback__signup {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

@media (max-width: 520px) {
  .email-form__row { flex-direction: column; }
  .email-form__btn { width: 100%; }
}

/* ============================================================ */
/* Email gate (taste-first user-base capture)                   */
/* ============================================================ */
.gate-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
  background: rgba(4, 5, 8, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.18s ease;
}
.gate-overlay--in { opacity: 1; }

.gate {
  position: relative;
  width: 100%; max-width: 430px;
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  border-radius: 18px;
  padding: 2rem 1.75rem 1.5rem;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(110,160,255,0.06);
  transform: translateY(8px) scale(0.985);
  transition: transform 0.18s ease;
}
.gate-overlay--in .gate { transform: none; }

.gate__close {
  position: absolute; top: 0.85rem; right: 1rem;
  background: none; border: none; cursor: pointer;
  color: var(--text-mute); font-size: 1.5rem; line-height: 1;
  transition: color 0.15s;
}
.gate__close:hover { color: var(--text); }

.gate__badge {
  display: inline-block;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-glow);
  border: 1px solid rgba(110,160,255,0.25);
  padding: 0.28rem 0.6rem; border-radius: 999px;
  margin-bottom: 0.9rem;
}
.gate__title {
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 600;
  color: var(--text); margin: 0 0 0.5rem; line-height: 1.2;
}
.gate__sub {
  font-size: 0.92rem; color: var(--text-dim); line-height: 1.5;
  margin: 0 0 1.25rem;
}
.gate__form { display: flex; flex-direction: column; gap: 0.7rem; }
.gate__input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-elev);
  border: 1px solid var(--border-hi);
  border-radius: 11px;
  padding: 0.8rem 0.9rem;
  color: var(--text); font-size: 0.98rem; font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gate__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.gate__input::placeholder { color: var(--text-mute); }
.gate__turnstile:empty { display: none; }

.gate__consent {
  display: flex; align-items: flex-start; gap: 0.55rem;
  font-size: 0.82rem; color: var(--text-dim); line-height: 1.45;
  cursor: pointer; user-select: none;
}
.gate__consent input { margin-top: 0.15rem; accent-color: var(--accent); }

.gate__error {
  font-size: 0.82rem; color: var(--bad);
  background: rgba(252,165,165,0.08);
  border: 1px solid rgba(252,165,165,0.2);
  border-radius: 9px; padding: 0.5rem 0.7rem;
}

.gate__submit {
  margin-top: 0.2rem;
  background: var(--accent); color: #06080f;
  border: none; border-radius: 11px;
  padding: 0.82rem 1rem;
  font-family: var(--font-display); font-size: 0.98rem; font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
.gate__submit:hover { filter: brightness(1.08); }
.gate__submit:active { transform: translateY(1px); }
.gate__submit:disabled { opacity: 0.6; cursor: default; }

.gate__fineprint {
  margin-top: 0.9rem; text-align: center;
  font-size: 0.72rem; color: var(--text-mute);
}

/* ── OAuth login buttons (gate) ────────────────────────────── */
.gate__oauth {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.5rem 0 0.3rem;
}
.gate__oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.72rem 1rem;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}
.gate__oauth-btn:hover { transform: translateY(-1px); }
.gate__oauth-btn:active { transform: translateY(0); }
.gate__oauth-btn:disabled,
.gate__oauth-btn.is-loading { opacity: 0.6; cursor: default; transform: none; }
.gate__oauth-icon { display: inline-flex; align-items: center; line-height: 0; }

.gate__oauth-btn--google {
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
}
.gate__oauth-btn--google:hover { background: #f6f7f9; }

.gate__oauth-btn--github {
  background: #1f2328;
  color: #ffffff;
  border: 1px solid #30363d;
}
.gate__oauth-btn--github:hover { background: #2a2f37; }

/* ── Signed-in account bar (landing) ───────────────────────── */
.landing__account {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
  padding: 0.55rem 0.9rem;
  background: rgba(110, 231, 183, 0.06);
  border: 1px solid rgba(110, 231, 183, 0.22);
  border-radius: 10px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.landing__account-email {
  font-size: 0.85rem;
  color: var(--good);
  font-weight: 500;
}
.landing__signout {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-hi);
  border-radius: 7px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.landing__signout:hover {
  color: var(--text);
  border-color: var(--text-mute);
  background: rgba(255,255,255,0.04);
}
.landing__signout:disabled { opacity: 0.6; cursor: default; }

/* ── Social icons (subtle, gray) ───────────────────────────── */
.landing__footer-social {
  display: flex;
  justify-content: center;
  margin-top: 1.1rem;
  width: 100%;
}
.social-icons { display: flex; gap: 0.6rem; justify-content: center; }
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: var(--text-mute);
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.social-icon:hover {
  color: var(--text-dim);
  border-color: var(--border-hi);
  background: rgba(255,255,255,0.03);
}

.landing__footer-sep { color: var(--text-mute); margin: 0 0.5rem; }
.landing__footer-legal span { color: var(--text-mute); font-size: 0.8rem; }

/* ── Footer "why" + signature ──────────────────────────────── */
.landing__footer-why {
  margin-top: 1.8rem;
  text-align: center;
  max-width: 32rem;
}
.landing__footer-why p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.65;
  font-style: italic;
}
.landing__footer-name {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--font-display);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.005em;
}

/* ── Curriculum sections (grouped levels) ──────────────────── */
.curriculum-section {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 3.5rem;
}
.curriculum-section:last-of-type { margin-bottom: 1rem; }
.curriculum-section__header {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.curriculum-section__num {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.curriculum-section__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.curriculum-section__count {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-left: auto;
}
