@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap");

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --bg-2: #f1f6f9;
  --bg-3: #f6e6d8;
  --ink: #1d1c1a;
  --muted: #5b5e62;
  --accent: #ff6b35;
  --accent-2: #14805e;
  --accent-3: #1f4e8c;
  --card: #fffdf8;
  --edge: #e0d8cf;
  --glass: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.6);
  --shadow: 0 18px 45px rgba(25, 21, 17, 0.12);
  --radius-lg: 36px;
  --radius-md: 26px;
  --radius-sm: 18px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 28px;
  --space-6: 40px;
  --bubble: 999px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --bg-2: #0c0e12;
  --bg-3: #141821;
  --ink: #f6f3ee;
  --muted: #b1b4ba;
  --accent: #ff8a5a;
  --accent-2: #39b48a;
  --accent-3: #8cb4ff;
  --card: #171a21;
  --edge: #2a2f3a;
  --glass: rgba(23, 26, 33, 0.9);
  --glass-border: rgba(42, 47, 58, 0.8);
  --shadow: 0 20px 45px rgba(4, 6, 10, 0.45);
}
* {
  box-sizing: border-box;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  background: linear-gradient(120deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

main {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto 80px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.bg-shape {
  position: absolute;
  border-radius: 999px;
  filter: blur(0px);
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
}

.shape-1 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle at 30% 30%, #ffb799, #ff6b35);
  top: -120px;
  left: -80px;
  animation: float 9s ease-in-out infinite;
}

.shape-2 {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at 30% 30%, #9dd8c2, #14805e);
  top: 220px;
  right: -90px;
  animation: float 10s ease-in-out infinite reverse;
}

.shape-3 {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle at 30% 30%, #a7c4f2, #1f4e8c);
  bottom: 80px;
  left: -50px;
  animation: float 12s ease-in-out infinite;
}

body[data-theme="dark"] .shape-1 {
  background: radial-gradient(circle at 30% 30%, #5b3d2f, #ff6b35);
  opacity: 0.2;
}

body[data-theme="dark"] .shape-2 {
  background: radial-gradient(circle at 30% 30%, #23463a, #39b48a);
  opacity: 0.2;
}

body[data-theme="dark"] .shape-3 {
  background: radial-gradient(circle at 30% 30%, #25324f, #8cb4ff);
  opacity: 0.2;
}

.hero {
  width: min(1100px, calc(100% - 24px));
  margin: 48px auto 36px;
  padding: 36px clamp(24px, 6vw, 56px);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(10px);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--edge);
  display: grid;
  place-items: center;
  padding: 6px;
  box-shadow: 0 12px 28px rgba(22, 19, 16, 0.2);
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #d5d3cc;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch input:checked + .slider {
  background: var(--accent-2);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.eyebrow {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
  color: var(--accent-3);
  font-weight: 600;
}

.tagline {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.wordmark {
  width: clamp(170px, 36vw, 280px);
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(20, 12, 28, 0.25));
}

.hero-body {
  margin-top: var(--space-5);
  display: grid;
  gap: var(--space-4);
}

h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.05;
  margin: 0;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.2rem;
  max-width: 580px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 107, 53, 0.28), transparent 70%);
  right: -30px;
  top: -30px;
  opacity: 0.6;
}

.stat-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 32px rgba(22, 19, 16, 0.18);
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.stat-value {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
}

.controls {
  display: grid;
  gap: var(--space-3);
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 1rem;
  color: var(--muted);
}

.field input,
.field select {
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 1.05rem;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(255, 107, 53, 0.4);
  border-color: var(--accent);
}

.control-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn {
  border: none;
  background: var(--ink);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--bubble);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.accent {
  background: var(--accent-2);
}

.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--edge);
}

.btn:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 18px rgba(22, 19, 16, 0.18);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
  box-shadow: none;
}

.lesson-list {
  display: grid;
  gap: var(--space-4);
  position: relative;
  z-index: 1;
}

.lesson-card {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-4);
  animation: rise 0.6s ease forwards;
  opacity: 0;
  transform: translateY(18px);
  animation-delay: var(--delay, 0s);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.lesson-card::before,
.lesson-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.35;
}

.lesson-card::before {
  width: 140px;
  height: 140px;
  top: -60px;
  right: -40px;
  background: radial-gradient(circle at 30% 30%, rgba(21, 128, 94, 0.35), transparent 70%);
}

.lesson-card::after {
  width: 110px;
  height: 110px;
  bottom: -50px;
  left: -40px;
  background: radial-gradient(circle at 30% 30%, rgba(31, 78, 140, 0.28), transparent 70%);
}

.lesson-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 42px rgba(22, 19, 16, 0.2);
}

.lesson-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.lesson-label {
  margin: 0;
  color: var(--accent-3);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.95rem;
  font-weight: 600;
}

.lesson-title {
  margin: 0;
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pill {
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--edge);
  font-size: 0.95rem;
  color: var(--muted);
}

.lesson-summary {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.5;
}

.lesson-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.highlight {
  background: rgba(255, 107, 53, 0.1);
  color: var(--accent-3);
  padding: 8px 14px;
  border-radius: var(--bubble);
  font-size: 1rem;
  border: 1px dashed rgba(255, 107, 53, 0.4);
}

.lesson-sections {
  display: grid;
  gap: var(--space-3);
}

.lesson-slides {
  display: grid;
  gap: var(--space-3);
}

.slide-stack {
  position: relative;
  min-height: 360px;
}

.lesson-slide {
  display: none;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  border: 1px solid var(--edge);
  box-shadow: 0 16px 32px rgba(22, 19, 16, 0.12);
}

.lesson-slide.is-active {
  display: block;
  animation: slideIn 0.35s ease;
}

.slide-header {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.slide-pill {
  background: rgba(255, 107, 53, 0.12);
  color: var(--accent-3);
  padding: 6px 14px;
  border-radius: var(--bubble);
  width: fit-content;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.slide-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.slide-body {
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.75;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.slide-body h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  color: var(--ink);
}

.slide-body h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: var(--ink);
}

.slide-body p {
  margin: 0 0 12px;
}

.slide-body ul,
.slide-body ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.slide-body li {
  margin-bottom: 8px;
}

.slide-body .concept,
.slide-body .exercise,
.slide-body .quiz,
.slide-body .answer-box {
  background: color-mix(in srgb, var(--card) 96%, transparent);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 14px 0;
  box-shadow: 0 10px 20px rgba(22, 19, 16, 0.08);
}

.slide-body .answer-box {
  min-height: 80px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.95rem;
  gap: 10px;
}

.slide-body code {
  background: color-mix(in srgb, var(--edge) 40%, transparent);
  border-radius: 8px;
  padding: 2px 6px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 0.95rem;
  color: var(--ink);
}

.slide-body .code-container pre {
  background: #111318;
  color: #f5f5f5;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.mini-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
}

.mini-input {
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--card);
  resize: vertical;
}

.mini-input:focus {
  outline: 2px solid rgba(255, 107, 53, 0.35);
  border-color: var(--accent);
}

.mini-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

.mini-status {
  color: var(--muted);
  font-size: 0.95rem;
}

.slide-comment {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--edge);
  display: grid;
  gap: 10px;
}

.comment-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
}

.slide-comment textarea {
  width: 100%;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  resize: vertical;
  min-height: 110px;
}

.slide-comment textarea:focus {
  outline: 2px solid rgba(255, 107, 53, 0.35);
  border-color: var(--accent);
}

.comment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.comment-status {
  color: var(--muted);
  font-size: 0.95rem;
}

.slide-nav {
  display: grid;
  gap: var(--space-3);
  align-items: center;
}

.slide-progress {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.slide-progress-track {
  width: 100%;
  height: 8px;
  background: color-mix(in srgb, var(--edge) 60%, transparent);
  border-radius: 999px;
  overflow: hidden;
}

.slide-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.2s ease;
}

.slide-nav .btn {
  justify-self: start;
}

.slide-nav .btn.accent {
  justify-self: end;
}

.code-lab {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: grid;
  gap: 14px;
  box-shadow: 0 16px 32px rgba(22, 19, 16, 0.12);
}

.code-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.code-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.code-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-3);
  font-size: 0.9rem;
  font-weight: 600;
}

.code-header h3 {
  margin: 6px 0 4px;
  font-size: 1.6rem;
}

.code-help {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.code-meta {
  display: grid;
  gap: 12px;
}

.code-field {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}

.code-field input {
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

.code-field input:focus {
  outline: 2px solid rgba(255, 107, 53, 0.35);
  border-color: var(--accent);
}

.code-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
}

.code-input {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 1rem;
  background: var(--card);
  color: var(--ink);
  resize: vertical;
}

.code-input:focus {
  outline: 2px solid rgba(255, 107, 53, 0.35);
  border-color: var(--accent);
}

.code-output {
  background: #101217;
  color: #f5f5f5;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 0.95rem;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-status {
  color: var(--muted);
  font-size: 0.95rem;
  min-height: 20px;
}

.lesson-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
  border-top: 1px dashed var(--edge);
  padding-top: var(--space-3);
}

.lesson-hint {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.lesson-section {
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  background: var(--card);
}

.lesson-section summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  font-size: 1.1rem;
}

.lesson-section summary::-webkit-details-marker {
  display: none;
}

.lesson-section summary::after {
  content: "+";
  float: right;
  font-size: 1.1rem;
}

.lesson-section[open] summary::after {
  content: "-";
}

.lesson-section .section-body {
  margin-top: var(--space-2);
  color: var(--muted);
  line-height: 1.7;
  font-size: 1.05rem;
}

.lesson-section .section-body .prose {
  white-space: pre-line;
}

.lesson-section pre,
.slide-body pre {
  background: #121212;
  color: #f5f5f5;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 1rem;
  margin: var(--space-2) 0 0;
}

.empty-state {
  background: var(--card);
  border: 1px dashed var(--edge);
  border-radius: var(--radius-md);
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 1.05rem;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-18px);
  }
  100% {
    transform: translateY(0px);
  }
}

@media (min-width: 720px) {
  .hero-top {
    align-items: center;
  }

  .lesson-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .controls {
    grid-template-columns: 1.3fr 1fr auto;
    align-items: end;
  }

  .control-actions {
    justify-content: flex-end;
  }

  .lesson-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .slide-nav {
    grid-template-columns: 1fr auto auto;
  }

  .code-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .hero-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .brand {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  main {
    margin: 0 auto 56px;
  }

  .hero {
    margin: 28px auto 24px;
    padding: 22px 18px;
  }

  .controls {
    padding: 18px;
  }

  .lesson-card {
    padding: 20px;
  }

  .lesson-slide {
    padding: 20px 16px;
  }

  .slide-title {
    font-size: 1.5rem;
  }

  .slide-body {
    font-size: 1.05rem;
    line-height: 1.7;
  }

  .pill {
    font-size: 0.85rem;
  }

  .code-lab {
    padding: 18px;
  }

  .code-header h3 {
    font-size: 1.4rem;
  }

  .code-input {
    min-height: 180px;
    font-size: 0.95rem;
  }

  .code-output {
    font-size: 0.9rem;
  }

  .code-meta {
    grid-template-columns: 1fr;
  }

  .mini-input {
    min-height: 140px;
  }
}

@media (max-width: 520px) {
  .brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
  }

  .wordmark {
    width: clamp(150px, 60vw, 230px);
  }

  h1 {
    font-size: clamp(2.1rem, 8vw, 2.8rem);
  }

  .subtitle {
    font-size: 1.05rem;
  }

  .hero-actions {
    gap: var(--space-2);
  }

  .hero-actions .btn {
    width: 100%;
  }

  .theme-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 16px 18px;
  }

  .slide-stack {
    min-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
