:root{--bg: #06060a;--panel: #14161f;--text: #d7dae3;--muted: #767c8f;--hud-height: 52px;--log-height: 52px;--pad-height: 180px;--overlay-clear-top: calc(env(safe-area-inset-top) + var(--hud-height))}*{box-sizing:border-box}html,body{margin:0;height:100%;height:100dvh;overflow:hidden;background:var(--bg);color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;touch-action:none;overscroll-behavior:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}#app{display:flex;flex-direction:column;height:100%;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}#hud{height:var(--hud-height);flex:0 0 auto;display:flex;align-items:center;gap:1em;padding:0 .6em;font-size:16px;background:var(--panel);white-space:nowrap;overflow:hidden}#hud .stat{display:flex;align-items:baseline;gap:.3em;flex:0 1 auto;min-width:0}#hud .stat[hidden]{display:none}#hud .stat.hp-stat{flex-direction:column;align-items:flex-start;gap:2px;min-width:0}#hud .stat.hp-stat .hp-stat-row{display:flex;align-items:baseline;gap:.3em}#hud .hp-bar{display:block;height:5px;max-width:100%;background:#3a3f4b;border-radius:1px;overflow:hidden}#hud .hp-bar-fill{display:block;height:100%;width:0;max-width:100%;background:#4caf50}#hud .label{color:var(--muted);font-size:12px}#hud.is-starving .label{color:#f4d03f;text-shadow:-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000}#hud .value{font-variant-numeric:tabular-nums}.value.warn{color:#e0b341}.value.danger{color:#e05c4a}#hud .spacer{flex:1 1 auto;min-width:0}#hud-seed{display:none}#stage{flex:1 1 auto;display:flex;align-items:center;justify-content:center;min-height:0}canvas{display:block;touch-action:none}#screen{image-rendering:auto}#log{position:relative;height:var(--log-height);flex:0 0 auto;display:flex;flex-direction:row;align-items:stretch;margin:0 .4em .3em;padding:6px .7em;font-size:14px;line-height:1.35;background:var(--panel);border:1px solid #3a3f4b;border-radius:3px;overflow:hidden;cursor:pointer}#log-lines{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;justify-content:flex-end;gap:2px;padding-right:1.1em}#log-affordance{flex:0 0 auto;align-self:center;color:var(--muted);font-size:12px;line-height:1;opacity:.65;pointer-events:none;user-select:none}#log .line{color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#log .line:last-child{color:var(--text)}#log .line.bad:last-child{color:#e05c4a}#log .line.good:last-child{color:#6fbf73}#controls{height:var(--pad-height);flex:0 0 auto;display:none;align-items:center;justify-content:space-around;gap:12px;padding:8px 16px;background:var(--panel)}body.touch #controls{display:flex}#dpad{display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);gap:4px;width:min(46vw,168px);aspect-ratio:1;touch-action:none}#dpad div{display:flex;align-items:center;justify-content:center;border-radius:6px;background:#1e2230;color:var(--muted);font-size:15px;pointer-events:none}#dpad div.center{background:#171b26;font-size:11px}#dpad div.center.facing{background:#2a3450;color:var(--text);font-size:15px}#dpad div.active{background:#33405c;color:var(--text)}#actions{display:flex;flex-direction:column;gap:10px}#actions button{min-width:88px;min-height:44px;padding:14px 12px;border:none;border-radius:8px;background:#1e2230;color:var(--text);font-family:inherit;font-size:13px;touch-action:none}#actions button:active,#actions button.active{background:#33405c}#inventory{position:fixed;inset:0;z-index:10;display:flex;align-items:flex-end;justify-content:center;background:linear-gradient(to bottom,transparent 0,transparent var(--overlay-clear-top),rgba(4,4,8,.72) var(--overlay-clear-top));padding:var(--overlay-clear-top) 0 env(safe-area-inset-bottom)}#inventory[hidden]{display:none}#inventory .sheet{position:relative;display:flex;flex-direction:column;width:min(100%,460px);max-height:100%;gap:8px;padding:12px 14px calc(12px + env(safe-area-inset-bottom));background:var(--panel);border-top:1px solid #2a2f3f;border-radius:12px 12px 0 0}.inv-body{position:relative;display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0}.inv-title{color:var(--muted);font-size:12px}.sheet-head{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:8px}.sheet-close{width:44px;height:44px;margin:-8px -8px -8px 0;border:none;background:transparent;color:var(--muted);font-family:inherit;font-size:20px;line-height:1}.sheet-close:active{color:var(--text)}.sheet-action{margin-left:auto;min-height:44px;padding:0 10px;border:1px solid #2a2f3f;border-radius:6px;background:transparent;color:var(--muted);font-family:inherit;font-size:12px;white-space:nowrap}.sheet-action:active{background:#33405c;color:var(--text)}#inv-list{flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y}.inv-row{display:flex;align-items:center;gap:.7em;min-height:40px;padding:0 10px;border-radius:6px;font-size:14px}.inv-row.selected{background:#33405c}.inv-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.inv-empty{padding:14px 10px;color:var(--muted);font-size:13px}#inv-actions{position:absolute;left:0;right:0;bottom:0;z-index:2;display:flex;gap:8px;box-sizing:border-box;max-width:100%;padding:8px;border:1px solid #2a2f3f;border-radius:8px;background:var(--panel);box-shadow:0 -6px 20px #00000073}#inv-actions[hidden]{display:none}.inv-action{flex:1 1 0;min-width:0;min-height:44px;border:none;border-radius:8px;background:#1e2230;color:var(--text);font-family:inherit;font-size:14px}.inv-action:active,.inv-action.selected{background:#33405c}#inv-detail{flex:0 0 auto;height:92px;overflow-y:auto;padding:8px 10px;border-radius:6px;background:#1a1e2a;font-size:12px;line-height:1.5}#inv-detail[hidden]{display:none}.inv-detail-stats{color:#f5d76e;font-size:13px}.inv-detail-note{color:var(--muted);font-size:11px}#inv-actions.slots{flex-direction:column;max-height:min(45vh,280px);overflow-y:auto;-webkit-overflow-scrolling:touch}.inv-slot{display:grid;grid-template-columns:4.5em auto 1fr;align-items:center;gap:0 10px;min-height:44px;padding:6px 12px;border:none;border-radius:8px;background:#1e2230;color:var(--text);font-family:inherit;font-size:14px;text-align:left}.inv-slot:active,.inv-slot.selected{background:#33405c}.inv-slot.cancel{grid-template-columns:1fr;text-align:center}.inv-slot-value{color:#f5d76e;font-size:13px}.inv-slot-effect{color:#7fb069;font-size:12px}.inv-slot-current{grid-column:1 / -1;overflow:hidden;color:var(--muted);font-size:11px;white-space:nowrap;text-overflow:ellipsis}.inv-hint{flex:0 0 auto;color:var(--muted);font-size:11px}body.touch .inv-hint{display:none}.popup{position:fixed;inset:0;z-index:11;display:flex;align-items:flex-start;justify-content:flex-start;padding:calc(var(--overlay-clear-top) + 12px) 0 0 14px;background:linear-gradient(to bottom,transparent 0,transparent var(--overlay-clear-top),rgba(4,4,8,.35) var(--overlay-clear-top))}.popup[hidden]{display:none}.popup .sheet{display:flex;flex-direction:column;max-width:min(92vw,340px);gap:4px;padding:8px;background:var(--panel);border:1px solid #2a2f3f;border-radius:8px}#floor-title{position:fixed;inset:0;z-index:90;display:flex;align-items:center;justify-content:center;background:#000;color:#fff;font-size:40px;letter-spacing:.2em;transition:opacity .4s linear}#floor-title[hidden]{display:none}#floor-title[data-phase=out]{opacity:0}#game-result{position:fixed;inset:0;z-index:92;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:16px;background:#000000e0;color:#fff;text-align:center;animation:game-result-in .6s ease-out}#game-result[hidden]{display:none}#game-result-title{font-size:32px;letter-spacing:.3em;color:#c9463d}#game-result.game-result-cleared #game-result-title{color:#d4af37}#game-result-cause{font-size:22px;line-height:1.5}#game-result-rows{white-space:pre-line;font-size:16px;line-height:1.9;color:#cfd3dc;max-height:60vh;overflow-y:auto}#game-result.game-result-list #game-result-rows{display:grid;grid-template-columns:repeat(5,auto) 1fr;column-gap:1em;white-space:nowrap;padding-right:12px;max-width:100%;box-sizing:border-box;overflow-x:auto}#game-result-rows .rank-cell{text-align:right}#game-result-rows .rank-cause{text-align:left}#game-result.game-result-deaths #game-result-rows{grid-template-columns:auto 1fr}#game-result.game-result-deaths #game-result-rows .rank-cause{grid-column:auto;padding-left:0;margin-bottom:0}@media(max-width:600px){#game-result.game-result-list #game-result-rows{font-size:14px;column-gap:.6em}#game-result-rows .rank-cause{grid-column:1 / -1;padding-left:2em;margin-bottom:.4em;line-height:1.4}}#game-result-hint{font-size:13px;color:#8a90a0}@keyframes game-result-in{0%{opacity:0}to{opacity:1}}#storm-title{position:fixed;inset:0;z-index:91;display:flex;align-items:center;justify-content:center;background:#0000008c;color:#fff;font-size:40px;letter-spacing:.2em;overflow:hidden;transition:opacity .4s linear}#storm-title[hidden]{display:none}#storm-title[data-phase=out]{opacity:0}#storm-title-text{position:relative;z-index:2}#storm-wind,#storm-gel{position:absolute;inset:0;pointer-events:none}#storm-wind:before,#storm-wind:after{content:"";position:absolute;inset:-20% 0;background:repeating-linear-gradient(90deg,transparent 0,transparent 48px,rgba(220,230,240,.18) 48px,rgba(220,230,240,.18) 52px);animation:storm-wind 2.4s linear infinite}#storm-wind:after{opacity:.5;animation-duration:1.6s;animation-direction:reverse}#storm-title[data-stage="2"] #storm-wind:before,#storm-title[data-stage="2"] #storm-wind:after{background:repeating-linear-gradient(90deg,transparent 0,transparent 22px,rgba(220,230,240,.28) 22px,rgba(220,230,240,.28) 28px);animation-duration:.9s}#storm-title[data-stage="2"] #storm-wind:after{animation-duration:.6s}#storm-gel{display:none;background:#050508;transform-origin:bottom;transform:scaleY(0)}#storm-title[data-stage="3"] #storm-gel{display:block;animation:storm-gel 1.2s linear forwards}@keyframes storm-wind{0%{transform:translate(-80px)}to{transform:translate(80px)}}@keyframes storm-gel{0%{transform:scaleY(0)}to{transform:scaleY(1)}}#scenario{z-index:100;align-items:flex-end;justify-content:center;padding:0;background:transparent}#scenario-blackout{position:absolute;z-index:2;inset:0;background:#000;opacity:1}#scenario-loading{position:absolute;z-index:3;inset:0;display:flex;align-items:center;justify-content:center;color:#9aa;font-size:14px;letter-spacing:.2em}#scenario-loading[hidden]{display:none}#scenario-background,#scenario-characters{position:absolute;inset:0}#scenario-background{z-index:0}#scenario-background-image,#scenario-background-fallback{width:100%;height:100%}#scenario-background-image{object-fit:cover}#scenario-characters{z-index:1;pointer-events:none}.scenario-character{position:absolute;bottom:0;width:40%;height:70%;transform:translate(-50%)}#scenario-character-left{left:20%}#scenario-character-center{left:50%}#scenario-character-right{left:80%}.scenario-character img,.scenario-character .scenario-image-fallback{width:100%;height:100%}.scenario-character img{object-fit:contain}.scenario-image-fallback{display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:12px;border:1px solid #3a3f4b;background:#20242d;color:#c7ccd8;text-align:center;overflow-wrap:anywhere}.scenario-image-fallback[hidden]{display:none}#scenario-dialog.sheet{position:relative;z-index:3;width:min(calc(100% - 28px),720px);max-width:min(calc(100% - 28px),720px);min-height:112px;margin:0 14px max(14px,env(safe-area-inset-bottom));padding:12px 14px}#scenario-dialog[hidden]{display:none}#scenario-speaker{color:var(--muted);font-size:12px}#scenario-text{color:var(--text);font-size:16px;line-height:1.6;white-space:pre-wrap}.popup-title{padding:0 6px 2px;color:var(--muted);font-size:11px}#shop-dialog-title{color:var(--text);font-size:14px;line-height:1.45;white-space:normal;max-width:min(92vw,360px);padding:4px 6px 6px}#shop-dialog .sheet{max-width:min(92vw,360px)}.option-row{min-width:120px;min-height:40px;padding:0 12px;border:none;border-radius:6px;background:transparent;color:var(--text);font-family:inherit;font-size:14px;text-align:left}.option-row:active,.option-row.selected{background:#33405c}.option-row-text{display:grid;grid-template-columns:minmax(4.5em,auto) 1fr;align-items:baseline;gap:8px 12px;cursor:default;pointer-events:none}.option-key{font-weight:700;color:#f0c674;white-space:nowrap}.option-desc{color:var(--muted, #a0a6b5);text-align:left}.option-row-toggle{display:flex;align-items:center;gap:10px;width:100%}.option-toggle-label{flex:1 1 auto;text-align:left;min-width:0}.option-switch{position:relative;flex:0 0 auto;width:36px;height:20px;border-radius:10px;background:#767c8f}.option-switch-knob{position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#1a1e28;transition:left .12s ease}.option-row-toggle.is-on .option-switch{background:#f0c674}.option-row-toggle.is-on .option-switch-knob{left:18px}.option-row-toggle.is-off .option-switch{background:#767c8f}.option-row-toggle.is-off .option-switch-knob{left:2px}.option-toggle-word{flex:0 0 auto;min-width:2.2em;font-weight:700;font-size:12px;letter-spacing:.04em}.option-row-toggle.is-on .option-toggle-word{color:#f0c674}.option-row-toggle.is-off .option-toggle-word{color:#767c8f}.option-row-level{display:flex;align-items:center;gap:10px;width:100%}.option-level-word{flex:0 0 auto;min-width:2.2em;font-weight:700;color:#f0c674}.menu-body{display:grid;grid-template-columns:86px 1fr;gap:8px;align-items:start;width:100%;min-width:0}.menu-body:has(#menu-stats[hidden]):has(#menu-equip[hidden]){grid-template-columns:1fr}#menu-list{display:grid;grid-template-columns:1fr;gap:4px;width:100%;min-width:0}#menu-list .option-row{min-width:0;padding:0 4px;text-align:center;white-space:normal;font-size:13px;line-height:1.3}#menu-list .option-row-toggle,#menu-list .option-row-level{text-align:left;min-width:0;padding:0 8px}#menu-list .option-row-text{text-align:left;padding:4px 8px;min-height:0}#menu[data-screen=restart-confirm] .option-row-text{display:block;padding:8px;line-height:1.6}#menu[data-screen=restart-confirm] .option-key{display:none}#menu[data-screen=restart-confirm] .option-desc{color:var(--text)}#menu[data-screen=credits] .option-row-text{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:10px 8px;line-height:1.6}#menu[data-screen=credits] .option-key{color:var(--text);white-space:normal;font-size:12px}#menu[data-screen=credits] .option-desc{width:100%}#menu-side{min-width:0;width:100%}.menu-footer{display:flex;justify-content:flex-end;align-items:center;gap:8px;flex-wrap:wrap}#release-notes-open{min-width:0;min-height:0;padding:0;border:0;background:transparent;color:var(--muted);font-family:inherit;font-size:11px;line-height:1.4;cursor:pointer;text-underline-offset:3px}@media(hover:hover){#release-notes-open:hover{text-decoration:underline}}#release-notes-open:active,#release-notes-open:focus-visible{text-decoration:underline}#release-notes-open:focus-visible{outline:1px solid var(--muted);outline-offset:3px}#first-controls-guide{color:var(--text);background:var(--panel);border:1px solid #52627e;border-radius:12px;width:min(520px,calc(100vw - 24px));max-height:calc(100dvh - 24px);box-sizing:border-box;padding:20px}#first-controls-guide[open]{display:flex;flex-direction:column;gap:12px}#first-controls-guide::backdrop{background:#000b}#first-controls-guide h2{margin:0;font-size:20px}#first-controls-body{overflow-y:auto;min-height:0;line-height:1.7;touch-action:pan-y}#first-controls-body p{margin:0 0 10px}#first-controls-close{flex-shrink:0;min-height:48px;color:var(--text);background:#26354d;border:1px solid #7290b8;border-radius:8px;font:inherit;touch-action:manipulation}.first-controls-hint{margin:0;font-size:12px}#release-notes{color:var(--text);background:var(--panel);border:1px solid #2a2f3f;border-radius:8px;width:min(560px,calc(100vw - 32px));padding:8px;box-sizing:border-box;margin:calc(var(--overlay-clear-top) + 12px) auto 0;max-height:calc(100dvh - var(--overlay-clear-top) - 24px - env(safe-area-inset-bottom))}#release-notes[open]{display:flex;flex-direction:column}#release-notes::backdrop{background:linear-gradient(to bottom,transparent 0,transparent var(--overlay-clear-top),rgba(4,4,8,.35) var(--overlay-clear-top))}#release-notes h2{margin:0;font-size:14px}#release-notes-body{overflow-y:auto;min-height:0;overflow-wrap:anywhere;touch-action:pan-y;overscroll-behavior:contain}#release-notes-body article{padding:12px 4px}#release-notes-body article+article{border-top:1px solid #2a2f3f}#release-notes-body h3{margin:0 0 8px;font-size:14px}#release-notes-body ul{margin:0;padding-left:1.25em;line-height:1.7}#release-notes-body li+li{margin-top:4px}.release-notes-hint{flex-shrink:0;font-size:12px}#release-touch-controls{display:none}body.touch #release-notes{width:100%;max-width:100%;height:calc(100dvh - var(--overlay-clear-top));max-height:calc(100dvh - var(--overlay-clear-top));margin:var(--overlay-clear-top) 0 0;padding:8px 8px env(safe-area-inset-bottom)}body.touch #release-notes-body{flex:1}body.touch #release-touch-controls{display:grid;grid-template-columns:minmax(44px,1fr) 198px minmax(44px,1fr);align-items:center;gap:var(--control-gap);flex:0 0 216px;margin-left:calc(max(var(--control-edge),env(safe-area-inset-left)) - 9px);margin-right:calc(max(var(--control-edge),env(safe-area-inset-right)) - 9px)}#release-touch-controls button{min-height:44px;border:1px solid #52627e;border-radius:8px;color:var(--text);background:#202a3c;font:inherit;padding:4px 0;touch-action:manipulation}#release-touch-controls .release-scroll{grid-column:2;display:grid;grid-template-rows:repeat(3,1fr);height:198px;gap:4px}#release-touch-controls .release-scroll button{font-size:24px}#menu-version{align-self:center;flex-shrink:0;font-size:11px;line-height:1.4;color:var(--muted)}.equip-panel{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:2px 6px;margin-top:0;padding-top:0;border-top:none;font-size:12px;width:100%;min-width:0}.equip-panel[hidden]{display:none}.equip-slot{color:var(--muted)}.equip-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.equip-value{color:#f5d76e}#menu-stats{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;margin-top:6px;padding-top:6px;border-top:1px solid #2a2f3f;font-size:14px;width:100%;min-width:0}#menu-stats[hidden]{display:none}#menu-stats .status-row{display:contents}#menu-stats .status-label{color:var(--muted)}#menu-stats .status-value{text-align:right;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}#menu:not([hidden])~#controls:not([data-mode=popup]){visibility:hidden;pointer-events:none}#menu .sheet{max-height:min(78vh,520px);overflow-y:auto;-webkit-overflow-scrolling:touch;width:min(100%,340px);max-width:min(100%,340px);box-sizing:border-box}#map{padding-right:14px}#map .sheet{width:min(100%,720px);max-width:min(100%,720px);max-height:82vh}#map-canvas-box{display:flex;align-items:center;justify-content:center;width:100%;height:min(64vh,520px);max-height:min(64vh,520px)}#map-canvas{image-rendering:pixelated}#map-legend{display:flex;flex-wrap:wrap;gap:4px 14px;justify-content:center;margin-top:8px;color:var(--muted);font-size:11px}#map-legend span:before{content:"\25a0";margin-right:4px}#map-legend span.round:before{content:"\25cf"}#cell-pick-grid{display:grid;grid-template-columns:repeat(7,36px);gap:2px;align-self:center}.cell-pick-cell{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid transparent;border-radius:4px;background:#262b3a}.cell-pick-cell.is-wall{background:#555b6e}.cell-pick-cell.is-unknown{background:#0b0c12;box-shadow:inset 0 0 0 1px #2a2f3f}.cell-pick-cell.is-self{background:#262b3a}.cell-pick-cell.selected{border-color:#f0c674}.cell-pick-dot{width:12px;height:12px;border-radius:50%}.cell-pick-dot.is-enemy{background:#e05a5a}.cell-pick-dot.is-ally{background:#f6e05a}.cell-pick-dot.is-self{background:#fff}#status .sheet{max-width:min(92vw,380px);max-height:80vh;overflow-y:auto}#log-history{padding-right:14px}#log-history .sheet{width:min(100%,720px);max-width:min(100%,720px);max-height:80vh;overflow:hidden}#log-history-list{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;overflow-y:auto;gap:2px;padding:0 6px 8px;font-size:14px;line-height:1.4}#log-history-list .log-history-line{color:var(--text);white-space:pre-wrap;word-break:break-word}#log-history-list .log-history-sep{color:var(--muted);text-align:center;margin:6px 0 2px;font-size:12px}#status-list{display:grid;grid-template-columns:auto 1fr;gap:3px 16px;min-width:200px;padding:0 6px;font-size:16px}.status-row{display:contents}.status-row .status-label{color:var(--muted)}.status-row.equip .status-value{color:#f5d76e}.status-head{grid-column:1 / -1;margin-top:6px;padding-bottom:2px;border-bottom:1px solid #2a2f3f;color:var(--muted);font-size:11px}#status-list>.status-head:first-child{margin-top:0}.status-effect{grid-column:1 / -1;color:#7fb069;font-size:12px;line-height:1.5}.status-effect.none{color:var(--muted)}.status-note{display:block;color:var(--muted);font-size:11px}.status-row.ailment .status-value{color:#e74c3c}.status-row.ailment.good .status-value{color:#7fb069}#inv-list,#inv-detail,#inv-actions,#menu .sheet,#status .sheet,#log-history-list,#game-result-rows,#release-notes-body{scrollbar-width:thin;scrollbar-color:var(--muted) var(--panel)}#inv-list::-webkit-scrollbar,#inv-detail::-webkit-scrollbar,#inv-actions::-webkit-scrollbar,#menu .sheet::-webkit-scrollbar,#status .sheet::-webkit-scrollbar,#log-history-list::-webkit-scrollbar,#game-result-rows::-webkit-scrollbar,#release-notes-body::-webkit-scrollbar{width:6px;height:6px}#inv-list::-webkit-scrollbar-track,#inv-detail::-webkit-scrollbar-track,#inv-actions::-webkit-scrollbar-track,#menu .sheet::-webkit-scrollbar-track,#status .sheet::-webkit-scrollbar-track,#log-history-list::-webkit-scrollbar-track,#game-result-rows::-webkit-scrollbar-track,#release-notes-body::-webkit-scrollbar-track{background:var(--panel)}#inv-list::-webkit-scrollbar-thumb,#inv-detail::-webkit-scrollbar-thumb,#inv-actions::-webkit-scrollbar-thumb,#menu .sheet::-webkit-scrollbar-thumb,#status .sheet::-webkit-scrollbar-thumb,#log-history-list::-webkit-scrollbar-thumb,#game-result-rows::-webkit-scrollbar-thumb,#release-notes-body::-webkit-scrollbar-thumb{background:var(--muted);border-radius:3px}body.touch{--pad-height: 216px;--control-edge: 24px;--control-gap: 6px}@media(max-width:349px){body.touch{--control-edge: 16px;--control-gap: 1px}}body.touch #controls{display:grid;grid-template-columns:minmax(44px,1fr) 198px minmax(44px,1fr);padding:9px max(var(--control-edge),env(safe-area-inset-right)) 9px max(var(--control-edge),env(safe-area-inset-left));gap:var(--control-gap)}body.touch #dpad{width:198px;height:198px;gap:4px;grid-column:2;grid-row:1}body.touch #dpad div{border-radius:8px}body.touch #dpad div.center{color:#fff4e9;background:#573425;border:1px solid #bd8b68;font-size:16px;font-weight:700}body.touch #dpad div.center.facing{background:#304d68}body.touch #turn-controls{grid-column:1;grid-row:1;display:flex;flex-direction:column;gap:10px;align-self:start}body.touch #actions{grid-column:3;grid-row:1;width:auto;gap:10px;align-self:start}body.touch #turn-controls button,body.touch #actions button{min-width:44px;width:100%;min-height:44px;padding:4px 0;font-size:13px;color:var(--text);border:1px solid #52627e;border-radius:8px;background:#202a3c}body.touch #btn-menu{font-size:11px}@media(max-width:480px){body.touch #hud{font-size:12px;gap:.5em}}#popup-controls{display:none}#popup-controls[hidden]{display:none!important}body.touch #controls[data-mode=popup]{visibility:visible;pointer-events:auto;position:relative;z-index:12}body.touch #controls[data-mode=popup]>:not(#popup-controls){display:none}body.touch #controls[data-mode=popup] #popup-controls{display:grid;grid-template-columns:minmax(44px,1fr) 198px minmax(44px,1fr);grid-column:1 / -1;gap:var(--control-gap);width:100%;height:198px;align-items:center}#popup-controls .popup-back{grid-column:1}#popup-controls .popup-pad{grid-column:2;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);gap:4px;width:198px;height:198px}#popup-controls button{min-height:44px;border:1px solid #52627e;border-radius:8px;background:#202a3c;color:var(--text);font:inherit;touch-action:manipulation}#popup-controls .popup-pad button{padding:0;font-size:24px}#popup-controls .popup-confirm{font-size:14px!important;font-weight:700;color:#fff4e9;background:#573425;border-color:#bd8b68}#popup-controls .popup-pad span{display:grid;place-items:center;border:1px solid #303847;border-radius:8px;font-size:24px;opacity:.28}#popup-controls button:disabled{opacity:.28}#popup-controls .popup-back{font-size:13px;padding:4px 0;align-self:start}#release-notes-back{align-self:start;margin-top:9px}body.touch #stairs,body.touch #menu,body.touch #status,body.touch #map,body.touch #log-history,body.touch #shop-dialog,body.touch #cell-pick,body.touch #inventory{bottom:calc(var(--pad-height) + env(safe-area-inset-bottom));align-items:flex-start;justify-content:flex-start;padding:calc(var(--overlay-clear-top) + 8px) 8px 8px}body.touch :is(#stairs,#menu,#status,#map,#log-history,#shop-dialog,#cell-pick) .sheet,body.touch #inventory .sheet{width:100%;max-width:100%;min-height:0;max-height:calc(100dvh - var(--overlay-clear-top) - var(--pad-height) - env(safe-area-inset-bottom) - 16px);overflow-y:auto;touch-action:pan-y}body.touch #inventory .sheet{height:100%;padding:8px;border-radius:10px;gap:4px}body.touch #inventory .inv-body{display:grid;grid-template-rows:minmax(0,1fr) 64px;gap:4px;overflow:hidden}body.touch #inventory #inv-list{min-height:0;grid-row:1;overflow-y:auto}body.touch #inventory #inv-detail{grid-row:2;height:64px;min-height:0;overflow-y:auto;touch-action:pan-y;padding:4px 6px}body.touch #inventory #inv-hint{display:none}body.touch #inventory #inv-actions{position:static;grid-row:1;min-height:0;max-height:100%;overflow-y:auto;display:flex;flex-direction:column;padding:0;gap:4px;box-shadow:none;border:0}body.touch #inventory #inv-actions[hidden]{display:none}body.touch #inventory:not([data-phase=list]):not([data-phase=description]) #inv-list{display:none}body.touch #inventory .inv-action,body.touch #inventory .inv-slot{flex:0 0 auto;min-height:44px}@media(max-height:520px){body.touch #inventory .sheet-head{gap:4px}body.touch #inventory .sheet-action,body.touch #inventory .sheet-close{min-height:28px;padding:2px 6px}body.touch #inventory .inv-body{grid-template-rows:minmax(0,1fr) 44px}body.touch #inventory #inv-detail{height:44px}}
