@font-face {
  font-family: Plex;
  src: url(/fonts/ibm-plex-sans-latin.woff2);
}
@font-face {
  font-family: Serif;
  src: url(/fonts/source-serif-4-latin.woff2);
  font-weight: 200 800;
}
@font-face {
  font-family: Mono;
  src: url(/fonts/ibm-plex-mono-400-latin.woff2);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f7f4ee;
  color: #282923;
  font:
    16px Plex,
    system-ui,
    sans-serif;
}
header {
  height: 76px;
  border-bottom: 1px solid #c9c6bb;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 clamp(18px, 5vw, 80px);
}
.brand {
  font:
    600 29px Serif,
    Georgia,
    serif;
  letter-spacing: -1.7px;
  text-decoration: none;
  color: inherit;
}
.brand i,
.accent {
  color: #7a262a;
}
.division,
.kicker,
.meta,
.num {
  font:
    12px Mono,
    monospace;
  letter-spacing: 0.09em;
}
.division {
  border-left: 1px solid #bdb7ac;
  padding-left: 20px;
}
#account {
  margin-left: auto;
}
main {
  max-width: 1450px;
  margin: auto;
  padding: 36px clamp(18px, 5vw, 80px) 60px;
}
h1,
h2,
h3 {
  font-family: Serif, Georgia, serif;
  font-weight: 550;
  letter-spacing: -0.035em;
  margin: 0 0 10px;
}
h1 {
  font-size: clamp(35px, 4.6vw, 66px);
  line-height: 1.04;
}
h2 {
  font-size: 30px;
}
h3 {
  font-size: 23px;
}
.kicker {
  color: #7a262a;
  margin: 0 0 14px;
  text-transform: uppercase;
}
.lead {
  font-size: 19px;
  line-height: 1.5;
  color: #54564e;
  max-width: 36em;
}
.entry {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 8%;
  align-items: center;
  padding: clamp(20px, 6vh, 80px) 0;
}
.entry h1 {
  font-size: clamp(54px, 6.5vw, 96px);
}
.sheet,
.card {
  background: #fffdf8;
  border: 1px solid #cfcbc0;
  border-radius: 7px;
  padding: 24px;
}
.sheet {
  padding: clamp(22px, 4vw, 44px);
  box-shadow: 4px 5px 0 #e7e2d8;
  border-top: 3px solid #802d32;
}
.rule {
  border-top: 1px solid #c9c6bb;
  margin-top: 28px;
  padding-top: 15px;
  max-width: 460px;
}
.row,
.toolbar,
.between {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.between {
  justify-content: space-between;
}
.toolbar {
  margin: 18px 0;
}
.muted,
small {
  color: #5c6057;
}
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #ccc7bc;
  margin-bottom: 22px;
}
.tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
}
.tabs .selected {
  border-bottom-color: #7a262a;
  color: #7a262a;
}
button,
select,
input {
  font: inherit;
}
button,
select {
  cursor: pointer;
  min-height: 44px;
  border: 1px solid #c4c1b6;
  background: #fffdf8;
  border-radius: 5px;
  padding: 8px 15px;
  color: inherit;
}
button:hover {
  border-color: #7a262a;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #865c36;
  outline-offset: 2px;
}
.primary,
.tool.active {
  color: white;
  background: #792a30;
  border-color: #792a30;
}
.danger {
  color: #792a30;
}
.link {
  background: transparent;
  border: 0;
  text-decoration: underline;
  padding: 4px 0;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
label {
  display: block;
  margin: 14px 0;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  line-height: 1.5;
}
.check input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  flex: none;
}
input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 46px;
  border: 1px solid #b5b5a9;
  border-radius: 4px;
  background: #fff;
  padding: 10px;
}
.cards,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  margin-top: 16px;
}
.card .row {
  margin-top: 14px;
}
.badge {
  font-size: 13px;
  padding: 4px 9px;
  border-radius: 20px;
  background: #e4eee3;
  color: #275b3b;
}
.badge.warn {
  background: #f7e6ca;
  color: #69451a;
}
.thumb {
  padding: 0;
  text-align: left;
  overflow: hidden;
}
.thumb .between {
  padding: 12px;
}
.thumb .desk-preview,
.paper svg {
  display: block;
  width: 100%;
  background-color: #fff;
  background-image: linear-gradient(#eff0eb 1px, transparent 1px);
  background-size: 100% 8.333%;
}
.paper {
  overflow: hidden;
  border: 1px solid #c5c6b9;
  border-radius: 5px;
  background: #fff;
}
.paper svg {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.pdf {
  background: #e9e7df;
  border: 1px solid #cecbc1;
  border-radius: 5px;
  max-height: 37vh;
  overflow: auto;
  text-align: center;
}
.pdf canvas {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
}
.code {
  letter-spacing: 0.15em;
  color: #742529;
  font:
    600 24px Mono,
    monospace;
}
.panel {
  max-width: 950px;
  margin: 16px auto;
}
.empty {
  border: 1px dashed #c4c1b6;
  padding: 30px;
  border-radius: 6px;
}
.foot {
  font-size: 13px;
  color: #55584f;
  margin-top: 30px;
}
dialog {
  color: inherit;
  background: #fffdf8;
  border: 1px solid #aba89d;
  border-radius: 8px;
  width: min(520px, 92vw);
  padding: 26px;
}
dialog::backdrop {
  background: #2225;
}
#notice:not(:empty) {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #4d2025;
  color: white;
  padding: 12px 20px;
  border-radius: 5px;
  z-index: 10;
  max-width: 94vw;
}
.art {
  font:
    italic 36px Serif,
    serif;
  color: #574f44;
  transform: rotate(-3deg);
  display: block;
  padding: 10px;
}
.art b {
  font: italic 25px Serif;
  color: #8b3337;
}
.stat {
  font:
    13px Mono,
    monospace;
  color: #54594e;
}
details {
  margin: 18px 0;
}
summary {
  cursor: pointer;
}
.tools {
  position: sticky;
  top: 0;
  background: #f7f4ee;
  z-index: 1;
  padding: 8px 0;
}
.noticebox {
  padding: 12px 16px;
  background: #f3e7d4;
  border-radius: 5px;
}
.hidden {
  display: none;
}
@media (max-width: 750px) {
  .entry {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 12px 0;
  }
  .entry .rule {
    display: none;
  }
  header {
    height: 62px;
    gap: 12px;
  }
  .division {
    font-size: 10px;
    padding-left: 10px;
  }
  .brand {
    font-size: 25px;
  }
  main {
    padding-top: 22px;
  }
  .toolbar {
    gap: 8px;
  }
  .sheet,
  .card {
    padding: 16px;
  }
  .thumb {
    padding: 0;
  }
}
@media (min-width: 1100px) {
  .studentLayout {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(480px, 1.22fr);
    gap: 24px;
  }
  .studentLayout .pdf {
    max-height: 75vh;
  }
}
[hidden] {
  display: none !important;
}
@media (min-width: 720px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
    gap: 10px;
  }
  .thumb .between {
    padding: 7px 9px;
    gap: 5px;
  }
}

/* Tutor-only question preparation. */
.prep-mode { margin: 24px 0; max-width: 340px; }
.prep-layout { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(320px,1fr); gap:28px; align-items:start; }
.prep-layout h2 { font-size:24px; }
.prep-source-scroll { max-height:72vh; overflow:auto; border:1px solid #cecbc1; background:#e9e7df; }
#source-surface { position:relative; width:100%; }
#source-canvas { display:block; width:100%; touch-action:none; cursor:crosshair; }
#selection { position:absolute; pointer-events:none; border:2px solid #742529; background:rgba(116,37,41,.12); box-sizing:border-box; }
.prep-source .toolbar { flex-wrap:wrap; }
.prep-source label { display:flex; align-items:center; gap:8px; }
.prep-source select { width:auto; }
#question-list { display:flex; gap:8px; overflow:auto; padding:0 0 12px; margin-bottom:14px; }
#question-list button { min-width:130px; max-width:220px; text-align:left; flex-shrink:0; }
#question-list small { display:block; opacity:.7; }
#question-list .selected { background:#742529; color:white; }
#question-list span { display:block; overflow:hidden; text-overflow:ellipsis; }
#question-label { width:100%; }
#question-editor .toolbar { margin-top:12px; }
#region-list { list-style:none; padding:0; }
#region-list li { display:flex; justify-content:space-between; gap:8px; align-items:center; border-bottom:1px solid #ddd9ce; padding:8px 0; }
#region-list button { padding:5px 9px; font-size:13px; }
.prep-preview { padding:12px; background:white; border:1px solid #cecbc1; min-height:120px; max-height:60vh; overflow:auto; }
.prep-preview canvas { display:block; width:100%; height:auto; }
.prep-save { margin-top:28px; }
.prep-save .toolbar { margin-top:16px; }
.whole-mode { grid-template-columns:minmax(0,820px); }
.question-dialog { width:min(1100px,92vw); max-width:92vw; }
.question-dialog img { display:block; width:100%; margin-top:20px; }
@media (max-width:950px) { .prep-layout { grid-template-columns:minmax(0,1fr); } .prep-source-scroll { max-height:60vh; } }
.prep-title { font-size:clamp(32px,4vw,46px); margin-bottom:8px; }
#question-list .selected small { color:#fff; opacity:.85; }
.prep-source .toolbar { position:sticky; top:0; z-index:3; background:#f7f4ee; padding:8px 0; }
.studentLayout.question-layout { display:block; max-width:1000px; margin:0 auto; }
.question-layout > section + section { margin-top:20px; }
.question-layout .pdf { max-height:35vh; }

/* Prepared questions each have their own uncluttered writing screen. */
.question-layout .paper svg { background-image:none; }
.question-layout .pdf { max-height:28vh; }

.worksheet-picker { display:grid; gap:12px; max-height:50vh; overflow:auto; }
.worksheet-picker article { border:1px solid #d1cabe; padding:16px; border-radius:6px; }
.worksheet-picker h3 { margin:0 0 8px; }
.waiting-roster { list-style:none; padding:0; max-width:650px; }
.waiting-roster li { display:flex; align-items:center; justify-content:space-between; padding:14px 0; border-bottom:1px solid #d1cabe; }
.waiting-student { margin-top:28px; }

/* Simplified lesson screens (Nov 2026). */
.title-sm { font-size: clamp(28px, 3.2vw, 40px); margin: 0; }
.h3 { font-size: 23px; margin-top: 28px; }
.small { font-size: 13px; }
.wide { width: 100%; }
.spacer { flex: 1; }
.warn-text { color: #69451a; }
.lesson-head { margin-bottom: 18px; align-items: flex-start; }
.lesson-head .muted { margin: 4px 0 0; }
.studio-head { margin-bottom: 14px; }
.join-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; background: #fffdf8; border: 1px solid #cfcbc0; border-radius: 7px; padding: 14px 20px; margin-bottom: 18px; }
.join-strip .meta { display: block; color: #6b6d64; margin-bottom: 2px; }
.join-strip .code { font-size: 30px; }
.join-url { font: 15px Mono, monospace; }
#joined { margin-left: auto; }
.waiting-tutor { text-align: center; padding: 36px 24px; }
.waiting-tutor p { max-width: 34em; margin: 0 auto 18px; }
.question-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.question-bar select { flex: 0 1 420px; min-width: 0; }
.icon { min-width: 44px; padding: 8px 0; font-size: 22px; line-height: 1; }
.tutor-pdf { max-height: 24vh; margin-bottom: 18px; }
.diagnostics { margin-top: 36px; color: #5c6057; font-size: 14px; }
.diagnostics .stat { margin: 8px 0; }
.past { margin-top: 14px; font-size: 14px; }
.past-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e3ded3; }
.past-row .link { min-height: 36px; }
.card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.card h2 { font-size: 26px; }
.card .meta { margin: 0 0 8px; color: #5c6057; }
.card .past { align-self: stretch; }
.card-foot { margin-top: auto; padding-top: 10px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2f7a4a; margin-right: 7px; vertical-align: 1px; }
.join-only { display: grid; place-items: center; padding: clamp(10px, 6vh, 70px) 0; }
.join-only .sheet { width: min(460px, 100%); }
.join-only h1 { font-size: clamp(34px, 5vw, 46px); }
.join-only .code-sm { font-size: 18px; }
.join-only .link { display: block; margin-top: 14px; }
.q-head { margin-bottom: 8px; }
.q-head .kicker { margin: 0; }
.q-head .row { gap: 18px; }
.studentLayout .tools { margin: 0 0 10px; }
.question-layout > section + section { margin-top: 14px; }
@media (max-width: 750px) {
  .join-strip { padding: 12px 14px; gap: 8px 18px; }
  .join-url { display: none; }
  .question-bar select { flex: 1 1 100%; order: -1; }
}

/* Classroom workspace: consistent hierarchy, comfortable touch targets, generous paper. */
:root { --wine:#792a30; --line:#ded9ce; --surface:#fffdf8; --quiet:#686b61; }
body { line-height:1.5; }
button { font-weight:500; transition:background-color .15s, border-color .15s; }
button:not(.primary):not(.active):hover { background-color:#eee9df; }
button:disabled:hover { background-color:inherit; }
h1,h2,h3,p { overflow-wrap:break-word; }
.tabs .selected { font-weight:600; }
.studio-intro { margin:0 0 24px; max-width:60em; }
.studio-summary { display:flex; flex-wrap:wrap; gap:12px 32px; padding:18px 22px; background:#eeeae1; border-radius:10px; margin-bottom:26px; color:#55594f; }
.studio-summary strong { color:#282923; font-size:22px; margin-right:6px; }
.studio-summary span:last-child { margin-left:auto; align-self:center; font-size:14px; }
.class-controls { display:flex; gap:20px; align-items:end; }
.class-controls label { margin:0; font-size:14px; font-weight:500; }
.class-controls label:first-child { flex:1; max-width:500px; }
.class-controls select { display:block; margin-top:6px; min-width:180px; min-height:46px; }
.classroom-card { border-radius:12px; padding:24px; gap:12px; }
.classroom-card h2 { margin:8px 0 0; }
.classroom-card p { margin:0; }
.class-symbol { display:grid; place-items:center; width:44px; height:44px; background:#f0e3df; border-radius:12px; color:var(--wine); font:600 24px Serif,serif; }
.badge.neutral { background:#eeece5; color:#5a5d54; }
.card-actions { display:flex; flex-wrap:wrap; gap:8px; padding-top:14px; margin-top:auto; }
.breadcrumbs { display:flex; flex-wrap:wrap; gap:14px; align-items:center; color:var(--quiet); margin-bottom:26px; font-size:14px; }
.class-overview { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:28px; border:1px solid var(--line); border-radius:12px; background:var(--surface); padding:28px; margin:30px 0; }
.class-overview h2 { font-size:23px; margin:12px 0 6px; }
.class-overview p { font-size:15px; color:var(--quiet); margin:0; }
.step-number { font:13px Mono,monospace; color:var(--wine); }
.lesson-history { margin-top:36px; }
.lesson-history > .between { margin-bottom:16px; }
.history-list { border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--surface); }
.history-row { display:flex; justify-content:space-between; align-items:center; gap:24px; padding:22px 24px; }
.history-row + .history-row { border-top:1px solid var(--line); }
.history-row h3 { font:500 18px Plex, sans-serif; letter-spacing:0; margin:0; }
.history-row p { margin:4px 0 0; }
.class-settings { margin-top:40px; font-size:14px; color:var(--quiet); }
.empty { background:#ffffff60; padding:32px; }
.empty p { max-width:52em; }
.desk-app { max-width:1500px; padding-inline:clamp(16px,3vw,44px); }
.desk-app .studentLayout.question-layout { max-width:1200px; }
.question-section { border:1px solid var(--line); background:var(--surface); border-radius:12px; overflow:hidden; }
.question-section .q-head { padding:18px 24px; margin:0; gap:16px; }
.q-head h2 { font-size:24px; margin:5px 0 0; }
.question-section .pdf { border:0; border-top:1px solid var(--line); border-radius:0; background:white; max-height:34vh; }
.question-section .pdf canvas { max-width:100%; }
.question-layout > .workings-section { margin-top:28px; }
.workings-heading { margin-bottom:12px; padding-inline:4px; }
.workings-heading .kicker { margin-bottom:5px; }
.workings-heading h2 { font-size:25px; margin:0; }
.workings-section .tools { border:1px solid var(--line); border-radius:10px; padding:10px 12px; background:var(--surface); top:8px; box-shadow:0 3px 12px #28292308; }
.workings-section .paper { border-color:#d5d3c9; border-radius:10px; box-shadow:0 4px 18px #28292306; }
.workings-section .paper svg { aspect-ratio:5 / 3; background-image:none; }
.workings-section .foot { margin:12px 4px; }
.writing-focus .question-section { display:none; }
.writing-focus .studentLayout.question-layout { max-width:none; }
.writing-focus .workings-section { margin-top:16px; }
.join-only .sheet p { line-height:1.6; }
@media (min-width:1000px) { .classroom-card { min-height:260px; } }
@media (max-width:750px) {
  .studio-summary { gap:8px 20px; padding:16px; }
  .studio-summary span:last-child { flex-basis:100%; margin-left:0; }
  .class-overview { grid-template-columns:1fr; gap:22px; padding:22px; }
  .class-controls { gap:12px; flex-wrap:wrap; }
  .class-controls label:first-child { min-width:180px; }
  .history-row { padding:18px; flex-wrap:wrap; gap:12px; }
  .question-section .q-head { padding:14px 16px; }
  .workings-heading { align-items:start; }
  .workings-heading > span { width:100%; }
  .workings-section .tools { gap:8px; padding:8px; }
  .workings-section .tools button { padding-inline:12px; }
  .studio-head .primary { flex-shrink:0; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto !important; transition:none !important; } }
/* Keep the prompt readable without letting its source image consume the desk. */
.desk-app:has(.workings-section) { padding-top:22px; }
.desk-app:has(.workings-section) .lesson-head { margin-bottom:14px; }
.desk-app:has(.workings-section) .lesson-head h1 { font-size:28px; }
.question-section .q-head { padding:12px 18px; }
.question-section .q-head h2 { font:500 17px Plex,sans-serif; letter-spacing:0; }
.question-section .pdf { max-height:22vh; min-height:80px; }
.question-section .pdf canvas, .question-section .pdf img { width: min(100%, 800px) !important; height:auto; margin:auto; display:block; }
.question-layout > .workings-section { margin-top:20px; }
.workings-heading h2 { font-size:22px; }
@media (max-width:480px) {
  header { padding-inline:16px; }
  .division { display:none; }
  .brand { font-size:23px; }
  .question-section .q-head .row { gap:16px; }
  .question-section .pdf { max-height:30vh; }
}
.input-mode.active { border-color:var(--wine); color:var(--wine); background:#f3e7e4; }
@media (pointer:coarse) {
  button, select, summary { min-height:48px; }
  .tools { scroll-margin-top:12px; }
  .question-section { scroll-margin-top:16px; }
  .history-row button { min-height:48px; }
}
.annotation-tools { border:1px solid var(--line); border-radius:10px; padding:10px; margin-bottom:6px; }
.annotation-tools .tool.active { background:#b12630; border-color:#b12630; }
/* Saving feedback must not insert a row or move the drawing surface. */
#annotation-status { flex:1 1 0; min-width:0; height:20px; line-height:20px; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Quiet classroom surfaces: controls and states carry the interaction. */
.assigned-check { display:inline-grid; place-items:center; width:32px; height:32px; border-radius:50%; background:#e4eee3; color:#275b3b; font-size:20px; }
.desk-meta { display:flex; align-items:center; gap:14px; }
.expand-mark { color:var(--wine); font-size:24px; line-height:1; }
.thumb { border-radius:12px; transition:border-color .15s,box-shadow .15s; }
.thumb:hover, .thumb:focus-visible { border-color:var(--wine); box-shadow:0 3px 14px #74252912; }
#grid { scroll-margin-top:12px; }
.desk-controls { position:sticky; top:0; z-index:2; background:var(--bg, #f7f4ee); padding:10px 0; }
.desk-controls > .between { gap:12px; }
.desk-controls label { display:flex; align-items:center; gap:10px; }
.desk-controls .annotation-tools { position:static; margin:10px 0 0; }
.workings-section .foot:empty { display:none; }
@media (prefers-reduced-motion:reduce) { .thumb { transition:none; } }
.focus-toggle { display:inline-grid; place-items:center; flex-shrink:0; }
.focus-toggle[aria-pressed="true"] { color:var(--wine); background:#f0e3df; }
/* Consistent, touch-sized icons keep the paper's tools quiet and discoverable. */
.icon-control { display:inline-grid; place-items:center; flex:0 0 48px; width:48px; height:48px; padding:0 !important; border-radius:9px; }
.icon-control svg { pointer-events:none; }
.tools { gap:8px; }
.tool-divider { width:1px; height:26px; background:var(--line); margin-inline:2px; }
.workings-section .tool.active { background:#273447; border-color:#273447; }
.annotation-tools .red-pen { color:#c02f36; }
.annotation-tools .tool.active { color:white; }
.input-mode { color:var(--quiet); }
#start select { display:block; width:100%; margin-top:8px; }
.join-strip #joined { margin-left:auto; }
.q-head .row { gap:6px; }
/* Keep the question readable and fit the complete paper without stretching ink. */
body:has(.workings-section) > header { height:56px; }
.desk-app:has(.workings-section) .lesson-head > div:first-child { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px 14px; }
.desk-app:has(.workings-section) .lesson-head h1 { font-size:24px; margin:0; }
.desk-app:has(.workings-section) .lesson-head p { margin:0; }
.desk-app:has(.workings-section) { padding-top:16px; padding-bottom:20px; }
.question-layout > .workings-section { margin-top:14px; }
.workings-heading { margin-bottom:8px; }
.workings-section .paper { margin-inline:auto; }
.question-section .q-head { padding:8px 14px; }
.question-section .q-head .kicker { margin-bottom:4px; }
.writing-focus .studentLayout.question-layout { display:block; }

/* The worksheet stays readable across the top; the tools give space to paper. */
body:has(.workings-section) > header { height:48px; }
.desk-app:has(.workings-section) { max-width:none; padding:8px 12px 10px; }
.desk-app:has(.workings-section) .lesson-head { margin-bottom:8px; min-height:28px; }
.desk-app:has(.workings-section) .lesson-head h1 { font:600 18px Plex,sans-serif; letter-spacing:0; }
.desk-app:has(.workings-section) .lesson-head p { font-size:14px; }
.desk-app .studentLayout.question-layout { max-width:none; }
.question-section .q-head { padding:4px 8px 4px 12px; gap:8px; }
.question-section .q-head > div:first-child { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 14px; min-width:0; }
.question-section .q-head .kicker, .question-section .q-head h2 { margin:0; }
.question-section .q-head h2 { font-size:15px; }
.question-section .q-head .row { flex-shrink:0; }
.question-section .q-head .icon-control { width:44px; height:44px; min-height:44px; flex-basis:44px; }
.question-layout > .workings-section { position:relative; margin-top:8px; }
.workings-heading { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.paper-space { min-width:0; }
.workings-section .tools { margin:0 0 8px; padding:6px; }
.workings-section .paper { margin-inline:auto; }
.workings-section .foot { grid-column:1 / -1; }
@media (min-width:900px) and (orientation:landscape) {
  .question-layout > .workings-section { display:grid; grid-template-columns:62px minmax(0,1fr); gap:10px; align-items:start; }
  .workings-section .tools { flex-direction:column; flex-wrap:nowrap; gap:6px; margin:0; position:static; padding:6px; }
  .workings-section .tools .spacer { display:none; }
  .workings-section .tool-divider { width:26px; height:1px; margin:2px 0; }
}

/* Touch-friendly selectors show complete names without native select clipping. */
.choice-trigger { display:flex; align-items:center; gap:16px; min-height:56px; padding:10px 14px; border-radius:10px; text-align:left; }
.choice-copy { display:flex; flex:1; flex-direction:column; gap:3px; min-width:0; }
.choice-caption { font-size:12px; line-height:1.4; font-weight:400; color:var(--quiet); overflow-wrap:anywhere; }
.choice-title { font-size:16px; line-height:1.4; font-weight:500; white-space:normal; overflow-wrap:anywhere; }
.choice-trigger > svg, .choice-check svg { width:20px; height:20px; flex-shrink:0; }
.question-bar .question-choice { flex:1 1 340px; min-width:0; max-width:640px; }
.student-choice { min-width:180px; max-width:min(100%,360px); }
.choice-trigger:focus-visible, .choice-option:focus-visible { outline:2px solid var(--wine); outline-offset:3px; }
.choice-dialog { position:fixed; width:min(560px,calc(100vw - 32px)); max-height:min(640px,calc(100dvh - 32px)); padding:24px; border:1px solid var(--line); border-radius:16px; box-shadow:0 24px 80px #2223; overflow:auto; }
.choice-dialog h2 { font:600 22px Plex,sans-serif; margin:0 48px 20px 0; }
.choice-dialog > .icon-control { position:absolute; right:14px; top:12px; border:0; background:transparent; }
.choice-list { display:grid; gap:8px; list-style:none; padding:0; margin:0; }
.choice-option { display:flex; align-items:center; gap:16px; width:100%; min-height:56px; padding:14px; text-align:left; border:1px solid var(--line); border-radius:10px; }
.choice-option[aria-pressed="true"] { border-color:var(--wine); background:#f4eae7; }
.choice-check { display:flex; width:20px; flex:0 0 20px; color:var(--wine); }
@media(max-width:750px) { .question-bar .question-choice { flex-basis:100%; max-width:none; order:-1; } }

.import-strip { display:flex; align-items:center; flex-wrap:wrap; gap:12px 24px; padding:20px; margin:22px 0; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.import-strip > div { flex:1 1 280px; }
.import-strip p { margin:4px 0 0; }
#import-status { flex-basis:100%; font-size:14px; }
#import-status:empty { display:none; }
.tutor-reference { margin-top:24px; border-top:1px solid var(--line); padding-top:18px; }
.tutor-reference > h3 { display:flex; align-items:center; gap:12px; }
.answer-reference h3 { font:500 15px Plex,sans-serif; margin:18px 0 5px; }
.answer-text { white-space:pre-wrap; overflow-wrap:anywhere; margin:0; }
.region-details { margin:16px 0; }
.region-details summary { color:var(--quiet); cursor:pointer; }
.prep-title { margin-bottom:4px; }

/* Stable paper controls, separate from worksheet question navigation. */
.paper-navigation { display:flex; align-items:center; justify-content:center; gap:8px; min-height:48px; margin:0 0 6px; }
#paper-position { min-width:104px; text-align:center; font-size:14px; font-variant-numeric:tabular-nums; }
.paper-navigation .icon-control { width:44px; height:44px; min-height:44px; flex-basis:44px; }
.paper-navigation [data-action="paperAdd"] { margin-left:8px; }
.paper.drawing-paper { touch-action:none; overscroll-behavior:none; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
.paper.drawing-paper svg, .paper.drawing-paper path { touch-action:none; }
.paper { overflow-anchor:none; }

/* Parsed questions reflow naturally; math keeps its own accessible MathML. */
.parsed-question { color:var(--ink); padding:20px 24px; font:400 18px/1.65 Plex,sans-serif; text-align:left; overflow-wrap:anywhere; }
.question-stem,.question-parts li>div { white-space:pre-wrap; }
.question-stem,.question-parts li>div { min-width:0; }
.question-table-scroll { max-width:100%; overflow-x:auto; margin:16px 0; white-space:normal; overscroll-behavior-x:contain; border:1px solid var(--line,#d8d9d2); border-radius:8px; }
.question-table-scroll:focus-visible { outline:2px solid var(--ink); outline-offset:3px; }
.question-table { width:100%; border-collapse:collapse; font:inherit; line-height:1.5; background:white; }
.question-table th,.question-table td { padding:10px 14px; border:1px solid var(--line,#d8d9d2); min-width:5rem; overflow-wrap:normal; }
.question-table th { background:#f3f3ed; font-weight:600; }
.question-table .table-left { text-align:left; }
.question-table .table-center { text-align:center; }
.question-table .table-right { text-align:right; }
.question-parts { list-style:none; margin:18px 0 0; padding:0; display:grid; gap:16px; }
.question-parts li { display:grid; grid-template-columns:auto minmax(0,1fr); gap:12px; }
.part-label { min-width:28px; font-weight:600; }
.parsed-question figure { margin:16px 0; }
.parsed-question figure img { max-width:100%; max-height:300px; width:auto!important; object-fit:contain; }
.parsed-question figcaption { font-size:14px; }
.katex-display { overflow-x:auto; overflow-y:hidden; padding:8px 2px; margin:8px 0; }
.katex { font-size:1.1em; }
.math-error { color:#a52030; text-decoration:underline wavy; }
.question-section .pdf:has(.parsed-question) { max-height:32svh; overflow:auto; }
.tutor-pdf:has(.parsed-question) { max-height:36svh; overflow:auto; }
.parsed-editor textarea { width:100%; min-height:100px; font:16px/1.5 monospace; padding:12px; }
.parsed-editor { display:grid; gap:12px; }
.parsed-editor input { width:100%; }
@media(max-width:600px){.parsed-question {padding:16px;font-size:17px;}}
.attempt-navigation { display:flex; justify-content:center; gap:8px; margin:0 0 4px; }
.attempt-navigation button { min-height:36px; padding:5px 12px; font-size:13px; }
.desk-pagination { display:flex; justify-content:flex-end; align-items:center; gap:10px; margin:12px 0; font-size:14px; }
#grid .desk-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.desk-grid .thumb { min-width:0; }
.desk-grid .desk-meta { flex-wrap:wrap; justify-content:flex-end; }
.desk-paper-label { font-size:12px; }
.bank-filters { display:grid; grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); gap:12px; margin:24px 0 16px; }
.bank-filters label { min-width:0; font-size:13px; }
.bank-filters input,.bank-filters select { width:100%; min-width:0; }
.bank-selection { position:sticky; top:0; z-index:2; background:var(--paper,#f7f4ee); padding:12px 0; }
.bank-question { background:#fff; border:1px solid var(--line); border-radius:12px; margin:16px 0; padding:18px; }
.bank-question .parsed-question { padding:12px 0 0; }
.bank-question .check { flex:1; }
.bank-question .between { align-items:start; }
#bank-paging { display:flex; align-items:center; justify-content:center; gap:16px; margin:20px; }
.bank-sources summary { cursor:pointer; padding:12px 0; }
.lesson-options { display:flex; justify-content:flex-end; margin:10px 0; }
.lesson-options button { font-size:13px; min-height:36px; padding:6px 12px; }
.paper-controls { display:flex; align-items:center; justify-content:center; gap:16px; flex-wrap:wrap; margin-bottom:6px; }
.paper-controls .attempt-navigation,.paper-controls .paper-navigation { margin:0; }
@media(min-width:900px) and (orientation:landscape){
  .studentLayout.question-layout { display:grid; grid-template-columns:minmax(280px,31%) minmax(0,1fr); gap:14px; align-items:start; }
  .question-layout>.workings-section { display:block; margin-top:0; }
  .workings-section .tools { flex-direction:row; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
  .workings-section .tools .spacer { display:block; }
  .workings-section .tool-divider { width:1px; height:26px; margin:0 2px; }
  .question-section .pdf:has(.parsed-question) { max-height:calc(100svh - 240px); }
  .question-section .parsed-question { padding:14px; font-size:17px; }
  .writing-focus .studentLayout.question-layout { display:block; }
}
/* Saving changes the status content, never the document geometry. */
.lesson-head #status { flex:0 0 172px; width:172px; height:28px; line-height:20px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-align:center; font-size:12px; }
.lesson-head>.row { flex-wrap:nowrap; }

/* Shared Mynah identity, using the website's original artwork and palette. */
:root { --paper:#fcfaf5; --paper-2:#fffefb; --ink:#141413; --ink-2:#514e48; --mark:#b72129; --beak:#ffd122; --line:#dfdcd3; }
body { background:var(--paper); color:var(--ink); -webkit-font-smoothing:antialiased; }
header { background:var(--paper-2); border-color:var(--line); }
.brand { display:flex; align-items:center; flex-shrink:0; }
.brand img { display:block; width:210px; height:auto; }
h1,h2,h3 { font-family:Plex,system-ui,sans-serif; font-weight:600; letter-spacing:-.035em; }
button,select,input { border-radius:8px; }
button { border-color:var(--line); background:var(--paper-2); }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:2px solid var(--mark); outline-offset:3px; }
.primary { background:var(--mark); border-color:var(--mark); color:white; }
.primary:hover { background:#981b22; border-color:#981b22; }
.tabs .selected { color:var(--mark); border-bottom-color:var(--mark); }
.accent,.danger { color:var(--mark); }
.sheet,.card,dialog { background:var(--paper-2); border-color:var(--line); border-radius:14px; }
.sheet { border-top:4px solid var(--beak); }
.class-symbol { background:#fff2b0; color:var(--ink); border-radius:12px; }
.studio-summary { background:#f3efd6; border-color:var(--line); }
.entry-mynah { display:block; width:100px; height:auto; margin-bottom:24px; }
.entry .rule { border-color:var(--line); }
.entry h1 i { font-style:normal; }
.join-strip,.tools,.question-section { border-color:var(--line); }
.bank-studio { max-width:1600px; padding-inline:clamp(16px,3vw,48px); }
.bank-return { margin:0 0 12px; }
.question-bank { padding-bottom:26px; }
.question-bank h2 { font-size:24px; line-height:1.25; }
.bank-search-row { display:flex; align-items:center; gap:12px; margin:20px 0; }
.bank-search { display:flex; align-items:center; gap:12px; flex:1; margin:0; padding:0 14px; background:white; border:1px solid var(--line); border-radius:10px; }
.bank-search svg { width:20px; flex-shrink:0; color:var(--ink-2); }
.bank-search input { border:0; background:transparent; margin:0; width:100%; height:48px; box-shadow:none; }
.bank-refine { position:relative; flex-shrink:0; }
.bank-refine > summary { display:flex; align-items:center; gap:8px; min-height:48px; border:1px solid var(--line); padding:10px 14px; border-radius:10px; cursor:pointer; background:var(--paper-2); list-style:none; }
.bank-refine svg { width:19px; height:19px; }
.bank-refine summary::-webkit-details-marker { display:none; }
.bank-filter-panel { position:absolute; right:0; top:calc(100% + 8px); width:min(360px,calc(100vw - 36px)); padding:20px; border:1px solid var(--line); border-radius:14px; background:var(--paper-2); box-shadow:0 16px 48px #14141320; z-index:6; }
.bank-filter-panel label { margin:0 0 14px; font-size:13px; font-weight:500; }
.bank-filter-panel select { display:block; width:100%; margin-top:5px; }
.bank-layout { display:grid; grid-template-columns:230px minmax(0,1fr) 300px; gap:22px; align-items:start; }
.bank-browse { border:1px solid var(--line); border-radius:12px; background:#f5f2e9; position:sticky; top:16px; max-height:calc(100svh - 32px); overflow:auto; }
.bank-browse > summary { padding:16px; cursor:pointer; font-weight:600; }
#bank-tree { padding:0 8px 10px; }
.bank-category { display:flex; gap:8px; align-items:center; justify-content:space-between; width:100%; border:1px solid transparent; background:transparent; text-align:left; font-size:13px; line-height:1.4; padding:10px; margin:3px 0; min-height:44px; }
.bank-category span:first-child { min-width:0; overflow-wrap:anywhere; }
.bank-category.is-current { border-color:#b7212940; background:#fff0eb; color:#8b1c23; font-weight:600; }
.bank-total { flex-shrink:0; font-size:11px; font-variant-numeric:tabular-nums; color:var(--ink-2); background:#ffffffa8; border-radius:6px; padding:2px 6px; }
.bank-group { border-top:1px solid var(--line); margin-top:6px; padding-top:6px; }
.bank-group > summary { display:flex; align-items:center; gap:8px; justify-content:space-between; cursor:pointer; padding:10px 6px; min-height:48px; font-size:14px; font-weight:600; list-style:none; }
.bank-group > summary::before { content:'›'; flex:0 0 10px; font-size:20px; }
.bank-group[open] > summary::before { transform:rotate(90deg); }
.bank-group > summary > span:first-child { flex:1; }
.bank-group > summary::-webkit-details-marker { display:none; }
.bank-group .bank-category { padding-left:18px; }
.bank-main { min-width:0; }
.bank-result-head { margin:2px 0 16px; scroll-margin-top:20px; }
.bank-result-head h2 { margin-bottom:5px; }
.bank-result-head .muted { font-size:13px; }
.bank-question { margin:0 0 18px; padding:20px; border:1px solid var(--line); border-radius:14px; background:white; transition:border-color .15s; }
.bank-question.is-selected { border-color:#b7212980; box-shadow:inset 3px 0 var(--mark); }
.bank-question-top { display:flex; gap:10px; align-items:flex-start; }
.bank-question-top h3 { flex:1; min-width:0; font:600 16px/1.45 Plex,sans-serif; letter-spacing:-.015em; margin:2px 0 0; overflow-wrap:anywhere; }
.bank-question-number { font:500 12px Mono,monospace; color:var(--ink-2); border-radius:6px; background:#f5f2e9; padding:6px; white-space:nowrap; }
.bank-source { font-size:12px; line-height:1.5; color:var(--ink-2); margin:8px 0 4px; overflow-wrap:anywhere; }
.bank-question .parsed-question { padding:16px 0; font-size:17px; line-height:1.7; }
.bank-question .parsed-question img { max-height:320px; object-fit:contain; }
.bank-question-foot { display:flex; gap:14px; align-items:flex-end; justify-content:space-between; padding-top:12px; border-top:1px solid #efede6; }
.bank-tags { display:flex; flex-wrap:wrap; gap:6px; }
.bank-tags > span { font-size:11px; line-height:1.4; padding:5px 7px; background:#f5f2e9; border-radius:6px; }
.bank-add { display:flex; align-items:center; justify-content:center; gap:7px; flex-shrink:0; font-size:13px; padding:8px 10px; }
.bank-add svg { width:17px; height:17px; }
.bank-add[aria-pressed="true"] { color:#8b1c23; border-color:#b7212940; background:#fff0eb; }
.bank-icon { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; min-width:44px; padding:10px; flex-shrink:0; border-color:transparent; background:transparent; border-radius:8px; }
.bank-icon svg { width:21px; height:21px; }
.bank-tray { position:sticky; top:16px; border:1px solid var(--line); border-top:4px solid var(--beak); border-radius:14px; background:var(--paper-2); box-shadow:0 4px 20px #14141306; min-width:0; }
#bank-selection-details > summary { display:flex; align-items:center; gap:10px; list-style:none; cursor:pointer; padding:16px; min-height:54px; font-size:14px; }
#bank-selection-details > summary::-webkit-details-marker { display:none; }
#bank-selection-details > summary span { display:flex; align-items:center; gap:9px; flex:1; font-weight:600; }
#bank-selection-details > summary svg { width:18px; height:18px; }
#bank-selection-details[open] > summary > svg { transform:rotate(180deg); }
#bank-selected-count { background:#fff2b0; color:#51400a; border-radius:7px; padding:3px 8px; }
.bank-tray-content { padding:0 16px 14px; max-height:calc(100svh - 250px); overflow:auto; overscroll-behavior:contain; }
.bank-tray-content label { margin:0 0 14px; font-size:12px; font-weight:500; }
.bank-tray-content input { width:100%; margin-top:5px; }
#bank-selected { margin:0; padding:0; list-style:none; }
#bank-selected li { display:flex; align-items:start; gap:8px; padding:12px 0; border-top:1px solid var(--line); }
.bank-order { font:500 12px Mono,monospace; margin-top:4px; color:var(--mark); }
.bank-selected-copy { min-width:0; flex:1; }
.bank-selected-copy strong { display:block; font-size:13px; line-height:1.45; font-weight:500; overflow-wrap:anywhere; }
.bank-selected-copy small { display:block; font-size:11px; color:var(--ink-2); margin:4px 0; overflow-wrap:anywhere; }
.bank-order-controls { display:flex; gap:4px; }
.bank-order-controls .bank-icon { background:#f5f2e9; }
#bank-selected .bank-empty-selection { flex-direction:column; align-items:center; padding:24px 8px; color:var(--ink-2); text-align:center; font-size:13px; gap:14px; border-top:0; }
.bank-tray-actions { display:flex; gap:8px; padding:14px; border-top:1px solid var(--line); }
.bank-tray-actions button { font-size:13px; white-space:nowrap; flex:1; }
#bank-use { display:flex; gap:5px; align-items:center; justify-content:center; }
#bank-use svg { width:16px; height:16px; }
#bank-message { margin:0; font-size:13px; color:var(--ink-2); }
#bank-message:not(:empty) { padding:0 16px 12px; }
#bank-clear { font-size:12px; }
.bank-no-results img { display:block; margin:0 auto 20px; }
.bank-sources { margin-top:26px; padding:18px; border:1px solid var(--line); border-radius:12px; }
.bank-sources summary { padding:0; font-weight:500; }
.bank-sources .cards { margin-top:20px; }
.bank-sources .card button + button { margin-left:8px; }
.bank-answer-dialog,.bank-lesson-dialog { max-height:calc(100svh - 32px); overflow:auto; }
.bank-destinations { display:grid; gap:10px; margin:18px 0; }
.bank-destination { display:flex; align-items:center; gap:14px; text-align:left; padding:16px; }
.bank-destination > span { flex:1; min-width:0; }
.bank-destination strong { display:block; font-size:16px; overflow-wrap:anywhere; }
.bank-destination small { display:block; margin-top:5px; color:var(--ink-2); }
.bank-destination svg { width:22px; height:22px; }
.bank-new-room { padding:14px 0; border-top:1px solid var(--line); }
.bank-new-room summary { cursor:pointer; }
.bank-start-option { margin:18px 0; padding-bottom:20px; border-bottom:1px solid var(--line); }
.bank-start-option button { width:100%; }
@media (max-width:1199px) {
 .bank-layout { grid-template-columns:220px minmax(0,1fr); gap:18px; }
 .bank-tray { position:fixed; z-index:5; bottom:12px; top:auto; left:24px; right:24px; display:grid; grid-template-columns:1fr auto; box-shadow:0 8px 40px #14141324; }
 #bank-selection-details { min-width:0; }
 #bank-selection-details > summary { min-height:68px; }
 .bank-tray:has(details[open]) { display:block; }
 .bank-tray-content { max-height:55svh; }
 .bank-tray-actions { align-items:center; border-top:0; border-left:1px solid var(--line); padding:10px 14px; }
 .bank-tray:has(details[open]) .bank-tray-actions { border-left:0; border-top:1px solid var(--line); }
 #bank-message { grid-row:2; grid-column:1/-1; }
 #bank-message:empty { display:none; }
 .bank-studio { padding-bottom:140px; }
 .bank-question-foot { flex-direction:column; align-items:stretch; }
 .bank-add { align-self:flex-end; }
}
@media (max-width:699px) {
 .brand img { width:175px; }
 .division { display:none; }
 .bank-layout { display:block; }
 .bank-browse { position:static; max-height:52svh; margin-bottom:20px; }
 .bank-tray { left:10px; right:10px; grid-template-columns:minmax(0,1fr) auto; }
 #bank-selection-details > summary { padding:12px; gap:6px; font-size:12px; }
 #bank-selection-details > summary span svg { display:none; }
 .bank-tray-actions { gap:5px; padding:8px; }
 .bank-tray-actions button { font-size:12px; padding:8px; }
 #bank-use svg { display:none; }
 .bank-question { padding:16px; }
 .bank-question-top { gap:7px; }
 .bank-search-row { gap:8px; }
 .bank-search { padding:0 10px; }
 .bank-search input { font-size:14px; }
 .bank-refine > summary { padding:10px; }
 .bank-refine > summary > span:not(#bank-filter-count) { display:none; }
}
body:has(.workings-section) .brand img { width:155px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Parsed bank sources edit directly, without loading the archived PDF. */
.prep-layout.parsed-only{grid-template-columns:minmax(0,1fr);max-width:1100px;margin-inline:auto}
.prep-layout.parsed-only .prep-editor{min-width:0}
.archive-links{display:flex;flex-wrap:wrap;gap:.5rem 1rem;margin-bottom:1rem;font-size:.875rem}
.archive-links a{overflow-wrap:anywhere}
