/* Classroom: a full-screen lesson canvas with floating controls; slides, code and graphs as cards on it. */

.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.chip svg { width: 14px; height: 14px; color: var(--muted); }
.not-ready { max-width: 560px; margin: 40px auto; }

ol.outline { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.outline button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 999px; background: none; text-align: left; cursor: pointer; color: var(--text-2); }
.outline button:hover { background: var(--surface-2); }
.o-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); }
.o-title { flex: 1; min-width: 0; font-size: 13px; }
.outline li.done .o-num { background: var(--success-soft); color: var(--success); border-color: transparent; }
.outline li.current button { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.outline li.current .o-num { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.outline li.o-sub button { padding-left: 28px; font-size: 12.5px; }
.outline li.o-sub .o-num { min-width: 26px; width: auto; padding: 0 4px; font-size: 10.5px; border-radius: 999px; }
.outline button:disabled { opacity: .45; cursor: not-allowed; }

.chat { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; font-size: 13px; }
.chat-empty svg { width: 22px; height: 22px; }
.chat-empty p { margin: 0; }
.checkpoint { display: flex; flex-direction: column; gap: 8px; }
.ck-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.ck-head svg { width: 15px; height: 15px; color: var(--violet); }
.ck-head small { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-status { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.ck-status.live { background: var(--danger-soft); color: var(--danger); }
.ck-status.done { background: var(--surface-3); color: var(--muted); }
.ck-thread { display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; flex-direction: column; max-width: 92%; }
.msg .bubble { padding: 8px 11px; border-radius: 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg.teacher { align-self: flex-start; }
.msg.teacher .bubble { background: var(--surface-2); border-top-left-radius: 4px; }
.msg.teacher.prompt .bubble { background: var(--violet-soft); color: var(--text); }
.msg.student { align-self: flex-end; }
.msg.student .bubble { background: var(--primary); color: var(--on-primary); border-top-right-radius: 4px; }
.msg.system { align-self: center; }
.msg.system .bubble { background: var(--warning-soft); color: var(--warning); font-size: 12px; }
.msg-tag { align-self: flex-start; margin-top: 4px; font-size: 11px; font-weight: 600; color: var(--warning); }
.msg.typing { flex-direction: row; gap: 4px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; align-self: flex-start; }
.msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s; } .msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.wait-timer { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--primary); font-weight: 500; }
.wait-bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.wait-bar i { display: block; height: 100%; width: 100%; background: var(--primary); transition: width .1s linear; }
.wait-timer.holding { color: var(--success); }
.wait-timer.holding .wait-bar i { background: var(--success); }
/* stage */
.env-indicator { --i: 0; --pill-w: 96px; position: relative; display: inline-grid; grid-template-columns: repeat(4, var(--pill-w)); padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); user-select: none; }
.env-glider { position: absolute; top: 3px; bottom: 3px; left: 3px; width: var(--pill-w); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-sm); transform: translateX(calc(var(--i) * var(--pill-w))); transition: transform .35s cubic-bezier(.3, .8, .3, 1); }
.env-pill { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; font-size: 12.5px; font-weight: 500; color: var(--muted); transition: color .2s; cursor: default; }
.env-pill svg { width: 15px; height: 15px; }
.env-pill.active { color: var(--text); }
.stage-body { position: relative; flex: 1; min-height: 0; }
.stage-envs { position: absolute; inset: 0; }
.env { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.env.active { opacity: 1; visibility: visible; }

/* visual: interactive pictures in sandboxed frames */
.env-visual { background: radial-gradient(circle at 50% 0, var(--surface-2), var(--surface-3)); padding: 18px; display: flex; }
.vz-win { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fbfaf7; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.vz-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #e2ded4; background: #fff; color: #1b1c21; font-size: 13px; font-weight: 600; min-height: 38px; }
.vz-head svg { width: 15px; height: 15px; color: var(--violet); flex: none; }
.vz-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vz-tabs { margin-left: auto; display: flex; gap: 4px; overflow: hidden; }
.vz-tab { font-size: 11.5px; font-weight: 500; color: #74757e; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.vz-tab.active { background: var(--primary-soft); color: var(--primary); }
.vz-body { position: relative; flex: 1; min-height: 0; }
.vz-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fbfaf7; }
.vz-frame.off { visibility: hidden; pointer-events: none; }
.vz-frame.enter { animation: vz-enter .45s ease-out; }
@keyframes vz-enter { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.vz-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: #74757e; font-size: 13px; }
.vz-empty svg { width: 26px; height: 26px; opacity: .6; }

/* flow diagrams on the Visual board, drawn block by block like a whiteboard */
.flow-wrap { position: absolute; inset: 0; overflow: auto; padding: 8px 12px 16px; background: #fbfaf7; }
.flow-svg { width: 100%; height: auto; max-height: none; display: block; color: #1b1c21; stroke: none; stroke-width: 0; }
.flow-shape { fill: var(--pill); stroke: var(--primary); stroke-width: 3; }
.flow-block.question .flow-shape { fill: #fff7e6; stroke: #b96a12; }
.flow-block.end .flow-shape { fill: #eef6f1; stroke: #17885d; }
/* The app's icon rules stroke SVG in the theme colour, and dark mode makes text light: pin the board's own ink. */
.flow-text { font-family: var(--hand); font-size: 20px; fill: #1b1c21; -webkit-text-fill-color: #1b1c21; stroke: none; }
.flow-line { fill: none; stroke: var(--text-2); stroke-width: 2.5; }
.flow-arrowhead { fill: var(--text-2); }
.flow-branch { font-family: var(--hand); font-size: 17px; font-weight: 700; fill: #b96a12; -webkit-text-fill-color: #b96a12; stroke: none; }
.flow-block.enter { animation: flow-in .55s ease-out; }
.flow-block.enter .flow-shape { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: flow-draw .7s ease-out forwards; }
.flow-edge.enter .flow-line { stroke-dasharray: 900; stroke-dashoffset: 900; animation: flow-draw .6s .25s ease-out forwards; }
.flow-edge.enter .flow-branch { opacity: 0; animation: flow-fade .3s .6s forwards; }
.flow-block.hl .flow-shape { fill: #fff3b0; stroke-width: 4; }
@keyframes flow-draw { to { stroke-dashoffset: 0; } }
@keyframes flow-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes flow-fade { to { opacity: 1; } }

/* slides */
.env-slides { background: radial-gradient(circle at 50% 0, var(--surface-2), var(--surface-3)); display: grid; place-items: center; padding: 28px; }
.slide-frame { --ratio: 16 / 9; position: relative; width: min(100%, calc((100vh - 220px) * var(--ratio))); aspect-ratio: var(--ratio); container-type: size; }
/* Sizes follow the slide (cq units), not the window, so a slide in a narrow panel keeps its proportions.
   --fit (set by Stage.fitSlide) shrinks the text further when a slide still has too much on it. */
.slide { --fit: 1; position: absolute; inset: 0; background: #fff; color: #1b1c21; border-radius: 10px; box-shadow: 0 10px 40px rgba(20, 20, 40, .18); padding: 5.5cqh 6.5cqw; overflow: hidden; display: flex; flex-direction: column; }
.slide::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: linear-gradient(var(--primary), var(--violet)); }
.slide.enter { animation: slide-in .45s ease; }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }
.slide-title { flex: none; font-size: calc(clamp(15px, 4.2cqw, 40px) * var(--fit)); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; margin: 0 0 3.5cqh; color: #14181f; }
.slide-points { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: .5em; font-size: calc(clamp(11px, 2.3cqw, 22px) * var(--fit)); line-height: 1.35; color: #343844; min-height: 0; }
.slide > .slide-points { flex: 1; overflow: hidden; }
.slide-points li::marker { color: var(--primary); }
/* the real pictures from the slide, beside its points; the body only ever uses the space under the title */
.slide-body.with-pictures { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: minmax(0, 1fr); gap: 4cqw; }
.slide-body.with-pictures .slide-points { align-self: center; max-height: 100%; overflow: hidden; }
.slide-body.only-pictures { grid-template-columns: 1fr; }
.slide-pictures { min-height: 0; height: 100%; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; }
.slide-pictures img { max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; border-radius: 6px; flex: 1 1 0; }
.slide-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; color: #8b8d96; }
.slide-empty svg { width: 28px; height: 28px; }
/* The real slide as a picture; highlights sit over its printed lines */
.slide.as-image { padding: 0; }
.slide.as-image::before { display: none; }
.slide-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slide-mark { position: absolute; z-index: 1; border-radius: 4px; pointer-events: none;  /* see-through: readable on light and dark boxes */
  background: linear-gradient(rgba(255, 214, 10, .42), rgba(255, 214, 10, .42)) no-repeat 0 0 / 0 100%;
  animation: marker .6s ease forwards; }
.slide-num { position: absolute; right: 14px; bottom: 10px; font-size: 12px; color: #8b8d96; font-variant-numeric: tabular-nums; }

/* code */
.env-code { display: grid; grid-template-rows: minmax(0, 1fr) minmax(140px, 36%); background: #0f1116; }
.editor-win { display: flex; flex-direction: column; min-height: 0; }
.ed-chrome { display: none; }
.ed-tabs { display: flex; background: #161920; border-bottom: 1px solid #22252e; overflow-x: auto; min-height: 38px; }
.ed-tab { display: inline-flex; align-items: center; gap: 7px; padding: 0 16px; font: 500 12.5px var(--mono); color: #7d8394; border-right: 1px solid #22252e; white-space: nowrap; }
.ed-tab svg { width: 14px; height: 14px; color: #e8b84a; }
.ed-tab.active { background: #0f1116; color: #e4e6ec; box-shadow: inset 0 2px 0 var(--primary); }
.ed-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 0; }
.ed-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #5a6070; font-size: 13px; }
.ed-empty svg { width: 26px; height: 26px; }
.ed-code { font: 15px/1.75 var(--mono); color: #e4e6ec; }
.ed-line { display: flex; padding-right: 20px; transition: background .25s; border-left: 3px solid transparent; }
.ed-no { width: 52px; flex: none; text-align: right; padding-right: 18px; color: #4b5162; user-select: none; }
.ed-src { white-space: pre; }
.ed-line.typing .ed-src::after { content: ""; display: inline-block; width: 2px; height: 1.1em; background: #e4e6ec; vertical-align: -2px; margin-left: 1px; }
.ed-line.hl { background: rgba(255, 214, 64, .16); border-left-color: #ffd640; }
.ed-line.hl .ed-no { color: #ffd640; }
.terminal { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid #262a34; background: #0b0d11; }
.terminal.flash { animation: term-flash 1.1s ease; }
@keyframes term-flash { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 25%, 60% { box-shadow: inset 0 0 0 2px var(--primary); } }
.term-head { display: flex; align-items: center; gap: 7px; padding: 6px 14px; font: 600 11px var(--font); text-transform: uppercase; letter-spacing: .06em; color: #7d8394; border-bottom: 1px solid #1c1f27; }
.term-head svg { width: 14px; height: 14px; }
.term-cwd { margin-left: auto; text-transform: none; letter-spacing: 0; font: 11.5px var(--mono); color: #525868; }
.term-body { flex: 1; overflow-y: auto; padding: 10px 14px; font: 13.5px/1.6 var(--mono); color: #d0d4dc; }
.term-cmd { color: #e4e6ec; margin-top: 6px; }
.term-cmd:first-child { margin-top: 0; }
.term-prompt { color: #3ec48d; margin-right: 4px; }
.term-out { white-space: pre-wrap; color: #b9bfcb; }
.term-out.bad { color: #ff8a8a; }
.term-out .spinner { width: 12px; height: 12px; color: #7d8394; margin: 4px 0; }
.term-class { color: #f0a54a; white-space: pre-wrap; }

/* overlays */
.stage-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(6px); }
.splash { width: min(520px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); animation: toast-in .25s ease; }
.splash h2 { font-size: 22px; font-weight: 700; }
.splash p { margin: 0; }
.splash-badge { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 6px; background: linear-gradient(135deg, var(--primary), var(--violet)); color: #fff; }
.splash-badge svg { width: 26px; height: 26px; }
.splash-badge.ok { background: var(--success); }
.splash-badge.muted-badge { background: var(--surface-3); color: var(--text-2); }
.sp-grid, .sum-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; }
.sp-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; text-align: left; }
.sp-item svg { width: 16px; height: 16px; color: var(--primary); }
.sp-item span { flex: 1; color: var(--muted); }
.sum-item { padding: 12px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; }
.sum-item strong { font-size: 24px; font-weight: 700; }
.sum-item span { font-size: 12px; color: var(--muted); }
.splash-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

.chip.warn { color: var(--danger); border-color: var(--danger); }
/* The teacher's pen: a hand-drawn circle around a slide picture or a diagram block */
.pen-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.pen-stroke { fill: none; stroke: #e5484d; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.flow-pen { fill: none; stroke: #e5484d; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the lesson canvas ---------- */
.app.immersive { grid-template-columns: minmax(0, 1fr); }
.app.immersive .sidebar { display: none; }
/* The board is always light, like a real whiteboard, so the lesson keeps the light palette in dark mode too: a warm
   clean board, dark ink, the notebook title in a green marker. */
.lesson { --ink: #1c1a17; --board: #fbfaf7; --dot: transparent; --pill: #ffffff;
  --bg: #fbfaf7; --surface: #ffffff; --surface-2: #f5f3ef; --surface-3: #ebe8e2; --border: #ebe7e0; --border-strong: #ddd8cf;
  --text: #1c1a17; --text-2: #57524a; --muted: #8b857b; --primary: #1f1d1a; --primary-hover: #000000; --primary-soft: #eceae5;
  --on-primary: #ffffff; --accent: #6b46c1; --accent-soft: #f1ebfb; --success: #2f7d53; --success-soft: #e6f3ea;
  --warning: #a8660f; --warning-soft: #fbefdc; --danger: #c2412d; --danger-soft: #fbe7e2; --violet: #6b46c1; --violet-soft: #f1ebfb;
  --sky: #2b6f8a; --sky-soft: #e4f0f4; --marker-ink: #2f6a4e; color-scheme: light;
  position: relative; flex: 1; min-height: 0; height: 100vh; overflow: hidden; color: var(--ink);
  background: var(--board); }
.ls-board { position: absolute; inset: 0; }
.lesson.is-preview .ls-board { top: 44px; }  /* room for the teacher's preview bar under the title */
.ls-board .stage-envs { position: absolute; inset: 0; }

/* notebook: handwriting straight on the board, in columns that grow to the right */
.env-notebook { display: flex; background: none; padding: 0; }
.nb-pages { display: none; }
.nb-paper { position: relative; flex: 1; min-width: 0; overflow: auto; padding: 104px 72px 150px; cursor: grab; scrollbar-width: none; }
.nb-paper::-webkit-scrollbar { display: none; }  /* the board pans by dragging; no scrollbar showing under the caption */
.nb-paper.panning { cursor: grabbing; user-select: none; }
.nb-paper.pen-on { cursor: crosshair; touch-action: none; }
/* One centred column on the page; when it is full, the next column continues to the right (pan, or follow). */
.nb-flow { width: min(760px, 100%); height: 100%; margin: 0 auto; column-width: 760px; column-gap: 140px; column-fill: auto; }
.nb-topic { font: 700 46px/1.15 var(--hand); color: var(--marker-ink); font-style: italic; margin: 0 0 22px; break-after: avoid; }
.nb-topic:empty { display: none; }
.nb-lines { font-family: var(--hand); font-size: 25px; line-height: 1.65; color: var(--ink); font-style: italic; }
.nb-lines:empty { display: none; }
.nb-break { break-before: column; }
.nb-line { min-height: 1.65em; white-space: pre-wrap; break-inside: avoid; margin-bottom: 6px; }
.nb-line.nb-title { font-size: 30px; font-weight: 700; margin: 26px 0 10px; color: var(--ink); }
.nb-lines > .nb-line.nb-title:first-child { margin-top: 0; }
.nb-line.nb-bullet { position: relative; padding-left: 1.5em; }
.nb-line.nb-bullet::before { content: ""; position: absolute; left: .4em; top: .78em; width: .32em; height: .32em; border-radius: 50%; background: currentColor; }
.nb-line.writing::after { content: ""; display: inline-block; width: 3px; height: .9em; margin-left: 3px; background: var(--ink); vertical-align: -2px; animation: blink 1s infinite; }
.nb-line.nb-focus { animation: nb-focus 2.4s ease; border-radius: 6px; }
@keyframes nb-focus { 0%, 70% { background: color-mix(in srgb, var(--primary) 12%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 12%, transparent); } 100% { background: transparent; box-shadow: none; } }
.hl-mark { color: inherit; background: linear-gradient(transparent 18%, color-mix(in srgb, #ffe14d 85%, transparent) 18%, color-mix(in srgb, #ffe14d 85%, transparent) 88%, transparent 88%) no-repeat 0 0 / 0 100%; animation: marker .6s ease forwards; border-radius: 3px; padding: 0 2px; }
@keyframes marker { to { background-size: 100% 100%; } }
.ink-layer { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 2; }
.ink-stroke { fill: none; stroke: #e5484d; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

/* slides, code and graphs: cards on the board */
.env-slides { background: none; padding: 100px 64px 170px; }
.slide-frame { width: min(100%, calc((100vh - 290px) * var(--ratio))); }
.ls-board .env.env-code { inset: 96px 0 140px; width: min(1080px, calc(100% - 112px)); margin: 0 auto; border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px rgba(20, 20, 40, .18); }
.ls-board .env.env-visual { inset: 96px 56px 150px; background: none; padding: 0; }
.ls-board .vz-win { border-radius: 16px; box-shadow: 0 12px 40px rgba(20, 20, 40, .14); }
.ls-board .stage-overlay { z-index: 3; background: color-mix(in srgb, var(--board) 55%, transparent); backdrop-filter: blur(3px); }

/* top: where we are (left); the teacher, playback and End (right) */
.ls-top-left { position: absolute; top: 18px; left: 22px; z-index: 4; display: flex; align-items: center; gap: 12px; max-width: calc(50vw - 230px); }
.ls-top-center { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 4; }
/* The panel button stays above the open panel, so the same button opens and closes it. */
.ls-panel-btn { position: relative; z-index: 9; width: 40px; height: 40px; border: 0; border-radius: 12px; display: grid; place-items: center; background: var(--pill); color: var(--ink); box-shadow: 0 1px 8px rgba(28, 26, 23, .08); flex: none; cursor: pointer; }
.ls-panel-btn svg { width: 19px; height: 19px; }
.ls-panel-btn:hover { background: var(--surface-2); }
.ls-panel-btn.active { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.ls-where { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ls-where strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-where small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-state { color: var(--primary); font-weight: 600; }
.ls-top-center .env-indicator { --pill-w: 84px; background: var(--pill); border-color: transparent; box-shadow: 0 1px 8px rgba(28, 26, 23, .08); flex: none; }
.ls-top-center .env-glider { background: var(--primary-soft); box-shadow: none; }
.ls-top-center .env-pill { color: var(--muted); cursor: pointer; font-size: 12.5px; }
.ls-top-center .env-pill:hover, .ls-top-center .env-pill.active { color: var(--ink); }

.ls-top-right { position: absolute; top: 14px; right: 22px; z-index: 4; display: flex; align-items: center; gap: 10px; }
.ls-controls { display: flex; align-items: center; }
.ls-ctl { width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.ls-ctl svg { width: 19px; height: 19px; }
.ls-ctl:hover { background: var(--surface-2); color: var(--ink); }
.ls-ctl.active { color: var(--primary); }
.ls-play { width: 42px; height: 42px; background: var(--ink); color: #fff; box-shadow: 0 2px 10px rgba(28, 26, 23, .18); }
.ls-play:hover { background: var(--text); color: #fff; }
.ls-play svg path[fill] { fill: #fff; }
.ls-clock { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--pill); box-shadow: 0 1px 8px rgba(28, 26, 23, .08); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.ls-clock svg { width: 15px; height: 15px; }
.ls-clock.warn { color: #e5484d; }
.ls-pill { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 11px; border: 0; border-radius: 999px; background: var(--pill); color: var(--ink); font: 600 13px var(--font); box-shadow: 0 1px 8px rgba(28, 26, 23, .08); cursor: pointer; }
.ls-pill svg { width: 16px; height: 16px; }
.ls-pill:hover, .ls-pill.active { background: var(--primary-soft); color: var(--primary); }
/* The teacher's preview bar: under the title, on its own row, so its names always show. */
.ls-preview-bar { position: absolute; top: 74px; left: 22px; z-index: 4; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--pill); box-shadow: 0 1px 8px rgba(28, 26, 23, .08); }
.pv-tag { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 8px; font: 600 12px var(--font); color: var(--muted); }
.pv-tag svg { width: 14px; height: 14px; }
.pv-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px 0 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--pill); color: var(--ink); font: 600 13px var(--font); cursor: pointer; }
.pv-btn svg { width: 15px; height: 15px; }
.pv-btn:hover, .pv-btn.active { border-color: var(--primary); color: var(--primary); }
.pv-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.pv-btn.primary:hover { background: var(--primary-hover); color: #fff; }
/* The script panel (a teacher previewing a shared lesson): slides in from the right over the board. */
.ls-script { position: absolute; right: 0; top: 0; bottom: 0; z-index: 7; width: min(560px, 92vw); display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .25s ease; }
.lesson.script-open .ls-script { transform: none; }
.ls-script-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 6px; }
.ls-script-head strong { display: block; font: 600 20px var(--display); }
.ls-script-head small { color: var(--muted); font-size: 12.5px; }
.ls-script-note { margin: 4px 20px 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.ls-script-body { flex: 1; min-height: 0; overflow-y: auto; }
.ls-script-body .script-doc { padding: 8px 20px 40px; }
.ls-end { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 11px; border: 0; border-radius: 999px; background: var(--pill); color: var(--ink); font: 600 13px var(--font); box-shadow: 0 1px 8px rgba(28, 26, 23, .08); cursor: pointer; }
.ls-end:hover { background: #fdecec; color: #c93a3a; }
.ls-end-dot { width: 9px; height: 9px; border-radius: 2px; background: #e5484d; }

.ls-follow { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); z-index: 4; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--primary); color: #fff; font: 600 13.5px var(--font); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 30%, transparent); cursor: pointer; animation: toast-in .2s ease; }
.ls-follow svg { width: 16px; height: 16px; }

/* bottom: the live caption and the doubt box, nothing else */
.ls-bar { position: absolute; left: 22px; right: 22px; bottom: 18px; z-index: 5; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.ls-bar-row { display: flex; align-items: flex-end; gap: 16px; }
.ls-bar-row > *, .ls-scrub { pointer-events: auto; }
/* The scrubber row: the whole lesson as a bar, with back, next and speed. */
.ls-scrub { display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 4px; align-self: center; width: min(640px, 100%); border-radius: 999px; background: var(--pill); box-shadow: 0 1px 8px rgba(28, 26, 23, .08); color: var(--ink); }
.sc-btn { display: inline-flex; align-items: center; gap: 4px; height: 26px; min-width: 26px; justify-content: center; padding: 0 6px; border: 0; border-radius: 999px; background: none; color: var(--text-2); font: 600 12px var(--font); cursor: pointer; flex: none; }
.sc-btn:hover, .sc-btn.active { background: var(--surface-2); color: var(--ink); }
.sc-btn svg { width: 14px; height: 14px; }
.sc-back10 span { font-size: 11px; }
.sc-speed { min-width: 38px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.sc-track { position: relative; flex: 1; height: 20px; margin: 0 8px; }
.sc-track::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 3px; border-radius: 2px; background: var(--border); }
.sc-heard i { position: absolute; top: 9px; height: 3px; background: #d8d3ca; }
.sc-fill { position: absolute; left: 0; top: 9px; height: 3px; border-radius: 2px; background: var(--primary); width: 0; }
/* Checkpoints: reached ones are filled and clickable; the rest are hollow. */
.sc-point { position: absolute; top: 5px; width: 10px; height: 10px; padding: 0; border-radius: 50%; transform: translateX(-50%); border: 2px solid var(--border-strong); background: var(--pill); cursor: pointer; transition: transform .12s; }
.sc-point.sc-topic { width: 16px; height: 16px; top: 2px; display: grid; place-items: center; font: 700 9px var(--font); color: var(--muted); }
.sc-point.sc-topic.reached { color: #fff; }
.sc-point.sub { width: 8px; height: 8px; top: 6px; border-width: 1.5px; }
.sc-count { flex: none; padding: 0 6px; font: 600 11px var(--font); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-point.reached { background: var(--primary); border-color: var(--primary); }
.sc-point:not(:disabled):hover { transform: translateX(-50%) scale(1.25); }
.sc-point:disabled { cursor: not-allowed; opacity: .7; }
.busy { pointer-events: none; opacity: .5; }
.sc-tip { position: absolute; bottom: 24px; transform: translateX(-50%); width: max-content; max-width: 240px; padding: 5px 9px; border-radius: 10px; z-index: 2; background: var(--ink); color: #f6f2ea; font-size: 12px; line-height: 1.4; pointer-events: none; display: flex; flex-direction: column; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.sc-tip strong { font-size: 11.5px; color: #e8c34e; }
.sc-continue { background: var(--primary-soft) !important; color: var(--primary) !important; }
.lesson.has-overlay .ls-scrub { visibility: hidden; }
.sc-gap { flex: none; height: 22px; padding: 0 8px; border: 0; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font: 600 11.5px var(--font); cursor: pointer; white-space: nowrap; }
.transcript { list-style: none; margin: 0; padding: 4px 8px; overflow-y: auto; flex: none; max-height: 30%; }
.transcript li { padding: 6px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.transcript li.current { background: var(--primary-soft); color: var(--primary); }
.flag-line { margin: 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 12px 12px 0; color: var(--text-2); font-size: 13.5px; }
/* The caption runs straight on the whiteboard, beside the tutor: no card behind it. */
.ls-caption { flex: 1; min-width: 0; max-width: 760px; display: flex; align-items: center; gap: 16px; }
.ls-tutor { --level: 0; position: relative; width: 84px; height: 84px; flex: none; border-radius: 50%; overflow: hidden; background: #e9ecf6; box-shadow: 0 2px 10px rgba(28, 26, 23, .14); }
.ls-tutor-orb { width: 100%; height: 100%; display: grid; place-items: center; font: 700 24px var(--font); color: #fff; background: radial-gradient(circle at 30% 30%, #8cc4a2, #2f6a4e 60%, #234d39); }
.ls-tutor.with-3d .ls-tutor-orb, .ls-tutor.with-video .ls-tutor-orb { display: none; }
.ls-tutor-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .18s ease; pointer-events: none; }
.ls-tutor-video.on { opacity: 1; }
.ls-tutor:not(.with-video) .ls-tutor-video { display: none; }
.ls-tutor-3d { position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, #fbfaf7, #ebe8e2); }
.ls-tutor-3d canvas { width: 100% !important; height: 100% !important; }
.ls-tutor-ring { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; box-shadow: inset 0 0 0 calc(2px + var(--level) * 4px) color-mix(in srgb, var(--primary) calc(12% + var(--level) * 50%), transparent); transition: box-shadow .08s linear; }
.lesson.paused .ls-tutor { filter: grayscale(.6); }
.ls-caption-text { position: relative; flex: 1; min-width: 0; margin: 0; height: calc(2 * 1.4em); overflow: hidden; scroll-behavior: smooth; font: 500 16px/1.45 var(--font); color: var(--ink); text-shadow: 0 0 6px var(--board), 0 0 2px var(--board); }
/* Only words already spoken are shown: the caption builds up as the teacher talks, like live subtitles. */
.ls-caption-text .w { color: var(--ink); }
.ls-caption-text .w:not(.said) { display: none; }
.ls-caption-text .w.said { animation: word-in .18s ease; }  /* a word fades in as it appears */
@keyframes word-in { from { opacity: 0; } }
.ls-ask-wrap { position: relative; margin-left: auto; flex: none; }
.ls-ask { position: relative; display: flex; align-items: center; gap: 6px; width: min(560px, 40vw); min-height: 62px; padding: 8px 8px 8px 10px; border-radius: 32px; background: var(--pill); box-shadow: 0 2px 14px rgba(28, 26, 23, .08); transition: box-shadow .2s; }
.ls-ask.active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent), 0 2px 14px rgba(28, 26, 23, .08); }
.ls-plus, .ls-send { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.ls-plus:hover { background: var(--surface-2); color: var(--ink); }
.ls-plus svg { width: 20px; height: 20px; }
.ls-send { background: var(--primary); color: #fff; }
.ls-send svg { width: 18px; height: 18px; transform: rotate(-90deg); }
.ls-input { flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: none; font: 400 16px/1.4 var(--font); color: var(--ink); padding: 6px 2px; max-height: 120px; }
.ls-input::placeholder { color: #a89d90; }
.ls-mic { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ls-mic svg { width: 20px; height: 20px; }
.ls-mic:hover { background: var(--text); }
.ls-mic.on { background: #e5484d; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(229, 72, 77, .18); } }
.ls-menu { position: absolute; left: 6px; bottom: 70px; min-width: 240px; padding: 6px; border-radius: 14px; background: var(--pill); box-shadow: 0 8px 30px rgba(28, 26, 23, .16); display: flex; flex-direction: column; }
.ls-menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--ink); font: 500 14px var(--font); text-align: left; cursor: pointer; }
.ls-menu-item:hover:not(:disabled) { background: var(--surface-2); }
.ls-menu-item:disabled { color: #b3b5bb; cursor: default; }
.ls-menu-item svg { width: 17px; height: 17px; }

/* the question being answered: a card above the doubt box */
/* Above the doubt box and the checkpoint bar (never over them). */
.ls-live { position: absolute; right: 0; bottom: 134px; width: min(640px, 52vw); max-height: min(60vh, calc(100vh - 230px)); display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 18px; background: var(--pill); box-shadow: 0 10px 34px rgba(28, 26, 23, .16); animation: toast-in .2s ease; }
.ls-live-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.ls-live-head svg { width: 16px; height: 16px; color: var(--accent); }
.ls-live-head strong { flex: 1; }
.ls-live-thread { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
/* Each question break in the chat starts with a small label, so earlier ones are easy to tell apart. */
.ls-live .ck-head { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ls-live .ck-head svg { width: 12px; height: 12px; }
.ls-live .ck-head strong { font-weight: 600; }
.ls-live .checkpoint + .checkpoint, .ls-live .raised-note + .checkpoint { border-top: 1px dashed var(--border); padding-top: 8px; }
.ls-live .raised-note { display: flex; flex-direction: column; gap: 8px; }
/* While the teacher talks, the doubt box rests: pause the lesson (or wait for a question break) to ask. */
.ls-ask.locked { opacity: .55; box-shadow: none; }
.ls-ask.locked .ls-input { cursor: not-allowed; }
.ls-ask.locked .ls-mic, .ls-ask.locked .ls-plus { cursor: not-allowed; background: #d9d1c4; }
.ls-live .msg .bubble, .ls-drawer .msg .bubble { font-size: 13.5px; }
.ls-live .msg.teacher .bubble { background: var(--surface-2); color: var(--ink); }
.ls-live .msg.teacher.prompt .bubble { background: var(--primary-soft); }
.ls-live .msg.system .bubble { background: #fbeedb; color: #9a5a10; }

/* drawer: outline and question history, from the handle on the left edge */
.ls-drawer { position: absolute; left: 0; top: 0; bottom: 0; z-index: 7; width: 340px; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .25s ease; }
.lesson.drawer-open .ls-drawer { transform: none; }
.ls-drawer-head { display: flex; align-items: center; height: 76px; padding: 0 16px 0 74px; }
.lesson.drawer-open .ls-top-left { z-index: 9; }
.lesson.drawer-open .ls-where { visibility: hidden; }  /* the panel's own title shows instead */
.ls-drawer-label { padding: 12px 18px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ls-drawer .outline { flex: none; max-height: 42%; }
.ls-drawer .chat { flex: 1; min-height: 0; }

@media (max-width: 1100px) {
  .ls-top-center .env-indicator { --pill-w: 70px; }
  .ls-ask { width: min(440px, 44vw); }
  .nb-paper { padding-left: 40px; padding-right: 40px; }
}
@media (max-width: 760px) {
  .ls-top-center .env-indicator, .ls-clock, .ls-where { display: none; }
  .ls-bar { left: 10px; right: 10px; }
  .ls-bar-row { flex-direction: column; align-items: stretch; }
  .sc-gap, .sc-btn span { display: none; }
  .ls-ask-wrap { margin-left: 0; }
  .ls-ask { width: 100%; }
}
.ls-ask .ls-model { align-self: center; flex: none; height: 22px; padding: 0 8px; font-size: 11px; margin-right: 4px; }
.ls-kind { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; background: #f3e5ee; color: #8a4f78; font-size: 10.5px; font-weight: 700; vertical-align: 2px; }
.ls-mini { height: 26px; padding: 0 11px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font: 600 12px var(--font); cursor: pointer; }
.ls-mini:hover { color: var(--ink); }
