*{box-sizing:border-box}html,body{margin:0;height:100%;overflow:hidden;background:#8dd4e8;color:#153d3a;font-family:Arial,Helvetica,sans-serif;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}input,textarea{user-select:text;-webkit-user-select:text}button,a{-webkit-tap-highlight-color:transparent;touch-action:manipulation;color:inherit;font:inherit}button{cursor:pointer}a{text-decoration:none}button:focus-visible,a:focus-visible,main:focus-visible{outline:3px solid #ffbe59;outline-offset:-3px}main{position:fixed;inset:0;touch-action:none;outline:none;background:linear-gradient(#70bfe6,#d9efcf)}canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}header{position:fixed;inset:23px 28px auto;display:flex;justify-content:space-between;pointer-events:none}.identity span{font-size:12px;letter-spacing:4px;font-weight:bold;color:#326b75}.identity h1{font-size:48px;letter-spacing:-2px;margin:4px 0;line-height:1;color:#164f51;text-shadow:0 2px #f5ffe260}.tools{display:flex;gap:7px;pointer-events:auto;align-items:start}.tools a,.tools button{display:grid;place-items:center;height:44px;min-width:44px;padding:0 15px;border-radius:14px;border:1px solid #ffffff8a;background:#f1ffe6c9;font-size:15px;box-shadow:0 2px #1b616225}.tools button{padding:0;font-size:20px}#sound[aria-pressed=false]{opacity:.6}#pocket{position:fixed;top:116px;left:29px;display:flex;align-items:center;gap:10px;font-size:15px;pointer-events:none}#pocket>span:first-child{background:#ffffe6c9;padding:7px 10px;border-radius:10px;color:#387c74}#goal{font-size:13px;color:#285c5c;text-shadow:0 1px #e7ffe2}#message{position:fixed;top:27%;left:50%;transform:translateX(-50%);color:#fff8d1;text-align:center;font-size:22px;font-weight:bold;text-shadow:0 2px 5px #183e32;pointer-events:none;width:90%}#hint{position:fixed;bottom:121px;left:50%;transform:translateX(-50%);font-size:19px;font-weight:bold;white-space:nowrap;pointer-events:none;color:#fff2c9;text-shadow:0 2px 5px #142820}#inventory{position:fixed;bottom:max(25px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);display:flex;gap:5px;background:#18382ff0;padding:8px;border:1px solid #b0c49c7a;border-radius:18px;box-shadow:0 4px 0 #112c257a}#inventory button{position:relative;width:72px;height:72px;padding:4px;border:2px solid transparent;border-radius:10px;background:#53705e;color:#fff2c9}#inventory button[aria-pressed=true]{border-color:#ffda78;background:#7d8052;box-shadow:0 0 0 1px #172c20}#inventory canvas{width:33px;height:33px;left:8px;top:6px;image-rendering:pixelated}#inventory b{position:absolute;right:5px;top:27px;font-size:14px;text-shadow:0 1px 3px #081b12}#inventory span{position:absolute;bottom:6px;left:0;right:0;font-size:11px;font-weight:bold}.controls{position:fixed;bottom:max(27px,env(safe-area-inset-bottom));display:flex;gap:8px;touch-action:none}.controls.left{left:25px}.controls.right{right:25px}.controls button{display:grid;place-items:center;background:#244438e8;color:#ffe6ad;border:1px solid #c2d5ad88;border-radius:17px;width:66px;height:65px;font-size:29px;touch-action:none;box-shadow:0 3px #10271e88}.controls button.pressed{background:#677a48;border-color:#fff0bd}.controls #jump{width:78px}.controls #jump small{font-size:9px;letter-spacing:2px;display:block;margin-top:-17px}#saved{position:fixed;bottom:10px;left:29px;color:#cedfc7;font-size:10px;pointer-events:none;text-shadow:0 1px 3px #17362d}dialog{background:#f1efd3;color:#25483d;border:2px solid #9fad7e;border-radius:22px;width:min(470px,92vw);max-height:85dvh;padding:28px}dialog::backdrop{background:#132e26b5}dialog h2{font-size:30px;margin-top:12px}dialog p{font-size:15px;line-height:1.6;color:#42604e}dialog a{color:#1e695d;text-decoration:underline}#close-help{float:right;border:0;background:none;color:inherit;font-size:26px;width:38px;height:38px}
@media(max-width:800px){#inventory button{width:57px}.controls button{width:49px}.controls #jump{width:55px}.controls.left{left:15px}.controls.right{right:15px}#hint{font-size:16px}}
@media(max-width:600px){header{inset:18px 15px auto}.identity span{font-size:9px;letter-spacing:2px}.identity h1{font-size:31px;letter-spacing:-1px}.tools{gap:4px}.tools a{font-size:12px;padding:0 10px}.tools a,.tools button{height:37px;min-width:34px}.tools button{font-size:17px}#pocket{top:96px;left:16px;font-size:13px;gap:7px}#goal{font-size:11px}#inventory{bottom:max(90px,calc(env(safe-area-inset-bottom) + 74px));padding:6px;gap:4px;border-radius:14px}#inventory button{width:55px;height:66px}#inventory canvas{left:5px;top:4px;width:29px;height:29px}#inventory b{font-size:13px;top:24px;right:3px}#inventory span{font-size:10px;bottom:5px}#hint{bottom:171px;font-size:15px}#message{top:25%;font-size:20px}.controls{bottom:max(17px,env(safe-area-inset-bottom));gap:6px}.controls button{width:55px;height:57px;font-size:27px}.controls #jump{width:63px}#saved{bottom:41px;left:50%;transform:translateX(-50%);width:95px;text-align:center;font-size:9px;line-height:1.3}}
@media(max-width:350px){.identity h1{font-size:28px}.tools a{padding:0 8px}.tools a,.tools button{min-width:31px}#inventory button{width:49px}.controls button{width:47px}.controls #jump{width:56px}#saved{width:76px}}
@media(max-height:490px){header{top:10px}.identity h1{font-size:30px}.identity span{font-size:9px}#pocket{top:72px}#inventory{bottom:15px;padding:5px}#inventory button{height:56px;width:52px}#inventory canvas{width:25px;height:25px}#inventory span{bottom:3px;font-size:9px}#inventory b{top:20px;font-size:12px}.controls button{height:49px;width:50px}.controls{bottom:20px}#hint{bottom:90px;font-size:14px}#saved{bottom:3px}#message{top:23%}}

#together{position:fixed;top:163px;left:28px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;max-width:90vw}#join-world{border:1px solid #ffffffaa;border-radius:12px;background:#f1ffe6ed;color:#265e50;min-height:40px;padding:0 13px;font-size:14px;font-weight:bold;box-shadow:0 2px #214c4226}#join-world:disabled{opacity:.7}#online-count{font-size:13px;font-weight:bold;text-shadow:0 1px #e8ffdf}#reactions{display:flex;gap:4px}#reactions[hidden]{display:none}#reactions button{border:1px solid #fcffdb94;border-radius:12px;background:#f1ffe6dd;width:40px;height:40px;font-size:21px}
@media(max-width:600px){#together{top:138px;left:15px;gap:5px;max-width:calc(100vw - 30px)}#join-world{font-size:12px;padding:0 10px;min-height:38px}#online-count{font-size:11px}#reactions{gap:3px}#reactions button{height:36px;width:36px;font-size:19px}}
@media(max-height:490px){#together{top:108px}#join-world{min-height:33px}#reactions button{height:33px;width:33px}#online-count{font-size:11px}}

#fuel{position:fixed;right:28px;bottom:111px;width:150px;pointer-events:none;color:#ffebaf;text-shadow:0 1px 3px #17362d}#fuel span{display:block;font-size:10px;letter-spacing:2px;margin-bottom:5px;text-align:right}#fuel i{display:block;height:7px;border-radius:9px;background:#1e382d;border:1px solid #fff4b87a;overflow:hidden}#fuel-fill{display:block;height:100%;background:#fbd66f;transform-origin:left;will-change:transform}#fuel.empty #fuel-fill{background:#e77c67}.controls #jump small{font-size:7px;letter-spacing:.5px} @media(max-width:600px){#fuel{right:16px;bottom:183px;width:115px}#fuel span{font-size:8px}}@media(max-height:490px){#fuel{bottom:84px;width:115px}#fuel span{font-size:8px}}

#photo-tools[hidden]{display:none}.photographing header,.photographing #together,.photographing #pocket,.photographing #message,.photographing #hint,.photographing #inventory,.photographing #fuel,.photographing #saved,.photographing .controls{display:none}#photo-tools{position:fixed;inset:0;pointer-events:none;color:#fff4d2;text-shadow:0 1px 4px #14352d}.photo-top{position:absolute;top:max(20px,env(safe-area-inset-top));left:25px;right:25px;display:flex;align-items:center;justify-content:space-between;gap:12px}.photo-top>span{font-size:12px;letter-spacing:3px;font-weight:bold}.photo-bottom{position:absolute;bottom:max(24px,env(safe-area-inset-bottom));left:0;right:0;display:grid;justify-content:center;gap:11px;text-align:center}.photo-hint{font-size:13px}.photo-controls{display:flex;align-items:center;gap:8px;padding:7px;border:1px solid #f7ebba77;border-radius:19px;background:#17392fea;box-shadow:0 3px 0 #18382e66;pointer-events:auto}#photo-tools button{height:44px;min-width:44px;border:1px solid #eff6ca66;border-radius:12px;background:#2e5846;color:#fff0c7;font-size:23px;pointer-events:auto}.photo-controls output{width:42px;font-size:12px}.photo-top #close-photo{font-size:13px;padding:0 13px;background:#173b33d9}#photo-tools #photo-shutter{background:#ffe2a0;color:#264336;font-size:15px;font-weight:bold;padding:0 18px;border-color:#fff0c7}#photo-result{width:min(890px,94vw);padding:14px;text-align:center;max-height:93dvh}#photo-result img{display:block;max-width:100%;max-height:65dvh;width:auto;height:auto;margin:0 auto 12px;border-radius:5px}#close-photo-result{display:block;margin:0 0 6px auto;border:0;background:none;font-size:24px;width:36px;height:36px}#photo-download{display:inline-flex;align-items:center;min-height:46px;padding:0 24px;background:#285944;color:#fff1c9;border-radius:12px;text-decoration:none;font-size:15px;font-weight:bold}#photo-result p{font-size:12px;margin:10px 0 2px}@media(max-width:600px){.photo-top{left:15px;right:15px}.photo-top>span{font-size:10px;letter-spacing:1.5px}.photo-controls{gap:5px;padding:6px}#photo-tools #photo-shutter{padding:0 12px;font-size:13px}.photo-bottom{bottom:max(18px,env(safe-area-inset-bottom))}#photo-tools button{min-width:42px}.photo-controls output{width:37px}}@media(max-height:490px){.photo-top{top:10px}.photo-bottom{bottom:12px}.photo-hint{display:none}#photo-result img{max-height:48dvh}}

/* Keep the top edge light; the world is the title. */
header{justify-content:flex-end}#pocket{top:27px;left:28px;gap:8px}#together{top:77px;left:28px}#goal{font-size:12px} @media(max-width:600px){#pocket{top:20px;left:15px}#goal{display:none}#together{top:67px;left:15px}} @media(max-height:490px){#pocket{top:12px}#together{top:60px}}

/* Keep moving cached terrain on the compositor while characters render at 60 Hz. */
#terrain{will-change:transform}#chat-toggle{position:relative}#chat-unread{position:absolute;right:-4px;top:-5px;min-width:18px;height:18px;border-radius:10px;background:#efb858;color:#214534;font:bold 11px/18px Arial;font-style:normal}#chat-unread[hidden],#chat-panel[hidden],.photographing #chat-panel{display:none}#chat-panel{position:fixed;right:28px;top:128px;width:min(330px,calc(100vw - 30px));max-height:calc(100dvh - 250px);display:flex;flex-direction:column;padding:12px;background:#f3f2dbee;border:1px solid #ffffffbb;border-radius:17px;box-shadow:0 7px 28px #133c3933;color:#244a3b}.chat-heading{display:flex;align-items:center;justify-content:space-between;font-size:15px}.chat-heading button{border:0;background:transparent;font-size:24px;min-width:36px;height:32px}#chat-log{overflow:auto;overscroll-behavior:contain;max-height:240px;min-height:38px;scrollbar-width:thin}#chat-log article{display:flex;gap:8px;padding:8px 0;border-bottom:1px solid #446e481c}#chat-log article>div{min-width:0;flex:1}#chat-log b{font-size:11px;color:#45705b}#chat-log p{margin:3px 0 0;font-size:14px;line-height:1.4;overflow-wrap:anywhere;white-space:pre-wrap}#chat-log img,.chat-guest{flex-shrink:0;width:28px;height:28px;border-radius:9px}.chat-guest{display:grid;place-items:center;background:#bed9ad;color:#315a40}#chat-status{font-size:10px;line-height:1.4;margin:9px 0 7px;color:#52735d}#chat-form{display:flex;gap:6px}#chat-input{min-width:0;flex:1;width:100%;height:42px;border:1px solid #8aac88;border-radius:10px;background:#fffbed;color:#25483d;padding:0 10px;font:16px Arial}#chat-input:focus{outline:2px solid #d6a446;outline-offset:-2px}#chat-send{border:0;border-radius:10px;background:#285d46;color:#fff2c9;padding:0 12px;font-size:13px;font-weight:bold}#chat-send:disabled{opacity:.5}@media(max-width:600px){#chat-panel{right:15px;top:119px;max-height:calc(100dvh - 220px)}#chat-log{max-height:29dvh}.tools{gap:3px}.tools a{padding:0 8px}header{right:15px}}@media(max-height:550px){#chat-panel{top:105px;max-height:calc(100dvh - 125px)}#chat-log{max-height:120px}}
#frontier{position:fixed;right:28px;top:80px;display:flex;align-items:center;gap:10px;flex-direction:row-reverse}#explore{min-height:42px;padding:0 17px;background:#ffe1a0;color:#32503e;border:1px solid #fff0c5;border-radius:13px;box-shadow:0 3px #32564135;font-size:15px;font-weight:bold}#explore:disabled{opacity:.65}#place{font-size:12px;font-weight:bold;color:#285749;text-shadow:0 1px #ffffda}.photographing #frontier{display:none}@media(max-width:600px){#frontier{top:114px;right:15px;gap:7px}#explore{min-height:38px;padding:0 12px;font-size:13px}#place{font-size:11px}}@media(max-height:490px){#frontier{top:103px}#explore{min-height:34px}}

/* Held controls cannot select text or open a touch callout. Chat remains selectable. */
.controls,.controls button,.controls small,#inventory,#reactions{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.controls button{touch-action:none}
.translation-tools{display:flex;align-items:center;gap:8px;margin:8px 0 2px;font-size:12px}.translation-tools select{min-width:0;flex:1;height:35px;border:1px solid #8aac88;border-radius:8px;color:#25483d;background:#fffbed;font-size:14px}.translation-tools button{min-height:35px;border:0;border-radius:8px;background:#dbe5c4;color:#25483d}#translation-status{font-size:10px;min-height:15px;color:#52735d}#chat-log .chat-translation{border-left:2px solid #82a88a;padding-left:7px;color:#2e6452;font-size:13px}#chat-log [hidden],.translation-tools [hidden]{display:none}
#photo-share{display:inline-flex;align-items:center;min-height:46px;padding:0 20px;margin:0 7px 7px 0;border:0;background:#e9bd61;color:#264336;border-radius:12px;font-size:15px;font-weight:bold}#share-link{width:100%;max-width:400px;height:38px;background:#fff9df;color:#264336;border:1px solid #9cad7c;border-radius:8px;padding:6px;font-size:13px}

/* The material strip grows with discoveries; swipe it without covering the world. */
#inventory{max-width:calc(100vw - 30px);width:max-content;gap:4px;align-items:center}#material-strip{position:relative;display:flex;gap:5px;max-width:380px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;touch-action:pan-x}#material-strip::-webkit-scrollbar{display:none}#inventory [data-kind]{flex:0 0 72px}#inventory [hidden]{display:none}#inventory .material-arrow{width:24px;min-width:24px;flex:0 0 24px;height:64px;padding:0;font-size:27px;background:transparent;border:0}#inventory span{line-height:1.05;padding:0 2px}#inventory [data-kind][aria-pressed=true]{box-shadow:inset 0 0 12px #ffdf7040}#discovery{position:fixed;top:24%;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:16px;padding:16px 24px;background:#f8e9b9f0;border:2px solid #fff5ce;border-radius:20px;color:#274e40;box-shadow:0 5px 0 #1e453c4a;pointer-events:none}#discovery[hidden],.photographing #discovery{display:none}#discovery canvas{position:static;flex:0 0 72px;width:72px;height:72px;image-rendering:pixelated}#discovery strong{display:block;font-size:29px;white-space:nowrap}#discovery span{display:block;font-size:15px;margin-top:5px;color:#53754e}
@media(max-width:800px){#inventory [data-kind]{flex-basis:57px}#material-strip{max-width:305px}}
@media(max-width:600px){#material-strip{max-width:calc(100vw - 104px);gap:4px}#inventory [data-kind]{flex-basis:55px}#inventory .material-arrow{width:20px;min-width:20px;flex-basis:20px;height:57px}#inventory span{font-size:9px}#discovery{gap:10px;padding:12px 16px;max-width:92vw;top:25%}#discovery canvas{width:52px;height:52px;flex-basis:52px}#discovery strong{font-size:23px}#discovery span{font-size:13px}}
@media(max-width:350px){#inventory [data-kind]{flex-basis:49px}}
@media(max-height:490px){#inventory [data-kind]{flex-basis:52px}#material-strip{max-width:280px}#discovery{top:20%;padding:10px 16px}#discovery canvas{width:48px;height:48px;flex-basis:48px}#discovery strong{font-size:23px}}
/* Before discoveries, all five starter blocks fit even inside the narrow mobile host. */
#inventory #materials-prev[hidden]+#material-strip{max-width:min(380px,calc(100vw - 46px))}#discovery{width:max-content}

/* A single utility row leaves the painted world open. Secondary context lives in help/chat. */
header{inset:max(16px,env(safe-area-inset-top)) 20px auto;justify-content:flex-end}
.tools{gap:6px;align-items:center;padding:5px;background:#183e35d9;border:1px solid #f5efc94d;border-radius:19px}
.tools a,.tools button,.tools #join-world,.tools #explore{display:grid;place-items:center;min-width:52px;width:52px;height:52px;min-height:52px;padding:0;border:0;border-radius:12px;background:#f0f1d5;color:#285548;box-shadow:none;font-size:24px}
.tools svg{display:block;width:27px;height:27px}
.tools #explore{background:#ffe1a0}
#together{position:relative;inset:auto;display:block;max-width:none}
#online-count{position:absolute;bottom:-1px;right:-2px;min-width:20px;padding:1px 4px;border-radius:7px;background:#244e40;color:#fff0bf;font:bold 11px/15px Arial;text-shadow:none;pointer-events:none}
#online-count:empty{display:none}
#join-world .world-public,#join-world[data-world=public] .world-personal{display:none}
#join-world[data-world=public] .world-public{display:block}
#fuel{width:78px;right:25px;bottom:100px}
#fuel[hidden]{display:none}
#inventory button,#inventory [data-kind]{height:68px}
#inventory canvas{width:43px;height:43px;left:5px;top:5px}
#inventory b{top:auto;bottom:5px;right:6px;font-size:13px}
#inventory span{display:none}
#hint{bottom:112px;font-size:18px}
#hint:empty{display:none}
#chat-panel{top:87px;right:20px}
#chat-panel #reactions{margin:5px 0;gap:8px}
#chat-panel #reactions button{width:44px;height:40px}
#help-dialog{padding:22px 25px}
#help-dialog h2{font-size:28px;margin:8px 0 18px}
#help-dialog p{line-height:1.55;margin:14px 0}
#help-dialog details{border-block:1px solid #8a9e7255;padding:12px 0;margin:16px 0}
#help-dialog summary{cursor:pointer;min-height:30px;padding-top:4px;font-size:14px;font-weight:bold}
.help-world{display:flex;flex-wrap:wrap;gap:5px 12px;background:#dce2c5;border-radius:10px;padding:12px;font-size:13px}
#help-dialog #place,#help-dialog #saved{position:static;inset:auto;display:block;transform:none;width:auto;font-size:12px;color:#42604e;text-shadow:none;text-align:left}
#help-dialog #saved{width:100%}
#help-dialog #pocket{position:static;display:flex;font-size:14px;pointer-events:auto;flex-wrap:wrap}
#help-dialog #goal{display:inline;font-size:12px;text-shadow:none}
.modal-credit{margin-top:18px;padding-top:12px;border-top:1px solid #8a9e7255;font-size:12px;color:#42604e;text-align:center}
.help-links{display:flex;align-items:center;flex-wrap:wrap;gap:12px;font-size:13px}
.help-links #sound{width:44px;height:44px;border:1px solid #8a9e7288;border-radius:10px;background:#dce2c5;font-size:23px}
.help-options{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0}
.help-options button{flex:1;min-height:46px;border:1px solid #8a9e7288;border-radius:12px;background:#dce2c5;color:#2f5c49;font-size:15px;font-weight:bold;padding:0 14px;cursor:pointer}
.help-options button:focus-visible{outline:3px solid #ffbe59;outline-offset:-2px}
#close-story{float:right;border:0;background:none;color:inherit;font-size:26px;width:38px;height:38px}
#story-dialog{padding:22px 25px}
#story-dialog h2{font-size:28px;margin:8px 0 18px}
#story-dialog p{line-height:1.55;margin:14px 0}
#story-dialog details{border-block:1px solid #8a9e7255;padding:12px 0;margin:16px 0}
#story-dialog summary{cursor:pointer;min-height:30px;padding-top:4px;font-size:14px;font-weight:bold}
#story-dialog #pocket{position:static;display:flex;font-size:14px;pointer-events:auto;flex-wrap:wrap}
#story-dialog #goal{display:inline;font-size:12px;text-shadow:none}
#story-dialog .story-controls{margin-top:6px}
#regenerate-world{color:#a23e2f!important;background:#f3e2d4!important}
.regenerate-hint{font-size:12px;color:#42604e;margin:8px 0 0}
.mundo-line{display:flex;gap:10px;margin:12px 0 4px}
.mundo-line button{flex:1;min-height:44px;border:1px solid #8a9e7288;border-radius:12px;background:#dce2c5;font-size:15px;font-weight:bold;padding:0 12px;cursor:pointer;color:#2f5c49}
.mundo-line #regenerate-world{color:#a23e2f;background:#f3e2d4}
.mundo-line #sound{flex:0 0 52px;font-size:23px}
#regenerate-dialog{width:min(400px,90vw);text-align:center;border:2px solid #9fad7e;border-radius:22px;background:#f1efd3;color:#25483d;padding:30px 26px}
#regenerate-dialog::backdrop{background:#132e26cc}
.regenerate-icon{width:64px;height:64px;margin:0 auto 14px;display:grid;place-items:center;border-radius:50%;background:#f3e2d4;color:#a23e2f;font-size:36px;font-weight:bold;box-shadow:inset 0 0 0 2px #dfc4ae}
#regenerate-dialog h2{font-size:24px;margin:0 0 10px}
#regenerate-dialog p{font-size:15px;line-height:1.55;color:#42604e;margin:0 0 20px}
#regenerate-dialog em{color:#a23e2f;font-style:normal}
.regenerate-actions{display:flex;gap:10px}
.regenerate-actions button{flex:1;min-height:46px;border-radius:12px;font-size:15px;font-weight:bold;cursor:pointer;border:1px solid #8a9e7288}
#regenerate-cancel{background:#dce2c5;color:#2f5c49}
#regenerate-confirm{background:#b3503f;color:#fff3e8;border-color:#8f3d30}
@media(max-width:600px){header{inset:max(12px,env(safe-area-inset-top)) 12px auto;justify-content:flex-end}.tools{gap:4px;padding:4px;border-radius:16px}.tools a,.tools button,.tools #join-world,.tools #explore{width:44px;height:44px;min-width:44px;min-height:44px;border-radius:10px}.tools svg{width:24px;height:24px}#inventory button,#inventory [data-kind]{height:57px}#inventory canvas{width:35px;height:35px;left:4px;top:3px}#inventory b{bottom:2px;right:5px;font-size:12px}#hint{bottom:168px;font-size:15px}#fuel{bottom:84px;right:16px;width:63px}#chat-panel{top:78px;right:12px;max-height:calc(100dvh - 190px)}}
@media(max-height:490px){header{top:8px}.tools a,.tools button,.tools #join-world,.tools #explore{width:44px;height:44px;min-width:44px;min-height:44px}#inventory button,#inventory [data-kind]{height:53px}#inventory canvas{width:32px;height:32px}#hint{bottom:83px}#fuel{bottom:78px}#chat-panel{top:70px;max-height:calc(100dvh - 90px)}}

/* Explicit world choices: an editable first visit, with the shared place one tap away. */
.tools #together{display:flex;gap:0;background:#183e35;border-radius:12px;padding:2px}
.tools #solo-world,.tools #join-world{width:78px;min-width:78px;font-size:18px;font-weight:bold;border-radius:9px;background:transparent;color:#e0e7cd}
.tools #together button[aria-pressed=true]{background:#ffe1a0;color:#285548}
#online-count{right:0;bottom:-5px;font-size:10px;line-height:13px}
@media(max-width:600px){header{left:6px;right:6px}.tools{gap:3px;padding:4px}.tools #solo-world,.tools #join-world{width:54px;min-width:54px;font-size:13px}.tools #together{padding:0}}
@media(max-height:490px) and (min-width:601px){.tools #solo-world,.tools #join-world{width:70px;min-width:70px;font-size:16px}}

/* A held Home fills once; remembered places keep a quiet amber border. */
#home{position:relative;overflow:hidden;touch-action:none}#home.has-home{border-color:#ffc888;box-shadow:inset 0 0 0 2px #ffc88855}#home.holding:after{content:'';position:absolute;inset:auto 0 0;height:5px;background:#ffd48e;transform-origin:left;animation:home-hold .65s linear both}@keyframes home-hold{from{transform:scaleX(0)}to{transform:scaleX(1)}}

/* Big, still portraits: choosing a cat does no animation work while play is paused. */
#change-cat{display:flex;align-items:center;justify-content:space-between;width:calc(100% - 44px);min-height:44px;padding:8px 14px;border:1px solid #94aa7c;border-radius:12px;background:#dce7c4;color:#285548;font-weight:bold}
#cat-dialog{width:min(460px,calc(100vw - 20px));max-height:94dvh;padding:18px 24px 12px;background:#e4edcf;text-align:center;overflow:auto}
#cat-dialog h2{margin:0;font-size:26px;text-align:left}#close-cat{position:absolute;right:12px;top:9px;width:44px;height:44px;border:0;background:transparent;font-size:30px}
.cat-stage{position:relative;height:240px;margin:6px 0 12px;border-radius:70% 70% 18px 18px;background:radial-gradient(ellipse at 50% 85%,#aec78a 0 20%,transparent 21%),radial-gradient(ellipse at 50% 65%,#f9f0b9 0 45%,transparent 46%)}
.cat-stage canvas{position:static;height:220px;width:176px;filter:drop-shadow(0 5px 0 #314d3720)}#cat-name{display:block;position:absolute;bottom:-1px;left:0;right:0;font-size:17px}
.cat-choices{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px}.cat-choices button{min-width:0;height:86px;border:2px solid transparent;border-radius:12px;background:#c3d4af;color:#2c513f;padding:3px 0;font-weight:bold}
.cat-choices button[aria-pressed=true]{background:#fff0bb;border-color:#527652}.cat-choices canvas{position:static;display:block;width:48px;height:60px;margin:auto}.cat-choices span{font-size:10px;display:block}
#cat-done{display:block;width:100%;min-height:48px;margin-top:14px;background:#285a44;color:#fff0bd;border:0;border-radius:12px;font-weight:bold;font-size:17px}#cat-dialog p{font-size:11px;margin:10px 0 0;color:#4e6c52}
@media(max-width:400px){#cat-dialog{padding:18px 14px 12px}.cat-choices{grid-template-columns:repeat(3,minmax(0,1fr))}.cat-choices button{height:78px}.cat-choices canvas{height:54px;width:43px}.cat-choices span{font-size:11px}.cat-stage{height:208px}.cat-stage canvas{height:192px;width:154px}}
@media(max-height:580px){.cat-stage{height:120px;margin-bottom:7px}.cat-stage canvas{height:111px;width:89px}#cat-name{font-size:13px}.cat-choices button{height:65px}.cat-choices canvas{height:43px;width:34px}#cat-dialog{padding-top:12px}#cat-done{margin-top:8px}}

/* Edge doors replace the old directional labels; hidden in Solo and photos. */
#builder-visits{position:fixed;inset:0;pointer-events:none}.photographing #builder-visits{display:none}
/* Reading and typing take priority over the edge Visit shortcuts. */
#chat-panel{z-index:1;background:#f3f2db}
#builder-visits button{position:absolute;transform:translate(-50%,-50%);display:flex;align-items:center;width:140px;height:80px;padding:2px 8px 2px 2px;gap:2px;border:1px solid #fff0b99c;border-radius:20px;background:#234d40eb;color:#fff0b9;box-shadow:0 3px 0 #16382c50;pointer-events:auto;text-align:left}
#builder-visits button[hidden]{display:none}#builder-visits button:disabled{opacity:.6}#builder-visits canvas{position:static;flex:0 0 56px;width:56px;height:70px}#builder-visits strong{display:block;font-size:22px;white-space:nowrap}#builder-visits small{display:block;font-size:14px;margin-top:4px;color:#c5dbc4}
@media(max-width:600px){#builder-visits button{width:100px;height:60px;border-radius:16px;padding-right:5px}#builder-visits canvas{flex-basis:40px;width:40px;height:50px}#builder-visits strong{font-size:15px}#builder-visits small{font-size:11px;margin-top:3px}}
/* A single invitation leaves the world and movement controls usable. */
#visit-request{position:fixed;z-index:14;top:82px;right:24px;width:440px;max-width:calc(100% - 24px);display:flex;align-items:center;gap:10px;padding:9px 12px;background:#fff2cc;color:#244b3f;border:2px solid #315d4c;border-radius:15px;box-shadow:0 3px 0 #244b3f50;box-sizing:border-box}
#visit-request[hidden]{display:none}#visit-request canvas{position:static;inset:auto;width:32px;height:40px;flex:none}#visit-request span{flex:1;min-width:0;font-size:18px;font-weight:bold;overflow-wrap:anywhere;line-height:1.15}#visit-request button{min-width:66px;min-height:44px;border:1px solid #315d4c;border-radius:9px;background:#315d4c;color:#fff2cc;font-size:15px;font-weight:bold;touch-action:manipulation}#visit-request #visit-decline{background:transparent;color:#315d4c}#visit-request button:disabled{opacity:.5}#visit-request button[hidden]{display:none}body.photo-mode #visit-request{display:none}
@media(max-width:600px){#visit-request{top:74px;right:10px;max-width:calc(100% - 20px);gap:6px;padding:7px}#visit-request span{font-size:14px}#visit-request button{font-size:13px;min-width:58px}#visit-request canvas{width:26px;height:33px}}

/* One thumb handles diagonal flight; the other side stays available for sculpting. */
#thumb-pad{display:none;position:fixed;z-index:1;left:14px;bottom:calc(88px + env(safe-area-inset-bottom));width:120px;height:120px;padding:0;border:2px solid #f8edbb80;border-radius:50%;background:radial-gradient(circle,#2a554288 0 38%,#24443880 39% 100%);color:#fff0b4;box-shadow:0 3px 0 #112c2555;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#thumb-pad .thumb-directions{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;opacity:.85}
#thumb-pad .thumb-knob{position:absolute;left:40px;top:40px;width:36px;height:36px;border:2px solid #fff2c4;border-radius:50%;background:#e7c978;box-shadow:0 3px 0 #142f2660;transform:translate(var(--thumb-x,0px),var(--thumb-y,0px));pointer-events:none}
#thumb-pad.steering{border-color:#fff0b4;background:#244438bf}
/* Touch controls follow input capability through rotation, including wide tablets. */
@media(max-width:600px),(pointer:coarse){
 #thumb-pad{display:block}.controls.left,.controls.right #jump{display:none}
 .controls.right{right:16px;bottom:calc(114px + env(safe-area-inset-bottom))}.controls.right #home{width:52px;height:52px;border-radius:15px}
 #inventory{bottom:calc(12px + env(safe-area-inset-bottom));padding:5px;border-radius:14px}
 #inventory button,#inventory [data-kind]{height:49px;flex-basis:49px}
 #inventory canvas{width:32px;height:32px;left:3px;top:2px}#inventory b{bottom:1px;font-size:11px}
 #inventory .material-arrow{height:49px}
 #hint{bottom:calc(76px + env(safe-area-inset-bottom));font-size:14px}
 #fuel{left:32px;right:auto;bottom:calc(80px + env(safe-area-inset-bottom));width:84px}
}
@media(max-height:490px) and (pointer:coarse){#thumb-pad{width:104px;height:104px;bottom:85px}#thumb-pad .thumb-knob{left:33px;top:33px} .controls.right{bottom:110px}}
.photographing #thumb-pad{display:none}

#creative-setting{display:flex;align-items:center;gap:12px;padding:14px 12px;margin:14px 0;border:1px solid #526b56;border-radius:12px;text-align:left;cursor:pointer}
#creative-setting input{width:24px;height:24px;flex:0 0 24px;accent-color:#487b58}
#creative-setting strong{display:block;font-size:16px}#creative-setting small{display:block;font-size:12px;line-height:1.5;margin-top:5px}
#creative-setting.unavailable{opacity:.6;cursor:default}

.woodling-recipe{display:flex;align-items:center;gap:10px;margin:14px 0;padding:10px;border-radius:14px;background:#294e4633}.woodling-recipe canvas{position:static;width:148px;height:81px;flex:none}.woodling-recipe figcaption{font-size:13px;line-height:1.4}.woodling-recipe small{font-size:11px}

/* One optional next act, revealed after the drawing; no change to the first gesture. */
#night-trial{position:fixed;left:28px;top:23px;min-height:44px;padding:9px 18px;border:1px solid #d4d8bb;border-radius:20px;background:#283751ed;color:#fff0bf;font-size:19px;font-weight:bold;box-shadow:0 3px 0 #17283c66}
#night-trial[hidden],#night-status[hidden]{display:none}
#night-status{position:fixed;top:23px;left:28px;display:flex;align-items:center;gap:12px;background:#223149f2;color:#ffedbf;border:1px solid #a7bca9;border-radius:15px;padding:5px 7px 5px 16px;font-size:23px;font-weight:bold;white-space:nowrap}
#night-status button{min-height:40px;border:0;border-radius:10px;background:#e6ddbd;color:#253847;padding:0 10px;font-size:16px}
#night-help{display:block;width:100%;min-height:48px;margin:12px 0;border:1px solid #778872;border-radius:12px;background:#283751;color:#fff0bf;font-size:16px;padding:10px}
#night-help:disabled{opacity:.5}
.photographing #night-trial,.photographing #night-status{display:none}
@media(max-width:600px){#night-trial{left:12px;top:max(12px,env(safe-area-inset-top));min-height:44px;font-size:15px;padding:8px 15px}#night-status{left:12px;top:max(12px,env(safe-area-inset-top));font-size:18px;gap:8px;padding-left:11px}#night-status button{font-size:14px}}
@media(max-height:490px){#night-trial{top:8px}#night-status{top:8px}}

#night-again[hidden]{display:none}#night-trial{white-space:nowrap}#night-status{max-width:calc(100vw - 18px)}
@media(max-width:600px){#night-status{font-size:16px;gap:6px;padding:5px 6px 5px 10px}#night-status button{padding:0 8px;min-height:44px}}

/* Slow fireflies move with the cached world between six small repaints per second. */
#cave-life{will-change:transform}
/* A workshop is a voluntary stop in the same world, with no idle animation. */
#craft-toggle{position:fixed;right:26px;bottom:117px;min-width:78px;min-height:48px;display:flex;align-items:center;justify-content:center;gap:7px;padding:8px 12px;border:1px solid #f6dfaa99;border-radius:14px;background:#284c43ed;color:#ffedbc;font-size:17px;font-weight:bold;box-shadow:0 3px #142e2866}#craft-toggle svg{width:23px;height:23px}
#workshop-dialog{width:min(400px,calc(100vw - 22px));max-height:calc(100dvh - 28px);padding:24px 20px 16px;border:2px solid #739883;border-radius:22px;background:#f0ead0;color:#23473f;overflow:auto;box-shadow:0 18px 70px #112c3670}#workshop-dialog::backdrop{background:#15352a80}
#close-workshop{position:absolute;right:9px;top:7px;width:42px;height:42px;border:0;background:none;font-size:30px}#workshop-dialog h2{font-size:23px;line-height:1.15;margin:9px 28px 16px 0}#workshop-art{position:static;display:block;width:100%;height:auto;border-radius:12px}#workshop-dialog p{font-size:13px;line-height:1.4;margin:12px 0}#workshop-context{text-align:center}.workshop-recipes{display:grid;grid-template-columns:1fr 1fr;gap:10px}.workshop-recipes button{min-height:70px;display:grid;gap:4px;text-align:left;padding:12px;border:1px solid #86a189;border-radius:12px;background:#d9e3c5}.workshop-recipes strong{font-size:17px}.workshop-recipes span{font-size:13px}.workshop-upgrade{border-top:1px solid #829b7966;margin-top:17px;padding-top:17px}.workshop-upgrade>strong{font-size:19px}#pack-tiers{display:flex;gap:5px;margin-top:10px}#pack-tiers i{height:7px;background:#c1cbbb;flex:1;border-radius:4px}#pack-tiers .filled{background:#48977f}#craft-pack,#pickup-bench{width:100%;min-height:46px;border:1px solid #6c8c78;border-radius:11px;background:#285d4e;color:#fff2c8;font-size:15px;font-weight:bold;padding:10px}#pickup-bench{margin-top:10px;background:transparent;color:#345c4d;font-size:13px}#pickup-bench[hidden]{display:none}#workshop-dialog button:disabled{opacity:.5;cursor:default}#workshop-stock{text-align:center;color:#567263}.photographing #craft-toggle{display:none}
@media(max-width:600px){#craft-toggle{right:16px;bottom:calc(182px + env(safe-area-inset-bottom));min-width:52px;width:52px;height:52px;min-height:52px;display:flex;flex-direction:column;gap:1px;font-size:10px;padding:5px}#craft-toggle svg{width:24px;height:24px}#workshop-dialog{padding:20px 16px 12px}#workshop-dialog h2{font-size:21px}}
@media(pointer:coarse) and (min-width:601px){#craft-toggle{right:16px;bottom:calc(182px + env(safe-area-inset-bottom));min-height:48px}}
@media(max-height:490px){#craft-toggle{bottom:110px;right:87px}#workshop-art{display:none}}

/* Horizontal (landscape) mode: inventory on the left, fabricar + home on the right. */
#landscape-bar{display:none}
body.landscape-bar #landscape-bar{display:flex;position:fixed;left:0;right:0;bottom:calc(12px + env(safe-area-inset-bottom));align-items:center;justify-content:space-between;gap:8px;padding:0 14px;z-index:5;pointer-events:none}
body.landscape-bar #landscape-bar #inventory{position:static;transform:none;left:auto;bottom:auto;margin:0;width:auto;max-width:calc(100vw - 300px);pointer-events:auto}
body.landscape-bar #landscape-bar .right-actions{display:flex;align-items:center;gap:8px;pointer-events:auto}
body.landscape-bar #landscape-bar #craft-toggle{position:static;right:auto;bottom:auto;min-height:52px;min-width:64px;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:6px;font-size:14px;padding:2px 10px;margin:0}
body.landscape-bar #landscape-bar #craft-toggle svg{width:22px;height:22px}
body.landscape-bar #landscape-bar #home{position:static;width:52px;height:52px;border-radius:15px;flex:0 0 52px;margin:0}
@media(orientation:portrait){body.landscape-bar #landscape-bar{display:none}}

/* Full-screen PWA: cover status/navigation bars and notch/cutout areas. */
html,body{height:100%;height:100dvh;min-height:100dvh;position:fixed;inset:0;width:100%}
@media(display-mode:fullscreen),(display-mode:standalone),screen and (min-width:0px){main.photographing #photo-tools,#photo-tools.touch-buttons{margin:0}}
#craft-sky{position:fixed!important}
body{background:#8dd4e8}
