/* The simulation keeps the charcoal workbench and mosaic from chalkboard.css. */
.simulation-open {
  --case-ink: #fff2d9;
  --case-muted: #d6d0bf;
  --case-gold: #f4d297;
  --case-line: #918773;
  --case-slate: #242928;
  --case-raised: #303634;
}

.simulation-open .topbar {
  flex-wrap: nowrap;
  gap: clamp(4px, calc(var(--stage-width) * .016 - 9px), 12px);
  min-height: 0;
  padding-block: clamp(2px, calc(var(--stage-width) * .009 - 6.5px), 5px);
  padding-inline: max(calc(var(--stage-edge) / 2), env(safe-area-inset-left)) max(calc(var(--stage-edge) / 2), env(safe-area-inset-right));
  background: #1b211f;
  border-bottom-color: #80745f80;
}
.simulation-open .topbar .brand { flex: none; min-width: var(--stage-target); min-height: var(--stage-target); font-size: var(--stage-toolbar-text); gap: 8px; margin: 0; }
.simulation-open .brand small { display: none; }
.simulation-open .sigil {
  width: clamp(23px, calc(var(--stage-width) * .024), 30px);
  height: auto;
  aspect-ratio: 15 / 16;
  flex: none;
  font-size: clamp(1rem, calc(var(--stage-width) * .0165), 1.3125rem);
}
.simulation-open .case-objective {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 0;
  line-height: 1.35;
}
.simulation-open .case-objective > span { flex: none; color: var(--case-muted); font-size: var(--stage-toolbar-text); }
.simulation-open .case-objective > strong {
  color: var(--case-ink);
  font-size: var(--stage-interface-text);
  font-weight: 750;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.simulation-open .topbar-tools { flex: none; flex-wrap: nowrap; gap: 4px; margin-inline-start: 0; }
.simulation-open .topbar-tools :is(button, a) {
  min-width: var(--stage-target);
  min-height: var(--stage-target);
  padding: 2px clamp(5px, calc(var(--stage-width) * .012 - 5px), 9px);
  margin: 0;
  font-size: var(--stage-toolbar-text);
  line-height: 1.3;
  white-space: nowrap;
}
.simulation-open .museum-map-toggle { background: #30362e; border-color: #ad9973; color: #ffe6b4; }
.simulation-open .topbar-tools .quiet:hover { background: #3d453d; border-color: #b4a17d; }
.simulation-open .scene-caption .scene-action {
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border-inline-start: 3px solid var(--case-gold);
  background: #19211ff0;
  color: #fff1ce;
  line-height: 1.5;
  text-shadow: none;
}
.simulation-open :is(.task-clue, .gate-clue) { color: #ffe2b0; }
.simulation-open .quiet[data-action="hint"] {
  background: #30372f;
  border-color: #c9b386;
  color: #ffe6b4;
}

.simulation-open .gate-simulation .chalk-question { text-align: left; }
.simulation-open .gate-simulation .chalk-question h1 { font-size: var(--stage-lesson-title); line-height: 1.3; }
.simulation-open .gate-simulation .chalk-question p { margin-top: 4px; font-size: var(--stage-problem-text); line-height: 1.5; }
.simulation-open .gate-simulation .chalk-models h2 { margin: 0; font-size: var(--stage-problem-text); }
.simulation-open .chalk-empty { display: grid; place-content: center; color: var(--case-muted); text-align: center; padding: 10px; }
.simulation-open .chalk-original [data-pickup] { outline-offset: 3px; }
.simulation-open .chalk-empty.drop-ready { background: #454c39; border-color: var(--case-gold); }
.simulation-open .scene-caption-action { margin-top: clamp(5px, calc(var(--stage-width) * .007), 8px); }
.simulation-open .gate-simulation .chalk-controls { grid-template-columns: repeat(4, minmax(0, 1fr)); align-self: end; }
.simulation-open .gate-simulation .chalk-controls button {
  min-width: 0;
  min-height: 48px;
  padding: 8px;
  font-size: var(--stage-interface-text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.simulation-open .gate-simulation .chalk-controls .primary { grid-column: auto; }
.simulation-open .gate-simulation .chalk-controls .quiet { border-color: #c5b48e; color: #fff0d0; }

.simulation-open #museum-map:has(.casebook) {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: clamp(16px, 2.4vw, 24px);
  border-color: var(--case-line);
  border-radius: 10px;
  background: var(--case-slate);
  color: var(--case-ink);
  scrollbar-width: thin;
  scrollbar-color: #a7997a #242928;
}
.simulation-open #museum-map[open]:has(.casebook) { display: block; }
.simulation-open #museum-map:has(.casebook)::backdrop { background: #101713d9; }
.simulation-open .casebook { display: grid; gap: 16px; font-size: 1rem; line-height: 1.5; }
.simulation-open .casebook > * { min-width: 0; }
.simulation-open .casebook .museum-map-header { align-items: start; }
.simulation-open .casebook .museum-map-header h2 {
  margin: 0 0 4px;
  font: 400 1.65rem/1.3 'Museum Chalk', var(--serif);
  color: var(--case-ink);
}
.simulation-open .casebook .museum-map-header p { color: var(--case-muted); font-size: 1rem; }
.simulation-open .casebook strong { color: var(--case-ink); }
.simulation-open .casebook h3 { margin: 0 0 8px; color: var(--case-gold); font-size: 1rem; font-weight: 750; }
.simulation-open .casebook .museum-map-close { min-height: 44px; color: var(--case-ink); border-color: var(--case-line); }
.simulation-open .casebook-mission { padding: 12px; border-inline-start: 3px solid var(--case-gold); background: var(--case-raised); }
.simulation-open .casebook-mission p { line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.simulation-open .casebook-evidence { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.simulation-open .casebook-evidence li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(104px, 1fr) minmax(0, 2fr);
  gap: 12px;
  padding: 10px 12px 10px 36px;
  border-bottom: 1px solid #91877350;
  color: var(--case-muted);
  overflow-wrap: anywhere;
}
.simulation-open .casebook-evidence li::before { content: '○'; position: absolute; left: 12px; top: 10px; color: #b5ae9e; }
.simulation-open .casebook-evidence li > strong { color: var(--case-muted); }
.simulation-open .casebook-evidence li.earned { border-radius: 4px; background: #30392f; color: #f1ebdb; }
.simulation-open .casebook-evidence li.earned::before { content: '✓'; color: var(--case-gold); font-weight: 800; }
.simulation-open .casebook-evidence li.earned > strong { color: #ffe3ab; }
.simulation-open .practice-menu-intro { color: var(--case-muted); word-break: keep-all; overflow-wrap: anywhere; }
.simulation-open .practice-options { display: grid; gap: 8px; }
.simulation-open .practice-options button[data-training-index] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--case-line);
  border-radius: 5px;
  background: var(--case-raised);
  color: var(--case-ink);
  text-align: left;
  line-height: 1.4;
}
.simulation-open .practice-options button strong { font-size: 1rem; overflow-wrap: anywhere; }
.simulation-open .practice-options button:hover:not(:disabled) { background: #41483e; border-color: var(--case-gold); }
.simulation-open .practice-options button:active:not(:disabled) { background: #4b5040; }
.simulation-open .practice-options .practice-status { flex: none; color: #ffe0a0; font-size: .875rem; font-weight: 750; }
.simulation-open .casebook :is(button, a):focus-visible { outline: 3px solid var(--case-gold); outline-offset: 3px; }

@container museum-stage (max-width: 1100px) {
  .simulation-open .topbar .brand { justify-content: center; }
  .simulation-open .brand > span:last-child { display: none; }
}
@container museum-stage (max-width: 900px) {
  .simulation-open .topbar-tools { gap: 2px; }
  .simulation-open .case-objective { gap: 5px; }
}
@container museum-stage (max-width: 720px) {
  .simulation-open .case-objective > span { display: none; }
}
@container museum-stage (max-width: 540px) {
  .simulation-open .topbar .brand { display: none; }
  .simulation-open .case-objective > strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.25;
  }
}
@container museum-stage (max-width: 360px) {
  .simulation-open .topbar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .simulation-open .topbar-tools { flex-wrap: wrap; }
}
@media (max-height: 500px) and (min-width: 620px) {
  .simulation-open .gate-simulation .chalk-controls button { min-height: 44px; padding: 4px 7px; line-height: 1.25; }
}
@media (max-height: 470px) and (min-width: 700px) {
  .simulation-open #museum-map:has(.casebook) { width: min(920px, calc(100% - 24px)); padding: 16px; }
  .simulation-open .casebook:not(.practice-menu) { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .simulation-open .casebook > .museum-map-header { grid-column: 1 / -1; }
  .simulation-open .casebook > .casebook-mission { align-self: start; }
  .simulation-open .casebook > section:has(.casebook-evidence) { grid-column: 2; }
  .simulation-open .casebook-evidence li { grid-template-columns: minmax(0, 1fr); gap: 2px; padding-block: 6px; }
  .simulation-open .casebook-evidence li::before { top: 6px; }
  .simulation-open .practice-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 619px) {
  .simulation-open .gate-simulation .chalk-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .simulation-open .gate-simulation .chalk-controls .primary { grid-column: auto; }
  .simulation-open .gate-simulation .chalk-question { text-align: left; }
  .simulation-open .casebook-evidence li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .simulation-open .casebook .museum-map-header { gap: 8px; }
  .simulation-open .casebook .museum-map-close { margin-inline-start: auto; }
}

@media (orientation: portrait) and (min-width: 620px) {
  .simulation-open .gate-simulation { align-self: flex-start; grid-template-rows: auto auto auto auto; }
  .simulation-open .gate-simulation .chalk-models { align-items: start; }
}

/* Lessons 2–6 share the mosaic frame; their mathematical colors stay meaningful. */
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) {
  width: min(calc(100% - 20px), 1470px);
  margin-block: 8px;
  padding: 10px clamp(12px, 1.8vw, 24px) max(14px, env(safe-area-inset-bottom));
  font-size: 1rem;
  line-height: 1.5;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .task {
  margin-bottom: 8px;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .task h1 {
  font-size: var(--stage-lesson-title);
  line-height: 1.3;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .prompt {
  margin-top: 4px;
  font-size: var(--stage-problem-text);
  line-height: 1.5;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .lesson-workspace {
  flex: 0 0 auto;
  grid-template-rows: auto;
  align-content: start;
  align-items: start;
  gap: clamp(10px, 1.3vw, 18px);
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .lesson-workspace > * {
  min-width: 0;
}
.simulation-open #app[data-lesson-backdrop] .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) :is(.diagram, .interaction) {
  padding: clamp(12px, 1.4vw, 20px);
  border-color: #8f8370;
  background: #1e2423;
  box-shadow: none;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) :is(.entry, .choice-set, .feedback, .success, .options label) {
  font-size: 1rem;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) :is(button, .options label, .entry input, summary) {
  min-height: 44px;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) button {
  min-width: 44px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .entry input {
  min-width: 0;
  max-width: 100%;
}
.simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .quiet:hover:not(:disabled) {
  background: #42493e;
  border-color: #c6b48e;
  color: #fff1d9;
}

/* Learning and mission are small controls beside a short, readable status. */
.simulation-open .simulation-phase-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-block: 14px 0;
  padding-block: 12px 0;
  border-top: 1px solid #91877370;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--case-muted);
}
.simulation-open .simulation-phase-bar p { font-size: .9375rem; }
.simulation-open .casebook-source { display: block; margin-top: 3px; color: var(--case-muted); font-size: .875rem; }
.simulation-open .practice-options button[data-chapter-training] {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--case-line);
  border-radius: 5px;
  background: var(--case-raised);
  color: var(--case-ink);
  text-align: left;
}
.simulation-open .simulation-phase-bar > * { min-width: 0; }
.simulation-open .simulation-phase-bar p { flex: 1 1 220px; overflow-wrap: anywhere; }
.simulation-open .simulation-phase-bar strong { color: var(--case-ink); }
.simulation-open .simulation-phase-bar :is(.simulation-phase-actions, .simulation-phase-buttons) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.simulation-open :is(.simulation-phase-bar, .simulation-training-controls) button {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border: 1px solid #ad9c7e;
  border-radius: 5px;
  background: #303735;
  color: var(--case-ink);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.simulation-open .simulation-phase-bar button.primary {
  background: #f1cd92;
  border-color: #f1cd92;
  color: #28221b;
}
.simulation-open .simulation-phase-bar button:disabled { opacity: .58; }
.simulation-open :is(.simulation-phase-bar, .simulation-training-controls) button:hover:not(:disabled) {
  border-color: #ffe3aa;
  background: #454c3f;
  color: #fff2d7;
}
.simulation-open .simulation-phase-bar button.primary:hover:not(:disabled) { background: #ffe0ad; color: #28221b; }
.simulation-open .simulation-training-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 10px 0; }
.simulation-open :is(.simulation-phase-bar, .simulation-training-controls) button:focus-visible {
  outline: 3px solid var(--case-gold);
  outline-offset: 3px;
}

/* Map bars retain gold/blue fills, grouping bands, and a visible zero baseline. */
.simulation-open .lesson.chalk-lesson.chapter2 .map-ruler { --ruler-line: #c6beaad9; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-scale-axis { color: #f7ead1; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-track { background: #121918; box-shadow: 0 0 0 1px #aaa18a8c, -2px 0 #f3dfb8; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-steps { border-color: #95866d; background: #2a302d; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-steps li > span { color: #e9e2d2; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-scale-key { border-color: #bdac8a; background: #3a3c31; color: #ffe7b5; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-grouping[aria-pressed="true"] { border-color: #f4d297; background: #4e4435; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-slot { border-color: #b8aa8d; background: #28302c; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-slot.drop-ready { border-color: #ffe2ab; background: #454c39; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-glass { border-color: #aecbd3; background: #273331; }
.simulation-open .lesson.chalk-lesson.chapter2 .map-glass :is(b, strong) { background: #17201ff0; color: #fff1d7; }
.simulation-open .lesson.chalk-lesson.chapter2 :is(.map-reading, .map-note, .map-mismatch) { color: #f4e8ce; }

/* Paper records keep dark ink; number-line and tile colors still identify quantities. */
.simulation-open .lesson.chalk-lesson.chapter3 .archive-diagram:not(:has(.archive-lines, .archive-table, .archive-film)) .archive-card {
  color: #342719;
  border-color: #c9aa7e;
  background: #f1deb7;
}
.simulation-open .lesson.chalk-lesson.chapter3 .archive-diagram:not(:has(.archive-lines, .archive-table, .archive-film)) .archive-card :is(strong, small) { color: #342719; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-diagram:has(.archive-lines, .archive-table, .archive-film) .archive-equation .archive-card {
  background: #303634;
  border-color: #a18f72;
  color: #fff1d9;
}
.simulation-open .lesson.chalk-lesson.chapter3 .archive-diagram:has(.archive-lines, .archive-table, .archive-film) .archive-equation small { color: #e3dac7; }
.simulation-open .lesson.chalk-lesson.chapter3 :is(.archive-lines, .archive-table-evidence:not(:empty), .film-proof) { background: #252d2a; border-color: #998b74; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-line { --axis-ink: #c9aa77; --axis-active: #ffda97; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-line + .archive-line { --axis-ink: #86afc8; --axis-active: #c0e4ff; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-line li.is-current::before { border-color: #252d2a; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-table :is(th, td) { border-color: #9a8c75; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-table thead th { background: #383e36; color: #f9edd5; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-table tbody tr:is([data-selected], :has(input:checked)) > * { background: #4b4636; }
.simulation-open .lesson.chalk-lesson.chapter3 .film-tray { border-color: #dec18b; background: #3a4339; }
.simulation-open .lesson.chalk-lesson.chapter3 .film-leftover { border-color: #efc6b4; background: repeating-linear-gradient(135deg, #303a33 0 5px, #41473a 5px 10px); }
.simulation-open .lesson.chalk-lesson.chapter3 .film-raw { background: transparent; border-color: transparent; }
.simulation-open .lesson.chalk-lesson.chapter3 .film-top { background: transparent; }
.simulation-open .lesson.chalk-lesson.chapter3 :is(.film-guide, .film-row p span) { color: #e7e0d1; }
.simulation-open .lesson.chalk-lesson.chapter3 .archive-file-cards label:has(input:checked) { background: #ffe4a5; color: #342719; }

/* The two wire patterns, strip ticks, and cross products remain distinct. */
.simulation-open .lesson.chalk-lesson.chapter4 .bench-formula .bench-term { background: linear-gradient(#3b443e, #29312d); border-color: #b4a17b; }
.simulation-open .lesson.chalk-lesson.chapter4 .bench-formula .bench-term[aria-pressed="true"] { background: #665035; }
.simulation-open .lesson.chalk-lesson.chapter4 .bench-strip .track { fill: #35443d; }
.simulation-open .lesson.chalk-lesson.chapter4 .bench-strip line { stroke: #202924; }
.simulation-open .lesson.chalk-lesson.chapter4 .bench-strip .outline { stroke: #d1d5bd; }
.simulation-open .lesson.chalk-lesson.chapter4 :is(.bench-note, .bench-pair-readout, .bench-strip p span) { color: #eae6d7; }

/* Correspondence tables use chalk; receipt cards remain readable paper objects. */
.simulation-open .lesson.chalk-lesson.chapter5 .store-table :is(th, td) { border-color: #9b927b; }
.simulation-open .lesson.chalk-lesson.chapter5 .store-table th { color: #f7eedc; background: #303b34; }
.simulation-open .lesson.chalk-lesson.chapter5 .store-card { background: #35392f; border-color: #b29d77; }
.simulation-open .lesson.chalk-lesson.chapter5 .store-proof { border-color: #9ba58d; background: #252e29; }
.simulation-open .lesson.chalk-lesson.chapter5 .store-scale p { background: #354237; }
.simulation-open .lesson.chalk-lesson.chapter5 .store-marks span { background: #2c3c32; }
.simulation-open .lesson.chalk-lesson.chapter5 .store-marks .fixed { background: #533e2c; }
.simulation-open .lesson.chalk-lesson.chapter5 .receipt-card { color: #29342d; background: #e9d7a7; }
.simulation-open .lesson.chalk-lesson.chapter5 .receipt-card :is(b, strong, span) { color: #302b1e; }
.simulation-open .lesson.chalk-lesson.chapter5 .receipt-card[aria-pressed="true"] { background: #ffe5a6; color: #302b1e; }

/* The allocation tape retains its solid/hatched parts and validation colors. */
.simulation-open .lesson.chalk-lesson.chapter6 .share-bar { background: #35413a; border-color: #e1d0a4; }
.simulation-open .lesson.chalk-lesson.chapter6 .share-proof { border-color: #a4ad93; background: #2b352e; }
.simulation-open .lesson.chalk-lesson.chapter6 :is(.share-spec, .share-candidate) { color: #eee7d7; }
.simulation-open .lesson.chalk-lesson.chapter6 :is(.share-plates, .share-slots) { width: 100%; }
.simulation-open .lesson.chalk-lesson.chapter6 .share-plate { width: 100%; align-content: center; gap: 8px; padding: 12px; }
.simulation-open .lesson.chalk-lesson.chapter6 .share-plate img { width: 100%; max-width: 300px; aspect-ratio: 640 / 291; object-fit: contain; }

@media (orientation: landscape) and (min-width: 620px) {
  .simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .lesson-workspace {
    grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  }
}

/* Give the mathematical objects the remaining board area, rather than a blank footer. */
@media (orientation: landscape) and (min-width: 900px) and (min-height: 600px) {
  .simulation-open #app[data-lesson-backdrop] .chalk-lesson:not(.chalk-experiment) .lesson-workspace { flex: 1; grid-template-rows: minmax(min-content, 1fr); align-items: stretch; }
  .simulation-open #app[data-lesson-backdrop] .chalk-lesson .lesson-tools { align-content: center; }
  .simulation-open #app[data-lesson-backdrop] .chalk-lesson .model-content { flex: 1; align-content: center; }
  .simulation-open #app[data-lesson-backdrop] .chalk-lesson .check-diagram { min-height: 340px; }
  .simulation-open .lesson.chalk-lesson:not(.chalk-experiment) {
    min-height: calc(100svh - 78px);
    padding-inline: clamp(14px, 1.7vw, 26px);
  }
  .simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .lesson-workspace {
    flex: 1;
    grid-template-rows: minmax(min-content, 1fr);
    align-items: stretch;
  }
  .simulation-open .chalk-lesson .interaction { display: flex; flex-direction: column; justify-content: center; }
  .simulation-open .chalk-lesson .interaction > .simulation-phase-bar { margin-top: 14px; padding-top: 14px; }
  .simulation-open .chalk-lesson .map-diagram { justify-content: center; }
  .simulation-open .chalk-lesson :is(.bench-diagram, .store-diagram, .share-diagram) { grid-template-columns: minmax(0, 1fr); justify-content: stretch; align-content: center; }
  .simulation-open .chalk-lesson.chapter2 .map-ruler { gap: clamp(18px, 3.5svh, 28px); }
  .simulation-open .chalk-lesson.chapter2 .map-track { height: clamp(64px, 11svh, 90px); }
  .simulation-open .chalk-lesson.chapter2 .map-bar { height: 100%; }
  .simulation-open .chalk-lesson.chapter2 .map-measure-label strong { font-size: 1.75rem; }
  .simulation-open .chalk-lesson.chapter2 .map-grouping { margin-top: 16px; }
  .simulation-open .chalk-lesson.chapter3 .archive-diagram { align-content: center; }
  .simulation-open .chalk-lesson.chapter3 .archive-film { --film-tile: clamp(22px, 4.6cqw, 36px); gap: 12px; }
  .simulation-open .chalk-lesson.chapter3 .archive-ratio { font-size: clamp(2.15rem, 6cqw, 3.2rem); }
  .simulation-open .chalk-lesson.chapter3 .archive-bar span { padding-block: 16px; font-size: 1.5rem; }
  .simulation-open .chalk-lesson.chapter4 .bench-strips { gap: 18px; }
  .simulation-open .chalk-lesson.chapter4 .bench-strip svg { height: clamp(60px, 10svh, 82px); }
  .simulation-open .chalk-lesson.chapter4 .bench-diagram:has(.bench-proof) .bench-strip svg { height: 44px; }
  .simulation-open .chalk-lesson.chapter4 .bench-diagram:has(.bench-proof) .bench-strips { gap: 8px; }
  .simulation-open .chalk-lesson.chapter4 .bench-proof strong { font-size: 1.75rem; }
  .simulation-open .chalk-lesson.chapter5 .store-table :is(th, td) { padding: clamp(12px, 2.8svh, 24px) 8px; }
  .simulation-open .chalk-lesson.chapter5 .store-table td { font-size: 1.8rem; }
  .simulation-open .chalk-lesson.chapter5 .store-equation { font-size: 2.5rem; }
  .simulation-open .chalk-lesson.chapter6 .share-bar { min-height: clamp(84px, 16svh, 120px); }
  .simulation-open .chalk-lesson.chapter6 .share-tape { gap: 16px; }
  .simulation-open .chalk-lesson.chapter6 .share-proof { font-size: 1.125rem; }
  .simulation-open .lesson.chalk-lesson.chapter6 .share-plate { min-height: 160px; }
}
@media (orientation: portrait), (max-width: 619px) {
  .simulation-open.lesson-open #app { display: block; }
  .simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) {
    width: calc(100% - 12px);
    margin-block: 6px;
    padding-inline: clamp(10px, 2vw, 18px);
  }
  .simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .lesson-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }
  .simulation-open .simulation-phase-bar { align-items: flex-start; }
  .simulation-open .simulation-phase-bar p { flex-basis: 100%; }
  .simulation-open .lesson.chalk-lesson.chapter5 .receipt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (orientation: landscape) and (min-width: 620px) and (max-height: 500px) {
  .simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) {
    margin-block: 4px;
    padding: 6px 10px max(10px, env(safe-area-inset-bottom));
    border-width: 6px;
  }
  .simulation-open .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) .task { margin-bottom: 5px; }
  .simulation-open .simulation-phase-bar { gap: 4px 8px; padding-block: 3px; margin-bottom: 6px; }
  .simulation-open :is(.simulation-phase-bar, .simulation-training-controls) button { padding-inline: 9px; }
  .simulation-open #app[data-lesson-backdrop] .lesson.chalk-lesson:is(.chapter2, .chapter3, .chapter4, .chapter5, .chapter6) :is(.diagram, .interaction) { padding: 10px; }
}

@container museum-viewport (max-height: 650px) and (min-width: 620px) {
  .museum-stage .lesson.chalk-experiment {
    min-height: auto;
    padding-block: 12px;
    gap: 8px;
    grid-template-rows: auto auto auto auto;
  }
  .chalk-experiment .chalk-models > section { grid-template-rows: 1.8em auto; }
  .chalk-experiment .chalk-models .rack { grid-template-rows: 2.8em auto; }
  .chalk-experiment .chalk-empty-label { inset-block-start: 2.8em; }
  .chalk-experiment .chalk-feedback { block-size: 5rem; min-block-size: 5rem; }
}

@container museum-viewport (max-height: 380px) and (min-width: 620px) {
  .museum-stage .lesson.chalk-experiment { margin-block: 3px; padding-block: 6px; gap: 5px; }
  .chalk-experiment .chalk-question { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; }
  .museum-stage .chalk-experiment .chalk-question p { margin-top: 0; }
  .chalk-experiment .chalk-models { width: min(100%, 620px); justify-self: center; }
  #app .chalk-experiment .chalk-models .bundle {
    --chalk-tile: 24px;
    grid-template-rows: var(--chalk-tile) calc(var(--chalk-tile) + 2px);
  }
  .chalk-experiment .chalk-models .rail + .rail { padding-top: 1px; }
  .chalk-experiment :is(.rack-caption, .chalk-controls button) { word-break: keep-all; overflow-wrap: break-word; }
  .chalk-experiment .chalk-controls { grid-row: 3; }
  .chalk-experiment .chalk-feedback { block-size: 3.15rem; min-block-size: 3.15rem; }
  .chalk-experiment .chalk-equation { gap: 1px 12px; line-height: 1.35; }
  .chalk-experiment .chalk-equation > span:first-child { font-size: 2rem; }
}
