:root {
  --bg: #f7f4ef;
  --ink: #182020;
  --muted: #5f6964;
  --panel: #fffdf8;
  --line: #d9d2c3;
  --accent: #006d77;
  --accent-2: #c7432f;
  --accent-3: #e6a93d;
  --code: #112426;
  --code-ink: #d9fff7;
  --shadow: 0 20px 60px rgba(24, 32, 32, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(247, 244, 239, 0.9);
  border-bottom: 1px solid rgba(217, 210, 195, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #fffdf8;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav a {
  padding: 10px 12px;
  border-radius: 8px;
}

.nav a:hover {
  background: #ebe4d7;
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: clamp(18px, 3vw, 36px);
  min-height: calc(100svh - 68px);
  padding: clamp(20px, 4vw, 56px);
  align-items: stretch;
}

.landing-hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: calc(92svh - 68px);
  overflow: hidden;
  padding: clamp(22px, 4vw, 56px);
  color: #fffdf8;
  isolation: isolate;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  background: var(--code);
}

.landing-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    90deg,
    rgba(17, 36, 38, 0.9) 0%,
    rgba(17, 36, 38, 0.68) 44%,
    rgba(17, 36, 38, 0.18) 100%
  );
}

.landing-hero-content {
  width: min(720px, 100%);
}

.landing-hero h1 {
  color: #fffdf8;
  text-shadow: 0 8px 34px rgba(0, 0, 0, 0.34);
}

.landing-hero .intro {
  color: rgba(255, 253, 248, 0.82);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-button {
  flex: 0 0 auto;
  min-width: 140px;
  text-align: center;
}

.landing-hero .secondary-button {
  border-color: rgba(255, 253, 248, 0.42);
  background: rgba(255, 253, 248, 0.12);
  color: #fffdf8;
  backdrop-filter: blur(10px);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 118px));
  gap: 12px;
  margin: 32px 0 0;
}

.hero-stats div {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 253, 248, 0.28);
}

.hero-stats dt {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.hero-stats dd {
  margin: 7px 0 0;
  color: rgba(255, 253, 248, 0.74);
  font-size: 13px;
  font-weight: 800;
}

.home-page .section-band {
  padding-top: clamp(42px, 6vw, 72px);
}

.workspace-panel,
.play-panel {
  min-width: 0;
}

.panel-heading {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(40px, 7vw, 92px);
  line-height: 0.95;
  letter-spacing: 0;
}

.intro {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.65;
}

.lesson-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: clamp(24px, 4vw, 44px);
}

.lesson-tab {
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.lesson-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffdf8;
}

.lesson-control-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.lesson-control-bar .secondary-button {
  width: 100%;
}

#lessonPosition {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.editor-shell {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #254143;
  border-radius: 8px;
  background: var(--code);
  box-shadow: var(--shadow);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 12px 10px 16px;
  color: var(--code-ink);
  border-bottom: 1px solid rgba(217, 255, 247, 0.16);
  font-size: 14px;
  font-weight: 800;
}

.toolbar-actions,
.transport {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(217, 255, 247, 0.22);
  border-radius: 8px;
  background: rgba(217, 255, 247, 0.08);
  color: var(--code-ink);
  cursor: pointer;
}

.icon-button svg,
.primary-button svg,
.secondary-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#codeEditor {
  display: block;
  width: 100%;
  min-height: clamp(270px, 42vh, 460px);
  padding: 18px;
  resize: vertical;
  border: 0;
  background: var(--code);
  color: var(--code-ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(14px, 1.8vw, 17px);
  line-height: 1.65;
}

.editor-status {
  min-height: 34px;
  margin: 0;
  padding: 8px 16px 10px;
  color: rgba(217, 255, 247, 0.74);
  border-top: 1px solid rgba(217, 255, 247, 0.12);
  font-size: 13px;
  line-height: 1.4;
}

.play-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

#pulseCanvas {
  width: 100%;
  aspect-ratio: 12 / 7;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.transport {
  justify-content: stretch;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  flex: 1;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.lesson-card,
.step-card,
.style-card,
.syntax-list article,
.progress-meter,
.embed-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.progress-meter {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.progress-meter div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-meter span:first-child {
  color: var(--ink);
  font-size: 18px;
}

.progress-meter progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #ece5d9;
}

.progress-meter progress::-webkit-progress-bar {
  background: #ece5d9;
}

.progress-meter progress::-webkit-progress-value {
  background: var(--accent);
}

.progress-meter progress::-moz-progress-bar {
  background: var(--accent);
}

.lesson-card {
  padding: clamp(18px, 3vw, 24px);
}

.learner-tips {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.learner-tips summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
}

.learner-tips .goals {
  margin-top: 12px;
}

.complete-button {
  width: 100%;
  margin-top: 14px;
}

.complete-button.is-complete {
  border-color: #2f7d55;
  background: #2f7d55;
}

.embed-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.embed-panel .secondary-button {
  width: 100%;
}

#strudelFrame {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.embed-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.lesson-card h2,
.section-heading h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.lesson-card p,
.section-heading p,
.step-card p,
.syntax-list p,
.deploy-layout p {
  color: var(--muted);
  line-height: 1.7;
}

.goals {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.goals li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #33403d;
}

.goals li::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--accent-3);
}

.lesson-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.lesson-detail-grid section,
.lesson-depth-grid section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.lesson-detail-grid h3,
.lesson-depth-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.lesson-detail-grid p,
.lesson-depth-grid p {
  margin: 0;
}

.lesson-depth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.lesson-depth-wide {
  grid-column: 1 / -1;
}

.numbered-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: #33403d;
  line-height: 1.65;
}

.section-band {
  padding: clamp(54px, 8vw, 96px) clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--line);
}

.section-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.section-heading {
  max-width: 680px;
  margin-bottom: 24px;
}

.module-hero {
  padding: clamp(42px, 7vw, 84px) clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}

.module-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.55fr);
  gap: clamp(22px, 5vw, 64px);
  align-items: center;
}

.legend-panel,
.path-map,
.module-link,
.checklist {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.legend-panel,
.path-map,
.checklist {
  padding: 18px;
}

.legend-panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--muted);
  font-weight: 800;
}

.legend-row code {
  min-width: 52px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--code);
  color: var(--code-ink);
}

.legend-dot {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.legend-dot.accent {
  background: var(--accent);
}

.legend-dot.warm {
  background: var(--accent-3);
}

.legend-dot.red {
  background: var(--accent-2);
}

.path-map {
  display: grid;
  gap: 10px;
}

.path-map button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: 0;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
}

.path-map button.is-active {
  background: var(--ink);
  border-left-color: var(--accent-3);
  color: #fffdf8;
}

.module-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.module-links .section-heading {
  grid-column: 1 / -1;
}

.module-link {
  display: grid;
  gap: 10px;
  min-height: 148px;
  padding: 18px;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.module-link:hover,
.module-link:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 18px 46px rgba(24, 32, 32, 0.14);
  transform: translateY(-2px);
}

.module-link strong {
  font-size: 20px;
}

.module-link span,
.card-meta {
  color: var(--muted);
  line-height: 1.6;
}

.card-meta {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: #40514d;
  font-size: 14px;
  line-height: 1.55;
  list-style: none;
}

.mini-list li {
  position: relative;
  padding-left: 14px;
}

.mini-list li::before {
  content: "";
  position: absolute;
  top: 0.7em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.segmented-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segmented-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.segmented-tabs button.is-active {
  background: var(--ink);
  color: #fffdf8;
}

.checklist {
  display: grid;
  gap: 12px;
}

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

.checklist input {
  margin-top: 4px;
}

.lesson-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
}

.lesson-tools label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.lesson-tools input {
  width: min(420px, 100%);
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.step-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 220px;
  padding: 22px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.step-card:hover,
.step-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 18px 46px rgba(24, 32, 32, 0.14);
  transform: translateY(-2px);
}

.step-card span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 32px;
  border-radius: 8px;
  background: #efe4ca;
  color: #6f4d00;
  font-weight: 900;
}

.step-card h3,
.syntax-list h3 {
  margin: 20px 0 8px;
  font-size: 20px;
}

.card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin: auto 0 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.empty-state {
  margin: 18px 0 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.examples-band {
  background: #eef3f2;
}

.style-example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.style-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 330px;
  padding: 20px;
}

.style-card span {
  width: max-content;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 8px;
  background: #dce8e4;
  color: #24514d;
  font-size: 12px;
  font-weight: 900;
}

.style-card h3 {
  margin: 0;
  font-size: 22px;
}

.style-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.style-card code {
  display: block;
  min-height: 112px;
  padding: 12px;
  border-radius: 8px;
  background: var(--code);
  color: var(--code-ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.style-card .secondary-button {
  width: 100%;
  margin-top: auto;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.25fr);
  gap: clamp(22px, 5vw, 72px);
}

.sticky-heading {
  position: sticky;
  top: 96px;
  align-self: start;
}

.syntax-list {
  display: grid;
  gap: 12px;
}

.syntax-list article {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  align-items: center;
}

.syntax-list code,
.deploy-steps code {
  display: block;
  padding: 12px;
  border-radius: 8px;
  background: var(--code);
  color: var(--code-ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.syntax-list h3,
.syntax-list p {
  margin-top: 0;
}

.syntax-source {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.syntax-source a {
  color: var(--accent);
  font-weight: 900;
}

.syntax-actions {
  display: grid;
  gap: 8px;
  min-width: 132px;
}

.compact-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.deploy-band {
  background: #e9f0ec;
}

.deploy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: clamp(20px, 5vw, 64px);
  align-items: center;
}

.deploy-steps {
  display: grid;
  gap: 10px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(16px, 4vw, 48px);
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.footer a {
  color: var(--accent);
  font-weight: 800;
}

@media (max-width: 980px) {
  .workspace,
  .two-column,
  .deploy-layout,
  .module-hero-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: 0;
  }

  .landing-hero::after {
    background: linear-gradient(
      90deg,
      rgba(17, 36, 38, 0.92) 0%,
      rgba(17, 36, 38, 0.72) 68%,
      rgba(17, 36, 38, 0.36) 100%
    );
  }

  .sticky-heading {
    position: static;
  }

  .lesson-grid,
  .module-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav a {
    flex: 0 0 auto;
  }

  .workspace {
    padding: 18px 14px 42px;
  }

  .landing-hero {
    min-height: calc(86svh - 68px);
    padding: 24px 14px 34px;
  }

  h1 {
    font-size: clamp(38px, 13vw, 58px);
  }

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

  .hero-actions {
    display: grid;
  }

  .hero-button {
    width: 100%;
  }

  .lesson-picker,
  .lesson-grid,
  .style-example-grid,
  .module-links,
  .syntax-list article,
  .lesson-detail-grid,
  .lesson-depth-grid {
    grid-template-columns: 1fr;
  }

  .lesson-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-control-bar {
    grid-template-columns: 1fr;
  }

  #lessonPosition {
    text-align: center;
  }

  .transport {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .primary-button,
  .secondary-button {
    padding: 0 10px;
  }

  .section-band {
    padding-inline: 14px;
  }

  .footer {
    flex-direction: column;
  }
}
