#school[hidden],#school [hidden]{display:none}
#school{text-align:left}
.school-layout{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:20px}
.school-classroom{overflow:hidden;border:6px solid #d5ad83;border-radius:20px;background:linear-gradient(#f6e8ce 75%,#d9af85 75%);padding:18px 12px 0;align-self:start}
.blackboard{border:7px ridge #d8ae7f;border-radius:5px;padding:12px;background:#26584f;color:#fff9dc;text-align:center;min-height:120px}
.blackboard strong{font: bold 1.6rem Georgia,serif}
.blackboard p{margin:.6rem 0;line-height:1.4}
#school-people{display:flex;justify-content:center;align-items:end;height:clamp(120px,25vh,230px)}
#school-people figure{display:grid;justify-items:center;margin:0;min-width:0;height:100%}
#school-people svg{width:100%;height:100%;min-height:0}
#school-people figcaption{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:#ffefcf;color:#503729;padding:2px 8px;border-radius:6px;font-size:.8rem}
#school-form label{display:grid;gap:4px;margin:12px 0;color:var(--ink-soft);font-weight:bold}
#school-form select,#school-actions button,#school-restart{border:1px solid var(--edge);border-radius:10px;padding:10px;background:var(--paper);color:var(--plum);font:inherit}
#school-actions{display:grid;gap:8px;margin:16px 0}
#school-actions button{text-align:left;background:var(--well)}
@media(max-width:760px){.school-layout{grid-template-columns:1fr}}
.school-options {border:0;margin:14px 0;padding:0;min-width:0}
.school-options legend {color:var(--ink-soft);font-weight:bold;margin-bottom:6px}
.school-options div {display:flex;flex-wrap:wrap;gap:6px}
#school-form .school-options label {position:relative;display:block;margin:0;cursor:pointer}
.school-options input {position:absolute;opacity:0}
.school-options span {display:flex;align-items:center;justify-content:center;gap:6px;min-width:44px;min-height:44px;padding:4px 10px;border:1px solid var(--edge);border-radius:14px;background:var(--paper);color:var(--plum)}
.school-options input:checked + span {border-color:var(--berry);box-shadow:inset 0 0 0 1px var(--berry);background:var(--well)}
.school-options input:focus-visible + span {outline:3px solid var(--berry);outline-offset:2px}
.school-options input[name="class-group"] + span::before {content:"";width:18px;height:18px;border-radius:50%;background:var(--sample);border:1px solid #0003}
.school-options input[value="Blue"] + span {--sample:#649cda}
.school-options input[value="Yellow"] + span {--sample:#f2cf50}
.school-options input[value="Green"] + span {--sample:#64ae80}
#school-destinations {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(130px,100%),1fr));gap:8px;margin:8px 0 18px}
#school-destinations button {min-height:46px;padding:8px;border-radius:12px;border:1px solid var(--edge);background:var(--well);color:var(--plum);font:inherit;font-weight:600;cursor:pointer}
#school-destinations button:hover,#school-destinations button:focus-visible {border-color:var(--berry)}
#school-map {max-width:800px;margin:0 auto;background:var(--paper);border:1px solid var(--edge);border-radius:20px;padding:clamp(12px,3vw,26px)}
#school-map h2 {font:500 2rem Georgia,serif;color:var(--plum);margin:0}
#school-map p {margin:6px 0 16px}
#school-map #school-destinations {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-areas:"classroom classroom bathroom nurse" "hallway hallway hallway hallway" "coordination direction cafeteria yard";gap:4px;background:#9b8872;border:4px solid #9b8872;padding:4px;border-radius:8px}
#school-map button {background:#fff3dc;color:#40382e;display:flex;align-items:center;flex-direction:column;justify-content:center;padding:4px;gap:2px;border-radius:3px;font:600 clamp(.7rem,2vw,.95rem)/1.15 system-ui;overflow-wrap:anywhere}
#school-map button svg {width:100%;height:clamp(42px,9vw,84px)}
#school-map button[data-room="hallway"] {background:repeating-linear-gradient(90deg,#e8cbae 0 38px,#edd2b7 38px 40px);min-height:44px}
#school-map button[data-room="hallway"] svg {display:none}
[data-room=classroom]{grid-area:classroom}[data-room=bathroom]{grid-area:bathroom}[data-room=nurse]{grid-area:nurse}[data-room=hallway]{grid-area:hallway}[data-room=coordination]{grid-area:coordination}[data-room=direction]{grid-area:direction}[data-room=cafeteria]{grid-area:cafeteria}[data-room=yard]{grid-area:yard}
.school-interior {position:relative;aspect-ratio:1.65;isolation:isolate}
#school-furniture,#school-furniture svg {position:absolute;inset:0;width:100%;height:100%;z-index:-1}
#school-people {position:absolute;inset:auto 2% 3%;height:57%}
#school-people figure {flex:0 1 20%;grid-template-rows:minmax(0,1fr) auto}
#school-people figcaption {max-width:100%;font-size:clamp(9px,1.5vw,13px)}
#back-to-map {margin-bottom:12px;min-height:44px;padding:6px 12px;border:1px solid var(--edge);border-radius:12px;background:var(--well);color:var(--plum);cursor:pointer}
.map-grade {display:inline-flex;align-items:center;gap:.5rem;font-weight:bold}
.map-grade select {font:inherit;color:var(--plum);background:var(--paper);padding:.4em;border:1px solid var(--edge);border-radius:8px}
#school-map #school-destinations {grid-template-columns:repeat(6,minmax(0,1fr));grid-template-areas:"blue blue yellow yellow green green" "hallway hallway hallway hallway hallway hallway" "coordination coordination direction direction bathroom bathroom" "cafeteria cafeteria cafeteria nurse nurse nurse" "yard yard yard yard yard yard"}
[data-section=Blue]{grid-area:blue}[data-section=Yellow]{grid-area:yellow}[data-section=Green]{grid-area:green}
.map-scene {position:relative;display:block;width:100%;height:clamp(72px,11vw,108px);overflow:hidden;border-radius:3px}
#school-map .map-scene svg {display:block;width:100%;height:100%}
.map-actors {position:absolute;inset:22% 4% 3%;display:flex;justify-content:space-evenly;align-items:end}
.map-actors>span {display:block;height:100%;min-width:0;max-width:48%;animation:map-sway 3s ease-in-out infinite alternate;transform-origin:bottom}
.map-actors>span:nth-child(even){animation-delay:-1.5s}


[data-room=hallway] .map-actors>span {animation:map-walk 6s ease-in-out infinite alternate}
[data-room=yard] .map-actors>span {animation:map-play 1.7s ease-in-out infinite}
[data-room=yard] .map-actors>span:nth-child(2n){animation-delay:-.7s}
[data-room=yard] .map-actors>span:nth-child(3n){animation-delay:-1.3s}
@keyframes map-sway {to{transform:rotate(3deg) translateY(-2px)}}
@keyframes map-walk {from{transform:translateX(-21px)}to{transform:translateX(21px)}}
@keyframes map-play {50%{transform:translateY(-9px) rotate(-3deg)}}
@media(prefers-reduced-motion:reduce){#school-map .map-actors>span{animation:none}}
/* Every miniature uses the same height as its scale. Wide rooms gain floor space. */
#school-map {container-type:inline-size}
.map-scene {height:clamp(42px,14cqw,104px)}
.map-scene>svg,#school-furniture>svg {overflow:visible}
.map-actors>span {flex:0 0 auto;width:clamp(15px,5cqw,38px);height:100%}
.map-scene {background:#f1dfbb}
.school-interior {overflow:hidden;aspect-ratio:auto;height:clamp(160px,33vw,330px)}
#school-people figure {flex:0 1 auto;width:clamp(30px,5vw,63px)}
#school-detail[data-place=yard] .school-classroom {grid-column:1/-1}

.scene-clock {transform-origin:315px 28px;animation:school-tick 12s steps(12) infinite}
.scene-chalk {stroke-dasharray:70;animation:school-write 5s ease-in-out infinite alternate}
.scene-swing {transform-box:fill-box;transform-origin:50% 0%;animation:school-swing 1.5s ease-in-out infinite alternate}
.scene-ball,.scene-drip,.scene-steam {animation:school-rise 1.7s ease-in-out infinite alternate}
.scene-drip {animation-direction:reverse;animation-duration:.9s}
@keyframes school-tick {to{transform:rotate(360deg)}}
@keyframes school-write {from{stroke-dashoffset:70}to{stroke-dashoffset:0}}
@keyframes school-swing {from{transform:rotate(-24deg)}to{transform:rotate(24deg)}}
@keyframes school-rise {to{transform:translateY(-8px)}}
@media(prefers-reduced-motion:reduce){#school [class^="scene-"]{animation:none}}

#school-map [data-room=hallway] .map-scene {height:clamp(30px,8cqw,56px)}
#school-detail[data-place=hallway] .school-interior {height:clamp(110px,22vw,210px)}
#staff-editor {display:grid;gap:5px;margin:12px 0;color:var(--ink-soft);font-weight:bold}
#staff-name {padding:9px;border:1px solid var(--edge);border-radius:10px;background:var(--paper);color:var(--plum);font:inherit}
