/* Reusable Theatre: the film fills the window; one control bar and one sheet recede around it. */
:root{
 color-scheme:dark;
 --ground:#0c0d0e;--surface:#17181a;--surface-2:#212224;--surface-3:#2b2c2e;--line:#26282a;--track:#3a3b3d;
 --text:#edeae4;--text-2:#ada9a1;--text-3:#8c8984;--accent:#d9cbae;--wrong:#d39468;
 --sheet-w:400px;--inset-w:244px;--bar-space:104px;--ease:cubic-bezier(.2,.7,.2,1);
 font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"Helvetica Neue",sans-serif;
 font-size:14px;line-height:1.4;color:var(--text);background:var(--ground);
 -webkit-font-smoothing:antialiased;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--ground)}
body{height:100dvh;min-height:0;overflow:hidden}
#theatre{height:100dvh;min-height:0;display:flex;flex-direction:column}
button,input,select{font:inherit;color:inherit}
button{background:none;border:0;border-radius:12px;padding:0;cursor:pointer;transition:background .16s ease,color .16s ease}
button:hover{background:var(--surface-2)}
:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
a{color:var(--text);text-underline-offset:3px}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}

/* Lesson identity and supporting-information link. */
header.bar{flex:none;min-height:56px;padding:6px 28px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 28px}
.bar-title{display:flex;align-items:baseline;gap:14px;min-width:0}
.bar-title a{font-size:14px;font-weight:600;text-decoration:none;white-space:nowrap}
.bar-title h1{margin:0;font-size:14px;font-weight:400;color:var(--text-2)}
.bar-title h1 span{color:var(--text-3)}
.bar-notes{display:flex;flex-wrap:wrap;align-items:center;gap:4px 20px;font-size:12px;color:var(--text-3)}
#about-open{height:44px;padding:0 10px;font-size:13px;color:var(--text-2)}

main{flex:1;min-height:0;display:flex}
.study{flex:1;min-width:0;display:flex}
.scene-composition{position:relative;flex:1;min-width:0}

/* Image field. #detail is the camera viewport; it narrows when the sheet opens. */
#stage{position:absolute;inset:0;overflow:hidden;background:var(--ground)}
#scene{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#detail,#caption-field{position:absolute;top:0;left:0;bottom:var(--bar-space);width:100%;touch-action:none;outline-offset:-3px;transition:width .45s var(--ease),bottom .3s var(--ease)}
.scene-composition:has(#sheet:not([hidden])) :is(#detail,#caption-field){width:calc(100% - var(--sheet-w) - 48px)}
.scene-composition:has(#sheet:not([hidden])):has(.lag-inset:not([hidden])) :is(#detail,#caption-field){width:calc(100% - var(--sheet-w) - var(--inset-w) - 64px)}
.scene-composition:has(#slice-controls:not([hidden])) :is(#detail,#caption-field){bottom:calc(var(--bar-space) + 52px)}
#caption-field{pointer-events:none;z-index:2}
#loading{position:absolute;inset:0;z-index:9;display:grid;place-items:center;background:var(--ground);color:var(--text-2)}

.procedure-caption{position:absolute;top:28px;left:36px;z-index:2;max-width:min(440px,46%);pointer-events:none}
.procedure-phase{display:block;font-size:14px;font-weight:500;color:var(--accent)}
.procedure-caption h2{margin:10px 0 12px;font-size:44px;line-height:1.02;font-weight:500;letter-spacing:-.025em}
.procedure-caption p{margin:0;font-size:16px;line-height:1.5;color:var(--text-2)}
.procedure-caption p:empty{display:none}
.detail-view-note{position:absolute;left:36px;bottom:14px;font-size:12px;color:var(--text-3);pointer-events:none}
#section-note{position:absolute;left:36px;bottom:36px;font-size:12px;color:var(--text-2);pointer-events:none}
#detail .orientation{position:absolute;right:28px;bottom:14px;font-size:12px;color:var(--text-3);pointer-events:none}

/* Synchronized schematic: top right of the image, beside the sheet when it is open. */
.lag-inset{position:absolute;top:20px;right:24px;z-index:3;width:var(--inset-w);padding:14px;border-radius:16px;background:rgba(12,13,14,.78);pointer-events:none;transition:right .45s var(--ease)}
.scene-composition:has(#sheet:not([hidden])) .lag-inset{right:calc(var(--sheet-w) + 48px)}
.lag-inset-heading{display:flex;flex-direction:column;gap:3px;padding-bottom:10px;margin-bottom:8px;border-bottom:1px solid var(--line)}
.lag-inset-heading strong{font-size:13px;font-weight:500}
.lag-inset-heading span{font-size:12px;color:var(--text-3)}
.lag-inset-diagram{display:block;width:100%;height:auto;overflow:hidden}
.lag-inset-diagram text{font-family:inherit;font-size:16px;font-weight:500;fill:var(--text-2)}
.lag-inset-diagram .lag-state-label{fill:var(--accent)}
.lag-inset-copy p{margin:6px 0 4px;min-height:34px;font-size:12px;line-height:1.45;color:var(--text-2)}
.lag-inset-copy small{display:block;font-size:11px;color:var(--text-3)}

/* One sheet: a teaching question takes it over; otherwise it holds steps. */
.sheet{position:absolute;top:16px;right:24px;z-index:4;width:var(--sheet-w);max-height:calc(100% - var(--bar-space) - 16px);overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;scrollbar-width:thin;scrollbar-color:var(--track) transparent;padding:28px;border-radius:24px;background:var(--surface);animation:sheet-in .32s var(--ease)}
@keyframes sheet-in{from{opacity:0;transform:translateX(14px)}}
.sheet[data-mode=question]>:not(#lesson){display:none}
.sheet[data-mode=steps] #lesson{display:none}
.sheet[data-mode=question]{height:calc(100% - var(--bar-space) - 16px);padding:0;overflow:hidden}
#lesson,#lesson-question{height:100%;min-height:0}
#lesson-question{display:flex;flex-direction:column}
.lesson-content{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;padding:28px 28px 16px;scrollbar-width:thin;scrollbar-color:var(--track) transparent}
.lesson-response{display:flex;flex-direction:column;gap:12px;flex:none;max-height:60%;padding:14px 28px 20px;border-top:1px solid var(--line)}
#lesson-title:focus{outline:none}
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin:-10px -12px 16px 0}
.sheet-head h2{margin:0;font-size:18px;font-weight:500}
#sheet-close{width:44px;height:44px;display:grid;place-items:center;color:var(--text-2)}

.drilling-method>span{display:block;margin-bottom:8px;font-size:12px;color:var(--text-3)}
.drilling-method>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;padding:3px;border-radius:12px;background:var(--ground)}
.drilling-method button{height:38px;border-radius:9px;font-size:13px;color:var(--text-2)}
.drilling-method button[aria-pressed=true]{background:var(--surface-3);color:var(--text)}

#step-explanation{margin:26px 0 18px}
#step-explanation .eyebrow{margin:0 0 6px;font-size:13px;font-weight:500;color:var(--accent)}
#step-title{margin:0 0 12px;font-size:22px;line-height:1.2;font-weight:500;letter-spacing:-.015em}
#pearls{list-style:none;margin:0;padding:0}
#pearls li{font-size:14px;line-height:1.6;color:var(--text-2)}
#pearls li+li{margin-top:10px}

.step-group{border-top:1px solid var(--line)}
.step-group summary{display:flex;align-items:center;gap:12px;min-height:48px;list-style:none;cursor:pointer;font-size:14px;color:var(--text-2)}
.step-group summary::-webkit-details-marker{display:none}
.step-group[data-active=true]>summary{color:var(--text)}
.stage-number{font-size:12px;color:var(--text-3);font-variant-numeric:tabular-nums}
.stage-chevron{margin:0 6px 4px auto;width:7px;height:7px;font-size:0;border-right:1.5px solid var(--text-3);border-bottom:1.5px solid var(--text-3);rotate:45deg;transition:rotate .2s ease}
.step-group[open] .stage-chevron{rotate:225deg;margin-bottom:-4px}
.step-substeps{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 6px;padding:0 0 12px 26px}
#steps .step-substeps button{min-height:36px;padding:6px 10px;border-radius:10px;text-align:left;font-size:13px;color:var(--text-2)}
#steps .step-substeps button[aria-current=step]{background:var(--surface-3);color:var(--text)}

#lesson-count{margin:0 0 12px;font-size:14px;font-weight:500;color:var(--accent)}
#lesson-title{margin:0 0 12px;font-size:26px;line-height:1.2;font-weight:500;letter-spacing:-.02em}
#lesson-prompt{margin:0;font-size:15px;line-height:1.5;color:var(--text-2)}
.lesson-choices{display:flex;flex-direction:column;gap:10px;margin-top:22px;counter-reset:choice}
.lesson-choices button{counter-increment:choice;display:flex;align-items:center;gap:14px;min-height:56px;padding:12px 16px;border-radius:14px;background:var(--surface-2);text-align:left;font-size:15px;line-height:1.4}
.lesson-choices button:hover{background:var(--surface-3)}
.lesson-choices button::before{content:counter(choice,upper-alpha);flex:none;width:26px;height:26px;display:grid;place-items:center;border:1px solid var(--track);border-radius:8px;font-size:12px;color:var(--text-2)}
.lesson:has(#lesson-feedback:not([hidden])) .lesson-choices button[data-result=""]{color:var(--text-3)}
.lesson-choices button[data-result=correct]{background:#24221e;box-shadow:inset 0 0 0 1.5px var(--accent)}
.lesson-choices button[data-result=correct]::before{content:"✓";background:var(--accent);border-color:var(--accent);color:var(--ground)}
.lesson-choices button[data-result=incorrect]{box-shadow:inset 0 0 0 1.5px var(--wrong)}
.lesson-choices button[data-result=incorrect]::before{content:"✕";border-color:var(--wrong);color:var(--wrong)}
.lesson-feedback{margin:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;font-size:15px;line-height:1.6;color:var(--text-2)}
.lesson-primary{flex:none;display:block;margin:0 0 0 auto;height:44px;padding:0 22px;border-radius:999px;background:var(--text);color:var(--ground);font-size:14px;font-weight:500}
.lesson-primary:hover{background:#fff}
.lesson:has(#lesson-feedback[hidden]) .lesson-primary{padding:0 4px;background:none;color:var(--text-2);font-weight:400}

/* Control bar. */
.playback{position:absolute;left:50%;bottom:24px;z-index:5;translate:-50% 0;width:min(1060px,calc(100% - 48px));display:flex;align-items:center;gap:12px;padding:10px 12px 10px 10px;border-radius:20px;background:var(--surface)}
#play{flex:none;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--text);color:var(--ground)}
#play:hover{background:#fff}
#play-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
#play-icon{width:13px;height:14px;margin-left:2px;background:currentColor;clip-path:polygon(0 0,100% 50%,0 100%)}
#play[data-playing=true] #play-icon{margin-left:0;clip-path:none;background:linear-gradient(90deg,currentColor 0 34%,transparent 34% 66%,currentColor 66%)}
#restart{flex:none;width:40px;height:44px;display:grid;place-items:center;color:var(--text-2)}
.scrubber{position:relative;flex:1;min-width:110px;height:36px;--at:0}
.chapter-track{position:absolute;left:0;right:0;top:50%;height:4px;margin-top:-2px;border-radius:2px;background:var(--track)}
.chapter-track::before{content:"";position:absolute;inset:0;border-radius:2px;background:var(--text);transform-origin:left;transform:scaleX(var(--at))}
.chapter-break{position:absolute;top:-1px;width:3px;height:6px;margin-left:-1.5px;background:var(--surface)}
.question-mark{position:absolute;top:50%;width:8px;height:8px;margin:-4px 0 0 -4px;border-radius:50%;background:var(--accent);display:none}
body[data-teaching=true] .question-mark{display:block}
.scrubber::after{content:"";position:absolute;top:50%;left:calc(var(--at)*100%);width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;background:#fff;pointer-events:none}
.scrubber:has(#progress:focus-visible)::after{box-shadow:0 0 0 3px var(--accent)}
.scrub-label{position:absolute;bottom:calc(100% - 4px);left:clamp(32px,calc(var(--at)*100%),calc(100% - 32px));translate:-50% 0;font-size:12px;color:var(--accent);white-space:nowrap;pointer-events:none}
#progress{position:absolute;inset:0;width:100%;height:100%;margin:0;background:transparent;-webkit-appearance:none;appearance:none;cursor:pointer}
#progress:focus-visible{outline:none}
#progress::-webkit-slider-runnable-track{height:36px;background:transparent}
#progress::-webkit-slider-thumb{-webkit-appearance:none;width:2px;height:36px;opacity:0}
#progress::-moz-range-track{background:transparent}
#progress::-moz-range-thumb{width:2px;height:36px;border:0;opacity:0}
#time{flex:none;font-size:13px;color:var(--text-2);font-variant-numeric:tabular-nums;white-space:nowrap}
.bar-rule{flex:none;width:1px;height:24px;background:var(--surface-3)}
.bar-text{flex:none;height:44px;padding:0 10px;font-size:13px;color:var(--text-2);white-space:nowrap}
.bar-key{color:var(--text-3)}
.playback-rate{display:flex;align-items:center;border-radius:12px}
.playback-rate select{field-sizing:content;height:44px;padding:0 6px;border:0;background:transparent;color:var(--text-2);cursor:pointer;-webkit-appearance:none;appearance:none;font-variant-numeric:tabular-nums}
.playback-rate:hover{background:var(--surface-2)}
.playback-rate option{background:var(--surface);color:var(--text)}

#bone-menu{inset:auto;margin:0;padding:6px;border:0;border-radius:14px;background:var(--surface-2);color:var(--text);box-shadow:0 14px 40px rgba(0,0,0,.55)}
#bone-menu:popover-open{display:flex;flex-direction:column;gap:2px;min-width:168px}
#bone-menu button{height:40px;padding:0 12px;border-radius:10px;text-align:left;font-size:13px;color:var(--text-2)}
#bone-menu button:hover{background:var(--surface-3)}
#bone-menu button[aria-pressed=true]{background:var(--surface-3);color:var(--text)}

.teaching-option{flex:none;position:relative;display:flex;align-items:center;gap:10px;height:44px;padding:0 10px;border-radius:12px;font-size:13px;color:var(--text-2);cursor:pointer;white-space:nowrap}
.teaching-option:hover{background:var(--surface-2)}
.teaching-option input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.teaching-option:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}
.teaching-option:has(input:checked){color:var(--text)}
.switch{position:relative;flex:none;width:34px;height:20px;border-radius:10px;background:var(--track);transition:background .2s ease}
.switch::after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--text);transition:translate .2s var(--ease),background .2s ease}
.teaching-option:has(input:checked) .switch{background:var(--accent)}
.teaching-option:has(input:checked) .switch::after{translate:14px 0;background:var(--ground)}

.bar-icon{flex:none;display:flex;align-items:center;gap:8px;height:44px;padding:0 12px;font-size:13px;color:var(--text-2)}
.bar-icon[aria-expanded=true]{background:var(--surface-3);color:var(--text)}
.bar-icon:disabled{opacity:.4;cursor:default;background:none}

.slice-controls{position:absolute;left:50%;bottom:calc(var(--bar-space) - 4px);z-index:5;translate:-50% 0;display:flex;align-items:center;gap:10px;padding:6px 8px 6px 16px;border-radius:14px;background:var(--surface);font-size:12px;color:var(--text-2);white-space:nowrap}
.slice-controls label{color:var(--text)}
.slice-controls input{width:180px;accent-color:var(--accent)}
.slice-controls output{width:34px;font-variant-numeric:tabular-nums}
.slice-controls button{height:36px;padding:0 10px;border-radius:10px}

dialog{width:min(640px,92vw);max-height:85vh;padding:0;border:0;border-radius:22px;background:var(--surface);color:var(--text-2);box-shadow:0 30px 100px rgba(0,0,0,.6)}
dialog::backdrop{background:rgba(6,7,8,.72)}
.dialog-title{display:flex;align-items:center;justify-content:space-between;padding:18px 18px 8px 28px}
.dialog-title h2{margin:0;font-size:20px;font-weight:500;color:var(--text)}
.dialog-title button{width:44px;height:44px;font-size:22px;color:var(--text-2)}
.dialog-body{padding:0 28px 22px;font-size:14px;line-height:1.7}

@media(max-width:1180px){
 :root{--sheet-w:340px;--inset-w:200px}
 .lag-inset{padding:10px}
 .lag-inset-copy p{min-height:0}
 .procedure-caption h2{font-size:36px}
 
}


/* Keep captions clear of the centered model when the desktop image becomes narrow. */
@media(min-width:901px){
 .scene-composition:has(#sheet:not([hidden])) .procedure-caption{max-width:28%}
 .scene-composition:has(#sheet:not([hidden])) .procedure-caption h2{font-size:clamp(15px,calc((100vw - var(--sheet-w) - var(--inset-w) - 64px)*.04),30px);margin:8px 0}
}

/* Narrow portrait: captions have their own band; image, controls and panel stay in view. */
@media(min-width:901px) and (max-width:1180px){
 .procedure-caption{left:24px;top:22px}
 .scene-composition:has(#sheet[data-mode=steps]:not([hidden])) .procedure-caption p{display:none}
 .procedure-caption p{font-size:14px}
 #detail .orientation{display:none}
}
@media(max-width:900px){
 :root{--bar-space:0px;--inset-w:184px;--caption-space:72px}
 header.bar{position:relative;padding:6px 14px;gap:2px 12px}
 .bar-title{padding-right:56px;gap:10px}
 .bar-title a,.bar-title h1{font-size:13px}
 .bar-title h1 span{display:none}
 .bar-notes{gap:0 12px;font-size:10px;line-height:1.5}
 #about-open{position:absolute;top:2px;right:6px;height:40px;font-size:12px;padding:0 8px}
 .scene-composition{display:flex;flex-direction:column;min-height:0}
 #stage{position:relative;inset:auto;order:0;flex:1 1 46%;min-height:0}
 #detail,.scene-composition:has(#sheet:not([hidden])) #detail,.scene-composition:has(#slice-controls:not([hidden])) #detail{top:var(--caption-space);width:100%;bottom:0}
 .scene-composition:has(.lag-inset:not([hidden])) #detail,.scene-composition:has(#sheet:not([hidden])):has(.lag-inset:not([hidden])) #detail{width:calc(100% - var(--inset-w) - 12px)}
 #caption-field,.scene-composition:has(#sheet:not([hidden])) #caption-field,.scene-composition:has(#sheet:not([hidden])):has(.lag-inset:not([hidden])) #caption-field{top:0;bottom:auto;height:var(--caption-space);width:100%}
 .playback{position:static;order:1;flex:none;translate:none;width:auto;margin:8px 10px 0;flex-wrap:wrap;gap:4px 6px;padding:8px;border-radius:16px}
 .scrubber{flex:1 1 0;min-width:64px}
 .bar-rule{flex-basis:100%;width:auto;height:0}
 .bar-text,.teaching-option,.bar-icon{height:40px}
 .bar-icon{margin-left:auto}
 .slice-controls{position:static;order:2;translate:none;margin:6px 10px 0;flex:none;flex-wrap:wrap}
 .slice-controls input{flex:1;width:auto;min-width:80px}
 .sheet,.sheet[data-mode=question]{position:static;order:3;width:auto;height:auto;max-height:none;flex:1 1 54%;min-height:0;margin:8px 10px 10px;border-radius:18px;animation:none}
 .sheet{padding:18px}
 .sheet[data-mode=question]{padding:0}
 #lesson-title{font-size:21px}
 .lesson-content{padding:18px 18px 12px}
 .lesson-response{padding:12px 18px;gap:10px}
 .lesson-choices{margin-top:14px;gap:8px}
 .lesson-choices button{min-height:44px;font-size:14px}
 .procedure-caption{top:8px;left:14px;right:14px;max-width:none}
 .procedure-phase{font-size:12px}
 .procedure-caption h2{margin:4px 0 0;font-size:21px;line-height:1.1}
 .procedure-caption p{display:none}
 .detail-view-note{left:14px;bottom:6px;font-size:11px}
 #section-note{left:14px;bottom:24px;font-size:11px}
 #detail .orientation{display:none}
 .lag-inset,.scene-composition:has(#sheet:not([hidden])) .lag-inset{top:calc(var(--caption-space) + 4px);right:10px;padding:10px;border-radius:12px}
}
@media(max-width:620px){
 :root{--inset-w:128px;--caption-space:56px}
 .bar-notes{font-size:9.5px}
 .sheet{padding:16px}
 .playback{gap:4px}
 #restart{width:32px}
 #time{font-size:12px}
 .bar-text,.teaching-option,.bar-icon{padding-left:6px;padding-right:6px;font-size:12px}
 .playback-rate{padding:0}
 .teaching-option{gap:6px}
 .bar-icon svg{display:none}
 .procedure-caption h2{font-size:19px}
 #lesson-count{margin-bottom:6px;font-size:13px}
 #lesson-title{font-size:19px;margin-bottom:6px}
 .lesson-content{padding:16px 16px 10px}
 .lesson-response{padding:10px 16px;gap:8px}
 .lesson-choices{margin-top:12px;gap:6px}
 .lesson-choices button{min-height:44px;padding:8px 12px;gap:10px;font-size:13.5px}
 .lesson-choices button::before{width:22px;height:22px}
 .lesson-feedback{font-size:13.5px}
 .lesson-primary{height:40px}
 .lag-inset,.scene-composition:has(#sheet:not([hidden])) .lag-inset{right:8px;padding:8px}
 .lag-inset-heading{padding-bottom:6px;margin-bottom:4px}
 .lag-inset-heading strong{font-size:10px}
 .lag-inset-heading span{display:none}
 .lag-inset-copy p{display:none}
 .lag-inset-copy small{font-size:9px}
}
/* Short desktop windows need compact questions, with feedback and Continue pinned below choices. */
@media(min-width:621px) and (max-height:760px){
 #lesson-count{font-size:13px;margin-bottom:8px}
 #lesson-title{font-size:22px;margin-bottom:8px}
 #lesson-prompt{font-size:14px}
 .lesson-content{padding:18px 20px 12px}
 .lesson-response{padding:12px 20px;gap:8px}
 .lesson-choices{margin-top:14px;gap:6px}
 .lesson-choices button{min-height:44px;padding:8px 12px;font-size:14px;gap:10px}
 .lesson-choices button::before{width:22px;height:22px}
 .lesson-feedback{font-size:14px;line-height:1.45}
 .lesson-primary{height:40px}
}
/* Landscape phones and short windows: a bounded side panel and one compact control row. */
@media(min-width:481px) and (max-height:600px) and (orientation:landscape){
 :root{--bar-space:72px;--sheet-w:clamp(250px,42vw,340px);--inset-w:116px;--caption-space:56px}
 header.bar{position:relative;min-height:40px;padding:3px 12px;gap:0 10px}
 .bar-title{gap:10px;padding-right:48px}
 .bar-title a,.bar-title h1{font-size:12px}
 .bar-title h1 span{display:none}
 .bar-notes{font-size:9px;line-height:1.3;gap:0 12px}
 #about-open{position:absolute;right:6px;top:0;height:36px;font-size:12px}
 .scene-composition{display:block}
 #stage{position:absolute;inset:0;min-height:0}
 #detail,.scene-composition:has(#sheet:not([hidden])) #detail,.scene-composition:has(#slice-controls:not([hidden])) #detail{top:var(--caption-space);bottom:var(--bar-space);width:100%}
 .scene-composition:has(.lag-inset:not([hidden])) #detail{width:calc(100% - var(--inset-w) - 16px)}
 .scene-composition:has(#sheet:not([hidden])) #detail{width:calc(100% - var(--sheet-w) - 24px)}
 .scene-composition:has(#sheet:not([hidden])):has(.lag-inset:not([hidden])) #detail{width:calc(100% - var(--sheet-w) - var(--inset-w) - 32px)}
 #caption-field,.scene-composition:has(#sheet:not([hidden])) #caption-field,.scene-composition:has(#sheet:not([hidden])):has(.lag-inset:not([hidden])) #caption-field{top:0;bottom:auto;width:100%;height:var(--caption-space)}
 .scene-composition:has(#sheet:not([hidden])) #caption-field,.scene-composition:has(#sheet:not([hidden])):has(.lag-inset:not([hidden])) #caption-field{width:calc(100% - var(--sheet-w) - 24px)}
 .procedure-caption{top:6px;left:12px;right:8px;max-width:none}
 .procedure-phase{font-size:11px}
 .procedure-caption h2{font-size:18px;line-height:1.1;margin:3px 0 0}
 .procedure-caption p,#detail .orientation{display:none}
 .lag-inset,.scene-composition:has(#sheet:not([hidden])) .lag-inset{top:var(--caption-space);right:8px;padding:6px}
 .scene-composition:has(#sheet:not([hidden])) .lag-inset{right:calc(var(--sheet-w) + 16px)}
 .lag-inset-heading{margin-bottom:4px;padding-bottom:4px}
 .lag-inset-heading strong{font-size:10px}
 .lag-inset-heading span,.lag-inset-copy p{display:none}
 .lag-inset-copy small{font-size:8px}
 .sheet,.sheet[data-mode=question]{position:absolute;top:4px;right:8px;bottom:var(--bar-space);width:var(--sheet-w);height:auto;max-height:none;margin:0;border-radius:14px}
 .sheet{padding:12px}
 .sheet[data-mode=question]{padding:0}
 .lesson-content{padding:12px 14px 8px}
 #lesson-count{font-size:12px;margin-bottom:6px}
 #lesson-title{font-size:17px;margin-bottom:6px}
 #lesson-prompt{font-size:12px}
 .lesson-choices{margin-top:10px;gap:6px}
 .lesson-choices button{font-size:12px;min-height:36px;padding:6px 8px;gap:8px}
 .lesson-choices button::before{width:20px;height:20px;font-size:11px}
 .lesson-response{padding:8px 14px;gap:6px}
 .lesson-feedback{font-size:12px;line-height:1.4}
 .lesson-primary{height:36px;font-size:12px;padding:0 16px}
 .playback{position:absolute;left:8px;right:8px;bottom:8px;width:auto;margin:0;translate:none;flex-wrap:nowrap;gap:4px;padding:6px;border-radius:16px}
 .bar-rule{display:none}
 #play{width:40px;height:40px}
 #restart{width:30px;height:40px}
 .scrubber{min-width:48px}
 #time{font-size:12px}
 .bar-text,.teaching-option,.bar-icon{height:40px;padding:0 6px;font-size:12px}
 .playback-rate{padding:0}
 .teaching-option{gap:6px}
 .bar-icon{margin-left:0;gap:6px}
 .bar-icon svg{display:none}
 .slice-controls{position:absolute;left:8px;right:auto;bottom:var(--bar-space);margin:0;padding:4px 8px;gap:6px;font-size:10px}
 .scene-composition:has(#sheet:not([hidden])) .slice-controls{right:calc(var(--sheet-w) + 16px);width:auto;gap:4px;padding:4px 6px;flex-wrap:nowrap}
 .slice-controls input{flex:1;min-width:48px;width:100px}
 .scene-composition:has(#sheet:not([hidden])) .slice-controls input{width:auto}
 .slice-controls button{height:28px}
 #section-note{display:none}
 .scene-composition:has(#slice-controls:not([hidden])) #detail{bottom:calc(var(--bar-space) + 38px)}
}
@media(prefers-reduced-motion:reduce){
 *,*::before,*::after{transition:none!important;animation:none!important}
}

[data-loading=true] .playback{opacity:.5}

/* One stable header: lesson identity, technique choices, supporting information. */
#theatre header.bar{min-height:78px;padding:12px 28px;gap:16px 24px;flex-wrap:nowrap;border-bottom:1px solid var(--line)}
#theatre .bar-title{min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:0}
#theatre .bar-title a{font-size:12px;font-weight:500;color:var(--text-3)}
#theatre .bar-title h1{font-size:17px;font-weight:500;line-height:1.25;color:var(--text);letter-spacing:-.02em}
#theatre .bar-notes{flex:none;justify-self:end}
#theatre #about-open{position:static;min-height:44px;height:auto;padding:0 10px;font-size:12px;color:var(--text-2);white-space:nowrap}
#about-open span{margin-left:6px;color:var(--text-3)}
#theatre.has-comparison header.bar{display:grid;grid-template-columns:minmax(0,1fr) 360px minmax(0,1fr);height:88px;min-height:88px;gap:24px;align-items:center}
#theatre .comparison-controls{min-width:0;width:100%;margin:0;padding:0;background:none;border:0}
#theatre .comparison-controls>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;width:100%;padding:4px;border:1px solid #45433e;border-radius:14px;background:var(--ground)}
#theatre .comparison-controls button{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:2px;min-height:48px;height:48px;padding:6px 10px 6px 31px;border-radius:9px;color:var(--text-2);font-size:13px;line-height:1.25;text-align:left}
#theatre .comparison-controls button::before{content:'';position:absolute;left:11px;top:50%;translate:0 -50%;width:10px;height:10px;border:1px solid #827c70;border-radius:50%}
#theatre .comparison-controls button:hover{background:var(--surface-2);color:var(--text)}
#theatre .comparison-controls button[aria-pressed=true]{background:var(--accent);color:var(--ground);box-shadow:0 1px 5px #0004}
#theatre .comparison-controls button[aria-pressed=true]::before{border-color:currentColor;background:currentColor;box-shadow:inset 0 0 0 2px var(--accent)}
#theatre .comparison-first{font-weight:600}
#theatre .comparison-next{font-size:11px}
.dialog-body section+section{border-top:1px solid var(--line);margin-top:20px;padding-top:16px}
.dialog-body h3{font-size:13px;font-weight:600;color:var(--text);margin:0 0 10px}
.dialog-body p{margin:8px 0}
@media(min-width:901px) and (max-width:1100px){
 #theatre.has-comparison header.bar{grid-template-columns:minmax(0,1fr) 340px 44px;gap:20px;padding:12px 20px}
 #theatre.has-comparison #about-open{width:44px;padding:0;font-size:0}
 #theatre.has-comparison #about-open span{display:none}
 #theatre.has-comparison #about-open::before{content:'ⓘ';font-size:20px}
}
@media(max-width:900px){
 #theatre header.bar{min-height:72px;padding:10px 14px;gap:12px}
 #theatre .bar-title h1{font-size:16px}
 #theatre .bar-title a{font-size:11px}
 #theatre #about-open{font-size:11px;padding:0 4px}
 #theatre.has-comparison header.bar{grid-template-columns:minmax(0,1fr) 320px 44px;height:80px;min-height:80px;gap:16px;padding:8px 14px}
 #theatre.has-comparison #about-open{width:44px;padding:0;font-size:0}
 #theatre.has-comparison #about-open span{display:none}
 #theatre.has-comparison #about-open::before{content:'ⓘ';font-size:20px}
 #theatre .comparison-controls button{font-size:12px;padding-left:28px;padding-right:6px}
 #theatre .comparison-controls button::before{left:9px}
 #theatre .comparison-next{font-size:10px}
}
@media(max-width:700px){
 #theatre.has-comparison header.bar{grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:58px 58px;height:140px;min-height:140px;padding:8px 14px;gap:8px 12px}
 #theatre.has-comparison .comparison-controls{grid-column:1 / -1;grid-row:2}
 #theatre.has-comparison .bar-notes{grid-column:2;grid-row:1;position:static}
 #theatre.has-comparison .bar-title{width:auto;gap:4px}
 #theatre.has-comparison .bar-title a{padding:0}
 #theatre .comparison-controls button{font-size:13px}
 #theatre .comparison-next{font-size:11px}
}
@media(min-width:481px) and (max-height:600px) and (orientation:landscape){
 #theatre header.bar{min-height:46px;padding:4px 12px;gap:12px}
 #theatre .bar-title{flex-direction:column;align-items:flex-start;gap:3px}
 #theatre .bar-title h1{font-size:13px}
 #theatre .bar-title a{font-size:11px}
 #theatre #about-open{min-height:44px;font-size:11px}
 #theatre.has-comparison header.bar{grid-template-columns:minmax(0,1fr) 300px 44px;grid-template-rows:none;height:68px;min-height:68px;gap:12px;padding:6px 12px}
 #theatre.has-comparison .comparison-controls,#theatre.has-comparison .bar-notes{grid-column:auto;grid-row:auto}
 #theatre .comparison-controls button{height:44px;min-height:44px;font-size:12px;padding-top:3px;padding-bottom:3px}
 #theatre .comparison-next{font-size:10px}
}
