.touch-field-menu{display:none}
@media(any-pointer:coarse){
 body.mobile-play{position:fixed;inset:0;touch-action:none}
 .mobile-play #world{touch-action:none}
 .mobile-play .pad,.mobile-play .mobile-attack,.mobile-play .mobile-actions-toggle{display:none!important}
 .mobile-play .game-menu-button,.mobile-play .touch-field-menu,.mobile-play .game-settings-button,.mobile-play .mobile-camera-toggle,.mobile-play .mobile-inventory-toggle{display:grid;place-items:center;position:fixed;top:calc(8px + env(safe-area-inset-top));bottom:auto;right:auto;transform:none;translate:none;scale:1;width:40px;height:40px;min-height:40px;padding:4px;max-width:none;border:1px solid #ffffff40;border-radius:50%;background:#172c31db;color:white;font-size:23px;z-index:30;touch-action:manipulation}
 .mobile-play .game-menu-button{left:calc(8px + env(safe-area-inset-left))}
 .mobile-play .game-menu-button img{width:30px;height:30px}
 .mobile-play .touch-field-menu{left:calc(54px + env(safe-area-inset-left))}
 .mobile-play .game-settings-button{left:calc(100px + env(safe-area-inset-left))}
 .mobile-play .mobile-camera-toggle{left:calc(146px + env(safe-area-inset-left))}
 .mobile-play .mobile-inventory-toggle,.mobile-play.mobile-inventory-open .mobile-inventory-toggle{left:calc(192px + env(safe-area-inset-left));top:calc(8px + env(safe-area-inset-top));bottom:auto;max-width:none;z-index:30}
 .mobile-play .mission-button{left:auto;right:calc(8px + env(safe-area-inset-right));top:calc(8px + env(safe-area-inset-top));width:min(150px,25vw);max-width:25vw;font-size:10px;height:40px;min-height:40px;z-index:20}
 .mobile-play .game-hud-stack{top:calc(56px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));width:min(240px,48vw);max-width:48vw}
 .mobile-play .play-status{top:calc(84px + env(safe-area-inset-top));max-width:calc(100vw - 24px);font-size:10px}
 .mobile-play .day-night-badge,.mobile-play .meadow-power-hud{display:none!important}
 .mobile-play .actions{display:flex;align-items:end;right:calc(18px + env(safe-area-inset-right));bottom:calc(18px + env(safe-area-inset-bottom));gap:10px;scale:1;translate:none;z-index:20}
 .mobile-play .actions button{display:none!important}
 .mobile-play .actions #up{display:block!important;width:72px;height:72px;min-height:72px;border-radius:50%;background:#21352e66;color:#fff4d6;border:3px solid #fff4d680;box-shadow:0 0 0 4px #20342e44;font-size:32px;padding:0}
 .mobile-play.touch-build-selected .actions #place,.mobile-play.touch-build-selected .actions #break{display:block!important;width:54px;height:44px;min-height:44px;border-radius:12px;background:#203a32bb;color:white;font-size:11px}
 .mobile-play .mobile-use{right:calc(25px + env(safe-area-inset-right));bottom:calc(106px + env(safe-area-inset-bottom));width:58px;min-height:40px;background:#21352e99;color:white;border-radius:16px;font-size:11px}
 .mobile-play .boss-powers{bottom:calc(24px + env(safe-area-inset-bottom));left:50%;max-width:40vw;transform:translateX(-50%)}
 .mobile-play .boss-powers button{width:48px;height:44px;font-size:10px}
 .mobile-play .meadow-fire-button{bottom:calc(157px + env(safe-area-inset-bottom))}
 .mobile-play .forage-badge{bottom:calc(115px + env(safe-area-inset-bottom))}
 .mobile-play .toast{bottom:calc(165px + env(safe-area-inset-bottom));max-width:65vw}
 .mobile-play .map-dock:not(.collapsed){top:calc(114px + env(safe-area-inset-top))!important}
 .mobile-play.mobile-inventory-open .inventory-nav{bottom:calc(78px + env(safe-area-inset-bottom));max-width:calc(100vw - 32px)}
 body.mobile-play:has(#modal:not(.hidden)) .touch-field-menu,body.mobile-play:has(#modal:not(.hidden)) .mobile-camera-toggle,body.mobile-play:has(#modal:not(.hidden)) .mobile-inventory-toggle{display:none}
}
@media(any-pointer:coarse) and (max-width:430px){
 .mobile-play .mission-button{top:calc(56px + env(safe-area-inset-top));max-width:43vw;width:43vw}
 .mobile-play .game-hud-stack{max-width:53vw}
 .mobile-play .play-status{top:calc(102px + env(safe-area-inset-top))}
 .mobile-play .actions #up{width:64px;height:64px;min-height:64px}
}

/* Final toolbar: map and chat stay in the top row, clear of the field. */
.portal-chat-button,.map-restore{position:fixed;top:calc(8px + env(safe-area-inset-top))!important;bottom:auto!important;left:auto!important;right:calc(8px + env(safe-area-inset-right))!important;z-index:31;min-height:40px;padding:4px 9px;font-size:12px}
.portal-chat-button{right:calc(78px + env(safe-area-inset-right))!important}
:is(body:not(.mobile-play),body.mobile-play) .map-dock:not(.collapsed){left:auto!important;right:calc(8px + env(safe-area-inset-right))!important;top:calc(92px + env(safe-area-inset-top))!important;bottom:auto!important;width:min(232px,43vw)!important;max-height:calc(100dvh - 170px)!important;overflow:auto}
:is(body:not(.mobile-play),body.mobile-play) .map-dock.user-positioned:not(.collapsed){left:var(--map-left)!important;top:var(--map-top)!important;right:auto!important;bottom:auto!important;width:var(--map-width, min(232px,43vw))!important}
.map-heading{cursor:grab!important;touch-action:none}
.map-heading button{display:block!important}
.play-status,.mobile-play .play-status{left:calc(8px + env(safe-area-inset-left))!important;right:calc(8px + env(safe-area-inset-right))!important;top:calc(54px + env(safe-area-inset-top))!important;max-width:none!important;width:auto!important;min-height:28px;height:auto;max-height:36px;flex-wrap:nowrap;overflow-x:auto;background:#173b32dc;color:#fff;z-index:29}
.play-status-health{order:0!important;display:inline-flex!important;align-items:center;gap:5px;color:white}
.health-meter{display:inline-block;width:72px;height:8px;border-radius:6px;overflow:hidden;background:#702d36}
.health-meter-fill{display:block;height:100%;background:#6fe786;transition:width .2s}
@media(any-pointer:coarse){
 .mobile-play .game-menu-button{left:calc(8px + env(safe-area-inset-left))!important;width:40px;height:40px}
 .mobile-play .map-restore{display:block!important}
 .mobile-play .map-restore.hidden{display:none!important}
 .mobile-play .portal-chat-button{width:40px;height:40px;min-height:40px;font-size:22px;right:calc(54px + env(safe-area-inset-right))!important}
 .mobile-play .map-restore{width:40px;height:40px;font-size:22px}
 .mobile-play .mobile-camera-toggle{left:calc(146px + env(safe-area-inset-left));font-size:23px}
 .mobile-play #up:before{content:none}
}
@media(any-pointer:coarse) and (max-width:380px){
 .mobile-play .game-menu-button,.mobile-play .touch-field-menu,.mobile-play .game-settings-button,.mobile-play .mobile-camera-toggle,.mobile-play .mobile-inventory-toggle{width:34px;height:34px;min-height:34px}
 .mobile-play .touch-field-menu{left:calc(46px + env(safe-area-inset-left))}
 .mobile-play .game-settings-button{left:calc(84px + env(safe-area-inset-left))}
 .mobile-play .mobile-camera-toggle{left:calc(122px + env(safe-area-inset-left))}
 .mobile-play .mobile-inventory-toggle{left:calc(160px + env(safe-area-inset-left))}
}
/* In-game header matches the reference while leaving the centre open. */
.field-chat-shortcut{position:fixed;z-index:31;top:calc(8px + env(safe-area-inset-top));left:calc(254px + env(safe-area-inset-left));height:40px;padding:4px 12px;border:1px solid #ffffff70;border-radius:22px;background:#172c31dc;color:#fff;font-weight:700;touch-action:manipulation}
.field-chat-shortcut.hidden,.field-top-status.hidden{display:none!important}
.field-top-status{position:fixed;z-index:29;top:calc(8px + env(safe-area-inset-top));left:min(46vw,570px);right:calc(168px + env(safe-area-inset-right));height:84px;display:flex;align-items:flex-start;gap:8px;pointer-events:none;color:#fff;font-size:14px;font-weight:800;text-shadow:0 1px 3px #182b35}
.field-top-status>*{pointer-events:auto;background:#172c31dc;border:1px solid #ffffff57;border-radius:12px;min-height:40px;box-sizing:border-box;white-space:nowrap}
.field-player{display:grid;grid-template-columns:38px minmax(0,1fr);grid-template-rows:39px 25px;align-items:center;min-width:180px;flex:1;padding:2px 5px 4px;max-width:340px}
.field-portrait{grid-row:1;display:grid;place-items:center;width:31px;height:31px;background:#416d64;border-radius:7px}
.field-identity{overflow:hidden;text-overflow:ellipsis}
.field-health-track{grid-column:1/3;position:relative;height:23px;border-radius:8px;border:2px solid #50bbbe;background:#802b37;text-align:center;overflow:hidden}
.field-health-fill{position:absolute;inset:0 auto 0 0;background:#e34441;transition:width .2s}
.field-health-text{position:relative;line-height:19px;font-size:12px}
.field-top-status button{padding:4px 9px;background:#172c31dc;color:#fff;font:inherit;cursor:pointer}
.field-day{padding:10px 8px}
@media(any-pointer:coarse){
 .mobile-play .game-menu-button{left:calc(8px + env(safe-area-inset-left))!important}
 .mobile-play .game-settings-button{left:calc(54px + env(safe-area-inset-left))!important}
 .mobile-play .touch-field-menu{left:calc(100px + env(safe-area-inset-left))!important}
 .mobile-play .mobile-inventory-toggle,.mobile-play.mobile-inventory-open .mobile-inventory-toggle{left:calc(146px + env(safe-area-inset-left))!important;top:calc(8px + env(safe-area-inset-top))!important;bottom:auto!important;transform:none!important;display:grid!important;width:40px;height:40px;border-radius:50%;font-size:23px}
 .mobile-play .mobile-camera-toggle{left:calc(192px + env(safe-area-inset-left))!important}
 .mobile-play .field-chat-shortcut{left:calc(238px + env(safe-area-inset-left));width:40px;padding:0;font-size:21px;border-radius:50%}
 .mobile-play .field-chat-shortcut{font-size:0}.mobile-play .field-chat-shortcut:before{content:'💬';font-size:21px}
 .mobile-play .portal-chat-button{left:calc(284px + env(safe-area-inset-left))!important;right:auto!important;width:40px;height:40px;min-height:40px;padding:0;border-radius:50%}
 .mobile-play .map-restore{right:calc(8px + env(safe-area-inset-right))!important;left:auto!important;top:calc(8px + env(safe-area-inset-top))!important}
 .mobile-play .field-top-status{top:calc(55px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));right:calc(8px + env(safe-area-inset-right));height:60px;gap:5px;font-size:11px}
 .mobile-play .field-player{min-width:128px;max-width:240px;grid-template-columns:28px minmax(0,1fr);grid-template-rows:26px 16px;min-height:49px}
 .mobile-play .field-portrait{width:23px;height:23px;font-size:15px}
 .mobile-play .field-health-track{height:17px}.mobile-play .field-health-text{line-height:14px;font-size:10px}
 .mobile-play .field-top-status button,.mobile-play .field-day{padding:7px 5px;min-height:33px}
 .mobile-play .play-status{top:calc(112px + env(safe-area-inset-top))!important;max-height:26px;min-height:26px;font-size:9px;left:calc(8px + env(safe-area-inset-left))!important;right:calc(8px + env(safe-area-inset-right))!important}
 .mobile-play .play-status-health{display:none!important}
 .mobile-play .map-dock:not(.collapsed){top:calc(148px + env(safe-area-inset-top))!important;width:min(140px,28vw)!important;max-height:34dvh!important}
 .mobile-play .map-dock.user-positioned:not(.collapsed){top:var(--map-top)!important;width:var(--map-width,min(140px,28vw))!important}
 .mobile-play.mobile-inventory-open .inventory-nav{display:flex!important;position:fixed;bottom:calc(75px + env(safe-area-inset-bottom));left:50%;right:auto;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);z-index:36;background:#153833e9;pointer-events:auto}
 .mobile-play.mobile-inventory-open .bar{display:flex!important;position:fixed;bottom:calc(10px + env(safe-area-inset-bottom));left:50%;right:auto;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);height:55px;z-index:36;background:#153833e9;pointer-events:auto}
 .mobile-play.mobile-inventory-open .mobile-inventory-toggle{top:calc(8px + env(safe-area-inset-top))!important;bottom:auto!important}
}
@media(any-pointer:coarse) and (max-width:700px){.mobile-play .field-gems{display:none}.mobile-play .field-day{font-size:9px}.mobile-play .field-top-status{gap:3px}}
@media(any-pointer:coarse) and (max-width:430px){
 .mobile-play .game-menu-button,.mobile-play .game-settings-button,.mobile-play .touch-field-menu,.mobile-play .mobile-camera-toggle,.mobile-play .mobile-inventory-toggle,.mobile-play .field-chat-shortcut,.mobile-play .portal-chat-button{width:32px!important;height:32px!important;min-height:32px!important}
 .mobile-play .game-settings-button{left:calc(44px + env(safe-area-inset-left))!important}.mobile-play .touch-field-menu{left:calc(80px + env(safe-area-inset-left))!important}.mobile-play .mobile-inventory-toggle{left:calc(116px + env(safe-area-inset-left))!important}.mobile-play .mobile-camera-toggle{left:calc(152px + env(safe-area-inset-left))!important}.mobile-play .field-chat-shortcut{left:calc(188px + env(safe-area-inset-left))}.mobile-play .portal-chat-button{left:calc(224px + env(safe-area-inset-left))!important}
 .mobile-play .field-top-status{top:calc(45px + env(safe-area-inset-top))}.mobile-play .play-status{top:calc(100px + env(safe-area-inset-top))!important}.mobile-play .map-dock:not(.collapsed){top:calc(135px + env(safe-area-inset-top))!important}
}
/* Wider screens use one header row; smaller screens wrap the live stats below it. */
body:not(.mobile-play) .touch-field-menu{display:grid;place-items:center;position:fixed;top:calc(8px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));width:40px;height:40px;border-radius:50%;z-index:31;background:#172c31db;color:white;font-size:23px}
body:not(.mobile-play) .game-settings-button{left:calc(54px + env(safe-area-inset-left))!important;top:calc(8px + env(safe-area-inset-top))!important;width:40px;height:40px;border-radius:50%}
body:not(.mobile-play) .game-menu-button{left:calc(100px + env(safe-area-inset-left))!important;top:calc(8px + env(safe-area-inset-top))!important;width:40px;height:40px;border-radius:50%}
body:not(.mobile-play) .portal-chat-button{left:calc(356px + env(safe-area-inset-left))!important;right:auto!important}
body:not(.mobile-play) .play-status{top:calc(100px + env(safe-area-inset-top))!important}
.field-coins:after,.field-gems:after{content:' +';font-size:17px;color:#d9f8e1}
@media(any-pointer:coarse){
 .mobile-play .touch-field-menu{left:calc(8px + env(safe-area-inset-left))!important}
 .mobile-play .game-menu-button{left:calc(100px + env(safe-area-inset-left))!important}
 .mobile-play .field-top-status{top:calc(55px + env(safe-area-inset-top))}
}
@media(max-width:1100px){
 body:not(.mobile-play) .field-top-status{top:calc(55px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));right:calc(8px + env(safe-area-inset-right));height:54px;gap:6px;font-size:11px}
 body:not(.mobile-play) .field-player{min-width:130px;max-width:240px;grid-template-columns:28px minmax(0,1fr);grid-template-rows:26px 16px;min-height:49px}
 body:not(.mobile-play) .field-portrait{width:23px;height:23px;font-size:15px}
 body:not(.mobile-play) .field-health-track{height:17px}.field-health-text{line-height:14px;font-size:10px}
 body:not(.mobile-play) .play-status{top:calc(112px + env(safe-area-inset-top))!important}
 body:not(.mobile-play) .map-dock:not(.collapsed){top:calc(148px + env(safe-area-inset-top))!important}
}
@media(any-pointer:coarse) and (max-width:430px){
 .mobile-play .touch-field-menu{left:calc(8px + env(safe-area-inset-left))!important}
 .mobile-play .game-menu-button{left:calc(80px + env(safe-area-inset-left))!important}
}
@media(any-pointer:coarse) and (min-width:1101px){
 .mobile-play .field-top-status{top:calc(8px + env(safe-area-inset-top));left:min(38vw,560px);right:calc(178px + env(safe-area-inset-right));height:80px;font-size:13px}
 .mobile-play .field-player{grid-template-columns:38px minmax(0,1fr);grid-template-rows:38px 23px;min-height:68px;max-width:310px}
 .mobile-play .field-portrait{width:31px;height:31px;font-size:20px}
 .mobile-play .field-health-track{height:21px}.mobile-play .field-health-text{line-height:18px;font-size:12px}
 .mobile-play .play-status{top:calc(82px + env(safe-area-inset-top))!important;left:min(38vw,560px)!important;right:calc(178px + env(safe-area-inset-right))!important}
 .mobile-play .map-dock:not(.collapsed){top:calc(8px + env(safe-area-inset-top))!important;width:160px!important;max-height:220px!important}
 .mobile-play .map-dock.user-positioned:not(.collapsed){top:var(--map-top)!important;width:var(--map-width,160px)!important}
 .mobile-play .map-restore{top:calc(8px + env(safe-area-inset-top))!important}
}
.field-day{display:flex;align-items:center;gap:6px}.field-day strong{font-size:15px}.field-day small{font-size:10px;opacity:.8}
.field-fullscreen{position:fixed;z-index:32;top:calc(8px + env(safe-area-inset-top));right:calc(8px + env(safe-area-inset-right));width:34px;height:34px;border:1px solid #fff8;border-radius:6px;background:#173b32c9;color:#fff;font-size:24px;line-height:1}
.field-fullscreen.hidden{display:none!important}
.field-map-compass{display:none;pointer-events:none}
@media(any-pointer:coarse) and (min-width:701px){
 .mobile-play .field-top-status{right:calc(178px + env(safe-area-inset-right))}
 .mobile-play .map-dock:not(.collapsed){border-radius:50%!important;padding:0!important;width:160px!important;height:160px!important;overflow:hidden!important;border:3px solid #dcf5e5!important;box-shadow:0 0 0 4px #18383180!important;background:#12382ebd!important}
 .mobile-play .map-dock:not(.collapsed) canvas{width:100%;height:100%;border:0;border-radius:50%;aspect-ratio:1;object-fit:cover}
 .mobile-play .map-dock:not(.collapsed) .map-heading{position:absolute;z-index:2;top:0;left:25%;right:25%;height:23px;font-size:0;cursor:grab!important}
 .mobile-play .map-heading strong{font-size:0!important}.mobile-play .map-heading button{position:absolute;right:-30px;top:0;opacity:.85}
 .mobile-play .map-dock:not(.collapsed) .map-goal,.mobile-play .map-dock:not(.collapsed) .map-legend{display:none}
 .mobile-play .map-dock:not(.collapsed) .field-map-compass{display:block;position:absolute;inset:0;color:#fff;text-shadow:0 1px 3px #123;font-weight:900;font-size:12px;pointer-events:none}
 .field-map-compass span{position:absolute}.field-map-compass .north{top:1px;left:50%;transform:translateX(-50%)}.field-map-compass .south{bottom:1px;left:50%;transform:translateX(-50%)}.field-map-compass .west{left:4px;top:50%;transform:translateY(-50%)}.field-map-compass .east{right:4px;top:50%;transform:translateY(-50%)}
 .mobile-play .field-fullscreen{right:calc(9px + env(safe-area-inset-right));top:calc(8px + env(safe-area-inset-top));width:31px;height:31px}
}
@media(any-pointer:coarse) and (max-width:1100px){
 .mobile-play .map-dock:not(.collapsed){top:calc(148px + env(safe-area-inset-top))!important;width:130px!important;height:130px!important}
 .mobile-play .map-dock.user-positioned:not(.collapsed){top:var(--map-top)!important;width:var(--map-width,130px)!important}
 .mobile-play .field-fullscreen{top:calc(148px + env(safe-area-inset-top))}
}
@media(any-pointer:coarse) and (max-width:700px){
 .mobile-play .field-day{font-size:10px;gap:3px}.mobile-play .field-day strong{font-size:10px}.mobile-play .field-day small{display:none}
 .mobile-play .field-fullscreen{top:calc(8px + env(safe-area-inset-top))}
}
@media(any-pointer:coarse){.mobile-play:has(.map-dock.collapsed) .field-fullscreen{right:calc(54px + env(safe-area-inset-right))}}
/* Single top row. All elements share one flex layout rather than independent coordinates. */
body .game-topbar{position:fixed;z-index:36;top:calc(7px + env(safe-area-inset-top));left:calc(7px + env(safe-area-inset-left));right:calc(7px + env(safe-area-inset-right));display:flex;align-items:flex-start;gap:clamp(3px,.45vw,8px);height:132px;pointer-events:none;overflow:visible}
body .game-topbar>*{box-sizing:border-box;pointer-events:auto;flex-shrink:0}
body .game-topbar>.touch-field-menu,body .game-topbar>.game-settings-button,body .game-topbar>.game-menu-button,body .game-topbar>.mobile-inventory-toggle,body .game-topbar>.mobile-camera-toggle,body .game-topbar>.field-chat-shortcut,body .game-topbar>.portal-chat-button,body .game-topbar>.map-restore{position:relative!important;inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;transform:none!important;translate:none!important;display:grid!important;place-items:center;width:clamp(30px,2.9vw,52px)!important;height:clamp(30px,2.9vw,52px)!important;min-height:0!important;max-width:none!important;padding:2px!important;margin:0!important;border:1px solid #ffffff6b!important;border-radius:50%!important;background:#18333bdd!important;color:#fff!important;font-size:clamp(17px,1.8vw,27px)!important;line-height:1!important;z-index:1!important}
body .game-topbar>.game-menu-button img{width:80%;height:80%;object-fit:contain}
body .game-topbar>.mobile-inventory-toggle{font-size:0!important}
body .game-topbar>.mobile-inventory-toggle:before{content:'🎒';font-size:clamp(18px,1.8vw,27px)}
body .game-topbar>.field-chat-shortcut{width:clamp(36px,6.7vw,104px)!important;border-radius:22px!important;font-size:clamp(10px,1.1vw,17px)!important}
body .game-topbar>.field-chat-shortcut:before{content:none!important}
body .game-topbar>.portal-chat-button{width:clamp(36px,6.7vw,104px)!important;border-radius:22px!important;font-size:clamp(10px,1.1vw,17px)!important}
body .game-topbar>.portal-chat-button.hidden,body .game-topbar>.field-chat-shortcut.hidden,body .game-topbar>.field-top-status.hidden,body .game-topbar>.map-restore.hidden{display:none!important}
body .game-topbar>.field-top-status{position:relative!important;inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;display:flex;flex:1 1 0;min-width:0;height:auto;width:auto;max-width:none!important;gap:clamp(3px,.4vw,7px);font-size:clamp(9px,.9vw,14px);pointer-events:auto}
body .game-topbar .field-player{min-width:100px;max-width:none;flex:1 1 120px;grid-template-columns:clamp(22px,2.4vw,38px) minmax(0,1fr);grid-template-rows:clamp(24px,2.5vw,39px) 21px 16px;min-height:76px;overflow:hidden}
body .game-topbar .field-portrait{width:clamp(20px,2.1vw,31px);height:clamp(20px,2.1vw,31px);font-size:clamp(12px,1.4vw,20px)}
body .game-topbar .field-health-track{height:20px}
body .game-topbar .field-health-text{line-height:17px}
body .game-topbar .field-mission{grid-column:1/3;text-align:center;font-size:clamp(8px,.72vw,11px);color:#e6f6e5}
body .game-topbar .field-coins,body .game-topbar .field-gems{flex:0 1 auto;min-width:0;padding:8px 5px;font-size:inherit}
body .game-topbar .field-day{min-width:0;flex:0 1 auto;display:grid;grid-template-columns:auto auto;gap:0 4px;padding:5px;align-content:center;font-size:inherit}
body .game-topbar .field-day small{grid-column:2;font-size:clamp(8px,.7vw,11px)}
body .game-topbar>.map-dock:not(.user-positioned):not(.collapsed){position:relative!important;inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;flex:0 0 clamp(72px,9vw,160px);width:clamp(72px,9vw,160px)!important;height:clamp(72px,9vw,160px)!important;max-height:none!important;padding:0!important;margin:0!important;border:3px solid #e8f9ed!important;border-radius:50%!important;overflow:hidden!important;background:#133f42d8!important}
body .game-topbar>.map-dock.user-positioned:not(.collapsed){position:fixed!important;left:var(--map-left)!important;top:var(--map-top)!important;right:auto!important;bottom:auto!important;width:var(--map-width,130px)!important;height:var(--map-width,130px)!important;max-height:none!important;border-radius:50%!important;overflow:hidden!important}
body .game-topbar>.map-dock.collapsed{display:none!important}
body .game-topbar>.map-dock:not(.collapsed) canvas{width:100%!important;height:100%!important;aspect-ratio:1!important;border:0!important;border-radius:50%!important}
body .game-topbar>.map-dock:not(.collapsed) .map-goal,body .game-topbar>.map-dock:not(.collapsed) .map-legend{display:none!important}
body .game-topbar>.map-dock:not(.collapsed) .field-map-compass{display:block;position:absolute;inset:0;color:#fff;text-shadow:0 1px 3px #123;font-size:11px;font-weight:900;pointer-events:none}
body .game-topbar>.map-dock:not(.collapsed) .map-heading{position:absolute;z-index:3;top:0;left:22%;width:56%;height:25px;cursor:grab!important}
body .game-topbar>.map-dock:not(.collapsed) .map-heading strong{font-size:0!important}
body .game-topbar>.map-dock:not(.collapsed) .map-heading button{position:absolute;right:0;top:0;width:20px;height:20px}
body .game-topbar .field-fullscreen{position:absolute!important;right:2px!important;top:2px!important;left:auto!important;bottom:auto!important;width:24px;height:24px;z-index:4}
body:has(.game-topbar) .play-status{display:none!important}
.field-quick-menu{position:fixed;z-index:50;top:calc(50px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));display:flex;flex-direction:column;gap:5px;padding:7px;border-radius:12px;background:#173b32ed;box-shadow:0 5px 18px #0b2829ad}
.field-quick-menu.hidden{display:none!important}.field-quick-menu button{min-width:120px;padding:9px;border-radius:8px;background:#e7f1dd;color:#234b3c;font-weight:800}
@media(max-width:900px){body .game-topbar{overflow-x:auto;scrollbar-width:none;touch-action:pan-x;height:110px}body .game-topbar::-webkit-scrollbar{display:none}body .game-topbar>.field-top-status{flex:0 0 300px}body .game-topbar>.map-dock:not(.user-positioned):not(.collapsed){flex:0 0 80px;width:80px!important;height:80px!important}body .game-topbar .field-player{min-width:115px}body .game-topbar .field-day small{display:none}}
@media(max-width:600px){body .game-topbar>.field-chat-shortcut,body .game-topbar>.portal-chat-button{width:36px!important;font-size:0!important}body .game-topbar>.field-chat-shortcut:before{content:'💬'!important;font-size:19px!important}body .game-topbar>.portal-chat-button{font-size:18px!important}}
body:has(#modal:not(.hidden)) .game-topbar{display:none!important}
/* Keep the player status at the same height as the other controls. */
body .game-topbar{align-items:flex-start;height:auto;min-height:50px}
body .game-topbar>.field-top-status{flex:0 1 auto;align-items:center;height:48px}
body .game-topbar .field-player{flex:0 1 clamp(150px,16vw,270px);width:clamp(150px,16vw,270px);min-width:110px;max-width:270px;min-height:48px;height:48px;padding:2px 5px;grid-template-columns:26px minmax(0,1fr);grid-template-rows:24px 10px 10px;overflow:visible}
body .game-topbar .field-portrait{width:22px;height:22px;font-size:14px}
body .game-topbar .field-identity{font-size:clamp(10px,1vw,14px)}
body .game-topbar .field-health-track{height:9px;border-width:1px;border-radius:5px;overflow:visible}
body .game-topbar .field-health-fill{border-radius:4px}
body .game-topbar .field-health-text{position:absolute;right:2px;top:-23px;line-height:18px;font-size:10px;text-shadow:0 1px 2px #142b31}
body .game-topbar .field-mission{font-size:9px;line-height:10px;overflow:hidden;text-overflow:ellipsis}
body .game-topbar .field-coins,body .game-topbar .field-gems,body .game-topbar .field-day{min-height:46px;align-self:center}
body:has(.portal-panel:not(.hidden)) .game-topbar{display:none!important}
body .game-topbar .field-map-compass{transform:rotate(calc(-1 * var(--map-heading,0rad)))}
body .game-topbar .field-map-compass span{transform:rotate(var(--map-heading,0rad))}
body .game-topbar .field-map-compass .north{transform:translateX(-50%) rotate(var(--map-heading,0rad))}
body .game-topbar .field-map-compass .south{transform:translateX(-50%) rotate(var(--map-heading,0rad))}
body .game-topbar .field-map-compass .east,body .game-topbar .field-map-compass .west{transform:translateY(-50%) rotate(var(--map-heading,0rad))}
.field-eat{position:fixed;z-index:34;right:calc(20px + env(safe-area-inset-right));bottom:calc(200px + env(safe-area-inset-bottom));min-width:66px;min-height:45px;padding:7px 10px;border:2px solid #e9f7cf9c;border-radius:18px;background:#1d4c32d9;color:white;font-size:16px;font-weight:800;text-shadow:0 1px 3px #193629;touch-action:manipulation;cursor:pointer}
.field-eat.hidden,body:has(.portal-panel:not(.hidden)) .field-eat{display:none!important}
@media(max-width:900px){body .game-topbar{height:auto;overflow-x:auto;align-items:flex-start}body .game-topbar>.field-top-status{flex:0 0 auto}body .game-topbar .field-player{width:150px;flex:0 0 150px}body .game-topbar>.map-dock:not(.user-positioned):not(.collapsed){flex:0 0 80px}}

/* Keep the jump arrow lower and free of the legacy Use control. */
@media(any-pointer:coarse){
 .mobile-play .mobile-use{display:none!important}
 .mobile-play .actions{bottom:calc(6px + env(safe-area-inset-bottom))!important}
 .mobile-play .game-topbar button,.mobile-play .field-quick-menu button,.mobile-play .inventory-nav button,.mobile-play .bar .slot{touch-action:none}
}

/* Compact, separate prompt lanes below the top toolbar on touch devices. */
@media(any-pointer:coarse){
 .mobile-play .actions{bottom:env(safe-area-inset-bottom)!important}
 .mobile-play .actions #up{width:60px;height:60px;min-height:60px;font-size:28px}
 .mobile-play .checkpoint-cue{
  top:calc(98px + env(safe-area-inset-top));
  width:max-content;max-width:min(320px,46vw);
  padding:5px 9px;font-size:10px;line-height:1.2;
  border-radius:14px;white-space:normal;
 }
 .mobile-play .treasure-status{
  top:calc(139px + env(safe-area-inset-top));left:50%;right:auto;
  transform:translateX(-50%);max-width:min(290px,44vw);
  padding:5px 8px;font-size:9px;line-height:1.2;white-space:normal;
 }
 .mobile-play .treasure-button{
  top:calc(177px + env(safe-area-inset-top));right:calc(12px + env(safe-area-inset-right));
  max-width:min(150px,25vw);padding:7px 9px;font-size:10px;line-height:1.2;
 }
 .mobile-play .royal-action{font-size:10px;line-height:1.2;padding:7px 9px}
 .mobile-play .toast{max-width:min(320px,55vw);padding:5px 9px;font-size:10px;line-height:1.2;text-align:center}
}
@media(any-pointer:coarse) and (orientation:portrait){
 .mobile-play .checkpoint-cue{top:calc(141px + env(safe-area-inset-top));max-width:72vw}
 .mobile-play .treasure-status{top:calc(184px + env(safe-area-inset-top));max-width:70vw}
 .mobile-play .treasure-button{top:calc(226px + env(safe-area-inset-top));max-width:34vw}
 .mobile-play .toast{max-width:70vw}
}

/* Landscape phone prompts occupy distinct lanes and leave the aim point clear. */
@media(any-pointer:coarse) and (orientation:landscape) and (max-height:550px){
 .mobile-play .checkpoint-cue{top:calc(93px + env(safe-area-inset-top));max-width:38vw;font-size:9px}
 .mobile-play .treasure-status{top:calc(137px + env(safe-area-inset-top));max-width:36vw;font-size:9px}
 .mobile-play .cave-route-cue{top:calc(181px + env(safe-area-inset-top));bottom:auto;left:calc(8px + env(safe-area-inset-left));transform:none;max-width:31vw;padding:5px 7px;font-size:9px;line-height:1.25}
 .mobile-play .cave-exit-action,.mobile-play .treasure-button{top:calc(181px + env(safe-area-inset-top));bottom:auto;left:auto;right:calc(8px + env(safe-area-inset-right));transform:none;max-width:26vw;padding:6px 8px;font-size:10px;line-height:1.2;white-space:normal}
 .mobile-play .toast{top:auto;bottom:calc(90px + env(safe-area-inset-bottom));max-width:32vw;font-size:9px;line-height:1.25}
 .mobile-play .travel-rescue{top:calc(96px + env(safe-area-inset-top));max-width:28vw;padding:4px 7px;font-size:9px}
}

/* At a short landscape height, scrolling stays inside each menu page. */
@media(orientation:landscape) and (max-height:550px){
 #modal.adventure-open{padding:5px}
 #modal .adventure-card{width:calc(100vw - 10px);height:calc(100dvh - 10px);max-height:calc(100dvh - 10px);border-radius:16px}
 .book-navigation{padding:5px;gap:4px}
 .book-tab{min-height:34px;padding:3px 4px;font-size:11px;gap:4px}
 .book-tab span:first-child{font-size:14px}
 .book-sheet{padding:7px;min-height:0}
 .book-page{padding:9px;min-height:0;overflow-y:auto;overflow-x:hidden}
 .book-page[data-book-page="cover"] .opening-logo{margin:0!important;padding:0!important}
 .book-page[data-book-page="cover"] .opening-logo img{width:45px;height:45px}
 .book-page[data-book-page="cover"] .opening-logo h1{font-size:clamp(22px,3vw,30px)}
 .book-page[data-book-page="cover"] .meadow-scene{width:min(100%,300px);margin:1px auto!important}
 .book-page[data-book-page="cover"] .book-page-heading h2{font-size:18px}
 .book-page[data-book-page="cover"] .intro{font-size:10px!important;margin:1px 0 4px!important}
 .book-cover-actions button{min-height:34px;padding:4px;font-size:10px}
 .book-watch-story,.book-enable-sound{font-size:9px;padding:3px 8px;margin:2px}
 .book-page[data-book-page="characters"] .wardrobe{flex:none!important;min-height:max-content;margin:0;padding:7px}
 .book-page[data-book-page="characters"] .character-roster{grid-template-columns:repeat(5,minmax(0,1fr));margin:0 0 6px;gap:4px}
 .book-page[data-book-page="characters"] .character-card{min-height:39px;padding:2px}
 .book-page[data-book-page="characters"] .wardrobe-grid{grid-template-columns:minmax(160px,35%) minmax(0,1fr)}
 .book-page[data-book-page="characters"] .wardrobe-preview{min-height:170px}
 .book-page[data-book-page="characters"] .opening-choice-story{flex:none;position:relative;margin:8px 0 0;padding:6px 9px}
 .book-page[data-book-page="characters"] .opening-choice-story h2{font-size:14px;margin:2px 0}
 .book-page[data-book-page="characters"] .opening-choice-story p{font-size:10px!important;line-height:1.25!important}
 .book-page[data-book-page="characters"] .choice-chips{font-size:9px;margin-top:4px}
}

/* Compact captions leave most of the opening animation visible. */
@media(orientation:landscape) and (max-height:550px){
 .intro-cinematic{place-items:end center}
 .intro-cinematic .intro-dialog{width:min(650px,calc(100vw - 20px));max-height:25dvh;overflow-y:auto;margin-bottom:calc(5px + env(safe-area-inset-bottom));padding:7px 12px;border-radius:12px}
 .intro-cinematic .intro-chapter{font-size:9px;letter-spacing:2px}
 .intro-cinematic .intro-title,.intro-cinematic.canvas-ready .intro-title{font-size:clamp(16px,2.6vw,22px);line-height:1.08;margin:2px 0}
 .intro-cinematic .intro-body,.intro-cinematic.canvas-ready .intro-body{font-size:10px;line-height:1.2;margin:2px 0}
 .intro-cinematic .intro-progress{margin:4px 0;gap:4px}
 .intro-cinematic .intro-progress span{height:3px}
 .intro-cinematic .intro-actions button{min-height:27px;padding:3px 8px;font-size:10px}
}

/* Put touch actions on the screen edge; keep the fruit below door prompts. */
@media(any-pointer:coarse){
 body.mobile-play .actions{bottom:calc(2px + env(safe-area-inset-bottom))!important;right:calc(9px + env(safe-area-inset-right))!important;transform:none!important;translate:none!important}
 body.mobile-play .field-eat{top:auto!important;bottom:calc(170px + env(safe-area-inset-bottom))!important;right:calc(83px + env(safe-area-inset-right))!important;min-width:58px;min-height:43px;padding:5px 7px;font-size:13px;z-index:20}
 body.mobile-play .actions #up{width:57px;height:57px;min-height:57px}
}
@media(any-pointer:coarse) and (max-width:1366px){
 body.mobile-play{--edge-bottom:calc(3px + env(safe-area-inset-bottom))}
 body.mobile-play .mobile-attack{bottom:var(--edge-bottom)!important;right:calc(9px + env(safe-area-inset-right))!important}
 body.mobile-play #place{bottom:var(--edge-bottom)!important;right:calc(88px + env(safe-area-inset-right))!important}
 body.mobile-play #break{bottom:var(--edge-bottom)!important;right:calc(143px + env(safe-area-inset-right))!important}
 body.mobile-play #up{bottom:calc(64px + env(safe-area-inset-bottom))!important;right:calc(88px + env(safe-area-inset-right))!important}
 body.mobile-play #down{bottom:calc(64px + env(safe-area-inset-bottom))!important;right:calc(151px + env(safe-area-inset-right))!important}
 body.mobile-play .meadow-fire-button{bottom:calc(84px + env(safe-area-inset-bottom))!important;right:calc(9px + env(safe-area-inset-right))!important}
}
@media(any-pointer:coarse) and (max-height:420px){body.mobile-play .field-eat{bottom:calc(5px + env(safe-area-inset-bottom))!important;right:calc(216px + env(safe-area-inset-right))!important}}

/* Reference order: MB, joined menu/chat, bag, settings, then the live status. */
body .game-topbar .field-menu-chat{display:flex;align-items:center;gap:0;flex:0 0 auto;height:clamp(30px,2.9vw,52px);padding:0 3px;border:1px solid #ffffff6b;border-radius:25px;background:#18333bdd;pointer-events:auto}
body .game-topbar .field-menu-chat .touch-field-menu,body .game-topbar .field-menu-chat .field-chat-shortcut{position:relative!important;inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;transform:none!important;translate:none!important;scale:1!important;display:grid!important;place-items:center;width:clamp(30px,2.8vw,48px)!important;height:100%!important;min-height:0!important;max-width:none!important;margin:0!important;padding:1px!important;border:0!important;border-radius:21px!important;background:transparent!important;color:#fff!important;box-shadow:none!important;font-size:clamp(18px,1.7vw,25px)!important;line-height:1!important;z-index:1!important}
body .game-topbar .field-menu-chat .field-chat-shortcut{font-size:0!important}
body .game-topbar .field-menu-chat .field-chat-shortcut::before{content:'▤'!important;font-size:clamp(20px,1.9vw,28px)!important}
body .game-topbar .field-menu-chat .field-chat-shortcut.hidden{display:none!important}
body .game-topbar>.mobile-inventory-toggle{font-size:0!important}
body .game-topbar>.mobile-inventory-toggle:before{content:'🎒';font-size:clamp(18px,1.8vw,27px)}
body .field-secondary-shortcut{display:none!important}
body .field-treasure-route{position:fixed;right:calc(12px + env(safe-area-inset-right));top:calc(165px + env(safe-area-inset-top));z-index:35;max-width:min(285px,62vw);border:1px solid #ffdc83;border-radius:13px;background:#173c39e8;color:#ffebbb;padding:8px 11px;font:800 12px/1.25 system-ui;box-shadow:0 4px 14px #0a2a3180;text-align:center;touch-action:manipulation}
body .field-treasure-route.hidden,body:has(#modal:not(.hidden)) .field-treasure-route{display:none!important}
@media(max-width:700px){body .game-topbar .field-menu-chat{height:32px}body .game-topbar .field-menu-chat .touch-field-menu,body .game-topbar .field-menu-chat .field-chat-shortcut{width:29px!important}body .game-topbar .field-menu-chat .field-chat-shortcut::before{font-size:19px!important}body .field-treasure-route{top:calc(115px + env(safe-area-inset-top));font-size:10px;max-width:58vw}}
@media(max-width:650px){body #modal .book-page[data-book-page="cover"] .meadow-scene{width:100%;max-width:none;aspect-ratio:16/9;max-height:28vh}}
.field-coins .gold-coin-icon{width:25px;height:25px;vertical-align:middle;object-fit:contain}
/* The consolidated time tile is the only visible clock. */
.day-night-badge{display:none!important}
@media(max-width:700px){body .game-topbar .field-coins .gold-coin-icon{width:19px;height:19px;flex:none}}
