/* ============================================================
   Workbooks · Claude build — left-rail track picker + prereq-gated path
   Namespaced wbc-* so it never collides with the other build.
   ============================================================ */
.wbc-root { display: block; }

.wbc-app {
  display: flex; gap: 28px; align-items: flex-start;
  max-width: 1060px; margin: 0 auto; padding: 8px 16px 72px;
}

/* ---------- left rail: parallel track picker ---------- */
.wbc-rail {
  flex: 0 0 246px; position: sticky; top: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.wbc-rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 4px 6px 8px;
}
.wbc-rail-title { font-size: 13px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: var(--text-3); }
.wbc-rail-count { font-size: 13px; font-weight: 700; color: var(--text-2); }

.wbc-track-btn {
  display: flex; align-items: center; gap: 11px; text-align: left;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg);
  transition: border-color .12s ease, background .12s ease, transform .06s ease;
}
.wbc-track-btn:hover { border-color: hsl(var(--hue) 60% 55%); }
.wbc-track-btn:active { transform: translateY(1px); }
.wbc-track-btn.active {
  border-color: hsl(var(--hue) 62% 46%);
  background: hsl(var(--hue) 62% 96%);
  box-shadow: inset 3px 0 0 hsl(var(--hue) 62% 46%);
}
.wbc-track-symbol {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  background: hsl(var(--hue) 62% 48%);
}
.wbc-track-text { display: flex; flex-direction: column; min-width: 0; }
.wbc-track-text strong { font-size: 13.5px; font-weight: 700; color: var(--text); line-height: 1.25; }
.wbc-track-text small { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.wbc-track-btn.complete .wbc-track-symbol { background: #ffd84d; color: #6a4b00; }

/* ---------- main path panel ---------- */
.wbc-main { flex: 1; min-width: 0; }
.wbc-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: 16px; color: #fff; margin-bottom: 8px;
  background: hsl(var(--hue) 62% 46%);
  box-shadow: 0 4px 0 hsl(var(--hue) 62% 36%);
}
.wbc-banner-symbol {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
  background: rgba(255,255,255,0.22);
}
.wbc-banner-text { flex: 1; min-width: 0; }
.wbc-banner-text h2 { margin: 0; font-size: 19px; font-weight: 800; }
.wbc-banner-text p { margin: 2px 0 0; font-size: 13px; opacity: .9; }
.wbc-banner-count { font-weight: 800; font-size: 14px; padding: 6px 12px; border-radius: 10px; background: rgba(255,255,255,0.22); }

/* winding path */
.wbc-path { position: relative; padding: 26px 0 6px; }
.wbc-path::before {
  content: ""; position: absolute; top: 4px; bottom: 24px; left: 50%;
  width: 3px; transform: translateX(-50%);
  background: repeating-linear-gradient(var(--border) 0 8px, transparent 8px 16px);
}
.wbc-slot { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; margin-bottom: 18px; }
.wbc-slot.pos-0 { transform: translateX(0); }
.wbc-slot.pos-1 { transform: translateX(88px); }
.wbc-slot.pos-2 { transform: translateX(0); }
.wbc-slot.pos-3 { transform: translateX(-88px); }

.wbc-node {
  width: 72px; height: 72px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 23px; font-weight: 800; color: #fff; display: grid; place-items: center;
  position: relative; transition: transform .08s ease;
}
.wbc-node:active { transform: translateY(4px); }
.wbc-node.done { background: hsl(var(--hue) 62% 46%); box-shadow: 0 6px 0 hsl(var(--hue) 62% 34%); }
.wbc-node.done:active { box-shadow: 0 2px 0 hsl(var(--hue) 62% 34%); }
.wbc-node.open { background: var(--green); box-shadow: 0 6px 0 #1b5e20; animation: wbc-bob 2.4s ease-in-out infinite; }
.wbc-node.open:active { box-shadow: 0 2px 0 #1b5e20; }
.wbc-node.locked { background: var(--bg-2); color: var(--text-3); box-shadow: inset 0 0 0 1.5px var(--border); cursor: default; }
.wbc-node.locked:active { transform: none; }
.wbc-node.frontier.done, .wbc-node.frontier.open { box-shadow: 0 0 0 3px var(--accent), 0 6px 0 hsl(var(--hue) 62% 34%); }
.wbc-node-glyph { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.wbc-node-glyph svg { display: block; }

@keyframes wbc-bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-4px);} }

.wbc-node-label { font-size: 12px; font-weight: 600; color: var(--text-2); max-width: 160px; text-align: center; line-height: 1.3; }
.wbc-node-need { font-size: 10.5px; color: var(--text-4); max-width: 160px; text-align: center; line-height: 1.25; }
.wbc-slot.nudge { animation: wbc-shake .4s; }
@keyframes wbc-shake { 0%,100%{margin-left:0;} 20%{margin-left:-7px;} 40%{margin-left:7px;} 60%{margin-left:-4px;} 80%{margin-left:4px;} }

.wbc-foot { text-align: center; margin-top: 22px; }
.wbc-reset { background: none; border: 1px solid var(--border); color: var(--text-3); padding: 8px 16px; border-radius: 10px; font-size: 13px; cursor: pointer; }
.wbc-reset:hover { color: var(--text-2); border-color: var(--text-3); }

/* ---------- lesson view ---------- */
.wbc-lesson { max-width: 780px; margin: 0 auto; padding: 8px 16px 80px; }
.wbc-lesson-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.wbc-lesson-back { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 14px; cursor: pointer; padding: 6px 0; }
.wbc-lesson-kicker { font-size: 12px; font-weight: 700; color: #fff; padding: 6px 12px; border-radius: 10px; background: hsl(var(--hue) 62% 46%); }
.wbc-lesson-title { font-size: 26px; margin: 0 0 8px; color: var(--text); }
.wbc-lesson-goal {
  font-size: 15px; line-height: 1.55; color: var(--text); margin: 0 0 18px;
  padding: 12px 16px; background: hsl(var(--hue) 62% 96%); border-radius: 12px; border-left: 4px solid hsl(var(--hue) 62% 46%);
}
.wbc-eq-panel { display: grid; gap: 10px; margin-bottom: 22px; }
.wbc-eq { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.wbc-setup, .wbc-goalbox { font-size: 14px; line-height: 1.5; padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; }
.wbc-setup { background: var(--bg-2); border: 1px solid var(--border); }
.wbc-goalbox { background: var(--green-bg); color: var(--text); }

.wbc-steps { list-style: none; counter-reset: wbc; padding: 0; margin: 0; display: grid; gap: 14px; }
.wbc-step { position: relative; counter-increment: wbc; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px 16px 56px; }
.wbc-step::before {
  content: counter(wbc); position: absolute; left: 14px; top: 16px; width: 28px; height: 28px; border-radius: 50%;
  background: hsl(var(--hue) 62% 46%); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.wbc-step-prompt { margin: 0 0 8px; font-size: 14.5px; line-height: 1.5; color: var(--text); }
.wbc-step-eq { background: var(--bg-2); border-radius: 8px; padding: 8px 12px; margin: 6px 0; overflow-x: auto; }
.wbc-reveal-btn { background: none; border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.wbc-reveal-btn:hover { border-color: var(--accent); color: var(--accent); }
.wbc-reveal { margin-top: 8px; background: var(--green-bg); border-radius: 8px; padding: 8px 12px; overflow-x: auto; }

.wbc-exercises { margin-top: 26px; }
.wbc-exercises h4 { font-size: 16px; margin: 0 0 12px; }
.wbc-ex-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.wbc-ex-prompt { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.wbc-ex-options { display: grid; gap: 8px; }
.wbc-ex-opt { text-align: left; padding: 10px 14px; border: 2px solid var(--border); background: var(--bg); border-radius: 10px; font-size: 13.5px; cursor: pointer; }
.wbc-ex-opt:hover:not(.answered) { border-color: var(--accent); }
.wbc-ex-opt.correct { border-color: var(--green); background: var(--green-bg); }
.wbc-ex-opt.wrong { border-color: var(--red); background: var(--red-bg); }
.wbc-ex-opt.answered { cursor: default; }
.wbc-ex-explain { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.wbc-ex-hint { font-size: 13px; color: var(--text-2); margin: 0 0 8px; }

.wbc-lesson-footer { margin-top: 32px; text-align: right; }
.wbc-complete { background: var(--green); color: #fff; border: none; font-weight: 800; font-size: 16px; padding: 14px 40px; border-radius: 14px; cursor: pointer; box-shadow: 0 5px 0 #1b5e20; transition: transform .08s ease; }
.wbc-complete:active { transform: translateY(3px); box-shadow: 0 2px 0 #1b5e20; }
.wbc-complete.is-done { background: var(--bg-3); color: var(--green); box-shadow: 0 5px 0 var(--border); }
.wbc-toast { margin-top: 14px; font-weight: 700; color: var(--text-2); }

/* ---------- responsive: rail becomes a horizontal scroller ---------- */
@media (max-width: 760px) {
  .wbc-app { flex-direction: column; gap: 16px; }
  .wbc-rail { position: static; flex: none; width: 100%; flex-direction: row; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
  .wbc-rail-head { display: none; }
  .wbc-track-btn { flex: 0 0 auto; }
  .wbc-track-text small { display: none; }
  .wbc-slot.pos-1 { transform: translateX(54px); }
  .wbc-slot.pos-3 { transform: translateX(-54px); }
  .wbc-node { width: 64px; height: 64px; font-size: 20px; }
  .wbc-tree { --wbc-colw: 116px; }
}

/* ---- concept chips (PaperView-style) + step counts; logos removed ---- */
.wbc-track-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; background: hsl(var(--hue) 62% 48%); }
/* concept chips matching the roadmap/reader .fp-chip: solid, compact, white text */
.wbc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 18px; }
.wbc-chip {
  font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 4px;
  border: 1px solid transparent; color: #fff; background: hsl(var(--hue) 46% 46%);
  white-space: nowrap;
}
.wbc-node-steps { font-size: 10.5px; font-weight: 700; letter-spacing: .2px; color: hsl(var(--hue) 38% 46%); }
.wbc-lesson .wbc-chips { margin-top: 2px; }

/* inline, self-contained background — no outside reading */
.wbc-recall { margin: 0 0 20px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
.wbc-recall-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.wbc-recall-grid { display: grid; gap: 8px; margin-top: 10px; }
.wbc-recall-card { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 8px; }
.wbc-recall-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.wbc-recall-eq { font-size: 13px; overflow-x: auto; }

/* ---- read-and-answer-as-you-go stepper ---- */
.wbc-ref { margin: 0 0 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); overflow: hidden; }
.wbc-ref-sum { cursor: pointer; padding: 12px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); list-style: none; }
.wbc-ref-sum::-webkit-details-marker { display: none; }
.wbc-ref-sum::before { content: "▸ "; }
.wbc-ref[open] .wbc-ref-sum::before { content: "▾ "; }
.wbc-ref-setup { font-size: 14px; line-height: 1.55; color: var(--text); margin: 0 16px 12px; }
.wbc-ref .wbc-recall-card { margin: 0 16px 10px; }

.wbc-stage { border: 1px solid var(--border); border-radius: 16px; padding: 22px 22px 20px; background: var(--bg); min-height: 220px; }
.wbc-prog { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.wbc-prog-label { font-size: 12px; font-weight: 700; color: hsl(var(--hue) 40% 44%); white-space: nowrap; }
.wbc-prog-dots { display: flex; flex-wrap: wrap; gap: 5px; }
.wbc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.wbc-dot.past { background: hsl(var(--hue) 55% 55%); }
.wbc-dot.cur { background: hsl(var(--hue) 62% 44%); box-shadow: 0 0 0 3px hsl(var(--hue) 62% 90%); }

.wbc-stage-prompt { font-size: 17px; line-height: 1.5; font-weight: 600; color: var(--text); margin: 0 0 16px; }
.wbc-stage-attempt { font-size: 13px; color: var(--text-3); font-style: italic; margin-bottom: 14px; }
.wbc-stage-reveal {
  background: hsl(var(--hue) 62% 46%); color: #fff; border: none; font-weight: 700; font-size: 14px;
  padding: 11px 22px; border-radius: 10px; cursor: pointer; box-shadow: 0 4px 0 hsl(var(--hue) 62% 36%); transition: transform .08s ease;
}
.wbc-stage-reveal:active { transform: translateY(3px); box-shadow: 0 1px 0 hsl(var(--hue) 62% 36%); }
.wbc-stage-eq { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 4px 0 12px; overflow-x: auto; }
.wbc-stage-check { background: var(--green-bg); border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; overflow-x: auto; font-size: 14px; }
.wbc-stage-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wbc-stage-prev { background: none; border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: 13px; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.wbc-stage-prev:hover { border-color: var(--text-3); }
.wbc-stage-next {
  background: hsl(var(--hue) 62% 46%); color: #fff; border: none; font-weight: 700; font-size: 14px;
  padding: 11px 24px; border-radius: 10px; cursor: pointer; box-shadow: 0 4px 0 hsl(var(--hue) 62% 36%); transition: transform .08s ease; margin-left: auto;
}
.wbc-stage-next:active { transform: translateY(3px); box-shadow: 0 1px 0 hsl(var(--hue) 62% 36%); }

/* ===== v3: concept-chip rail, calmer lesson top, on-page explanations ===== */
.wbc-rail { gap: 5px; }
.wbc-trackchip {
  position: relative; overflow: hidden;
  display: flex; align-items: stretch; gap: 9px; width: 100%;
  white-space: normal; text-align: left; padding: 9px 12px 11px; border-radius: 8px;
  background: hsl(var(--hue) 44% 47%); color: #fff; border: 1px solid transparent;
  font-size: 12.5px; line-height: 1.25; cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
/* a slim accent rail on the left of each chip */
.wbc-trackchip .fp-bar {
  flex: 0 0 3px; align-self: stretch; height: auto; width: 3px; border-radius: 3px;
  background: rgba(255,255,255,.5);
}
.wbc-tc-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.wbc-tc-label { font-weight: 600; }
.wbc-tc-meta { font-size: 10px; opacity: .8; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
/* thin completion bar hugging the bottom edge */
.wbc-tc-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0,0,0,.18); }
.wbc-tc-prog-fill { display: block; height: 100%; background: rgba(255,255,255,.92); transition: width .3s ease; }
/* resting chips sit back a touch so the active one reads as selected */
.wbc-trackchip:not(.active) { filter: saturate(.9) brightness(.96); opacity: .92; }
.wbc-trackchip:hover { filter: brightness(1.05); opacity: 1; }
.wbc-trackchip.active {
  filter: none; opacity: 1; font-weight: 600; transform: translateX(2px);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--c, #555) 45%, transparent),
              inset 0 0 0 1.5px rgba(255,255,255,.85);
}
.wbc-trackchip.active .fp-bar { background: #fff; }

/* calmer lesson top: goal becomes plain prose, no box */
.wbc-lesson-goal { background: none !important; border: none !important; padding: 0 !important; color: var(--text-2) !important; font-size: 15px !important; line-height: 1.55 !important; margin: 0 0 18px !important; }

/* on-page explanation so you can derive without leaving */
.wbc-stage-prompt { font-weight: 700; }
.wbc-stage-explain { font-size: 14.5px; line-height: 1.62; color: var(--text); margin: 0 0 16px; }

/* ===== v4: exact PaperView palette, header on RHS, navigable locked nodes ===== */
/* header: brand left, title pushed right */
.wbc-hero-top { display: flex; align-items: baseline; gap: 10px; }
.wbc-hero-title { margin-left: auto; font-size: 18px; font-weight: 700; color: var(--text); }

/* LHS chips use the canonical subfield colors (taxonomy ROOT_COLORS) */
.wbc-trackchip { background: var(--c, hsl(var(--hue) 44% 47%)); }

/* coordinate the main surfaces to the exact track color */
.wbc-banner { background: var(--c, hsl(var(--hue) 62% 46%)); box-shadow: 0 4px 0 color-mix(in srgb, var(--c, #555) 72%, #000); }
.wbc-lesson-kicker { background: var(--c, hsl(var(--hue) 62% 46%)); }
.wbc-lesson-goal { /* stays plain prose */ }

/* locked nodes are now navigable (review-friendly), just visually muted */
.wbc-node.locked { cursor: pointer; }
.wbc-node.locked:active { transform: translateY(4px); }
.wbc-node.locked:hover { box-shadow: inset 0 0 0 1.5px var(--text-3); }

/* ===== v5: align body left edge with the header (kill the extra indent) ===== */
.wbc-app { max-width: none; padding-left: 0; padding-right: 0; }
.wbc-lesson { margin: 0; max-width: none; padding-left: 0; padding-right: 0; }

.workbook-content.wbc-page { max-width: 1040px; }

/* ===== v6: branching tree layout, brighter start node, figures ===== */
.wbc-tree { --wbc-colw: 172px; position: relative; display: flex; flex-direction: column; gap: 46px; padding: 22px 0 8px; }
.wbc-tree-row { position: relative; z-index: 1; display: grid; justify-content: center; align-items: start; row-gap: 40px; }
.wbc-tree .wbc-slot { margin-bottom: 0; }
.wbc-tree-edges { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: visible; }
.wbc-edge { fill: none; stroke: var(--border); stroke-width: 2.5; stroke-dasharray: 5 6; }

/* start (open) node = a brighter variant of the track colour, not generic green */
/* open = same colour as the rest; distinguished only by an outline ring */
.wbc-node.open {
  background: var(--c, #2e7d32);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c, #1b5e20) 62%, #000);
  outline: 3px solid color-mix(in srgb, var(--c, #2e7d32) 50%, #fff);
  outline-offset: 3px;
}
.wbc-node.open:active { box-shadow: 0 2px 0 color-mix(in srgb, var(--c,#1b5e20) 62%, #000); }
.wbc-node.done { background: var(--c, hsl(var(--hue) 62% 46%)); box-shadow: 0 6px 0 color-mix(in srgb, var(--c,#555) 70%, #000); }
.wbc-node.done:active { box-shadow: 0 2px 0 color-mix(in srgb, var(--c,#555) 70%, #000); }

/* figures in a lesson step */
.wbc-stage-figure { margin: 6px 0 14px; padding: 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; text-align: center; }
.wbc-stage-figure svg { max-width: 100%; height: auto; }

/* result reveal button (answer hidden until clicked) */
.wbc-stage-reveal { background: none; border: 1px dashed var(--border); color: var(--text-2); font-weight: 600; font-size: 13px; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.wbc-stage-reveal:hover { border-color: var(--c, var(--accent)); color: var(--c, var(--accent)); }

/* v7 fix: tree must span the panel so connector geometry is correct */
.wbc-tree { width: 100%; }
.wbc-tree-row { width: 100%; }

/* ===== v8: full scrollable sheet (textbook with fill-in reveals) ===== */
.wbc-sheet { list-style: none; counter-reset: wbsheet; padding: 0; margin: 8px 0 0; display: grid; gap: 0; }
.wbc-sheet-step {
  position: relative; counter-increment: wbsheet;
  padding: 18px 4px 18px 52px; border-top: 1px solid var(--border-subtle);
}
.wbc-sheet-step:first-child { border-top: none; }
.wbc-sheet-step::before {
  content: counter(wbsheet); position: absolute; left: 6px; top: 18px;
  width: 30px; height: 30px; border-radius: 50%;
  background: color-mix(in srgb, var(--c, #555) 14%, #fff);
  color: var(--c, var(--text-2)); border: 1.5px solid color-mix(in srgb, var(--c,#555) 35%, #fff);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.wbc-sheet-prompt { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.45; }
.wbc-sheet-explain { margin: 0 0 12px; font-size: 15px; line-height: 1.65; color: var(--text); }
.wbc-sheet-step .wbc-stage-eq { margin: 4px 0 0; }
.wbc-sheet-step .wbc-stage-reveal { margin-top: 2px; }
.wbc-lesson-footer { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); text-align: right; }

.wbc-node-extra { font-size: 10px; color: var(--text-3); max-width: 150px; text-align: center; line-height: 1.25; font-style: italic; }

/* v15: lock the track banner so only the tree scrolls (rail is already sticky) */
.wbc-banner { position: sticky; top: 12px; z-index: 5; }

/* ===== v16: only the tree scrolls — header/rail/banner are static, no sticky travel ===== */
.wbc-app { align-items: stretch; overflow: hidden; box-sizing: border-box; padding-bottom: 12px; }
.workbook-content.wbc-page { padding-bottom: 0; }
.wbc-rail { position: static; top: auto; overflow-y: auto; }
.wbc-main { display: flex; flex-direction: column; min-height: 0; }
.wbc-banner { position: static; top: auto; }
.wbc-tree { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* ===== v18: breathing room above the first node + hidden tree scrollbar ===== */
.wbc-tree { padding-top: 40px; scrollbar-width: none; -ms-overflow-style: none; }
.wbc-tree::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ===== v20: wide trees scroll instead of clipping; nothing is cut off ===== */
.wbc-tree { overflow-x: auto; padding-left: 8px; padding-right: 8px; }
/* fits → centered; overflows → packs to the start so the left edge stays reachable
   (and the rest scrolls), while every row keeps the same column grid. */
.wbc-tree-row { justify-content: safe center; }

/* ===== v20: node-by-node "unmark" mode (after Reset progress) ===== */
.wbc-slot.unmarkable .wbc-node { cursor: pointer; position: relative; }
.wbc-slot.unmarkable .wbc-node::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none;
  border: 2px dashed color-mix(in srgb, var(--c, #d4584e) 70%, #fff);
  animation: wbc-unmark-pulse 1.6s ease-in-out infinite;
}
@keyframes wbc-unmark-pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
.wbc-foot { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.wbc-foot-hint { font-size: 13px; color: var(--text-2); font-weight: 600; }
.wbc-reset:disabled { opacity: .4; cursor: default; }
.wbc-reset-done { background: var(--c, #555); color: #fff; border-color: transparent; }

/* ===== v21: compact labelled module bands for large tracks ===== */
.wbc-tree-section { position: relative; }
.wbc-tree-section + .wbc-tree-section { margin-top: 22px; }
.wbc-module-head {
  text-align: center; margin: 0 0 8px; padding: 0;
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c, #555) 70%, var(--text-3));
}
.wbc-module-head::after {
  content: ""; display: block; width: 26px; height: 1.5px; margin: 5px auto 0;
  border-radius: 2px; background: color-mix(in srgb, var(--c, #555) 45%, transparent);
}

/* ===== v24: widen the workbook so module bands fit without horizontal scroll ===== */
/* keep header brand and the tree panel aligned by sharing one max-width */
.workbook-hero,
.workbook-content.wbc-page { max-width: min(1340px, 96vw); }
/* bands now fit the wider panel; no horizontal scroll/clip needed */
.wbc-tree { overflow-x: hidden; }

/* ===== v25: brighter rail w/ header-style shadow, calmer clicks, roomier subheaders ===== */
/* left rail: full-brightness chips with the same chunky offset shadow as the header */
.wbc-rail { gap: 8px; }
.wbc-trackchip {
  box-shadow: 0 3px 0 color-mix(in srgb, var(--c, #555) 70%, #000);
}
.wbc-trackchip:not(.active) { filter: none; opacity: 1; }
.wbc-trackchip:hover { filter: brightness(1.06); opacity: 1; }
.wbc-trackchip.active {
  filter: brightness(1.05); transform: translateX(2px);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--c, #555) 70%, #000),
              inset 0 0 0 1.5px rgba(255,255,255,.92);
}
.wbc-tc-meta.is-complete { opacity: 1; font-weight: 700; }

/* more breathing room between a module subheader and its nodes */
.wbc-module-head { margin: 0 0 18px; }

/* calmer click: smaller press travel; the current node stays put (just its outline) */
.wbc-node:active, .wbc-node.locked:active { transform: translateY(2px); }
.wbc-node.open { animation: none; }
.wbc-node.open:active { box-shadow: 0 4px 0 color-mix(in srgb, var(--c, #1b5e20) 62%, #000); }
.wbc-node.done:active { box-shadow: 0 4px 0 color-mix(in srgb, var(--c, #555) 70%, #000); }

/* ===== v26: rail fits without a scrollbar (compact chips + hidden scrollbar) ===== */
.wbc-rail { gap: 6px; scrollbar-width: none; -ms-overflow-style: none; }
.wbc-rail::-webkit-scrollbar { width: 0; height: 0; display: none; }
.wbc-trackchip { padding: 7px 11px 8px; }
.wbc-tc-label { line-height: 1.2; }
.wbc-tc-body { gap: 1px; }

/* ===== v27: rail never clipped — only the tree is height-bound (set inline by JS) ===== */

/* ===== v28: workbook lesson sheet — no slideshow, actual work surface ===== */
.wbc-workbook-cover {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px;
  align-items: end; padding: 0 0 18px; margin: 0 0 20px;
  border-bottom: 2px solid color-mix(in srgb, var(--c, #555) 22%, var(--border));
}
.wbc-cover-label {
  display: inline-flex; align-items: center; margin: 0 0 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c, #555) 72%, var(--text-3));
}
.wbc-cover-stats {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  font-size: 11px; font-weight: 700; color: var(--text-2);
}
.wbc-cover-stats span {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-2); text-transform: uppercase; letter-spacing: .06em;
}

.wbc-workbook {
  display: grid; grid-template-columns: minmax(250px, 350px) minmax(0, 1fr);
  gap: 28px; align-items: start;
}
.wbc-workbook-notes {
  position: sticky; top: 14px; display: grid; gap: 14px;
  max-height: calc(100vh - 28px); overflow: auto; padding-right: 4px;
  scrollbar-width: thin;
}
.wbc-note-section {
  padding: 0 0 12px; border-bottom: 1px solid var(--border);
}
.wbc-note-section:last-child { border-bottom: none; }
.wbc-note-section h3 {
  margin: 0 0 10px; font-size: 11px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c, #555) 68%, var(--text-3));
}
.wbc-note-section p {
  margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text);
}
.wbc-note-mini {
  padding: 8px 0; border-top: 1px solid var(--border-subtle);
}
.wbc-note-mini:first-of-type { border-top: none; padding-top: 0; }
.wbc-note-card {
  padding: 8px 0; border-top: 1px solid var(--border-subtle);
}
.wbc-note-card:first-of-type { border-top: none; padding-top: 0; }
.wbc-note-card strong {
  display: block; margin: 0 0 6px; font-size: 12.5px; color: var(--text);
}
.wbc-note-eq {
  font-size: 12px; line-height: 1.45; overflow-x: auto;
  padding: 8px 10px; border: 1px solid var(--border-subtle);
  border-radius: 6px; background: var(--bg-2);
}
.wbc-note-eq mjx-container {
  font-size: 92% !important;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.wbc-workbook-main { min-width: 0; }
.wbc-primer {
  margin: 0 0 16px; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-2);
}
.wbc-primer h3 {
  margin: 0 0 12px; font-size: 11px; font-weight: 900; letter-spacing: .16em;
  text-transform: uppercase; color: color-mix(in srgb, var(--c, #555) 72%, var(--text-3));
}
.wbc-primer-block {
  display: grid; gap: 5px; padding: 11px 0; border-top: 1px solid var(--border-subtle);
}
.wbc-primer-block:first-of-type { border-top: none; padding-top: 0; }
.wbc-primer-block:last-child { padding-bottom: 0; }
.wbc-primer h4 {
  margin: 0; font-size: 14px; line-height: 1.35; color: var(--text); font-weight: 850;
}
.wbc-primer p {
  margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-2);
  text-align: justify; text-justify: inter-word;
}
.wbc-primer-eq {
  padding: 8px 10px; border: 1px solid var(--border-subtle); border-radius: 6px;
  background: var(--bg); overflow-x: auto; font-size: 13px;
}
.wbc-workbook-progress {
  position: sticky; top: 0; z-index: 3; display: grid; gap: 7px;
  padding: 10px 0 12px; margin: -2px 0 8px; background: var(--bg);
}
.wbc-workbook-progress > span:first-child {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3);
}
.wbc-progress-rail {
  display: block; height: 7px; border-radius: 999px; background: var(--bg-2);
  border: 1px solid var(--border); overflow: hidden;
}
.wbc-progress-fill {
  display: block; width: 0%; height: 100%;
  background: var(--c, hsl(var(--hue) 62% 46%)); transition: width .18s ease;
}

.wbc-workbook-sheet {
  list-style: none; counter-reset: workbook-line; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.wbc-workbook-line {
  position: relative; counter-increment: workbook-line;
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 16px;
  padding: 13px 0 15px; border-top: 1px solid var(--border);
}
.wbc-workbook-line:first-child { border-top: none; }
.wbc-article-chunk {
  grid-column: 1 / -1; display: grid; gap: 9px; margin: 0 0 12px;
  max-width: 92ch;
}
.wbc-article-chunk .wbc-line-prompt,
.wbc-article-chunk .wbc-line-explain,
.wbc-article-chunk .wbc-section-body,
.wbc-article-chunk .wbc-stage-figure {
  grid-column: auto;
}
.wbc-article-chunk .wbc-line-prompt {
  margin-bottom: 0; font-size: 18px; line-height: 1.3;
}
.wbc-workbook-line.is-checked .wbc-line-number {
  background: var(--c, hsl(var(--hue) 62% 46%)); color: #fff;
  border-color: transparent;
}
.wbc-line-head { grid-column: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wbc-line-number {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid color-mix(in srgb, var(--c, #555) 38%, var(--border));
  background: color-mix(in srgb, var(--c, #555) 8%, var(--bg));
  color: var(--c, hsl(var(--hue) 62% 46%));
  font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums;
}
.wbc-line-count { font-size: 10.5px; font-weight: 700; color: var(--text-4); text-transform: uppercase; letter-spacing: .06em; }
.wbc-line-prompt {
  grid-column: 2; margin: 0 0 6px; font-size: 16px; line-height: 1.32;
  color: var(--text); font-weight: 800;
}
.wbc-line-explain {
  grid-column: 2; margin: 0 0 10px; font-size: 14.5px; line-height: 1.5;
  color: var(--text);
}
.wbc-section-body {
  grid-column: 2; display: grid; gap: 9px; margin: 0 0 10px;
  max-width: 86ch;
}
.wbc-section-body p {
  margin: 0; font-size: 15.5px; line-height: 1.62; color: var(--text);
  text-align: justify; text-justify: inter-word;
}
.wbc-section-eq {
  margin: 3px 0; padding: 10px 12px; border: 1px solid var(--border-subtle);
  border-radius: 7px; background: var(--bg-2); overflow-x: auto; font-size: 14px;
  text-align: center;
}
.wbc-work-area {
  grid-column: 2; display: grid; gap: 6px; margin: 8px 0 8px;
  max-width: 86ch;
}
.wbc-work-label-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wbc-work-label {
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3);
}
.wbc-work-prompt {
  margin: 0 0 1px; color: var(--text-2); font-size: 13.5px; line-height: 1.45;
}
.wbc-work-save {
  min-height: 1em; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-4);
}
.wbc-work-input {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 58px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 7px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 22px, color-mix(in srgb, var(--border) 70%, transparent) 22px 23px),
    var(--bg);
  color: var(--text); font: inherit; line-height: 1.45;
}
.wbc-work-input:focus {
  outline: 2px solid color-mix(in srgb, var(--c, #555) 36%, transparent);
  border-color: color-mix(in srgb, var(--c, #555) 55%, var(--border));
}

.wbc-line-result {
  grid-column: 2; margin: 3px 0 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-2); overflow: hidden;
}
.wbc-line-result summary {
  cursor: pointer; padding: 8px 11px; list-style: none;
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c, #555) 70%, var(--text-2));
}
.wbc-line-result summary::-webkit-details-marker { display: none; }
.wbc-line-result summary::before { content: "+ "; font-weight: 900; }
.wbc-line-result[open] summary::before { content: "- "; }
.wbc-result-substeps {
  margin: 0; padding: 10px 14px 10px 32px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--text); font-size: 13.5px; line-height: 1.5;
}
.wbc-result-substeps li { margin: 5px 0; padding-left: 2px; }
.wbc-result-substeps mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.wbc-result-eq,
.wbc-result-check {
  padding: 10px 12px; border-top: 1px solid var(--border-subtle);
  overflow-x: auto; font-size: 14px; line-height: 1.5;
}
.wbc-result-check { background: color-mix(in srgb, var(--green-bg) 64%, var(--bg)); }

.wbc-line-done {
  grid-column: 2; justify-self: end; display: inline-flex; align-items: center; gap: 8px;
  width: fit-content; font-size: 12.5px; font-weight: 700; color: var(--text-2);
  cursor: pointer; user-select: none;
}
.wbc-line-done input { accent-color: var(--c, hsl(var(--hue) 62% 46%)); }

.wbc-synthesis {
  margin: 26px 0 0; padding: 18px 0 0; border-top: 2px solid var(--border);
  display: grid; gap: 12px;
}
.wbc-synthesis h3 {
  margin: 0; font-size: 15px; font-weight: 900; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text);
}
.wbc-quiz { display: grid; gap: 12px; width: 100%; max-width: 86ch; }
.wbc-quiz-top {
  display: grid; grid-template-columns: auto minmax(120px, 1fr); gap: 12px;
  align-items: center; color: var(--text-3); font-size: 12px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.wbc-quiz-rail {
  height: 4px; border-radius: 99px; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--border-subtle);
}
.wbc-quiz-fill {
  display: block; width: 0%; height: 100%;
  background: var(--c, hsl(var(--hue) 62% 46%));
  transition: width .25s ease;
}
.wbc-quiz-card {
  box-sizing: border-box;
  padding: 20px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-2); animation: fade-up .25s ease;
}
.wbc-quiz-category {
  margin: 0 0 8px; font-size: 10px; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: color-mix(in srgb, var(--c, #555) 70%, var(--text-3));
}
.wbc-quiz-card h4 {
  margin: 0 0 14px; color: var(--text); font-size: 17px;
  line-height: 1.45; font-weight: 800;
}
.wbc-quiz-options { display: grid; gap: 10px; }
.wbc-quiz-option {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.5; text-align: left;
  cursor: pointer; transition: border-color .15s, background .15s, transform .12s, opacity .15s;
}
.wbc-quiz-option:hover:not(:disabled) {
  border-color: var(--c, hsl(var(--hue) 62% 46%));
  background: color-mix(in srgb, var(--c, #555) 8%, var(--bg));
  transform: translateY(-1px);
}
.wbc-quiz-option.is-revealed { cursor: default; opacity: .66; }
.wbc-quiz-option.is-correct {
  opacity: 1; border-color: var(--green); background: var(--green-bg);
  color: color-mix(in srgb, var(--green) 74%, var(--text)); font-weight: 700;
}
.wbc-quiz-option.is-picked-wrong {
  opacity: 1; border-color: var(--red); background: var(--red-bg);
  color: color-mix(in srgb, var(--red) 74%, var(--text)); font-weight: 700;
}
.wbc-quiz-explanation {
  margin: 14px 0 0; padding: 13px 15px; background: var(--bg);
  border: 1px solid var(--border-subtle); border-radius: 8px;
  color: var(--text); font-size: 13px; line-height: 1.6; animation: fade-up .2s ease;
}
.wbc-quiz-explanation.is-correct {
  background: #eef8f0;
  border-color: #b8ddbf;
  color: #1f6f35;
}
.wbc-quiz-explanation.is-wrong {
  background: #fff0f0;
  border-color: #efb9b9;
  color: #9f1f1f;
}
.wbc-quiz-next {
  margin-top: 14px; width: 100%; min-height: 46px; border: 1px solid var(--c, hsl(var(--hue) 62% 46%));
  border-radius: 8px; background: var(--c, hsl(var(--hue) 62% 46%));
  color: #fff; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.wbc-quiz-next:active { transform: scale(.99); }
.wbc-quiz-complete p {
  margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.6;
}
.wbc-frontier-note {
  margin: 2px 0 0; padding: 10px 12px; border-left: 3px solid var(--c, hsl(var(--hue) 62% 46%));
  background: var(--bg-2); color: var(--text-2); font-size: 13px; line-height: 1.5;
}

@media (max-width: 900px) {
  .wbc-workbook-cover { grid-template-columns: 1fr; align-items: start; }
  .wbc-cover-stats { justify-content: flex-start; }
  .wbc-workbook { grid-template-columns: 1fr; }
  .wbc-workbook-notes { position: static; max-height: none; overflow: visible; padding-right: 0; }
}

@media (max-width: 640px) {
  .wbc-workbook-line { grid-template-columns: 46px minmax(0, 1fr); gap: 0 10px; }
  .wbc-line-number { width: 34px; height: 34px; font-size: 12px; }
  .wbc-line-count { display: none; }
  .wbc-line-prompt { font-size: 15.5px; }
  .wbc-line-explain { font-size: 14px; }
  .wbc-workbook-progress { position: static; }
}
.wbc-app { height: auto !important; overflow: visible; align-items: flex-start; }
.wbc-rail { overflow-y: visible; align-self: flex-start; }

/* v45: let long route labels breathe; the map can scroll instead of compressing */
.wbc-tree {
  gap: 84px;
  padding-bottom: 96px;
}
.wbc-tree-row {
  row-gap: 92px;
}
.wbc-tree .wbc-slot {
  gap: 9px;
  min-height: 154px;
}

/* v47: normal browser zoom should feel like the calmer 90% view */
.wbc-app {
  max-width: min(1280px, 92vw);
  gap: 24px;
}
.wbc-rail {
  flex-basis: 224px;
}
.wbc-trackchip {
  padding: 6px 10px 7px;
  border-radius: 10px;
}
.wbc-tc-label {
  font-size: 12.5px;
}
.wbc-tc-meta {
  font-size: 9.5px;
}
.wbc-banner {
  gap: 12px;
  padding: 13px 16px;
  border-radius: 12px;
}
.wbc-banner-symbol {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 15px;
}
.wbc-banner-text h2 {
  font-size: 17px;
}
.wbc-banner-text p,
.wbc-banner-count {
  font-size: 12.5px;
}
.wbc-banner-count {
  padding: 5px 10px;
  border-radius: 8px;
}
.wbc-tree {
  --wbc-colw: 172px;
  gap: 84px;
  padding-top: 58px;
  padding-bottom: 96px;
}
.wbc-tree-row {
  row-gap: 92px;
}
.wbc-tree .wbc-slot {
  gap: 9px;
  min-height: 154px;
}
.wbc-node {
  width: 72px;
  height: 72px;
  font-size: 23px;
}
.wbc-node-label {
  max-width: 160px;
  font-size: 12px;
  line-height: 1.3;
}
.wbc-node-steps,
.wbc-node-need,
.wbc-node-extra {
  font-size: 10.5px;
}

/* v48: keep the workbook header/body margins aligned with a little more inset */
.workbook-hero,
.workbook-content.wbc-page {
  max-width: min(1280px, 92vw);
}
