:root {
  --bg: #0e1311;
  --bg-2: #121916;
  --surface: #161e1a;
  --surface-2: #1c2621;
  --border: #26332c;
  --border-strong: #35463d;
  --text: #e4ece7;
  --muted: #93a79c;
  --faint: #62756a;
  --accent: #5ee08f;
  --accent-ink: #06210f;
  --accent-soft: rgba(94, 224, 143, 0.12);
  --amber: #f3b54a;
  --amber-soft: rgba(243, 181, 74, 0.12);
  --red: #f47c7c;
  --red-soft: rgba(244, 124, 124, 0.12);
  --blue: #7cc4fa;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --radius-sm: 6px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --header-h: 56px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f7f4;
  --bg-2: #eef1ec;
  --surface: #ffffff;
  --surface-2: #f3f5f1;
  --border: #dde3dc;
  --border-strong: #c5cfc4;
  --text: #17201b;
  --muted: #56675d;
  --faint: #8a998f;
  --accent: #15803d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(21, 128, 61, 0.1);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.1);
  --red: #c53030;
  --red-soft: rgba(197, 48, 48, 0.08);
  --blue: #1d6fb8;
  --shadow: 0 10px 30px rgba(20, 40, 30, 0.08);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--mono); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 0.5em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
::selection { background: var(--accent-soft); }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { height: 100%; display: flex; align-items: center; gap: 24px; max-width: none; padding: 0 20px; }
.logo { font-family: var(--mono); font-weight: 600; font-size: 1.15rem; color: var(--text); display: flex; align-items: center; gap: 2px; }
.logo:hover { text-decoration: none; }
.logo .dot { color: var(--accent); }
.logo .cursor { display: inline-block; width: 0.55em; height: 1.05em; background: var(--accent); margin-left: 3px; animation: blink 1.1s steps(1) infinite; transform: translateY(2px); }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .logo .cursor { animation: none; } }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 0.93rem; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.xp-chip { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); display: flex; gap: 10px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
.xp-chip b { color: var(--text); font-weight: 600; }
.xp-chip .streak b { color: var(--amber); }
.icon-btn { background: none; border: 1px solid transparent; color: var(--muted); width: 34px; height: 34px; border-radius: var(--radius-sm); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--surface); }
.menu-toggle { display: none; }

@media (max-width: 760px) {
  .menu-toggle { display: inline-grid; }
  .nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .xp-chip { display: none; }
  .site-header .container { gap: 12px; padding: 0 16px; }
}

/* Buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 0.93rem var(--sans);
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn kbd { font-size: 0.72rem; opacity: .7; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }

.form { display: grid; gap: 16px; }
.field label { display: block; font-size: 0.88rem; font-weight: 500; margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field .error { color: var(--red); font-size: 0.85rem; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }

.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin: 16px 0; border: 1px solid var(--border); background: var(--surface); }
.flash.error { border-color: var(--red); background: var(--red-soft); }
.flash.success { border-color: var(--accent); background: var(--accent-soft); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.auth-card { max-width: 420px; margin: 56px auto; }
.auth-card h1 { font-size: 1.5rem; }

.badge { display: inline-flex; align-items: center; gap: 4px; font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); }
.badge.free { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.badge.pro { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }

.progress { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }

main { flex: 1; }
.page { padding: 40px 0 72px; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--faint); font-size: 0.88rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* Landing */
.hero { padding: 72px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.eyebrow { font: 500 0.8rem var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.3rem); line-height: 1.08; letter-spacing: -0.025em; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { font-size: 1.14rem; color: var(--muted); max-width: 34em; margin-bottom: 28px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { font-size: 0.86rem; color: var(--faint); margin-top: 14px; }

.terminal { background: #0a0f0c; border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; font: 0.84rem/1.55 var(--mono); color: #cfe3d6; }
.terminal-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid #1f2b24; color: #6f8a7a; font-size: 0.76rem; }
.terminal-bar i { width: 10px; height: 10px; border-radius: 50%; background: #25332b; display: inline-block; }
.terminal-bar span { margin-left: 8px; }
.terminal pre { margin: 0; padding: 16px 18px; overflow-x: auto; white-space: pre; }
.terminal .k { color: #7cc4fa; } .terminal .s { color: #f3b54a; } .terminal .c { color: #5d7668; } .terminal .n { color: #c6a2f7; }
.terminal .out { border-top: 1px dashed #1f2b24; color: #5ee08f; }

.section { padding: 64px 0; border-top: 1px solid var(--border); }
.section h2 { font-size: 1.8rem; margin-top: 0; letter-spacing: -0.02em; }
.section-lead { color: var(--muted); max-width: 40em; margin-bottom: 36px; font-size: 1.05rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { padding: 22px; }
.feature h3 { margin: 12px 0 6px; font-size: 1.02rem; }
.feature p { color: var(--muted); font-size: 0.94rem; margin: 0; }
.feature .ico { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }

.syllabus { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.syllabus-item { display: flex; gap: 14px; padding: 16px 18px; }
.syllabus-item .num { font: 600 0.9rem var(--mono); color: var(--faint); min-width: 26px; }
.syllabus-item h3 { margin: 0 0 4px; font-size: 1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.syllabus-item p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.stats-row { display: flex; gap: 40px; flex-wrap: wrap; margin-top: 36px; }
.stat b { display: block; font: 600 1.7rem var(--mono); }
.stat span { color: var(--muted); font-size: 0.88rem; }

/* Course overview */
.course-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.module { margin-bottom: 18px; padding: 0; overflow: hidden; }
.module-head { display: flex; gap: 16px; align-items: center; padding: 18px 20px; }
.module-head .num { font: 600 1.4rem var(--mono); color: var(--faint); min-width: 40px; }
.module-head h2 { margin: 0; font-size: 1.12rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.module-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.module-head .meta { margin-left: auto; min-width: 120px; text-align: right; font: 0.8rem var(--mono); color: var(--muted); }
.module-head .meta .progress { margin-top: 6px; }
.lesson-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.lesson-list li a { display: flex; align-items: center; gap: 12px; padding: 11px 20px 11px 76px; color: var(--text); border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.lesson-list li:last-child a { border-bottom: 0; }
.lesson-list li a:hover { background: var(--surface-2); text-decoration: none; }
.lesson-list .state { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none; display: grid; place-items: center; }
.lesson-list .done .state { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lesson-list .kind { margin-left: auto; font: 0.74rem var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.lesson-list .locked { color: var(--faint); }
@media (max-width: 640px) {
  .lesson-list li a { padding-left: 20px; }
  .module-head .meta { display: none; }
}

/* Lesson — reading layout */
.lesson-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.lesson-nav { border-right: 1px solid var(--border); padding: 20px 0; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; background: var(--bg-2); }
.lesson-nav h4 { margin: 0 20px 8px; font: 500 0.74rem var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.lesson-nav .mod-title { margin: 18px 20px 6px; font-size: 0.86rem; font-weight: 600; color: var(--muted); }
.lesson-nav a { display: flex; gap: 10px; align-items: center; padding: 6px 20px; font-size: 0.88rem; color: var(--muted); }
.lesson-nav a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.lesson-nav a.current { color: var(--text); background: var(--surface); box-shadow: inset 3px 0 var(--accent); }
.lesson-nav a .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none; }
.lesson-nav a.done .dot { background: var(--accent); border-color: var(--accent); }
.article { max-width: 760px; padding: 40px 40px 80px; }
.article-head .crumbs { font: 0.8rem var(--mono); color: var(--faint); margin-bottom: 10px; }
.article-head h1 { font-size: 2rem; margin-bottom: 6px; }
.article-head .meta { color: var(--muted); font-size: 0.88rem; display: flex; gap: 14px; margin-bottom: 28px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .lesson-shell { grid-template-columns: minmax(0, 1fr); }
  .lesson-nav { display: none; }
  .article { padding: 28px 16px 64px; }
}

/* Prose */
.prose { font-size: 1.02rem; }
.prose code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.08em 0.35em; font-size: 0.88em; }
.prose pre { background: #0a0f0c; color: #d8e8de; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; font-size: 0.86rem; line-height: 1.55; margin: 0 0 1.2em; }
:root[data-theme="light"] .prose pre { background: #f1f4ef; color: #1a2a20; }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: 0.25em 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: 0.92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.admonition { border: 1px solid var(--border); border-left: 3px solid var(--blue); background: var(--surface); border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 1.2em; }
.admonition > :last-child { margin-bottom: 0; }
.admonition-title { font-weight: 600; margin-bottom: 4px; font-size: 0.95rem; }
.admonition.tip { border-left-color: var(--accent); }
.admonition.warning, .admonition.caution { border-left-color: var(--amber); }
.admonition.danger { border-left-color: var(--red); }

/* Quiz */
.quiz { margin-top: 36px; }
.quiz h2 { margin-top: 0; }
.q { padding: 18px 20px; margin-bottom: 14px; }
.q-title { font-weight: 600; margin-bottom: 12px; }
.q-title code { font-size: 0.9em; }
.q-opts { display: grid; gap: 8px; }
.q-opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-2); }
.q-opt:hover { border-color: var(--border-strong); }
.q-opt input { margin-top: 5px; accent-color: var(--accent); }
.q-opt.right { border-color: var(--accent); background: var(--accent-soft); }
.q-opt.wrong { border-color: var(--red); background: var(--red-soft); }
.q-explain { margin-top: 10px; font-size: 0.93rem; color: var(--muted); }
.q-explain > :last-child { margin-bottom: 0; }

.lesson-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.complete-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); margin-top: 24px; }

/* Workbench (exercise layout) */
.workbench { display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.25fr); height: calc(100vh - var(--header-h)); }
.wb-left { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.wb-right { display: grid; grid-template-rows: auto minmax(0, 1fr) 6px var(--out-h, 38%); min-height: 0; min-width: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; background: var(--bg-2); overflow-x: auto; flex: none; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: 500 0.88rem var(--sans); padding: 11px 12px 9px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { font: 0.72rem var(--mono); padding: 0 6px; border-radius: 999px; background: var(--surface-2); }
.tab .count.pass { background: var(--accent-soft); color: var(--accent); }
.tab .count.fail { background: var(--red-soft); color: var(--red); }
.pane { display: none; overflow-y: auto; min-height: 0; flex: 1; }
.pane.active { display: block; }
.wb-left .pane { padding: 24px 24px 48px; }
.wb-left .article-head h1 { font-size: 1.5rem; }
.task-box { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--surface); border-radius: var(--radius); padding: 16px 18px; margin: 24px 0; }
.task-box h3 { margin: 0 0 8px; font: 600 0.78rem var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.task-box > div > :last-child { margin-bottom: 0; }
.hints { margin-top: 12px; }
.hint { border-left: 3px solid var(--amber); background: var(--amber-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 10px 14px; margin-bottom: 8px; font-size: 0.93rem; }
.hint > :last-child { margin-bottom: 0; }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--bg-2); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar .pos { font: 0.78rem var(--mono); color: var(--faint); padding: 0 6px; }
.toolbar .pos .area { color: var(--muted); }
.editor-host { min-height: 0; min-width: 0; position: relative; }
#editor { position: absolute; inset: 0; }
.editor-fallback { width: 100%; height: 100%; resize: none; border: 0; padding: 12px; background: var(--bg); color: var(--text); font: 14px/1.5 var(--mono); tab-size: 4; }
.splitter { background: var(--border); cursor: row-resize; }
.splitter:hover, .splitter.dragging { background: var(--accent); }
.output { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); }
.output .pane { padding: 14px 16px; font-size: 0.9rem; }
.console { font: 0.84rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; margin: 0; }
.console .err { color: var(--red); }
.console .warn { color: var(--amber); }
.console .dim { color: var(--faint); }
.status-line { display: flex; align-items: center; gap: 8px; font: 500 0.88rem var(--sans); margin-bottom: 10px; }
.status-line.ok { color: var(--accent); }
.status-line.bad { color: var(--red); }
.status-line.warn { color: var(--amber); }
.empty { color: var(--faint); font-size: 0.9rem; }

.test { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); }
.test summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; font-size: 0.9rem; }
.test summary::-webkit-details-marker { display: none; }
.test .mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 0.7rem; flex: none; }
.test.pass .mark { background: var(--accent); color: var(--accent-ink); }
.test.fail .mark { background: var(--red); color: #fff; }
.test .msg { color: var(--muted); font-size: 0.84rem; margin-left: auto; text-align: right; }
.test-body { padding: 0 12px 12px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.diff h5 { margin: 8px 0 4px; font: 500 0.72rem var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.diff pre, .io pre { margin: 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; font: 0.8rem/1.45 var(--mono); overflow-x: auto; white-space: pre; min-height: 2.2em; }
.diff .line-bad { background: var(--red-soft); display: block; }
@media (max-width: 700px) { .diff { grid-template-columns: 1fr; } }

.dataset { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 14px; overflow: hidden; }
.dataset-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font: 0.82rem var(--mono); flex-wrap: wrap; }
.dataset-head .dd { color: var(--accent); font-weight: 600; }
.dataset-head .dir { margin-left: auto; color: var(--faint); font-size: 0.74rem; text-transform: uppercase; }
.dataset pre { margin: 0; padding: 10px 12px; font: 0.8rem/1.45 var(--mono); overflow-x: auto; background: var(--bg); max-height: 320px; }
.ruler { color: var(--faint); user-select: none; }

.success-card { text-align: center; padding: 22px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); border-radius: var(--radius); margin-bottom: 12px; }
.success-card .big { font-size: 1.2rem; font-weight: 600; margin-bottom: 4px; }
.success-card .xp { font: 600 0.9rem var(--mono); color: var(--accent); }

@media (max-width: 1000px) {
  .workbench { grid-template-columns: minmax(0, 1fr); height: auto; }
  .wb-left, .wb-right { min-width: 0; }
  .toolbar .pos { display: none; }
  .wb-left { border-right: 0; border-bottom: 1px solid var(--border); max-height: none; }
  .wb-left .pane { max-height: 55vh; }
  .wb-right { grid-template-rows: auto 60vh 0 auto; }
  .splitter { display: none; }
  .output { min-height: 260px; }
}

/* Dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 24px 0 32px; }
.dash-stat { padding: 18px 20px; }
.dash-stat .label { font: 500 0.76rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.dash-stat .value { font: 600 1.9rem var(--mono); margin-top: 4px; }
.dash-stat .value small { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.continue-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.continue-card h2 { margin: 4px 0 0; font-size: 1.25rem; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin-top: 28px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.mod-row { display: grid; grid-template-columns: 28px 1fr 90px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
.mod-row:last-child { border-bottom: 0; }
.mod-row .n { font: 0.82rem var(--mono); color: var(--faint); }
.recent-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.recent-item:last-child { border-bottom: 0; }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; max-width: 820px; margin: 36px auto 0; }
.plan { padding: 28px; display: flex; flex-direction: column; }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.plan h2 { margin: 0 0 4px; font-size: 1.2rem; }
.plan .price { font: 600 2.3rem var(--mono); margin: 14px 0 4px; }
.plan .price small { font-size: 0.95rem; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 24px; display: grid; gap: 9px; flex: 1; }
.plan li { display: flex; gap: 10px; font-size: 0.95rem; }
.plan li::before { content: "✓"; color: var(--accent); font-weight: 700; }
.plan li.no::before { content: "–"; color: var(--faint); }
.plan li.no { color: var(--faint); }

/* Locked */
.locked-card { max-width: 560px; margin: 64px auto; text-align: center; padding: 36px 32px; }
.locked-card .lock { width: 52px; height: 52px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); display: grid; place-items: center; margin: 0 auto 16px; }

/* Playground */
.playground { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); height: calc(100vh - var(--header-h)); }
.pg-editor { display: grid; grid-template-rows: auto minmax(0, 1fr); border-right: 1px solid var(--border); min-width: 0; }
.pg-side { display: flex; flex-direction: column; min-height: 0; }
.pg-side textarea { width: 100%; min-height: 110px; resize: vertical; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font: 0.84rem/1.45 var(--mono); }
.pg-side .pane { padding: 14px 16px; }
.pg-side label { display: block; font: 500 0.78rem var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 6px; }
@media (max-width: 900px) {
  .playground { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pg-editor { grid-template-rows: auto 60vh; border-right: 0; }
}

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120%); visibility: hidden; opacity: 0; transition: transform .25s, opacity .25s, visibility .25s; background: var(--surface); border: 1px solid var(--border-strong); padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 100; font-size: 0.92rem; max-width: calc(100% - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); visibility: visible; opacity: 1; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding: 44px 0 32px; }
}

/* Tutor */
.tutor { display: flex; flex-direction: column; height: 100%; }
.pane.tutor-pane.active { display: flex; flex-direction: column; padding: 0 !important; }
.tutor-log { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: 12px; font-size: 0.94rem; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.assistant > :last-child { margin-bottom: 0; }
.msg.assistant pre { font-size: 0.82rem; }
.msg.error { align-self: stretch; background: var(--red-soft); border: 1px solid var(--red); }
.tutor-intro { color: var(--muted); font-size: 0.93rem; }
.tutor-intro h3 { margin: 0 0 6px; color: var(--text); font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 10px; }
.chip { font: 500 0.82rem var(--sans); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.tutor-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-2); }
.tutor-form textarea { flex: 1; resize: none; height: 44px; max-height: 140px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: 0.93rem/1.4 var(--sans); }
.tutor-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.tutor-meta { font: 0.74rem var(--mono); color: var(--faint); padding: 0 20px 8px; }
.typing::after { content: "▍"; animation: blink 1s steps(1) infinite; color: var(--accent); }
.hex-btn { margin-left: 6px; font-family: var(--mono); font-size: 0.72rem; padding: 2px 8px; }
.hex-btn.active { color: var(--accent); border-color: var(--accent); }
.steps .test summary { gap: 12px; }

/* Pygments tokens in lesson code blocks */
.prose .highlight pre { margin: 0 0 1.2em; }
.prose .k, .prose .kr, .prose .kd, .prose .kn, .prose .kt, .prose .ow, .prose .nb { color: var(--blue); }
.prose .s, .prose .s1, .prose .s2, .prose .sa, .prose .sc { color: var(--amber); }
.prose .m, .prose .mi, .prose .mf, .prose .il { color: #c6a2f7; }
.prose .c, .prose .c1, .prose .cm, .prose .cs { color: var(--faint); font-style: italic; }
:root[data-theme="light"] .prose .m, :root[data-theme="light"] .prose .mi, :root[data-theme="light"] .prose .mf { color: #7c3aed; }
