:root{color-scheme:light;font-family:ui-rounded,"Trebuchet MS",system-ui,sans-serif;color:#fff9e9;--ink:#173e35;--cream:#fff6dd;--gold:#f5c46b}
*{box-sizing:border-box}body{margin:0;background:#9dbbb2}button{font:inherit;cursor:pointer;border:0;touch-action:manipulation}button:focus-visible,canvas:focus-visible{outline:3px solid #fff;outline-offset:4px}button:disabled{cursor:default}button,svg{flex-shrink:0}[hidden]{display:none!important}#game{height:100dvh;min-height:340px;width:100%;position:relative;overflow:hidden}#world{width:100%;height:100%;display:block;touch-action:none;outline:none}.vignette{position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,rgba(24,50,47,.18),transparent 22%,transparent 72%,rgba(12,39,30,.2))}.topbar{position:absolute;inset:25px 28px auto;display:flex;justify-content:space-between;align-items:center;pointer-events:none;gap:12px}.brand{display:flex;gap:12px;align-items:center;text-shadow:0 2px 6px #14352944}.brand svg{width:40px;height:40px}.brand span{font-size:16px;font-weight:800;letter-spacing:.13em}.brand small{display:block;font-size:14px;margin-top:4px;opacity:.91}.top-actions{display:flex;gap:10px;pointer-events:auto}.glass{background:rgba(27,61,51,.87);border:1px solid #ffffff35;box-shadow:0 8px 28px #18392b14;backdrop-filter:blur(14px)}.small-button,.icon-button{color:var(--cream);height:44px;border-radius:14px;display:flex;align-items:center;justify-content:center;gap:9px}.small-button{padding:0 14px;font-size:14px}.small-button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.icon-button{width:44px;font-size:21px;font-weight:700}.altitude{position:absolute;top:104px;right:28px;border-radius:19px;padding:16px 18px;width:156px;pointer-events:none}.eyebrow{font-size:12px;letter-spacing:.18em;color:#d1dbc9;font-weight:700}.altitude>div{margin:3px 0 8px;display:flex;align-items:baseline;gap:5px}.altitude strong{font-size:40px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums;letter-spacing:-.05em}.altitude .unit{font-size:18px;color:#d5dfd1}.infinity{display:flex;gap:7px;align-items:center;font-size:12px;white-space:nowrap;color:#ecdfbb}.infinity b{font-size:21px;font-weight:400}.toast{position:absolute;top:100px;left:50%;max-width:min(530px,calc(100vw - 48px));transform:translate(-50%,-6px);padding:13px 20px;background:rgba(255,249,232,.95);border-radius:15px;color:var(--ink);box-shadow:0 8px 30px #173c2920;font-size:15px;text-align:center;opacity:0;transition:opacity .2s,transform .2s;pointer-events:none}.toast.visible{opacity:1;transform:translate(-50%,0)}.mode-pill{position:absolute;bottom:137px;left:50%;transform:translateX(-50%);display:flex;gap:8px;align-items:center;background:#264c3de0;border:1px solid #ffffff30;padding:7px 14px;border-radius:100px;font-size:14px;pointer-events:none;white-space:nowrap}.mode-dot{width:6px;height:6px;border-radius:50%;background:#eacc7a}.controls{position:absolute;bottom:25px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:12px}.keyboard-tip{display:flex;gap:18px;font-size:14px;align-items:center;text-shadow:0 1px 3px #133426;white-space:nowrap}.keyboard-tip>span{display:flex;align-items:center;gap:4px}kbd{font:700 12px ui-rounded,system-ui,sans-serif;display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:23px;padding:0 5px;border-radius:6px;background:#fff5dc24;border:1px solid #ffffff40;box-shadow:0 2px 0 #183b3220}.actions{display:flex;gap:10px}.action{height:54px;border-radius:17px;display:flex;align-items:center;gap:12px;padding:0 20px;font-weight:700;box-shadow:0 4px 0 #163d4144,0 8px 30px #23492e22;transition:background .15s,transform .15s}.action:active{transform:translateY(2px)}.action.primary{background:var(--gold);color:#273f31}.action.primary:hover{background:#ffd88a}.action.primary svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}.action.primary kbd{border-color:#53664140;background:#fff6d94d}.action.secondary{background:#234b3eef;color:var(--cream);border:1px solid #ffffff36;min-width:200px;justify-content:space-between}.action.secondary:disabled{background:#234b3ecc;color:#ecf0e3c7}.action.primary:disabled{opacity:.66}.vertical-controls{position:static;order:-1;display:flex;gap:8px;width:max-content}.air-controls .mode-pill{bottom:195px}.vertical-controls button{display:flex;align-items:center;gap:10px;min-height:43px;border-radius:13px;color:var(--cream);padding:8px 13px;background:#234b3eee;border:1px solid #ffffff36}.vertical-controls button.held{background:#6b8548}.vertical-controls kbd{font-size:11px}.joystick{display:none}.curtain{position:absolute;inset:0;display:flex;align-items:center;padding:5vh 8vw;background:linear-gradient(90deg,rgba(14,42,35,.64),rgba(16,49,39,.08) 66%);backdrop-filter:blur(1px)}.welcome{max-width:390px}.welcome-kicker{font-size:13px;letter-spacing:.18em;font-weight:700;color:#f7db9c}h1{font-family:Georgia,"Times New Roman",serif;font-size:clamp(50px,5.6vw,82px);line-height:.99;letter-spacing:-.05em;font-weight:500;margin:22px 0}h1 em{color:#f7cd7a;font-weight:500}.welcome>p{font-size:18px;line-height:1.5;color:#f5f0dc}.welcome>ul{list-style:none;padding:0;margin:25px 0 29px;display:grid;gap:14px}.welcome>ul>li{font-size:17px;display:flex;align-items:center;gap:12px}.feature-icon{width:22px;text-align:center;color:#f2cc7c;font-size:22px}.start-button{background:var(--gold);color:#203e32;font-weight:800;font-size:18px;padding:16px 34px;border-radius:15px;min-width:210px;box-shadow:0 4px 0 #152b3450}.start-button:disabled{opacity:.7}.welcome .welcome-note{font-size:13px;max-width:270px;margin-top:17px;color:#e7ebdb}.error-panel{position:absolute;inset:20% 10%;margin:auto;background:#fff9e9;color:#173e35;max-width:520px;padding:28px;border-radius:20px;height:max-content;box-shadow:0 14px 80px #163c4333}.error-panel h2{font-size:24px}.error-panel p{line-height:1.5}.error-panel button{background:#244d3e;color:#fff5dc;padding:12px 20px;border-radius:10px}.help-mode .welcome h1{font-size:52px}.help-mode .welcome>ul{margin:20px 0}.help-mode .welcome>ul>li{line-height:1.45}.help-mode .welcome{max-width:420px}.help-mode .curtain{background:#193d33ba;backdrop-filter:blur(6px);justify-content:center}
@media(max-width:850px),(pointer:coarse){.joystick{display:block;position:absolute;left:22px;bottom:30px;width:124px;height:124px;border-radius:50%;background:#224b3b38;touch-action:none;border:1px solid #fff6dc66;user-select:none}.stick-ring{position:absolute;inset:20px;border:1px solid #fff5dd50;border-radius:50%}.stick{position:absolute;left:37px;top:37px;width:50px;height:50px;border-radius:50%;background:#f3eacbd9;box-shadow:0 4px 12px #12392f40;pointer-events:none}.joystick>span{position:absolute;left:0;right:0;bottom:6px;text-align:center;font-size:10px;font-weight:800;letter-spacing:.14em;pointer-events:none}.keyboard-tip{display:none}.controls{bottom:28px;right:22px;left:auto;transform:none;align-items:flex-end}.actions{flex-direction:column;gap:9px}.action{min-width:170px!important;height:49px;padding:0 15px;font-size:14px}.action kbd{display:none}.action.primary svg{width:21px;height:21px}.action.secondary{justify-content:center}.vertical-controls{position:static;order:-1;gap:7px}.vertical-controls button{height:45px;min-width:80px;justify-content:center;font-size:14px;padding:8px}.vertical-controls kbd{display:none}.mode-pill{bottom:35px;left:50%;font-size:12px}.topbar{inset:18px 18px auto}.brand{gap:7px}.brand svg{width:32px;height:32px}.brand span{font-size:12px;letter-spacing:.08em}.brand small{font-size:12px}.top-actions{gap:7px}.small-button span{display:none}.small-button{padding:0;width:41px}.icon-button{width:41px}.altitude{top:81px;right:18px;width:133px;padding:11px 13px;border-radius:16px}.altitude strong{font-size:32px}.infinity{font-size:10px;gap:4px}.eyebrow{font-size:10px}.toast{top:80px;left:18px;transform:none;max-width:calc(100vw - 184px);padding:10px 12px;font-size:13px;text-align:left}.toast.visible{transform:none}.welcome{max-width:320px}.curtain{padding:5vh 8vw}.welcome h1{font-size:64px}.welcome>ul>li{font-size:16px}.welcome>p{font-size:17px}.welcome>ul{gap:12px;margin:20px 0 25px}.welcome-kicker{font-size:11px}.welcome .welcome-note{font-size:12px}.start-button{padding:14px 28px;min-height:50px}}
@media(max-width:480px){.topbar{inset:15px 13px auto}.altitude{right:13px}.curtain{align-items:center;background:linear-gradient(90deg,#153d31cd,#153d3170)}.welcome h1{font-size:58px}.welcome>ul{gap:11px}.brand span{font-size:11px}.controls{right:13px;bottom:24px}.action{min-width:155px!important;font-size:13px}.joystick{left:14px;bottom:26px;width:114px;height:114px}.stick{left:32px;top:32px}.mode-pill{left:19px;bottom:205px;transform:none}.toast{top:84px;max-width:calc(100vw - 174px);font-size:12px}.help-mode .welcome h1{font-size:42px}.help-mode .welcome>ul>li{font-size:14px}.help-mode .welcome>ul{gap:11px}}
@media(max-height:550px){.welcome h1{font-size:43px;margin:10px 0}.welcome>p{margin:8px 0;font-size:15px}.welcome>ul{margin:12px 0;gap:7px}.welcome>ul>li{font-size:14px}.welcome .welcome-note{margin:9px 0;font-size:11px}.start-button{padding:12px 28px;font-size:16px}.welcome-kicker{font-size:10px}.curtain{padding:20px 8vw}.topbar{top:12px}.altitude{top:70px;padding:9px 13px}.altitude strong{font-size:29px}.controls{bottom:17px}.mode-pill{bottom:180px;left:25px;transform:none}.toast{top:75px}.help-mode .welcome h1{font-size:35px}.help-mode .welcome>ul{margin:10px 0}.help-mode .welcome>ul>li{font-size:13px}.help-mode .welcome .welcome-note{display:none}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}

@media(max-width:850px),(pointer:coarse){.air-controls .mode-pill{bottom:35px}}
@media(max-width:480px){.air-controls .mode-pill{bottom:205px}}

.character{display:flex;align-items:center;gap:13px;margin:18px 0 20px;padding:7px 15px 7px 8px;border-radius:15px;background:#1b493a8c;border:1px solid #fff5df30;width:max-content}.character img{width:49px;height:61px;object-fit:contain}.character span{display:block;font-size:13px;color:#e9efde}.character strong{display:block;font-size:18px;color:#fff5dc;margin-top:3px}.help-mode .character{display:none}@media(max-height:650px){.character{display:none}}

.palette{display:flex;gap:7px;align-items:center;margin:14px 0 19px}.coat-choice{width:57px;min-height:67px;border-radius:12px;background:#193f2e55;border:1px solid #fff5dc35;color:#fff6dd;display:flex;align-items:center;flex-direction:column;justify-content:center;gap:6px;font-size:12px}.coat-choice i{width:28px;height:28px;display:block;background:var(--coat);border-radius:50%;box-shadow:inset -3px -3px 0 #00000018}.coat-choice[aria-pressed=true]{border:2px solid #ffe0a1;background:#fff0c52b}.coat-choice[aria-pressed=true] i:after{content:'✓';font-style:normal;color:#183e2c;font-size:20px;font-weight:800;display:grid;place-items:center;height:100%}.help-mode .palette{display:none}.choose-mode .welcome h1{font-size:52px}.choose-mode .character{display:flex}.welcome h1{margin:17px 0}.welcome>ul{margin:19px 0 22px}.character{margin:14px 0}.welcome .welcome-note{margin-top:13px}@media(max-height:650px){.palette{margin:10px 0}.coat-choice{min-height:54px}.coat-choice i{width:23px;height:23px}.choose-mode .character{display:none}}@media(max-width:480px){.brand span{font-size:10px;letter-spacing:.04em}.brand svg{width:28px}.brand small{font-size:11px}.top-actions{gap:5px}.topbar{gap:5px}.small-button,.icon-button{width:37px;height:41px}.palette{gap:5px}.coat-choice{width:56px;font-size:12px}.welcome h1{font-size:49px}.welcome>p{font-size:16px}.welcome>ul>li{font-size:14px}.welcome>ul{gap:10px}.character img{height:48px;width:40px}.character strong{font-size:16px}.character{padding:5px 12px 5px 7px}.welcome-kicker{font-size:10px}.curtain{padding:5vh 7vw}}

.welcome .controller-note{font-size:13px;line-height:1.45;color:#f0e5c8;margin:8px 0 0;max-width:340px}

/* Keep the document-root fullscreen control reachable above the menu. */
.topbar{z-index:3}
.brand,.brand>div{min-width:0}
.brand{flex:1}
.brand span,.brand small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top-actions{flex-shrink:0}
#fullscreen[aria-pressed=true]{background:#486b45;border-color:#f5c46b}
.curtain{z-index:2;padding-top:max(84px,5vh)}
.error-panel{z-index:5}
.welcome .fullscreen-note{font-size:12px;line-height:1.45;color:#f0e5c8;margin:8px 0 0;max-width:340px}
@media(max-width:850px),(pointer:coarse){.top-actions .small-button,.top-actions .icon-button{width:44px;min-width:44px;height:44px}}
.curtain{overflow-y:auto;backdrop-filter:none}
.welcome{flex-shrink:1;min-width:0;max-height:100%;overflow-y:auto;padding:5px}
.feature-icon{flex:0 0 22px}
.gamepad-mode .joystick{display:none}
.gamepad-mode .action kbd,.gamepad-mode .vertical-controls kbd{display:inline-flex}
.gamepad-mode .keyboard-tip{display:flex;white-space:normal;justify-content:center}
.gamepad-mode .keyboard-tip>span{white-space:nowrap}
@media(max-width:850px),(pointer:coarse){.gamepad-mode .keyboard-tip{font-size:12px;gap:9px;flex-wrap:wrap;max-width:320px}.gamepad-mode .controls{align-items:center;left:50%;right:auto;transform:translateX(-50%)}.gamepad-mode .actions{flex-direction:row}.gamepad-mode .action{min-width:130px!important}.gamepad-mode .mode-pill{bottom:164px;left:50%;transform:translateX(-50%)}.gamepad-mode.air-controls .mode-pill{bottom:220px}}
@media(max-height:650px){.welcome .controller-note{font-size:12px;margin-top:6px}.help-mode .welcome .welcome-note{display:block}}

/* Audio settings remain reachable near the top of the pause menu. */
.music-settings{display:none;margin:20px 0 24px;padding:17px 0 14px;border-top:1px solid #fff5dc35;border-bottom:1px solid #fff5dc35}
.help-mode .music-settings{display:block}
.music-heading,.music-volume-label{display:flex;justify-content:space-between;align-items:center;gap:12px}
.music-heading{margin-bottom:12px}
.music-heading h2{margin:0;font-size:18px}
.music-settings button{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:44px;min-width:88px;padding:8px 15px;border:1px solid #fff5dc66;border-radius:12px;background:#163c31;color:var(--cream);font-weight:700}
#music-toggle[aria-pressed=true]{color:#203e32;background:var(--gold);border-color:var(--gold)}
#music-toggle svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.music-volume-label{font-size:14px;color:var(--cream)}
#music-volume-value{font-variant-numeric:tabular-nums;font-weight:700}
#music-volume{display:block;width:100%;height:44px;margin:0;accent-color:var(--gold);cursor:pointer;touch-action:pan-y}
#music-volume:focus-visible{outline:3px solid #fff;outline-offset:2px;border-radius:8px}
.music-settings p{margin:3px 0 0;color:#f0e5c8;font-size:13px;line-height:1.5}
#music-retry{margin-top:10px}
.music-settings .music-controller-hint{display:none;margin-top:8px}
.gamepad-mode .music-settings .music-controller-hint{display:block}

/* Graphics live in the existing pause menu, including its keyboard/gamepad focus order. */
.graphics-settings{display:none;margin:22px 0 24px;padding-top:18px;border-top:1px solid #fff5dc35}
.help-mode .graphics-settings{display:block}
.graphics-settings h2{margin:0 0 10px;font-size:16px;font-weight:700;letter-spacing:.02em}
.quality-options{display:flex;gap:7px;max-width:340px}
.quality-options button{flex:1;min-width:58px;min-height:44px;padding:8px 10px;border-radius:10px;border:1px solid #fff5dc66;background:#163c31;color:var(--cream);font-size:14px;font-weight:700}
.quality-options button[aria-pressed=true]{color:#203e32;background:var(--gold);border-color:var(--gold)}
.quality-options button:disabled{opacity:.4}
.graphics-settings p{font-size:13px;line-height:1.5;color:#efe6cf;margin:10px 0 0;max-width:340px}
.palette{width:100%;max-width:313px}
.palette .coat-choice{flex:1;min-width:0;width:auto}
@media(max-height:650px){.graphics-settings{margin:16px 0 18px;padding-top:12px}.graphics-settings p{font-size:12px}}


/* Home supplies stay below the brand; the pause dialog owns all home actions. */
.bag-button{position:absolute;z-index:1;top:88px;left:28px;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:4px;min-height:58px;min-width:142px;max-width:210px;padding:9px 14px;border-radius:14px;color:var(--cream);text-align:left}
.bag-label{font-size:14px;font-weight:800}
.bag-stock{display:flex;flex-wrap:wrap;gap:4px 15px;font-size:12px;color:#e7ebd9}
.bag-stock b{color:var(--cream);font-variant-numeric:tabular-nums}
.bag-button:hover,.open-home:hover{background:#375e49}
.menu-open .bag-button{display:none}
.toast{max-width:min(530px,calc(100vw - 440px))}
.open-home{display:none;align-items:center;justify-content:space-between;gap:15px;width:100%;min-height:44px;margin:0 0 18px;padding:11px 14px;border:1px solid #fff5dc66;border-radius:12px;background:#163c31;color:var(--cream);font-weight:700;text-align:left}
.help-mode .open-home{display:flex}
.home-panel{display:none}
.home-mode .character,.home-mode .palette,.home-mode .welcome>ul,.home-mode .graphics-settings,.home-mode .open-home{display:none}
:is(.home-mode,.people-mode) .curtain{justify-content:center;background:#193d33eb;backdrop-filter:blur(6px)}
:is(.home-mode,.people-mode) .welcome{width:100%;max-width:440px;padding:8px;scrollbar-gutter:stable}
:is(.home-mode,.people-mode) .welcome h1{font-size:42px;line-height:1.05;margin:12px 0}
:is(.home-mode,.people-mode) .welcome>p{font-size:14px;line-height:1.5}
.home-mode .home-panel{display:block;margin:18px 0 22px}
.home-panel h2{margin:0 0 10px;font-size:16px;font-weight:700}
.home-stock{display:flex;flex-wrap:wrap;gap:10px 28px;padding:11px 0 13px;border-top:1px solid #fff5dc35;border-bottom:1px solid #fff5dc35}
.home-stock>span{display:flex;align-items:baseline;gap:8px;font-size:14px;color:#e7ebd9}
.home-stock strong{font-size:27px;line-height:1.15;font-variant-numeric:tabular-nums;color:var(--gold)}
.home-panel p{margin:10px 0;font-size:14px;line-height:1.5;color:#f5f0dc;overflow-wrap:anywhere}
.home-panel #home-name{margin-top:18px;font-size:19px;font-weight:800;color:var(--cream)}
.home-actions{display:grid;gap:8px;margin:14px 0 22px}
.home-panel button{min-height:44px;padding:11px 14px;border-radius:11px;background:#163c31;border:1px solid #fff5dc66;color:var(--cream);font-size:14px;font-weight:700;line-height:1.35;white-space:normal}
.home-panel button:hover:not(:disabled){filter:brightness(1.1)}
.home-panel button:disabled{opacity:.5}
.home-panel h3{margin:18px 0 10px;font-size:14px;font-weight:700;color:#f7db9c}
.home-build-options{list-style:none;padding:0;margin:0;display:grid;gap:12px}
.home-build-item{min-width:0;padding:13px 14px;border:1px solid #fff5dc40;border-radius:13px;background:#15382e80}
.home-build-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:5px 12px}
.home-build-heading h4{margin:0;font-size:17px;line-height:1.35;color:var(--cream)}
.home-build-status{font-size:12px;font-weight:700;color:#e4d8b4}
.home-build-item[data-status="ready"]{border-color:var(--gold)}
.home-build-item[data-status="ready"] .home-build-status{color:var(--gold)}
.home-build-item[data-status="built"]{background:#d5e3b80a;border-color:#c6dda644}
.home-build-item[data-status="built"] .home-build-status{color:#d0e4b7}
.home-panel .home-build-description{margin:6px 0 10px;color:#e7ebd9}
.home-panel .home-build-materials{display:grid;gap:2px;margin:0;font-variant-numeric:tabular-nums;color:#e7ebd9}
.home-build-materials strong{color:var(--cream)}
.home-panel .home-build-missing,.home-panel .home-build-requirement{margin:8px 0 0;color:#f7db9c}
.home-panel .home-build-button{display:block;width:100%;margin-top:12px;background:var(--gold);border-color:var(--gold);color:#203e32;scroll-margin-block:12px 76px}
.home-panel .home-build-button:disabled{opacity:1;background:#244a3f;border-color:#fff5dc33;color:#cdd7ca}
#discovered-homes{list-style:none;display:grid;gap:8px;padding:0;margin:0 0 14px}
#discovered-homes li{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;min-width:0;padding:10px 0;border-bottom:1px solid #fff5dc28;font-size:14px;line-height:1.45;overflow-wrap:anywhere}
#discovered-homes li>span{flex:1;min-width:0}
#discovered-homes button{flex-shrink:0}
.home-panel #home-message{padding:10px 12px;background:#fff5dc14;border-left:3px solid var(--gold);border-radius:0 8px 8px 0;scroll-margin-block:12px 76px}
.home-panel #home-message:focus{outline:2px solid var(--gold);outline-offset:3px}
.home-panel #home-save-status{font-size:12px;color:#e7ebd9}
.home-panel #home-message:empty,.home-panel #home-save-status:empty{display:none}
:is(.home-mode,.people-mode) .start-button{width:100%;min-width:0;min-height:48px}
@media(max-width:850px),(pointer:coarse){.bag-button{top:81px;left:18px;min-width:0;max-width:calc(100% - 180px);padding:9px 12px}.bag-label{font-size:13px}.bag-stock{gap:4px 11px}.toast{top:189px;left:18px;max-width:calc(100vw - 36px)}}
@media(max-width:480px){.bag-button{left:13px;max-width:calc(100% - 166px)}.toast{left:13px;max-width:calc(100vw - 26px)}:is(.home-mode,.people-mode) .curtain{padding-right:18px;padding-left:18px}:is(.home-mode,.people-mode) .welcome{padding:5px}:is(.home-mode,.people-mode) .welcome h1{font-size:34px}.home-mode .home-panel{margin-top:14px}.home-stock{gap:10px 24px}.home-stock strong{font-size:25px}}
@media(max-height:550px){.bag-button{top:70px}.toast{top:173px}:is(.home-mode,.people-mode) .curtain{padding-top:72px;padding-bottom:16px}:is(.home-mode,.people-mode) .welcome h1{font-size:32px;margin:7px 0}.home-mode .home-panel{margin-top:12px}:is(.home-mode,.people-mode) .welcome-kicker{display:none}:is(.home-mode,.people-mode) .welcome{max-height:100%;overflow-y:auto}:is(.home-mode,.people-mode) .welcome .welcome-note{display:none}}


/* People share the forest pause dialog; escort guidance stays with the bag. */
.person-panel{display:none}
.people-mode .character,.people-mode .palette,.people-mode .welcome>ul,.people-mode .graphics-settings,.people-mode .open-home,.people-mode .home-panel{display:none}
.people-mode .welcome{max-width:420px}
.people-mode .person-panel{display:block;margin:18px 0 22px}
.person-panel h2{margin:0 0 10px;font-size:22px;line-height:1.2;color:var(--cream);overflow-wrap:anywhere}
.person-panel p{margin:10px 0;font-size:14px;line-height:1.5;color:#f5f0dc;overflow-wrap:anywhere}
.person-actions{display:grid;gap:9px;margin:18px 0}
.person-actions button{min-height:48px;padding:12px 15px;border:1px solid #fff5dc66;border-radius:11px;background:#163c31;color:var(--cream);font-size:15px;font-weight:700;line-height:1.35;text-align:left;white-space:normal}
.person-actions #pet-person{background:var(--gold);border-color:var(--gold);color:#203e32}
.person-actions #attack-person{margin-top:5px;background:transparent;border-color:#fff5dc45;font-weight:600}
.person-actions button:hover:not(:disabled){filter:brightness(1.1)}
.person-actions button:disabled{opacity:.5}
.person-panel #person-message{padding:10px 12px;background:#fff5dc14;border-left:3px solid var(--gold);border-radius:0 8px 8px 0}
.person-panel #person-message:empty{display:none}
#home-panel-title:focus-visible,#person-name:focus-visible{outline:2px solid var(--gold);outline-offset:5px;border-radius:3px}
.person-status{position:absolute;z-index:1;top:154px;left:28px;max-width:min(190px,50%);margin:0;padding:8px 10px;border-radius:12px;color:var(--cream);font-size:13px;line-height:1.4;pointer-events:none;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
.menu-open .person-status{display:none}
.toast.visible~.person-status{visibility:hidden}
@media(max-width:850px),(pointer:coarse){.person-status{top:145px;left:18px;max-width:min(190px,50%,calc(100% - 180px));padding:5px 8px;font-size:12px;line-height:1.3}}
@media(max-width:480px){.person-status{left:13px;max-width:min(190px,50%,calc(100% - 166px))}.people-mode .person-panel{margin-top:14px}}
@media(max-height:550px){.person-status{top:134px}.people-mode .person-panel{margin-top:12px}.person-actions{margin:12px 0}}


/* The existing pause dialog also owns online play; the game keeps its full canvas. */
.open-together{display:block;width:100%;max-width:320px;min-height:46px;margin:0 0 12px;padding:11px 16px;border:1px solid #fff5dc80;border-radius:12px;background:#163c31;color:var(--cream);font-size:16px;font-weight:700;text-align:left}
.open-together:hover{background:#375e49}
.online-panel{display:none}
:is(.home-mode,.people-mode,.online-mode) .open-together{display:none}
.online-mode .character,.online-mode .palette,.online-mode .welcome>ul,.online-mode .graphics-settings,.online-mode .open-home,.online-mode .home-panel,.online-mode .person-panel{display:none}
.online-mode .curtain{justify-content:center;background:#193d33ed}
.online-mode .welcome{width:100%;max-width:460px;padding:8px;scrollbar-gutter:stable}
.online-mode .welcome h1{font-size:42px;line-height:1.05;margin:12px 0}
.online-mode .welcome>p{font-size:16px;line-height:1.5}
.online-mode .online-panel{display:block;margin:18px 0 20px}
.online-mode .start-button{width:100%;min-width:0;min-height:48px}
.online-panel p{font-size:15px;line-height:1.5;margin:10px 0;color:#f5f0dc;overflow-wrap:anywhere}
.online-panel button{min-height:46px;padding:11px 14px;border:1px solid #fff5dc75;border-radius:11px;background:#163c31;color:var(--cream);font-size:15px;font-weight:700;white-space:normal}
.online-panel button:hover:not(:disabled){background:#375e49}
.online-panel button:disabled{opacity:.55;cursor:wait}
.online-panel .online-primary{width:100%;margin:7px 0 20px;color:#203e32;background:var(--gold);border-color:var(--gold)}
.online-panel .online-primary:hover:not(:disabled){background:#ffd88a}
#join-room-form{margin:0 0 16px}
#join-room-form label{display:block;font-size:16px;font-weight:700;margin:0 0 8px}
.join-room-fields{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
#room-code{min-width:0;width:100%;min-height:48px;padding:10px 12px;border:2px solid #fff5dc75;border-radius:10px;font:700 18px ui-monospace,monospace;letter-spacing:.12em;text-transform:uppercase;background:#fff9e9;color:#173e35}
#room-code:focus-visible{outline:3px solid var(--gold);outline-offset:3px}
#room-code-hint{font-size:14px;margin:8px 0}
.online-panel .room-code-label{font-size:13px;letter-spacing:.14em;font-weight:700;color:#f7db9c;margin:16px 0 3px}
.online-panel .room-code-value{font:700 clamp(24px,6vw,34px) ui-monospace,monospace;letter-spacing:.15em;color:var(--cream);margin:3px 0 8px;user-select:all}
.online-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:14px 0 8px}
.online-panel #leave-room{background:transparent;font-weight:600}
#room-player-list{list-style:none;margin:14px 0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;max-height:140px;overflow-y:auto}
#room-player-list li{display:flex;align-items:center;gap:8px;min-width:0;font-size:14px;padding:5px 0}
.player-coat{width:13px;height:13px;border-radius:50%;flex:0 0 13px;border:1px solid #fff9}
.online-panel .online-note{font-size:14px;line-height:1.5;color:#e7ebd9;border-top:1px solid #fff5dc35;padding-top:14px;margin-top:17px}
#online-error:empty,#room-copy-status:empty{display:none}
#online-error{padding:10px 12px;border-left:3px solid var(--gold);background:#fff5dc14;border-radius:0 8px 8px 0}
#retry-room{margin:8px 0}
#together[data-connected=true]{border-color:var(--gold);background:#3b634d}
#online-summary{border-left:1px solid #fff5dc66;padding-left:9px}
@media(max-width:480px){.online-mode .curtain{padding:80px 18px 20px}.online-mode .welcome{padding:5px}.online-mode .welcome h1{font-size:34px}.online-actions{grid-template-columns:1fr}.online-panel .room-code-value{letter-spacing:.1em}.top-actions{gap:4px}.brand svg{display:none}.mode-pill{max-width:calc(100% - 32px);font-size:12px}}
@media(max-height:550px){.online-mode .curtain{padding-top:72px;padding-bottom:16px}.online-mode .welcome h1{font-size:32px;margin:7px 0}.online-mode .welcome-kicker{display:none}.online-mode .welcome .welcome-note{display:none}.online-mode .online-panel{margin-top:12px}}

.remote-labels{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.remote-player-label{position:absolute;left:0;top:0;padding:4px 8px;background:#173e35eb;color:var(--cream);border:1px solid #fff9;border-radius:8px;font-size:13px;line-height:1.3;white-space:nowrap;text-shadow:none;pointer-events:none}
.menu-open .remote-labels{display:none}

/* Both animal families share the existing selection and controller focus order. */
.creature-choices>p{font-size:14px;font-weight:700;margin:12px 0 5px;color:#fff1d1}
.creature-choices .palette{margin:5px 0 12px}
#character-bird-icon{width:49px;height:61px;flex:none}
#character-drawing-icon{width:49px;height:61px;flex:none}
.drawing-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;width:100%;max-width:360px;margin:5px 0 16px}
.drawing-choice{display:flex;align-items:center;gap:8px;min-height:54px;padding:6px 10px;border:1px solid #fff5dc55;border-radius:10px;background:#193f2e88;color:#fff6dd;text-align:left;font-size:14px;line-height:1.2}
.drawing-choice svg{width:34px;height:40px;color:var(--creature-color)}
.drawing-choice span{min-width:0;overflow-wrap:anywhere}
.drawing-choice[aria-pressed=true]{border-color:#ffe0a1;box-shadow:inset 0 0 0 1px #ffe0a1;background:#fff0c52b}
.drawing-colors p{font-size:14px;margin:0 0 5px}.drawing-colors .palette{max-width:360px}.drawing-colors .coat-choice{font-size:14px}
.drawing-colors .creature-action-hint{font-size:14px;line-height:1.45;color:#e7ebd9;margin:7px 0 16px}
#elviria-palette{max-width:360px;gap:9px}
#elviria-palette .coat-choice{min-height:56px;flex-direction:row;gap:9px}
.creature-action{min-height:48px;background:#f4e8c6;border:1px solid #fff4d4;color:#203e32;font-weight:700;justify-content:space-between;gap:10px}
.creature-action:hover{background:#fff4d9}
.welcome{scroll-padding-block:12px 76px;scrollbar-gutter:stable}
.welcome .start-button{position:sticky;bottom:0;z-index:1;width:100%;min-width:0;min-height:50px;box-shadow:0 -5px 16px #173e3566,0 4px 0 #152b3450}
@media(max-width:380px){.drawing-choice{padding:6px;gap:5px}.drawing-choice svg{width:29px}}
.help-mode .creature-choices,.home-mode .creature-choices,.people-mode .creature-choices,.online-mode .creature-choices{display:none}
@media(max-width:850px),(pointer:coarse){.gamepad-mode .actions{flex-wrap:wrap;justify-content:center;max-width:360px}}
@media(max-width:850px),(pointer:coarse){.gamepad-mode.creature-action-ready .mode-pill{bottom:220px}.gamepad-mode.creature-action-ready.air-controls .mode-pill{bottom:274px}}

/* Keep phone controls inside the visible screen and clear of notches. */
:root{--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
#game{min-height:0}
body{overscroll-behavior:none}
.vertical-controls button{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#welcome-title:focus{outline:none}
.creature-choices button:disabled{opacity:.5}
@media(max-width:850px),(pointer:coarse){
  #game{--phone-side:18px}
  .topbar{top:calc(15px + var(--safe-top));left:calc(var(--phone-side) + var(--safe-left));right:calc(var(--phone-side) + var(--safe-right))}
  .bag-button{top:calc(81px + var(--safe-top));left:calc(var(--phone-side) + var(--safe-left));max-width:calc(100% - 170px - var(--safe-left) - var(--safe-right))}
  .altitude{top:calc(81px + var(--safe-top));right:calc(var(--phone-side) + var(--safe-right))}
  .person-status{top:calc(145px + var(--safe-top));left:calc(var(--phone-side) + var(--safe-left));max-width:calc(100% - 180px - var(--safe-left) - var(--safe-right))}
  .controls{right:calc(var(--phone-side) + var(--safe-right));bottom:calc(24px + var(--safe-bottom));width:170px;max-width:calc(100% - 146px - var(--safe-left) - var(--safe-right))}
  .actions{width:100%}
  .action{width:100%;min-width:0!important;min-height:49px;height:auto;padding:11px 14px;font-size:14px;line-height:1.3}
  .vertical-controls{width:100%}
  .vertical-controls button{flex:1;min-width:0;min-height:48px}
  .joystick{left:calc(var(--phone-side) + var(--safe-left));bottom:calc(26px + var(--safe-bottom));-webkit-user-select:none;-webkit-touch-callout:none}
  .stick{left:calc(50% - 25px);top:calc(50% - 25px)}
  .mode-pill,.air-controls .mode-pill{left:calc(var(--phone-side) + var(--safe-left));bottom:calc(205px + var(--safe-bottom));transform:none;max-width:calc(100% - 36px - var(--safe-left) - var(--safe-right));white-space:normal}
  .toast{top:calc(189px + var(--safe-top));left:calc(var(--phone-side) + var(--safe-left));max-width:calc(100% - 36px - var(--safe-left) - var(--safe-right));font-size:14px}
  #game .curtain{padding:calc(76px + var(--safe-top)) calc(18px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(18px + var(--safe-left));justify-content:center}
  .welcome{width:100%;max-width:420px}
  .welcome .start-button{position:sticky;bottom:0;z-index:1;width:100%;min-width:0;min-height:50px;box-shadow:0 -5px 16px #173e3566,0 4px 0 #152b3450}
  .menu-open :is(.controls,.joystick,.altitude,.mode-pill){visibility:hidden;pointer-events:none}
  .gamepad-mode .controls{width:auto;max-width:calc(100% - 36px - var(--safe-left) - var(--safe-right));right:auto}
  .gamepad-mode .action{width:auto}
  .gamepad-mode .vertical-controls{width:max-content}
}
@media(max-width:480px){#game{--phone-side:13px}}
@media(max-height:550px) and (max-width:850px),(max-height:550px) and (pointer:coarse){
  .topbar{top:calc(10px + var(--safe-top))}
  .bag-button{top:calc(66px + var(--safe-top));min-height:48px;padding:6px 10px}
  .altitude{top:calc(66px + var(--safe-top));display:flex;align-items:center;gap:8px;width:170px;padding:7px 10px}
  .altitude>div{margin:0;gap:3px}.altitude strong{font-size:25px}.altitude .unit{font-size:14px}.altitude .infinity{display:none}
  .controls{bottom:calc(12px + var(--safe-bottom));gap:7px}
  .action{min-height:44px;padding:9px 12px}.vertical-controls button{min-height:44px;height:44px}
  .joystick{bottom:calc(12px + var(--safe-bottom));width:110px;height:110px}
  .person-status{top:calc(121px + var(--safe-top));max-width:170px}
  #game .curtain{padding-top:calc(64px + var(--safe-top));padding-bottom:calc(10px + var(--safe-bottom))}
}
@media(min-width:560px) and (max-height:550px) and (max-width:850px),(min-width:560px) and (max-height:550px) and (pointer:coarse){
  .mode-pill,.air-controls .mode-pill{left:50%;bottom:calc(12px + var(--safe-bottom));transform:translateX(-50%);max-width:calc(100% - 390px - var(--safe-left) - var(--safe-right))}
  .toast{top:calc(66px + var(--safe-top));left:50%;transform:translateX(-50%);max-width:calc(100% - 390px - var(--safe-left) - var(--safe-right))}.toast.visible{transform:translateX(-50%)}
}
