/* Class of One — visual design.
   Goals: loads fast on a weak Chromebook, high contrast, large tap targets,
   readable at speed (a judge should "get it" in two minutes). No web fonts,
   no frameworks, no build step. */

:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --line: #2a323c;
  --ink: #eef2f6;
  --ink-dim: #a9b4c0;
  --ink-faint: #6f7c8a;
  --accent: #6ea8fe;
  --accent-ink: #0b1220;
  --teacher: #1e242c;
  --student: #24406b;
  --good: #57cc99;
  --radius: 14px;
  --maxread: 62ch;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* White line-drawn topic icons, replacing emoji everywhere. Sized in em so
   each one scales with whatever text it sits beside, and currentColor so it
   always matches the surrounding text color in both themes. */
.icn { width: 1em; height: 1em; flex: none; vertical-align: -0.2em; }
.lesson-eyebrow .icn { width: 14px; height: 14px; vertical-align: -2.5px; }
.rm-dot .icn { width: 16px; height: 16px; }
.resource .r-cert .icn { width: 12px; height: 12px; }
.mic-btn { display: grid; place-items: center; }

body {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 10;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark { color: var(--accent); font-size: 22px; }
.brand-name { font-weight: 700; letter-spacing: 0.2px; }
.brand-tag { color: var(--ink-faint); font-size: 12.5px; }

.section-label { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-dim); margin: 0 0 4px; }
.path-sub { color: var(--ink-faint); font-size: 13px; margin: 0 0 14px; }

/* Track picker — the CS fields */
.track-picker-wrap { margin-bottom: 20px; }
.track-picker-wrap .section-label { margin-bottom: 10px; }
.track-picker { display: flex; flex-direction: column; gap: 6px; }
.track-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim);
  padding: 9px 11px; border-radius: 10px; cursor: pointer; font-size: 13.5px; font-family: inherit;
}
.track-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.track-btn.active { border-color: var(--accent); color: var(--ink); background: #1a2740; }
.track-icon { font-size: 16px; flex: none; }
.track-name { font-weight: 600; flex: 1; }
.track-badge {
  flex: none; font-size: 11px; padding: 2px 7px; border-radius: 99px;
  background: rgba(87,204,153,.15); color: var(--good); border: 1px solid rgba(87,204,153,.3);
}
.path-header { margin-bottom: 4px; }

.path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.path li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  color: var(--ink-dim); font-size: 14px; text-align: left; width: 100%;
}
.path li:hover { background: var(--panel-2); }
.path li.active { background: var(--panel-2); border-color: var(--accent); color: var(--ink); }
.path li.done { color: var(--ink-faint); }
.path .dot {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--ink-faint); margin-top: 1px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.path li.active .dot { border-color: var(--accent); color: var(--accent); }
.path li.done .dot { background: var(--good); border-color: var(--good); color: #08240f; }
.path .l-title { font-weight: 600; }
.path .l-sub { font-size: 12px; color: var(--ink-faint); }

.progress-wrap { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.progress-label { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--ink-dim); margin-bottom: 8px; }
.reset-btn { background: none; border: none; color: var(--ink-faint); cursor: pointer; font-size: 12px; text-decoration: underline; }
.reset-btn:hover { color: var(--ink); }
.progress-bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--good); transition: width .3s ease; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100vh; min-width: 0; }
.chat-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 26px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.lesson-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--ink-faint); }
.chat-header h1 { font-size: 19px; margin: 3px 0 4px; }
.lesson-goal { margin: 0; color: var(--ink-dim); font-size: 14px; max-width: var(--maxread); }
.restart-lesson-btn {
  margin-top: 8px; background: none; border: none; color: var(--ink-faint);
  font-size: 12px; text-decoration: underline; cursor: pointer; padding: 0; font-family: inherit;
}
.restart-lesson-btn:hover { color: var(--ink-dim); }
.help-btn {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel-2); color: var(--ink-dim); border: 1px solid var(--line);
  font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit;
}
.help-btn:hover { border-color: var(--accent); color: var(--ink); }
.mode-pill {
  flex: none; font-size: 11.5px; padding: 5px 10px; border-radius: 99px;
  background: var(--panel-2); color: var(--ink-dim); border: 1px solid var(--line); white-space: nowrap;
}
.mode-pill.live { color: var(--good); border-color: rgba(87,204,153,.4); }
.mode-pill.demo { color: #f0c674; border-color: rgba(240,198,116,.35); }

.header-right { display: flex; align-items: center; gap: 12px; flex: none; }
.lab-toggle {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim);
  padding: 6px 12px; border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.lab-toggle:hover, .lab-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--ink); }

.messages { flex: 1; overflow-y: auto; padding: 26px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Code Lab ---------- */
.code-lab { border-top: 1px solid var(--line); background: #0b0e12; max-height: 42vh; display: flex; flex-direction: column; }
.lab-head { display: flex; align-items: center; gap: 12px; padding: 9px 26px; border-bottom: 1px solid var(--line); }
.lab-title { font-weight: 700; font-size: 13px; }
.lab-status { color: var(--ink-faint); font-size: 12px; flex: 1; }
.lab-close { background: none; border: none; color: var(--ink-faint); cursor: pointer; font-size: 15px; }
.lab-close:hover { color: var(--ink); }
.lab-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); overflow: hidden; }
.lab-editor-wrap, .lab-output-wrap { background: #0b0e12; display: flex; flex-direction: column; min-height: 0; }
.lab-editor {
  flex: 1; resize: none; background: #0b0e12; color: #e8eef5; border: none; outline: none;
  padding: 14px 16px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.55; tab-size: 4; min-height: 140px;
}
.lab-actions { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.lab-run {
  background: var(--good); color: #08240f; border: none; border-radius: 8px;
  padding: 7px 16px; font-weight: 700; cursor: pointer; font-size: 13px;
}
.lab-run:hover { filter: brightness(1.08); }
.lab-run:disabled { opacity: .6; cursor: default; }
.lab-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px;
}
.lab-ghost:hover { border-color: var(--accent); color: var(--ink); }
.lab-output-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); padding: 10px 16px 4px; }
.lab-output {
  flex: 1; margin: 0; padding: 4px 16px 14px; overflow: auto; color: #cfe0ff;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.lab-output.error { color: #ff9b9b; }
.msg { display: flex; gap: 12px; max-width: 100%; }
.msg .avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
}
.msg.teacher .avatar { background: var(--teacher); color: var(--accent); border: 1px solid var(--line); }
.msg.student { flex-direction: row-reverse; }
.msg.student .avatar { background: var(--student); color: #cfe0ff; }
.bubble {
  padding: 12px 15px; border-radius: var(--radius); font-size: 15px; line-height: 1.55;
  max-width: var(--maxread); white-space: pre-wrap; word-wrap: break-word;
}
.msg.teacher .bubble { background: var(--teacher); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.student .bubble { background: var(--student); border-top-right-radius: 4px; }
.bubble code { background: rgba(0,0,0,.35); padding: 1px 5px; border-radius: 5px; font-size: 13.5px; }
.bubble pre { background: #0b0e12; border: 1px solid var(--line); padding: 12px; border-radius: 10px; overflow-x: auto; margin: 8px 0 0; }
.bubble pre code { background: none; padding: 0; }

.typing .bubble { color: var(--ink-faint); font-style: italic; }

/* ---------- Stuck row ---------- */
.stuck-row { display: flex; align-items: center; gap: 8px; padding: 10px 26px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.stuck-label { color: var(--ink-faint); font-size: 13px; margin-right: 2px; }
.stuck-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim);
  padding: 7px 12px; border-radius: 99px; cursor: pointer; font-size: 13px;
}
.stuck-btn:hover { border-color: var(--accent); color: var(--ink); }

/* ---------- Composer ---------- */
.composer { display: flex; gap: 10px; padding: 14px 26px 20px; border-top: 1px solid var(--line); background: var(--panel); }
.composer textarea {
  flex: 1; resize: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 15px; max-height: 160px;
}
.composer textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.composer button {
  flex: none; background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: 12px; padding: 0 22px; font-weight: 700; font-size: 15px; cursor: pointer;
}
.composer button:hover { filter: brightness(1.08); }
.composer button:disabled { opacity: .5; cursor: default; }
.mic-btn {
  flex: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; width: 48px; padding: 0; font-size: 18px; cursor: pointer;
}
.mic-btn:hover { border-color: var(--accent); }
.mic-btn.listening { border-color: #ff6b6b; background: rgba(255,107,107,.15); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.lab-toggle[aria-pressed="true"] { border-color: var(--good); color: var(--good); }

/* ---------- Small screens ---------- */
/* ---------- Teacher's notes modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 22px 20px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 17px; margin: 0; }
.modal-sub { color: var(--ink-dim); font-size: 13.5px; margin: 8px 0 16px; }
.modal-label { display: block; font-size: 12.5px; color: var(--ink-dim); margin: 12px 0 5px; font-weight: 600; }
.modal-input, .modal-textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14.5px; resize: none;
}
.modal-input:focus, .modal-textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.modal-recall { font-size: 12.5px; color: var(--ink-faint); margin: 14px 0 4px; line-height: 1.5; }
.modal-recall b { color: var(--ink-dim); font-weight: 600; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- Diagrams (illustrations) ---------- */
.diagram-card {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 6px;
}
.diagram-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.diagram-title { font-weight: 700; font-size: 14px; }
.diagram-card > svg { width: 100%; height: auto; display: block; }
.diagram-card .dg-box { fill: var(--panel-2); stroke: var(--line); }
.diagram-card .dg-accent { fill: var(--accent); }
.diagram-card .dg-good { fill: var(--good); }
.diagram-card .dg-line { stroke: var(--ink-faint); fill: none; }
.diagram-card .dg-line-accent { stroke: var(--accent); fill: none; }
.diagram-card .dg-label { fill: var(--ink); font-size: 13px; font-weight: 600; font-family: inherit; }
.diagram-card .dg-sub { fill: var(--ink-faint); font-size: 11px; font-family: inherit; }
.diagram-card .dg-mono { fill: var(--ink-dim); font-size: 12px; font-family: ui-monospace, monospace; }
.diagram-caption { color: var(--ink-dim); font-size: 12.5px; margin: 12px 0 0; }

/* ---------- Forget confirmation ---------- */
.forget-confirm { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.forget-q { font-size: 13.5px; color: var(--ink); display: block; margin-bottom: 10px; }
.forget-btns { display: flex; gap: 10px; justify-content: flex-end; }
.danger-btn {
  background: #d05a54; color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-weight: 700; cursor: pointer; font-size: 13.5px;
}
.danger-btn:hover { filter: brightness(1.08); }

/* ---------- Welcome modal ---------- */
.modal.welcome { max-width: 500px; text-align: center; }
.welcome-mark { color: var(--accent); font-size: 30px; line-height: 1; margin-bottom: 6px; }
.modal.welcome h2 { font-size: 22px; margin: 0 0 14px; }
.welcome-why { font-size: 15px; color: var(--ink-dim); line-height: 1.6; margin: 0 0 12px; text-align: left; }
.welcome-ask { font-size: 15px; font-weight: 600; margin: 18px 0 16px; }
.welcome-actions { display: flex; flex-direction: column; gap: 10px; }
.welcome-actions .lab-run, .welcome-actions .lab-ghost { padding: 12px; font-size: 15px; border-radius: 10px; }

/* ---------- Guided tour ---------- */
.tour { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.tour-box {
  position: fixed; max-width: 300px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--accent); border-radius: 12px; padding: 15px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); pointer-events: auto;
}
.tour-text { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.tour-nav { display: flex; align-items: center; gap: 8px; }
.tour-count { font-size: 12px; color: var(--ink-faint); margin-right: auto; }
.tour-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 49; pointer-events: auto; }
.tour-highlight {
  position: relative; z-index: 52;
  outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px;
}

/* ---------- Roadmap button ---------- */
.further-btn {
  margin-top: 14px; width: 100%; text-align: left;
  background: linear-gradient(180deg, #1a2740, var(--panel-2));
  border: 1px solid var(--accent); color: var(--ink); border-radius: 10px;
  padding: 12px 13px; cursor: pointer; font-size: 13.5px; font-weight: 700; font-family: inherit;
}
.further-btn:hover { filter: brightness(1.12); }

/* ---------- Roadmap panel ---------- */
.modal.wide { max-width: 620px; max-height: 86vh; overflow-y: auto; }
.roadmap-body { margin-top: 8px; }
.rm-stage { display: flex; gap: 14px; padding-bottom: 22px; position: relative; }
.rm-stage:not(:last-child)::before {
  content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line);
}
.rm-dot {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; background: var(--panel-2); border: 2px solid var(--line); z-index: 1;
}
.rm-stage.done .rm-dot { background: var(--good); border-color: var(--good); color: #08240f; }
.rm-stage.active .rm-dot { border-color: var(--accent); color: var(--accent); }
.rm-stage.optional .rm-dot { border-style: dashed; color: var(--ink-faint); }
.rm-stage.optional .rm-title { color: var(--ink-dim); }
.rm-content { flex: 1; min-width: 0; padding-top: 3px; }
.rm-title { font-weight: 700; font-size: 15.5px; }
.rm-sub { font-size: 12.5px; color: var(--ink-faint); margin: 2px 0 10px; }
.rm-lessons { display: flex; flex-direction: column; gap: 5px; }
.rm-lesson { font-size: 13.5px; color: var(--ink-dim); display: flex; gap: 8px; align-items: center; }
.rm-lesson .mk { color: var(--ink-faint); }
.rm-lesson.done { color: var(--ink); }
.rm-lesson.done .mk { color: var(--good); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 13px; padding: 7px 12px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--ink-dim);
}
.chip.build { border-color: rgba(110,168,254,.35); }
.chip.career { border-color: rgba(240,198,116,.35); color: var(--ink); }
.resource-list { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.resource {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; color: var(--ink);
}
.resource:hover { border-color: var(--accent); }
.resource .r-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.resource .r-name { font-weight: 600; font-size: 14.5px; }
.resource .r-note { font-size: 12.5px; color: var(--ink-faint); }
.resource .r-cert {
  flex: none; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px;
  background: rgba(87,204,153,.15); color: var(--good); border: 1px solid rgba(87,204,153,.3); white-space: nowrap;
}
.resource .r-arrow { flex: none; color: var(--ink-faint); font-size: 15px; }

/* ---------- Interactive widgets (manipulatives) ---------- */
.widget-card {
  border: 1px solid var(--accent); background: linear-gradient(180deg, #16233c, #131820);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 6px;
}
.widget-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.widget-spark { font-size: 15px; }
.widget-title { font-weight: 700; font-size: 14.5px; }
.widget-hint { color: var(--ink-dim); font-size: 13px; margin: 0 0 14px; }
.widget-body { }

/* binary flipper */
.bits { display: flex; gap: 6px; flex-wrap: wrap; }
.bit {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 6px; cursor: pointer; min-width: 42px;
}
.bit .bit-val { font-size: 20px; font-weight: 800; font-family: ui-monospace, monospace; color: var(--ink-faint); }
.bit.on { border-color: var(--good); background: rgba(87,204,153,.12); }
.bit.on .bit-val { color: var(--good); }
.bit .bit-place { font-size: 10px; color: var(--ink-faint); }
.widget-readout { margin-top: 14px; font-size: 15px; }
.widget-readout .big { font-size: 26px; font-weight: 800; color: var(--accent); font-family: ui-monospace, monospace; }

/* caesar cipher */
.cipher-row { display: flex; flex-direction: column; gap: 10px; }
.cipher-io { display: flex; flex-direction: column; gap: 4px; }
.cipher-io label { font-size: 12px; color: var(--ink-faint); }
.cipher-input {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 15px;
}
.cipher-output {
  background: #0b0e12; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font-family: ui-monospace, monospace; font-size: 16px; letter-spacing: 2px; color: var(--good); min-height: 20px;
}
.cipher-slider-row { display: flex; align-items: center; gap: 12px; }
.cipher-slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.cipher-shift { font-family: ui-monospace, monospace; color: var(--accent); font-weight: 700; min-width: 78px; }

/* qubit coin */
.qubit-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.coin {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  font-size: 30px; font-weight: 800; border: 3px solid var(--accent);
  background: radial-gradient(circle at 35% 30%, #2a3a58, #131a26); color: var(--ink);
}
.coin.spinning { animation: spin .5s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotateY(360deg); } }
.qubit-controls { display: flex; flex-direction: column; gap: 8px; }
.qubit-btns { display: flex; gap: 8px; }
.qubit-state { font-size: 13px; color: var(--ink-dim); max-width: 30ch; }
.qubit-tally { font-size: 12px; color: var(--ink-faint); font-family: ui-monospace, monospace; }

/* ---------- Mobile: sidebar becomes a drawer instead of vanishing ---------- */
.mobile-menu-btn, .sidebar-close, .sidebar-backdrop { display: none; }

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .lab-body { grid-template-columns: 1fr; }
  .code-lab { max-height: 55vh; }

  .mobile-menu-btn {
    display: block; margin: 10px 12px 0; width: calc(100% - 24px);
    background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
    border-radius: 10px; padding: 11px 14px; font-size: 14px; font-weight: 700;
    cursor: pointer; text-align: left; font-family: inherit;
  }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 44;
  }
  .sidebar {
    position: fixed; inset: 0 20% 0 0; z-index: 45; max-width: 360px;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close {
    display: block; margin-left: auto; background: none; border: none; color: var(--ink-dim);
    font-size: 18px; cursor: pointer; padding: 4px;
  }
  .brand { align-items: center; }
  .chat-header { flex-wrap: wrap; padding: 14px 16px; }
  .header-right { flex-wrap: wrap; gap: 8px; width: 100%; }
  .messages, .composer, .stuck-row { padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
