:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --surface-blue: #eff6ff;
  --ink: #111827;
  --muted: #5f6b7a;
  --line: #d8e0ea;
  --line-strong: #b8c4d3;
  --navy: #0f1f38;
  --navy-light: #172b4d;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --cyan: #06b6d4;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --code: #0b1220;
  --code-line: #22304a;
  --editor-gutter: 50px;
  --sans: "IBM Plex Sans", Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow: 0 10px 30px rgba(15, 31, 56, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  margin: 0;
}

button, textarea { font: inherit; }
button { color: inherit; }
code { background: #e4ebf5; border-radius: 4px; color: #173b78; font: .88em var(--mono); padding: 2px 5px; }
.is-hidden { display: none !important; }

.masthead {
  align-items: center;
  background: var(--navy);
  border-bottom: 1px solid #2a3b58;
  color: #fff;
  display: flex;
  height: 70px;
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 42px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { align-items: center; color: inherit; display: flex; gap: 12px; text-decoration: none; }
.brand-mark {
  background: var(--cyan);
  border-radius: 5px;
  color: #06243a;
  font: 800 12px/1.05 var(--mono);
  letter-spacing: .08em;
  padding: 8px 9px 7px;
}
.brand strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.brand small { color: #9cafc8; display: block; font: 10px var(--mono); margin-top: 1px; text-transform: uppercase; }

.masthead-actions { align-items: center; display: flex; gap: clamp(16px, 2.5vw, 34px); }

.header-progress { align-items: center; display: flex; gap: 13px; }
.header-progress > span { color: #c8d3e2; font: 11px var(--mono); }
.progress-track { background: #34445e; border-radius: 20px; height: 5px; overflow: hidden; width: clamp(90px, 12vw, 170px); }
.progress-track span { background: linear-gradient(90deg, var(--cyan), #60a5fa); display: block; height: 100%; transition: width .25s ease; width: 0; }

.user-menu { align-items: center; border-left: 1px solid #34445e; display: flex; gap: 9px; padding-left: clamp(14px, 2vw, 25px); }
.user-menu[hidden] { display: none; }
.user-avatar { background: #27405e; border: 1px solid #516783; border-radius: 50%; display: block; height: 32px; object-fit: cover; width: 32px; }
.user-avatar-fallback { align-items: center; color: #d7e6f4; display: flex; font: 700 11px var(--mono); justify-content: center; }
.user-identity { display: block; line-height: 1.2; max-width: 180px; }
.user-identity strong, .user-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-identity strong { color: #f5f8fc; font-size: 11px; }
.user-identity small { color: #8fa4bf; font: 8px var(--mono); margin-top: 3px; }
.logout-link { border: 1px solid #40536f; border-radius: 5px; color: #cbd6e4; font-size: 9px; font-weight: 700; padding: 7px 9px; text-decoration: none; white-space: nowrap; }
.logout-link:hover { border-color: #7890ad; color: #fff; }

.session-pending .shell, .session-pending .landing { visibility: hidden; }
.anonymous .header-progress { display: none; }

.shell { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: calc(100vh - 70px); }

.landing { margin: 0 auto; max-width: 1440px; padding: clamp(28px, 4vw, 58px); }
.landing-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #132e52 65%, #0c596c 100%);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: #fff;
  display: grid;
  gap: clamp(30px, 5vw, 72px);
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  min-height: min(680px, calc(100vh - 128px));
  overflow: hidden;
  padding: clamp(38px, 6vw, 84px);
  position: relative;
}
.landing-hero::before { background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px); background-size: 18px 18px; content: ""; height: 280px; opacity: .45; position: absolute; right: -55px; top: -55px; width: 390px; }
.landing-copy { align-self: center; position: relative; z-index: 1; }
.landing-copy .eyebrow { color: #67e8f9; }
.landing-copy h1 { font-size: clamp(48px, 6.3vw, 86px); max-width: 830px; }
.landing-lede { color: #cad8e8; font-size: clamp(15px, 1.45vw, 19px); line-height: 1.7; max-width: 690px; }
.landing-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 16px 20px; margin-top: 29px; }
.landing-actions > span { color: #8fa7c1; font: 9px var(--mono); }
.landing-login { align-items: center; background: var(--cyan); border-radius: 6px; color: #092039; display: inline-flex; font-size: 12px; font-weight: 800; gap: 25px; padding: 13px 17px; text-decoration: none; transition: background .15s, transform .15s; }
.landing-login:hover { background: #67e8f9; transform: translateY(-1px); }
.landing-spec { align-self: end; border-bottom: 1px solid rgba(255, 255, 255, .2); border-top: 1px solid rgba(255, 255, 255, .2); display: grid; grid-column: 1; grid-template-columns: repeat(3, 1fr); }
.landing-spec div { padding: 16px 15px 16px 0; }
.landing-spec div + div { border-left: 1px solid rgba(255, 255, 255, .17); padding-left: 18px; }
.landing-spec strong { color: #fff; display: block; font: 700 21px var(--mono); }
.landing-spec span { color: #8fa7c1; display: block; font: 8px/1.45 var(--mono); letter-spacing: .05em; margin-top: 4px; text-transform: uppercase; }
.landing-code { align-self: center; background: #091321; border: 1px solid #31506d; border-radius: 9px; box-shadow: 0 24px 60px rgba(1, 8, 18, .35); grid-column: 2; grid-row: 1 / 3; min-width: 0; overflow: hidden; position: relative; z-index: 1; }
.landing-code-head { align-items: center; background: #17233a; border-bottom: 1px solid #2d3c56; color: #9eacc0; display: flex; font: 8px var(--mono); justify-content: space-between; letter-spacing: .07em; padding: 13px 16px; text-transform: uppercase; }
.landing-code-head span:last-child { color: #6ee7b7; }
.landing-code pre { color: #dbe6f5; font: clamp(9px, .9vw, 12px)/1.9 var(--mono); margin: 0; overflow-x: auto; padding: 25px 20px; white-space: pre; }
.landing-line { color: #4f6179; display: inline-block; margin-right: 16px; text-align: right; user-select: none; width: 18px; }
.landing-runtime { align-items: center; background: #07101d; border-top: 1px solid #21314a; display: grid; font: 9px var(--mono); gap: 10px; grid-template-columns: auto minmax(0, 1fr) auto; padding: 13px 17px; }
.landing-runtime > span:first-child { color: #67e8f9; font-weight: 700; }
.landing-runtime > span:last-child { color: #71839c; }
.landing-runtime code { background: transparent; color: #a7f3d0; overflow: hidden; padding: 0; text-overflow: ellipsis; white-space: nowrap; }
.landing-audience { align-items: end; border-bottom: 1px solid var(--line-strong); display: grid; gap: clamp(35px, 8vw, 120px); grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); padding: clamp(68px, 9vw, 120px) clamp(8px, 2vw, 28px) clamp(42px, 6vw, 75px); }
.landing-audience h2 { font-size: clamp(34px, 4.2vw, 58px); letter-spacing: -.045em; line-height: 1.05; margin: 0; max-width: 720px; }
.landing-audience > p { color: #526173; font-size: 14px; line-height: 1.8; margin: 0 0 5px; max-width: 570px; }
.landing-capabilities { display: grid; grid-template-columns: repeat(4, 1fr); }
.landing-capabilities article { border-bottom: 1px solid var(--line); min-height: 275px; padding: 35px clamp(18px, 2.3vw, 35px); }
.landing-capabilities article + article { border-left: 1px solid var(--line); }
.landing-capabilities article > span { color: var(--blue); font: 700 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.landing-capabilities h3 { font-size: 19px; margin: 37px 0 13px; }
.landing-capabilities p { color: #5d6979; font-size: 11.5px; line-height: 1.7; margin: 0; }
.landing-close { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: flex; justify-content: space-between; margin-top: clamp(45px, 6vw, 80px); padding: clamp(28px, 4vw, 48px); }
.landing-close h2 { font-size: clamp(27px, 3vw, 40px); letter-spacing: -.035em; margin: 0; }
.landing-login-dark { background: var(--navy); color: #fff; flex: 0 0 auto; }
.landing-login-dark:hover { background: var(--navy-light); }

.rail {
  background: #f9fbfd;
  border-right: 1px solid var(--line);
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  padding: 22px 15px;
  position: sticky;
  scrollbar-color: #c5cfdb transparent;
  scrollbar-width: thin;
  top: 70px;
}

.rail-heading { align-items: center; display: flex; justify-content: space-between; margin: 0 8px 13px; }
.rail-heading > span { color: #344054; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.text-button { background: none; border: 0; color: var(--muted); cursor: pointer; font: 9px var(--mono); padding: 4px; text-decoration: underline; }
.text-button:hover { color: var(--blue); }

.overview-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #344054;
  cursor: pointer;
  display: flex;
  font-size: 12px;
  font-weight: 650;
  gap: 9px;
  margin-bottom: 9px;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}
.overview-button:hover, .overview-button.active { background: #e7eef8; color: var(--blue-dark); }
.overview-icon { color: var(--blue); font: 15px var(--mono); }

.module-group { border-top: 1px solid var(--line); }
.module-group:last-child { border-bottom: 1px solid var(--line); }
.module-button {
  align-items: start;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: grid;
  gap: 2px 8px;
  grid-template-columns: 23px minmax(0, 1fr) auto;
  padding: 11px 9px;
  text-align: left;
  width: 100%;
}
.module-button:hover, .module-button.active { background: #edf3fa; }
.module-number { color: #7b8798; font: 10px var(--mono); padding-top: 2px; }
.module-title { font-size: 11.5px; font-weight: 700; line-height: 1.35; }
.module-score { color: var(--muted); font: 9px var(--mono); padding-top: 2px; }
.module-track { color: #7b8798; font: 8px var(--mono); grid-column: 2; letter-spacing: .03em; text-transform: uppercase; }

.module-sections { display: none; padding: 1px 7px 9px 31px; }
.module-group.open .module-sections { display: block; }
.section-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-left: 1px solid #cdd7e4;
  color: #596678;
  cursor: pointer;
  display: grid;
  font-size: 10px;
  gap: 7px;
  grid-template-columns: 21px minmax(0, 1fr);
  line-height: 1.3;
  padding: 6px 7px;
  text-align: left;
  width: 100%;
}
.section-button:hover { color: var(--blue-dark); }
.section-button.active { background: #e8f1ff; border-left: 2px solid var(--blue); border-radius: 0 4px 4px 0; color: #1549a8; font-weight: 650; }
.section-status { color: #8190a3; font: 8px var(--mono); }
.section-status.done { color: var(--green); font-size: 10px; }

.rail-note { color: #8190a3; font: 9px var(--mono); margin: 20px 8px 0; }
.status-dot { background: var(--green); border-radius: 50%; display: inline-block; height: 6px; margin-right: 5px; width: 6px; }
.status-dot.saving { background: #f59e0b; }
.status-dot.saved { background: var(--green); }
.status-dot.error { background: var(--red); }

main { min-width: 0; outline: none; padding: clamp(28px, 4vw, 58px); }
.overview, .lesson { margin: 0 auto; max-width: 1150px; }

.overview-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #173b69 72%, #0d6376 100%);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: #fff;
  display: grid;
  gap: clamp(30px, 6vw, 80px);
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  overflow: hidden;
  padding: clamp(35px, 6vw, 72px);
  position: relative;
}
.overview-hero::after {
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
  background-size: 17px 17px;
  content: "";
  height: 180px;
  opacity: .5;
  position: absolute;
  right: -30px;
  top: -25px;
  width: 260px;
}
.eyebrow { color: var(--blue); font: 700 10px var(--mono); letter-spacing: .11em; margin: 0 0 13px; text-transform: uppercase; }
.overview-hero .eyebrow { color: #67e8f9; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(42px, 6vw, 72px); font-weight: 760; letter-spacing: -.055em; line-height: .98; margin-bottom: 22px; max-width: 720px; }
.lede { color: #d5e0ee; font-size: 17px; line-height: 1.65; max-width: 680px; }
.primary-action { background: var(--cyan); border: 0; border-radius: 6px; color: #092039; cursor: pointer; font-size: 12px; font-weight: 800; margin-top: 12px; padding: 12px 17px; }
.primary-action:hover { background: #67e8f9; transform: translateY(-1px); }
.primary-action span { margin-left: 12px; }
.course-facts { align-self: center; border-left: 1px solid rgba(255, 255, 255, .22); padding-left: 24px; position: relative; z-index: 1; }
.fact { border-top: 1px solid rgba(255, 255, 255, .2); padding: 12px 0; }
.fact:last-child { border-bottom: 1px solid rgba(255, 255, 255, .2); }
.fact span { color: #8fabc9; display: block; font: 8px var(--mono); letter-spacing: .08em; margin-bottom: 3px; text-transform: uppercase; }
.fact strong { color: #f4f8fc; font-size: 11px; font-weight: 600; line-height: 1.45; }

.principles { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); padding: 24px 0 55px; }
.principle { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: #475467; font-size: 11px; line-height: 1.5; padding: 16px; }
.principle > span { color: var(--blue); display: block; font: 700 9px var(--mono); margin-bottom: 8px; }

.index-heading { align-items: end; border-bottom: 1px solid var(--line-strong); display: flex; justify-content: space-between; margin-bottom: 18px; padding-bottom: 16px; }
.index-heading h2 { font-size: 30px; letter-spacing: -.025em; margin: 0; }
.index-heading > p { color: var(--muted); font-size: 12px; margin: 0; max-width: 350px; text-align: right; }
.module-index { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.index-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  gap: 4px 10px;
  grid-template-columns: 28px 1fr;
  min-height: 130px;
  padding: 17px;
  text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.index-card:hover { border-color: #8aabe1; box-shadow: var(--shadow); transform: translateY(-2px); }
.index-number { color: var(--blue); font: 700 11px var(--mono); grid-row: 1 / 4; }
.index-track { color: #7b8798; font: 8px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.index-card strong { align-self: start; font-size: 14px; line-height: 1.35; }
.index-meta { align-self: end; color: #7b8798; font: 8px var(--mono); }

.step-header { border-bottom: 1px solid var(--line); margin-bottom: 32px; padding-bottom: 22px; }
.step-breadcrumb { color: #718096; display: flex; font: 9px var(--mono); gap: 0; letter-spacing: .05em; margin-bottom: 16px; text-transform: uppercase; }
.step-breadcrumb span + span::before { color: #b3bdca; content: "/"; margin: 0 9px; }
.step-title-row { align-items: end; display: flex; gap: 20px; justify-content: space-between; }
.module-name { color: var(--blue-dark); font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.step-title-row h2 { font-size: clamp(30px, 4vw, 46px); font-weight: 760; letter-spacing: -.045em; line-height: 1.06; margin: 0; }
.duration { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 20px; color: #526173; font: 9px var(--mono); padding: 7px 11px; white-space: nowrap; }

.step-progress { border-radius: 3px; display: flex; gap: 0; margin-top: 25px; overflow: visible; width: 100%; }
.step-pip { background: #dce4ed; border: 0; border-radius: 0; cursor: pointer; flex: 1 1 0; height: 6px; min-width: 0; padding: 0; position: relative; }
.step-pip:first-child { border-radius: 3px 0 0 3px; }
.step-pip:last-child { border-radius: 0 3px 3px 0; }
.step-pip:hover { background: #b9c8da; }
.step-pip.done { background: var(--green); }
.step-pip.active { background: var(--blue); }
.step-pip span { color: var(--blue-dark); font: 800 8px var(--mono); left: 50%; position: absolute; top: 10px; transform: translateX(-50%); }

.concept-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 270px; }
.concept-main { min-width: 0; }
.concept-card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 4px 16px rgba(15, 31, 56, .04); padding: clamp(25px, 4vw, 42px); }
.content-label { color: #64748b; display: block; font: 700 9px var(--mono); letter-spacing: .09em; margin-bottom: 11px; text-transform: uppercase; }
.concept-card h3 { font-size: 25px; letter-spacing: -.025em; margin-bottom: 15px; }
.concept-card p { color: #435064; font-size: 15px; line-height: 1.75; margin-bottom: 0; }

.worked-examples { margin-top: 18px; }
.worked-examples-heading { align-items: center; display: flex; gap: 15px; justify-content: space-between; margin-bottom: 10px; padding: 0 4px; }
.worked-examples-heading h3 { font-size: 18px; margin: 0; }
.repl-transcript { color: #d5e3f2; font: 11px/1.55 var(--mono); max-height: 320px; overflow: auto; padding: 0 17px 10px; }
.repl-welcome { color: #607089; }
.repl-entry { margin: 0; position: relative; white-space: pre-wrap; }
.repl-entry.command { color: #d5e3f2; padding: 4px 0; }
.repl-entry.command > span { color: #67e8f9; user-select: none; }
.repl-entry.result { color: #a7f3d0; min-height: 15px; padding: 1px 55px 7px 33px; }
.repl-entry.result.error { color: #f4aaaa; }
.repl-entry.result pre { font: inherit; margin: 0; white-space: pre-wrap; }
.repl-entry-time { color: #50627b; font-size: 8px; position: absolute; right: 0; top: 2px; }
.repl-command-row { align-items: start; border-top: 1px solid #1e293b; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; padding: 9px 11px 9px 17px; }
.repl-prompt { color: #67e8f9; font: 700 11px/1.55 var(--mono); padding-top: 6px; user-select: none; }
.repl-command-input { background: transparent; border: 0; caret-color: #fff; color: #d5e3f2; font: 11px/1.55 var(--mono); min-height: 0; outline: 0; overflow: hidden; padding: 6px 10px; resize: none; width: 100%; }
.repl-command-row .button { margin-top: 1px; }
.variable-inspector { border-top: 1px solid #1e293b; color: #aab8ca; font: 9px/1.5 var(--mono); }
.variable-inspector.is-empty { display: none; }
.variable-inspector-heading { align-items: center; background: #0c1728; color: #d5e3f2; display: flex; font-weight: 700; justify-content: space-between; letter-spacing: .06em; padding: 8px 17px; text-transform: uppercase; }
.variable-inspector-heading span:last-child { color: #c4b5fd; font-weight: 400; letter-spacing: 0; text-transform: none; }
.variable-inspector.source-changed .variable-inspector-heading::after { color: #f6c66d; content: " · source changed"; font-weight: 400; }
.variable-list { border-top: 1px solid #172237; max-height: 190px; overflow: auto; }
.variable-row { align-items: baseline; display: grid; gap: 8px; grid-template-columns: minmax(70px, .45fr) minmax(100px, .8fr) minmax(140px, 1.5fr); padding: 6px 17px; }
.variable-row + .variable-row { border-top: 1px solid #121e31; }
.variable-row.repl-variable { box-shadow: inset 2px 0 #67e8f9; }
.variable-row.trace-variable { box-shadow: inset 2px 0 #c084fc; }
.variable-name { color: #67e8f9; font-weight: 700; overflow-wrap: anywhere; }
.variable-type { color: #91a2ba; overflow-wrap: anywhere; }
.variable-preview { background: transparent; color: #a7f3d0; font: inherit; overflow-wrap: anywhere; padding: 0; }
.worked-example { background: #0f1b2d; border: 1px solid #263956; border-radius: 9px; color: #d9e4f2; margin-top: 10px; overflow: hidden; padding: clamp(22px, 3vw, 32px); }
.worked-example .content-label { color: #67e8f9; }
.worked-example h3 { color: #fff; font-size: 18px; margin: 0 0 18px; }
.example-heading { align-items: start; display: flex; gap: 15px; justify-content: space-between; }
.example-badge { background: #18314f; border: 1px solid #315170; border-radius: 20px; color: #9bdbea; font: 8px var(--mono); padding: 5px 8px; white-space: nowrap; }
.example-badge.connecting { color: #f6c66d; }
.example-badge.connected { color: #6ee7b7; }
.example-badge.error { color: #fca5a5; }
.example-editor-shell { border: 1px solid #253650; border-radius: 7px; margin-top: 16px; overflow: hidden; }
.example-toolbar { min-height: 40px; }
.example-terminal { background: #070d18; border-top: 1px solid var(--code-line); color: #cad5e5; }
.example-output { min-height: 52px; padding: 14px 17px 8px; position: relative; }
.example-runtime { color: #607089; font: 8px var(--mono); position: absolute; right: 12px; top: 10px; }
.example-direct-output { color: #d5e3f2; font: 10px/1.55 var(--mono); margin: 0; overflow-wrap: anywhere; padding-right: 58px; white-space: pre-wrap; }
.example-direct-output.error { color: #f4aaaa; }
.worked-code-block { background: #08111f; border: 1px solid #253650; border-radius: 6px; display: grid; grid-template-columns: 42px minmax(0, 1fr); margin: 0 0 16px; overflow: hidden; }
.worked-code-block pre { border: 0; border-radius: 0; font: 11px/1.65 var(--mono); margin: 0; padding: 17px 14px; white-space: pre; }
.worked-code-block .example-line-numbers { background: #0b1627; border-right: 1px solid #253650; color: #50627b; overflow: hidden; padding-left: 6px; padding-right: 9px; text-align: right; user-select: none; }
.worked-code-block .example-code { background: #08111f; overflow-x: auto; }
.worked-example pre code { background: transparent; color: #d8e5f5; font: 11px/1.65 var(--mono); padding: 0; }
.worked-example > p { color: #aebed2; font-size: 11px; line-height: 1.65; margin: 0; }

.quick-check { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; margin-top: 18px; padding: clamp(22px, 3vw, 32px); }
.quick-check.completed { border-color: #91d4bc; box-shadow: inset 3px 0 var(--green); }
.check-heading { align-items: start; display: flex; justify-content: space-between; }
.check-heading h3 { font-size: 18px; margin: 0; }
.check-state { background: var(--surface-soft); border-radius: 20px; color: #64748b; font: 8px var(--mono); padding: 6px 9px; }
.completed .check-state { background: var(--green-soft); color: #047857; }
.check-prompt { font-size: 14px; font-weight: 650; line-height: 1.55; margin: 24px 0 16px; }
.exercise-spec { background: #f7f9fc; border: 1px solid var(--line); border-radius: 7px; display: grid; gap: 25px; grid-template-columns: 1.2fr .8fr; margin-bottom: 17px; padding: 18px; }
.exercise-spec ul { margin: 0; padding-left: 17px; }
.exercise-spec li { color: #475569; font-size: 10.5px; line-height: 1.55; margin-bottom: 5px; padding-left: 2px; }
.exercise-spec .case-list { list-style: none; padding-left: 0; }
.exercise-spec .case-list li { border-left: 2px solid #93b4e8; padding-left: 9px; }
.micro-editor-shell { border-radius: 7px; overflow: hidden; }
.micro-toolbar { min-height: 42px; }
.micro-editor { min-height: 230px; }
.micro-output { min-height: 78px; }
.automated-checks { background: #f8fafc; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 17px; overflow: hidden; }
.automated-checks-heading { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 12px 15px; }
.automated-checks-heading .content-label { margin: 0; }
.checks-summary { color: #718096; font: 8px var(--mono); }
.checks-list { display: grid; }
.automated-check { align-items: center; border-top: 1px solid #e8edf3; color: #526173; display: grid; font-size: 10.5px; gap: 9px; grid-template-columns: 18px 1fr; padding: 8px 15px; }
.automated-check:first-child { border-top: 0; }
.check-icon { color: #94a3b8; font: 800 13px var(--mono); text-align: center; }
.automated-check.passed { background: #f0fdf7; color: #047857; }
.automated-check.passed .check-icon { color: var(--green); }
.automated-check.failed { background: var(--red-soft); color: #b91c1c; }
.automated-check.failed .check-icon { color: var(--red); }
.automated-check.not-run { background: #fffbeb; color: #92400e; }
.automated-check.not-run .check-icon { color: #d97706; }
.answer-options { display: grid; gap: 8px; }
.answer-option { align-items: center; background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; display: grid; font-size: 12px; gap: 10px; grid-template-columns: auto 25px 1fr; padding: 11px 13px; }
.answer-option:hover { background: var(--surface-blue); border-color: #abc4eb; }
.answer-option:has(input:checked) { background: var(--surface-blue); border-color: #7fa5e4; box-shadow: inset 2px 0 var(--blue); }
.answer-option input { accent-color: var(--blue); margin: 0; }
.option-key { color: #718096; font: 10px var(--mono); }
.check-actions { align-items: center; display: flex; gap: 15px; margin-top: 16px; }
.button { border: 0; border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: 750; padding: 9px 13px; }
.button:disabled { cursor: wait; opacity: .55; }
.button-check, .button-run { background: var(--blue); color: #fff; }
.button-check:hover, .button-run:hover { background: var(--blue-dark); }
.check-feedback { color: var(--muted); font-size: 11px; line-height: 1.5; }
.check-feedback.correct { color: #047857; }
.check-feedback.incorrect { color: var(--red); }

.context-column { display: flex; flex-direction: column; gap: 13px; }
.context-block { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 18px; }
.context-block.accent { background: var(--surface-blue); border-color: #b9ceef; }
.context-block p { color: #526173; font-size: 11px; line-height: 1.6; margin: 0; }

.lab-prerequisites { background: var(--surface-blue); border: 1px solid #b9ceef; border-bottom: 0; border-radius: 9px 9px 0 0; padding: 15px 20px; }
.lab-prerequisites .content-label { margin-bottom: 8px; }
.lab-prerequisites > div { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-prerequisites > div span { background: #fff; border: 1px solid #c5d6ef; border-radius: 20px; color: #34527f; font-size: 9px; padding: 4px 8px; }

.lab-intro { align-items: start; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 35px; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); padding: clamp(24px, 4vw, 38px); }
.lab-intro + .automated-checks { border-radius: 0; border-top: 0; margin-bottom: 0; }
.lab-intro h3 { font-size: 25px; letter-spacing: -.03em; margin-bottom: 8px; }
.lab-intro p { color: var(--muted); font-size: 12px; }
.lab-contract ul { margin: 0; padding-left: 18px; }
.lab-contract li { color: #435064; font-size: 11px; margin-bottom: 7px; padding-left: 3px; }

.lab-workbench { border-radius: 0 0 9px 9px; box-shadow: var(--shadow); overflow: hidden; }
.editor-toolbar { align-items: center; background: #17233a; border-top: 1px solid #2d3c56; color: #9eacc0; display: flex; justify-content: space-between; min-height: 46px; padding: 7px 11px 7px 17px; }
.editor-toolbar > span { font: 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.editor-actions { display: flex; gap: 7px; }
.button-secondary { background: #2b3a53; color: #d3dbe7; }
.button-secondary:hover { background: #3a4b67; }
.button-trace.active { background: #164e63; box-shadow: inset 0 0 0 1px #22d3ee; color: #cffafe; }
.button-run { min-width: 88px; }
.editor-code-layer { background: var(--code); position: relative; }
.editor-global-overlays { inset: 0; overflow: hidden; pointer-events: none; position: absolute; z-index: 4; }
.editor-global-badge {
  background: rgba(16, 45, 66, .94);
  border: 1px solid rgba(103, 232, 249, .28);
  border-radius: 4px;
  color: #a7f3d0;
  font: 9px/1.45 var(--mono);
  overflow: hidden;
  padding: 2px 6px;
  position: absolute;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-global-badge.traced { border-color: rgba(192, 132, 252, .48); color: #ddd6fe; }
.autocomplete-menu {
  background: #111d31;
  border: 1px solid #3a4b67;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .35);
  color: #e8eef7;
  font: 10.5px var(--mono);
  overflow-y: auto;
  position: fixed;
  z-index: 30;
}
.autocomplete-caret-mirror { margin: 0; overflow: hidden; pointer-events: none; position: fixed; visibility: hidden; }
.autocomplete-option { align-items: center; cursor: pointer; display: flex; gap: 16px; justify-content: space-between; min-height: 34px; padding: 6px 10px; }
.autocomplete-option + .autocomplete-option { border-top: 1px solid #263750; }
.autocomplete-option.active, .autocomplete-option:hover { background: rgba(6, 182, 212, .15); }
.autocomplete-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.autocomplete-detail { color: #91a2ba; flex: 0 1 auto; font-size: 9px; line-height: 1.35; max-width: 78%; overflow-wrap: anywhere; text-align: right; }
.autocomplete-detail.kind-function, .autocomplete-detail.kind-method { color: #67e8f9; }
.autocomplete-detail.kind-keyword { color: #c084fc; }
.autocomplete-detail.kind-class { color: #fbbf24; }
.editor-line-numbers {
  background: #0a1424;
  border-right: 1px solid #1f2d44;
  bottom: 0;
  color: #50627b;
  font: 12.5px/1.65 var(--mono);
  left: 0;
  margin: 0;
  overflow: hidden;
  padding: 21px 10px 21px 0;
  pointer-events: none;
  position: absolute;
  text-align: right;
  top: 0;
  user-select: none;
  white-space: pre;
  width: var(--editor-gutter);
  z-index: 2;
}
.code-highlight {
  border: 0;
  color: #dbe6f5;
  font: 12.5px/1.65 var(--mono);
  inset: 0;
  margin: 0;
  overflow: hidden;
  padding: 21px;
  padding-left: calc(var(--editor-gutter) + 16px);
  pointer-events: none;
  position: absolute;
  tab-size: 4;
  white-space: pre;
  z-index: 0;
}
.code-editor {
  -webkit-text-fill-color: transparent;
  background: transparent;
  border: 0;
  caret-color: #f8fafc;
  color: transparent;
  display: block;
  font: 12.5px/1.65 var(--mono);
  min-height: 400px;
  outline: none;
  overflow: auto;
  padding: 21px;
  padding-left: calc(var(--editor-gutter) + 16px);
  position: relative;
  resize: vertical;
  tab-size: 4;
  white-space: pre;
  width: 100%;
  z-index: 1;
}
.code-editor:focus { box-shadow: inset 3px 0 var(--cyan); }
.code-editor::selection { background: rgba(59, 130, 246, .42); -webkit-text-fill-color: transparent; }
.code-editor.example-editor { height: auto; min-height: 0; resize: none; }
.tok-keyword { color: #c084fc; font-weight: 650; }
.tok-builtin { color: #67e8f9; }
.tok-string { color: #a7f3d0; }
.tok-comment { color: #71839c; font-style: italic; }
.tok-number { color: #fbbf80; }
.tok-decorator { color: #f9a8d4; }
.tok-self { color: #93c5fd; font-style: italic; }
.tok-operator { color: #94a3b8; }
.hint-panel { background: #17233a; border-top: 1px solid #33425e; color: #b9c7d9; display: none; font: 10px/1.6 var(--mono); padding: 14px 20px; }
.hint-panel.visible { display: block; }
.hint-panel strong { color: #67e8f9; }
.output { background: #070d18; border-top: 1px solid var(--code-line); color: #cad5e5; min-height: 108px; padding: 17px 20px; }
.output-empty { align-items: center; color: #758398; display: flex; font: 10px var(--mono); gap: 12px; }
.output-empty span { color: var(--cyan); font-size: 15px; }
.output-empty p { margin: 0; }
kbd { border: 1px solid #4a5970; border-radius: 3px; font: 9px var(--mono); padding: 2px 5px; }
.result-head { align-items: center; display: flex; font: 10px var(--mono); justify-content: space-between; margin-bottom: 11px; }
.result-head strong { font-size: 11px; text-transform: uppercase; }
.result-head .passed { color: #6ee7b7; }
.result-head .failed, .result-head .error, .result-head .timeout { color: #fca5a5; }
.test-result { border-top: 1px solid #1e293b; display: grid; font: 10px/1.5 var(--mono); gap: 9px; grid-template-columns: 17px 1fr; padding: 8px 0; }
.test-result .ok { color: #6ee7b7; }
.test-result .bad { color: #fca5a5; }
.test-message, .stream { color: #f4aaaa; font: 9px/1.5 var(--mono); grid-column: 2; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.stream { border-top: 1px dashed #29364a; color: #aebcd0; grid-column: auto; margin-top: 9px; padding-top: 9px; }

.lesson-footer { display: flex; justify-content: space-between; margin-top: 28px; }
.nav-button { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: 700; padding: 10px 14px; }
.nav-button:hover { border-color: #7fa5e4; color: var(--blue-dark); }
.nav-button-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.nav-button-primary:hover { background: var(--navy-light); color: #fff; }

@media (max-width: 980px) {
  .shell { display: block; }
  .rail { border-bottom: 1px solid var(--line); border-right: 0; max-height: none; overflow-x: auto; padding: 10px 16px; position: static; }
  .rail-heading, .rail-note { display: none; }
  #lesson-nav { display: flex; min-width: max-content; }
  .overview-button { margin: 0 7px 0 0; padding: 9px 13px; width: auto; }
  .module-group { border: 0; margin-right: 7px; }
  .module-button { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; display: block; height: 54px; padding: 8px 11px; width: 155px; }
  .module-number, .module-title, .module-track { display: block; }
  .module-number { float: left; margin-right: 7px; }
  .module-title { font-size: 10px; }
  .module-track { margin-left: 23px; margin-top: 2px; }
  .module-score { display: none; }
  .module-sections { display: none !important; }
  main { padding: 34px 24px 55px; }
  .landing { padding: 28px 24px 50px; }
  .landing-hero { grid-template-columns: 1fr; min-height: 0; }
  .landing-spec { grid-column: 1; grid-row: auto; }
  .landing-code { grid-column: 1; grid-row: auto; }
  .landing-capabilities { grid-template-columns: repeat(2, 1fr); }
  .landing-capabilities article:nth-child(3) { border-left: 0; }
}

@media (max-width: 760px) {
  .masthead { height: 64px; padding: 0 15px; }
  .brand strong { font-size: 12px; }
  .brand small { display: none; }
  .header-progress { gap: 7px; }
  .header-progress > span { font-size: 8px; }
  .progress-track { width: 55px; }
  .masthead-actions { gap: 9px; }
  .gateway-mode .header-progress { display: none; }
  .user-menu { gap: 7px; padding-left: 0; }
  .user-avatar { height: 28px; width: 28px; }
  .user-identity { max-width: 100px; }
  .user-identity small { display: none; }
  .logout-link { font-size: 8px; padding: 6px 7px; }
  main { padding: 24px 14px 45px; }
  .landing { padding: 20px 14px 42px; }
  .landing-hero { padding: 38px 25px 28px; }
  .landing-copy h1 { font-size: clamp(43px, 13vw, 64px); }
  .landing-audience { align-items: start; grid-template-columns: 1fr; }
  .landing-close { align-items: flex-start; flex-direction: column; gap: 25px; }
  .overview-hero { grid-template-columns: 1fr; padding: 30px 24px; }
  h1 { font-size: 43px; }
  .course-facts { border-left: 0; padding-left: 0; }
  .principles { grid-template-columns: repeat(2, 1fr); padding-bottom: 40px; }
  .module-index { grid-template-columns: 1fr; }
  .index-heading { align-items: start; display: block; }
  .index-heading > p { margin-top: 8px; text-align: left; }
  .step-breadcrumb { flex-wrap: wrap; }
  .step-title-row { align-items: start; }
  .step-title-row h2 { font-size: 32px; }
  .duration { font-size: 7px; }
  .concept-layout { grid-template-columns: 1fr; }
  .context-column { display: grid; grid-template-columns: repeat(2, 1fr); }
  .lab-intro { grid-template-columns: 1fr; }
  .exercise-spec { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  :root { --editor-gutter: 42px; }
  .principles, .context-column { grid-template-columns: 1fr; }
  .check-heading, .check-actions { align-items: start; flex-direction: column; }
  .worked-examples-heading { align-items: flex-start; flex-direction: column; }
  .repl-command-row { grid-template-columns: auto minmax(0, 1fr); }
  .repl-command-row .button { grid-column: 2; justify-self: end; }
  .answer-option { grid-template-columns: auto 20px 1fr; padding: 10px; }
  .editor-toolbar { align-items: start; gap: 8px; }
  .editor-actions { flex-wrap: wrap; justify-content: end; }
  .button { font-size: 8px; padding: 8px 9px; }
  .code-editor { font-size: 11px; min-height: 430px; padding: 15px; padding-left: calc(var(--editor-gutter) + 12px); }
  .code-highlight { font-size: 11px; padding: 15px; padding-left: calc(var(--editor-gutter) + 12px); }
  .editor-line-numbers { font-size: 11px; padding-bottom: 15px; padding-top: 15px; }
  .micro-editor { min-height: 260px; }
  .code-editor.example-editor { min-height: 0; }
  .lesson-footer { gap: 10px; }
  .nav-button { font-size: 8px; }
  .anonymous .brand small { display: none; }
  .gateway-mode .user-identity { display: none; }
  .landing-hero { border-radius: 10px; gap: 34px; padding: 34px 20px 22px; }
  .landing-lede { font-size: 14px; }
  .landing-actions { align-items: flex-start; flex-direction: column; }
  .landing-spec { grid-template-columns: 1fr; }
  .landing-spec div { padding: 12px 0; }
  .landing-spec div + div { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .17); padding-left: 0; }
  .landing-spec strong { display: inline-block; font-size: 17px; margin-right: 9px; }
  .landing-spec span { display: inline; }
  .landing-code pre { font-size: 8px; padding: 18px 12px; }
  .landing-line { margin-right: 9px; width: 15px; }
  .landing-runtime { grid-template-columns: auto minmax(0, 1fr); }
  .landing-runtime > span:last-child { display: none; }
  .landing-audience { padding-left: 6px; padding-right: 6px; }
  .landing-capabilities { grid-template-columns: 1fr; }
  .landing-capabilities article { min-height: 0; padding: 30px 7px; }
  .landing-capabilities article + article { border-left: 0; }
  .landing-capabilities h3 { margin-top: 22px; }
}

@media (forced-colors: active) {
  .code-highlight { display: none; }
  .code-editor { -webkit-text-fill-color: CanvasText; background: Canvas; color: CanvasText; }
}
