:root {
  color-scheme: dark;
  --bg: #120906;
  --surface: rgba(29, 16, 11, 0.72);
  --surface-solid: #1D100B;
  --surface2: rgba(255, 245, 235, 0.04);
  --text: #FFF5EB;
  --muted: #BFA696;
  --ember: #FF4A1C;
  --amber: #FF9A2E;
  --gold: #FFC94A;
  --line: rgba(255, 245, 235, 0.1);
  --line-hover: rgba(255, 154, 46, 0.5);
  --glass: rgba(18, 9, 6, 0.94);
  --fire: linear-gradient(135deg, #FF4A1C 0%, #FF9A2E 60%, #FFC94A 100%);
  --title-color: #FFF5EB;
  --code-bg: #190D09;
  --code-text: #FFEAD5;
  --ok-bg: rgba(34, 197, 94, 0.1);
  --ok-border: rgba(34, 197, 94, 0.35);
  --ok-text: #86efac;
  --warn-bg: rgba(255, 74, 28, 0.1);
  --warn-border: rgba(255, 74, 28, 0.35);
  --radius: 16px;
}

body.light {
  color-scheme: light;
  --bg: #FAF5F0;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #FFFFFF;
  --surface2: rgba(31, 18, 13, 0.03);
  --text: #1F120D;
  --muted: #6E5649;
  --line: rgba(31, 18, 13, 0.1);
  --line-hover: rgba(205, 91, 24, 0.45);
  --glass: rgba(250, 245, 240, 0.96);
  --title-color: #1F120D;
  --code-bg: #1D100B;
  --code-text: #FFF5EB;
  --ok-bg: #ecfdf3;
  --ok-border: #86efac;
  --ok-text: #166534;
  --warn-bg: #fff1ed;
  --warn-border: #fca58e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
}
.navbar {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.logo-img { height: 30px; width: auto; display: block; }
body:not(.light) .logo-light { display: none; }
body.light .logo-dark { display: none; }
.course-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.02em;
}
body.light .course-tag { color: #B84214; }
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lesson-select {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}
.lesson-select option {
  background: var(--surface-solid);
  color: var(--text);
}
.btn-theme {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-theme:hover, .lesson-select:hover { border-color: var(--line-hover); }

/* Main Container */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

/* Ember Background Layer */
#ember-canvas,
.ember-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: strict;
}
.ember-dot {
  position: absolute;
  bottom: -16px;
  border-radius: 50%;
  will-change: transform;
  animation: emberFloat linear infinite;
}
@keyframes emberFloat {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  10% { opacity: 0.72; }
  85% { opacity: 0.55; }
  100% { transform: translate3d(0, -108vh, 0); opacity: 0; }
}

/* Top Slide Frame - High-contrast Keynote Presentation Deck (Light slide on Dark page, Dark slide on Light page) */
.slide-frame {
  --s-text: #1F120D;
  --s-muted: #6A5245;
  --s-accent: #C2410C;
  --s-line: rgba(31, 18, 13, 0.11);
  background: linear-gradient(155deg, #FFFFFF 0%, #FFF3E8 100%);
  border: 1px solid rgba(255, 224, 198, 0.5);
  border-radius: 26px;
  padding: 26px 34px 20px;
  margin-bottom: 36px;
  height: 500px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
  color: var(--s-text);
}
body.light .slide-frame {
  --s-text: #FFF5EB;
  --s-muted: #C7AA98;
  --s-accent: #FF9A2E;
  --s-line: rgba(255, 245, 235, 0.12);
  background: linear-gradient(155deg, #2A1610 0%, #150A07 100%);
  border: 1px solid rgba(255, 154, 46, 0.25);
  box-shadow: 0 18px 42px rgba(42, 22, 16, 0.18);
}
.slide-frame::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 92, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
.slide-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.slide-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.slide-badge {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--s-accent);
}
.slide-counter {
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
  color: var(--s-muted);
}
.slide-item { display: none; }
.slide-item.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 6px 2px 4px;
}
.slide-title {
  margin: 0 0 8px;
  font-size: clamp(1.38rem, 2.4vw, 1.85rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--s-text);
}
.slide-lead {
  color: var(--s-muted);
  font-size: 0.98rem;
  margin: 0 0 16px;
  max-width: 68ch;
}
.slide-frame code {
  background: rgba(194, 65, 12, 0.09);
  color: var(--s-accent);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.88em;
}
body.light .slide-frame code {
  background: rgba(255, 154, 46, 0.14);
}

/* Clean Editorial Grid inside Slide */
.slide-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px 18px;
  margin-top: 4px;
}
.point-box {
  padding-top: 10px;
  border-top: 1px solid var(--s-line);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--s-muted);
}
.point-box strong {
  color: var(--s-text);
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.slide-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--s-line);
  flex-shrink: 0;
}
.slide-frame .btn-ghost {
  color: var(--s-text);
  border-color: var(--s-line);
}
.slide-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}
.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--s-line);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: width 0.2s, background 0.2s;
}
.slide-dot.active {
  width: 24px;
  background: var(--s-accent);
}

/* Download & Brand Kit Bar */
.dl-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 196, 166, 0.1);
  border: 1px solid rgba(255, 196, 166, 0.3);
  color: var(--gold);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  margin: 6px 8px 10px 0;
  transition: background 0.15s, border-color 0.15s;
}
.dl-pill:hover {
  background: rgba(255, 196, 166, 0.18);
  border-color: var(--amber);
}
body.light .dl-pill {
  background: #FFF3E8;
  color: #B84214;
  border-color: rgba(184, 66, 20, 0.28);
}
.yummy-brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0 16px;
  flex-wrap: wrap;
}
.yummy-brand-row img.ym-logo {
  height: 54px;
  width: auto;
  border-radius: 12px;
  background: #fff;
  padding: 4px;
}
.yummy-brand-row img.ym-cover {
  height: 64px;
  width: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}
/* Practice Section Below - Clean Editorial Timeline */
.work-frame {
  padding: 0;
}
.work-tabs {
  display: inline-flex;
  gap: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  width: 100%;
}
.wtab-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  margin-bottom: -1px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.wtab-btn.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
}
body.light .wtab-btn.active {
  color: #B84214;
  border-bottom-color: #B84214;
}
.wtab-panel { display: none; }
.wtab-panel.active { display: block; }

/* Practice Steps - Clean dividers instead of stacked boxes */
.step-card {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.step-card:first-child { padding-top: 4px; }
.step-card.locked-done {
  opacity: 0.75;
}
.step-card.locked-future {
  opacity: 0.35;
  pointer-events: none;
}
.step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.step-title {
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--text);
}
.step-status {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
}
.step-card.locked-done .step-status {
  background: var(--ok-bg);
  color: var(--ok-text);
}
.step-body { margin-top: 12px; color: var(--muted); }
.step-body p { margin: 0 0 12px; color: var(--text); }

/* Prompt Box - The ONE intentional elevated card so students know where to copy */
.prompt-box {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin: 16px 0;
}
.prompt-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--amber);
  font-weight: 700;
}
.prompt-code {
  margin: 0;
  padding: 16px 18px;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--code-text);
  white-space: pre-wrap;
  line-height: 1.6;
}
.btn-copy {
  background: var(--fire);
  color: #150A07;
  border: none;
  border-radius: 999px;
  padding: 5px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.btn-copy.copied { background: #22c55e; color: #fff; }

/* Pill Buttons */
.btn-fire {
  background: var(--fire);
  color: #150A07;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-fire:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-fire:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.15s;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--line-hover); }
.btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

/* Callouts & Alerts */
.alert-warn {
  background: var(--warn-bg);
  border-left: 3px solid var(--ember);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 14px 0;
  font-size: 0.93rem;
  color: var(--text);
}
.alert-warn strong { color: var(--ember); }

/* Interactive Demo Widgets */
.demo-box {
  border: 1px dashed var(--line-hover);
  border-radius: 14px;
  padding: 18px;
  margin: 14px 0;
  background: var(--surface2);
}
.demo-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-family: "Space Mono", monospace;
  font-size: 0.88rem;
  margin: 8px 0;
}

/* Lesson List on Index - Clean Apple/Linear Row List instead of boxy grid */
.lesson-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 36px;
  margin-top: 16px;
}
@media (max-width: 720px) {
  .lesson-grid { grid-template-columns: 1fr; }
}
.lesson-card {
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: padding-left 0.15s, border-color 0.15s;
}
.lesson-card:hover {
  padding-left: 8px;
  border-bottom-color: var(--amber);
}
.lesson-num {
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
  color: var(--amber);
  font-weight: 700;
  margin-bottom: 2px;
}
body.light .lesson-num { color: #B84214; }

.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .wrap { padding: 24px 16px 72px; }
  .navbar { padding: 10px 16px; }
  .slide-frame { height: auto; min-height: 400px; padding: 20px; }
}
