#mobileNav,#mobileSpeed,#mobileShopClose,#mobileApplyRelic{display:none}
#settingsActions{display:grid;gap:12px;margin-top:20px}#settingsActions button{width:100%;height:auto;min-height:48px;padding:12px;border-radius:8px;background:#263e43;color:#f5e8cd;font-size:16px}#settingsDialog p{margin-top:12px;line-height:1.5}#settingsActions #resetBtn{background:#722f39}
@media(max-width:760px){
 :root{--mobile-left:96px;--mobile-right:78px}
 #forgeToggle,#managersBtn,.player-column>.relic-area,#boostBtn,.speed-track,#speedFlare{display:none!important}
 .layout{height:100dvh}.player-column{display:contents}
 .player-column .player-info{position:fixed;top:0;left:0;right:0;height:64px;min-height:0;padding:5px 48px 4px 8px;border:0;border-radius:0;background:#d9eef2de;display:grid;grid-template-columns:1fr 1fr;gap:1px;z-index:9}
 .player-info .wallet{padding:0;gap:4px}.player-info .gold-total{font-size:21px}.player-info #goldRate{display:none}.player-info .currencies{position:static;justify-content:flex-end;font-size:12px;gap:10px}.player-info .stats-grid{grid-column:1/3;display:grid;grid-template-columns:repeat(4,1fr);gap:4px;padding:1px 0}.stats-grid span{font-size:7px}.stats-grid strong{font-size:12px;margin:0}.player-info .player-toolbar{position:absolute;top:8px;left:auto;right:5px}.player-info #settingsBtn{width:38px;height:38px;font-size:23px;background:#233d48;color:#fff;border-radius:9px}.player-info .durability-line,.player-info .durability-track{display:none}
 .operation,.motherlode .operation{position:fixed;top:118px;bottom:124px;left:var(--mobile-left);right:var(--mobile-right);width:auto;height:auto;padding:0;gap:3px;justify-content:flex-start;align-items:center;overflow:visible}
 .board,.mine-viewport{transform:none;flex-shrink:0}.board{height:calc(var(--cell)*3)}.mine-viewport{height:calc(var(--cell)*7)}
 .player-column>.board-actions{position:fixed;top:70px;left:calc(var(--mobile-left) + 2px);right:8px;width:auto;display:block;min-height:42px;z-index:10}.player-column>.board-actions #spawnBtn{width:100%;min-height:42px;height:42px;padding:6px 18px}.player-column>.board-actions #spawnBtn b{font-size:15px}.player-column>.board-actions #spawnBtn small{font-size:8px}
 .blacksmith:not(.mobile-vendor){position:fixed;top:70px;left:3px;bottom:auto;width:88px;height:260px;min-width:0;padding:3px;gap:3px;transform:none;border:0;border-radius:8px;background:#090b10;z-index:11;overflow:hidden}
 .blacksmith:not(.mobile-vendor) .forge-brand{display:block;font-size:9px;line-height:1.1;text-align:center}.blacksmith:not(.mobile-vendor) .forge-brand span{display:block;font-size:7px;margin-top:2px}.blacksmith:not(.mobile-vendor) .smith-scene{display:block;height:66px;min-height:66px}.blacksmith:not(.mobile-vendor) .smith-scene:after{width:86px;height:66px;left:50%;transform:translateX(-50%)}.blacksmith:not(.mobile-vendor) .forge-title{display:block;font-size:11px;text-align:center}.blacksmith .vendor-tabs{display:none!important}
 .blacksmith:not(.mobile-vendor) #upgrades{flex:none;min-height:0;overflow:visible}.blacksmith:not(.mobile-vendor) .next-upgrade{width:82px;height:112px;min-height:0;max-height:none;padding:4px;gap:2px;border-radius:7px;display:flex;flex-direction:column;justify-content:center}.blacksmith:not(.mobile-vendor) .upgrade-art{width:36px;height:32px;min-height:32px;flex:none;margin:0}.blacksmith:not(.mobile-vendor) .next-label,.blacksmith:not(.mobile-vendor) .next-upgrade p{display:none}.blacksmith:not(.mobile-vendor) .next-upgrade b{font-size:10px;line-height:1.05}.blacksmith:not(.mobile-vendor) .next-upgrade small{font-size:8px}.blacksmith:not(.mobile-vendor) .next-upgrade strong{font-size:8px;line-height:1.1}.blacksmith:not(.mobile-vendor) .next-upgrade em{font-size:11px;min-height:18px;padding:2px 5px;margin:0}.blacksmith:not(.mobile-vendor) #buyAllSmith{font-size:9px;min-height:25px;padding:4px;margin:0}
 .blacksmith.mobile-vendor{position:fixed;inset:70px 8px 66px;width:auto;transform:none;padding:35px 16px 12px;z-index:40;border:1px solid #cbb173;border-radius:12px}.blacksmith.mobile-vendor #mobileShopClose{display:block;position:absolute;right:8px;top:5px;font-size:25px;background:none;color:white;width:40px;height:32px}.blacksmith.mobile-vendor .next-upgrade{min-height:220px}.blacksmith.mobile-vendor .smith-scene{height:80px;min-height:60px}.blacksmith.mobile-vendor .upgrade-art{max-height:130px}
 #mobileNav{display:flex;position:fixed;inset:auto 0 0;height:calc(56px + env(safe-area-inset-bottom));padding:5px 4px calc(5px + env(safe-area-inset-bottom));background:#07090d;border-top:1px solid #55524a;gap:4px;z-index:30;align-items:stretch}#mobileNav button{flex:1;min-width:0;padding:5px 2px;background:#202a35;color:#eddfbd;border:1px solid #4e5863;border-radius:7px;font-size:10px;font-weight:bold}
 #mobileSpeed{display:flex;position:fixed;right:3px;top:43dvh;width:72px;align-items:center;flex-direction:column;pointer-events:none;z-index:12;filter:drop-shadow(0 2px 2px #50341d)}#mobileSpeed small{font-size:8px;font-weight:bold;color:#fff5b5;letter-spacing:1px}#mobileSpeed b{display:flex;align-items:center;transform:rotate(-8deg);height:40px}#mobileSpeed .speed-digit{width:17px;height:28px;flex-shrink:0}#mobileSpeed .decimal,#mobileSpeed .times{font:bold italic 19px sans-serif;color:#ffe672}#mobileSpeed[data-tier='2']{filter:drop-shadow(0 0 5px #ffbd34) hue-rotate(-15deg)}#mobileSpeed[data-tier='3']{filter:drop-shadow(0 0 7px #ff6534) hue-rotate(-30deg)}#mobileSpeed[data-tier='4']{filter:drop-shadow(0 0 9px #59daff) hue-rotate(-35deg)}
 .player-column .spells{position:fixed;left:auto;right:3px;bottom:calc(64px + env(safe-area-inset-bottom));width:88px;height:96px;min-height:0;margin:0;padding:5px;display:flex;flex-direction:column;gap:3px;z-index:15;border-radius:9px}.spells h2{font-size:11px}.spells button{font-size:9px;min-height:28px;padding:3px;line-height:1.1}.spells small,#blessingUpgrade{display:none!important}.spells #transferTarget{font-size:8px;min-height:20px}.spells:has(#transferTarget:not([hidden])){height:120px}
 .run-dock.board-actions{position:fixed;bottom:calc(64px + env(safe-area-inset-bottom));left:var(--mobile-left);right:96px;width:auto;min-height:45px;z-index:15}.run-dock #playBtn{min-height:45px;height:45px;padding:5px}.run-dock #playBtn b{font-size:14px}.run-dock #returnBtn:not([hidden]){display:block!important;min-height:45px;font-size:14px}
 .excavator-strip{position:fixed;left:3px!important;z-index:10}.excavator-strip #motherMulti{height:38px;top:-41px;padding:3px}.excavator-strip #motherMulti b{font-size:19px}.excavator-strip #motherMulti span{font-size:8px}.excavator-strip #motherMulti small{display:none}.excavator-strip #motherMulti:before{inset:-2px}.excavator-stat b{font-size:13px}.excavator-stat span{font-size:7px}#motherControls{gap:2px;padding-top:2px}#motherControls #excavatorService{min-height:38px;font-size:8px;padding:6px 18%}
 #managerPanel{position:fixed!important;inset:70px 5px 64px!important;width:auto;max-height:none;padding:10px;z-index:45}#managerOptions{grid-template-columns:1fr}.manager-card b{font-size:16px}.manager-card p{font-size:12px}.manager-card small{font-size:11px}.manager-card [data-manager]{font-size:12px;min-height:35px}.manager-portrait{height:85px;flex-basis:72px}#managerPanel h2{font-size:23px}
 #mobileApplyRelic{display:block;background:#345547;color:#fff0be;padding:12px;border-radius:7px;margin:12px 0;width:100%}#tileInspector{bottom:165px;right:4px;max-width:250px}#transferGuide{position:fixed;top:112px;left:96px;right:4px;font-size:11px}#centerConfirm{max-width:80vw;font-size:13px}
}
@media(max-width:760px){
 .blacksmith:not(.mobile-vendor){height:230px}
 .blacksmith:not(.mobile-vendor) .smith-scene:after{position:absolute;top:0}
 .blacksmith:not(.mobile-vendor) .next-upgrade{height:82px;min-height:82px;flex:none;padding:3px;gap:1px}
 .blacksmith:not(.mobile-vendor) .upgrade-art{width:25px;height:20px;min-height:20px}
 .blacksmith:not(.mobile-vendor) .next-upgrade em{min-width:0;min-height:14px;font-size:10px;padding:1px 4px}
 .blacksmith:not(.mobile-vendor) .next-upgrade b{font-size:9px}
 .blacksmith:not(.mobile-vendor) #buyAllSmith{flex:none;min-height:25px;font-size:9px}
 .player-column .spells{height:88px}
 .player-column .spells h2{display:none}
}
#settingsDialog #saveState{display:block;font-size:12px;color:#b5c8c5;text-align:center}
@media(max-width:760px){
 :root{--mobile-right:4px}
 .blacksmith:not(.mobile-vendor){top:64px;bottom:56px;height:auto;width:92px;border-radius:0;padding-bottom:102px}
 .player-column .spells{left:5px;right:auto;bottom:64px;width:82px;height:88px;border:1px solid #4c5b65;background:#182430}
 .operation,.motherlode .operation{right:4px;bottom:119px}
 #mobileSpeed{right:10px;top:42dvh;opacity:.92}
 .run-dock.board-actions{right:8px;bottom:64px}
 .excavator-strip{display:none!important}
 body.motherlode-view .excavator-strip{display:block!important;position:fixed;top:108px!important;bottom:236px;left:8px!important;width:calc(100vw - 16px)!important;height:auto!important;z-index:31}
 body.motherlode-view .excavator-strip canvas{width:100%;height:100%;max-width:none;aspect-ratio:auto;touch-action:none}
 body.motherlode-view .board,body.motherlode-view .mine-viewport,body.motherlode-view .run-dock,body.motherlode-view .player-column>.board-actions,body.motherlode-view #mobileNav,body.motherlode-view .spells,body.motherlode-view #mobileSpeed{display:none!important}
 body.motherlode-view #motherBack{display:block;position:fixed;top:68px;right:8px;z-index:45;background:#172c35;color:#fff2c6;border:1px solid #b29b6d;padding:10px;border-radius:8px;font-size:13px}
 body.motherlode-view .excavator-strip #motherMulti{width:120px;right:auto;top:-40px;height:38px}
 body.motherlode-view #motherControls{position:fixed;top:auto;bottom:184px;left:8px;right:8px;display:grid;grid-template-columns:110px 1fr;gap:6px;height:48px}
 body.motherlode-view #motherControls #excavatorStatus{grid-template-columns:repeat(4,1fr);gap:3px}
 body.motherlode-view .blacksmith{position:fixed!important;inset:auto 0 0!important;width:100%!important;height:178px!important;z-index:35;padding:8px!important;display:grid;grid-template-columns:1fr 100px;gap:8px}
 body.motherlode-view .blacksmith .forge-brand,body.motherlode-view .blacksmith .smith-scene,body.motherlode-view .blacksmith .forge-title{display:none!important}
 body.motherlode-view .blacksmith #upgrades{grid-column:1;grid-row:1;min-width:0}
 body.motherlode-view .blacksmith .next-upgrade{height:160px;min-height:0;width:100%;display:grid;grid-template-columns:70px 1fr;grid-template-rows:repeat(4,1fr);padding:8px;gap:3px;text-align:left}
 body.motherlode-view .blacksmith .next-upgrade .upgrade-art{grid-column:1;grid-row:1/5;width:68px;height:90px}
 body.motherlode-view .blacksmith .next-upgrade b{font-size:16px}body.motherlode-view .blacksmith .next-upgrade small{font-size:12px}body.motherlode-view .blacksmith .next-upgrade strong{font-size:12px}body.motherlode-view .blacksmith .next-upgrade em{font-size:16px;justify-self:start}
 body.motherlode-view #buyAllSmith{grid-column:2;grid-row:1;align-self:stretch;font-size:14px!important}
}

/* Keep each phone shop in its own layout box. Old fixed card heights let
   centered text escape upward into the portrait when a longer card appeared. */
@media(max-width:760px){
 #forgePanel .forge-brand,#forgePanel .forge-title,#forgePanel #vendorLevel,#forgePanel #buyAllSmith{flex-shrink:0}
 #forgePanel #upgrades{height:auto;min-height:0;min-width:0;flex:1 1 0;overflow:hidden}
 #forgePanel .next-upgrade{height:100%;min-height:0;max-height:100%;min-width:0;flex:1 1 0;overflow:hidden;justify-content:flex-start;gap:5px}
 #forgePanel .next-upgrade>:not(.upgrade-art){min-width:0;max-width:100%;flex-shrink:0;overflow-wrap:anywhere}
 #forgePanel:not(.mobile-vendor) .next-upgrade{padding:7px 4px}
 #forgePanel:not(.mobile-vendor) .next-upgrade .upgrade-art{width:44px;height:36px;min-height:0;flex:0 1 36px}
 #forgePanel:not(.mobile-vendor) .next-upgrade b{line-height:1.2;hyphens:auto}
 #forgePanel:not(.mobile-vendor) .next-upgrade strong{line-height:1.25}
 #forgePanel:not(.mobile-vendor) .next-upgrade em{margin-top:auto;min-height:24px;padding:4px;line-height:1.2}
 #forgePanel #vendorLevel{overflow-wrap:anywhere;line-height:1.25}
 #forgePanel.mobile-vendor .next-upgrade{padding:12px;gap:8px}
 #forgePanel.mobile-vendor .smith-scene{display:flex}
 #forgePanel.mobile-vendor .forge-title{display:block;text-align:center}
 #forgePanel.mobile-vendor .next-label{display:none}
 #forgePanel.mobile-vendor .next-upgrade .upgrade-art{height:130px;min-height:0;flex:1 1 130px;max-height:130px;width:150px}
 #forgePanel.mobile-vendor .next-upgrade b{font-size:22px!important;line-height:1.15}
 #forgePanel.mobile-vendor .next-upgrade strong{font-size:16px!important;line-height:1.25}
 #forgePanel.mobile-vendor .next-upgrade p{font-size:14px;line-height:1.35;margin:0}
 #forgePanel.mobile-vendor .next-upgrade em{margin-top:auto;min-height:36px;padding:7px;font-size:18px}
 body.motherlode-view #forgePanel{grid-template-rows:minmax(0,1fr) auto;gap:4px 8px}
 body.motherlode-view #forgePanel #upgrades{height:100%}
 body.motherlode-view #forgePanel #vendorLevel{grid-column:1/-1;grid-row:2;padding:0}
 body.motherlode-view #forgePanel .next-upgrade{grid-template-columns:48px minmax(0,1fr);grid-template-rows:auto auto auto;align-content:center;padding:6px;gap:3px 5px}
 body.motherlode-view #forgePanel .next-upgrade .upgrade-art{grid-column:1;grid-row:1/4;width:44px;height:60px}
 body.motherlode-view #forgePanel .next-upgrade b,body.motherlode-view #forgePanel .next-upgrade strong,body.motherlode-view #forgePanel .next-upgrade em{grid-column:2}
 body.motherlode-view #forgePanel .next-upgrade em{margin:0;min-height:22px;padding:3px}
}
@media(max-width:760px) and (max-height:680px){
 #forgePanel:not(.mobile-vendor) .forge-brand a{height:24px}
 #forgePanel:not(.mobile-vendor) .smith-scene{height:42px;min-height:42px}
 #forgePanel:not(.mobile-vendor) .smith-scene:after{width:60px;height:42px}
 #forgePanel:not(.mobile-vendor) .next-upgrade{padding:5px 4px;gap:3px}
 #forgePanel:not(.mobile-vendor) .next-upgrade .upgrade-art{display:none}
 #forgePanel.mobile-vendor .forge-brand,#forgePanel.mobile-vendor .next-upgrade .upgrade-art{display:none}
 #forgePanel.mobile-vendor .smith-scene{height:44px;min-height:44px}
 #forgePanel.mobile-vendor .smith-scene:after{width:66px;height:44px}
}
