/* ==========================================================================
   Step Into Labs — UI
   ========================================================================== */
:root {
  --bg: #07090d;
  --bg-1: #0b0e14;
  --bg-2: #0f131a;
  --bg-3: #141922;
  --bg-4: #1a202b;
  --line: #1c2230;
  --line-2: #273042;
  --text: #e6e9ef;
  --text-2: #a9b1c2;
  --muted: #6b7489;
  --accent: #5af2a6;
  --accent-2: #2fd889;
  --accent-ink: #04130b;
  --accent-soft: rgba(90, 242, 166, 0.12);
  --accent-glow: rgba(90, 242, 166, 0.35);
  --blue: #7c9cff;
  --violet: #b48cff;
  --amber: #ffc65c;
  --red: #ff6b7a;
  --cyan: #5ad8f2;
  --radius: 14px;
  --radius-sm: 9px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --topbar: 56px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.page-scroll { overflow: auto; }
body.dragging, body.dragging * { cursor: inherit !important; user-select: none !important; }
body.dragging-v { cursor: col-resize; }
body.dragging-h { cursor: row-resize; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
::selection { background: rgba(90, 242, 166, 0.25); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #222a38; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #2e384a; background-clip: padding-box; border: 2px solid transparent; }

code, pre, kbd { font-family: var(--mono); }
code, pre, kbd, samp, .dbg { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
kbd {
  font-size: 11px; padding: 1px 6px; border-radius: 5px;
  background: var(--bg-4); border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--text-2);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--bg-3);
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .2s;
}
.btn:hover { background: var(--bg-4); border-color: #34405a; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #7ff7bb; border-color: #7ff7bb; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text); border-color: var(--line); }
.btn-danger { color: var(--red); border-color: rgba(255, 107, 122, .3); background: rgba(255, 107, 122, .06); }
.btn-danger:hover { background: rgba(255, 107, 122, .12); border-color: rgba(255, 107, 122, .5); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 8px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- top bar ---------- */
.topbar {
  height: var(--topbar); display: flex; align-items: center; gap: 18px;
  padding: 0 16px 0 18px; border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 16, .85); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; display: block; }
.brand-name { font-size: 15px; }
.brand-name b { color: var(--accent); font-weight: 700; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; min-width: 0; }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.xp { display: flex; align-items: center; gap: 10px; margin-right: 8px; font-size: 12.5px; color: var(--text-2); font-family: var(--mono); }
.xp-bar { width: 120px; height: 6px; border-radius: 6px; background: var(--bg-4); overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* ==========================================================================
   Home
   ========================================================================== */
.home { height: calc(100vh - var(--topbar)); overflow-y: auto; overflow-x: hidden; }
.home-inner { max-width: 1160px; margin: 0 auto; padding: 0 28px 72px; }

.si { font-family: var(--mono); color: var(--accent); font-weight: 700; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 52px; align-items: center;
  padding: 76px 0 64px; border-bottom: 1px solid var(--line);
}
.kicker { font-family: var(--mono); font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
.kicker .si { font-size: 17px; line-height: 1; }
.hero h1 {
  font-size: clamp(30px, 3.05vw, 42px); line-height: 1.1; letter-spacing: -.035em; margin: 18px 0 22px; font-weight: 800; text-wrap: balance;
}
.hero h1 .dim { color: #6f788c; }
.hero p.lead { font-size: 17px; line-height: 1.65; color: var(--text-2); max-width: 520px; margin: 0 0 30px; }
.hero p.lead code { font-size: .92em; }
.hero-cta { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.link-arrow { color: var(--text-2); font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: 0; padding: 0; }
.link-arrow:hover { color: var(--text); text-decoration: none; }
.hero-meta { margin-top: 34px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; }
.hero-meta b { color: var(--text-2); font-weight: 500; }
.resume { margin-top: 30px; max-width: 420px; }
.resume-row { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.resume-bar { height: 3px; background: var(--bg-4); }
.resume-bar i { display: block; height: 100%; background: var(--accent); }

/* ---------- the stepping debugger ---------- */
.dbg {
  background: #0b0e13; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden;
  font-family: var(--mono); font-size: 13px; color: #c9d1e0;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
}
.dbg-bar {
  display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-bottom: 1px solid var(--line);
  background: #0e1218; font-size: 12px; color: var(--muted);
}
.dbg-bar .file { color: var(--text-2); }
.dbg-bar .ctl { margin-left: auto; display: flex; gap: 12px; }
.dbg-bar .ctl span { padding: 2px 6px; border-radius: 4px; }
.dbg-bar .ctl .on { color: var(--accent-ink); background: var(--accent); }
.dbg-code { padding: 10px 0; }
.dbg-line { display: grid; grid-template-columns: 22px 30px 1fr; align-items: center; height: 23px; white-space: pre; transition: background .18s; }
.dbg-line .ip { color: var(--accent); text-align: center; font-weight: 700; opacity: 0; transition: opacity .12s; }
.dbg-line .ln { color: #3d475a; text-align: right; padding-right: 12px; user-select: none; }
.dbg-line.cur { background: rgba(90, 242, 166, .08); box-shadow: inset 2px 0 0 var(--accent); }
.dbg-line.cur .ip { opacity: 1; }
.dbg-line.cur .ln { color: var(--text-2); }
.dbg-panes { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
.dbg-sec { padding: 12px 16px 14px; border-bottom: 1px solid var(--line); }
.dbg-sec:last-child { border-bottom: 0; }
.dbg-label { font-size: 11px; color: var(--muted); margin-bottom: 9px; display: flex; justify-content: space-between; }
.mem { display: flex; gap: 6px; }
.mem-cell { width: 44px; text-align: center; }
.mem-cell .addr { font-size: 10px; color: #3d475a; margin-bottom: 4px; }
.mem-cell .byte {
  height: 34px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 4px;
  color: var(--text-2); transition: border-color .15s, color .15s, background .15s;
}
.mem-cell .hex { font-size: 10px; color: #4b5568; margin-top: 4px; }
.mem-cell.empty .byte { color: transparent; border-style: dashed; }
.mem-cell.seen .byte { color: #6f788c; }
.mem-cell.at .byte { border-color: var(--accent); color: var(--text); background: rgba(90, 242, 166, .08); }
.mem-cell.nul .byte { color: var(--amber); }
.mem-ptr { position: relative; height: 18px; margin-top: 6px; }
.mem-ptr span {
  position: absolute; top: 0; left: 0; width: 44px; text-align: center; color: var(--accent); font-size: 12px;
  transition: transform .3s cubic-bezier(.3, .7, .2, 1), opacity .2s;
}
.locals { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 12.5px; }
.locals .k { color: var(--muted); }
.locals .v { color: var(--text); }
.locals .v.flash { color: var(--accent); }
.stdout { font-size: 13px; color: var(--text); min-height: 20px; }
.stdout .cur-blk { display: inline-block; width: 7px; height: 14px; background: var(--accent); vertical-align: -2px; margin-left: 1px; animation: blink 1.1s steps(1) infinite; }
.tk-kw { color: #c792ea; } .tk-ty { color: #82aaff; } .tk-str { color: #c3e88d; } .tk-num { color: #f78c6c; }
.tk-com { color: #546178; font-style: italic; } .tk-pp { color: #ff9cac; } .tk-fn { color: #82e0ff; }
.caret { display: inline-block; width: 8px; height: 15px; background: var(--accent); vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- how it works ---------- */
.how { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.how-step { padding: 34px 28px 36px 0; }
.how-step + .how-step { padding-left: 28px; border-left: 1px solid var(--line); }
.how-step .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.how-step h3 { margin: 10px 0 8px; font-size: 18px; letter-spacing: -.01em; }
.how-step p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }

.who { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.who-card { padding: 30px 28px 32px 0; }
.who-card:nth-child(2n) { padding-left: 28px; border-left: 1px solid var(--line); }
.who-card:nth-child(n + 3) { border-top: 1px solid var(--line); }
.who-card h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.01em; }
.who-card p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
@media (max-width: 760px) {
  .who { grid-template-columns: 1fr; }
  .who-card, .who-card:nth-child(2n) { padding: 22px 0; border-left: 0; }
  .who-card + .who-card { border-top: 1px solid var(--line); }
}

/* ---------- curriculum ---------- */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 64px 0 26px; }
.section-head h2 { font-size: 30px; letter-spacing: -.025em; margin: 0; }
.section-head p { margin: 0; color: var(--muted); max-width: 440px; font-size: 14px; }

.module { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-top: 1px solid var(--line); }
.module-head .off { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.module-head h3 { margin: 6px 0 6px; font-size: 18px; letter-spacing: -.01em; }
.module-head p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.lesson-rows { display: flex; flex-direction: column; }
.lesson-row {
  display: grid; grid-template-columns: 22px 34px minmax(0, 1fr) auto; align-items: baseline; gap: 6px 10px;
  padding: 11px 12px; margin: 0 -12px; border-radius: 6px; color: var(--text); cursor: pointer;
  transition: background .15s;
}
.lesson-row:hover { background: var(--bg-2); text-decoration: none; }
.lesson-row .st { font-family: var(--mono); font-weight: 700; color: #3d475a; text-align: center; }
.lesson-row .no { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.lesson-row .t { font-weight: 600; font-size: 15.5px; }
.lesson-row .t small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-row .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.lesson-row .meta .prog { color: var(--text-2); }
.lesson-row.complete .st { color: var(--accent); }
.lesson-row.current .st { color: var(--accent); }
.lesson-row.current { background: rgba(90, 242, 166, .05); }
.lesson-row .next { margin-left: 10px; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--accent); }
.lesson-row.locked { cursor: not-allowed; }
.lesson-row.locked .t { color: #6f788c; }
.lesson-row.locked:hover { background: transparent; }
.lesson-row .win { font-family: var(--mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 4px; margin-left: 8px; vertical-align: 2px; font-weight: 500; }
.pips { display: flex; gap: 4px; }
.pips i { width: 16px; height: 4px; border-radius: 2px; background: var(--bg-4); }
.pips i.on { background: var(--accent); }

.home-footer {
  margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 13px;
}
.home-footer .lockup { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-weight: 600; }
.home-footer .lockup img { width: 22px; height: 22px; }

/* ==========================================================================
   Lesson view
   ========================================================================== */
.lesson-view {
  --left: 44%;
  height: calc(100vh - var(--topbar));
  display: grid; grid-template-columns: var(--left) 6px minmax(0, 1fr);
  background: var(--bg);
}
.pane { min-width: 0; min-height: 0; position: relative; }
.pane-lesson { background: var(--bg-1); display: flex; flex-direction: column; }
.lesson-scroll { overflow-y: auto; flex: 1; scroll-behavior: smooth; }
.lesson-inner { max-width: 760px; margin: 0 auto; padding: 34px 38px 60px; }

.gutter { background: var(--bg); position: relative; z-index: 5; transition: background .15s; }
.gutter::after { content: ''; position: absolute; background: var(--line); transition: background .15s; }
.gutter-v { cursor: col-resize; }
.gutter-v::after { top: 0; bottom: 0; left: 2px; width: 2px; }
.gutter-h { cursor: row-resize; }
.gutter-h::after { left: 0; right: 0; top: 2px; height: 2px; }
.gutter:hover::after, .gutter.active::after { background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }

.lesson-head { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.lesson-head h1 { font-size: 34px; line-height: 1.12; letter-spacing: -.03em; margin: 10px 0 8px; }
.lesson-head .sub { color: var(--text-2); font-size: 16px; margin: 0 0 14px; }
.meta-row { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.meta-row span { display: inline-flex; align-items: center; gap: 6px; }
.meta-row svg { width: 14px; height: 14px; }

/* prose */
.prose { color: #cfd5e1; font-size: 15.5px; line-height: 1.75; }
.prose h2 { font-size: 22px; letter-spacing: -.02em; color: var(--text); margin: 38px 0 12px; scroll-margin-top: 20px; }
.prose h2::before { content: '#'; color: var(--accent); opacity: .6; margin-right: 10px; font-family: var(--mono); font-weight: 500; }
.prose h3 { font-size: 17px; color: var(--text); margin: 26px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose strong { color: var(--text); font-weight: 650; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.prose :not(pre) > code, .mission code, .wd code, .toast code, .modal code {
  font-size: .86em; padding: 2px 6px; border-radius: 6px;
  background: rgba(124, 156, 255, .09); border: 1px solid rgba(124, 156, 255, .16); color: #b9c8ff;
  white-space: pre-wrap; word-break: break-word;
}
.table-wrap { overflow-x: auto; margin: 6px 0 20px; border: 1px solid var(--line); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th { text-align: left; font-weight: 600; color: var(--text); background: var(--bg-2); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.prose th, .prose td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: rgba(255, 255, 255, .015); }

.codeblock { margin: 8px 0 20px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0a0d12; }
.codeblock-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.codeblock-lang { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.codeblock-copy { font-size: 11.5px; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); cursor: pointer; opacity: 0; transition: opacity .15s, background .15s; }
.codeblock:hover .codeblock-copy { opacity: 1; }
.codeblock-copy:hover { background: var(--bg-4); color: var(--text); }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.65; color: #c9d1e0; }
.codeblock.lang-output { background: #06080b; }
.codeblock.lang-output pre { color: var(--accent); }
.codeblock.lang-text pre { color: var(--text-2); line-height: 1.45; }

.callout { margin: 8px 0 20px; padding: 14px 16px 14px 18px; border-radius: 12px; border: 1px solid; position: relative; font-size: 14.5px; }
.callout::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: currentColor; }
.callout-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 4px; font-family: var(--mono); }
.callout-body { color: #cfd5e1; }
.callout-note { color: var(--blue); border-color: rgba(124, 156, 255, .25); background: rgba(124, 156, 255, .05); }
.callout-tip { color: var(--accent); border-color: rgba(90, 242, 166, .22); background: rgba(90, 242, 166, .045); }
.callout-warn { color: var(--amber); border-color: rgba(255, 198, 92, .25); background: rgba(255, 198, 92, .05); }
.callout-deep { color: var(--violet); border-color: rgba(180, 140, 255, .25); background: rgba(180, 140, 255, .05); }

/* missions in the lesson pane */
.missions-section { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--line); scroll-margin-top: 10px; }
.missions-section > h2 { display: flex; align-items: center; gap: 12px; font-size: 22px; letter-spacing: -.02em; margin: 0 0 6px; }
.missions-section > p { color: var(--text-2); margin: 0 0 20px; font-size: 14.5px; }
.mission-list { display: flex; flex-direction: column; gap: 12px; }
.mission {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2);
  padding: 16px 18px; position: relative; transition: border-color .3s, background .3s, opacity .3s;
}
.mission-top { display: flex; align-items: center; gap: 12px; }
.m-idx {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 700; border: 1px solid var(--line-2); color: var(--muted);
}
.m-idx svg { width: 15px; height: 15px; }
.mission h4 { margin: 0; font-size: 15.5px; flex: 1; }
.m-state { font-size: 11px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mission-body { margin: 12px 0 0 40px; font-size: 14.5px; color: #cfd5e1; }
.mission-body p { margin: 0 0 10px; }
.mission-body .codeblock { margin: 6px 0 12px; }
.mission-body .codeblock pre { font-size: 13px; padding: 10px 14px; }
.mission.active { border-color: rgba(90, 242, 166, .5); background: linear-gradient(180deg, rgba(90, 242, 166, .05), var(--bg-2) 60%); box-shadow: 0 0 0 1px rgba(90, 242, 166, .1), 0 12px 40px -24px var(--accent-glow); }
.mission.active .m-idx { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 0 16px -2px var(--accent-glow); }
.mission.active .m-state { color: var(--accent); }
.mission.done .m-idx { background: var(--accent-soft); color: var(--accent); border-color: rgba(90, 242, 166, .35); }
.mission.done h4 { color: var(--text-2); }
.mission.done .m-state { color: var(--accent); }
.mission.locked { opacity: .5; }
.mission.locked .mission-body { filter: blur(3px); user-select: none; pointer-events: none; max-height: 54px; overflow: hidden; }
.mission.just-done { animation: missionPop .8s cubic-bezier(.2, .8, .2, 1); }
@keyframes missionPop { 0% { transform: scale(1); } 30% { transform: scale(1.015); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(90, 242, 166, .15); } 100% { transform: scale(1); } }
.mission-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.hint-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 198, 92, .06); border: 1px dashed rgba(255, 198, 92, .3); color: #f3dcae; font-size: 14px; }
.hint-box::before { content: 'HINT  '; font-family: var(--mono); font-size: 11px; color: var(--amber); letter-spacing: .1em; font-weight: 700; }
.check-preview { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.check-preview li { display: flex; gap: 8px; align-items: flex-start; }
.check-preview li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); margin-top: 8px; flex: none; }

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); }
.lesson-nav a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); color: var(--text); min-width: 0; max-width: 48%; }
.lesson-nav a:hover { text-decoration: none; border-color: #33405a; background: var(--bg-2); }
.lesson-nav a small { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.lesson-nav a.next { margin-left: auto; text-align: right; }
.lesson-nav a.disabled { opacity: .45; pointer-events: none; }

/* ---------- IDE ---------- */
.pane-ide {
  --console: 34%;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) 6px var(--console);
  background: #0d1016;
}
.mission-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(90, 242, 166, .07), transparent 60%), var(--bg-1);
  cursor: pointer; min-height: 52px;
}
.mission-bar .mb-label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--accent); text-transform: uppercase; white-space: nowrap; }
.mission-bar .mb-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.mission-bar .pips i { width: 20px; }
.mission-bar.all-done { background: linear-gradient(90deg, rgba(90, 242, 166, .16), transparent 70%), var(--bg-1); }
.watch {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-family: var(--mono);
  color: var(--text-2); padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 20px; white-space: nowrap;
}
.watch i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent-glow); animation: pulse 2s infinite; }
.watch.fail i { background: var(--red); animation: none; }
.watch.idle i { background: var(--muted); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(90, 242, 166, .5); } 70% { box-shadow: 0 0 0 8px rgba(90, 242, 166, 0); } 100% { box-shadow: 0 0 0 0 rgba(90, 242, 166, 0); } }

.ide-toolbar { display: flex; align-items: stretch; height: 42px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.file-tab {
  display: flex; align-items: center; gap: 8px; padding: 0 16px; font-family: var(--mono); font-size: 12.5px;
  border-right: 1px solid var(--line); background: #0d1016; color: var(--text); position: relative;
}
.file-tab::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); }
.file-tab .c-icon { display: grid; place-items: center; color: var(--text); }
.file-tab .c-icon .course-logo { width: 17px; height: 17px; }
.file-tab .save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); transition: background .3s; }
.file-tab .save-dot.dirty { background: var(--amber); }
.file-tab .save-dot.saved { background: var(--accent); opacity: .7; }
.toolbar-spacer { flex: 1; }
.toolbar-actions { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.backend-badge { font-size: 12px; color: var(--muted); max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.backend-badge[hidden] { display: none; }
.backend-badge.bad { color: var(--red); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.footer-links a { color: var(--text-2); }
.footer-links a:hover { color: var(--text); }
.btn-run { height: 30px; padding: 0 14px; border-radius: 8px; font-size: 13px; }
.btn-run .spin { display: none; }
.btn-run.running .spin { display: block; animation: spin .8s linear infinite; }
.btn-run.running .play { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.editor-host { position: relative; min-height: 0; overflow: hidden; }
.editor-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-family: var(--mono); font-size: 13px; }
.editor-loading .bar { width: 160px; height: 3px; border-radius: 3px; background: var(--bg-4); overflow: hidden; margin-top: 12px; }
.editor-loading .bar i { display: block; width: 40%; height: 100%; background: var(--accent); animation: load 1.1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.fallback-editor {
  width: 100%; height: 100%; resize: none; border: 0; outline: 0; padding: 14px 16px;
  background: #0d1016; color: #dce3ee; font-family: var(--mono); font-size: 14px; line-height: 1.6; tab-size: 4;
}

/* console */
.console { display: flex; flex-direction: column; min-height: 0; background: #080a0e; }
.console-tabs { display: flex; align-items: center; gap: 2px; padding: 0 8px; height: 38px; border-bottom: 1px solid var(--line); background: var(--bg-1); flex: none; }
.ctab {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); background: transparent; border: 0; cursor: pointer;
}
.ctab:hover { color: var(--text); background: var(--bg-3); }
.ctab.active { color: var(--text); background: var(--bg-4); }
.ctab svg { width: 14px; height: 14px; }
.ctab .badge { font-family: var(--mono); font-size: 10.5px; padding: 0 6px; border-radius: 10px; background: var(--bg-3); color: var(--text-2); line-height: 17px; }
.ctab .badge.ok { background: var(--accent-soft); color: var(--accent); }
.ctab .badge.fail { background: rgba(255, 107, 122, .12); color: var(--red); }
.console-tabs .spacer { flex: 1; }
.console-body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.cpanel { display: none; height: 100%; }
.cpanel.active { display: block; }

.terminal { padding: 12px 16px 18px; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: #cfd6e2; }
.terminal .t-empty { color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.t-line { white-space: pre-wrap; word-break: break-word; }
.t-cmd { color: var(--text-2); }
.t-cmd .p { color: var(--accent); margin-right: 8px; }
.t-out { white-space: pre-wrap; word-break: break-word; margin: 2px 0 6px; color: #e9eef6; }
.t-out:empty::after { content: '(no output)'; color: var(--muted); font-style: italic; }
.t-err { color: var(--red); white-space: pre-wrap; word-break: break-word; margin: 2px 0 6px; }
.t-diag { display: block; white-space: pre-wrap; word-break: break-word; }
.t-diag.error { color: #ff8f9b; }
.t-diag.warning { color: var(--amber); }
.t-diag.note { color: var(--blue); }
.t-diag.loc { cursor: pointer; }
.t-diag.loc:hover { text-decoration: underline; }
.t-diag.muted { color: #7e889c; }
.t-ok { color: var(--accent); }
.t-meta { color: var(--muted); font-size: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); display: flex; gap: 14px; flex-wrap: wrap; }
.t-meta .bad { color: var(--red); }
.t-meta .good { color: var(--accent); }
.t-sep { height: 1px; background: var(--line); margin: 10px 0; }

.stdin-panel { display: flex; flex-direction: column; height: 100%; }
.stdin-panel .help { padding: 10px 16px 0; color: var(--muted); font-size: 12.5px; }
.stdin-panel textarea {
  flex: 1; margin: 8px 12px 12px; resize: none; border-radius: 10px; border: 1px solid var(--line-2); outline: 0;
  background: #0b0e13; color: var(--text); font-family: var(--mono); font-size: 13px; padding: 10px 12px; line-height: 1.6;
}
.stdin-panel textarea:focus { border-color: rgba(90, 242, 166, .5); box-shadow: 0 0 0 3px rgba(90, 242, 166, .08); }
.args-row {
  display: flex; align-items: center; margin: 10px 12px 0; border: 1px solid var(--line-2); border-radius: 10px;
  background: #0b0e13; font-family: var(--mono); font-size: 13px; overflow: hidden;
}
.args-row:focus-within { border-color: rgba(90, 242, 166, .5); box-shadow: 0 0 0 3px rgba(90, 242, 166, .08); }
.args-label { padding: 8px 4px 8px 12px; color: var(--accent); user-select: none; white-space: nowrap; }
.args-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; padding: 8px 12px 8px 4px; }
.files-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.files-row .help { padding: 0 4px 0 4px; }
.file-chip {
  font-family: var(--mono); font-size: 12px; color: var(--text); background: var(--bg-3); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 3px 8px; cursor: pointer;
}
.file-chip:hover { border-color: rgba(90, 242, 166, .5); color: var(--accent); }
.file-view {
  max-height: 50vh; overflow: auto; background: #0b0e13; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre; margin: 0;
}

.wd { padding: 14px 16px 18px; }
.wd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.wd-head .eye { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.wd-head .eye svg { width: 16px; height: 16px; }
.wd-head h5 { margin: 0; font-size: 13.5px; }
.wd-head small { color: var(--muted); font-size: 12px; display: block; }
.wd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wd-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13.5px; }
.wd-item .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; background: var(--bg-4); color: var(--muted); }
.wd-item .ic svg { width: 12px; height: 12px; }
.wd-item.ok .ic { background: var(--accent-soft); color: var(--accent); }
.wd-item.fail .ic { background: rgba(255, 107, 122, .14); color: var(--red); }
.wd-item.skip { opacity: .55; }
.wd-item .txt { flex: 1; min-width: 0; }
.wd-item .detail { display: block; color: var(--muted); font-size: 12px; font-family: var(--mono); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.wd-item.fail .detail { color: #d99aa2; }
.wd-stale { margin-bottom: 10px; font-size: 12.5px; color: var(--amber); }
.wd-done { text-align: center; padding: 28px 10px; color: var(--text-2); }
.wd-done b { display: block; color: var(--accent); font-size: 18px; margin-bottom: 6px; }

/* ==========================================================================
   Overlays: drawer, modal, toasts, confetti
   ========================================================================== */
.scrim { position: fixed; inset: 0; background: rgba(3, 5, 8, .62); backdrop-filter: blur(4px); z-index: 80; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); z-index: 90;
  background: var(--bg-1); border-left: 1px solid var(--line); box-shadow: -30px 0 60px -20px rgba(0, 0, 0, .7);
  display: flex; flex-direction: column; animation: slideIn .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { overflow-y: auto; padding: 10px 10px 30px; }
.drawer-module { padding: 14px 10px 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.drawer-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.drawer-item:hover { background: var(--bg-3); text-decoration: none; }
.drawer-item.active { background: var(--accent-soft); }
.drawer-item.locked { opacity: .45; cursor: not-allowed; }
.drawer-item .di-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }
.drawer-item .di-ic svg { width: 12px; height: 12px; }
.drawer-item.done .di-ic { background: var(--accent-soft); color: var(--accent); border-color: rgba(90, 242, 166, .3); }
.drawer-item .di-t { flex: 1; font-size: 14px; font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-item .di-p { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal {
  width: min(480px, 100%); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: var(--shadow); padding: 26px; animation: modalIn .3s cubic-bezier(.2, .8, .2, 1); position: relative;
}
@keyframes modalIn { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal h3 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.02em; }
.modal p { color: var(--text-2); margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.modal .trophy { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; box-shadow: 0 0 40px -8px var(--accent-glow); }
.modal .trophy svg { width: 32px; height: 32px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-of-type { border-bottom: 0; }
.setting b { display: block; font-size: 14px; font-weight: 600; }
.setting small { color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 22px; background: var(--bg-4); border: 1px solid var(--line-2); cursor: pointer; transition: background .2s; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-2); transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--accent-soft); border-color: rgba(90, 242, 166, .5); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--accent); }
.range-row { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
input[type=range] { accent-color: var(--accent); width: 130px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px;
  background: var(--bg-3); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  animation: toastIn .35s cubic-bezier(.2, .8, .2, 1); pointer-events: auto; max-width: 90vw;
}
.toast.out { animation: toastOut .3s forwards; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.success { border-color: rgba(90, 242, 166, .4); }
.toast.success svg { color: var(--accent); }
.toast.error svg { color: var(--red); }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(10px); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 110; }

.locked-view { height: calc(100vh - var(--topbar)); display: grid; place-items: center; text-align: center; padding: 20px; }
.locked-view .ic { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; background: var(--bg-3); color: var(--muted); }
.locked-view .ic svg { width: 28px; height: 28px; }
.locked-view h2 { margin: 0 0 8px; }
.locked-view p { color: var(--text-2); margin: 0 0 20px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .how { grid-template-columns: 1fr; }
  .how-step, .how-step + .how-step { padding: 22px 0; border-left: 0; border-top: 1px solid var(--line); }
  .module { grid-template-columns: 1fr; gap: 12px; }
  .xp { display: none; }
  body { overflow: auto; }
  .lesson-view { display: flex; flex-direction: column; height: auto; }
  .pane-lesson { height: auto; }
  .lesson-scroll { overflow: visible; }
  .lesson-inner { padding: 24px 16px 40px; }
  .gutter { display: none; }
  .pane-ide { height: 92vh; grid-template-rows: auto auto minmax(0, 1fr) 0 38%; }
  .crumbs { display: none; }
  .backend-badge { display: none; }
}
@media (max-width: 560px) {
  .home-inner { padding: 0 16px 60px; }
  .hero { gap: 36px; padding-top: 36px; }
  .mem-cell, .mem-ptr span { width: 38px; }
  .dbg-bar .ctl span:not(.on) { display: none; }
  .hero p.lead { font-size: 16px; }
  .lesson-row { grid-template-columns: 18px 28px minmax(0, 1fr); }
  .lesson-row .meta { grid-column: 3; text-align: left; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .mission-body { margin-left: 0; }
  .brand-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Courses: landing tracks, course header, assembly harness
   ========================================================================== */
.tracks { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-bottom: 8px; }
.track {
  display: grid; grid-template-columns: 34px 56px minmax(0, 1fr) 150px; align-items: center; gap: 18px;
  padding: 22px 14px; margin: 0 -14px; border-bottom: 1px solid var(--line); color: var(--text); border-radius: 6px;
  transition: background .15s;
}
.track:hover { background: var(--bg-2); text-decoration: none; }
.track-no { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.track-icon {
  color: #f2f4f8; height: 48px; width: 48px; border: 1px solid var(--line-2);
  border-radius: 10px; display: grid; place-items: center; background: #0b0e13; transition: border-color .15s;
}
.track-icon .course-logo { width: 30px; height: 30px; }
.track:hover .track-icon { border-color: #3a4558; }
.course-title { display: flex; align-items: center; gap: 18px; }
.course-title .course-logo { width: 56px; height: 56px; flex: none; color: #f2f4f8; }
@media (max-width: 560px) { .course-title { gap: 12px; } .course-title .course-logo { width: 40px; height: 40px; } }
.track-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.track-title { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.track-tag { color: var(--text-2); font-size: 14.5px; }
.track-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.track-prog { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.tp-bar { width: 120px; height: 3px; background: var(--bg-4); }
.tp-bar i { display: block; height: 100%; background: var(--accent); }
.tp-go { color: var(--muted); }
.track:hover .tp-go { color: var(--accent); }
.tracks + .how { margin-top: 40px; border-top: 1px solid var(--line); }

.course-hero { padding: 64px 0 52px; border-bottom: 1px solid var(--line); max-width: 760px; }
.course-hero h1 { font-size: clamp(34px, 4.2vw, 52px); letter-spacing: -.035em; line-height: 1.05; margin: 16px 0 14px; font-weight: 800; }
.course-hero .lead { font-size: 17px; line-height: 1.6; color: var(--text-2); margin: 0 0 28px; max-width: 620px; }
.course-warn { border: 1px solid rgba(255, 198, 92, .35); background: rgba(255, 198, 92, .06); color: var(--amber); border-radius: 8px; padding: 10px 14px; margin: -8px 0 24px; font-size: 14px; }
.course-next { display: block; margin-top: 36px; padding: 22px 0 0; border-top: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 18px; text-align: right; }
.course-next small { display: block; font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.course-next:hover { text-decoration: none; color: var(--accent); }

.harness-link {
  margin-left: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); background: none; border: 1px dashed var(--line-2);
  border-radius: 4px; padding: 1px 6px; cursor: pointer;
}
.harness-link:hover { color: var(--accent); border-color: rgba(90, 242, 166, .5); }
.harness-name { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 0 0 6px; }

@media (max-width: 760px) {
  .track { grid-template-columns: 44px minmax(0, 1fr); gap: 12px 14px; }
  .track-icon { width: 44px; height: 44px; }
  .track-no { display: none; }
  .track-prog { grid-column: 2; align-items: flex-start; }
}
