:root{color-scheme:light;--cream:#fff6da;--hud:#30362de6;--gold:#f6c471;--ink:#342c23;--edge:#ffedbb85;font-family:"DM Sans","PingFang SC","Microsoft YaHei",system-ui,sans-serif}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;background:#4e402d;overscroll-behavior:none}
body{overflow:hidden}button{font:inherit;cursor:pointer;color:inherit;-webkit-tap-highlight-color:transparent}
button:focus-visible{outline:3px solid #ffcf78;outline-offset:3px}button:disabled{opacity:.55;cursor:default}
[hidden]{display:none!important}.symbols{position:absolute;width:0;height:0;overflow:hidden;pointer-events:none}
.icon{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.stage{position:relative;width:100%;height:100%;height:100dvh;overflow:hidden;isolation:isolate;outline:0;user-select:none;-webkit-user-select:none;--side:clamp(12px,2vw,30px);--top:clamp(10px,2vh,22px);--base:clamp(14px,3vh,32px)}
#world{position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;will-change:transform}
.room{display:block;width:100%;height:100%;pointer-events:none}
#scene{display:block;position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.hud,.controls{position:absolute;left:max(var(--side),env(safe-area-inset-left));right:max(var(--side),env(safe-area-inset-right));display:flex;justify-content:space-between;pointer-events:none}
.hud{top:max(var(--top),env(safe-area-inset-top));align-items:flex-start}
.controls{bottom:max(var(--base),calc(env(safe-area-inset-bottom) + 6px));align-items:flex-end}
.hud button,.controls button{pointer-events:auto}
.objective,.pause,.dpad,.actions .round{color:var(--cream);background:var(--hud);border:1.5px solid var(--edge);box-shadow:0 2px 0 #37291670,0 3px 12px #35221228}
.objective{display:flex;align-items:center;gap:7px;padding:7px 12px 7px 9px;border-radius:22px;font-size:13px;font-weight:650;letter-spacing:.035em}
.objective .icon{width:18px;height:18px;color:var(--gold)}
#arrival{position:absolute;top:calc(100% + 6px);left:0;display:flex;align-items:center;gap:12px;padding:5px 11px;border-radius:9px;border:1px solid var(--edge);background:var(--hud);color:var(--cream);font-size:12px;font-weight:600;line-height:1.3}
#arrival b{font-size:17px;font-variant-numeric:tabular-nums;color:var(--gold)}
#arrival.urgent{background:#713f31;color:#fff6e6;border-color:#edc19f}
#arrival.urgent b{color:#ffdfab}
.round,.small{display:inline-grid;place-content:center;justify-items:center;border-radius:50%;padding:0}
.pause{width:44px;height:44px}.pause .icon{width:18px;height:18px}
.dpad,.actions{display:flex;align-items:flex-end;gap:9px}
.dpad{gap:0;border-radius:24px;overflow:hidden;padding:2px}
.control{position:relative;display:flex;align-items:center;justify-content:center;gap:4px;border:0;touch-action:none;-webkit-touch-callout:none;user-select:none}
.dpad .control{border-radius:50%;width:49px;height:44px;color:var(--cream);background:transparent;flex-direction:column;gap:0}
.dpad .icon{width:20px;height:20px}.dpad .control+.control:before{content:"";position:absolute;left:0;top:24%;height:52%;width:1px;background:#dfd3a641}
.control kbd{font:600 9px/1 "IBM Plex Mono",ui-monospace,monospace;color:#ecddb8}
.actions .control{flex-direction:column;gap:1px;width:53px;height:53px;font-size:10px;font-weight:700;line-height:1.1}
.actions .control .icon{width:18px;height:18px}
.actions #jump{isolation:isolate;overflow:hidden;width:68px;height:68px;background:#f6c471;color:#462c1b;border:2px solid #fff1ba;box-shadow:0 3px 0 #854e30,0 4px 12px #39200f42}
#jump .icon{width:25px;height:25px}#jump kbd{color:#765435}#charge-fill{position:absolute;inset:0;z-index:-1;background:#ee9852;transform:scaleY(0);transform-origin:bottom}
.control.pressed,.control:active{filter:brightness(1.18);transform:translateY(1px)}.dpad .pressed{background:#fff2c82e}
.actions span{font-size:11px}.loading,.toast,noscript{position:absolute;left:50%;transform:translateX(-50%);background:var(--hud);color:var(--cream);border:1px solid var(--edge);border-radius:20px;padding:8px 13px;font-size:13px;max-width:85vw;text-align:center}
.loading,noscript{top:43%}.toast{bottom:calc(max(var(--base),env(safe-area-inset-bottom)) + 8px);margin:0;pointer-events:none}
dialog{color:var(--ink);background:#fff8e9;border:1.5px solid #756449;border-radius:14px;padding:20px;box-shadow:0 4px 0 #6347264d,0 12px 38px #46341d38}
h1,h2,p{margin:0}.result h2,dialog h1{font-family:"Songti SC","STSong",serif;font-weight:900;line-height:1.2;font-size:26px}
.primary,.secondary{border-radius:8px;min-height:44px;padding:8px 17px;font-weight:700;font-size:14px}
.primary{background:#50624a;color:var(--cream);border:1px solid #435540;display:inline-flex;gap:7px;align-items:center;justify-content:center}.primary .icon{width:16px;height:16px}.secondary,.small{background:transparent;border:1px solid #bbaf96}
dialog{width:min(365px,calc(100vw - 32px));max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 18px);overflow:auto}
dialog::backdrop{background:#302a2091}.dialog-head,.dialog-foot{display:flex;justify-content:space-between;gap:9px;align-items:center}.small{width:44px;height:44px}
#menu-content{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:18px 0}
#clue-open{grid-column:1/-1}
.item{min-height:50px;display:flex;align-items:center;justify-content:center;gap:6px;background:#f2ebd9;border:1px solid #c9bca2;border-radius:9px;font-size:14px}.item .icon{width:17px;height:17px}
.dialog-foot{margin-top:14px}.dialog-foot .primary{flex:1}dl{display:grid;grid-template-columns:auto 1fr;gap:12px;margin:18px 0}dt{font-size:14px;font-weight:750}dd{margin:0}
@media(pointer:coarse),(max-width:700px){.control kbd{display:none}.dpad .control{width:51px;height:50px}.actions .control{width:54px;height:54px}.actions #jump{width:68px;height:68px}.dpad .icon{width:23px;height:23px}.actions .icon{margin-bottom:2px}.toast{bottom:calc(max(var(--base),env(safe-area-inset-bottom)) + 82px);width:max-content}}
@media(max-height:430px){.stage{--base:7px;--top:6px}.dialog-head h1{font-size:22px}dialog{padding:13px}#menu-content{margin:9px 0}}
.stage.finished .controls,.stage.finished .objective{visibility:hidden}
#levels-content{display:grid;gap:8px;margin:16px 0}#levels-content .item{justify-content:flex-start;padding-left:14px}
#locked-note,#clue-content{color:#625f50;font-size:14px;line-height:1.6}
#clue-content p{margin:14px 0}
.objective{max-width:calc(100% - 52px);line-height:1.4;background:#394034ec}

dd{font-size:14px;line-height:1.65;color:#655844}
.result{margin:auto;width:min(345px,calc(100vw - 36px));padding:26px 22px 22px;text-align:center;border:1px solid #a99c81;border-radius:12px;background:#faf5e9}
.result[open]{animation:reveal .25s ease-out}
.result::backdrop{background:rgba(47,48,40,.48)}
.result-seal{width:42px;height:42px;margin:0 auto 12px;display:grid;place-items:center;border:2px solid #9c6146;border-radius:12px 10px 13px 9px;transform:rotate(-7deg);color:#9c6146}
.result-seal .icon{width:27px;height:27px}
.result h2{font-size:clamp(27px,5vw,33px);letter-spacing:.06em;color:#343c32}
.result p{margin:12px auto 20px;color:#665c4c;font-size:14px;line-height:1.65}
.result-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
.result-actions button{display:inline-flex;align-items:center;justify-content:center;gap:5px}
.result-actions .icon{width:15px;height:15px}
@keyframes reveal{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.result[open]{animation:none}}
