@font-face{font-family:Suite;src:url('assets/fonts/SUITE-Variable.woff2');font-weight:300 900;font-display:swap}
:root{--rescue-ready:1}
.boot-status{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:20px;background:#ecede0;overflow:auto}
.boot-card{width:100%;max-width:360px;padding:28px;border:1px solid #becbb2;border-radius:16px;background:#fffdf1;text-align:center;box-shadow:0 12px 40px #29442b12}
.boot-card h2{font-size:21px}.boot-card>p:not(.eyebrow){font-size:13px;line-height:1.7;margin:15px 0}.boot-card a{display:block;font-size:12px;padding:13px 8px;margin-top:6px}
:root{font-family:Suite,system-ui,sans-serif;color:#2e4439;background:#ecede0;font-synthesis:none;--ink:#2e4439;--green:#335e47;--cream:#fffdf1;--line:#d8ddc6;--gold:#f3c767;--muted:#6f806c}
*{box-sizing:border-box}body{margin:0;min-width:280px}button,input{font:inherit}button{color:inherit;cursor:pointer;touch-action:manipulation;min-height:44px;border:1px solid var(--line);border-radius:10px;background:#fafbf1;padding:9px 13px;transition:background .12s,box-shadow .12s}button:hover{background:#edf1dc}button:active{transform:translateY(1px)}button:disabled{opacity:.4;cursor:default;transform:none}button:focus-visible,a:focus-visible,input:focus-visible,canvas:focus-visible{outline:3px solid #cb7c37;outline-offset:3px}button[hidden],[hidden]{display:none!important}a{color:inherit}h1,h2,p{margin:0}h2{font-size:24px;letter-spacing:-.7px}kbd{font:10px Suite,system-ui;background:#e2e7d6;border-radius:3px;padding:2px 4px;color:#7c8975}canvas{display:block}button.primary{background:var(--green);border-color:var(--green);color:#fffde9;font-weight:800;box-shadow:inset 0 -2px 0 #193b2e40}button.primary:hover{background:#284e3b}
.rescue-app{max-width:1240px;margin:auto;padding:18px 28px 0}.topbar{height:65px;display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:14px}.home-link{text-decoration:none;font-size:12px;letter-spacing:1px;font-weight:800}.wordmark{text-align:center}.wordmark>span{font-size:10px;letter-spacing:4px;color:#7d8b6d;font-weight:900}.wordmark h1{font-size:24px;letter-spacing:-1px;margin-top:4px}.header-actions{display:flex;gap:8px}.header-actions button{width:42px;min-height:40px;padding:6px;border-radius:50%;background:#f7f7eb;font-weight:800}.game-shell{border:1px solid #becbb2;border-radius:18px;overflow:hidden;background:var(--cream);box-shadow:0 18px 60px #29442b12}.stagebar{height:64px;display:flex;align-items:center;justify-content:space-between;padding:10px 22px;background:#fafbef;border-bottom:1px solid var(--line)}#open-levels{border:0;background:transparent;padding:0;display:flex;align-items:center;gap:12px;text-align:left;min-height:40px}.chapter-label{font-size:10px;letter-spacing:1px;border:1px solid #cbd7b8;border-radius:20px;padding:5px 9px;color:#71805f}#stage-name{font-size:15px;letter-spacing:-.3px}.rescue-count{display:flex;align-items:center;gap:12px}.count-label{font-size:11px;color:var(--muted)}#counts{font-size:19px;font-variant-numeric:tabular-nums}#counts small{font-size:12px;font-weight:500;color:var(--muted)}
.scene{position:relative;height:clamp(300px,48vh,530px);overflow:hidden;background:#d7dfbc}#board{width:100%;height:100%;touch-action:none;cursor:grab;outline-offset:-4px}#board:active{cursor:grabbing}.scene-top{pointer-events:none;position:absolute;left:16px;right:16px;top:12px;display:flex;gap:9px;align-items:center;font-size:11px;color:#34583c;text-shadow:0 1px #f3f5e4}.phase{padding:6px 10px;border:1px solid #9aaf8460;border-radius:7px;background:#fffcebda;font-weight:900;text-shadow:none}.phase.planning{background:#f7d279;border-color:#cea64e}.camera-controls{position:absolute;bottom:10px;right:12px;display:flex;gap:4px}.camera-controls button{min-height:34px;height:34px;padding:5px 9px;background:#fffcebe8;border-color:#c2cfab;box-shadow:0 2px 0 #4e693224;font-size:11px}.camera-controls button:first-child,.camera-controls button:nth-child(2){width:34px;font-size:17px}.camera-controls button[aria-pressed=true]{background:#f6cf79}.edge-controls{position:absolute;top:45%;left:8px;right:8px;display:flex;justify-content:space-between;pointer-events:none}.edge-controls button{pointer-events:auto;font-size:26px;width:32px;min-height:48px;padding:0;background:#fffcebb0;border-color:#adbfa37a;color:#5e7859}
.command-deck{padding:12px 20px 6px}.hint-row{display:flex;align-items:center;gap:10px;justify-content:space-between;min-height:32px;margin-bottom:8px;font-size:12px;color:#6a775e}.hint-row button{min-height:28px;padding:3px 9px;flex-shrink:0;font-size:11px;border-radius:6px}.toolbar{display:flex;gap:9px}.toolbar>button{display:flex;align-items:center;position:relative;flex:1;gap:10px;min-height:64px;padding:10px 15px;text-align:left;box-shadow:0 2px 0 #dadecc}.tool-icon{display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:7px;background:#e5ead5;color:#587449;font-size:25px;font-weight:900}.tool-copy{display:flex;flex-direction:column;gap:2px}.tool-copy strong{font-size:15px}.tool-copy small{font-size:10px;color:#7a866e}.toolbar b{margin-left:auto;border-radius:5px;background:#e9edde;padding:3px 7px;font-size:13px}.toolbar kbd{position:absolute;top:5px;right:5px}.toolbar button.chosen{background:#fbdf93;border-color:#bca251;box-shadow:0 2px 0 #c4a459}.toolbar button.chosen .tool-icon{background:#f5c767;color:#70532c}.toolbar button.chosen b{background:#ecc778}.toolbar button.empty:not(.chosen){background:#e8ebdf;border-color:#bbc5ae;color:#56634d;box-shadow:none}.toolbar button.empty .tool-icon{filter:grayscale(1);opacity:.65}.toolbar button.empty b{background:#d7ddcc;color:#4c5944}.toolbar button.empty .tool-copy small{color:#5d6954}
.selection-panel{margin:10px 0 4px;border:1px solid #cfb56c;background:#ffefbe;border-radius:11px;padding:10px 12px}.selected-friend{display:flex;gap:10px;align-items:center}.selected-friend>canvas{width:52px;height:52px;flex-shrink:0;image-rendering:pixelated;background:#f6dfa0;border:1px solid #e3c675;border-radius:8px}.selected-friend>div{flex:1;min-width:0}.selected-friend strong{font-size:13px}.selected-friend p{font-size:11px;line-height:1.5;margin-top:3px;color:#796641}.selected-friend>button{align-self:flex-start;border:0;min-height:28px;padding:1px 6px;font-size:23px;background:transparent}.selection-actions{display:flex;gap:7px;align-items:center;margin-top:8px}.selection-actions button{font-size:12px;min-height:38px;padding:7px 13px}.selection-actions>span{font-size:10px;color:#8c784b;margin-left:auto}.candidates{display:flex;gap:5px;overflow-x:auto;max-width:100%;scrollbar-width:thin}.candidates:not(:empty){padding:8px 0 0}.candidates button{min-width:65px;min-height:54px;display:flex;align-items:center;gap:2px;padding:4px;border-color:#e1c67c;background:#fff6d6}.candidates button.active{border:2px solid #856a32;background:#f3d385}.candidates canvas{width:32px;height:32px;image-rendering:pixelated}.candidates span{font-size:10px;white-space:nowrap}
.playback{display:flex;gap:7px;margin-top:11px}.playback button{min-height:43px;font-size:12px}.playback #pause{display:flex;gap:22px;justify-content:space-between;min-width:150px;font-size:14px}#speed{min-width:57px;font-variant-numeric:tabular-nums}#rewind{margin-left:auto}#more{width:40px;padding:5px;font-size:20px}.notice-row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:38px}.notice-row p{font-size:11px;color:#708066;line-height:1.5}.notice-row button{white-space:nowrap;border:0;background:transparent;font-size:11px;min-height:32px;padding:5px}#friend-count{background:#e5ead9;border-radius:10px;padding:2px 5px}.rescue-app>footer{font-size:10px;color:#87927e;padding:12px 2px;display:flex;justify-content:space-between;gap:12px}.eyebrow{font-size:10px;letter-spacing:3px;color:#81926d;font-weight:900;margin-bottom:8px}
#result{position:absolute;inset:0;display:grid;place-items:center;background:#dfe7cba8;backdrop-filter:blur(3px);z-index:3}.result-card{padding:20px 28px;background:#fffceb;border:1px solid #b9c99e;box-shadow:0 8px 0 #74865825;border-radius:14px;text-align:center;max-width:90%}.result-card canvas{width:70px;height:70px;margin:0 auto 6px;image-rendering:pixelated}.result-card h2{font-size:23px}.result-card p:not(.eyebrow){font-size:12px;margin:9px 0 16px}.result-actions{display:flex;gap:8px;justify-content:center}.result-actions button{font-size:12px}
 dialog{max-width:min(520px,calc(100vw - 24px));max-height:calc(100dvh - 30px);overflow:auto;border:1px solid #bfcca9;border-radius:17px;padding:24px;color:var(--ink);background:var(--cream);box-shadow:0 20px 90px #102c2950}dialog::backdrop{background:#173b315c;backdrop-filter:blur(2px)}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:14px}.dialog-heading>button{border:0;background:transparent;font-size:24px;padding:0 8px}dialog p,dialog li{font-size:13px;line-height:1.8;margin:12px 0}dialog ol{padding-left:22px}dialog>button{margin-right:6px}.setting{display:flex;align-items:center;gap:9px;margin:20px 0;font-size:13px}input[type=checkbox]{width:18px;height:18px;accent-color:var(--green)}#levels{display:flex;flex-direction:column;gap:8px;margin-top:15px}#levels button{display:flex;align-items:center;gap:12px;text-align:left;padding:14px}#levels button.active{background:#e7efcf;border-color:#8ba96a}#levels small{margin-left:auto;font-size:11px;color:#7b8969}.friend-list{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.friend-list button{display:flex;flex-direction:column;align-items:center;font-size:11px;padding:6px;gap:3px}.friend-list canvas{width:48px;height:48px;image-rendering:pixelated}.friend-list small{color:#79866b;font-size:10px}
@media(min-width:1100px) and (min-height:900px){.scene{height:53vh}.command-deck{padding-left:28px;padding-right:28px}}
@media(max-width:650px){.rescue-app{padding:8px 8px 0}.topbar{height:52px;margin-bottom:7px;gap:8px}.home-link{font-size:18px;width:34px}.home-link span{display:none}.wordmark h1{font-size:18px;margin-top:3px}.wordmark>span{font-size:8px;letter-spacing:3px}.header-actions{gap:4px}.header-actions button{width:32px;min-height:34px;height:34px;padding:4px;font-size:13px}.game-shell{border-radius:12px}.stagebar{height:53px;padding:6px 12px}.chapter-label{display:none}#open-levels{gap:5px}#stage-name{font-size:12px}.count-label{display:none}#counts{font-size:16px}#counts small{font-size:10px}.scene{height:clamp(245px,40dvh,380px)}.scene-top{left:10px;right:10px;top:9px;font-size:10px;gap:6px}#scene-tip{max-width:65%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.phase{padding:5px 7px}.camera-controls{right:8px;bottom:8px;gap:3px}.camera-controls button{min-height:34px;font-size:10px;padding:4px 7px}.edge-controls{left:5px;right:5px}.edge-controls button{width:26px;min-height:45px}.command-deck{padding:8px 9px 3px}.hint-row{font-size:11px;line-height:1.4;margin-bottom:6px;min-height:29px}.toolbar{gap:5px}.toolbar>button{min-height:58px;padding:7px 8px;gap:6px}.tool-icon{width:25px;height:30px;font-size:21px;background:transparent}.tool-copy strong{font-size:12px}.tool-copy small{display:none}.toolbar b{font-size:11px;padding:2px 4px}.toolbar kbd{display:none}.playback{gap:4px;margin-top:9px}.playback #pause{min-width:97px;gap:8px;font-size:13px}.playback button{padding:7px;font-size:11px;min-height:43px}#speed{min-width:39px}#undo{font-size:10px}#more{width:30px;font-size:19px}#rewind{margin-left:auto}.notice-row{min-height:34px}.notice-row p{font-size:10px;max-width:calc(100% - 60px)}.notice-row button{font-size:10px}.selection-panel{padding:8px;margin-top:8px}.selected-friend>canvas{width:44px;height:44px}.selected-friend strong{font-size:12px}.selected-friend p{font-size:10px}.selection-actions>span{display:none}.selection-actions button{flex:1}.rescue-app>footer{font-size:9px;padding:8px 3px}.rescue-app>footer span{display:none}.result-card{padding:13px 16px}.result-card h2{font-size:19px}.result-card canvas{width:52px;height:52px}.result-card .eyebrow{font-size:8px}.result-actions button{padding:7px 10px}dialog{padding:18px}dialog h2{font-size:21px}}
@media(max-width:350px){.toolbar>button{padding:7px 5px;gap:3px}.tool-icon{width:19px}.tool-copy strong{font-size:11px}.playback #pause{min-width:80px}.playback button{padding:6px 5px}#undo{font-size:9px}.notice-row p{font-size:9px}}
@media(max-height:500px) and (min-width:500px){.rescue-app{padding:6px 9px}.topbar{height:34px;margin-bottom:5px}.wordmark>span{display:none}.wordmark h1{font-size:17px;margin:0}.header-actions button{min-height:30px;height:30px;width:32px}.game-shell{display:grid;grid-template-columns:minmax(0,1fr) 245px;border-radius:10px}.stagebar{grid-column:1;grid-row:1;height:43px;padding:5px 12px}.stagebar .chapter-label,.count-label{display:none}#stage-name{font-size:12px}#counts{font-size:15px}.scene{grid-column:1;grid-row:2;height:calc(100dvh - 100px);min-height:180px}.command-deck{grid-column:2;grid-row:1 / 3;padding:8px;border-left:1px solid var(--line);max-height:calc(100dvh - 57px);overflow:auto}.hint-row{font-size:10px;line-height:1.4;margin:0 0 6px}.toolbar{gap:4px}.toolbar>button{min-height:52px;padding:4px;gap:3px;justify-content:center}.tool-icon,.tool-copy small,.toolbar kbd{display:none}.tool-copy strong{font-size:11px}.toolbar b{margin:0;padding:2px 3px;font-size:10px}.playback{flex-wrap:wrap;gap:5px}.playback #pause{flex:1;min-width:130px;font-size:12px}.playback button{min-height:38px;font-size:10px;padding:6px}#speed{min-width:44px}#rewind{margin:0;flex:1}#undo{flex:1}#more{width:28px}.notice-row{align-items:start;flex-direction:column;gap:1px;padding-top:7px}.notice-row p{font-size:10px;line-height:1.5}.notice-row button{min-height:30px}.selection-panel{padding:6px}.selected-friend{gap:5px}.selected-friend>canvas{width:36px;height:36px}.selected-friend strong{font-size:10px}.selected-friend p{font-size:9px}.selected-friend>button{font-size:18px;padding:0 2px}.selection-actions{gap:4px}.selection-actions button{font-size:10px;min-height:34px;padding:4px 7px}.selection-actions>span{display:none}.candidates button{min-width:54px;min-height:44px}.candidates canvas{width:26px;height:26px}.camera-controls{bottom:6px;right:6px}.camera-controls button{font-size:9px;padding:3px 6px;min-height:30px;height:30px}.camera-controls button:first-child,.camera-controls button:nth-child(2){width:28px}.scene-top{left:8px;top:7px;font-size:9px}.phase{padding:4px 6px}.rescue-app>footer{display:none}.result-card{padding:12px}.result-card h2{font-size:17px}.result-card canvas{width:42px;height:42px}.result-card .eyebrow{display:none}.result-card p:not(.eyebrow){font-size:10px;margin:7px 0 10px}.result-actions button{min-height:34px;font-size:10px;padding:5px 8px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

/* Keep the map and primary controls together, including during selection. */
@media(min-height:501px){
 .rescue-app{height:100dvh;display:flex;flex-direction:column;padding-top:10px}
 .topbar{height:55px;flex-shrink:0;margin-bottom:10px}
 .game-shell{flex:1;min-height:0;display:flex;flex-direction:column}
 .stagebar{flex-shrink:0;height:55px}
 .scene{height:auto;min-height:160px;flex:1}
 .command-deck{flex-shrink:0}
 .rescue-app>footer{flex-shrink:0;padding-top:9px;padding-bottom:9px}
 .is-planning .hint-row{display:none}
 .is-planning .selection-panel{margin-top:8px}
 .is-planning .selected-friend>canvas{width:40px;height:40px}
 .is-planning .selection-actions{margin-top:5px}
 .is-planning .selection-actions button{min-height:36px;padding:6px 12px}
}
@media(max-width:650px) and (min-height:501px){
 .rescue-app{padding-top:5px;padding-bottom:7px}
 .topbar{height:45px;margin-bottom:5px}
 .stagebar{height:45px}
 .rescue-app>footer{display:none}
 .command-deck{padding-top:7px}
 .is-planning .selection-panel{padding:6px 8px}
 .is-planning .selected-friend>canvas{width:36px;height:36px}
 .is-planning .selected-friend p{line-height:1.35}
 .is-planning .selected-friend strong{font-size:11px}
 .is-planning .selection-actions button{min-height:35px;padding:6px}
 .is-planning .toolbar>button{min-height:46px}
 .is-planning .playback{margin-top:7px}
 .is-planning .notice-row{min-height:29px}
}

@media(pointer:coarse){
 .selection-actions button,.is-planning .selection-actions button{min-height:44px}
 .camera-controls button,.camera-controls button:first-child,.camera-controls button:nth-child(2){min-width:40px;min-height:40px;height:40px}
 .edge-controls button{width:40px;min-height:48px}
 .header-actions button{min-width:40px;min-height:40px}
}

.tool-icon svg{width:26px;height:26px;flex-shrink:0}
@media(max-width:650px){.tool-icon svg{width:22px;height:22px}}
@media(max-width:350px){.tool-icon svg{width:18px;height:18px}}
.twilight #scene-tip{color:#fff1d4;text-shadow:0 1px 2px #263e45}
#journey-progress{padding:9px 12px;background:#eef1df;border-radius:8px;font-weight:800;color:#617c4b}
.result-card #result-progress{font-size:11px;color:#71854f;margin:-7px 0 13px}
#result-title:focus{outline:none}
.notice-row button.needs-release{background:#f7d68c;border:1px solid #c4a363;color:#634c28;border-radius:8px;font-weight:800}
@media(max-width:650px) and (min-height:501px){
 .rescue-app{padding-top:max(5px,env(safe-area-inset-top));padding-bottom:max(7px,env(safe-area-inset-bottom));padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right))}
}
@media(max-height:500px) and (min-width:500px){
 .rescue-app{padding-top:max(6px,env(safe-area-inset-top));padding-bottom:max(6px,env(safe-area-inset-bottom));padding-left:max(9px,env(safe-area-inset-left));padding-right:max(9px,env(safe-area-inset-right))}
 .scene{height:calc(100dvh - 100px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
 .command-deck{max-height:calc(100dvh - 57px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
}
#counts.goal-met{color:#416f43;text-shadow:0 1px #fff}
.result-actions.has-undo{display:grid;grid-template-columns:1fr 1fr}
#result-undo{grid-column:1 / -1}
.is-planning .hint-row{display:none}
@media(max-height:500px) and (min-width:500px){
 .playback{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px;gap:5px;margin-top:7px}
 .playback #pause{grid-column:1 / 3;min-width:0}
 .playback #speed{min-width:0}
 .playback #more{width:auto}
 .is-planning .toolbar>button{min-height:46px}
 .is-planning .selection-panel{margin-top:6px}
}
@media(max-height:500px) and (min-width:500px) and (max-width:600px){
 .game-shell{grid-template-columns:minmax(0,1fr) 225px}
}
.result-card{max-height:calc(100% - 16px);overflow:auto}
@media(max-height:350px) and (min-width:500px){.result-card canvas{display:none}}
@media(max-width:650px) and (max-height:650px){
 .result-card .eyebrow{display:none}
 .result-card canvas{width:42px;height:42px}
 .result-card p:not(.eyebrow){font-size:11px;margin:8px 0 10px}
}


.friend-filters{display:flex;gap:6px;flex-wrap:wrap;margin-top:12px}.friend-filters button{flex:1;min-height:40px;padding:7px 10px;font-size:12px;white-space:nowrap}.friend-filters button[aria-pressed=true]{background:#f6cf79;border-color:#b69b54}#friend-summary{font-size:12px;line-height:1.6;min-height:20px}#undo-detail{padding:10px 12px;background:#e8edda;border-radius:8px;font-size:12px}
.chapter-picker{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:8px;margin-top:14px}.chapter-picker label{min-width:0}.chapter-picker select{width:100%;min-height:44px;background:#fafbf1;border:1px solid var(--line);border-radius:9px;padding:7px;font:inherit;font-size:13px;color:var(--ink)}.chapter-picker select:focus-visible{outline:3px solid #cb7c37;outline-offset:2px}#chapter-description{font-size:12px;line-height:1.6;margin:10px 0}#recommended-level{font-size:12px;background:#e8edda}.map-note{font-size:11px!important}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#levels button{display:grid;grid-template-columns:30px minmax(0,1fr);column-gap:10px;row-gap:4px;padding:12px}#levels button>strong{grid-row:1 / 3;font-variant-numeric:tabular-nums}#levels button>span{line-height:1.4;overflow-wrap:anywhere}#levels small{grid-column:2;margin-left:0;line-height:1.5;white-space:nowrap}.friend-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.friend-filters button{min-width:0}#stage-briefing{white-space:pre-line;background:#e8edda;border-radius:8px;padding:10px 12px;line-height:1.8}#open-levels{min-width:0}#stage-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rescue-count{flex-shrink:0}
#chapter-record{font-size:11px;color:#637755;margin-top:-4px}

