/* ==========================================================================
   CodeForge - visual system v6 "night forge".

   Dark-first, Duolingo-energy: deep navy ground, one signature green for
   every primary action, chunky 3D buttons, a playful colour per chapter,
   and a light mode one toggle away ([data-theme="light"]).
   Everything routes through tokens - components never hardcode a theme.
   The editor island is constant: code looks like code in both modes.
   ========================================================================== */

@font-face {
  font-family: "Nunito";
  src: url("../vendor/fonts/nunito-var.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- dark (default) ---- */
  --bg:          #131f24;
  --surface:     #1b2a32;
  --surface-2:   #22343f;
  --surface-3:   #2a3f4b;
  --surface-4:   #345061;
  --line:        #37464f;
  --line-soft:   #2c3b43;
  --line-strong: #4a5f6a;

  --text:        #f1f7fb;
  --body:        #d9e5ea;
  --dim:         #9db4bd;
  --faint:       #64808c;

  /* the darker island: editor, console, code samples (constant-ish) */
  --code-bg:     #0d171c;
  --code-bar:    #0a1216;
  --code-line:   #22343c;
  --code-text:   #dce8ed;
  --code-dim:    #8fa6af;

  /* the duo palette */
  --green:       #58cc02;
  --green-dark:  #46a302;
  --green-lit:   #79d92e;
  --blue:        #1cb0f6;
  --blue-dark:   #1899d6;
  --red:         #ff4b4b;
  --orange:      #ff9600;
  --yellow:      #ffc800;
  --purple:      #ce82ff;
  --pink:        #ff86d0;

  --ok:          #58cc02;
  --ok-wash:     rgba(88, 204, 2, 0.14);
  --ok-border:   rgba(88, 204, 2, 0.45);
  --ok-text:     #86e03d;
  --err:         #ff5c5c;
  --err-wash:    rgba(255, 75, 75, 0.13);
  --err-border:  rgba(255, 92, 92, 0.45);
  --err-text:    #ff8a8a;
  --warn:        #ff9600;
  --warn-wash:   rgba(255, 150, 0, 0.13);
  --warn-border: rgba(255, 150, 0, 0.45);
  --info:        #1cb0f6;
  --info-wash:   rgba(28, 176, 246, 0.13);
  --info-border: rgba(28, 176, 246, 0.45);
  --info-text:   #62c9ff;

  /* selection (chosen options, active toggles) */
  --sel-wash:    rgba(28, 176, 246, 0.16);
  --sel-border:  rgba(28, 176, 246, 0.55);
  --sel-text:    #62c9ff;

  /* inline code chips in prose */
  --chip-bg:     rgba(255, 255, 255, 0.08);
  --chip-text:   #ffd48a;

  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-pop:  0 24px 70px rgba(0, 0, 0, 0.55);
  --btn-gloss:   inset 0 1.5px 0 rgba(255, 255, 255, 0.22);

  --overlay:     rgba(6, 12, 15, 0.72);
  --scroll-thumb:#33454d;

  /* chapter accent - swapped per lesson by the app */
  --accent:      var(--green);
  --accent-wash: rgba(88, 204, 2, 0.14);

  --ui:      "Nunito", "Segoe UI", system-ui, sans-serif;
  --display: "Nunito", "Segoe UI", system-ui, sans-serif;
  --mono:    "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;

  --r-sm: 10px;  --r: 14px;  --r-lg: 18px;
}

/* ---- light mode: one toggle away ---- */
:root[data-theme="light"] {
  --bg:          #ffffff;
  --surface:     #ffffff;
  --surface-2:   #f7f7f7;
  --surface-3:   #efefef;
  --surface-4:   #e5e5e5;
  --line:        #e5e5e5;
  --line-soft:   #ececec;
  --line-strong: #d0d0d0;

  --text:        #3c3c3c;
  --body:        #4b4b4b;
  --dim:         #777777;
  --faint:       #afafaf;

  --ok-wash:     #e9f8dc;
  --ok-border:   #c7ecac;
  --ok-text:     #46a302;
  --err-wash:    #ffeded;
  --err-border:  #ffd2d2;
  --err-text:    #d33131;
  --warn-wash:   #fff2df;
  --warn-border: #ffdcb0;
  --info-wash:   #ddf4ff;
  --info-border: #b5e6ff;
  --info-text:   #1899d6;

  --sel-wash:    #ddf4ff;
  --sel-border:  #84d8ff;
  --sel-text:    #1899d6;

  --chip-bg:     #efefef;
  --chip-text:   #b3451e;

  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-pop:  0 20px 60px rgba(0, 0, 0, 0.15);
  --btn-gloss:   inset 0 1.5px 0 rgba(255, 255, 255, 0.35);

  --overlay:     rgba(60, 60, 60, 0.35);
  --scroll-thumb:#d8d8d8;

  --accent-wash: rgba(88, 204, 2, 0.13);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--ui); font-size: 14.5px; line-height: 1.5;
  background: var(--bg); color: var(--body);
  overflow: hidden; -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
.sidebar, .main, .lesson-bar, .panel-bar { transition: background-color .25s ease, border-color .25s ease; }

::selection { background: rgba(28, 176, 246, 0.3); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

.hidden { display: none !important; }
.ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app { display: grid; grid-template-columns: 262px minmax(0, 1fr); height: 100vh; }
@media (max-width: 1180px) { .app { grid-template-columns: 222px minmax(0, 1fr); } }

/* ==========================================================================
   Brand + sidebar
   ========================================================================== */

.sidebar {
  background: var(--surface); border-right: 2px solid var(--line-soft);
  display: flex; flex-direction: column; min-height: 0;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 17px 15px 13px; }
.brand-logo { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 2px 6px rgba(240, 169, 76, .25)); }
.brand-name {
  font-family: var(--display); font-size: 17px; font-weight: 800;
  letter-spacing: -0.01em; line-height: 1.1; color: var(--text);
}
.brand-name span { color: var(--green); }
.brand-sub { font-size: 11px; color: var(--faint); margin-top: 2px; font-weight: 600; }

/* track switcher */
.tracks { display: flex; gap: 6px; padding: 0 14px 12px; }
.track-btn {
  flex: 1; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--line-soft);
  font-family: var(--ui); font-size: 11.5px; font-weight: 700; color: var(--dim);
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  transition: background .12s, border-color .12s, color .12s;
}
.track-btn:hover { background: var(--surface-3); color: var(--text); }
.track-btn.is-active { background: var(--sel-wash); border-color: var(--sel-border); color: var(--sel-text); }
.track-count { font-family: var(--mono); font-size: 9.5px; color: var(--faint); font-weight: 600; }
.track-btn.is-active .track-count { color: var(--sel-text); }

/* progress */
.progress-block { padding: 2px 17px 14px; }
.progress-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--dim); font-weight: 700; }
.progress-pct { font-family: var(--ui); font-size: 12px; color: var(--ok-text); font-weight: 800; }
.progress-track { height: 13px; background: var(--surface-3); border-radius: 8px; margin: 7px 0 6px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(180deg, var(--green-lit), var(--green));
  border-radius: 8px;
  transition: width .45s cubic-bezier(.4, 0, .2, 1); position: relative;
}
.progress-fill::after {
  content: ""; position: absolute; left: 7px; right: 7px; top: 3px; height: 4px;
  background: rgba(255, 255, 255, .32); border-radius: 4px;
}
.progress-meta { font-size: 11.5px; color: var(--faint); font-weight: 600; }

/* rail */
.rail { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.rail-btn {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: var(--r-sm); background: none; border: 2px solid transparent; cursor: pointer;
  font-family: var(--ui); font-weight: 800; color: var(--dim);
  text-align: left; transition: background .12s, color .12s, border-color .12s;
  text-transform: uppercase; letter-spacing: .05em; font-size: 12.5px;
}
.rail-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-btn.is-active { background: var(--sel-wash); border-color: var(--sel-border); color: var(--sel-text); }
.rail-btn.is-active .ico { color: var(--sel-text); }
.rail-badge {
  margin-left: auto; font-family: var(--ui); font-size: 10.5px; font-weight: 800;
  background: var(--surface-3); color: var(--dim); padding: 1px 7px; border-radius: 20px;
}
.rail-btn.is-active .rail-badge { background: var(--sel-border); color: var(--text); }

/* lesson tree */
.lesson-tree { flex: 1; overflow-y: auto; padding: 4px 10px 10px; min-height: 0; }
.tree-chapter { margin-bottom: 2px; }
.tree-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 8px; border-radius: var(--r-sm);
  background: none; border: none; cursor: pointer; color: var(--dim);
  font-family: var(--ui); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 800;
}
.tree-head:hover { background: var(--surface-2); color: var(--text); }
.tree-dotmark {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--chapter, var(--faint));
  box-shadow: 0 0 8px color-mix(in srgb, var(--chapter, transparent) 55%, transparent);
}
.tree-tick { margin-left: auto; font-family: var(--ui); font-size: 10.5px; font-weight: 800; color: var(--faint); }
.tree-tick.done { color: var(--ok-text); }
.tree-lessons { display: none; padding: 1px 0 6px; }
.tree-chapter.open .tree-lessons { display: block; }

.tree-lesson {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6.5px 8px 6.5px 12px; border-radius: var(--r-sm);
  background: none; border: none; cursor: pointer;
  font-family: var(--ui); font-size: 13px; font-weight: 600; color: var(--dim); text-align: left;
}
.tree-lesson:hover { background: var(--surface-2); color: var(--text); }
.tree-lesson.current { background: var(--accent-wash); color: var(--text); box-shadow: inset 3px 0 0 var(--chapter, var(--accent)); }
.tree-lesson.locked { color: var(--faint); opacity: .55; cursor: not-allowed; }
.tree-lesson.locked:hover { background: none; }
.dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-strong); display: grid; place-items: center;
  font-size: 9px; font-weight: 800; color: transparent; background: transparent;
}
.tree-lesson.done .dot { border-color: var(--green); background: var(--green); color: #fff; }
.tree-lesson.current .dot { border-color: var(--chapter, var(--accent)); }
.tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-foot { border-top: 2px solid var(--line-soft); padding: 10px 12px 10px 15px; display: flex; align-items: center; gap: 8px; }
.engine { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; color: var(--faint); margin-right: auto; }
.engine-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.engine-dot.ready { background: var(--green); box-shadow: 0 0 8px rgba(88, 204, 2, .6); }
.engine-dot.busy { background: var(--orange); box-shadow: 0 0 8px rgba(255, 150, 0, .6); }
.text-btn {
  background: none; border: none; cursor: pointer; font-family: var(--ui);
  font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--faint);
}
.text-btn:hover { color: var(--blue); }
#btn-reset:hover { color: var(--red); }
#btn-theme { font-size: 15px; width: 28px; height: 28px; }

/* ==========================================================================
   Main / views
   ========================================================================== */

.main { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.view { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 30px 34px; display: flex; flex-direction: column; }
#view-lesson { padding: 0; overflow: hidden; }

.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.view-title { font-family: var(--display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.view-sub { color: var(--dim); font-size: 14px; font-weight: 600; margin-top: 4px; max-width: 64ch; }

/* chunky duo buttons */
.btn {
  font-family: var(--ui); font-size: 13px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 9px 16px; border-radius: var(--r); cursor: pointer;
  background: var(--surface-2); color: var(--info-text);
  border: 2px solid var(--line); border-bottom-width: 4px;
  transition: filter .12s, background .12s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.btn.primary {
  background: var(--green); color: #fff; border-color: var(--green-dark);
  box-shadow: var(--btn-gloss);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.btn.primary:hover { filter: brightness(1.07); background: var(--green); }
.btn.ghost { background: none; border-color: transparent; color: var(--info-text); }
.btn.ghost:hover { background: var(--sel-wash); }
.btn.ghost:active { transform: none; border-bottom-width: 2px; margin-bottom: 0; }
.btn.big { padding: 12px 24px; font-size: 14.5px; }
.btn:disabled { background: var(--surface-2); color: var(--faint); border-color: var(--line-soft); cursor: not-allowed; transform: none; box-shadow: none; }
.btn:disabled:hover { filter: none; background: var(--surface-2); }
.icon-btn {
  width: 31px; height: 31px; display: grid; place-items: center;
  border-radius: var(--r-sm); background: none; border: 2px solid transparent;
  color: var(--dim); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }

.search {
  background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--r);
  padding: 9px 14px; color: var(--text); font-family: var(--ui); font-size: 13.5px; font-weight: 600; width: 240px;
}
.search::placeholder { color: var(--faint); }
.search:focus { outline: none; border-color: var(--sel-border); background: var(--surface); }

/* ==========================================================================
   Chapter cards
   ========================================================================== */

.chapter-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.chapter-card {
  position: relative; background: var(--surface); border: 2px solid var(--line-soft);
  border-bottom-width: 4px;
  border-radius: var(--r-lg); padding: 16px 17px 15px; cursor: pointer;
  display: flex; flex-direction: column; gap: 9px; overflow: hidden;
  transition: border-color .15s, transform .15s, box-shadow .2s;
}
.chapter-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg,
    var(--chapter, var(--accent)),
    color-mix(in srgb, var(--chapter, var(--accent)) 55%, transparent));
}
.chapter-card:hover {
  border-color: color-mix(in srgb, var(--chapter, var(--accent)) 45%, var(--line));
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .25),
              0 0 24px color-mix(in srgb, var(--chapter, transparent) 12%, transparent);
}
.chapter-card.locked { opacity: .5; cursor: not-allowed; }
.chapter-card.locked:hover { transform: none; border-color: var(--line-soft); box-shadow: none; }
.cc-top { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.cc-num {
  font-family: var(--ui); font-size: 10px; letter-spacing: .08em; font-weight: 800;
  color: var(--chapter, var(--accent));
  background: color-mix(in srgb, var(--chapter, var(--accent)) 14%, transparent);
  padding: 2.5px 9px; border-radius: 20px;
}
.cc-count { font-family: var(--ui); font-size: 11px; font-weight: 800; color: var(--faint); }
.cc-title { font-family: var(--display); font-size: 17.5px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.cc-desc { font-size: 13px; font-weight: 600; color: var(--dim); line-height: 1.5; }
.cc-lessons { list-style: none; margin: 3px 0; padding: 0; display: flex; flex-direction: column; }
.cc-lessons li { display: flex; align-items: baseline; gap: 8px; font-size: 12.8px; font-weight: 600; color: var(--faint); padding: 2.5px 0; }
.cc-lessons li.done { color: var(--dim); }
.cc-lessons li.next { color: var(--text); font-weight: 800; }
.cc-mark { font-family: var(--mono); font-size: 11px; width: 10px; flex: none; color: var(--faint); }
.cc-lessons li.done .cc-mark { color: var(--green); }
.cc-lessons li.next .cc-mark { color: var(--chapter, var(--accent)); }
.cc-skills { display: flex; flex-wrap: wrap; gap: 5px; }
.skill-chip {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  background: var(--surface-2); border: 1.5px solid var(--line-soft);
  padding: 2.5px 8px; border-radius: 20px;
}
.cc-bar { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; margin-top: auto; }
.cc-bar span { display: block; height: 100%; background: var(--chapter, var(--accent)); border-radius: 6px; transition: width .4s; }

/* ==========================================================================
   Lesson view
   ========================================================================== */

.lesson-bar {
  display: flex; align-items: center; gap: 13px; padding: 12px 20px;
  border-bottom: 2px solid var(--line-soft); background: var(--surface); flex: none;
}
.lesson-bar-text { min-width: 0; flex: 1; }
.lesson-chapter { font-family: var(--ui); font-size: 10.5px; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.lesson-name { font-family: var(--display); font-size: 17.5px; font-weight: 800; letter-spacing: -.01em; margin-top: 1px; color: var(--text); }
.lesson-bar-right { display: flex; align-items: center; gap: 8px; }

/* duo-style chapter position segments */
.seg-row { display: flex; gap: 4px; margin-right: 10px; }
.seg { width: 17px; height: 7px; border-radius: 4px; background: var(--surface-3); transition: background .2s; }
.seg.done { background: var(--green); }
.seg.cur { background: var(--accent); box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--accent) 30%, transparent); }
@media (max-width: 1180px) { .seg-row { display: none; } }

.status-chip { font-family: var(--ui); font-size: 10.5px; letter-spacing: .06em; padding: 4px 11px; border-radius: 20px; text-transform: uppercase; font-weight: 800; }
.status-chip.done { background: var(--ok-wash); color: var(--ok-text); }
.status-chip.progress { background: var(--accent-wash); color: var(--accent); }

/* minmax(0,..) so the editor can never be pushed off-screen on a narrow window */
.lesson-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); }
.study-col { min-height: 0; overflow-y: auto; border-right: 2px solid var(--line-soft); background: var(--bg); }
.study { padding: 22px 26px 44px; max-width: 76ch; }

.study h2 {
  font-family: var(--ui); font-size: 11px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
  padding-bottom: 7px; border-bottom: 2px solid var(--line-soft); margin: 30px 0 14px;
}
.study h2:first-child { margin-top: 0; }
.study h3 { font-family: var(--display); font-size: 18.5px; font-weight: 800; letter-spacing: -.01em; margin: 20px 0 9px; color: var(--text); }
.study h3:first-of-type { margin-top: 0; }
.study p { color: var(--body); line-height: 1.68; margin-bottom: 12px; font-size: 14.6px; font-weight: 500; }
.study b, .study strong { color: var(--text); font-weight: 800; }
.study code { font-family: var(--mono); font-size: 12.8px; background: var(--chip-bg); color: var(--chip-text); padding: 1.5px 6px; border-radius: 6px; }
.study pre.sample, .study .sample {
  font-family: var(--mono); font-size: 13.3px; line-height: 1.62;
  background: var(--code-bg); border: 1px solid var(--code-line);
  border-left: 5px solid var(--accent);
  padding: 13px 15px; border-radius: var(--r); margin: 12px 0 14px;
  overflow-x: auto; color: var(--code-text); white-space: pre;
}
.study ul, .study ol { margin: 0 0 13px 19px; color: var(--body); line-height: 1.65; font-size: 14.2px; }
.study li { margin-bottom: 5px; }

.callout {
  border-radius: var(--r); padding: 12px 15px; margin: 14px 0;
  font-size: 13.6px; font-weight: 600; line-height: 1.6; color: var(--body);
  border: 2px solid var(--line-soft); border-left: 5px solid var(--line-strong); background: var(--surface);
}
.callout b:first-child { display: block; font-family: var(--ui); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 5px; font-weight: 800; }
.callout.key  { border-color: var(--ok-border); border-left-color: var(--green); background: var(--ok-wash); }
.callout.key b:first-child { color: var(--ok-text); }
.callout.tip  { border-color: var(--info-border); border-left-color: var(--blue); background: var(--info-wash); }
.callout.tip b:first-child { color: var(--info-text); }
.callout.warn { border-color: var(--err-border); border-left-color: var(--err); background: var(--err-wash); }
.callout.warn b:first-child { color: var(--err-text); }

.example { border: 2px solid var(--line-soft); border-radius: var(--r); overflow: hidden; margin: 4px 0 8px; }
.example-row { border-bottom: 2px solid var(--line-soft); }
.example-row:last-child { border-bottom: none; }
.example-code { font-family: var(--mono); font-size: 13.2px; line-height: 1.7; padding: 9px 14px; background: var(--code-bg); color: var(--code-text); white-space: pre-wrap; }
.example-note { font-size: 12.8px; font-weight: 600; color: var(--dim); line-height: 1.55; padding: 8px 14px 9px; background: var(--surface); border-left: 5px solid var(--accent); }
.example-note::before { content: "→ "; color: var(--accent); font-weight: 800; }

.tasks { list-style: none; margin: 0 0 6px; padding: 0; }
.tasks li {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 13px; margin-bottom: 8px;
  background: var(--surface); border: 2px solid var(--line-soft); border-bottom-width: 4px;
  border-radius: var(--r); font-size: 13.8px; font-weight: 600; color: var(--body); line-height: 1.5;
}
.tasks .task-n { font-family: var(--ui); font-size: 11px; color: #fff; background: var(--accent); border-radius: 8px; padding: 2px 8px; flex: none; margin-top: 1px; font-weight: 800; text-shadow: 0 1px 0 rgba(0,0,0,.2); }

.mistakes { list-style: none; margin: 0; padding: 0; }
.mistakes li { padding: 10px 14px; margin-bottom: 8px; font-size: 13.4px; font-weight: 600; line-height: 1.55; background: var(--err-wash); border: 2px solid var(--err-border); border-left: 5px solid var(--err); border-radius: var(--r); color: var(--body); }
.mistakes code { font-family: var(--mono); font-size: 12.6px; color: var(--chip-text); background: var(--chip-bg); padding: 1px 6px; border-radius: 5px; }

.terms { display: flex; flex-direction: column; gap: 8px; }
.term { display: grid; grid-template-columns: 132px 1fr; gap: 12px; padding: 10px 13px; background: var(--surface); border: 2px solid var(--line-soft); border-radius: var(--r); }
.term-name { font-family: var(--mono); font-size: 12.8px; font-weight: 600; color: var(--chip-text); }
.term-def { font-size: 13.2px; font-weight: 600; color: var(--dim); line-height: 1.5; }

.notes-block { margin-top: 30px; }
.notes-area {
  width: 100%; min-height: 92px; resize: vertical; background: var(--surface-2);
  border: 2px solid var(--line); border-radius: var(--r); padding: 11px 13px;
  color: var(--text); font-family: var(--ui); font-size: 13.6px; font-weight: 600; line-height: 1.6;
}
.notes-area:focus { outline: none; border-color: var(--sel-border); }
.notes-area::placeholder { color: var(--faint); font-weight: 600; }
.notes-saved { font-size: 11px; font-weight: 700; color: var(--faint); margin-top: 5px; height: 13px; }

/* ==========================================================================
   Editor + output - the code island (constant in both themes)
   ========================================================================== */

.work-col { display: grid; grid-template-rows: 1.3fr 1fr; min-height: 0; min-width: 0; }
.scratch-grid { flex: 1; min-height: 0; display: grid; grid-template-rows: 1.4fr 1fr; gap: 14px; }
.editor-panel, .output-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--code-bg); }
.editor-panel { border-bottom: 2px solid var(--code-line); }
.scratch-grid .editor-panel, .scratch-grid .output-panel { border: 2px solid var(--line-soft); border-bottom-width: 4px; border-radius: var(--r-lg); overflow: hidden; }

.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: var(--code-bar); border-bottom: 1px solid var(--code-line); flex: none; }
.file-name { font-family: var(--mono); font-size: 11.5px; color: var(--code-dim); }
.panel-bar-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.panel-bar .icon-btn { color: var(--code-dim); }
.panel-bar .icon-btn:hover { background: rgba(255, 255, 255, .07); color: var(--code-text); border-color: transparent; }
.panel-bar .btn { border-width: 2px; border-bottom-width: 3px; padding: 6px 13px; font-size: 12px; }
.panel-bar .btn:not(.primary):not(.ghost) { background: #223740; color: #9fdcff; border-color: #101d22; }
.panel-bar .btn:not(.primary):not(.ghost):hover { background: #2a424c; }
.panel-bar .btn.ghost { color: #9fdcff; }
.panel-bar .btn.ghost:hover { background: rgba(28, 176, 246, .15); }
.run-note { font-family: var(--mono); font-size: 10.5px; color: var(--code-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.CodeMirror { flex: 1; min-height: 0; height: auto; font-family: var(--mono); font-size: 13.6px; line-height: 1.62; background: var(--code-bg); color: var(--code-text); }
.CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid var(--code-line); }
.CodeMirror-linenumber { color: #46606c; font-size: 11.5px; }
.CodeMirror-cursor { border-left: 2px solid var(--yellow); }
.CodeMirror-selected { background: rgba(28, 176, 246, .22) !important; }
.CodeMirror-activeline-background { background: rgba(255, 255, 255, .035); }
.CodeMirror-matchingbracket { color: var(--yellow) !important; border-bottom: 1px solid var(--yellow); }
pre.CodeMirror-placeholder { color: #4e6a77 !important; font-style: italic; }

.cm-s-forge .cm-keyword    { color: #ff9d7a; }
.cm-s-forge .cm-builtin    { color: #6fc7ff; }
.cm-s-forge .cm-def        { color: #ffd48a; }
.cm-s-forge .cm-variable   { color: var(--code-text); }
.cm-s-forge .cm-variable-2 { color: #c4d3da; }
.cm-s-forge .cm-string     { color: #8fe08f; }
.cm-s-forge .cm-number     { color: #f9a8d4; }
.cm-s-forge .cm-comment    { color: #6b8391; font-style: italic; }
.cm-s-forge .cm-operator   { color: #bccbd2; }
.cm-s-forge .cm-property   { color: #d8c08a; }
.cm-s-forge .cm-error      { color: #ff7b6b; }

.output-body { flex: 1; min-height: 0; overflow-y: auto; padding: 13px 15px; font-family: var(--mono); font-size: 13px; line-height: 1.62; }
.output-body::-webkit-scrollbar-thumb { background: #2c3f48; border-color: var(--code-bg); }
.output-empty { color: #5d7681; font-family: var(--ui); font-size: 13px; font-weight: 600; }
.out-line { color: var(--code-text); white-space: pre-wrap; word-break: break-word; }

/* ==========================================================================
   Diagnosis - feedback cards inside the console
   ========================================================================== */

.diag { margin-top: 12px; border-radius: var(--r); overflow: hidden; border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow-card); }
.diag-head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; font-family: var(--ui); }
.diag.fail .diag-head { background: var(--err-wash); border-bottom: 2px solid var(--err-border); }
.diag.pass .diag-head { background: var(--ok-wash); border-bottom: 2px solid var(--ok-border); }
.diag-icon { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 800; }
.diag.fail .diag-icon { background: var(--red); color: #fff; }
.diag.pass .diag-icon { background: var(--green); color: #fff; animation: icon-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes icon-pop { from { transform: scale(.3); } to { transform: scale(1); } }
.diag-title { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.diag.fail .diag-title { color: var(--err-text); }
.diag.pass .diag-title { color: var(--ok-text); }

.diag-body { padding: 4px 0 6px; background: var(--surface); }
.diag-block { padding: 11px 14px; border-bottom: 2px solid var(--line-soft); font-family: var(--ui); }
.diag-block:last-child { border-bottom: none; }
.diag-kind {
  font-family: var(--ui); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 5px; display: flex; align-items: center; gap: 6px; font-weight: 800;
}
.diag-kind::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.diag-block.near .diag-kind { color: var(--orange); }
.diag-block.why  .diag-kind { color: var(--info-text); }
.diag-block.spot .diag-kind { color: var(--yellow); }
.diag-block.what .diag-kind { color: var(--err-text); }
.diag-btitle { font-size: 13.8px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.diag-text { font-size: 13.4px; font-weight: 600; color: var(--body); line-height: 1.6; }
.diag-text code { font-family: var(--mono); font-size: 12.4px; background: var(--chip-bg); padding: 2px 6px; border-radius: 5px; color: var(--chip-text); }
.diag-line { margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.diag-fix {
  margin-top: 8px; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--info-wash); border: 2px solid var(--info-border);
  font-size: 13.2px; font-weight: 600; color: var(--body); line-height: 1.55;
}
.diag-fix::before { content: "TRY THIS "; font-family: var(--ui); font-size: 9.5px; letter-spacing: .1em; color: var(--info-text); font-weight: 800; }
.diag-example { margin-top: 8px; font-family: var(--mono); font-size: 12.4px; line-height: 1.65; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--r-sm); padding: 10px 13px; color: var(--code-text); white-space: pre-wrap; }

.diag-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 11px 14px; background: var(--surface); }
.cmp-box { border-radius: var(--r-sm); padding: 9px 11px; min-width: 0; }
.cmp-label { font-family: var(--ui); font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 5px; font-weight: 800; }
.cmp-box.want { border: 2px solid var(--ok-border); background: var(--ok-wash); }
.cmp-box.want .cmp-label { color: var(--ok-text); }
.cmp-box.got { border: 2px solid var(--err-border); background: var(--err-wash); }
.cmp-box.got  .cmp-label { color: var(--err-text); }
.cmp-line { font-family: var(--mono); font-size: 12.4px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.cmp-empty { font-family: var(--ui); font-size: 12.6px; font-weight: 600; color: var(--faint); font-style: italic; }

.result { margin-top: 11px; padding: 12px 15px; border-radius: var(--r); font-family: var(--ui); font-size: 13.6px; font-weight: 600; line-height: 1.6; border: 2px solid var(--line); background: var(--surface); color: var(--body); box-shadow: var(--shadow-card); }
.result-title { font-family: var(--ui); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; font-weight: 800; }
.result.pass { border-color: var(--ok-border); background: var(--ok-wash); }
.result.pass .result-title { color: var(--ok-text); }
.result.info { border-color: var(--info-border); background: var(--info-wash); }
.result.info .result-title { color: var(--info-text); }
.result b { color: var(--text); font-weight: 800; }

.hint { margin-top: 11px; padding: 12px 15px; border-radius: var(--r); background: var(--info-wash); border: 2px solid var(--info-border); font-size: 13.6px; font-weight: 600; line-height: 1.6; color: var(--body); font-family: var(--ui); }
.hint-step { font-family: var(--ui); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--info-text); margin-bottom: 5px; font-weight: 800; }

/* ==========================================================================
   Reference
   ========================================================================== */

.ref-list { display: flex; flex-direction: column; gap: 24px; }
.ref-group-title { font-family: var(--ui); font-size: 11px; letter-spacing: .11em; text-transform: uppercase; color: var(--chapter, var(--accent)); padding-bottom: 7px; border-bottom: 2px solid var(--line-soft); margin-bottom: 12px; font-weight: 800; }
.ref-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 10px; }
.ref-card { background: var(--surface); border: 2px solid var(--line-soft); border-bottom-width: 4px; border-radius: var(--r); padding: 13px 15px; }
.ref-name { font-family: var(--mono); font-size: 13.4px; font-weight: 600; color: var(--chip-text); margin-bottom: 4px; }
.ref-def { font-size: 13.2px; font-weight: 600; color: var(--dim); line-height: 1.55; }
.ref-sample { font-family: var(--mono); font-size: 12.6px; color: var(--code-text); background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 8px; padding: 8px 11px; margin-top: 8px; white-space: pre-wrap; }
.ref-empty { color: var(--faint); font-size: 13.8px; font-weight: 600; }

/* ==========================================================================
   Welcome / onboarding
   ========================================================================== */

.welcome-layer { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: grid; place-items: center; overflow-y: auto; }
.welcome {
  width: min(690px, 92vw); margin: 40px 0; padding: 34px 38px 30px;
  background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px;
  border-radius: 22px;
  box-shadow: var(--shadow-pop);
}
.wc-logo { width: 56px; height: 56px; margin-bottom: 16px; filter: drop-shadow(0 4px 14px rgba(240, 169, 76, .3)); }
.wc-step { font-family: var(--ui); font-size: 11px; letter-spacing: .11em; text-transform: uppercase; color: var(--ok-text); margin-bottom: 8px; font-weight: 800; }
.wc-title { font-family: var(--display); font-size: 29px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-bottom: 9px; color: var(--text); }
.wc-sub { color: var(--dim); font-size: 14.6px; font-weight: 600; line-height: 1.6; margin-bottom: 22px; max-width: 56ch; }

.wc-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.wc-option {
  display: flex; align-items: flex-start; gap: 13px; text-align: left; width: 100%;
  padding: 13px 15px; border-radius: var(--r); cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--line); border-bottom-width: 4px;
  transition: border-color .12s, background .12s;
  font-family: var(--ui);
}
.wc-option:hover { background: var(--surface-3); }
.wc-option:active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.wc-option.chosen { border-color: var(--sel-border); background: var(--sel-wash); }
.wc-key {
  font-family: var(--ui); font-size: 11.5px; font-weight: 800; flex: none;
  width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--dim); margin-top: 1px; border: 2px solid var(--line);
}
.wc-option.chosen .wc-key { background: var(--blue); border-color: var(--blue-dark); color: #fff; }
.wc-otext { min-width: 0; }
.wc-olabel { font-size: 14.6px; font-weight: 800; color: var(--text); }
.wc-option.chosen .wc-olabel { color: var(--sel-text); }
.wc-odesc { font-size: 13px; font-weight: 600; color: var(--dim); margin-top: 2px; line-height: 1.5; display: block; }

.wc-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 4px; }
.wc-dots { display: flex; gap: 7px; }
.wc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-4); }
.wc-dot.on { background: var(--green); box-shadow: 0 0 8px rgba(88, 204, 2, .5); }
.wc-actions { display: flex; gap: 10px; align-items: center; }

.plan { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.plan-row { display: flex; gap: 13px; align-items: flex-start; padding: 13px 15px; background: var(--surface-2); border: 2px solid var(--line-soft); border-left: 5px solid var(--green); border-radius: var(--r); }
.plan-icon { font-family: var(--ui); font-size: 11px; font-weight: 800; color: var(--ok-text); flex: none; margin-top: 2px; }
.plan-title { font-size: 14.4px; font-weight: 800; color: var(--text); }
.plan-desc { font-size: 13px; font-weight: 600; color: var(--dim); line-height: 1.55; margin-top: 2px; display: block; }

/* ==========================================================================
   Dialog
   ========================================================================== */

.dialog-layer { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 150; backdrop-filter: blur(2px); }
.dialog { background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--r-lg); padding: 22px 24px; width: min(450px, 90vw); box-shadow: var(--shadow-pop); }
.dialog h3 { font-family: var(--display); font-size: 18.5px; font-weight: 800; margin-bottom: 7px; color: var(--text); }
.dialog p { color: var(--dim); font-size: 13.8px; font-weight: 600; line-height: 1.6; margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ==========================================================================
   Polish - motion, focus, and small touches
   ========================================================================== */

.run-note { display: flex; align-items: center; gap: 4px; }
.run-note kbd {
  font-family: var(--mono); font-size: 9.5px; color: var(--code-dim);
  background: #223740; border: 1px solid #101d22;
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; line-height: 1.5;
}
.note-sep { color: #4e6570; margin: 0 3px; }

.btn:focus-visible, .icon-btn:focus-visible, .rail-btn:focus-visible,
.track-btn:focus-visible, .tree-lesson:focus-visible, .tree-head:focus-visible,
.wc-option:focus-visible, .text-btn:focus-visible, .search:focus-visible {
  outline: 3px solid rgba(28, 176, 246, .55);
  outline-offset: 1px;
}

.view { animation: view-in .16s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.diag, .hint, .result { animation: panel-in .18s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.diag.pass { animation: panel-in .18s ease, pass-glow 1.1s ease .05s; }
@keyframes pass-glow {
  0% { box-shadow: 0 0 0 0 rgba(88, 204, 2, 0); }
  30% { box-shadow: 0 0 0 4px rgba(88, 204, 2, .4); }
  100% { box-shadow: 0 0 0 0 rgba(88, 204, 2, 0); }
}

.editor-panel:focus-within .file-name { color: #9fdcff; }
.editor-panel:focus-within .panel-bar { border-bottom-color: #2c4650; }

.result-next {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--ui); font-size: 12.5px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; cursor: pointer;
  color: #fff; background: var(--green); border: 2px solid var(--green-dark); border-bottom-width: 4px;
  padding: 8px 15px; border-radius: var(--r-sm);
  box-shadow: var(--btn-gloss); text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
  transition: filter .12s;
}
.result-next:hover { filter: brightness(1.07); }
.result-next:active { transform: translateY(2px); border-bottom-width: 2px; }

.output-empty::before { content: "▸ "; color: #4e6570; font-family: var(--mono); }

@media (prefers-reduced-motion: reduce) {
  .view, .diag, .hint, .result, .diag.pass, .diag.pass .diag-icon { animation: none; }
}

/* ==========================================================================
   Study modes - guided stepper, folds, and the view toggle
   ========================================================================== */

.study-toggle {
  display: inline-flex; gap: 3px; padding: 3px;
  background: var(--surface); border: 2px solid var(--line-soft);
  border-radius: var(--r); margin-bottom: 18px;
}
.stog {
  font-family: var(--ui); font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--dim);
  background: none; border: none; cursor: pointer;
  padding: 6px 13px; border-radius: var(--r-sm);
  transition: background .12s, color .12s;
}
.stog:hover { color: var(--text); }
.stog.on { background: var(--sel-wash); color: var(--sel-text); }

.step-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.step-count { font-family: var(--ui); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 800; }
.step-dots { display: flex; gap: 6px; }
.sd { width: 22px; height: 6px; border-radius: 4px; background: var(--surface-3); transition: background .25s; }
.sd.on { background: var(--green); }

.step-body { animation: panel-in .18s ease; }
.step-body h3:first-child { margin-top: 0; }

.step-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--line-soft);
}
.step-nudge {
  font-size: 13.4px; font-weight: 600; color: var(--body); line-height: 1.6;
  background: var(--ok-wash); border: 2px solid var(--ok-border); border-left: 5px solid var(--green);
  border-radius: var(--r); padding: 11px 14px; margin: 14px 0 18px;
}
.step-nudge b { color: var(--ok-text); font-weight: 800; }

.fold {
  border: 2px solid var(--line-soft); border-radius: var(--r);
  background: var(--surface); margin: 0 0 10px; overflow: hidden;
}
.fold summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  font-family: var(--ui); font-size: 11px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--dim);
  transition: color .12s, background .12s;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor;
  border-radius: 1px;
  transform: rotate(-45deg); transition: transform .16s; margin-top: -2px;
}
.fold[open] summary::before { transform: rotate(45deg); margin-top: -4px; }
.fold summary:hover { color: var(--text); background: var(--surface-2); }
.fold[open] summary { color: var(--accent); border-bottom: 2px solid var(--line-soft); }
.fold-body { padding: 13px 14px 11px; }
.fold-body > :last-child { margin-bottom: 0; }
.fold-body .notes-area { margin-top: 2px; }

@media (prefers-reduced-motion: reduce) { .step-body { animation: none; } }

/* ==========================================================================
   Collapsible sidebar + welcome-back
   ========================================================================== */

.brand-collapse { margin-left: auto; opacity: .55; }
.brand-collapse:hover { opacity: 1; }

/* sidebar hidden -> its box vanishes, so the grid must become one column */
.app.side-collapsed { grid-template-columns: minmax(0, 1fr); }
.app.side-collapsed .sidebar { display: none; }

.side-reveal {
  position: fixed; left: 12px; bottom: 12px; z-index: 90;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-2); border: 2px solid var(--line); border-bottom-width: 4px;
  color: var(--dim); cursor: pointer; display: grid; place-items: center;
  box-shadow: var(--shadow-card);
  transition: background .12s, color .12s, transform .1s;
}
.side-reveal:hover { color: var(--blue); background: var(--surface-3); transform: translateY(-1px); }

.wb-card {
  background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px;
  border-radius: 22px; padding: 28px 30px 24px;
  width: min(470px, 92vw); text-align: center;
  box-shadow: var(--shadow-pop);
  animation: panel-in .22s ease;
  font-family: var(--ui);
}
.wb-flame { font-size: 42px; margin-bottom: 6px; animation: flame-pulse 2.2s ease-in-out infinite; display: inline-block; }
@keyframes flame-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(255, 150, 0, .3)); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 16px rgba(255, 150, 0, .55)); }
}
.wb-streak {
  font-family: var(--ui); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--orange); font-weight: 800; margin-bottom: 10px;
}
.wb-card h3 { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; color: var(--text); }
.wb-card p { color: var(--dim); font-size: 14px; font-weight: 600; line-height: 1.6; margin-bottom: 16px; }
.wb-stats {
  display: flex; justify-content: center; gap: 20px; flex-wrap: wrap;
  padding: 13px 12px; margin-bottom: 18px;
  background: var(--surface-2); border: 2px solid var(--line-soft); border-radius: var(--r);
  font-size: 12.8px; font-weight: 600; color: var(--dim);
}
.wb-stats b { color: var(--text); font-weight: 800; }
.wb-actions { justify-content: center; }

@media (prefers-reduced-motion: reduce) { .wb-flame { animation: none; } }

/* a narrow window stacks the lesson instead of crushing it */
@media (max-width: 920px) {
  .lesson-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1.4fr); }
  .study-col { border-right: none; border-bottom: 2px solid var(--line-soft); max-height: 42vh; }
  .scratch-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1.3fr 1fr; }
}
