:root{color-scheme:dark;font-family:Georgia,'Hiragino Mincho ProN',serif;color:#e8dfc5;background:#10181c}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 55% 25%,#263432 0,transparent 65%),#10181c}main{max-width:1000px;margin:auto;padding:28px 38px}header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ffffff17;padding-bottom:22px}.brand{color:#e7d3a2;text-decoration:none;letter-spacing:3px;font-size:17px}.brand span{font-size:11px;letter-spacing:4px}.badge,.eyebrow,footer,small{font:10px monospace;letter-spacing:2px;color:#8eaaa1}.heading{display:flex;align-items:center;justify-content:space-between;padding:26px 0 20px}.eyebrow{color:#c3a76c;margin:0 0 8px}h1{font-weight:400;font-size:32px;margin:0;letter-spacing:5px}h1 span{font-size:12px;margin-left:20px;letter-spacing:2px;color:#9daaa3}button{color:#e5d7b8;background:#253532;border:1px solid #7c806344;border-radius:5px;padding:11px 16px;cursor:pointer;font:12px inherit;touch-action:none}button:hover{background:#3c5045}button:active{transform:translateY(1px)}button:focus-visible,canvas:focus-visible{outline:2px solid #dfb970}.game{border:1px solid #a48c514a;border-radius:7px;overflow:hidden;box-shadow:0 20px 65px #0008}.status{display:flex;justify-content:space-between;padding:13px 20px;background:#182421;font:12px monospace}.status>span:first-child{color:#f0c977;font-weight:bold}.status b{color:#db8d7a;font-size:15px;margin-left:12px}.viewport{position:relative;background:#0c1419}canvas{display:block;width:100%;image-rendering:pixelated;aspect-ratio:640/416;outline:none}.maplabel{position:absolute;left:18px;bottom:12px;color:#b9c7b6;font-size:11px;pointer-events:none}.maplabel small{margin-left:12px;font-size:8px}.message{min-height:44px;padding:13px 20px;font-size:12px;background:#1b2927;border-top:1px solid #a48c5133}.bottom{display:flex;justify-content:space-between;align-items:center;padding:20px 0}.help p{margin:0 0 8px;font-size:15px}.help span{font:11px/1.8 sans-serif;color:#a8b9b0}.help small{display:block;margin-top:10px;font-size:9px;letter-spacing:1px}.controls{display:grid;grid-template-columns:repeat(3,43px);gap:5px}.controls button{height:36px;padding:0;color:#d7bd82}.up{grid-column:2}.controls button:nth-child(2){grid-column:1}.down{grid-column:2}footer{border-top:1px solid #ffffff14;padding-top:18px;display:flex;justify-content:space-between;font-size:9px}footer span{letter-spacing:1px}@media(max-width:600px){main{padding:18px 12px}.brand{font-size:12px;letter-spacing:2px}.brand span{display:block;font-size:9px}.badge{font-size:7px;letter-spacing:0}.heading{padding:20px 2px}h1{font-size:25px}h1 span{display:block;font-size:10px;margin:7px 0 0}.status{padding:11px 9px;font-size:10px}.status b{font-size:11px;margin-left:4px}canvas{height:390px;object-fit:cover;aspect-ratio:auto}.bottom{gap:8px}.help span{font-size:10px}.controls{grid-template-columns:repeat(3,44px)}.controls button{height:40px}.message{font-size:11px;padding:12px}footer span{display:none}}
/* Art-direction pass: give the playable canvas room to breathe. */
main{max-width:1180px}.heading{padding:24px 0 20px}.game{border:1px solid #c5a76a70;box-shadow:0 25px 80px #0008,0 0 0 4px #0d171b}.viewport{background:#111e26}.mode-switch{display:flex;gap:8px}.mode-switch button{font-size:11px}.mode-switch button[aria-pressed=true]{color:#f3dca5;background:#455347;border-color:#b9a274}canvas{aspect-ratio:960/624}.message{color:#dfd4b9}.maplabel{background:#102125aa;padding:6px 9px;border-left:2px solid #c4a366}.controls button{min-height:42px}@media(max-width:600px){.heading{align-items:flex-start;gap:12px}.mode-switch{flex-direction:column;gap:5px}.mode-switch button{font-size:10px;padding:8px 11px}canvas{height:430px;aspect-ratio:auto}.brand{font-size:13px}.bottom{padding:22px 0}.game{box-shadow:0 18px 45px #0006}.status{font-size:10px}.status>span:first-child{font-size:9px}}
.controls .attack{grid-column:3;grid-row:3;background:#6a4d32;color:#ffe3a3;font-size:10px;border-color:#bc9855}.controls .attack:hover{background:#87613d}
@media(prefers-reduced-motion:reduce){button:active{transform:none}}
.status{align-items:center}.status #sound{font:10px monospace;padding:5px 9px;min-width:60px;background:#22352f;border-color:#b8a26b55}.status #sound[aria-pressed=true]{color:#ffe1a0;border-color:#c7a963}.status #sound:focus-visible{outline:2px solid #f2d28b}@media(max-width:600px){.status{gap:5px}.status #sound{font-size:9px;min-width:48px;padding:5px}.status #turn{font-size:9px}}
#map-panel{position:absolute;right:12px;top:12px;border:1px solid #b5aa7966;box-shadow:0 5px 15px #0005;pointer-events:none;width:154px;background:#0b1d23eb}#minimap{width:100%;height:auto;aspect-ratio:180/136;object-fit:contain;image-rendering:pixelated}#map-panel>span{display:block;font:8px sans-serif;letter-spacing:1px;padding:5px 6px;color:#d8c797}.aqua{color:#8fe2dd}.adventure-tools{display:flex;align-items:center;gap:14px;padding:15px 0 0}.adventure-tools>span{font:11px sans-serif;color:#a9bab0}.adventure-tools #map-toggle{margin-left:auto}.adventure-tools #potion{border-color:#829e77;color:#d4e9bf;background:#2d4032}.adventure-tools small{font:9px sans-serif;letter-spacing:0;color:#a9c6a3;margin-left:8px}.adventure-tools b{display:inline-block;margin:0 6px;color:#ffe2a1}button:disabled{opacity:.45;cursor:default}@media(max-width:600px){#map-panel{width:112px;right:8px;top:8px}#map-panel>span{font-size:6px;letter-spacing:0;padding:4px}.adventure-tools{gap:6px;flex-wrap:wrap}.adventure-tools>span{font-size:9px;order:3;width:100%}.adventure-tools button{padding:9px 12px}}
.objective{font:12px sans-serif;color:#ddc488;letter-spacing:1px;margin:0 0 14px;border-left:2px solid #bd9b61;padding:6px 12px}.run-result{position:absolute;inset:0;background:#0c1b23e8;z-index:3;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:25px;backdrop-filter:blur(3px)}.run-result[hidden]{display:none}.run-result h2{font:normal 32px Georgia,'Hiragino Mincho ProN',serif;color:#f2d491;letter-spacing:3px;margin:12px 0}.run-result>p:not(.eyebrow){font:12px/1.9 sans-serif;color:#bfcebf}.run-result #result-stats{border-top:1px solid #d4bb7955;padding-top:17px;color:#ffe6b4;margin:15px 0 25px}.run-result button{background:#5a664b;border-color:#b6ab78;padding:13px 24px}@media(max-width:600px){.objective{font-size:10px;letter-spacing:0}.run-result h2{font-size:23px}.run-result>p:not(.eyebrow){font-size:10px}.run-result{padding:16px}}
#gear-dialog{width:min(580px,calc(100% - 24px));max-height:90dvh;overflow:auto;background:linear-gradient(135deg,#25382f,#14272b);color:#e9e2c8;border:1px solid #c7aa6e;border-radius:10px;padding:25px;box-shadow:0 25px 100px #000b}#gear-dialog::backdrop{background:#06131bd4;backdrop-filter:blur(3px)}.gear-header{display:flex;align-items:center;justify-content:space-between}.gear-header h2{font-size:26px;font-weight:normal;letter-spacing:4px;margin:4px 0 0}#gear-totals{background:#0f2327;padding:13px;border-left:2px solid #d0b275;color:#eed39a;font:14px monospace}#gear-slots{display:grid;grid-template-columns:1fr 1fr;gap:12px}.gear-card,.gear-pickup{border:1px solid #9bac7c44;background:#122c2c80;border-radius:5px;text-align:center;padding:15px 10px}.gear-label{font:9px monospace;letter-spacing:2px;color:#98b1a3;margin:0 0 8px}.gear-name{font-size:17px;color:#f2dfaf;margin:7px 0}.gear-detail{font:11px sans-serif;color:#a5baa8}.gear-icon{display:block;width:72px;height:72px;background-image:url('assets/equipment-v1.webp');background-size:200% 200%;background-repeat:no-repeat;image-rendering:pixelated;margin:0 auto}.gear-icon.empty{background:none;border:1px dashed #75978a55;border-radius:50%}.gear-card button{font-size:10px;padding:8px 9px}.gear-pickup{margin-top:14px;border-color:#d8bb7755;background:#4e583a44}.gear-pickup>p:not(.gear-name):not(.gear-label){font:12px sans-serif}.gear-compare{color:#d4e3af}.gear-pickup button{background:#677046;color:#fff0c5;border-color:#bbaa73}.gear-rule,.gear-empty{font:11px/1.8 sans-serif;color:#b4c6b5}.gear-rule{margin-top:18px}#gear-feedback{font:11px/1.8 sans-serif;color:#e1c58a;min-height:20px;border-top:1px solid #9ba27433;padding-top:10px}.adventure-tools{flex-wrap:wrap}.adventure-tools #gear-open{border-color:#b79c68;color:#ead49d}@media(max-width:600px){#gear-dialog{padding:17px 13px}.gear-card{padding:12px 5px}.gear-card button{font-size:9px}.gear-name{font-size:15px}#gear-slots{gap:8px}.adventure-tools>span{width:100%}.gear-icon{width:64px;height:64px}}
#gear-dialog #gear-slots .gear-icon{width:52px;height:52px}.inventory-heading{font:12px sans-serif;color:#a8bfb0;margin:18px 0 9px}.inventory-row{display:grid;grid-template-columns:48px 1fr auto;align-items:center;gap:12px;border:1px solid #839b7a3d;background:#102b2c80;border-radius:5px;margin:7px 0;padding:9px 12px}.inventory-row.is-equipped{border-color:#d0b27599;background:#4c563b55}.inventory-row .gear-icon{width:46px;height:46px}.inventory-name{font-size:14px;color:#e8dbb6;margin:0}.inventory-row.is-equipped .inventory-name{color:#ffe1a0}.inventory-row .gear-detail{margin:5px 0 0;font-size:10px}.inventory-row button{padding:8px 13px;font-size:11px}#gear-totals{font-size:12px}@media(max-width:600px){.inventory-row{gap:8px;padding:8px}.inventory-name{font-size:12px}.inventory-row button{font-size:10px;padding:8px 11px}#gear-totals{font-size:10px}}
#gear-slots{display:block}.loadout-figure{position:relative;min-height:210px;background:radial-gradient(ellipse at 50% 65%,#8f9c633d,transparent 65%);border:1px solid #a7ac7544;border-radius:7px;margin:12px 0;display:grid;grid-template-columns:1fr 166px 1fr;align-items:center}.loadout-body{position:relative;width:166px;height:190px;grid-column:2;grid-row:1}.loadout-avatar{position:absolute;inset:0;background:url('assets/explorer-v1.webp') 0 0/200% 200% no-repeat;image-rendering:pixelated}.loadout-label{text-align:center;position:relative;z-index:2;grid-row:1;padding:9px 4px}.loadout-label.weapon{grid-column:1}.loadout-label.shield{grid-column:3}.loadout-label .gear-name{font-size:12px}.loadout-label .gear-icon{width:42px!important;height:42px!important}.equipped-tag{font:10px sans-serif;color:#f3d28b;border:1px solid #cdb77355;background:#b7a1581a;border-radius:20px;padding:4px 7px;display:inline-block;margin:3px 0}.loadout-body .loadout-held-weapon{position:absolute;width:62px!important;height:62px!important;left:90px;top:80px;z-index:2;transform:rotate(12deg)}.loadout-body .loadout-held-shield{position:absolute;width:50px!important;height:50px!important;left:11px;top:100px;z-index:3}@media(max-width:600px){.loadout-figure{grid-template-columns:1fr 136px 1fr;min-height:185px}.loadout-body{width:136px;height:166px}.loadout-label .gear-name{font-size:10px}.loadout-label .gear-label{font-size:9px;letter-spacing:0}.loadout-label .gear-icon{width:32px!important;height:32px!important}.equipped-tag{font-size:8px;padding:4px}.loadout-body .loadout-held-weapon{left:75px;top:70px;width:52px!important;height:52px!important}.loadout-body .loadout-held-shield{left:8px;top:87px;width:44px!important;height:44px!important}}
.loadout-body .loadout-held-weapon{left:116px;top:77px;transform:none;transform-origin:12.5% 90%}.loadout-body .loadout-grip{z-index:4;clip-path:polygon(67% 60%,85% 60%,85% 80%,67% 80%);pointer-events:none}@media(max-width:600px){.loadout-body .loadout-held-weapon{left:96px;top:69px;transform:none}}
.loadout-body .loadout-held-weapon{left:102px;top:79px}.loadout-body .loadout-grip{clip-path:polygon(59% 60%,76% 60%,76% 81%,59% 81%)}@media(max-width:600px){.loadout-body .loadout-held-weapon{left:84px;top:69px}}
.loadout-body .loadout-avatar.is-armed{background-image:url('assets/explorer-armed-v2.webp');background-size:112% auto;background-position:center bottom}
.loadout-body .loadout-avatar.is-armed{background-size:108% auto}
.loadout-body .loadout-avatar.with-shield{background-image:url('assets/explorer-shield-poses-v1.webp');background-size:200% 200%;transform:none}

.loadout-body .loadout-avatar.is-armed:not(.with-shield){transform:scaleX(-1)}

.loadout-body .loadout-avatar.combat-ready{background-size:400% 400%;transform:none}
.loadout-body .loadout-avatar.combat-ready:not(.with-shield){transform:none}

/* Inventory: readable hierarchy and touch targets. */
#gear-dialog{width:min(680px,calc(100% - 24px));font-family:'Hiragino Kaku Gothic ProN',sans-serif;padding:24px}
.gear-header{position:sticky;top:-24px;z-index:5;background:#20332f;padding:12px 0;border-bottom:1px solid #bcaa6b44}
.gear-header h2{font-size:23px;letter-spacing:2px}.gear-header button{min-height:44px}
#gear-totals{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:14px 8px;border:1px solid #9ca47744;border-radius:7px;text-align:center}
.stat-label{font-size:11px;color:#b5c5b8;margin:0 0 6px}.stat-value{font-size:19px;font-weight:600;margin:0;color:#f7e4b5}
.loadout-figure{margin:16px 0 22px}.loadout-label .gear-name{font-size:14px;line-height:1.6}.loadout-label .gear-label{font-size:11px;letter-spacing:1px}
.inventory-heading{font-size:16px;color:#f1dfb6;margin:20px 0 12px;font-weight:600}
.inventory-category{font-size:12px;letter-spacing:1px;color:#c3cdbd;margin:20px 0 8px;padding-bottom:8px;border-bottom:1px solid #a1b09044}
.inventory-row{grid-template-columns:58px minmax(0,1fr) auto;gap:14px;padding:14px 12px;margin:9px 0;background:#10272b;border-radius:8px}
.inventory-row.is-equipped{border-color:#d6b873;background:linear-gradient(100deg,#51563a88,#243c34)}
.inventory-row .gear-icon{width:56px;height:56px}.inventory-name{font:600 15px/1.5 sans-serif}.inventory-row .gear-detail{font:12px/1.5 sans-serif;color:#bfccbc;margin:4px 0}
.inventory-equipped,.inventory-compare{font:12px/1.5 sans-serif;margin:5px 0 0}.inventory-equipped{color:#ffe0a0}.is-better{color:#b8ebbd}.is-lower{color:#f0b3a4}.is-same{color:#a9bfb7}
.inventory-row button{min-height:44px;min-width:82px;font:13px sans-serif;padding:10px 12px;border-color:#bda56688;background:#3d5140}.inventory-row.is-equipped button{background:transparent;border-color:#a2b39a55;color:#cbd5c6}
.gear-rule,#gear-feedback{font-size:12px;line-height:1.8}.gear-empty{padding:8px 0}
@media(max-width:600px){#gear-dialog{padding:14px;max-height:92dvh}.gear-header{top:-14px}.gear-header h2{font-size:20px}.stat-value{font-size:16px}.stat-label{font-size:10px}#gear-totals{gap:3px;padding:12px 4px}.loadout-figure{grid-template-columns:1fr 120px 1fr;min-height:178px}.loadout-body{width:120px;height:152px}.loadout-label .gear-name{font-size:12px}.inventory-row{grid-template-columns:42px minmax(0,1fr) 72px;gap:8px;padding:12px 8px}.inventory-row .gear-icon{width:42px;height:42px}.inventory-name{font-size:14px}.inventory-row button{min-width:0;width:72px;font-size:12px;padding:10px 5px}.inventory-compare{font-size:11px}.gear-header .eyebrow{font-size:8px;letter-spacing:1px}}
.equipment-details{margin:20px 0 12px;border-top:1px solid #a1b09044;padding-top:8px}.equipment-details summary{cursor:pointer;padding:13px 0;font-size:13px;color:#d7c99f;min-height:44px}.potion-list-icon{display:block;width:56px;height:56px;background:url('assets/dungeon-props-v2.webp') 100% 100%/200% 200% no-repeat;image-rendering:pixelated}.inventory-row{margin:0;border-radius:0;border-bottom:0}.inventory-heading+.inventory-row{border-radius:8px 8px 0 0}.inventory-row:last-child{border-bottom:1px solid #839b7a3d;border-radius:0 0 8px 8px}.inventory-row:only-of-type{border-radius:8px}.inventory-row.is-equipped{border-left:3px solid #d6b873}@media(max-width:600px){.potion-list-icon{width:42px;height:42px}}
.inventory-tabs{display:flex;gap:6px;margin:10px 0 14px}.inventory-tabs button{flex:1;padding:10px 4px;min-height:42px;font:13px sans-serif}.inventory-tabs button[aria-pressed=true]{background:#5b6141;color:#ffe3a1;border-color:#c8ae70}.inventory-layout{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:14px;align-items:start}.inventory-compact{max-height:310px;overflow-y:auto;border:1px solid #82977766;border-radius:7px;background:#10272b;min-height:100px}.inventory-choice{display:grid;grid-template-columns:34px minmax(0,1fr) 28px;width:100%;align-items:center;gap:8px;padding:6px 9px;min-height:49px;border:0;border-bottom:1px solid #8aa18033;border-radius:0;background:transparent;text-align:left}.inventory-choice[aria-pressed=true]{background:#61704a66;box-shadow:inset 3px 0 #e8c77d}.inventory-choice .gear-icon,.inventory-choice .potion-list-icon{width:34px;height:34px}.inventory-choice .inventory-name{font:13px/1.4 sans-serif}.inventory-mark{margin:0;color:#f5d58e;font:12px sans-serif;text-align:right}.inventory-detail{background:#0f2529;border:1px solid #a3aa7955;border-radius:7px;padding:16px;position:sticky;top:70px}.detail-name{font:600 16px/1.5 sans-serif;margin:0 0 12px;color:#f4dfac}.inventory-detail .gear-detail{line-height:1.8;font-size:12px}.inventory-detail>button{width:100%;margin-top:14px;min-height:44px;background:#526244;border-color:#bca86c}.inventory-compact>.gear-empty{padding:12px;font-size:12px}@media(max-width:600px){.inventory-layout{grid-template-columns:1fr;gap:12px}.inventory-compact{max-height:245px}.inventory-detail{position:static;padding:13px}.inventory-detail>button{margin-top:8px}.inventory-choice .inventory-name{font-size:14px}}
/* Keep the equipped appearance visible above the item list. */
#gear-dialog .compact-loadout .loadout-figure{min-height:116px;margin:10px 0 14px;grid-template-columns:1fr 104px 1fr}
#gear-dialog .compact-loadout .loadout-body{width:104px;height:116px}
#gear-dialog .compact-loadout .loadout-label{padding:6px 4px}
#gear-dialog .compact-loadout .gear-icon{display:none}
#gear-dialog .compact-loadout .gear-name{font-size:12px;margin:4px 0}
#gear-dialog .compact-loadout .gear-label{font-size:10px;margin:0}
#gear-dialog .compact-loadout .equipped-tag{font-size:9px;padding:3px 6px;margin:2px 0}
#gear-dialog .compact-loadout+.inventory-heading{margin-top:12px}
#gear-dialog #gear-totals{margin-bottom:8px}
/* A compact upper-left character panel, with status beside it. */
.inventory-overview{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin:12px 0 18px;align-items:stretch}
#gear-dialog .inventory-overview .loadout-figure{height:174px;min-height:0;margin:0;padding:4px 6px 8px;grid-template-columns:1fr 1fr;grid-template-rows:112px auto;gap:0}
#gear-dialog .inventory-overview .loadout-body{grid-column:1/3;grid-row:1;width:104px;height:112px;justify-self:center}
#gear-dialog .inventory-overview .loadout-label{grid-row:2;padding:0 3px;align-self:start}
#gear-dialog .inventory-overview .loadout-label.weapon{grid-column:1}
#gear-dialog .inventory-overview .loadout-label.shield{grid-column:2}
#gear-dialog .inventory-overview .gear-label{font-size:9px;color:#aabbac}
#gear-dialog .inventory-overview .gear-name{font-size:11px;margin:3px 0;line-height:1.4}
#gear-dialog .inventory-overview .equipped-tag{display:none}
#gear-dialog .inventory-overview #gear-totals{margin:0;grid-template-columns:1fr 1fr;align-items:center;padding:12px 6px;gap:10px 4px}
#gear-dialog .inventory-overview .stat-value{font-size:20px}
@media(max-width:600px){.inventory-overview{gap:9px;margin:10px 0 14px}#gear-dialog .inventory-overview .stat-value{font-size:18px}#gear-dialog .inventory-overview .loadout-figure{height:174px}.inventory-heading{margin-top:12px}}
.progression{display:flex;align-items:center;gap:12px;padding:8px 18px;background:#122623;border-top:1px solid #bba36b22;font:11px sans-serif;color:#b8c9b6}.progression strong{color:#f0d28d;font:600 13px sans-serif;white-space:nowrap}.progression progress{height:6px;width:110px;accent-color:#d5bc73;border:0;border-radius:8px;overflow:hidden}.progression progress::-webkit-progress-bar{background:#30483b}.progression progress::-webkit-progress-value{background:#d5bc73}.progression progress::-moz-progress-bar{background:#d5bc73}@media(max-width:600px){.progression{padding:8px 10px;gap:9px;font-size:10px}.progression progress{width:90px}}
.save-status{font:10px/1.6 sans-serif;color:#a2b9aa;margin:0 0 8px}.mode-switch button[hidden]{display:none}#new-run-dialog{width:min(440px,calc(100% - 28px));padding:25px;color:#e9dfc7;background:#172c30;border:1px solid #bca46e;border-radius:9px;font-family:sans-serif}#new-run-dialog::backdrop{background:#07151dcc}#new-run-dialog h2{font-size:20px}#new-run-dialog p{font-size:13px;line-height:1.8;color:#c1cdbf}#new-run-dialog>div{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}#new-run-confirm{border-color:#d1af71;background:#5a6040}
/* Keep health and progress visible when the page scrolls during play. */
.game{overflow:visible}.game-hud{position:sticky;top:0;z-index:8;background:#142723;box-shadow:0 4px 12px #07141b66;border-radius:7px 7px 0 0;overflow:hidden}.viewport{overflow:hidden}.game>.message{border-radius:0 0 7px 7px}.status #hp{color:#d8e8b5;font-weight:700;white-space:nowrap}.status>span:nth-child(2){white-space:nowrap}#restart{background:#5a6240;border-color:#c7ac70;color:#ffe7ae;font-weight:600}
.game-hud .mode-switch{display:flex;flex-direction:row;gap:8px;padding:9px 12px;border-bottom:1px solid #bda47133;background:#132521}.game-hud .mode-switch button{min-height:40px;padding:9px 14px;font:12px sans-serif}.game-hud .mode-switch #restart{order:0}.game-hud .mode-switch #resume-run{order:1;border-color:#bba76c;color:#f1dfa9}.game-hud .mode-switch #art-room{order:2;margin-left:auto;font-size:10px;color:#a9bcad}@media(max-width:600px){.game-hud .mode-switch{gap:6px;padding:7px 9px}.game-hud .mode-switch button{font-size:12px;padding:8px 10px}.game-hud .mode-switch #art-room{padding:8px 6px;font-size:10px}}
#boss-status{position:absolute;left:12px;top:12px;z-index:2;max-width:calc(100% - 190px);width:300px;padding:10px 13px;background:#14212cef;border:1px solid #c9a060;border-radius:6px;color:#f4d89a;font:12px sans-serif;pointer-events:none}#boss-status[hidden]{display:none}#boss-health{display:block;width:100%;height:7px;accent-color:#e4ae62;margin-top:8px}#boss-health::-webkit-progress-bar{background:#3d4142}#boss-health::-webkit-progress-value{background:#d8a261}@media(max-width:600px){#boss-status{left:8px;top:8px;max-width:calc(100% - 134px);font-size:10px;padding:8px}}
.enemy-preview{font:12px sans-serif;color:#c4cbb4;padding:12px 0 20px}.enemy-preview summary{cursor:pointer;min-height:40px;padding:10px 0}.enemy-preview button{margin:4px 7px 4px 0;min-height:44px}
.run-result{background:radial-gradient(ellipse at 50% 0,#243b4bf5,#091923f5 75%);overflow-y:auto;justify-content:flex-start;padding:25px 28px 28px;gap:0}.run-result.is-success{background:radial-gradient(ellipse at 50% 0,#4d5439ed,#101f29f5 75%)}.run-result .eyebrow{font-size:9px;margin:0}.run-result h2{font-size:28px;margin:12px 0}.run-result>p:not(.eyebrow){font:12px/1.8 sans-serif;margin:0 0 12px}.run-result #result-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;width:min(100%,570px);padding:0;border:0;margin:6px 0 14px}.run-result #result-stats>div{display:flex;flex-direction:column;gap:7px;padding:12px 7px;border:1px solid #b0ae7955;border-radius:6px;background:#0c20277d;font-family:sans-serif}.run-result #result-stats span{font-size:10px;color:#b7c4b9}.run-result #result-stats strong{font-size:17px;color:#f3d99f}.run-result #result-treasure{color:#ead59e;padding:10px 14px;border:1px solid #c5a26755;border-radius:5px;margin:0 0 10px;background:#46503844;width:min(100%,570px)}#result-loadout{display:flex;gap:12px;justify-content:center;flex-wrap:wrap;margin:0 0 16px;font:12px sans-serif;color:#c5d2c0}#result-loadout>div{display:flex;gap:6px;align-items:center}#result-loadout .gear-icon{width:32px;height:32px;margin:0}.run-result #retry{padding:12px 24px;min-height:44px}@media(max-width:600px){.run-result{padding:16px 13px}.run-result h2{font-size:22px;margin:9px 0}.run-result>p:not(.eyebrow){font-size:10px;line-height:1.6;margin-bottom:8px}.run-result #result-stats{gap:6px;margin:4px 0 9px}.run-result #result-stats>div{padding:9px 3px;gap:5px}.run-result #result-stats strong{font-size:13px}.run-result #result-stats span{font-size:9px}.run-result #result-treasure{padding:8px;font-size:10px}#result-loadout{font-size:10px;gap:6px;margin-bottom:10px}#result-loadout .gear-icon{width:27px;height:27px}.run-result #retry{padding:9px 19px;font-size:11px}}
.loot-toasts{position:fixed;right:18px;top:154px;z-index:12;width:255px;pointer-events:none;display:grid;gap:7px}.receipt-row{display:flex;align-items:center;gap:10px;background:linear-gradient(120deg,#334437f5,#142a32f5);border:1px solid #d3b77d;border-radius:8px;padding:12px;box-shadow:0 8px 28px #0007}.receipt-icon{display:inline-block;flex:none;width:44px;height:44px;background-size:200% 200%;image-rendering:pixelated;background-repeat:no-repeat}.receipt-row small{display:block;font:10px sans-serif;color:#c7b886;letter-spacing:0;margin-bottom:5px}.receipt-row strong{font:600 16px/1.4 sans-serif;color:#ffe6ae}.last-loot{display:flex;flex-wrap:wrap;gap:6px 16px;padding:8px 12px;margin-top:12px;border-left:2px solid #d4b06a;background:#20332e;color:#f0d69f;font:12px sans-serif}.last-loot[hidden]{display:none}.last-loot>span{display:flex;align-items:center;gap:6px}.last-loot .receipt-icon{width:28px;height:28px}.heal-preview{font:600 14px/1.6 sans-serif;color:#d8eebd;border-left:2px solid #b1c987;padding-left:10px}.inventory-detail button{white-space:normal}#heal-stock{font-size:11px;color:#b9cbb4}@media(max-width:600px){.loot-toasts{right:12px;top:145px;width:220px}.receipt-row{padding:9px}.receipt-row strong{font-size:14px}.receipt-icon{width:36px;height:36px}#heal-stock{font-size:10px}}
#loading-screen{position:absolute;inset:0;z-index:5;background:#10232df5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;font:13px sans-serif;color:#d6dbc5;text-align:center;padding:24px}#loading-screen[hidden]{display:none}#loading-screen>span{font-size:36px;color:#e6c27d;animation:lantern-pulse 1.5s ease-in-out infinite}@keyframes lantern-pulse{50%{opacity:.4;transform:scale(.92)}}#welcome-dialog{width:min(530px,calc(100% - 26px));background:linear-gradient(145deg,#253c3a,#101f2c);border:1px solid #c3aa71;border-radius:12px;color:#eee2c7;padding:28px;box-shadow:0 20px 80px #000b}#welcome-dialog::backdrop{background:#07121bd9;backdrop-filter:blur(3px)}#welcome-dialog h2{font:normal 25px/1.6 Georgia,'Hiragino Mincho ProN',serif}#welcome-dialog>p:not(.eyebrow),#welcome-dialog li{font:13px/1.9 sans-serif;color:#c0d0c1}#welcome-dialog ul{padding-left:19px;margin:18px 0 22px}#welcome-dialog li{margin:7px 0}#welcome-dialog>div{display:flex;gap:10px;flex-wrap:wrap}#welcome-dialog button{min-height:46px;font-size:13px}#welcome-start{background:#67704a;border-color:#d2b675;color:#fff0bd}#welcome-dialog>small{display:block;margin-top:20px;font:10px sans-serif;letter-spacing:0;color:#9aafa4}@media(max-width:600px){#welcome-dialog{padding:21px}#welcome-dialog h2{font-size:21px}#welcome-dialog button{flex:1;padding:11px 8px;font-size:12px}}@media(prefers-reduced-motion:reduce){#loading-screen>span{animation:none}}
@media(max-width:600px){.bottom{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start}.help{min-width:0}.help span{overflow-wrap:anywhere}.controls{grid-template-columns:repeat(3,44px)}.heading{padding-bottom:14px}main{padding-top:16px}}

/* Touch play stays in one viewport: receipts never move the controls. */
@media (max-width:600px), (max-width:1400px) and (pointer:coarse), (max-width:1000px) and (max-height:500px){
 html,body{height:100%;overflow:hidden;overscroll-behavior:none}
 main{position:fixed;inset:0;max-width:none;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);display:flex;flex-direction:column;height:100%;height:100dvh}
 main>header,.heading,#save-status,#objective,main>footer,.enemy-preview,.help{display:none}
 .game{flex:1;min-height:0;display:flex;flex-direction:column;border-radius:0;box-shadow:none;border:0;overflow:hidden}
 .game-hud{position:relative;flex:none;border-radius:0}
 .game-hud .mode-switch{padding:4px 8px;gap:5px}
 .game-hud .mode-switch button{min-height:30px;padding:5px 8px;font-size:10px}
 .status{padding:6px 10px;font:11px monospace;align-items:center;gap:6px}
 .status b{font-size:12px;margin-left:2px}.status #turn{display:none}.status #sound{padding:5px 8px;min-height:28px;font-size:10px}
 .progression{padding:4px 10px!important;gap:8px!important;min-height:24px}.progression span{font-size:9px}
 .viewport{flex:1;min-height:0;width:100%}
 #world{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto;object-fit:cover;touch-action:none}
 .game>.message{height:32px;min-height:32px;max-height:32px;padding:8px 12px;font:11px/16px sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:0}
 .adventure-tools{height:48px;min-height:48px;margin:0!important;padding:4px 8px!important;display:flex!important;gap:6px!important;align-items:center;background:#142723}
 .adventure-tools button{min-height:38px;padding:7px 10px;font-size:11px;white-space:nowrap}.adventure-tools #heal-stock{flex:1;font:9px/1.5 sans-serif;letter-spacing:0}.adventure-tools small{display:none}.adventure-tools #map-toggle{margin-left:auto}
 .bottom{position:fixed;inset:0;display:block;padding:0;pointer-events:none;z-index:10}
 .controls{display:contents;pointer-events:none}
 .controls button{position:absolute;width:52px;height:52px;min-height:52px;padding:0;pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;border:1px solid #d7e4cf66;border-radius:16px;background:#16303966;box-shadow:inset 0 0 16px #b9d4cf12;color:#f4e8c6;font:19px sans-serif;backdrop-filter:blur(2px);transform:none}
 .controls button:active{background:#b7c99977;border-color:#f2dda4;transform:scale(.96)}
 .controls .up{left:calc(68px + env(safe-area-inset-left));bottom:calc(196px + env(safe-area-inset-bottom))}
 .controls button:nth-child(2){left:calc(12px + env(safe-area-inset-left));bottom:calc(140px + env(safe-area-inset-bottom))}
 .controls #wait{left:calc(68px + env(safe-area-inset-left));bottom:calc(140px + env(safe-area-inset-bottom));font-size:15px}
 .controls button:nth-child(4){left:calc(124px + env(safe-area-inset-left));bottom:calc(140px + env(safe-area-inset-bottom))}
 .controls .down{left:calc(68px + env(safe-area-inset-left));bottom:calc(84px + env(safe-area-inset-bottom))}
 .controls .attack{right:calc(20px + env(safe-area-inset-right));bottom:calc(100px + env(safe-area-inset-bottom));width:72px;height:72px;border-radius:50%;background:#715c3266;border-color:#e9c58388;font:14px sans-serif}
 #map-panel{width:94px!important;right:8px;top:8px;padding:4px!important;pointer-events:none}#minimap{width:100%;height:auto;aspect-ratio:180/136;object-fit:contain}#map-panel>span{font-size:7px;letter-spacing:0}
 .maplabel{top:8px;bottom:auto;left:8px;font-size:9px;padding:4px 7px}.maplabel small{display:none}
 .loot-toasts{top:calc(122px + env(safe-area-inset-top));left:50%;right:auto;transform:translateX(-50%);width:min(260px,70vw);z-index:12}.receipt-row{padding:7px 10px}.receipt-row strong{font-size:13px}.receipt-icon{width:30px;height:30px}.receipt-row small{font-size:9px;margin-bottom:2px}
 .last-loot{position:absolute;left:0;top:0;visibility:hidden;pointer-events:none}
 dialog{max-height:calc(100dvh - 24px);overscroll-behavior:contain}
 #boss-status{top:44px;max-width:55%}.run-result{z-index:15}
}
@media (max-width:1000px) and (max-height:500px){
 .game-hud .mode-switch{position:absolute;right:4px;top:0;border:0;background:transparent;padding:3px;z-index:2}.game-hud .mode-switch button{min-height:26px;font-size:9px;padding:4px 7px}.game-hud .mode-switch #art-room{display:none}
 .status{padding-right:225px;min-height:34px}.status #gold,.status #sound{display:none}.progression{min-height:20px!important;padding:2px 10px!important}.progression #xp-progress{max-width:100px}
 .controls .up{bottom:calc(164px + env(safe-area-inset-bottom))}.controls button:nth-child(2),.controls #wait,.controls button:nth-child(4){bottom:calc(108px + env(safe-area-inset-bottom))}.controls .down{bottom:calc(52px + env(safe-area-inset-bottom))}.controls .attack{bottom:calc(68px + env(safe-area-inset-bottom))}
 .game>.message{position:absolute;bottom:48px;left:190px;right:110px;background:#142723aa;pointer-events:none;border:0;height:25px;min-height:25px;padding:4px 8px;font-size:10px}
 .loot-toasts{top:58px;width:250px}#map-panel{width:80px!important}.adventure-tools{height:44px;min-height:44px}.adventure-tools button{min-height:34px}
}

#world{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab}#world:active{cursor:grabbing}
.drag-thumb{position:fixed;z-index:14;width:88px;height:88px;transform:translate(-50%,-50%);border:1px solid #dfeddf44;border-radius:50%;background:#d3e4d408;pointer-events:none;box-shadow:inset 0 0 0 30px #d7e5d008}.drag-thumb::before,.drag-thumb::after{content:'';position:absolute;background:#e9f0df33}.drag-thumb::before{left:43px;top:9px;bottom:9px;width:1px}.drag-thumb::after{top:43px;left:9px;right:9px;height:1px}.drag-thumb[hidden]{display:none}
#rotate-view{display:none}
@media (max-width:600px), (max-width:1400px) and (pointer:coarse), (max-width:1000px) and (max-height:500px){
 .controls button:not(.attack){opacity:.22;backdrop-filter:none}.controls button:not(.attack):active{opacity:.65}
 #rotate-view{display:block;font-size:10px;padding:6px;flex:none}#heal-stock{display:none}.adventure-tools #map-toggle{margin-left:auto}
}
@media (orientation:landscape){#rotate-view{display:none}}
body.manual-landscape main{inset:auto;left:0;top:0;width:100dvh;height:100dvw;transform-origin:top left;transform:rotate(90deg) translateY(-100%);padding:0}
body.manual-landscape #rotate-view{display:block}

body.manual-landscape .game-hud .mode-switch{position:absolute;right:4px;top:0;border:0;background:transparent;padding:3px;z-index:2}body.manual-landscape .game-hud .mode-switch button{min-height:26px;font-size:9px;padding:4px 7px}body.manual-landscape .game-hud .mode-switch #art-room{display:none}body.manual-landscape .status{padding-right:225px;min-height:34px}body.manual-landscape .status #gold,body.manual-landscape .status #sound{display:none}body.manual-landscape .progression{min-height:20px!important;padding:2px 10px!important}body.manual-landscape .progression #xp-progress{max-width:100px}body.manual-landscape .controls .up{bottom:calc(164px + env(safe-area-inset-bottom))}body.manual-landscape .controls button:nth-child(2),body.manual-landscape .controls #wait,body.manual-landscape .controls button:nth-child(4){bottom:calc(108px + env(safe-area-inset-bottom))}body.manual-landscape .controls .down{bottom:calc(52px + env(safe-area-inset-bottom))}body.manual-landscape .controls .attack{bottom:calc(68px + env(safe-area-inset-bottom))}body.manual-landscape .game>.message{position:absolute;bottom:48px;left:190px;right:110px;background:#142723aa;pointer-events:none;border:0;height:25px;min-height:25px;padding:4px 8px;font-size:10px}body.manual-landscape .loot-toasts{top:58px;width:250px}body.manual-landscape #map-panel{width:80px!important}body.manual-landscape .adventure-tools{height:44px;min-height:44px}body.manual-landscape .adventure-tools button{min-height:34px}

body.manual-landscape .loot-toasts{position:absolute}body.manual-landscape .bottom{width:100%;height:100%}

/* Native selection/copy callouts must not interrupt held game gestures. */
body,main,main *,dialog,dialog *,.drag-thumb{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
canvas,button{-webkit-user-drag:none}
input,textarea,[contenteditable=true]{user-select:text;-webkit-user-select:text;-webkit-touch-callout:default}

/* Native modal dialogs live outside the rotated main, so rotate their own surface. */
body.manual-landscape dialog[open]{position:fixed;inset:auto;top:50%;left:50%;margin:0;transform:translate(-50%,-50%) rotate(90deg);transform-origin:center;width:min(530px,calc(100dvh - 24px));max-width:none;max-height:calc(100dvw - 24px)}
body.wide-inventory #gear-dialog[open]{width:min(940px,calc(100dvw - 24px));height:calc(100dvh - 24px);max-width:none;max-height:none;display:grid;grid-template-columns:156px minmax(0,1fr);grid-template-rows:44px minmax(0,1fr) 22px;gap:8px 14px;padding:10px 14px;overflow:hidden}
body.manual-landscape #gear-dialog[open]{width:calc(100dvh - 24px);height:calc(100dvw - 24px)}
body.wide-inventory #gear-dialog .gear-header{grid-column:1/-1;position:static;padding:0 0 6px;min-height:0}.wide-inventory .gear-header .eyebrow{display:none}.wide-inventory .gear-header h2{font-size:19px;margin:0}.wide-inventory .gear-header button{min-height:38px;padding:8px 15px}
body.wide-inventory #gear-dialog .inventory-overview{grid-column:1;grid-row:2;display:grid;grid-template-columns:1fr;grid-template-rows:minmax(100px,1fr) 70px;gap:7px;margin:0;min-height:0}
body.wide-inventory #gear-slots{display:block;min-height:0}
body.wide-inventory #gear-dialog .inventory-overview .loadout-figure{height:100%;min-height:0;padding:2px;grid-template-rows:minmax(70px,1fr) 37px}
body.wide-inventory #gear-dialog .inventory-overview .loadout-body{align-self:center;width:88px;height:90px}
body.wide-inventory #gear-dialog .inventory-overview .gear-name{font-size:10px;margin:2px 0}.wide-inventory .inventory-overview .gear-label{font-size:8px}
body.wide-inventory #gear-dialog .inventory-overview #gear-totals{padding:4px;gap:2px;border-radius:6px}.wide-inventory #gear-totals p{margin:2px 0}.wide-inventory #gear-totals .stat-label{font-size:9px}.wide-inventory #gear-totals .stat-value{font-size:15px}
body.wide-inventory #gear-ground{grid-column:2;grid-row:2;display:grid;grid-template-rows:20px 36px minmax(0,1fr);gap:6px;min-width:0;min-height:0}
body.wide-inventory .inventory-heading{font-size:11px;margin:0;line-height:20px}.wide-inventory .inventory-tabs{margin:0;gap:5px}.wide-inventory .inventory-tabs button{min-height:36px;padding:6px 4px;font-size:12px}
body.wide-inventory .inventory-layout{height:100%;min-height:0;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;align-items:stretch}
body.wide-inventory .inventory-compact{height:100%;max-height:none;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
body.wide-inventory .inventory-choice{min-height:46px;padding:5px 7px;gap:4px;grid-template-columns:30px minmax(0,1fr) 22px}.wide-inventory .inventory-choice .inventory-name{font-size:12px}.wide-inventory .inventory-choice .gear-icon,.wide-inventory .inventory-choice .potion-list-icon{width:30px;height:30px}
body.wide-inventory .inventory-detail{position:relative;top:auto;min-height:0;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:5px;overscroll-behavior:contain}.wide-inventory .inventory-detail p{margin:0}.wide-inventory .detail-name{font-size:14px;line-height:1.4}.wide-inventory .inventory-detail .gear-detail{font-size:10px;line-height:1.4}.wide-inventory .heal-preview{font-size:11px;line-height:1.5}.wide-inventory .inventory-detail>button{position:sticky;bottom:0;flex:none;min-height:40px;margin-top:auto;padding:8px 5px;font-size:12px;box-shadow:0 -4px 10px #0f2529}
body.wide-inventory #gear-dialog .gear-rule{display:none}body.wide-inventory #gear-feedback{grid-column:1/-1;grid-row:3;margin:0;padding:3px 0 0;min-height:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px;line-height:18px}

/* Drag is the sole movement surface on phones: no invisible directional hit areas. */
@media (max-width:600px), (max-width:1400px) and (pointer:coarse), (max-width:1000px) and (max-height:500px){
 .controls button:not(.attack){display:none;pointer-events:none}
 .adventure-tools{height:64px;min-height:64px;flex-wrap:nowrap;gap:7px!important;padding:6px 8px!important}
 .adventure-tools button{min-height:50px;padding:8px 10px;font-size:12px;touch-action:manipulation}
 .adventure-tools #gear-open,.adventure-tools #potion{flex:1;min-width:0;border-color:#b6a06b;background:#354a3d}
 .adventure-tools #map-toggle,.adventure-tools #rotate-view{min-width:44px;padding:8px 5px;font-size:10px;margin:0}
 .inventory-tabs button{min-height:48px}.inventory-choice{min-height:58px;padding:9px 10px}.inventory-choice .inventory-name{font-size:14px}.inventory-detail>button{min-height:50px}
 .controls .attack{bottom:calc(116px + env(safe-area-inset-bottom))}
}
body.wide-inventory .adventure-tools{height:60px;min-height:60px}
body.wide-inventory .game>.message{bottom:64px;left:12px;right:110px}
body.wide-inventory .controls .attack{bottom:calc(84px + env(safe-area-inset-bottom))}
body.wide-inventory #gear-ground{grid-template-rows:20px 44px minmax(0,1fr)}
body.wide-inventory .inventory-tabs button{min-height:44px}
body.wide-inventory .inventory-choice{min-height:54px;padding:8px}
body.wide-inventory .inventory-detail>button{min-height:48px}

/* The cottage is a quiet staging area; only the inventory lists scroll in landscape. */
#home-dialog{width:min(1120px,calc(100% - 24px));max-height:calc(100dvh - 24px);padding:20px;background:radial-gradient(ellipse at 18% 0,#3b4e45,#132630 78%);color:#ece2ca;border:1px solid #c3a56d;border-radius:12px;box-shadow:0 24px 100px #000b;overflow:auto;font-family:sans-serif}#home-dialog::backdrop{background:#06131be8;backdrop-filter:blur(4px)}
#home-dialog .home-header{padding:0 0 14px;border-color:#bbab7344;display:flex;justify-content:space-between;align-items:center}.home-header h2{margin:0;font:normal 26px Georgia,'Hiragino Mincho ProN',serif;letter-spacing:4px}.home-header button{min-height:46px}.home-layout{display:grid;grid-template-columns:minmax(240px,.85fr) minmax(0,1.6fr);gap:20px;margin-top:16px}.home-room{min-width:0;display:flex;flex-direction:column;gap:12px}.home-picture{position:relative;border:1px solid #a68e5a66;border-radius:8px;overflow:hidden;background:#111d29}.home-picture #cottage{width:100%;height:auto;aspect-ratio:4/3;object-fit:contain;image-rendering:pixelated}.home-room-tag{position:absolute;left:12px;bottom:10px;background:#102532b8;padding:6px 9px;border-left:2px solid #d1b270;font-size:10px;color:#e0d2ac}.home-note{font:11px/1.8 sans-serif;color:#aabfb6;margin:0}#home-stats{white-space:pre-line;font:12px/1.9 sans-serif;color:#e0d4b3;background:#10232a;padding:10px;border-radius:6px}#home-depart{min-height:52px;background:#66704a;border-color:#cab477;color:#fff1c2;font-size:14px;margin-top:auto}.home-storage{min-width:0}.home-storage-title{display:flex;justify-content:space-between;gap:8px;align-items:center}.home-storage-title h3{font:normal 18px Georgia,serif;margin:0}.home-storage-title>span{font-size:10px;color:#a3b7a8}.home-storage-columns{display:grid;grid-template-columns:1fr 1fr;gap:12px}.home-storage-columns>section{min-width:0}.home-storage-columns h4{display:flex;justify-content:space-between;font:13px sans-serif;margin:16px 0 10px;color:#e5cf9d}.home-storage-columns h4 small{font-size:9px;letter-spacing:0}.home-item-list{max-height:440px;min-height:140px;overflow:auto;overscroll-behavior:contain;border:1px solid #8b9a7655;border-radius:7px;background:#0d232a}.home-item{display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:7px;align-items:center;padding:10px 8px;border-bottom:1px solid #91a08b22}.home-item-art{width:30px;height:30px;background-size:200% 200%;background-repeat:no-repeat;image-rendering:pixelated}.home-item strong{font:12px/1.5 sans-serif}.home-item small{display:block;color:#efd393;font:9px sans-serif;letter-spacing:0;margin-top:4px}.home-item button{min-height:44px;font-size:11px;padding:7px 9px}.home-item .home-equip{grid-column:2/4;min-height:36px;background:#41523e;border-color:#a79a6955}.home-empty{font:12px/1.9 sans-serif;color:#99ada4;padding:12px;margin:0}#home-feedback{font:12px/1.6 sans-serif;color:#edcf92;border-top:1px solid #b19a6144;padding-top:12px;margin:16px 0 0;min-height:32px}.mode-switch #home-open{border-color:#b7a36e;color:#e8d6a7}.mode-switch #home-open:disabled{opacity:.4}
@media(max-width:600px){#home-dialog{padding:14px}.home-layout{grid-template-columns:1fr;gap:15px;margin-top:12px}.home-picture #cottage{max-height:230px}.home-storage-title>span{display:none}.home-item-list{max-height:240px}.home-storage-columns{gap:8px}.home-item{grid-template-columns:26px minmax(0,1fr);gap:7px}.home-item-art{width:26px;height:26px}.home-item button{grid-column:1/3;min-height:46px}.home-item .home-equip{grid-column:1/3;min-height:42px}.home-item strong{font-size:12px}.home-note{font-size:10px}#home-stats{font-size:11px}.home-header h2{font-size:22px}.game-hud .mode-switch #home-open{font-size:10px;padding:5px}.game-hud .mode-switch #art-room{display:none}}
body.wide-inventory #home-dialog[open]{display:flex;flex-direction:column;width:min(1100px,calc(100dvw - 24px));height:calc(100dvh - 24px);max-height:none;padding:10px 14px;overflow:hidden}
body.manual-landscape #home-dialog[open]{width:calc(100dvh - 24px);height:calc(100dvw - 24px)}
body.wide-inventory #home-dialog .home-header{flex:none;height:40px;padding:0 0 6px}.wide-inventory .home-header h2{font-size:20px}.wide-inventory .home-header .eyebrow{display:none}.wide-inventory .home-header button{min-height:36px;padding:7px 14px}
body.wide-inventory .home-layout{flex:1;min-height:0;grid-template-columns:210px minmax(0,1fr);gap:14px;margin-top:8px}.wide-inventory .home-room{gap:6px;min-height:0}.wide-inventory .home-picture{flex:1;min-height:65px}.wide-inventory .home-picture #cottage{position:absolute;width:100%;height:100%;max-height:none}.wide-inventory .home-room-tag{display:none}.wide-inventory .home-note{display:none}.wide-inventory #home-stats{font-size:10px;line-height:1.5;padding:5px 8px;flex:none}.wide-inventory #home-depart{min-height:44px;font-size:12px;flex:none;margin:0}
body.wide-inventory .home-storage{display:flex;flex-direction:column;min-height:0}.wide-inventory .home-storage-title{height:24px;flex:none}.wide-inventory .home-storage-title h3{font-size:15px}.wide-inventory .home-storage-title>span{display:none}.wide-inventory .home-storage-columns{flex:1;min-height:0;gap:9px}.wide-inventory .home-storage-columns>section{display:flex;flex-direction:column;min-height:0}.wide-inventory .home-storage-columns h4{font-size:12px;margin:7px 0}.wide-inventory .home-item-list{flex:1;min-height:0;max-height:none}.wide-inventory .home-item{grid-template-columns:26px minmax(0,1fr);padding:7px;gap:5px}.wide-inventory .home-item button{grid-column:1/3;min-height:42px}.wide-inventory .home-item .home-equip{grid-column:1/3;min-height:36px}.wide-inventory .home-item strong{font-size:11px}.wide-inventory #home-feedback{flex:none;min-height:20px;font-size:10px;line-height:16px;margin:7px 0 0;padding:4px 0 0}
@media(max-width:1000px) and (max-height:500px){.game-hud .mode-switch #home-open{font-size:9px;padding:4px}.status{padding-right:285px}}
body.manual-landscape .game-hud .mode-switch #home-open{font-size:9px;padding:4px}body.manual-landscape .status{padding-right:285px}

/* The cottage is a playable room first; storage is a separate panel within it. */
#home-dialog[open]:not(.is-storage){display:flex;flex-direction:column;width:min(1160px,calc(100dvw - 20px));height:min(850px,calc(100dvh - 20px));padding:12px;overflow:hidden}
#home-dialog:not(.is-storage) .home-layout,#home-dialog:not(.is-storage)>#home-feedback{display:none}
#home-dialog .house-walk{display:flex;flex-direction:column;flex:1;min-height:0;margin-top:10px;gap:8px}
#home-dialog.is-storage .house-walk{display:none}
#home-dialog .house-stage{position:relative;flex:1;min-height:0;overflow:hidden;border:1px solid #b8995a55;border-radius:7px;background:#0c1a24}
#house-world{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto;object-fit:fill;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab}
.house-caption{position:absolute;left:12px;top:10px;pointer-events:none;border-left:2px solid #dbbd78;padding:7px 12px;background:#10232cb5;display:flex;flex-direction:column;gap:5px}.house-caption>span{font:14px Georgia,serif;letter-spacing:3px;color:#e8d5a5}.house-caption small{font:10px sans-serif;letter-spacing:0;color:#bfd0c4}
.house-walk-bar{flex:none;display:flex;align-items:center;gap:12px;background:#142a2d;padding:6px 8px;border-radius:6px}.house-walk-bar p{flex:1;margin:0;font:12px/1.6 sans-serif;color:#d7d3b9}.house-walk-bar button{min-height:52px;min-width:160px;background:#5a6845;border-color:#bca46c;color:#ffebba;font-size:13px}.house-walk-bar button:disabled{opacity:.5}
body.manual-landscape #home-dialog[open]:not(.is-storage){width:calc(100dvh - 20px);height:calc(100dvw - 20px)}
body.wide-inventory #home-dialog[open]:not(.is-storage){padding:8px 12px}.wide-inventory #home-dialog .house-walk{margin-top:6px;gap:5px}.wide-inventory #home-dialog .house-walk-bar{padding:3px 7px}.wide-inventory #home-dialog .house-walk-bar button{min-height:46px;min-width:160px}.wide-inventory #home-dialog .house-walk-bar p{font-size:10px}
@media(max-width:600px){#home-dialog:not(.is-storage) .home-header{height:42px;padding:0 0 6px;flex:none}#home-dialog:not(.is-storage) .home-header .eyebrow{display:none}.house-walk-bar{gap:7px;padding:5px}.house-walk-bar p{font-size:10px}.house-walk-bar button{min-width:135px;padding:8px;font-size:12px}.house-caption{top:7px;left:7px;padding:5px 8px}.house-caption>span{font-size:12px}}

/* Shops and bank share the house's orientation-aware modal surface. */
#home-dialog.is-commerce .house-walk{display:none}.town-commerce{display:none}#home-dialog.is-commerce .town-commerce{display:flex;flex:1;min-height:0;flex-direction:column;gap:12px;margin-top:12px;overflow:hidden}
#town-balances{display:grid;grid-template-columns:1fr 1fr;gap:10px;flex:none}#town-balances>div{display:flex;align-items:center;justify-content:space-between;background:#0d242c;padding:12px 16px;border:1px solid #9e9f6944;border-radius:7px}#town-balances span{color:#b1c2b0;font-size:12px}#town-balances strong{color:#f5d99b;font:20px monospace;font-variant-numeric:tabular-nums}.town-shop-tabs,.town-bank-tabs{display:flex;gap:8px}.town-shop-tabs button,.town-bank-tabs button{flex:1;min-height:46px;font-size:13px}.town-commerce button[aria-pressed=true]{background:#606b45;color:#ffe6aa;border-color:#cbb473}
.town-trade-layout{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:14px;flex:1;min-height:0}#town-goods{min-height:0;overflow-y:auto;overscroll-behavior:contain;border:1px solid #82957555;background:#10252a;border-radius:7px;padding:6px}.town-good{display:grid;grid-template-columns:1fr auto;width:100%;text-align:left;gap:4px 12px;min-height:66px;padding:10px;border:0;border-bottom:1px solid #abb68a33;border-radius:0;background:transparent}.town-good strong{font-size:14px}.town-good small{grid-column:1;grid-row:2;font:10px/1.4 sans-serif;letter-spacing:0}.town-good>span{grid-column:2;grid-row:1/3;align-self:center;color:#efce83;font:14px monospace}.town-good:disabled{opacity:.4;cursor:default}.town-good:focus-visible{outline:2px solid #cfaf6d;outline-offset:-2px}
#town-quote{display:flex;flex-direction:column;gap:14px;padding:18px;background:#11282d;border:1px solid #a9a47366;border-radius:7px;overflow:auto;font:13px/1.8 sans-serif;color:#c8d1bd}#town-quote h3{font:normal 21px Georgia,serif;color:#f5dda6;margin:0}#town-quote p{margin:0}#town-quote button{min-height:52px;background:#616b46;border-color:#cbb06a;color:#fff0be;margin-top:auto;font-size:14px}
.town-bank{display:none}.town-commerce.is-bank .town-bank{display:flex;flex-direction:column;gap:12px;max-width:680px;width:100%;margin:0 auto;min-height:0;overflow:auto;padding:2px 4px}.town-commerce.is-bank .town-trade-layout,.town-commerce.is-bank .town-shop-tabs{display:none}.town-bank>p{font:12px/1.7 sans-serif;color:#c1d0bf;margin:0}.town-bank label{font:12px sans-serif;color:#e8d3a4}.bank-amount-row{display:flex;gap:8px}.bank-amount-row input{flex:1;min-width:0;min-height:52px;border:1px solid #b4a56d;border-radius:6px;background:#0b2029;color:#fff1ce;padding:12px;font:20px monospace;touch-action:manipulation}.bank-amount-row button{min-height:48px;min-width:70px}#bank-preview{white-space:pre-line;background:#0b2029;border-left:2px solid #c3aa6d;padding:12px;font:14px/1.8 monospace;color:#e2deb8;min-height:66px}#bank-confirm{min-height:52px;background:#626f48;border-color:#bfa46d;color:#fff0c0;font-size:14px}#bank-confirm:disabled{opacity:.4}#town-feedback{flex:none;font:12px/1.5 sans-serif;color:#ead3a1;margin:0;padding:8px 0 0;border-top:1px solid #aaa46b44;min-height:28px}
@media(max-width:600px){#town-balances{gap:6px}#town-balances>div{flex-direction:column;align-items:flex-start;padding:8px;gap:6px}#town-balances span{font-size:10px}#town-balances strong{font-size:17px}.town-trade-layout{grid-template-columns:1fr;grid-template-rows:minmax(110px,1fr) minmax(150px,.8fr);gap:8px}#town-quote{padding:12px;gap:6px;font-size:12px}#town-quote h3{font-size:18px}.town-good{min-height:62px}.bank-amount-row{flex-wrap:wrap}.bank-amount-row input{flex-basis:100%}.bank-amount-row button{flex:1}.town-bank>p{font-size:11px}#town-feedback{font-size:10px}}
body.wide-inventory #home-dialog.is-commerce .town-commerce{gap:7px;margin-top:7px}body.wide-inventory #town-balances>div{padding:7px 12px;flex-direction:row;align-items:center}body.wide-inventory #town-balances strong{font-size:17px}body.wide-inventory .town-shop-tabs button{min-height:40px;padding:6px}body.wide-inventory .town-trade-layout{grid-template-columns:1.1fr 1fr;grid-template-rows:minmax(0,1fr);gap:10px}body.wide-inventory .town-good{min-height:58px;padding:8px}body.wide-inventory #town-quote{padding:10px;gap:6px;font-size:11px}body.wide-inventory #town-quote h3{font-size:17px}body.wide-inventory #town-quote button{min-height:44px;padding:8px;font-size:12px}body.wide-inventory #town-feedback{font-size:10px;padding-top:5px;min-height:20px}
body.wide-inventory .town-bank{max-width:none;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto 44px auto minmax(44px,1fr);gap:6px 14px;overflow:auto}body.wide-inventory .town-bank>p{grid-column:1/-1;font-size:10px}body.wide-inventory .town-bank-tabs{grid-column:1;grid-row:2}body.wide-inventory .town-bank-tabs button{min-height:44px}body.wide-inventory .town-bank label{grid-column:1;grid-row:3}body.wide-inventory .bank-amount-row{grid-column:1;grid-row:4;flex-wrap:nowrap;align-items:start}body.wide-inventory .bank-amount-row input{flex-basis:0;min-height:46px;font-size:18px;padding:8px}body.wide-inventory .bank-amount-row button{min-width:52px;min-height:46px;padding:6px;flex:0 0 auto;font-size:11px}body.wide-inventory #bank-preview{grid-column:2;grid-row:2/4;font-size:12px;padding:7px;min-height:0}body.wide-inventory #bank-confirm{grid-column:2;grid-row:4;min-height:46px;align-self:start;font-size:12px}body.wide-inventory .town-commerce:not(.is-bank) .town-bank{display:none}
body.wide-inventory .town-commerce.is-bank .town-bank{display:grid;max-width:none;width:100%;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto 44px auto minmax(46px,1fr)}
#home-dialog.is-civic .house-walk,#home-dialog.is-departure .house-walk{display:none}.civic-pane,.departure-pane{display:none}#home-dialog.is-civic .civic-pane,#home-dialog.is-departure .departure-pane{display:flex;flex:1;min-height:0;overflow:auto;flex-direction:column;gap:12px;padding:16px 4px}.civic-pane p,.civic-pane small{font:13px/1.7 sans-serif;color:#d3dccb}.civic-pane label{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.civic-pane input{max-width:100%;background:#102630;color:#fff2d1;border:1px solid #8d986b;border-radius:5px;padding:12px;font-size:16px}.civic-pane button,.departure-pane button{min-height:48px}#housing-plots{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}#housing-plots article{padding:14px;background:#0d242c;border:1px solid #bdad7044;border-radius:7px;display:flex;gap:14px;flex-direction:column;font:14px/1.7 sans-serif}#housing-plots button:disabled{opacity:.5}#housing-quote:not(:empty){padding:14px;border:1px solid #c9ae6b;border-radius:7px}#housing-feedback{color:#ffe3a6}.departure-pane p{font:15px/1.8 sans-serif}.departure-pane{justify-content:center;text-align:center}.departure-actions{display:flex;gap:12px}.departure-actions button{flex:1}.departure-actions button:first-child{background:#65734b}
#home-dialog.is-map .house-walk{display:none}.district-map{display:none}#home-dialog.is-map .district-map{display:flex;flex:1;min-height:0;flex-direction:column;gap:12px;align-items:center;justify-content:center;overflow:auto}.district-map p{font:13px/1.7 sans-serif;color:#e0d5ad}.district-map canvas{max-width:100%;max-height:calc(100% - 48px);object-fit:contain;image-rendering:pixelated}#district-map-open{min-height:48px;min-width:72px;flex:none}
#home-dialog.is-departure .departure-pane{justify-content:flex-start;text-align:left;padding:12px 4px}.departure-pane>h3,.departure-pane>p{margin:0 0 8px}.departure-loadout{display:flex;flex-direction:column;gap:10px}.departure-loadout p{margin:0;font:13px/1.6 sans-serif}.departure-loadout label{display:flex;align-items:center;gap:12px;min-height:48px;padding:9px;background:#122b32;border:1px solid #81966a55;border-radius:6px;font:14px/1.5 sans-serif}.departure-loadout input{width:22px;height:22px;flex:none;accent-color:#d7bd75}#departure-tools{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:8px}#departure-loss{color:#ffd18b;white-space:pre-wrap}.departure-risk{color:#efb9a3}.departure-actions{position:sticky;bottom:0;background:#142b32;padding:8px 0}.departure-actions button:disabled{opacity:.4}#departure-consent-row[hidden]{display:none}
/* Storage owns a stable viewport; its two full inventories scroll independently. */
#home-dialog.is-storage[open]{display:flex;flex-direction:column;width:min(1160px,calc(100dvw - 20px));height:min(850px,calc(100dvh - 20px));max-height:none;overflow:hidden;padding:12px}#home-dialog.is-storage .home-header{flex:none}#home-dialog.is-storage .home-layout{display:flex;flex:1;min-height:0;flex-direction:column;gap:10px;margin-top:10px}#home-dialog.is-storage .home-room{display:grid;grid-template-columns:100px minmax(0,1fr) auto;gap:10px;flex:none;align-items:center}#home-dialog.is-storage .home-room:has(.home-picture[hidden]){grid-template-columns:minmax(0,1fr) auto}#home-dialog.is-storage .home-picture{height:74px;min-height:0;flex:none}#home-dialog.is-storage .home-picture #cottage{position:static;width:100%;height:100%;object-fit:contain}#home-dialog.is-storage .home-room-tag,#home-dialog.is-storage .home-note{display:none}#home-dialog.is-storage #home-stats{font:11px/1.6 sans-serif;padding:7px}#home-dialog.is-storage #home-depart{min-height:44px;margin:0;font-size:12px}#home-dialog.is-storage .home-storage{display:flex;flex:1;min-height:0;flex-direction:column}#home-dialog.is-storage .home-storage-title{flex:none;min-height:28px}#home-dialog.is-storage .home-storage-title h3{font-size:15px}#home-dialog.is-storage .home-storage-columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);flex:1;min-height:0;gap:12px}#home-dialog.is-storage .home-storage-columns>section{display:flex;min-height:0;flex-direction:column}#home-dialog.is-storage .home-storage-columns h4{flex:none;margin:6px 0 8px}#home-dialog.is-storage .home-item-list{flex:1;min-height:0;max-height:none;overflow-y:auto;touch-action:pan-y;scrollbar-gutter:stable;scrollbar-width:thin;-webkit-overflow-scrolling:touch}#home-dialog.is-storage .home-item button{touch-action:pan-y}#home-dialog.is-storage #home-feedback{flex:none;min-height:0;max-height:48px;overflow:auto;margin:7px 0 0;padding-top:5px;font-size:11px}.home-list-more{flex:none;margin:5px 0 0;font:10px/1.5 sans-serif;color:#d1be8e;min-height:15px}#home-dialog.is-storage .home-storage-title>span{display:none}
@media(max-width:600px){#home-dialog.is-storage .home-room,#home-dialog.is-storage .home-room:has(.home-picture[hidden]){grid-template-columns:minmax(0,1fr) auto}#home-dialog.is-storage .home-picture{display:none}#home-dialog.is-storage .home-storage-columns{gap:8px}#home-dialog.is-storage .home-item{grid-template-columns:24px minmax(0,1fr);padding:8px 5px}#home-dialog.is-storage .home-storage-title h3{font-size:13px}#home-dialog.is-storage #home-depart{font-size:10px;max-width:115px;padding:7px}#home-dialog.is-storage .home-item .home-equip{min-height:40px}.home-list-more{font-size:9px}}
body.manual-landscape #home-dialog.is-storage[open]{width:calc(100dvh - 20px);height:calc(100dvw - 20px)}

@media(max-width:600px){#home-dialog.is-storage .home-header{gap:7px;padding-bottom:9px}#home-dialog.is-storage .home-header .eyebrow{display:none}#home-dialog.is-storage .home-header h2{font-size:18px;letter-spacing:1px}#home-dialog.is-storage .home-header button{min-height:42px;padding:7px;font-size:11px}}

/* Menu gestures must remain native scrolling, including gestures starting on buttons.
   Allow both axes so the manually rotated landscape dialogs also pan correctly. */
#home-dialog:is(.is-commerce,.is-civic,.is-departure,.is-storage),
#home-dialog:is(.is-commerce,.is-civic,.is-departure,.is-storage) *{touch-action:manipulation}
#home-dialog :is(#town-goods,#town-quote,.town-bank,.civic-pane,.departure-pane,.home-item-list){-webkit-overflow-scrolling:touch;overscroll-behavior:contain;scrollbar-width:thin}
.town-shop-tabs,.town-bank-tabs,.town-bank>*{flex-shrink:0}

/* A single compact receipt stays at the playfield's lower left, clear of HUD/attack. */
#loot-toasts{position:absolute;left:10px;right:auto;top:auto;bottom:10px;transform:none;width:min(230px,calc(100% - 110px));max-width:calc(100% - 20px);gap:0;pointer-events:none}
#loot-toasts .receipt-row{gap:6px;padding:6px 8px;border-radius:5px;border-color:#c4b57b88;background:#10282de8;box-shadow:0 2px 8px #0003;min-width:0}
#loot-toasts .receipt-icon{width:24px;height:24px}
#loot-toasts .receipt-row>div{min-width:0}
#loot-toasts .receipt-row small{font-size:9px;line-height:1.2;margin-bottom:2px}
#loot-toasts .receipt-row strong{display:block;font:600 12px/1.35 sans-serif;overflow-wrap:anywhere}

/* Automatic landscape uses the same responsive layout in town and all menus.
   The fallback is available in town too when the phone keeps its portrait viewport. */
#rotate-home{display:none}
@media(max-width:600px) and (orientation:portrait){#rotate-home{display:block;min-width:48px;padding:7px;font-size:10px}#home-dialog .home-header{gap:6px}#home-dialog .home-header h2{font-size:18px;letter-spacing:1px}#home-dialog .home-header button{padding:7px;font-size:10px}}

/* Receipts occupy one short row above the movement area; replace the area label. */
#loot-toasts{top:8px;bottom:auto;width:min(220px,calc(100% - 120px))}
#loot-toasts .receipt-row small{display:none}
.viewport:has(#loot-toasts:not(:empty)) .maplabel{visibility:hidden}
#map-panel{pointer-events:auto;cursor:zoom-in;touch-action:manipulation}
#map-panel *{touch-action:manipulation}
#map-panel:focus-visible{outline:2px solid #dfb970;outline-offset:2px}
#dungeon-map-dialog[open]{display:flex;flex-direction:column;gap:10px;width:min(850px,calc(100dvw - 24px));height:min(760px,calc(100dvh - 24px));max-width:none;max-height:none;overflow:hidden;padding:14px;border:1px solid #c3aa71;border-radius:10px;background:#11282d;color:#eee2c7}
#dungeon-map-dialog::backdrop{background:#07121bd9}
.expanded-map-header{flex:none;padding:0 0 8px;gap:12px}.expanded-map-header h2{font:normal 20px sans-serif;margin:0}.expanded-map-header button{min-height:44px;touch-action:manipulation}
.expanded-map-stage{position:relative;flex:1;min-height:0;background:#0b1d23;border:1px solid #c3aa7144;border-radius:5px;overflow:hidden}
.expanded-map-stage canvas{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto;object-fit:contain}
.expanded-map-legend{flex:none;margin:0;font:12px/1.6 sans-serif;color:#e1d6b4}.expanded-map-legend small{font:10px sans-serif;letter-spacing:0}
body.manual-landscape #dungeon-map-dialog[open]{width:calc(100dvh - 24px);height:calc(100dvw - 24px)}

/* Every inventory surface, including item buttons, must permit native panning. */
#gear-dialog,#gear-dialog *{touch-action:manipulation}
#gear-dialog .inventory-compact,#gear-dialog .inventory-detail{-webkit-overflow-scrolling:touch;overscroll-behavior:contain;scrollbar-width:thin}
#gear-dialog .inventory-detail{min-width:0;overflow-wrap:anywhere}
.item-description{font:12px/1.8 sans-serif;color:#d2ddc7;margin:4px 0 8px}
.journey-dialog{width:min(500px,calc(100dvw - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:22px;border:1px solid #c3aa71;border-radius:10px;background:#142c31;color:#eee2c7;font:14px/1.8 sans-serif}
.journey-dialog::backdrop{background:#07121be0}.journey-dialog h2{font-size:20px;line-height:1.5;margin:0 0 12px}.journey-dialog p{margin:8px 0}.journey-dialog form{display:flex;flex-direction:column;gap:10px}.journey-dialog input{width:100%;min-height:48px;font:18px sans-serif;padding:10px;background:#0d2029;color:#fff0ca;border:1px solid #9eab7a;border-radius:5px}.journey-dialog button{min-height:48px;touch-action:manipulation}.journey-actions{display:flex;gap:12px;margin-top:16px}.journey-actions button{flex:1}.journey-error{color:#ffcfaa}#stairs-open[hidden]{display:none}
body.wide-inventory #gear-dialog .item-description{font-size:11px;line-height:1.6}
@media(max-width:600px){
 body:not(.wide-inventory) #gear-dialog[open]{display:flex;flex-direction:column;width:calc(100dvw - 24px);height:calc(100dvh - 24px);max-height:none;overflow:hidden;padding:12px;gap:8px}
 body:not(.wide-inventory) #gear-dialog .gear-header{position:static;flex:none;padding:0 0 7px}
 body:not(.wide-inventory) #gear-dialog .gear-header .eyebrow{display:none}
 body:not(.wide-inventory) #gear-dialog .inventory-overview{display:grid;grid-template-columns:120px minmax(0,1fr);gap:8px;height:125px;min-height:0;flex:none;margin:0}
 body:not(.wide-inventory) #gear-dialog .inventory-overview .loadout-figure{height:125px;grid-template-rows:85px auto;padding:0}
 body:not(.wide-inventory) #gear-dialog .inventory-overview .loadout-body{width:76px;height:85px}
 body:not(.wide-inventory) #gear-dialog #gear-totals{padding:6px;margin:0;gap:2px}
 body:not(.wide-inventory) #gear-dialog .stat-value{font-size:16px}
 body:not(.wide-inventory) #gear-dialog .stat-label{font-size:9px}
 body:not(.wide-inventory) #gear-ground{display:flex;flex-direction:column;flex:1;min-height:0}
 body:not(.wide-inventory) #gear-dialog .inventory-heading{flex:none;margin:0 0 5px}
 body:not(.wide-inventory) #gear-dialog .inventory-tabs{flex:none;margin:0 0 8px}
 body:not(.wide-inventory) #gear-dialog .inventory-layout{flex:1;min-height:0;grid-template-rows:minmax(100px,1fr) minmax(160px,1fr);gap:8px;align-items:stretch}
 body:not(.wide-inventory) #gear-dialog .inventory-compact{height:100%;max-height:none;min-height:0}
 body:not(.wide-inventory) #gear-dialog .inventory-detail{position:static;min-height:0;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:5px}
 body:not(.wide-inventory) #gear-dialog .inventory-detail p{margin:0;font-size:11px}
 body:not(.wide-inventory) #gear-dialog .inventory-detail>button{position:sticky;bottom:0;flex:none;min-height:44px;margin-top:auto;box-shadow:0 -4px 10px #0f2529}
 body:not(.wide-inventory) #gear-dialog .gear-rule{display:none}
 body:not(.wide-inventory) #gear-feedback{flex:none;min-height:0;max-height:28px;margin:0;padding-top:3px;overflow:auto;font-size:10px}
}

#home-inventory{border-color:#bdab6a;background:#485c3a;touch-action:manipulation;white-space:nowrap;flex:none}
#home-rest-notice{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);width:max-content;max-width:calc(100% - 24px);margin:0;padding:10px 14px;background:#152e27ee;border:1px solid #b7c986;border-radius:7px;color:#e6f5bb;font:600 14px/1.6 sans-serif;text-align:center;pointer-events:none}
#home-rest-notice[hidden]{display:none}
@media(max-width:600px){#home-dialog .home-header>div{flex:1;min-width:0}#home-dialog .home-header h2{font-size:15px;letter-spacing:0}#home-dialog .home-header .eyebrow{display:none}#home-dialog .home-header button{min-width:0;min-height:40px;padding:6px;font-size:10px}#home-dialog .home-header{flex-wrap:wrap;gap:5px}#home-rest-notice{font-size:12px}}

/* Shared category controls keep equipment and consumables easy to compare. */
.item-filter-tabs{display:flex;gap:6px;flex:none;margin:0 0 8px;min-width:0}.item-filter-tabs button{flex:1;min-height:44px;padding:7px 9px;font:12px sans-serif;touch-action:manipulation;white-space:nowrap}.item-filter-tabs button[aria-pressed=true]{background:#606b45;color:#ffe6aa;border-color:#cbb473}
#home-dialog.is-storage #storage-filters{display:flex}
.town-item-tools{display:flex;flex:none;align-items:center;gap:10px}.town-item-tools .item-filter-tabs{flex:1;margin:0}.town-item-tools>span{font:10px sans-serif;color:#d2c497;white-space:nowrap}.town-commerce.is-bank .town-item-tools{display:none}
#town-goods .town-good.is-protected{opacity:.7;border-left:3px solid #c5ad76;background:#454a352b}#town-goods .town-good.is-protected small{color:#e5c984}
.trade-item-stats{font:600 12px sans-serif;color:#e7d49e}.storage-item-summary{display:block;font:10px/1.6 sans-serif;color:#b6c9b9;margin-top:4px}
body.wide-inventory #home-dialog.is-commerce .town-commerce{gap:6px}
@media(max-width:600px){.town-item-tools{gap:6px}.item-filter-tabs{gap:4px}.item-filter-tabs button{padding:7px 4px;font-size:11px}.town-item-tools>span{font-size:9px}#home-dialog.is-storage #storage-filters{margin:0 0 5px}}
/* A short landscape screen uses rows rather than stacked action buttons. */
body.wide-inventory #home-dialog.is-storage .home-picture{display:none}
body.wide-inventory #home-dialog.is-storage .home-room{grid-template-columns:minmax(0,1fr) auto}
body.wide-inventory #home-dialog.is-storage .home-storage-title{display:none}
body.wide-inventory #home-dialog.is-storage .home-item{grid-template-columns:24px minmax(0,1fr) 60px 60px;gap:5px;padding:6px;align-items:center}
body.wide-inventory #home-dialog.is-storage .home-item button{grid-column:auto;width:60px;min-width:0;min-height:44px;padding:6px 3px;font-size:10px}

#gear-dialog .gear-effect{font:600 11px/1.6 sans-serif;color:#d5e9a9;border-left:2px solid #a5c17b;padding-left:7px}
/* Smith counter shares the shop entrance and keeps its own scrolling panes. */
.forge-pane{display:none}.town-commerce.is-forge .forge-pane{display:flex;flex:1;min-height:0;flex-direction:column;gap:10px}.town-commerce.is-forge :is(.town-trade-layout,.town-item-tools){display:none}.forge-intro{display:flex;align-items:center;gap:14px;background:linear-gradient(115deg,#3a2b21,#172e32);border:1px solid #b5925a77;border-radius:8px;padding:12px 16px}.forge-intro>span{font-size:34px;color:#e4bb77}.forge-intro h3{margin:0 0 5px;color:#f1d19a;font-size:20px}.forge-intro p{margin:0;color:#d2c9b2;font:12px/1.6 sans-serif}.forge-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);flex:1;min-height:0;gap:12px}.forge-layout>section{min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;border:1px solid #8c9d8a55;border-radius:7px;background:#10272e;padding:12px}#forge-items{display:flex;flex-direction:column;gap:8px}#forge-items button{display:flex;flex-direction:column;text-align:left;gap:6px;flex:none;min-height:64px;padding:12px}#forge-items small{font:11px/1.5 sans-serif;color:#c4cbb6}#forge-quote h3{font-size:19px;color:#f1d19a;margin:0 0 16px}#forge-quote p{font:13px/1.8 sans-serif}#forge-quote .forge-change{font-size:18px;color:#f1d19a}#forge-confirm{width:100%;min-height:52px;background:#78603b;color:#fff0c6;border-color:#c2a36c}#forge-confirm:disabled{opacity:.45}#forge-feedback{min-height:20px;margin:0;color:#f3d99d;font:12px/1.6 sans-serif}.town-commerce.is-forge #town-feedback{display:none}
@media(max-width:600px) and (orientation:portrait){.forge-layout{grid-template-columns:1fr;grid-template-rows:minmax(100px,.8fr) minmax(170px,1fr)}.forge-intro{padding:8px}.forge-intro h3{font-size:16px}.forge-intro p{font-size:10px}#forge-quote h3{margin-bottom:6px}#forge-quote p{margin:7px 0}}
body.wide-inventory .forge-intro{padding:6px 12px}body.wide-inventory .forge-intro h3{font-size:15px}body.wide-inventory .forge-intro p{font-size:10px}body.wide-inventory .forge-layout{gap:8px}body.wide-inventory #forge-quote h3{margin-bottom:5px;font-size:16px}body.wide-inventory #forge-quote p{margin:5px 0;font-size:11px}body.wide-inventory #forge-quote .forge-change{font-size:16px}body.wide-inventory #forge-items button{min-height:54px;padding:8px}body.wide-inventory #forge-confirm{min-height:44px;padding:8px}
body.wide-inventory .forge-layout{grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
body.wide-inventory .forge-intro{flex:none}body.wide-inventory #forge-feedback{font-size:10px;line-height:1.4;min-height:14px;max-height:28px;overflow:auto}
/* Product art uses the same sprite atlas as pickups and the inventory. */
.shop-item-art,.shop-detail-art{display:block;background-size:200% 200%;background-repeat:no-repeat;image-rendering:pixelated;flex:none}.shop-item-art{width:48px;height:48px;grid-column:1;grid-row:1/3}.shop-detail-art{width:88px;height:88px;align-self:center}.town-good{display:grid;grid-template-columns:48px minmax(0,1fr) auto;column-gap:12px;align-items:center}.town-good>strong{grid-column:2;grid-row:1}.town-good>small{grid-column:2;grid-row:2}.town-good>span:not(.shop-item-art){grid-column:3;grid-row:1/3}.town-good>strong,.town-good>small{min-width:0}
.furniture-shop{display:none}#home-dialog.is-furniture .furniture-shop{display:flex;flex:1;min-height:0;flex-direction:column;gap:10px;margin-top:10px}#home-dialog.is-furniture :is(.house-walk,.home-layout,.town-commerce,#home-feedback){display:none}.furniture-welcome{font:12px/1.7 sans-serif;color:#cfceb5;margin:0}#furniture-wallet{font:18px monospace;color:#f3d99c;margin:0}.furniture-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);flex:1;min-height:0;gap:12px}.furniture-layout>section{overflow:auto;min-height:0;overscroll-behavior:contain;touch-action:pan-y;padding:12px;background:#10272e;border:1px solid #92a89555;border-radius:8px}#furniture-goods{display:flex;flex-direction:column;gap:10px}#furniture-goods button{display:grid;grid-template-columns:88px minmax(0,1fr);text-align:left;align-items:center;column-gap:12px;padding:10px;flex:none;min-height:108px}#furniture-goods button[aria-pressed=true]{border-color:#d7ba78;background:#465543}#furniture-goods .furniture-art{grid-row:1/3}#furniture-goods small{font:12px sans-serif;color:#d6c89b}.furniture-art{display:block;width:88px;height:88px;background-image:url('assets/furniture-shop-v2.webp');background-size:200% 200%;background-repeat:no-repeat;image-rendering:pixelated}#furniture-detail>.furniture-art{width:144px;height:144px;margin:auto}#furniture-detail h3{font-size:22px;color:#f0d49d}#furniture-detail p{font:13px/1.8 sans-serif;color:#d3d8c2}#furniture-confirm{min-height:50px;width:100%;background:#646e48;color:#fff0bc}#furniture-confirm:disabled{opacity:.45}#furniture-feedback{min-height:20px;margin:0;font:12px/1.5 sans-serif;color:#f3d99c}
#home-dialog.is-furniture,#home-dialog.is-furniture *{touch-action:manipulation}
@media(max-width:600px) and (orientation:portrait){body:not(.wide-inventory) .furniture-layout{grid-template-columns:1fr;grid-template-rows:minmax(130px,1fr) minmax(200px,1.4fr)}body:not(.wide-inventory) #furniture-goods button{grid-template-columns:64px minmax(0,1fr);min-height:80px;padding:6px}body:not(.wide-inventory) #furniture-goods .furniture-art{width:64px;height:64px}body:not(.wide-inventory) #furniture-detail>.furniture-art{width:100px;height:100px}body:not(.wide-inventory) #furniture-detail h3{font-size:17px;margin:6px 0}body:not(.wide-inventory) #furniture-detail p{font-size:11px;margin:6px 0}}
body.wide-inventory .shop-item-art{width:36px;height:36px}body.wide-inventory .town-good{grid-template-columns:36px minmax(0,1fr) auto;column-gap:8px}body.wide-inventory .shop-detail-art{width:56px;height:56px}body.wide-inventory .furniture-layout{grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr)}body.wide-inventory #furniture-detail>.furniture-art{width:90px;height:90px}body.wide-inventory #furniture-detail h3{font-size:16px;margin:6px 0}body.wide-inventory #furniture-detail p{font-size:11px;margin:5px 0}body.wide-inventory .furniture-welcome{font-size:10px}body.wide-inventory #furniture-goods button{grid-template-columns:64px minmax(0,1fr);min-height:80px;padding:6px}body.wide-inventory #furniture-goods .furniture-art{width:64px;height:64px}
.town-good>.shop-item-art{grid-column:1;grid-row:1/3}
.release-update[hidden]{display:none!important}.release-update{display:flex;flex:none;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px;border:1px solid #d2b871;background:#35493b;color:#f9e9b8;font:12px/1.5 sans-serif;border-radius:7px}.release-update button{min-height:44px;padding:7px 12px;white-space:nowrap}
.room-editor[hidden]{display:none}.room-editor{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:8px;background:#183337;border:1px solid #bda26b77;border-radius:6px}.room-editor label{display:flex;align-items:center;gap:6px}.room-editor :is(button,select){min-height:44px;font-size:13px}.room-editor small{flex-basis:100%;font-size:11px;color:#d7dfca}#home-dialog .house-walk-bar{flex-wrap:wrap}#housing-sign-plot{min-height:44px;max-width:100%;background:#16343d;color:#f1dfbc}
body.wide-inventory .room-editor{padding:4px;gap:5px}body.wide-inventory .room-editor small{font-size:10px}
#home-dialog.is-decorating .house-walk-bar,#home-dialog.is-decorating .house-caption{display:none}
@media(max-width:600px) and (orientation:portrait){#home-dialog .house-walk-bar p{flex:1 0 100%;margin:0;font-size:11px;line-height:1.5}#home-dialog .house-walk-bar button{flex:1;min-width:0}}
#loot-toasts .receipt-row .receipt-comparison{display:block;color:#d6ebd1;font-size:10px;line-height:1.4;margin:3px 0 0}.last-loot>span{flex-wrap:wrap}
.adventure-reset-note{margin:5px 0 0;font:11px/1.5 sans-serif;color:#d7d8bd;flex:none}body.wide-inventory .adventure-reset-note{font-size:10px;margin:3px 0 0}
