:root{--ink:#111b47;--purple:#6433b9;--sun:#ffdc53;--edge:#d7c4f3}
*{box-sizing:border-box}
body{color:var(--ink);font-family:"Malgun Gothic",system-ui,sans-serif;background:linear-gradient(180deg,#7acbff 0,#e2f6ff 46%,#e7c9a4 86%,#b8db6e 100%) fixed}
.shell{max-width:1530px;padding:12px clamp(10px,2vw,30px);min-height:100vh;background:url('reference/sky.webp') right top/52% auto no-repeat,url('reference/garden.webp') left bottom/15% auto no-repeat}
.top{gap:10px;flex-wrap:wrap}
.brand,.heading{border-radius:35px;padding:9px 18px;border:3px solid #fff6bc;box-shadow:0 4px 0 #27217555;font-weight:1000}
.brand{background:linear-gradient(#fff9d8,#ffdc62);color:#151d49}
.heading{background:linear-gradient(#36aaff,#244bb8 56%,#29247e);color:white;font-size:clamp(21px,3vw,43px);text-shadow:0 2px #18164b}
.stageNav{gap:6px}
.navChip,.navChip.active{border:2px solid white;color:#34226c;background:#f6efff}
.navChip.active{background:#ffdc53;color:#21164a}
.class-qr{margin:4px 0 10px;padding:5px 14px;background:#f7efffeF}
.class-qr img{width:96px;height:96px}
.panel,.ref-panel{background:linear-gradient(#fff,#f5eeff);border:3px solid white;border-radius:23px;box-shadow:0 3px 0 #6a519339;padding:clamp(10px,1.4vw,22px)}
.ref-grid{display:grid;gap:12px;grid-template-columns:1fr 1fr}
.ref-portrait{grid-template-columns:minmax(0,40%) minmax(0,60%);align-items:stretch}
.ref-portrait>img{width:100%;height:100%;max-height:560px;object-fit:cover;object-position:center 28%;border-radius:24px;border:4px solid white}
.ref-person{text-align:center;display:grid;gap:12px;align-content:center}
.ref-person h1{background:linear-gradient(#fff6af,#ffdf57);border-radius:32px;padding:12px;margin:0 auto;font-size:clamp(28px,5vw,74px);font-weight:1000;color:#111b47;text-wrap:balance}
.ref-role{background:#e4d6fa;border-radius:25px;font-size:clamp(21px,3vw,42px);font-weight:900;padding:10px}
.ref-badge{display:inline-block;margin:auto;background:#e2d4fb;border-radius:22px;padding:5px 16px;font-weight:900}
.ref-actions,.ref-personnav{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}
.ref-actions .btn{flex:1;min-width:105px;font-size:clamp(15px,1.7vw,24px);padding:12px 7px}
.ref-actions .symbol{display:block;font-size:clamp(35px,5vw,72px);line-height:1.15}
.btn.blue{background:linear-gradient(#53c8ff,#087ddf 60%,#0758ad);color:white}.btn.green{background:linear-gradient(#91dd37,#42a825 55%,#237a16);color:white}.btn.pink{background:linear-gradient(#ff9abf,#e54986 55%,#a82966);color:white}.btn.purple{background:linear-gradient(#b18cf0,#773bc2 60%,#452185);color:white}.btn.gold{background:linear-gradient(#fff690,#ffca38);color:#33224b}
.ref-personnav{margin:14px 0}.ref-personnav .btn{min-height:45px}
.ref-roster,.ref-roles{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
.ref-card,.ref-case{border-radius:14px;border:2px solid var(--edge);background:white;color:var(--ink);font:inherit;font-weight:900;cursor:pointer;overflow:hidden;text-align:center;padding:3px}
.ref-card img{width:100%;height:clamp(60px,9vw,126px);object-fit:cover;object-position:center 28%;display:block;border-radius:9px}
.ref-card span{display:block;font-size:clamp(12px,1.15vw,17px);padding:3px}
.ref-card.selected,.ref-case.selected,.ref-request.selected{border-color:#d09605;background:#fff2ad;box-shadow:0 0 0 2px #ffd445}
.ref-poster,.ref-photo{width:100%;height:auto;border-radius:14px;display:block}
.ref-poster{aspect-ratio:16/9;object-fit:cover}
.ref-flow{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin:8px 0}
.ref-flow span,.ref-column h2{background:linear-gradient(#a770e2,#6733b8);color:white;border-radius:18px;padding:8px;font-size:clamp(14px,1.45vw,21px);font-weight:900;text-align:center;margin:0 0 7px}
.ref-flow .active{background:linear-gradient(#fff982,#ffd243);color:#352052}
.ref-columns{display:grid;gap:8px;grid-template-columns:repeat(4,minmax(0,1fr))}
.ref-column{min-width:0;padding:9px;align-content:start;display:grid;gap:8px}
.ref-column .ref-roles{grid-template-columns:repeat(2,minmax(0,1fr))}
.ref-column p{margin:3px 0;font-weight:750}
.ref-cases{display:grid;gap:5px;max-height:360px;overflow:auto;padding:4px}
.ref-case{display:flex;align-items:center;gap:7px;text-align:left;font-size:clamp(13px,1.2vw,18px)}
.ref-case img{width:36%;height:51px;object-fit:cover;border-radius:9px}
.ref-request{display:flex;width:100%;gap:8px;align-items:center;border:2px solid #bfa4e9;border-radius:14px;background:#f1e6ff;padding:8px;color:var(--ink);font:inherit;font-weight:800;text-align:left;cursor:pointer}
.ref-request span:first-child{background:#7841bd;color:white;border-radius:50%;min-width:25px;text-align:center}
.ref-wait{background:#ede6f9;border-radius:13px;padding:12px}
.ref-game .gameArea{background:linear-gradient(#79cef6b0,#fff5db55),url('reference/sky.webp') center/cover;border-radius:20px;min-height:290px}
.ref-game .cart{height:auto;min-width:120px}.ref-game .cart img{width:90px;height:75px;object-fit:cover;border-radius:12px}
.ref-game .characters{display:grid;grid-template-columns:repeat(5,minmax(0,1fr))}
.ref-game .characters img{width:100%;max-height:100px;object-fit:cover}
.ref-game .balloon{background:radial-gradient(circle at 33% 23%,#ffc4fd,#c663ee 54%,#7031b0);border:4px solid #fff6a1;color:#21104b}
.ref-game .basket{font-size:15px}
button:focus-visible,a:focus-visible{outline:4px solid #28125d;outline-offset:3px}
@media(max-width:850px){.ref-columns{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:540px){.ref-grid,.ref-columns{grid-template-columns:1fr}.ref-portrait>img{max-height:260px;object-position:center 28%}.ref-flow{grid-template-columns:1fr 1fr}.ref-roster{grid-template-columns:repeat(3,minmax(0,1fr))}.class-qr img{width:76px;height:76px}.ref-game .characters{grid-template-columns:repeat(3,minmax(0,1fr))}}
.ref-column>img{width:100%;max-height:250px;object-fit:cover;border-radius:14px}
.btn:disabled{opacity:.54;cursor:default}
/* Use the school, trees, and courtyard from the reference artwork. */
body{background:#d3ecb5;text-shadow:none;letter-spacing:normal}
.shell{max-width:none;padding-inline:clamp(12px,2vw,34px);background:
 url('reference/school-left.webp') left 105px/clamp(22px,4vw,74px) calc(100% - 170px) no-repeat,
 url('reference/school-right.webp') right 105px/clamp(22px,4vw,74px) calc(100% - 170px) no-repeat,
 url('reference/school-roof.webp') center top/100% 118px no-repeat,
 url('reference/school-path.webp') center bottom/100% 100px no-repeat,
 linear-gradient(#7acaff,#d4efff 35%,#bddf97 66%,#ebd1aa)}
.shell>main{max-width:1530px;margin-inline:auto}
.brand,.heading,.btn,.navChip,.titlePlate,.subtitle,.basket,.status,.notice,.charBtn,.ref-person h1,.ref-role{font-family:"Malgun Gothic","Apple SD Gothic Neo",system-ui,sans-serif;text-shadow:none;filter:none;letter-spacing:normal}
.brand,.btn,.navChip{font-weight:800}
.top>.brand{box-shadow:0 3px 0 #51467f44}
.ref-panel,.panel{box-shadow:0 3px 0 #6a519349}
.ref-poster{display:block;width:100%;height:auto;aspect-ratio:auto;object-fit:contain;max-height:360px;background:#daeaf5}
video.ref-poster{aspect-ratio:16/9}
.ref-columns{align-items:start}
.ref-cases{display:flex;flex-direction:column;gap:9px;max-height:386px;overflow-y:scroll;scrollbar-gutter:stable;scrollbar-width:auto;scrollbar-color:#7040af #e9dbfc;overscroll-behavior:contain;padding:5px 7px 5px 3px}
.ref-case{flex:0 0 auto;min-height:81px;padding:5px;line-height:1.28;white-space:normal;word-break:keep-all;font-size:clamp(15px,1.2vw,19px)}
.ref-case img{flex:0 0 39%;width:39%;height:67px;object-fit:contain;background:#f1edf8}
.ref-case span{overflow-wrap:anywhere}
.access-panel{display:grid;justify-items:center;align-content:start;gap:14px;text-align:center}
.access-panel h2{width:100%;margin:0}
.access-qr{width:min(100%,360px);aspect-ratio:1;object-fit:contain;background:#fff;border:4px solid #7849bc;border-radius:15px;image-rendering:pixelated}
.access-address{display:grid;gap:8px;max-width:100%;padding:14px;border-radius:14px;background:#e1efff;color:#173e81;font-weight:800;text-decoration:underline;overflow-wrap:anywhere}
.access-address span{font-size:clamp(14px,1.3vw,19px);font-weight:700}
body[data-stage="access"] .class-qr{display:none}
.ref-game .gameArea{height:clamp(360px,46vw,585px);background:
 url('reference/school-roof.webp') center top/100% 42% no-repeat,
 url('reference/school-path.webp') center bottom/100% 31% no-repeat,
 linear-gradient(#9cdfef 25%,#a1d17d 68%,#dbbd9c)}
.ref-game .balloon{width:clamp(108px,14vw,168px);height:clamp(100px,12vw,145px);padding:12px;font-size:clamp(15px,1.8vw,23px);word-break:keep-all;z-index:2}
.ref-game .cart{width:clamp(156px,22vw,278px);bottom:3px;z-index:1}
.ref-game .cart .face img{display:block;width:100%;height:clamp(141px,19vw,225px);object-fit:contain;margin:auto}
.ref-game .cart .basket{padding:5px 8px;min-height:32px}
.ref-game .characters img{display:block;width:100%;height:clamp(90px,12vw,150px);max-height:none;object-fit:contain}
.ref-game .characters button{align-content:center;display:grid;gap:4px}
@media(max-width:540px){.ref-cases{max-height:295px}.ref-case{min-height:73px}.ref-case img{height:61px}}
.ref-panel .titlePlate,.ref-card span,.ref-person h1{word-break:keep-all;text-wrap:balance}
.ref-roster .ref-card span{font-size:clamp(11px,1vw,16px)}
.role-audio{display:flex;align-items:center;flex-wrap:wrap;justify-content:center;gap:8px 16px;margin:10px auto;padding:9px 14px;width:fit-content;max-width:100%;border:2px solid #9e80cd;border-radius:16px;background:#fff;color:#17153a;font-size:15px}
.role-audio[hidden]{display:none}
.role-audio-player{width:min(275px,65vw)}
.role-audio audio{display:block;width:100%;height:40px}
.role-audio button{min-height:38px;border-radius:12px;background:#f3e9ff;color:#24134d;border:1px solid #9976c4;padding:4px 10px;font:inherit;cursor:pointer}
.role-audio-error{position:fixed;z-index:15;inset:auto auto 12px 50%;transform:translateX(-50%);width:min(560px,94vw);border-color:#bd6f19;background:#fff3d5}
.game-practice{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;margin-bottom:8px;border-radius:14px;background:#fff6d4;color:#282039;font-weight:800}
.game-practice select{font:inherit;color:inherit;min-height:44px;max-width:100%;border:2px solid #9870ce;border-radius:10px;padding:4px 8px;background:#fff}
.ref-game .gameArea{background:#d6eadf}
.game-scene-hint{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}
.game-hint-tag{position:absolute;top:8px;left:8px;padding:5px 9px;border-radius:9px;background:#fff;color:#201a41;font-size:14px;font-weight:800;z-index:1}
.ref-game .balloon{z-index:3}
.ref-game .cart{z-index:2}
#gamePraiseReplay[hidden]{display:none}
/* Match the five balloons to the original cart colors. */
.ref-game [data-role="driver"],.ref-role[data-role="driver"]{--balloon-light:#fff6a0;--balloon-main:#ffd136;--balloon-edge:#c68115;--balloon-ink:#30220c}
.ref-game [data-role="guard"],.ref-role[data-role="guard"]{--balloon-light:#e4ffba;--balloon-main:#91dc45;--balloon-edge:#418522;--balloon-ink:#19340f}
.ref-game [data-role="nurse"],.ref-role[data-role="nurse"]{--balloon-light:#ffe4ee;--balloon-main:#fb91ba;--balloon-edge:#bc3c76;--balloon-ink:#41162c}
.ref-game [data-role="cook"],.ref-role[data-role="cook"]{--balloon-light:#fff0cb;--balloon-main:#ffa849;--balloon-edge:#b75314;--balloon-ink:#48250f}
.ref-game [data-role="facility"],.ref-role[data-role="facility"]{--balloon-light:#d3f2ff;--balloon-main:#73c5fa;--balloon-edge:#2767af;--balloon-ink:#132e52}
.ref-game .balloon[data-role]{
 border-radius:49% 49% 45% 45% / 42% 42% 59% 59%;
 border:2px solid var(--balloon-edge);
 color:var(--balloon-ink);
 background:radial-gradient(ellipse at 29% 22%,white 0%,var(--balloon-light) 16%,var(--balloon-main) 55%,var(--balloon-edge) 100%);
 box-shadow:inset -8px -11px 16px #31162631,0 5px 10px #10213b44;
 padding:12px 14px 19px;
 text-shadow:0 1px 2px var(--balloon-light);
}
.ref-game .balloon[data-role]::before{
 content:"";position:absolute;top:11%;left:17%;width:22%;height:8%;
 border-radius:50%;transform:rotate(-33deg);background:#ffffffa8;pointer-events:none;
}
.ref-game .balloon[data-role]::after{
 content:"";position:absolute;left:50%;bottom:-10px;transform:translateX(-50%);
 width:16px;height:12px;background:var(--balloon-edge);
 clip-path:polygon(50% 0,100% 74%,81% 100%,20% 100%,0 74%);border-radius:3px;
}
.ref-game .cart[data-role] .basket{
 color:var(--balloon-ink);background:linear-gradient(var(--balloon-light),var(--balloon-main));
 border-color:var(--balloon-edge);
}
#gameRandomPlay{margin-left:auto;font-size:17px;min-height:44px;padding:7px 14px}
#gameRandomPlay[aria-pressed="true"]{background:linear-gradient(#ffec89,#ffce43);color:#38254c;border-color:#87631c}
@media(max-width:540px){#gameRandomPlay{margin-left:0}}
.ref-game .balloon,.ref-game .cart{left:50%}
.game-speed-controls{display:flex;align-items:center;flex-wrap:wrap;gap:7px;margin:0 0 12px;padding:8px 12px;border:2px solid #decbf2;border-radius:14px;background:#f8efff;color:#252044;font-weight:800}
.game-speed-controls button{min-height:46px;padding:6px 17px;border:2px solid #aa8ecf;border-radius:12px;background:#fff;color:#2f2050;font:inherit;cursor:pointer}
.game-speed-controls button[aria-pressed="true"]{border-color:#593b8b;background:#6237a3;color:white}
.ref-game .gameArea{--cart-width:clamp(116px,22vw,278px);--game-edge:calc(var(--cart-width) / 2 + 8px);--game-travel:calc(100% - 2 * var(--game-edge))}
.ref-game .balloon{left:calc(var(--game-edge) + var(--game-travel) * var(--fall-position,.5))}
.ref-game .cart{width:var(--cart-width);left:calc(var(--game-edge) + var(--game-travel) * var(--cart-position,.5))}
.ref-game .gameControls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0}
.ref-game .gameControls .btn{width:100%;min-width:0;min-height:54px;padding:8px 4px;font-size:clamp(14px,2vw,22px)}
.student-voice-picker{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:6px;border-radius:11px;background:#f3edff}
.student-voice-picker span{width:100%;font-weight:800;font-size:15px}
.student-voice-picker button{flex:1;min-width:58px;min-height:42px;border:2px solid #a285ce;border-radius:10px;background:white;color:#2d1b53;padding:4px 7px;font:inherit;font-weight:800;cursor:pointer}
.student-voice-picker button[aria-pressed="true"]{background:#5c3399;border-color:#5c3399;color:#fff}
.review-request.light{background:#ffed90;border-color:#d19a22;color:#30230b}
.review-request.tears{background:#cdeaff;border-color:#408bc2;color:#172c4b}
.review-request[aria-pressed="true"]{outline:3px solid #56338c;outline-offset:2px}
.ref-inquiry{padding:10px 12px;background:#e8dcfa;color:#25204a;border-radius:14px;font-weight:850;font-size:clamp(17px,2vw,27px);line-height:1.45;text-align:center;word-break:keep-all}
.ref-person .ref-inquiry{font-size:clamp(25px,3vw,46px)}
.ref-panel img[src$="story-group.webp"]{max-width:100%;height:auto;border-radius:14px}
.intro-roster{min-height:clamp(94px,13vw,174px);padding:5px;align-items:start;border-radius:14px;background:#f5efff}
.intro-roster .ref-card:not(button){cursor:default}
.intro-roster:focus-visible{outline:3px solid #653cad;outline-offset:2px}
#showIntroRoster{justify-self:start}

.ref-person .ref-role[data-role]{display:grid;gap:7px;padding:14px clamp(10px,2vw,22px);border:3px solid var(--balloon-edge);background:linear-gradient(115deg,var(--balloon-light),var(--balloon-main));color:var(--balloon-ink);text-shadow:none;line-height:1.35;word-break:keep-all}
.ref-role-label{justify-self:center;border:1px solid currentColor;border-radius:40px;padding:3px 15px;background:#fff9;font-size:clamp(15px,1.4vw,20px);font-weight:900}
.ref-request.personal-request{background:#dff4d7;border-color:#6a9d60;color:#153b26}
.ref-request.personal-request[aria-pressed="true"]{outline:3px solid #2b6a43;outline-offset:2px}
.goal-audio{display:inline-grid;place-items:center;vertical-align:middle;width:46px;min-height:44px;margin-left:4px;border:2px solid #4b3689;border-radius:12px;background:#e9ddff;color:#28184e;font:inherit;cursor:pointer}
body[data-stage="review"] #header{white-space:pre;line-height:1.16;font-size:clamp(14px,3.1vw,36px);width:max-content;max-width:100%}
@media(max-width:380px){body[data-stage="review"] #header{padding-inline:7px}}
@media(max-width:540px){
 .shell{padding-top:10px;padding-bottom:max(16px,env(safe-area-inset-bottom))}
 .top{gap:7px;margin-bottom:10px}
 .top .brand{max-width:calc(100% - 62px);font-size:15px;padding:8px 10px;min-height:44px;word-break:keep-all}
 .top .heading{font-size:clamp(17px,5vw,25px);padding:7px 11px;word-break:keep-all}
 body[data-stage="review"] #header{font-size:clamp(15px,4.4vw,22px)}
 .stageNav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:9px 0 12px}
 .stageNav .navChip{min-width:0;min-height:44px;padding:4px;font-size:14px}
 .ref-grid,.ref-columns,.ref-column,.ref-panel{min-width:0}
 .ref-panel .titlePlate{padding:9px;font-size:clamp(19px,5.8vw,30px)}
 .ref-portrait>img{height:auto;max-height:230px;object-fit:contain;background:#f8f1ff}
 .ref-inquiry,.ref-person .ref-inquiry{font-size:clamp(19px,5.5vw,26px)}
 .ref-personnav{gap:6px}.ref-personnav .btn{min-height:44px;font-size:14px}
 .ref-person .ref-actions .btn{min-width:0;flex:1 1 29%;line-height:1.25;font-size:14px}
 .ref-person .ref-actions .symbol{font-size:34px}
 .ref-flow span,.ref-column h2{line-height:1.25;word-break:keep-all}
 .ref-column{scroll-margin-top:12px}
 .ref-request,.ref-card,.ref-case,.student-voice-picker button{min-height:48px}
 .ref-request{font-size:16px}
 .game-practice{padding:7px 8px;gap:6px}
 .game-practice select{flex:1 1 180px;min-width:0;width:100%;font-size:15px}
 .game-speed-controls{padding:6px;gap:5px}
 .game-speed-controls button{min-height:44px;padding:4px 9px;font-size:14px}
 .ref-game .gameArea{min-height:245px;height:clamp(245px,59vw,320px);--cart-width:clamp(90px,26vw,118px)}
 .ref-game .balloon{width:clamp(87px,25vw,120px);height:clamp(81px,24vw,112px);font-size:clamp(13px,3.7vw,17px);padding:7px 5px 13px}
 .ref-game .cart .face img{height:clamp(82px,23vw,100px)}
 .ref-game .cart .basket{min-height:0;padding:3px 4px;font-size:11px}
 .ref-game .characters{gap:5px}
 .ref-game .characters img{height:62px}
 .ref-game .charBtn{min-height:48px;line-height:1.25;font-size:13px;padding:4px}
 .ref-game .gameControls .btn{min-height:48px}
 .ref-game .notice{padding:7px 8px;font-size:14px}
 .game-hint-tag{font-size:11px;top:5px;left:5px}
 .access-address,.role-audio-player{max-width:100%}
}
.class-qr img{width:clamp(128px,15vw,180px);height:auto;aspect-ratio:1}
.access-panel .access-qr{width:min(100%,420px)}
.qr-enlarge{display:inline-block;padding:4px;color:#392575;font-weight:800;text-decoration:underline}
