*{box-sizing:border-box}body{margin:0;background:#f3ecdd;color:#323d35;font:17px/1.5 system-ui,sans-serif}main{max-width:1080px;margin:auto;padding:18px 20px max(48px,env(safe-area-inset-bottom))}header{display:flex;align-items:center;gap:20px;flex-wrap:wrap}h1{font-size:clamp(24px,4vw,34px);letter-spacing:-.04em;margin:0}header a{color:inherit;min-height:44px;display:flex;align-items:center}button{font:inherit;min-height:64px;padding:10px 20px;border:2px solid #98a18c;border-radius:22px;background:#fffcf2;color:inherit;cursor:pointer;touch-action:manipulation}button:focus-visible,a:focus-visible{outline:4px solid #4f75aa;outline-offset:3px}button[aria-pressed=true]{background:#d7e1c4;border-color:#5e7559}button:disabled{opacity:.45;cursor:default}.choices,.toolbar{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0}.choices{justify-content:center}.stage{height:clamp(400px,60vh,580px);min-height:400px;position:relative;overflow:hidden;border-radius:34px;background:linear-gradient(#bed7d8 0%,#e5e5c9 50%,#b6c59a 51%,#8ea16f 100%);box-shadow:0 8px 30px #536c4120}.stage canvas{position:absolute;inset:0;width:100%;height:100%}.pads{position:absolute;inset:0;pointer-events:none}.pad{position:absolute;width:68px;height:68px;min-height:68px;padding:0;border-radius:50%;background:#fffcf2c9;border:2px dashed #49533e;transform:translate(-50%,-50%);pointer-events:auto;display:flex;align-items:center;justify-content:center;gap:2px;box-shadow:0 2px 12px #32422a25;user-select:none;-webkit-user-select:none}.pad .symbol{font-size:26px}.pad small{font-size:11px;align-self:flex-end;margin-bottom:12px}.pad.lit{background:#fff6b9;border-style:solid;box-shadow:0 0 0 7px #fff9cf99}.pad.waiting{border:3px solid #fff5ae}.pad.waiting::before{content:attr(data-symbol);font-size:22px;position:absolute;top:-60px;left:20px;background:#fff8cf;border-radius:50%;width:24px;height:24px;animation:arrive 1.2s ease-out forwards;pointer-events:none}.stage[data-instrument=whistle] .pad{border-radius:25px;background:#eaf4ebc9}.stage[data-instrument=harp] .pad{touch-action:none;height:82px;border-radius:35px;background:#f9e7cbba}.stage[data-instrument=whistle] .pad.waiting::before{animation:breath 1.2s ease-out forwards}.cue{position:absolute;left:50%;top:20px;transform:translateX(-50%);display:flex;gap:14px;font-size:28px;background:#fffbebd9;border-radius:24px;padding:4px 16px;min-height:0;white-space:nowrap}.cue:empty{display:none}.cue .done{opacity:.35}.cue .now{border-bottom:3px solid #526b48}.scene-caption{position:absolute;left:20px;right:20px;bottom:18px;pointer-events:none;text-align:center;text-shadow:0 1px 4px #fff}.scene-caption strong{display:block;font-size:20px}.scene-caption span{display:block;font-size:14px}.tool-icon{font-size:90px}#cooker-view{position:absolute;inset:30% 0;text-align:center;background:#edf0d7e6;z-index:1}#toast[data-toasted=true]{color:#9c5e2e;transform:rotate(-8deg);display:inline-block}#status{min-height:52px;margin:16px 0 0;text-align:center}#stitches{margin-left:auto;color:#617f4e;font-size:24px}#scene-loading{position:absolute;top:20px;left:20px;z-index:2;font-size:14px;background:#fff8e5d9;padding:8px;border-radius:14px}footer{font-size:12px;color:#647160;margin-top:28px}[hidden]{display:none!important}@keyframes arrive{from{transform:translateY(-35px);opacity:0}to{transform:translateY(30px);opacity:1}}@keyframes breath{from{transform:translate(-35px,30px);opacity:0}to{transform:translate(0,30px);opacity:1}}@media(max-width:600px){main{padding:12px 10px max(48px,env(safe-area-inset-bottom))}header{gap:12px}h1{font-size:24px}.choices{gap:6px}.choices button{padding:8px 11px;font-size:14px;border-radius:18px}.stage{height:430px}.toolbar button{padding:10px 14px}.scene-caption span{max-width:280px;margin:auto}#stitches{font-size:20px}}@media(prefers-reduced-motion:reduce){*,*::before{animation:none!important;transition:none!important}.pad.waiting::before{transform:translateY(30px)}}
button.controller-focus{outline:4px solid #4f75aa;outline-offset:3px}#controller-help{font-size:14px;text-align:center;background:#fffcf2;border-radius:18px;padding:12px;margin:12px 0}

.stage[data-instrument=whistle] .scene-caption{top:12px;bottom:auto}.stage[data-instrument=whistle] .pad{background:#fff8e8ed}

.stage[data-instrument=whistle] .scene-caption span{display:none}
.walk-controls{justify-content:center;align-items:center}.walk-controls span{width:100%;text-align:center;font-size:14px}.walk-controls button{min-width:64px}.stage[data-trial=approach] .scene-caption span,.stage[data-trial=near] .scene-caption span{display:block}
.stage[data-trial=trying] .scene-caption{display:none}
.embedded{background:#f3ecdd;overflow:auto}.embedded main{padding:8px 12px 40px}.embedded header,.embedded .choices,.embedded footer,.embedded .scene-caption,.embedded #controller-help{display:none!important}.embedded .stage{height:146px;min-height:146px;border-radius:18px;background:#eee4cf;box-shadow:none}.embedded .pad{top:88px!important;left:calc((var(--lane) + .5)*25%)!important}.embedded .pad:nth-child(1){--lane:0}.embedded .pad:nth-child(2){--lane:1}.embedded .pad:nth-child(3){--lane:2}.embedded .pad:nth-child(4){--lane:3}.embedded .cue{top:0;font-size:24px}.embedded #status{font-size:14px;min-height:24px;margin:6px 0}.embedded .toolbar{gap:6px;margin:6px 0;justify-content:center}.embedded .toolbar button{padding:6px 10px;min-height:64px}.embedded #mute,.embedded #stop{min-width:120px}

/* Keep every trial action in one reachable row above the phone edge. */
.embedded main{padding-bottom:12px}.embedded #music-controls{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}.embedded #music-controls button{min-width:0;font-size:14px;padding:4px 6px}.embedded .toolbar:has(#stop){display:none}

/* Song timing uses one clock. Shapes move; the generous tap pads stay still. */
#song-menu{padding:4px 0 10px}#song-menu h2{margin:0 0 8px;font-size:22px}.song-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.song-choices button{padding:8px;font-size:15px;min-height:88px}.song-choices strong,.song-choices small{display:block}.song-choices small{font-size:12px;margin-top:4px}#song-menu-slow{margin-top:8px;width:100%}.song-menu-open #stage,.song-menu-open #status{display:none}.song-mode #stage{height:220px;min-height:220px;background:#eee4cf}.song-mode #stage canvas,.song-mode .scene-caption,.song-mode #cue{visibility:hidden}.song-mode .pad{left:calc((var(--lane) + .5)*25%)!important;top:calc(100% - 48px)!important;height:68px!important;z-index:3}.song-mode .pad.waiting::before{display:none}#song-roll{position:absolute;inset:0;overflow:hidden;background:repeating-linear-gradient(90deg,transparent 0,transparent calc(25% - 1px),#988e7438 calc(25% - 1px),#988e7438 25%);touch-action:manipulation;z-index:1}#song-roll::after{content:'';position:absolute;left:0;right:0;bottom:48px;border-top:2px dashed #70815a;pointer-events:none}.scroll-note{position:absolute;top:0;left:calc((var(--lane) + .5)*25%);font-size:22px;line-height:26px;width:34px;height:28px;text-align:center;border-radius:10px;background:#fffdf1;color:#384b3b;border:1px solid #b5b396;will-change:transform;pointer-events:none}.scroll-note.due{background:#fff3a8;border:2px solid #617b50}.scroll-note.passed{opacity:.3}#song-title{position:absolute;z-index:2;top:0;left:50%;transform:translateX(-50%);padding:2px 12px;border-radius:0 0 14px 14px;background:#f3ecddf2;font-size:14px;white-space:nowrap;pointer-events:none}.song-hand{position:absolute;z-index:4;left:calc((var(--lane) + .5)*25%);transform:translateX(-50%);font-size:32px;pointer-events:none}.song-mode #music-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.song-mode #music-controls button{min-width:0;min-height:64px;font-size:14px;padding:4px 6px}.song-mode #song-again{order:0}.song-mode #songs{order:1}.song-mode #song-listen{order:2}.song-mode #song-slow{order:3}.song-mode #free{order:4}.song-mode #mute{order:5}.embedded #music-controls{grid-template-columns:repeat(5,minmax(0,1fr))}.embedded.song-mode #music-controls,.embedded.song-menu-open #music-controls{grid-template-columns:repeat(3,minmax(0,1fr))}.embedded.song-mode #status{font-size:13px;line-height:1.3;min-height:20px;margin:4px 0}.embedded.song-mode .stage{border-radius:16px}.song-menu-open #song-menu .song-choices button{min-height:88px}@media(max-height:340px){.embedded.song-mode #stage{height:146px;min-height:146px}.embedded.song-mode #status{font-size:12px;min-height:18px}}
.song-mode #scene-loading{display:none}

/* Family rehearsal uses the same stationary pads without implying a village placement. */
.family-lesson .stage{height:300px;min-height:300px;background:#e8ecd9}
.family-lesson .pad{left:calc((var(--lane) + .5)*25%)!important;top:54%!important}
.family-lesson .toolbar{justify-content:center}
.family-lesson #music-controls button{flex:1;min-width:140px}
.family-lesson #stitches{min-height:36px}
