/* RC4 W3 lesson layout (docs/coordination/WORKSPACE-DESIGN.md). Switched on by adding the class
   ws-v4 to the workspace root (next to .ws); every selector here starts with .ws-v4, so without
   that class nothing changes. Loaded after workspace.css. CSP-safe: no inline styles, no url(),
   no @import, no external fonts. Logical properties throughout (right-to-left ready). Status
   colours are Okabe-Ito and always come with a shape and a word. */

.ws-v4 {
  /* Tokens: the existing palette (workspace.css .ws), plus the type scale, spacing and radii. */
  --lv-ink: var(--ws-ink, #17183a);
  --lv-ink-soft: var(--ws-ink-soft, #4a4d6e);
  --lv-page: #f6f7fc;
  --lv-surface: #ffffff;
  --lv-side: #fbfbfe;
  --lv-line: var(--ws-line, #dfe3f3);
  --lv-accent: var(--ws-blue-ui, #2a4fd8);
  --lv-accent-deep: var(--ws-blue-ui-deep, #1d3bb0);
  --lv-accent-soft: var(--ws-lavender, #eef0ff);
  --lv-accent-line: var(--ws-lavender-2, #d9defa);
  --lv-focus: var(--ws-gold, #f2b632);
  --lv-ok: var(--ws-green, #009e73);
  --lv-ok-ink: var(--ws-green-ink, #00624a);
  --lv-learn: var(--ws-blue, #0072b2);
  --lv-weak: var(--ws-vermillion, #d55e00);
  --lv-warn-ink: var(--ws-orange-ink, #7a4b00);
  --lv-muted: var(--ws-grey, #6b6680);
  --lv-fs-xs: 0.8125rem;  /* 13 */
  --lv-fs-sm: 0.9375rem;  /* 15 */
  --lv-fs-md: 1.0625rem;  /* 17: body and question text */
  --lv-fs-lg: 1.25rem;    /* 20: question text on tablet and up */
  --lv-fs-xl: 1.5rem;     /* 24 */
  --lv-s1: 4px;
  --lv-s2: 8px;
  --lv-s3: 12px;
  --lv-s4: 16px;
  --lv-s5: 24px;
  --lv-r-sm: 8px;
  --lv-r-md: 12px;
  --lv-r-lg: 16px;
  --lv-r-pill: 999px;
  --lv-touch: 44px;
  --lv-chip-h: 36px;
  --lv-start-w: 272px;
  --lv-end-w: 320px;
  --lv-rail: 56px;
  --lv-read: 760px;       /* the conversation's reading width */
  --lv-shadow: 0 1px 2px rgba(18, 32, 79, 0.06), 0 8px 24px rgba(18, 32, 79, 0.08);
  background: var(--lv-page);
}

/* ---------- Old regions replaced or merged in v4 ---------- */
/* The pinned question card (now inside Nova's message), the old chapter panel, stage and topic
   box (now the two sidebars), and what Nova's window repeated: her caption (the conversation has
   her words), her status line (the sidebar's status line), her offer buttons and their note (now
   in her message in the conversation). Her mute and full-screen buttons stay: they are the
   sidebar's voice-output and expand controls. */
.ws-v4 .ws-qcard,
.ws-v4 .ws-panel,
.ws-v4 .ws-stage,
.ws-v4 .ws-scrim,
.ws-v4 .ws-drawer-btn,
.ws-v4 .ws-topics-box,
.ws-v4 [data-nova="caption"],
.ws-v4 [data-nova="status"],
.ws-v4 [data-nova="actions"],
.ws-v4 [data-nova="provenance"] { display: none !important; }
.ws-v4 .ws-body.lv-body { gap: 0; padding: 0; }
/* The sheet with no open question: over the conversation row, the dock still below it. */
.ws-v4 .lv-main > .ws-expand { grid-column: 1; grid-row: conv; }
/* The sheet inside the open question's message: in place, no shadow, its own scroll. */
.ws-v4 .lv-work-host > .ws-expand {
  position: static; display: flex; flex-direction: column; gap: var(--lv-s2);
  max-block-size: 70dvh; overflow-y: auto; margin-block-start: var(--lv-s2); padding: var(--lv-s3);
  border: 1px solid var(--lv-accent-line); border-radius: var(--lv-r-lg); background: var(--lv-side); box-shadow: none;
}
/* The help chips on their message (the workspace's own buttons, styled compact). */
.ws-v4 .lv-actions { display: flex; flex-wrap: wrap; gap: var(--lv-s2); margin-block-start: var(--lv-s2); }
.ws-v4 .lv-actions .ws-btn,
.ws-v4 .lv-offers .ws-btn {
  min-block-size: var(--lv-chip-h); padding-block: 0; padding-inline: var(--lv-s3);
  border: 1px solid var(--lv-line); border-radius: var(--lv-r-pill); background: var(--lv-surface);
  color: var(--lv-ink-soft); box-shadow: none; font-size: var(--lv-fs-sm); font-weight: 600;
}
.ws-v4 .lv-actions .ws-btn-primary,
.ws-v4 .lv-offers .ws-btn-primary { border-color: var(--lv-accent); color: var(--lv-accent-deep); }
.ws-v4 .lv-actions .ws-btn:hover:not(:disabled),
.ws-v4 .lv-offers .ws-btn:hover:not(:disabled) { background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
.ws-v4 .lv-actions .ws-btn[aria-expanded="true"] { border-color: var(--lv-accent); background: var(--lv-accent-soft); }
.ws-v4 .lv-offers { display: flex; flex-wrap: wrap; gap: var(--lv-s2); margin-block-start: var(--lv-s2); }
.ws-v4 .lv-turn-text { margin: 0; }
/* The inline name editor (New chapter, Rename, Add topic). */
.ws-v4 .lv-edit { display: flex; flex-direction: column; gap: var(--lv-s1); inline-size: 100%; padding: var(--lv-s1); }
.ws-v4 .lv-edit-input { min-block-size: 40px; padding-inline: var(--lv-s2); border: 1px solid var(--lv-accent); border-radius: var(--lv-r-sm); background: var(--lv-surface); color: var(--lv-ink); font: inherit; }
.ws-v4 .lv-edit-row { display: flex; gap: var(--lv-s1); }
.ws-v4 .lv-edit-error { margin: 0; color: var(--lv-warn-ink); font-size: var(--lv-fs-xs); }
/* The study tools and the practise-first list under the topics: compact rows. */
.ws-v4 .lv-topics .ws-side-tools { list-style: none; margin: var(--lv-s2) 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-v4 .lv-topics .ws-side-tool { display: flex; align-items: center; gap: var(--lv-s2); inline-size: 100%; min-block-size: 40px; padding-inline: var(--lv-s2); border: 0; border-radius: var(--lv-r-sm); background: transparent; text-align: start; cursor: pointer; }
.ws-v4 .lv-topics .ws-side-tool:hover { background: var(--lv-accent-soft); }
.ws-v4 .lv-topics .ws-side-help { display: none; }
.ws-v4 .lv-side-extra { display: flex; flex-direction: column; gap: var(--lv-s2); }
.ws-v4 .lv-side-extra .ws-concept { min-block-size: 40px; border-radius: var(--lv-r-sm); }
.ws-v4 .lv-chapters-note:empty { display: none; }

.ws-v4 .ws-top { min-block-size: 52px; padding-block: var(--lv-s1); }
.ws-v4 .ws-brand-tag { display: none; }
/* RC8C recovery (workstream D round 2; real browser 20261128T103636Z, G3 screenshots at 820, 780
   and 360 px): the brand (flex 1, min 0, its name overflowing visibly) was painted under Home and
   Progress, and at 360 px the nav and the end group (timer, stars, chapters) ran past the right
   edge. Now the brand gives way first (its name ends in an ellipsis; the logo always shows) and,
   when the controls still do not fit, the end group takes a second row: nothing overlaps, nothing
   is cut, no control or label is removed (a hidden word stays the button's accessible name). */
.ws-v4 .ws-brand { flex: 1 1 0; min-inline-size: 36px; overflow: hidden; }
.ws-v4 .ws-brand-text { min-inline-size: 0; }
.ws-v4 .ws-brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1023px) {
  .ws-v4 .ws-top { flex-wrap: wrap; row-gap: var(--lv-s1); }
  .ws-v4 .ws-top-end { flex-wrap: wrap; justify-content: flex-end; row-gap: var(--lv-s1); margin-inline-start: auto; }
}
@media (max-width: 480px) {
  .ws-v4 .lv-open-chapters > span:not([class]) { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 400px) {
  .ws-v4 .ws-brand { min-inline-size: 32px; }
}
/* A short landscape phone keeps ONE row (a second would take height the lesson needs): the nav and
   the chapters button show their icons; their words stay their accessible names. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1023px) {
  .ws-v4 .ws-nav-label,
  .ws-v4 .lv-open-chapters > span:not([class]) { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---------- Grid ---------- */
.ws-v4 .lv-body {
  position: relative;
  flex: 1 1 auto;
  min-block-size: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "nova" "main";
}
.ws-v4 .lv-main,
.ws-v4 .lv-body > .ws-main {
  grid-area: main;
  min-block-size: 0;
  min-inline-size: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "context" "conv" "dock";
  background: var(--lv-surface);
}
.ws-v4 .ws-context { grid-area: context; display: flex; align-items: center; gap: var(--lv-s2); padding-block: var(--lv-s1); padding-inline: var(--lv-s3); border-block-end: 1px solid var(--lv-line); font-size: var(--lv-fs-xs); }
.ws-v4 .ws-conv { grid-area: conv; position: relative; min-block-size: 0; display: flex; flex-direction: column; }
.ws-v4 .ws-log { flex: 1 1 auto; min-block-size: 0; overflow-y: auto; overscroll-behavior: contain; gap: 10px; padding-block: var(--lv-s3); padding-inline: var(--lv-s3); scroll-padding-block-end: var(--lv-s4); }
.ws-v4 .ws-log > * { max-inline-size: var(--lv-read); margin-inline: auto; }
.ws-v4 .ws-jump { position: absolute; inset-block-end: var(--lv-s3); inset-inline-start: 50%; transform: translateX(-50%); border-radius: var(--lv-r-pill); }
.ws-v4[dir="rtl"] .ws-jump { transform: translateX(50%); }
.ws-v4 .ws-dock { grid-area: dock; padding-block: var(--lv-s2); padding-inline: var(--lv-s3); border-block-start: 1px solid var(--lv-line); background: var(--lv-surface); }
.ws-v4 .ws-dock > * { max-inline-size: var(--lv-read); margin-inline: auto; }
/* The composer in the dock: one light outlined box (the dock is already white), no floating card. */
.ws-v4 .ws-composer { padding: 6px; border: 1px solid var(--lv-line); border-radius: var(--lv-r-lg); background: var(--lv-surface); box-shadow: none; }
.ws-v4 .ws-composer:focus-within { border-color: var(--lv-accent-line); }
.ws-v4 .ws-composer .ws-input { border-width: 1px; border-color: var(--lv-line); }
.ws-v4 .ws-composer .ws-input:focus { border-color: var(--lv-accent); }
/* Voice states: colour only (an inset ring), never a size change. */
.ws-v4 .ws-composer[data-conversation="listening"] .ws-input { border-color: var(--ws-blue, #0072b2); box-shadow: inset 0 0 0 1px var(--ws-blue, #0072b2); }
.ws-v4 .ws-composer[data-conversation="speaking"] .ws-input { border-color: var(--ws-violet, #5b3fd6); box-shadow: inset 0 0 0 1px var(--ws-violet, #5b3fd6); }
.ws-v4 .lv-open-chapters { display: inline-grid; }

/* ---------- Shared bits ---------- */
.ws-v4 .lv-vh { position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ws-v4 .lv-icon { inline-size: 20px; block-size: 20px; fill: currentColor; flex: none; }
.ws-v4 .lv-icon-btn,
.ws-v4 .lv-dots,
.ws-v4 .lv-ctl {
  display: inline-grid; place-items: center; flex: none;
  inline-size: var(--lv-touch); block-size: var(--lv-touch);
  border: 0; border-radius: var(--lv-r-md); background: transparent; color: var(--lv-ink-soft); cursor: pointer;
}
.ws-v4 .lv-icon-btn:hover,
.ws-v4 .lv-dots:hover,
.ws-v4 .lv-ctl:hover { background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
.ws-v4 .lv-ctl[aria-pressed="true"] { background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
.ws-v4 .lv-ctl[aria-disabled="true"],
.ws-v4 .lv-ctl:disabled { opacity: 0.45; cursor: not-allowed; }
.ws-v4 .lv-ctl-end[data-shown="true"] { color: var(--lv-weak); }
.ws-v4 :focus-visible { outline: 3px solid var(--lv-focus); outline-offset: 2px; }

/* ---------- Sidebars (both) ---------- */
.ws-v4 .lv-side {
  display: flex; flex-direction: column; min-block-size: 0; min-inline-size: 0;
  background: var(--lv-side); color: var(--lv-ink); font-size: var(--lv-fs-sm);
}
.ws-v4 .lv-side-head { display: flex; align-items: center; gap: var(--lv-s1); padding-block: var(--lv-s2); padding-inline: var(--lv-s3); }
.ws-v4 .lv-side-title { flex: 1 1 auto; margin: 0; font-size: var(--lv-fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--lv-muted); }
.ws-v4 .lv-side-body { flex: 1 1 auto; min-block-size: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--lv-s2); padding-block-end: var(--lv-s4); padding-inline: var(--lv-s2); }
.ws-v4 .lv-side[data-collapsed="true"] .lv-side-head { flex-direction: column; padding-inline: var(--lv-s1); }
.ws-v4 .lv-side[data-collapsed="true"] .lv-side-title { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }

.ws-v4 .lv-select { inline-size: 100%; min-block-size: var(--lv-touch); padding-inline: var(--lv-s3); border: 1px solid var(--lv-line); border-radius: var(--lv-r-md); background: var(--lv-surface); color: var(--lv-ink); font: inherit; font-weight: 600; }
.ws-v4 .lv-new,
.ws-v4 .lv-add {
  display: flex; align-items: center; gap: var(--lv-s2); inline-size: 100%;
  min-block-size: var(--lv-touch); padding-inline: var(--lv-s3);
  border: 1px dashed var(--lv-accent-line); border-radius: var(--lv-r-md); background: transparent;
  color: var(--lv-accent-deep); font: inherit; font-weight: 600; text-align: start; cursor: pointer;
}
.ws-v4 .lv-new { border-style: solid; background: var(--lv-surface); box-shadow: 0 1px 2px rgba(18, 32, 79, 0.06); }
.ws-v4 .lv-new:hover,
.ws-v4 .lv-add:hover { background: var(--lv-accent-soft); }
.ws-v4 .lv-search { display: flex; align-items: center; gap: var(--lv-s2); padding-inline: var(--lv-s3); border: 1px solid var(--lv-line); border-radius: var(--lv-r-md); background: var(--lv-surface); color: var(--lv-muted); }
.ws-v4 .lv-search-input { flex: 1 1 auto; min-inline-size: 0; min-block-size: 40px; border: 0; background: transparent; color: var(--lv-ink); font: inherit; }
.ws-v4 .lv-search-input:focus { outline: none; }
.ws-v4 .lv-search:focus-within { outline: 3px solid var(--lv-focus); outline-offset: 1px; }

/* Rows: one line each, no cards. */
.ws-v4 .lv-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-v4 .lv-row { position: relative; display: flex; align-items: center; border-radius: var(--lv-r-sm); }
.ws-v4 .lv-row:hover { background: rgba(42, 79, 216, 0.05); }
.ws-v4 .lv-row[data-active="true"],
.ws-v4 .lv-row[data-current="true"] { background: var(--lv-accent-soft); box-shadow: inset 3px 0 0 var(--lv-accent); }
.ws-v4[dir="rtl"] .lv-row[data-active="true"],
.ws-v4[dir="rtl"] .lv-row[data-current="true"] { box-shadow: inset -3px 0 0 var(--lv-accent); }
.ws-v4 .lv-row-main {
  flex: 1 1 auto; min-inline-size: 0; min-block-size: var(--lv-touch);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "mark title tag" "mark bar bar";
  align-items: center; column-gap: var(--lv-s2); row-gap: 3px;
  padding-block: 6px; padding-inline: var(--lv-s2);
  border: 0; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.ws-v4 .lv-row-title { grid-area: title; unicode-bidi: isolate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ws-v4 .lv-row[data-active="true"] .lv-row-title,
.ws-v4 .lv-row[data-current="true"] .lv-row-title { font-weight: 700; color: var(--lv-accent-deep); }
.ws-v4 .lv-row[data-archived="true"] .lv-row-title { color: var(--lv-muted); }
.ws-v4 .lv-tag { grid-area: tag; padding-inline: 6px; border-radius: var(--lv-r-pill); background: var(--lv-accent-soft); color: var(--lv-accent-deep); font-size: var(--lv-fs-xs); }
.ws-v4 .lv-tag-suggested { background: #fff4dc; color: var(--lv-warn-ink); }
.ws-v4 .lv-dots { inline-size: 36px; opacity: 0.55; }
.ws-v4 .lv-row:hover .lv-dots,
.ws-v4 .lv-row:focus-within .lv-dots,
.ws-v4 .lv-dots[aria-expanded="true"] { opacity: 1; }

/* The subtle progress bar: ten steps from data-step. */
.ws-v4 .lv-bar { grid-area: bar; position: relative; display: block; block-size: 3px; border-radius: var(--lv-r-pill); background: var(--lv-line); overflow: hidden; }
.ws-v4 .lv-bar::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 0; background: var(--lv-ok); border-radius: inherit; }
.ws-v4 .lv-bar[data-step="1"]::after { inline-size: 10%; }
.ws-v4 .lv-bar[data-step="2"]::after { inline-size: 20%; }
.ws-v4 .lv-bar[data-step="3"]::after { inline-size: 30%; }
.ws-v4 .lv-bar[data-step="4"]::after { inline-size: 40%; }
.ws-v4 .lv-bar[data-step="5"]::after { inline-size: 50%; }
.ws-v4 .lv-bar[data-step="6"]::after { inline-size: 60%; }
.ws-v4 .lv-bar[data-step="7"]::after { inline-size: 70%; }
.ws-v4 .lv-bar[data-step="8"]::after { inline-size: 80%; }
.ws-v4 .lv-bar[data-step="9"]::after { inline-size: 90%; }
.ws-v4 .lv-bar[data-step="10"]::after { inline-size: 100%; }

/* Row menus */
.ws-v4 .lv-menu {
  position: absolute; z-index: 30; inset-block-start: calc(100% - 4px); inset-inline-end: var(--lv-s1);
  min-inline-size: 180px; padding: var(--lv-s1); border: 1px solid var(--lv-line); border-radius: var(--lv-r-md);
  background: var(--lv-surface); box-shadow: var(--lv-shadow);
}
.ws-v4 .lv-menu-item { display: block; inline-size: 100%; min-block-size: 40px; padding-inline: var(--lv-s3); border: 0; border-radius: var(--lv-r-sm); background: transparent; color: var(--lv-ink); font: inherit; text-align: start; cursor: pointer; }
.ws-v4 .lv-menu-item:hover,
.ws-v4 .lv-menu-item:focus { background: var(--lv-accent-soft); }
.ws-v4 .lv-group { display: flex; flex-direction: column; gap: 2px; margin-block-start: var(--lv-s2); }
.ws-v4 .lv-group-title { margin: 0; padding-inline: var(--lv-s2); font-size: var(--lv-fs-xs); font-weight: 700; color: var(--lv-muted); }
.ws-v4 .lv-group-toggle { min-block-size: 40px; padding-inline: var(--lv-s2); border: 0; background: transparent; color: var(--lv-muted); font: inherit; font-size: var(--lv-fs-xs); font-weight: 700; text-align: start; cursor: pointer; }
.ws-v4 .lv-empty { margin: 0; padding: var(--lv-s2); color: var(--lv-muted); font-size: var(--lv-fs-sm); }

/* Topic status: a shape and a word (never colour alone). */
.ws-v4 .lv-topic-rows .lv-row-main { grid-template-areas: "mark title tag"; }
.ws-v4 .lv-mark { grid-area: mark; inline-size: 12px; block-size: 12px; border-radius: 50%; border: 2px solid var(--lv-muted); }
.ws-v4 .lv-mark[data-status="learning"] { border-color: var(--lv-learn); background: linear-gradient(90deg, var(--lv-learn) 50%, transparent 50%); }
.ws-v4 .lv-mark[data-status="weak"] { border-radius: 2px; transform: rotate(45deg) scale(0.85); border-color: var(--lv-weak); background: var(--lv-weak); }
.ws-v4 .lv-mark[data-status="mastered"] { border-color: var(--lv-ok); background: var(--lv-ok); }
.ws-v4 .lv-status { grid-area: tag; font-size: var(--lv-fs-xs); color: var(--lv-muted); white-space: nowrap; }
.ws-v4 .lv-status[data-status="mastered"] { color: var(--lv-ok-ink); }
.ws-v4 .lv-status[data-status="weak"] { color: var(--lv-warn-ink); }
.ws-v4 .lv-topics { display: flex; flex-direction: column; gap: var(--lv-s1); padding-block-start: var(--lv-s2); border-block-start: 1px solid var(--lv-line); }
.ws-v4 .lv-topics .lv-side-title { padding-inline: var(--lv-s2); }
.ws-v4 .lv-topics-chapter { unicode-bidi: isolate; margin: 0; padding-inline: var(--lv-s2); font-weight: 700; font-size: var(--lv-fs-sm); }

/* ---------- Right sidebar: Nova ---------- */
.ws-v4 .lv-nova { grid-area: nova; }
.ws-v4 .lv-nova-portrait { border-radius: var(--lv-r-lg); }
.ws-v4 .lv-nova-portrait > img { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; object-position: 50% 20%; }
.ws-v4 .lv-ctls { display: flex; align-items: center; justify-content: space-between; gap: 2px; padding-inline: var(--lv-s1); }
.ws-v4 .lv-mic-state { display: inline-grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 50%; color: var(--lv-muted); }
.ws-v4 .lv-mic-state[data-state="on"] { color: var(--lv-ok-ink); box-shadow: inset 0 0 0 2px var(--lv-ok); }
.ws-v4 .lv-mic-state[data-state="paused"] { color: var(--lv-warn-ink); outline: 2px dashed currentColor; outline-offset: -2px; }
.ws-v4 .lv-mic-state[data-state="unavailable"] { opacity: 0.4; }
.ws-v4 .lv-nova-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--lv-s2); padding-inline: var(--lv-s2); font-size: var(--lv-fs-xs); color: var(--lv-ink-soft); }
.ws-v4 .lv-nova-status { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.ws-v4 .lv-state-dot,
.ws-v4 .lv-rail-dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--lv-muted); }
.ws-v4 [data-state="speaking"] > .lv-state-dot,
.ws-v4 .lv-rail-dot[data-state="speaking"] { background: var(--lv-accent); }
.ws-v4 [data-state="listening"] > .lv-state-dot,
.ws-v4 .lv-rail-dot[data-state="listening"] { background: var(--lv-ok); }
.ws-v4 [data-state="thinking"] > .lv-state-dot,
.ws-v4 .lv-rail-dot[data-state="thinking"] { background: var(--lv-focus); }
.ws-v4 [data-state="paused"] > .lv-state-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--lv-muted); }
.ws-v4 .lv-timer { font-variant-numeric: tabular-nums; }

/* ---------- Conversation ---------- */
/* RC5 U rhythm: the log's 10 px gap between turns, 4-6 px between consecutive messages from the same
   author; Nova's ordinary messages are clean text (no card). */
.ws-v4 .ws-msg { margin-block: 0; border: 0; box-shadow: none; }
.ws-v4 .ws-tutor { background: transparent; padding: 0; }
.ws-v4 .ws-tutor p { margin-block: 0 4px; }
.ws-v4 .ws-tutor p:last-child { margin-block-end: 0; }
.ws-v4 .ws-tutor > .ws-author { margin-block: 0 2px; font-size: var(--lv-fs-xs); color: var(--lv-ink-soft); }
.ws-v4 .ws-tutor .ws-chips { margin-block-start: var(--lv-s1); }
/* A run of Nova's messages: the AI line stays (it is her disclosure) but compact, without her
   portrait again. */
.ws-v4 .ws-tutor + .ws-tutor { margin-block-start: -4px; }
.ws-v4 .ws-tutor + .ws-tutor > .ws-author .ws-avatar { display: none; }
.ws-v4 .ws-tutor + .ws-tutor > .ws-author .ws-author-name { font-weight: 600; }
/* The child's row spans the reading column, so its bubble aligns to the end edge
   (workspace.css .ws-student draws the bubble). */
.ws-v4 .ws-student { inline-size: 100%; max-inline-size: var(--lv-read); margin-inline: auto; padding: 0; border-radius: 0; background: transparent; color: var(--lv-ink); }
.ws-v4 .ws-student + .ws-student { margin-block-start: -6px; }

/* The inline question message: its card stays distinct (border, title row), with the same rhythm. */
.ws-v4 .lv-msg { margin-block: 0; color: var(--lv-ink); font-size: var(--lv-fs-md); line-height: 1.5; }
.ws-v4 .lv-author { display: flex; align-items: center; gap: var(--lv-s2); margin: 0 0 var(--lv-s1); font-size: var(--lv-fs-sm); }
.ws-v4 .lv-author-ai { color: var(--lv-muted); font-size: var(--lv-fs-xs); }
.ws-v4 .lv-lead { margin-block: 0 var(--lv-s2); }
.ws-v4 .lv-q-card { padding-block: var(--lv-s3); padding-inline: var(--lv-s4); border: 1px solid var(--lv-line); border-radius: var(--lv-r-lg); background: var(--lv-surface); box-shadow: 0 1px 2px rgba(18, 32, 79, 0.05); }
.ws-v4 .lv-question[data-state="solved"] .lv-q-card { border-color: var(--lv-ok); }
.ws-v4 .lv-q-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lv-s2); margin: 0 0 var(--lv-s1); font-size: var(--lv-fs-xs); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--lv-muted); }
.ws-v4 .lv-q-level { font-weight: 500; text-transform: none; letter-spacing: 0; }
.ws-v4 .lv-q-state { margin-inline-start: auto; padding-inline: var(--lv-s2); border-radius: var(--lv-r-pill); background: var(--lv-accent-soft); color: var(--lv-accent-deep); text-transform: none; letter-spacing: 0; }
.ws-v4 .lv-q-state[data-state="answered"] { background: #fff4dc; color: var(--lv-warn-ink); }
.ws-v4 .lv-q-state[data-state="solved"] { background: #e3f5ef; color: var(--lv-ok-ink); }
.ws-v4 .lv-q-state[data-state="solved"]::before { content: "\2713  "; }
.ws-v4 .lv-q-state[data-state="revealed"] { background: #ecebf2; color: var(--lv-ink-soft); }
.ws-v4 .lv-q-text { margin: 0; font-size: var(--lv-fs-md); font-weight: 600; overflow-wrap: anywhere; }
.ws-v4 .lv-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lv-s2); margin-block-start: var(--lv-s3); }
.ws-v4 .lv-option { min-block-size: var(--lv-touch); padding-block: var(--lv-s2); padding-inline: var(--lv-s3); border: 1px solid var(--lv-accent-line); border-radius: var(--lv-r-md); background: var(--lv-surface); color: var(--lv-ink); font: inherit; font-weight: 600; text-align: start; cursor: pointer; overflow-wrap: anywhere; }
.ws-v4 .lv-option:hover:not(:disabled) { background: var(--lv-accent-soft); }
.ws-v4 .lv-option[aria-pressed="true"] { border-width: 2px; border-color: var(--lv-accent); background: var(--lv-accent-soft); }
/* RC5: answered options stay readable (soft ink, full opacity), not faded to low contrast. */
.ws-v4 .lv-option:disabled { opacity: 1; color: var(--lv-ink-soft); cursor: default; }
.ws-v4 .lv-labels { display: flex; flex-wrap: wrap; gap: var(--lv-s1); margin-block-start: var(--lv-s2); }
.ws-v4 .lv-label { padding-inline: var(--lv-s2); border-radius: var(--lv-r-pill); font-size: var(--lv-fs-xs); background: #ecebf2; color: var(--lv-ink-soft); }
.ws-v4 .lv-label-aligned { background: #e3f5ef; color: var(--lv-ok-ink); }
.ws-v4 .lv-label-check { background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
.ws-v4 .lv-q-counts { margin: var(--lv-s1) 0 0; font-size: var(--lv-fs-xs); color: var(--lv-muted); }

/* Compact contextual action chips */
.ws-v4 .lv-chips { display: flex; flex-wrap: wrap; gap: var(--lv-s2); margin-block-start: var(--lv-s2); }
.ws-v4 .lv-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-block-size: var(--lv-chip-h); padding-inline: var(--lv-s3);
  border: 1px solid var(--lv-line); border-radius: var(--lv-r-pill); background: var(--lv-surface);
  color: var(--lv-ink-soft); font: inherit; font-size: var(--lv-fs-sm); font-weight: 600; cursor: pointer;
}
.ws-v4 .lv-chip .lv-icon { inline-size: 16px; block-size: 16px; }
.ws-v4 .lv-chip:hover:not(:disabled) { border-color: var(--lv-accent-line); background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
.ws-v4 .lv-chip[aria-expanded="true"] { border-color: var(--lv-accent); background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
.ws-v4 .lv-chip[aria-disabled="true"] { border-style: dashed; color: var(--lv-muted); }
/* Busy chips: a readable muted label on the quiet surface (RC5: no 0.55 fade to low contrast). */
.ws-v4 .lv-chip:disabled,
.ws-v4 .lv-actions .ws-btn:disabled,
.ws-v4 .lv-offers .ws-btn:disabled { opacity: 1; border-style: dashed; background: var(--lv-side); color: var(--lv-muted); cursor: progress; }
.ws-v4 .lv-chip-primary { border-color: var(--lv-accent); color: var(--lv-accent-deep); }
.ws-v4 .lv-question[data-state="solved"] .lv-chip-primary,
.ws-v4 .lv-question[data-state="revealed"] .lv-chip-primary { background: var(--lv-accent); color: #fff; }

/* The working area opens in place, inside the message */
.ws-v4 .lv-work { margin-block-start: var(--lv-s2); padding: var(--lv-s3); border: 1px solid var(--lv-accent-line); border-radius: var(--lv-r-lg); background: var(--lv-side); }
.ws-v4 .lv-work-foot { display: flex; justify-content: flex-end; margin-block-start: var(--lv-s2); }
.ws-v4 .lv-thread { display: flex; flex-direction: column; gap: var(--lv-s2); margin-block-start: var(--lv-s3); }
.ws-v4 .lv-thread:empty { display: none; }

/* ---------- Phone (below 768 px): Nova a compact strip, sidebars as drawers ---------- */
.ws-v4 .lv-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(18, 32, 79, 0.28); }
.ws-v4 .lv-chapters {
  position: fixed; z-index: 50; inset-block: 0; inset-inline-start: 0;
  inline-size: min(320px, 86vw); box-shadow: var(--lv-shadow);
  transition: transform 180ms ease;
}
.ws-v4 .lv-chapters[data-collapsed="true"] { transform: translateX(-105%); visibility: hidden; }
.ws-v4[dir="rtl"] .lv-chapters[data-collapsed="true"] { transform: translateX(105%); }
/* The right column on a phone: one row (portrait, status, controls) above the lesson. */
.ws-v4 .lv-nova { border-block-end: 1px solid var(--lv-line); }
.ws-v4 .lv-nova .lv-side-head { display: none; }
.ws-v4 .lv-nova[data-collapsed="true"] .lv-side-head { display: flex; flex-direction: row; justify-content: flex-end; }
.ws-v4 .lv-nova .lv-side-body {
  flex-direction: row; flex-wrap: wrap; align-items: center; overflow: visible;
  gap: var(--lv-s1) var(--lv-s2); padding-block: var(--lv-s1); padding-inline: var(--lv-s2);
}
/* nova.css already makes her window a compact strip below 1024 px (a small square portrait). */
.ws-v4 .lv-nova .lv-nova-portrait { flex: 1 1 60%; min-inline-size: 0; background: transparent; }
.ws-v4 .lv-nova .lv-nova-meta { flex: 1 1 120px; flex-direction: column; align-items: flex-start; gap: 0; padding: 0; }
.ws-v4 .lv-nova .lv-ctls { flex: none; }
.ws-v4 .lv-nova .lv-topics-host,
.ws-v4 .lv-nova .lv-side-extra { display: none; }
.ws-v4 .lv-nova[data-expanded="true"] .lv-side-extra { display: flex; }
/* Expand on a phone: Nova and the topics as a sheet from the end edge, the lesson still beside it. */
.ws-v4 .lv-nova[data-expanded="true"] {
  position: fixed; z-index: 50; inset-block: 0; inset-inline-end: 0; inline-size: min(340px, 88vw);
  box-shadow: var(--lv-shadow); overflow-y: auto;
}
.ws-v4 .lv-nova[data-expanded="true"] .lv-side-body { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.ws-v4 .lv-nova[data-expanded="true"] .lv-nova-portrait { inline-size: auto; block-size: auto; border-radius: var(--lv-r-lg); }
.ws-v4 .lv-nova[data-expanded="true"] .lv-nova-meta { flex-direction: row; align-items: center; }
.ws-v4 .lv-nova[data-expanded="true"] .lv-topics-host { display: block; }

@media (pointer: coarse) {
  .ws-v4 { --lv-chip-h: 44px; }
}

@media (max-width: 400px) {
  .ws-v4 .ws-log { padding-inline: var(--lv-s2); }
  .ws-v4 .lv-q-card { padding-inline: var(--lv-s3); }
  .ws-v4 .lv-chip { padding-inline: 10px; }
  .ws-v4 .lv-nova .lv-ctls .lv-ctl { inline-size: 40px; }
}

/* ---------- Tablet and up (768 px): three columns, each side collapsible to a rail ---------- */
@media (min-width: 768px) {
  .ws-v4 .lv-body {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "left main nova";
  }
  .ws-v4 .lv-open-chapters,
  .ws-v4 .lv-drawer-close,
  .ws-v4 [data-ws="nova-expand"] { display: none; }
  .ws-v4 .lv-scrim { display: none; }
  .ws-v4 .lv-chapters {
    grid-area: left; position: relative; inset: auto; z-index: auto; transform: none; visibility: visible;
    inline-size: var(--lv-start-w); box-shadow: none; border-inline-end: 1px solid var(--lv-line);
  }
  .ws-v4 .lv-chapters[data-collapsed="true"],
  .ws-v4[dir="rtl"] .lv-chapters[data-collapsed="true"] { transform: none; visibility: visible; inline-size: var(--lv-rail); }
  .ws-v4 .lv-nova,
  .ws-v4 .lv-nova[data-expanded="true"] {
    grid-area: nova; position: relative; inset: auto; z-index: auto; box-shadow: none;
    inline-size: var(--lv-end-w); border-block-end: 0; border-inline-start: 1px solid var(--lv-line);
  }
  .ws-v4 .lv-nova[data-collapsed="true"] { inline-size: var(--lv-rail); }
  .ws-v4 .lv-nova .lv-side-head { display: flex; justify-content: flex-end; }
  .ws-v4 .lv-nova .lv-side-body,
  .ws-v4 .lv-nova[data-expanded="true"] .lv-side-body { flex-direction: column; flex-wrap: nowrap; align-items: stretch; overflow-y: auto; padding-inline: var(--lv-s3); }
  .ws-v4 .lv-nova .lv-nova-portrait { flex: none; inline-size: auto; block-size: auto; border-radius: var(--lv-r-lg); }
  .ws-v4 .lv-nova .lv-nova-meta { flex: none; flex-direction: row; align-items: center; }
  .ws-v4 .lv-nova .lv-side-extra { display: flex; }
  .ws-v4 .lv-nova .lv-topics-host { display: block; }
  .ws-v4 .lv-q-text { font-size: var(--lv-fs-lg); }
  .ws-v4 .lv-options { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .ws-v4 .ws-log { padding-inline: var(--lv-s5); }
}

/* Tablet portrait: an opened chapter list lies over the conversation's start edge (the rail keeps
   its place, so the lesson never shifts) instead of squeezing the lesson. */
@media (min-width: 768px) and (max-width: 1023px) {
  .ws-v4 { --lv-end-w: 280px; }
  .ws-v4 .lv-chapters[data-collapsed="false"] { margin-inline-end: calc(var(--lv-rail) - var(--lv-start-w)); z-index: 20; box-shadow: var(--lv-shadow); }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .ws-v4 { --lv-start-w: 240px; --lv-end-w: 280px; }
}

/* RC5 U: the right sidebar a little tighter on tablet and up (the portrait and its animation are
   untouched); with a mouse or trackpad its controls and rows are compact, touch keeps 44 px. */
@media (min-width: 768px) {
  .ws-v4 .lv-nova .lv-side-body,
  .ws-v4 .lv-nova[data-expanded="true"] .lv-side-body { gap: 6px; padding-inline: 10px; }
  .ws-v4 .lv-nova .lv-side-head { padding-block: var(--lv-s1); }
  .ws-v4 .lv-nova .lv-topics { gap: 2px; padding-block-start: 6px; }
}
@media (min-width: 768px) and (pointer: fine) {
  .ws-v4 .lv-nova .lv-ctl { inline-size: 38px; block-size: 38px; }
  .ws-v4 .lv-nova .lv-mic-state { inline-size: 32px; block-size: 32px; }
  .ws-v4 .lv-nova .lv-row-main { min-block-size: 36px; padding-block: 4px; }
  .ws-v4 .lv-nova .lv-add { min-block-size: 36px; }
  .ws-v4 .lv-nova .lv-side-extra .ws-concept,
  .ws-v4 .lv-nova .lv-topics .ws-side-tool { min-block-size: 36px; }
}

/* Nova expanded on a laptop: a larger portrait column. */
@media (min-width: 1200px) {
  .ws-v4 .lv-nova[data-expanded="true"] { inline-size: 420px; }
}

@media (max-height: 520px) and (min-width: 768px) {
  .ws-v4 .lv-nova .nova-frame { max-block-size: 40vh; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-v4 .lv-chapters { transition: none; }
}

/* ---------- RC8: stationary Nova, her teaching board, the study-time chip ---------- */
/* docs/coordination/RC8-ARCHITECTURE.md section 1. Nova (portrait, controls, status) and her
   teaching board stay put at the top of the right column; the right column never scrolls as one
   container: only the topics area below them scrolls. The chapters (left) and the conversation
   (centre) scroll on their own; the composer stays at the foot of the centre column. Nova's own
   window (nova.css) is untouched. */
.ws-v4 .lv-body { overflow: hidden; }
.ws-v4 .lv-nova { position: relative; }
.ws-v4 .lv-side-extra:empty { display: none; }
.ws-v4 .lv-topics-host .ws-weak { display: flex; flex-direction: column; gap: var(--lv-s1); margin-block-start: var(--lv-s2); }
.ws-v4 .lv-topics-host .ws-concept { min-block-size: 40px; border-radius: var(--lv-r-sm); }
.ws-v4 .lv-board {
  display: flex; flex-direction: column; gap: var(--lv-s1); min-inline-size: 0;
  border: 1px solid var(--lv-line); border-radius: var(--lv-r-lg); background: var(--lv-surface);
}
/* RC9 UI item 1 (founder: "Replay the board" clipped in narrow sidebars): the header row wraps,
   so Replay and Enlarge move to a second row instead of past the column's clipped inline end. */
.ws-v4 .lv-board-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lv-s1); row-gap: 2px; padding-block: 2px; padding-inline: var(--lv-s2) 2px; }
.ws-v4 .lv-board-title { flex: 1 1 auto; min-inline-size: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--lv-fs-xs); font-weight: 700; color: var(--lv-muted); }
.ws-v4 .lv-board-replay { flex: none; max-inline-size: 100%; min-block-size: var(--lv-chip-h); padding-block: 0; padding-inline: var(--lv-s3); border-radius: var(--lv-r-pill); font-size: var(--lv-fs-xs); }
.ws-v4 .lv-board-toggle {
  display: inline-flex; align-items: center; min-block-size: var(--lv-touch); padding-inline: var(--lv-s3);
  border: 1px solid var(--lv-accent-line); border-radius: var(--lv-r-pill); background: var(--lv-surface);
  color: var(--lv-accent-deep); font: inherit; font-size: var(--lv-fs-sm); font-weight: 600; cursor: pointer;
}
.ws-v4 .lv-board-toggle[aria-expanded="true"] { background: var(--lv-accent-soft); border-color: var(--lv-accent); }
.ws-v4 .lv-board-canvas { position: relative; min-block-size: 0; overflow: hidden; border-radius: 0 0 var(--lv-r-lg) var(--lv-r-lg); }
.ws-v4 .lv-board-sim { flex: 0 1 auto; min-inline-size: 0; overflow-wrap: anywhere; padding-inline: var(--lv-s2); border-radius: var(--lv-r-pill); background: #fff4dc; color: var(--lv-warn-ink); font-size: var(--lv-fs-xs); font-weight: 600; }
/* RC8C P0: flex: none. The caption is a flex item of the board with overflow-y: auto, whose
   automatic minimum size is 0, so the column shrank it until Nova's narration was cut off. */
.ws-v4 .lv-board-say { flex: none; margin: 0; padding-block: 0 var(--lv-s2); padding-inline: var(--lv-s3); color: var(--lv-ink-soft); font-size: var(--lv-fs-xs); overflow-wrap: anywhere; }
/* In the column: the sentence of the step being drawn, whole (all of them on the big board). */
.ws-v4 .lv-nova .lv-board:not([data-enlarged="true"]) .lv-board-say:has(> .lv-say-line[data-current="true"]) > .lv-say-line:not([data-current="true"]) { display: none; }
.ws-v4 .lv-board[data-enlarged="true"] .lv-board-say { font-size: var(--lv-fs-sm); }
.ws-v4 .lv-board[data-enlarged="true"] .lv-say-line[data-current="true"] { font-weight: 700; color: var(--lv-ink); }
.ws-v4 .lv-nova .lv-board:not([data-expanded="true"]) .lv-board-say { display: none; }
.ws-v4 .lv-board-empty { margin: 0; padding-block: 0 var(--lv-s2); padding-inline: var(--lv-s3); color: var(--lv-muted); font-size: var(--lv-fs-xs); }

/* Phone (up to 720 px): a compact strip (small portrait and state) at the top of the conversation
   with the board as a sheet under it: closed, just a "Show Nova's board" pill in the strip; open
   (a tap, or for a few seconds when Nova starts a board sequence), it lies over the start of the
   conversation and scrolls on its own, so the child never scrolls past Nova. */
.ws-v4 .lv-nova .lv-board-slot { flex: 0 1 auto; min-inline-size: 0; }
.ws-v4 .lv-nova .lv-board { border: 0; background: transparent; }
.ws-v4 .lv-nova .lv-board-title,
.ws-v4 .lv-nova .lv-board-replay,
.ws-v4 .lv-nova .lv-board-canvas,
.ws-v4 .lv-nova .lv-board-empty { display: none; }
.ws-v4 .lv-nova .lv-board[data-expanded="true"] {
  position: absolute; z-index: 30; inset-block-start: 100%; inset-inline: var(--lv-s2);
  max-block-size: 55dvh; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--lv-accent-line); background: var(--lv-surface); box-shadow: var(--lv-shadow);
}
.ws-v4 .lv-nova .lv-board[data-expanded="true"] .lv-board-title,
.ws-v4 .lv-nova .lv-board[data-expanded="true"] .lv-board-replay:not([hidden]),
.ws-v4 .lv-nova .lv-board[data-expanded="true"] .lv-board-empty:not([hidden]) { display: block; }
.ws-v4 .lv-nova .lv-board[data-expanded="true"] .lv-board-canvas { display: block; block-size: min(45dvh, 320px); }
.ws-v4 .lv-nova[data-expanded="true"] .lv-board-canvas { display: block; block-size: 240px; }

/* Tablet (721-1023 px): two columns, the conversation and then Nova with her board; the chapters
   are a drawer over the lesson (the chapters button in the top bar opens it). */
@media (min-width: 721px) and (max-width: 1023px) {
  .ws-v4 { --lv-end-w: 300px; }
  .ws-v4 .lv-body {
    grid-template-columns: minmax(0, 1fr) var(--lv-end-w);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "main nova";
  }
  .ws-v4 .lv-open-chapters,
  .ws-v4 .lv-drawer-close { display: inline-grid; }
  .ws-v4 .lv-scrim:not([hidden]) { display: block; }
  .ws-v4 .lv-chapters,
  .ws-v4 .lv-chapters[data-collapsed="false"] {
    grid-area: auto; position: fixed; z-index: 50; inset-block: 0; inset-inline-start: 0;
    inline-size: min(320px, 86vw); margin-inline-end: 0; border-inline-end: 0; box-shadow: var(--lv-shadow);
  }
  .ws-v4 .lv-chapters[data-collapsed="true"] { inline-size: min(320px, 86vw); transform: translateX(-105%); visibility: hidden; }
  .ws-v4[dir="rtl"] .lv-chapters[data-collapsed="true"] { transform: translateX(105%); }
  .ws-v4 .lv-nova,
  .ws-v4 .lv-nova[data-expanded="true"] {
    grid-area: nova; position: relative; inset: auto; z-index: auto; box-shadow: none;
    inline-size: auto; border-block-end: 0; border-inline-start: 1px solid var(--lv-line);
  }
  .ws-v4 [data-ws="nova-expand"] { display: none; }
  .ws-v4 .lv-nova .lv-side-head { display: flex; justify-content: flex-end; }
  .ws-v4 .lv-nova .lv-side-body,
  .ws-v4 .lv-nova[data-expanded="true"] .lv-side-body { flex-direction: column; flex-wrap: nowrap; align-items: stretch; padding-inline: 10px; }
  .ws-v4 .lv-nova .lv-nova-portrait { flex: none; inline-size: auto; block-size: auto; border-radius: var(--lv-r-lg); }
  .ws-v4 .lv-nova .lv-nova-meta { flex: none; flex-direction: row; align-items: center; }
  .ws-v4 .lv-nova .lv-topics-host { display: block; }
}

/* Tablet and desktop (from 721 px). RC8C (founder finding F10, directive P7): the RC8 stack made
   this column a clipping box (overflow: hidden, every part flex: none, a 150 px board floor), so
   the board pushed Practice Questions and Mock Test out of sight. Now Nova stays put at the top
   (sticky), the BOARD is the part that gives way (flexible, min 0, a ceiling), the chapter tools
   keep their size, and if the column still cannot fit, it scrolls on its own: never clipped. */
@media (min-width: 721px) {
  .ws-v4 .lv-nova .lv-side-body,
  .ws-v4 .lv-nova[data-expanded="true"] .lv-side-body { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
  .ws-v4 .lv-nova .lv-nova-portrait,
  .ws-v4 .lv-nova .lv-ctls,
  .ws-v4 .lv-nova .lv-nova-meta { flex: none; }
  .ws-v4 .lv-nova .lv-nova-portrait { position: sticky; inset-block-start: 0; z-index: 2; }
  /* RC8C recovery (F10, item 5 in docs/coordination/rc8c-recovery/ws-d.md): the board gives way down
     to its own minimum (bar + canvas floor + an empty-state line), never below it; then the column
     scrolls. With a floor of 0 the slot shrank under the board at short windows (1280x640, phone
     landscape) and the board spilled over Chapter Notes and Practice Questions. */
  .ws-v4 .lv-nova .lv-board-slot { flex: 1 1 auto; min-block-size: calc(var(--lv-chip-h) + 96px + 4rem); display: flex; flex-direction: column; }
  .ws-v4 .lv-nova .lv-board-slot > .lv-board { flex: 1 1 auto; min-block-size: 0; }
  .ws-v4 .lv-nova .lv-chapter-tools,
  .ws-v4 .lv-nova .lv-chapter-notes { flex: none; }
  /* The pre-RC8C column (topics on the right, before workspace.js moves them): the topics and
     the tools at their foot take their own height and the column scrolls to them. */
  .ws-v4 .lv-nova .lv-topics-host { flex: none; min-block-size: 0; overflow: visible; }
  .ws-v4 .lv-nova .lv-board { border: 1px solid var(--lv-line); background: var(--lv-surface); }
  .ws-v4 .lv-nova .lv-board-title { display: block; }
  .ws-v4 .lv-nova .lv-board-replay:not([hidden]) { display: inline-flex; }
  .ws-v4 .lv-nova .lv-board-empty:not([hidden]) { display: block; }
  .ws-v4 .lv-nova .lv-board-canvas { display: block; flex: 1 1 auto; block-size: auto; min-block-size: 96px; max-block-size: min(32vh, 260px); }
  /* RC8C recovery (workstream D; real browser 20261128T103636Z G3-tools-desktop and
     -phone-landscape: "[data-classroom=teaching-board] svg" clipped by div.lv-board-canvas). The
     canvas gives way (flex, floor 96 px, ceiling above) but the drawing kept its own height (its
     width x 0.625, 183 px at 1366x768) and the canvas (overflow: hidden) cut its lower part off.
     Now the drawing fills the canvas and scales inside it (viewBox, preserveAspectRatio meet):
     smaller when space is short, never cut. Its proportions stay the canvas's preferred height. */
  .ws-v4 .lv-nova .lv-board-canvas:has(> .tb) { aspect-ratio: 1000 / 625; }
  .ws-v4 .lv-nova .lv-board-canvas > .tb { position: absolute; inset: 0; inline-size: auto; block-size: auto; }
  .ws-v4 .lv-nova .lv-board-canvas > .tb > .tb-svg { block-size: 100%; max-block-size: none; }
  .ws-v4 .lv-nova .lv-board-toggle { display: none; }
  /* RC9 UI item 3 (founder: board narration partly hidden): 4.5em (about 3 lines) cut a sentence
     of up to 300 characters inside an invisible touch scroller. 7.5em holds it in the column
     (still bounded: the column keeps its tools), and the slot reserves the caption's room only
     while a caption is shown (the base floor above is unchanged), so the board, not the words,
     gives way and Chapter Notes never paints over the narration. */
  .ws-v4 .lv-nova .lv-board .lv-board-say:not([hidden]) { display: block; max-block-size: 7.5em; overflow-y: auto; }
  .ws-v4 .lv-nova .lv-board-slot:has(.lv-board-say:not([hidden])) { min-block-size: calc(var(--lv-chip-h) + 96px + 4rem + 6.5rem); }
}
@media (min-width: 721px) and (max-height: 640px) {
  .ws-v4 .lv-nova .lv-board-canvas { min-block-size: 80px; max-block-size: min(26vh, 180px); }
  .ws-v4 .lv-nova .lv-board-slot { min-block-size: calc(var(--lv-chip-h) + 80px + 4rem); }
  .ws-v4 .lv-nova .lv-board-slot:has(.lv-board-say:not([hidden])) { min-block-size: calc(var(--lv-chip-h) + 80px + 4rem + 6.5rem); }
}
/* RC9 UI item 3 (phone, up to 720 px): the open sheet (55dvh) put the caption below its fold under
   a min(45dvh, 320px) canvas; with a caption shown the canvas is shorter and the drawing scales
   inside it (as from 721 px: viewBox, preserveAspectRatio meet), never cut. */
@media (max-width: 720px) {
  .ws-v4 .lv-nova:not([data-expanded="true"]) .lv-board[data-expanded="true"]:not([data-enlarged="true"]):has(.lv-board-say:not([hidden])) .lv-board-canvas { block-size: min(34dvh, 320px); }
  .ws-v4 .lv-nova:not([data-expanded="true"]) .lv-board[data-expanded="true"]:not([data-enlarged="true"]):has(.lv-board-say:not([hidden])) .lv-board-canvas > .tb { position: absolute; inset: 0; inline-size: auto; block-size: auto; }
  .ws-v4 .lv-nova:not([data-expanded="true"]) .lv-board[data-expanded="true"]:not([data-enlarged="true"]):has(.lv-board-say:not([hidden])) .lv-board-canvas > .tb > .tb-svg { block-size: 100%; max-block-size: none; }
}

/* The study-time chip in the top bar (public/top-timer.js): a clock, the time, a dot (filled:
   counting; dashed ring: waiting; hollow ring: paused: a shape, never colour alone), Pause/Resume. */
.ws-v4 .ws-top-timer-slot { display: contents; }
.ws-v4 .ws-top-timer {
  display: inline-flex; align-items: center; gap: 6px; min-block-size: 40px; padding-inline: 10px 2px;
  border: 1px solid var(--lv-line); border-radius: var(--lv-r-pill); background: var(--lv-surface);
  color: var(--lv-ink-soft); font-size: var(--lv-fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ws-v4 .ws-top-timer-icon { inline-size: 16px; block-size: 16px; fill: currentColor; flex: none; }
.ws-v4 .ws-top-timer-dot { inline-size: 8px; block-size: 8px; flex: none; border-radius: 50%; background: var(--lv-ok); }
.ws-v4 .ws-top-timer-dot[data-state="waiting"] { background: transparent; border: 2px dashed var(--lv-muted); }
.ws-v4 .ws-top-timer-dot[data-state="paused"] { background: transparent; box-shadow: inset 0 0 0 2px var(--lv-muted); }
.ws-v4 .ws-top-timer-value { unicode-bidi: isolate; direction: ltr; }
.ws-v4 .ws-top-timer-note { max-inline-size: 18ch; overflow: hidden; text-overflow: ellipsis; font-size: var(--lv-fs-xs); font-weight: 500; color: var(--lv-muted); }
.ws-v4 .ws-top-timer-btn {
  display: inline-grid; place-items: center; flex: none; inline-size: 36px; block-size: 36px;
  border: 0; border-radius: 50%; background: transparent; color: var(--lv-ink-soft); cursor: pointer;
}
.ws-v4 .ws-top-timer-btn:hover,
.ws-v4 .ws-top-timer-btn[aria-pressed="true"] { background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
.ws-v4 .ws-top-timer-btn-icon { inline-size: 18px; block-size: 18px; fill: currentColor; }
@media (pointer: coarse) {
  .ws-v4 .ws-top-timer { min-block-size: var(--lv-touch); }
  .ws-v4 .ws-top-timer-btn { inline-size: var(--lv-touch); block-size: var(--lv-touch); margin-block: -2px; }
}
@media (max-width: 480px) {
  .ws-v4 .ws-top-timer-icon,
  .ws-v4 .ws-top-timer-note { display: none; }
}

@media (forced-colors: active) {
  .ws-v4 .ws-top-timer-dot { forced-color-adjust: none; }
  .ws-v4 .lv-board { border: 1px solid CanvasText; }
  .ws-v4 .lv-row[data-active="true"],
  .ws-v4 .lv-row[data-current="true"] { outline: 2px solid CanvasText; }
  .ws-v4 .lv-bar::after,
  .ws-v4 .lv-mark { forced-color-adjust: none; }
  .ws-v4 .lv-chip,
  .ws-v4 .lv-option { border: 1px solid ButtonText; }
}

/* ======================================================================================
   RC8C (founder directive 2026-11-27, P7-P9; stream C findings C1-C6). Opt-in by markup:
   the portrait overlay (nova-sidebar.js overlay), the chapter tools row and Chapter Notes,
   nested chapter groups (lesson-sidebar.js nested), the board's Enlarge, and the composer's
   photo staging (attach-stage.js). Colours: the existing tokens; statuses are a shape or a
   word as well as a colour. Logical properties throughout (right to left ready).
   ====================================================================================== */

/* ---------- Nova's portrait: compact controls ON it (no rows of their own) ---------- */
.ws-v4 .lv-nova .lv-nova-portrait { position: relative; }
/* RC8C recovery round 2 (WS-L2; real browser 20261128T145050Z G3-tools-desktop-short 1280x640 and
   G3-tools-phone-landscape 780x360: "[data-nova=frame]" cut off once the column scrolled to Mock
   Test; screenshot G3-tools-desktop-short-measured: Nova's portrait half under the top bar). From
   721 px F10 makes the portrait sticky so Nova stays put when the column scrolls, but the rule just
   above (same weight, later in the file) turned it back to relative, so Nova scrolled away with
   the column. Sticky is a positioned box too, so the overlay still anchors on the portrait. The
   column's own background keeps what scrolls under her from showing through the compact strip. */
@media (min-width: 721px) {
  .ws-v4 .lv-nova .lv-nova-portrait { position: sticky; inset-block-start: 0; z-index: 2; background: var(--lv-side); }
}
.ws-v4 .lv-portrait-ctls {
  position: absolute; z-index: 3; inset-block-start: 6px; inset-inline-end: 6px;
  display: flex; align-items: center; gap: 2px; max-inline-size: calc(100% - 12px);
  padding: 2px; border-radius: var(--lv-r-pill); background: rgba(12, 16, 40, 0.58); color: #ffffff;
}
.ws-v4 .lv-portrait-ctls .lv-side-head,
.ws-v4 .lv-nova .lv-portrait-ctls .lv-side-head { padding: 0; gap: 0; }
.ws-v4 .lv-portrait-ctls .lv-ctls { padding: 0; gap: 2px; }
.ws-v4 .lv-portrait-ctls .lv-icon-btn,
.ws-v4 .lv-portrait-ctls .lv-ctl { inline-size: 36px; block-size: 36px; border-radius: 50%; color: inherit; }
.ws-v4 .lv-portrait-ctls .lv-icon-btn:hover,
.ws-v4 .lv-portrait-ctls .lv-ctl:hover { background: rgba(255, 255, 255, 0.18); color: #ffffff; }
/* D-C1 (a): Nova's own mic button in her window is the portrait's mic; the read-only state dot
   would say the same thing twice. */
.ws-v4 .lv-portrait-ctls .lv-mic-state { display: none; }
.ws-v4 .lv-portrait-ctls .lv-nova-meta { padding-inline: 6px 8px; color: inherit; }
.ws-v4 .lv-portrait-ctls .lv-nova-status { font-size: var(--lv-fs-xs); white-space: nowrap; }
.ws-v4 .lv-portrait-ctls .lv-timer[hidden] { display: none; }
@media (pointer: coarse) {
  .ws-v4 .lv-portrait-ctls .lv-icon-btn,
  .ws-v4 .lv-portrait-ctls .lv-ctl { inline-size: var(--lv-touch); block-size: var(--lv-touch); }
}
/* Below 1024 px Nova's window is a compact strip (nova.css): the controls sit at its end, in line. */
@media (max-width: 1023px) {
  .ws-v4 .lv-nova .lv-nova-portrait:has(> .lv-portrait-ctls) { display: flex; align-items: center; gap: var(--lv-s2); }
  .ws-v4 .lv-nova .lv-nova-portrait > .nova { flex: 1 1 auto; min-inline-size: 0; }
  .ws-v4 .lv-portrait-ctls { position: static; flex: none; background: transparent; color: var(--lv-ink-soft); }
  .ws-v4 .lv-portrait-ctls .lv-icon-btn:hover,
  .ws-v4 .lv-portrait-ctls .lv-ctl:hover { background: var(--lv-accent-soft); color: var(--lv-accent-deep); }
  .ws-v4 .lv-portrait-ctls .lv-nova-meta { display: none; }
}

/* ---------- The chapter tools row: Chapter Notes, Practice Questions, Mock Test ---------- */
.ws-v4 .lv-chapter-tools .ws-side-tools { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ws-v4 .lv-chapter-tools .ws-side-tools > li { flex: 1 1 auto; min-inline-size: 0; }
.ws-v4 .lv-chapter-tools .ws-side-tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; inline-size: 100%;
  min-block-size: 36px; padding-inline: 10px; border: 1px solid var(--lv-accent-line); border-radius: var(--lv-r-pill);
  background: var(--lv-surface); color: var(--lv-accent-deep); font: inherit; font-size: var(--lv-fs-sm); font-weight: 600; cursor: pointer;
}
.ws-v4 .lv-chapter-tools .ws-side-tool:hover { background: var(--lv-accent-soft); }
.ws-v4 .lv-chapter-tools .ws-side-text { display: inline; min-inline-size: 0; overflow-wrap: anywhere; }
.ws-v4 .lv-chapter-tools .ws-side-help { display: none; }
.ws-v4 .lv-chapter-tools .lv-icon { inline-size: 16px; block-size: 16px; }
@media (pointer: coarse) {
  .ws-v4 .lv-chapter-tools .ws-side-tool { min-block-size: var(--lv-touch); }
}
/* Phones: the strip stays one compact row; the tools and the notes are in Nova's sheet (Expand). */
@media (max-width: 720px) {
  .ws-v4 .lv-nova:not([data-expanded="true"]) .lv-chapter-tools,
  .ws-v4 .lv-nova:not([data-expanded="true"]) .lv-chapter-notes { display: none; }
}

/* ---------- Nova's board: Enlarge (an accessible overlay, never a taller column) ---------- */
.ws-v4 .lv-board-enlarge { min-block-size: var(--lv-chip-h); padding-block: 0; padding-inline: var(--lv-s3); border-radius: var(--lv-r-pill); font-size: var(--lv-fs-xs); }
/* RC8C P0 (founder: "the expanded board hides Nova"): the big board ends where Nova's dock
   (public/board-stage.js) begins: from 721 px a compact column at the inline end (the board keeps
   about 76-80 % of the width), on a phone a compact tile above the board. Her own portrait is
   moved into the dock, never copied. */
.ws-v4 { --lv-dock-w: clamp(200px, 20vw, 300px); --lv-dock-h: 128px; }
.ws-v4 .lv-board[data-enlarged="true"],
.ws-v4 .lv-nova .lv-board[data-enlarged="true"] {
  position: fixed; z-index: 60; inset-block: 4dvh; inset-inline-start: 2vw; inset-inline-end: calc(2vw + var(--lv-dock-w) + 12px); max-block-size: none;
  display: flex; flex-direction: column; overflow: auto;
  border: 1px solid var(--lv-accent-line); background: var(--lv-surface); box-shadow: var(--lv-shadow);
}
.ws-v4 .lv-board-dock {
  position: fixed; z-index: 61; inset-block: 4dvh; inset-inline-end: 2vw; inline-size: var(--lv-dock-w);
  display: flex; flex-direction: column; gap: var(--lv-s2); padding: var(--lv-s2);
  overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--lv-accent-line); border-radius: var(--lv-r-lg); background: var(--lv-surface); box-shadow: var(--lv-shadow);
}
.ws-v4 .lv-board-dock[hidden] { display: none; }
.ws-v4 .lv-board-dock .lv-dock-nova { flex: none; min-inline-size: 0; }
.ws-v4 .lv-board-dock .lv-nova-portrait { position: relative; inline-size: 100%; border-radius: var(--lv-r-lg); overflow: hidden; }
.ws-v4 .lv-board-dock .nova-frame { max-block-size: 40dvh; }
.ws-v4 .lv-board-dock .lv-toggle,
.ws-v4 .lv-board-dock [data-ws="nova-expand"] { display: none; }
.ws-v4 .lv-dock-ask { display: flex; gap: var(--lv-s1); align-items: flex-end; min-inline-size: 0; }
.ws-v4 .lv-dock-ask .ws-input { flex: 1 1 auto; min-inline-size: 0; min-block-size: var(--lv-touch); resize: none; font: inherit; font-size: var(--lv-fs-sm); }
.ws-v4 .lv-dock-send,
.ws-v4 .lv-dock-close { min-block-size: var(--lv-touch); }
@media (max-width: 720px) {
  /* Integration review S1: room for Nova's tile and the question box on one row, close on the next. */
  .ws-v4 { --lv-dock-h: 176px; }
  .ws-v4 .lv-board[data-enlarged="true"],
  .ws-v4 .lv-nova .lv-board[data-enlarged="true"] { inset-block: calc(2dvh + var(--lv-dock-h) + 8px) 2dvh; inset-inline: 2vw; }
  .ws-v4 .lv-board-dock { inset-block: 2dvh auto; inset-inline: 2vw; inline-size: auto; max-block-size: var(--lv-dock-h); flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ws-v4 .lv-board-dock .lv-dock-nova { inline-size: 72px; }
  .ws-v4 .lv-board-dock .lv-nova-portrait { block-size: 72px; }
  .ws-v4 .lv-board-dock .lv-dock-ask { flex: 1 1 160px; }
}
.ws-v4 .lv-nova .lv-board[data-enlarged="true"] .lv-board-canvas { display: block; flex: 1 1 auto; block-size: auto; min-block-size: 0; max-block-size: none; }
.ws-v4 .lv-nova .lv-board[data-enlarged="true"] .lv-board-title,
.ws-v4 .lv-nova .lv-board[data-enlarged="true"] .lv-board-say:not([hidden]) { display: block; max-block-size: none; }
.ws-v4 .lv-board-scrim { position: fixed; inset: 0; z-index: 59; background: rgba(18, 32, 79, 0.45); }
.ws-v4 .lv-board-scrim[hidden] { display: none; }

/* ---------- Left: chapter groups with their topics nested ---------- */
.ws-v4 .lv-group-row { flex-wrap: wrap; }
.ws-v4 .lv-group-row > .lv-row-main { flex: 1 1 0; }
.ws-v4 .lv-chapters .lv-rows:not(.lv-chapter-topics) > .lv-row > .lv-row-main { grid-template-areas: "mark title tag" "mark prov prov" "mark bar bar"; }
.ws-v4 .lv-disclose { inline-size: 36px; color: var(--lv-muted); }
.ws-v4 .lv-disclose .lv-icon { inline-size: 14px; block-size: 14px; transition: transform 120ms ease; }
.ws-v4 .lv-group-row[data-open="true"] > .lv-disclose .lv-icon { transform: rotate(90deg); }
.ws-v4[dir="rtl"] .lv-group-row:not([data-open="true"]) > .lv-disclose .lv-icon { transform: rotate(180deg); }
.ws-v4 .lv-prov { grid-area: prov; justify-self: start; background: #ecebf2; color: var(--lv-ink-soft); }
.ws-v4 .lv-prov[data-provenance="verified"] { background: #e3f5ef; color: var(--lv-ok-ink); }
.ws-v4 .lv-prov[data-provenance="draft"] { background: #fff4dc; color: var(--lv-warn-ink); }
.ws-v4 .lv-chapter-topics { flex: 1 0 100%; margin-block: 0 var(--lv-s1); padding-inline-start: 28px; }
.ws-v4 .lv-chapter-topics[hidden] { display: none; }
.ws-v4 .lv-chapter-topics .lv-row-main { grid-template-areas: "mark title tag"; min-block-size: 40px; }
.ws-v4 .lv-chapter-topics .lv-empty { padding-block: var(--lv-s1); font-size: var(--lv-fs-xs); }
@media (pointer: coarse) {
  .ws-v4 .lv-disclose { inline-size: var(--lv-touch); }
  .ws-v4 .lv-chapter-topics .lv-row-main { min-block-size: var(--lv-touch); }
}

/* ---------- Composer: the photo staging strip ---------- */
.ws-v4 .lv-att {
  display: flex; flex-direction: column; gap: var(--lv-s1); margin-block-end: 6px; padding: 6px var(--lv-s2);
  border: 1px dashed var(--lv-accent-line); border-radius: var(--lv-r-md); background: var(--lv-side);
}
.ws-v4 .lv-att[hidden],
.ws-v4 .lv-att-confirm[hidden],
.ws-v4 .lv-att-note[hidden],
.ws-v4 .lv-att-dest[hidden],
.ws-v4 .lv-att-preview[hidden],
.ws-v4 .lv-att-add[hidden],
.ws-v4 .lv-att-item .lv-chip[hidden] { display: none; }
.ws-v4 .lv-att-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--lv-s3); font-size: var(--lv-fs-xs); }
.ws-v4 .lv-att-title { margin: 0; font-weight: 700; color: var(--lv-ink); }
.ws-v4 .lv-att-dest { margin: 0; color: var(--lv-ink-soft); unicode-bidi: isolate; overflow-wrap: anywhere; }
.ws-v4 .lv-att-row { display: flex; align-items: flex-start; gap: 6px; overflow-x: auto; padding-block: 6px 2px; scroll-snap-type: x proximity; }
/* RC8C recovery (workstream C P7): attach-stage.js wraps the thumbnails row and Add in .lv-att-strip;
   Add stays beside the thumbnails and only the thumbnails scroll. */
.ws-v4 .lv-att-strip { display: flex; align-items: flex-start; gap: 6px; }
.ws-v4 .lv-att-strip > .lv-att-row { flex: 1 1 auto; min-inline-size: 0; }
.ws-v4 .lv-att-strip > .lv-att-add { margin-block-start: 6px; }
.ws-v4 .lv-att-list,
.ws-v4 .lv-att-grid { list-style: none; margin: 0; padding: 0; }
.ws-v4 .lv-att-list { display: flex; gap: var(--lv-s2); }
.ws-v4 .lv-att-item { position: relative; flex: none; inline-size: 64px; scroll-snap-align: start; }
.ws-v4 .lv-att-open {
  display: block; inline-size: 64px; block-size: 64px; padding: 0; overflow: hidden;
  border: 1px solid var(--lv-line); border-radius: var(--lv-r-sm); background: var(--lv-surface); cursor: zoom-in;
}
.ws-v4 .lv-att-open:disabled { cursor: progress; }
.ws-v4 .lv-att-img { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; }
.ws-v4 .lv-att-ph { display: grid; place-items: center; inline-size: 100%; aspect-ratio: 1; color: var(--lv-muted); }
.ws-v4 .lv-att-rm {
  position: absolute; inset-block-start: -6px; inset-inline-end: -6px; display: grid; place-items: center;
  inline-size: 30px; block-size: 30px; padding: 0; border: 2px solid #ffffff; border-radius: 50%;
  background: var(--lv-ink); color: #ffffff; cursor: pointer;
}
.ws-v4 .lv-att-rm::after { content: ""; position: absolute; inset: -7px; } /* a 44 px touch target */
.ws-v4 .lv-att-rm .lv-icon { inline-size: 16px; block-size: 16px; transform: rotate(45deg); }
.ws-v4 .lv-att-rm:disabled { opacity: 0.45; cursor: not-allowed; }
.ws-v4 .lv-att-status { display: block; margin-block-start: 2px; font-size: 0.6875rem; line-height: 1.2; text-align: center; color: var(--lv-muted); overflow-wrap: anywhere; }
.ws-v4 .lv-att-status:empty { display: none; }
.ws-v4 .lv-att-status[data-status="ready"],
.ws-v4 .lv-att-status[data-status="done"] { color: var(--lv-ok-ink); }
.ws-v4 .lv-att-status[data-status="failed"] { color: var(--lv-warn-ink); font-weight: 700; }
.ws-v4 .lv-att-status[data-status="failed"]::before { content: "! "; }
.ws-v4 .lv-att-item[data-status="failed"] .lv-att-open { border: 2px dashed var(--lv-weak); }
.ws-v4 .lv-att-add {
  flex: none; display: grid; place-items: center; inline-size: 64px; block-size: 64px;
  border: 1px dashed var(--lv-accent); border-radius: var(--lv-r-sm); background: transparent; color: var(--lv-accent-deep); cursor: pointer;
}
.ws-v4 .lv-att-add:hover { background: var(--lv-accent-soft); }
.ws-v4 .lv-att-hint,
.ws-v4 .lv-att-note { margin: 0; font-size: var(--lv-fs-xs); color: var(--lv-ink-soft); }
.ws-v4 .lv-att-note { color: var(--lv-warn-ink); }
.ws-v4 .lv-att-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--lv-fs-sm); }
.ws-v4 .lv-att-confirm-text { flex: 1 1 100%; }
/* The larger preview: a dialog over the whole page. */
.ws-v4 .lv-att-preview {
  position: fixed; z-index: 70; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--lv-s3); padding: var(--lv-s4); background: rgba(12, 16, 40, 0.86); color: #ffffff;
}
.ws-v4 .lv-att-pv-title { margin: 0; font-weight: 700; }
.ws-v4 .lv-att-pv-img { max-inline-size: 100%; max-block-size: 72dvh; object-fit: contain; border-radius: var(--lv-r-md); background: #ffffff; }
.ws-v4 .lv-att-pv-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--lv-s2); }

/* C-ATTACH-2: reorder (Earlier / Later; drag where a pointer can) on each staged page. */
.ws-v4 .lv-att-moves { display: flex; justify-content: space-between; margin-block-start: 2px; }
.ws-v4 .lv-att-move {
  display: grid; place-items: center; inline-size: 30px; block-size: 28px; padding: 0;
  border: 1px solid var(--lv-line); border-radius: var(--lv-r-sm); background: var(--lv-surface); color: var(--lv-ink-soft); cursor: pointer;
}
.ws-v4 .lv-att-move .lv-icon { inline-size: 14px; block-size: 14px; transform: rotate(180deg); }
.ws-v4 .lv-att-move-later .lv-icon { transform: none; }
.ws-v4[dir="rtl"] .lv-att-move .lv-icon { transform: none; }
.ws-v4[dir="rtl"] .lv-att-move-later .lv-icon { transform: rotate(180deg); }
.ws-v4 .lv-att-move:disabled { opacity: 0.4; cursor: default; }
.ws-v4 .lv-att-item[draggable="true"] { cursor: grab; }
@media (pointer: coarse) {
  .ws-v4 .lv-att-move { block-size: 36px; }
}

/* ---------- Conversation: one grouped photo message ---------- */
.ws-v4 .lv-att-msg { display: flex; flex-direction: column; align-items: flex-end; gap: var(--lv-s1); }
.ws-v4 .lv-att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 96px)); justify-content: end; gap: 6px; inline-size: min(100%, 420px); }
.ws-v4 .lv-att-msg .lv-att-item { inline-size: auto; }
.ws-v4 .lv-att-msg .lv-att-open { inline-size: 100%; block-size: auto; aspect-ratio: 1; }
.ws-v4 .lv-att-msg .lv-att-ph { border: 1px dashed var(--lv-line); border-radius: var(--lv-r-sm); background: var(--lv-side); }
.ws-v4 .lv-att-msg .lv-chip { margin-block-start: 2px; inline-size: 100%; justify-content: center; }
.ws-v4 .lv-att-store { margin: 0; max-inline-size: 420px; font-size: var(--lv-fs-xs); color: var(--lv-muted); text-align: end; }
.ws-v4 .lv-att-msg .lv-att-moves { display: none; } /* reordering is before sending only */
.ws-v4 .lv-att-progress { margin: 0; font-size: var(--lv-fs-sm); font-weight: 600; color: var(--lv-ink-soft); }
.ws-v4 .lv-att-failed { color: var(--lv-warn-ink); }
.ws-v4 .lv-att-batches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ws-v4 .lv-att-wait { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-inline-size: 420px; padding: var(--lv-s2); border: 1px dashed var(--lv-learn); border-radius: var(--lv-r-md); background: var(--lv-surface); }
.ws-v4 .lv-att-waiting { margin: 0; font-size: var(--lv-fs-sm); color: var(--lv-ink); }
.ws-v4 .lv-att-progress[hidden],
.ws-v4 .lv-att-failed[hidden],
.ws-v4 .lv-att-batches[hidden],
.ws-v4 .lv-att-wait[hidden] { display: none; }
.ws-v4 .lv-att-status[data-status="waiting"] { color: var(--lv-learn); }
.ws-v4 .lv-att-status[data-status="waiting"]::before { content: "\2026 "; }

/* RC8C S3: the larger view of a sent or saved photo (the preview dialog's look, over everything). */
.ws-v4 .lv-photo-viewer { z-index: 72; }
.ws-v4 .lv-photo-viewer[hidden] { display: none; }

/* RC8C B4a: the conversation from before this update, read-only and collapsed at the top. */
.ws-v4 .lv-legacy { display: flex; flex-direction: column; gap: var(--lv-s1); padding: var(--lv-s2); border: 1px dashed var(--lv-line); border-radius: var(--lv-r-md); background: var(--lv-side); }
.ws-v4 .lv-legacy-toggle {
  display: flex; align-items: center; gap: 6px; inline-size: 100%; min-block-size: 40px; padding-inline: var(--lv-s1);
  border: 0; border-radius: var(--lv-r-sm); background: transparent; color: var(--lv-ink-soft); font: inherit; font-weight: 700; text-align: start; cursor: pointer;
}
.ws-v4 .lv-legacy-toggle:hover { background: var(--lv-accent-soft); }
.ws-v4 .lv-legacy-toggle .lv-icon { inline-size: 14px; block-size: 14px; transition: transform 120ms ease; }
.ws-v4 .lv-legacy-toggle[aria-expanded="true"] .lv-icon { transform: rotate(90deg); }
.ws-v4[dir="rtl"] .lv-legacy-toggle[aria-expanded="false"] .lv-icon { transform: rotate(180deg); }
.ws-v4 .lv-legacy-note { margin: 0; font-size: var(--lv-fs-xs); color: var(--lv-muted); }
.ws-v4 .lv-legacy-body { display: flex; flex-direction: column; gap: 10px; opacity: 0.92; }
.ws-v4 .lv-legacy-body[hidden] { display: none; }
@media (pointer: coarse) {
  .ws-v4 .lv-legacy-toggle { min-block-size: var(--lv-touch); }
}
@media (prefers-reduced-motion: reduce) {
  .ws-v4 .lv-legacy-toggle .lv-icon { transition: none; }
}

/* ---------- Right column: Chapter Notes (P9) ---------- */
.ws-v4 .lv-chapter-notes { display: flex; flex-direction: column; gap: 2px; padding-block-start: 6px; border-block-start: 1px solid var(--lv-line); }
.ws-v4 .lv-notes-toggle {
  display: flex; align-items: center; gap: 6px; inline-size: 100%; min-block-size: 40px; padding-inline: var(--lv-s1);
  border: 0; border-radius: var(--lv-r-sm); background: transparent; color: var(--lv-ink); font: inherit; font-weight: 700; text-align: start; cursor: pointer;
}
.ws-v4 .lv-notes-toggle:hover { background: var(--lv-accent-soft); }
.ws-v4 .lv-notes-toggle .lv-icon { inline-size: 14px; block-size: 14px; transition: transform 120ms ease; }
.ws-v4 .lv-notes-toggle[aria-expanded="true"] .lv-icon { transform: rotate(90deg); }
.ws-v4[dir="rtl"] .lv-notes-toggle[aria-expanded="false"] .lv-icon { transform: rotate(180deg); }
.ws-v4 .lv-notes-title { flex: 1 1 auto; min-inline-size: 0; overflow-wrap: anywhere; }
.ws-v4 .lv-notes-count { flex: none; font-weight: 600; color: var(--lv-muted); }
.ws-v4 .lv-notes-gated { margin: 0; padding-inline: var(--lv-s1); font-size: var(--lv-fs-xs); color: var(--lv-warn-ink); }
.ws-v4 .lv-notes-gated[hidden],
.ws-v4 .lv-notes-body[hidden],
.ws-v4 .lv-chapter-notes .lv-empty[hidden] { display: none; }
.ws-v4 .lv-notes-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; list-style: none; margin: 0; padding: var(--lv-s1); }
.ws-v4 .lv-notes-open { display: flex; flex-direction: column; gap: 2px; inline-size: 100%; padding: 0; border: 0; background: transparent; color: var(--lv-ink-soft); font: inherit; font-size: var(--lv-fs-xs); cursor: zoom-in; }
.ws-v4 .lv-notes-img { display: block; inline-size: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--lv-line); border-radius: var(--lv-r-sm); }
.ws-v4 .lv-notes-label { overflow-wrap: anywhere; }
@media (pointer: coarse) {
  .ws-v4 .lv-notes-toggle { min-block-size: var(--lv-touch); }
}

/* ---------- Phone landscape: the conversation and a narrow Nova column side by side ---------- */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1023px) {
  .ws-v4 .lv-body { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); grid-template-areas: "main nova"; }
  .ws-v4 .lv-nova,
  .ws-v4 .lv-nova[data-expanded="true"] {
    grid-area: nova; position: relative; inset: auto; z-index: auto; box-shadow: none;
    /* RC8C recovery (round 2): 200 px was narrower than Nova's strip (portrait 52 px, her name bar
       with two 44 px controls, the column toggle: about 208 px + 12 px padding), so the column
       (overflow-x: hidden) cut her AI status label at
       the right edge (780x360 screenshot). 232 px holds the strip; the label then wraps inside. */
    inline-size: auto; max-inline-size: 232px; border-block-end: 0; border-inline-start: 1px solid var(--lv-line);
  }
  .ws-v4 .lv-nova .lv-side-body,
  .ws-v4 .lv-nova[data-expanded="true"] .lv-side-body { flex-direction: column; flex-wrap: nowrap; align-items: stretch; overflow-x: hidden; overflow-y: auto; padding-inline: 6px; }
  .ws-v4 .lv-nova .lv-nova-portrait { flex: none; max-block-size: 30dvh; }
  .ws-v4 .lv-nova:not([data-expanded="true"]) .lv-chapter-tools,
  .ws-v4 .lv-nova:not([data-expanded="true"]) .lv-chapter-notes { display: block; }
  /* RC8C recovery (workstream D; real browser 20261128T103636Z G3-tools-phone-landscape, 780x360,
     touch): 40 px here overrode the 44 px touch rule above (same weight, later), so Mock Test and
     Chapter Notes were 40 px tall on a touch phone. Smaller text stays; the target is 44 px. */
  .ws-v4 .lv-chapter-tools .ws-side-tool { min-block-size: var(--lv-touch); font-size: var(--lv-fs-xs); }
  /* RC8C recovery (same run): about 280 px of column cannot hold Nova, her board and the three
     tools, so the board's slot (min 0 from 721 px) shrank to nothing while the board itself
     (its bar and its 80 px canvas floor) could not: it spilled over Practice Questions and Mock
     Test and covered them ("covered by svg", 7059 and 6631 px2 of overlap). Here the slot keeps
     the board's own height and the column scrolls to the tools instead (never covered). */
  .ws-v4 .lv-nova .lv-board-slot { min-block-size: auto; }
  /* RC9 UI item 3: the captioned slot floor (more specific) would override that here; kept the same. */
  .ws-v4 .lv-nova .lv-board-slot:has(.lv-board-say:not([hidden])) { min-block-size: auto; }
  .ws-v4 .lv-att-row { padding-block: 2px; }
  .ws-v4 .lv-att-strip > .lv-att-add { margin-block-start: 2px; } /* level with the thumbnails here */
  .ws-v4 .lv-att-open,
  .ws-v4 .lv-att-add { inline-size: 52px; block-size: 52px; }
  .ws-v4 .lv-att-item { inline-size: 52px; }
  .ws-v4 .lv-att-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-v4 .lv-disclose .lv-icon,
  .ws-v4 .lv-notes-toggle .lv-icon { transition: none; }
}
@media (forced-colors: active) {
  .ws-v4 .lv-portrait-ctls { background: Canvas; color: CanvasText; border: 1px solid CanvasText; }
  .ws-v4 .lv-att-item[data-status="failed"] .lv-att-open { border: 2px dashed CanvasText; }
  .ws-v4 .lv-att-rm { border: 1px solid ButtonText; }
}
