*{box-sizing:border-box}
:root{color-scheme:light;--ink:#173d36;--muted:#50665c;--line:#deded1;--paper:#faf7ed;--white:#fffdf7;--orange:#a0412b;--yellow:#f7ca79;font-family:"DM Sans",system-ui,sans-serif;color:var(--ink);background:var(--paper)}
body{margin:0;line-height:1.45}
h1,h2,p,figure{margin:0}
h1{font-size:clamp(1.6rem,5.8vw,2.55rem);line-height:1.13;letter-spacing:-.035em}
h2{font-size:1.15rem}
button,select,input,textarea{font:inherit;color:inherit;min-height:46px}
button{cursor:pointer;border:1px solid var(--line);border-radius:13px;background:var(--white);font-weight:650;padding:.58rem .83rem}
button:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible{outline:3px solid #bd601b;outline-offset:2px}
button:disabled{cursor:default;opacity:.78}
button.primary{background:var(--ink);border-color:var(--ink);color:white}
button.warm{background:var(--yellow);border-color:transparent}
.bar{min-height:62px;background:var(--ink);color:white;display:flex;justify-content:space-between;align-items:center;padding:6px max(15px,calc((100% - 920px)/2));gap:12px}
.bar>div{display:flex;align-items:center;gap:9px;white-space:nowrap}
.bar button{color:white;background:transparent;border-color:#73978a;font-size:.82rem}
.mark{background:var(--yellow);color:var(--ink);display:inline-grid;place-items:center;width:32px;height:32px;border-radius:10px 10px 10px 2px;font-weight:900;font-size:1.15rem}
main{max-width:950px;margin:auto;padding:clamp(14px,3vw,28px) 15px 28px}
.hero{display:grid;grid-template-columns:1.45fr 1fr;overflow:hidden;border-radius:22px;background:#e5ede2;min-height:170px}
.hero div{padding:clamp(15px,4vw,36px);align-self:center}
.hero p{margin-top:.6rem;color:#36554b;max-width:31ch}
.hero img{width:100%;height:100%;min-height:170px;object-fit:cover}
.setup{margin:16px 0;display:grid;grid-template-columns:1fr 1fr;gap:10px 14px;padding:14px;background:var(--white);border:1px solid var(--line);border-radius:16px}
.setup label{display:grid;align-content:start;gap:4px;font-size:.86rem;font-weight:700}
.setup select{border:1px solid var(--line);border-radius:9px;background:#fff;padding:5px 8px;width:100%}
.setup p{grid-column:1/-1;font-size:.82rem;color:var(--muted)}
.tracks{display:grid;gap:9px}
.track{display:grid;grid-template-columns:44px 1fr auto;align-items:center;gap:10px;text-align:left;width:100%;min-height:65px}
.track strong,.track small{display:block}
.track small{color:var(--muted);font-weight:450}
.icon{display:grid;place-items:center;width:40px;height:40px;border-radius:11px;background:#deebe3;font-size:1.3rem}
.track:nth-child(2) .icon{background:#f5e2ba}
.track:nth-child(3) .icon{background:#f1dbd3}
.resume{margin:0 0 10px;width:100%}
.toolbar{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:9px}
.toolbar span{font-size:.87rem;font-weight:700;text-align:right}
progress{width:100%;height:7px;display:block;appearance:none;margin-bottom:12px;border:0}
progress::-webkit-progress-bar{background:#e7e3d5;border-radius:5px}
progress::-webkit-progress-value{background:#648477;border-radius:5px}
.card{display:grid;gap:12px}
.scene{background:#e9eee4;border-radius:16px;overflow:hidden;min-width:0}
.scene img{width:100%;height:clamp(144px,25vh,235px);object-fit:contain;display:block;background:#e4e9dd}
.scene details{padding:8px 12px}
summary{cursor:pointer;font-weight:700;padding:3px 0}
.scene p{margin-top:4px}
.scene.text{padding:13px}
.scene.text h2{margin-bottom:3px}
.answer{display:grid;align-content:start;gap:9px}
.type{font-size:.83rem;font-weight:750;color:var(--orange)}
.answer h1{font-size:clamp(1.28rem,4.4vw,1.9rem)}
.controls{display:flex;gap:7px;flex-wrap:wrap}
.controls button{font-size:.86rem}
.options,.marks{display:grid;gap:6px}
.options button{text-align:left}
.options .right{background:#dcecdf;border-color:#6b917e;opacity:1}
.options .wrong{background:#f8e2d9;border-color:#af705b;opacity:1}
.note{border-radius:12px;padding:9px 12px;background:#f6e8c8}
.model{background:#e3eee3}
.model p+p{margin-top:4px}
.model ul{margin:4px 0 6px;padding-left:1.3rem}
.hints p+p{margin-top:5px}
.marks{grid-template-columns:repeat(3,1fr)}
.marks button{padding:.35rem;font-size:.82rem}
.nav{display:flex;justify-content:space-between;gap:8px}
.status{font-size:.85rem;color:var(--orange)}
.controls:empty{display:none}
.hero{margin-bottom:12px}
.track[aria-pressed="true"]{border-color:#648477;background:#edf2e8}
.start{grid-column:1/-1}
.visible-story{padding:0 12px 10px}
.edit{justify-self:start;font-size:.86rem}
.correction-panel,.correction{display:grid;gap:7px}
.correction select{width:100%;min-width:0;border:1px solid var(--line);border-radius:9px;background:var(--white);padding:5px 8px}
.result{display:grid;gap:12px}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}
.stats div,.log li{padding:10px;background:var(--white);border:1px solid var(--line);border-radius:11px}
.stats strong{display:block;font-size:1.4rem}
.stats span{font-size:.82rem}
.log{display:grid;gap:6px;list-style:none;padding:0;margin:0}
.log small{display:block;color:var(--muted)}
@media(min-width:680px){.card{grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:20px}.scene{align-self:start}.scene img{height:auto;max-height:410px}.tracks{grid-template-columns:repeat(3,1fr)}.track{min-height:97px}.hero{min-height:238px}.hero img{max-height:250px;object-position:center 40%}}
@media(max-width:370px){.hero p{font-size:.86rem}.setup{padding:9px}.bar button{padding:.4rem}.stats div{padding:7px}}
@media(max-width:679px){
  .silent .scene img{height:clamp(100px,19vh,150px)}
  .silent .scene,.silent .answer{font-size:.93rem}
  .silent .answer{gap:7px}
  .silent .marks button{min-width:0}
}
@media(min-width:680px){.track:last-child:nth-child(5){grid-column:span 2}}
.profile-panel{display:grid;gap:9px;margin:0 0 12px;padding:12px;background:var(--white);border:1px solid var(--line);border-radius:16px}
.profile-row{display:flex;flex-wrap:wrap;gap:8px;align-items:end;justify-content:space-between}
.profile-select-wrap{display:grid;gap:4px;font-size:.84rem;font-weight:700;flex:1 1 170px;min-width:0}
.profile-select-wrap select,.profile-editor input,.note-box textarea{width:100%;border:1px solid var(--line);border-radius:9px;background:#fff;padding:8px 10px}
.profile-actions,.profile-links{display:flex;gap:7px;flex-wrap:wrap}
.profile-actions button,.profile-links button{font-size:.84rem;padding:.45rem .72rem}
.profile-editor{display:grid;gap:8px;background:#edf2e8}
.profile-editor label{font-size:.86rem;font-weight:700}
.review-box{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;margin:0 0 12px;padding:12px 14px;background:var(--white);border:1px solid var(--line);border-radius:16px}
.review-box strong,.review-box small{display:block}
.review-box small,.muted-note,.history-meta,.history-counts{color:var(--muted);font-size:.86rem}
.review-box.empty{background:#f4f2e8}
.note-box,.backup-card{display:grid;gap:8px;background:var(--white);border:1px solid var(--line)}
.note-box textarea{resize:vertical;min-height:76px}
.saved-tag{align-self:center;font-size:.86rem;font-weight:700;color:#2e6049}
.status.ok{color:#2e6049}
.meta-line{font-size:1rem}
.history-list{display:grid;gap:9px;list-style:none;padding:0;margin:0}
.history-card{display:grid;gap:6px;padding:12px 14px;background:var(--white);border:1px solid var(--line);border-radius:14px}
.history-head{display:flex;justify-content:space-between;align-items:baseline;gap:8px;flex-wrap:wrap}
.history-head span{font-size:.84rem;color:var(--muted)}
.history-note{font-size:.9rem}
.file-picker{display:grid;gap:6px;font-size:.86rem;font-weight:700;width:100%}
.file-picker input{border:1px dashed var(--line);border-radius:10px;padding:8px;background:var(--paper);max-width:100%}
.option-row{display:flex;gap:7px;align-items:stretch}
.opt-btn{flex:1 1 auto;display:flex;align-items:center;gap:10px;text-align:left;padding:7px 11px;min-height:60px}
.opt-art{flex:0 0 54px;height:50px;display:grid;place-items:center;background:#edf2e8;border-radius:10px;overflow:hidden}
.opt-btn.right .opt-art{background:#c8e3cd}
.opt-btn.wrong .opt-art{background:#f2cfc2}
.opt-art svg{display:block}
.opt-text{flex:1 1 auto;line-height:1.3}
.opt-speak{flex:0 0 46px;padding:0;display:grid;place-items:center;font-size:1.15rem;background:#f4f2e8}
@keyframes optFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}
@keyframes optBounce{0%,100%{transform:translateY(0) scale(1)}50%{transform:translateY(-4px) scale(1.04)}}
@keyframes optSway{0%,100%{transform:rotate(0deg)}35%{transform:rotate(-5deg)}70%{transform:rotate(5deg)}}
@keyframes optPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.07)}}
@keyframes optDrip{0%,100%{transform:translateY(0)}50%{transform:translateY(3px)}}
.anim-float svg{animation:optFloat 2.8s ease-in-out infinite}
.anim-bounce svg{animation:optBounce 2.2s ease-in-out infinite}
.anim-sway svg{animation:optSway 3s ease-in-out infinite}
.anim-pulse svg{animation:optPulse 2.4s ease-in-out infinite}
.anim-drip svg{animation:optDrip 2.2s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){.opt-art svg{animation:none !important}}
.skill-section{display:grid;gap:8px}
.skill-card summary small{display:block;color:var(--muted);font-weight:500}
.skill-card[open] .log{margin:8px 0}
.skill-card .log li{overflow-wrap:anywhere}
.teaching-note{border-top:1px solid var(--line);font-size:.89rem;color:var(--muted);padding:3px 0}
.teaching-note p{padding:2px 0 5px}
.scene.text .story-text{padding:3px 0 0}
.scene-zoom{position:relative;display:block;width:100%;padding:0;border:0;border-radius:0;background:transparent}
.scene-zoom span{position:absolute;right:8px;bottom:8px;display:grid;place-items:center;width:34px;height:34px;background:var(--ink);color:white;border-radius:9px}
.scene-zoom:focus-visible{outline-offset:-3px}
.scene-dialog{border:0;padding:12px;border-radius:15px;background:var(--paper);color:var(--ink);max-width:calc(100vw - 20px);max-height:calc(100vh - 20px)}
.scene-dialog::backdrop{background:rgba(12,32,27,.76)}
.scene-dialog>div{display:grid;gap:6px}
.scene-dialog button{justify-self:end}
.scene-dialog img{display:block;max-width:min(700px,calc(100vw - 48px));max-height:calc(100vh - 120px);height:auto;width:auto;margin:auto;object-fit:contain}
.hotspot-image{position:relative;max-width:435px;margin:auto}
.hotspot-image img,.silent .hotspot-image img{width:100%;height:auto;max-height:none;object-fit:fill}
@media(max-width:679px){.hotspot-image{max-width:min(100%,32vh)}}
.hotspot{position:absolute;transform:translate(-50%,-50%);min-height:0;min-width:0;padding:0;background:transparent;border:2px solid transparent;border-radius:9px}
.hotspot[aria-pressed=true]{background:#f7ca7955;border-color:#755311}
.hotspot.correct{border-color:#24604a;background:#59a47655;opacity:1}
.hotspot.wrong{border-color:#af705b;background:#e07a5f55;opacity:1}
.activity{display:grid;gap:8px}
.activity-help,.activity-status{margin:0;font-size:.86rem}
.activity-status:empty{display:none}
.activity-status{font-weight:700;color:var(--ink)}
.activity-tiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.activity-tile{position:relative;display:grid;justify-items:center;align-content:start;gap:2px;padding:6px 3px;min-height:72px;font-size:.86rem}
.activity-icon{display:inline-block;width:52px;height:48px}
.activity-icon svg{display:block;width:100%;height:100%}
.activity-tile[aria-pressed=true]{background:#f5e5bf;border-color:#85612a}
.activity-tile.correct{background:#dceee2;border-color:#3d735d;opacity:1}
.activity-tile.wrong{background:#f8e2d9;border-color:#af705b;opacity:1}
.activity-target{border-style:dashed;background:#edf2e9}
.activity-target small{font-weight:550;color:var(--muted)}
.order-badge{position:absolute;top:5px;right:5px;border-radius:100%;background:var(--ink);color:white;width:23px;height:23px;display:grid;place-items:center}
.activity-solution{padding:7px 9px;background:#e3eee4;border-radius:9px}
.activity-solution ol,.activity-solution ul{display:grid;gap:3px;margin:4px 0;padding-left:20px}
.activity-solution li .activity-icon{width:28px;height:26px;vertical-align:middle}
.activity-solution li span{margin-right:.3rem}
.lesson-instruction{padding:8px 10px;background:#e9efe5;border-radius:9px;font-size:.9rem}
.model [data-action=lesson-model]{margin-top:7px}
.lesson-results li small+small{margin-top:3px;font-weight:700}
.bar .bar-actions{min-width:0;justify-content:flex-end;gap:5px}
.role-page,.role-grid,.family-grid,.goal-grid{display:grid;gap:10px}
.role-grid,.family-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.role-card{display:grid;align-content:center;text-align:left;gap:5px;min-height:94px;padding:13px 15px}
.role-card strong{font-size:1.1rem}
.role-card span{font-weight:450;color:var(--muted)}
.role-family{background:#e2ede2;border-color:#8dab9d}
.teacher-plan{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 12px;padding:12px;border-radius:12px;background:#e5ede2}
.teacher-plan p{font-size:.87rem;color:var(--muted)}
.goal-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.goal-button{text-align:left}
.goal-button[aria-pressed=true]{background:#dcece0;border-color:#496d59}
.parent-report{margin:0;background:var(--white);border:1px solid var(--line);padding:14px;border-radius:12px;white-space:pre-wrap;overflow-wrap:anywhere;font:inherit}
.family-card .answer h1{font-size:clamp(1.4rem,5vw,2.1rem)}
.family-card .opt-btn{width:100%}
.type{display:inline-flex;align-items:center;gap:6px;justify-self:start;padding:3px 9px;border-radius:999px;background:#f8e8de}
.type[data-kind=who]{color:#254a72;background:#e5eff8}
.type[data-kind=where]{color:#235742;background:#e1efe7}
.type[data-kind=when]{color:#7c5210;background:#fbf0d6}
.type[data-kind=why]{color:#8b3a24;background:#fae7e0}
.type[data-kind=feeling]{color:#7a2e55;background:#f9e6f0}
.type[data-kind=how]{color:#2b5b63;background:#e2f0f2}
.type[data-kind=speech]{color:#4e3a7a;background:#ece8f9}
.type-ico{flex:0 0 auto}
button.is-speaking{border-color:var(--ink);background:#e3eee3;box-shadow:0 0 0 2px #64847755}
.family-done{justify-items:center;text-align:center;padding:20px 10px}
.done-badge{display:grid;place-items:center}
.family-length-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:var(--white);border:1px solid var(--line);border-radius:14px}
.family-length-bar>span{font-size:.86rem;font-weight:700}
.family-lengths{display:flex;flex-wrap:wrap;gap:6px}
.family-lengths button{min-height:40px;padding:.38rem .72rem;font-size:.84rem}
.family-lengths button[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:white}
.family-grid small{font-size:.8rem;color:var(--orange);font-weight:700}
/* Tablet workspaces use the viewport for the scene and the response together. */
@media(min-width:680px){
  main.study-screen{max-width:1360px;padding:10px 16px 12px}
  .study-screen>.toolbar{margin-bottom:6px}
  .study-screen>progress{height:5px;margin-bottom:8px}
  .study-screen .card{grid-template-columns:minmax(0,1fr) minmax(0,1.35fr);gap:16px;align-items:start}
  .study-screen .scene img,.study-screen .silent .scene img{height:min(var(--scene-room,360px),39vw);max-height:none;object-fit:contain}
  .study-screen .hotspot-image{width:min(100%,var(--scene-room,360px));max-width:435px}
  .study-screen .hotspot-image img,.study-screen .silent .hotspot-image img{height:auto}
  .study-screen .answer{gap:7px}
  .study-screen .answer h1,.study-screen .family-card .answer h1{font-size:clamp(1.25rem,2.1vw,1.7rem);line-height:1.2}
  .study-screen .type{font-size:.81rem}
  .study-screen .scene p{font-size:1rem;line-height:1.4}
  .study-screen .activity-tiles{grid-template-columns:repeat(3,minmax(0,1fr))}
  .study-screen .activity-targets{grid-template-columns:repeat(2,minmax(0,1fr))}
  .study-screen .activity-tile{font-size:.9rem;min-height:74px}
  .study-screen .nav{position:sticky;bottom:8px;background:var(--paper);padding-top:3px;z-index:1}
  .study-compact .answer,.study-compact .activity{gap:5px}
  .study-compact .answer h1,.study-compact .family-card .answer h1{font-size:1.25rem}
  .study-compact .note{padding:7px 10px;line-height:1.35}
  .study-compact .model ul{margin:3px 0}
  .study-compact .controls button{padding:5px 9px}
  .study-compact .opt-btn{min-height:52px;padding:5px 9px}
  .study-compact .opt-art{width:44px;height:40px;flex-basis:44px}
  .study-compact .opt-art svg{width:42px;height:38px}
  .study-compact .activity-icon{width:40px;height:36px}
  .study-compact .activity-tile{min-height:62px;padding:4px 3px}
  .study-compact .activity-help{font-size:.84rem}
  .study-dense .options{grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch}
  .study-dense .option-row{display:grid;grid-template-rows:1fr auto;gap:4px;min-width:0}
  .study-dense .opt-btn{flex-direction:column;justify-content:center;min-width:0;gap:3px;text-align:center;font-size:1rem}
  .study-dense .opt-art{flex-basis:auto}
  .study-dense .opt-speak{min-height:44px}
  .study-dense .activity-solution{font-size:.9rem;line-height:1.3}
  .study-dense .activity-solution .activity-icon{width:24px;height:22px}
  .study-screen .study-scene-extra{margin:6px 8px 8px;font-size:.92rem}
  .study-screen .study-scene-extra p{font-size:inherit}
  .study-screen .study-scene-extra ul{margin:4px 0}
}
@media(max-width:430px){
  .role-grid,.family-grid{grid-template-columns:1fr}
  .bar{padding-inline:10px;gap:7px}
  .bar>div:first-child{gap:6px}
  .bar .bar-actions button{padding:5px 6px;white-space:normal;font-size:.75rem}
}
