/* One screen position shared by the top menu and game areas. */
.header-sound-toggle,.scene-bgm-toggle,#soundToggle{position:fixed!important;top:calc(env(safe-area-inset-top,0px) + 16px)!important;right:max(18px,calc((100vw - 1180px)/2 + 18px))!important;z-index:10000!important;min-width:108px;min-height:44px;padding:9px 14px;border:1px solid rgba(169,113,15,.38);border-radius:999px;color:#263c3a;font:800 14px system-ui,sans-serif;background:rgba(255,255,255,.95);box-shadow:0 8px 24px #203e581f;cursor:pointer;white-space:nowrap}
.header-sound-toggle[aria-pressed="true"],.scene-bgm-toggle[aria-pressed="true"],#soundToggle[aria-pressed="true"]{color:white;border-color:#dfad63;background:linear-gradient(135deg,#bd2d25,#8f1d19)}
.sound-toggle:not(.header-sound-toggle){display:none!important}
.site-header{backdrop-filter:none!important}.header-brand-controls{padding-right:125px}
body[data-screen="shrineWorld"] .shrine-world{padding-top:0!important}
body.scene-bgm-page{padding-top:0}body.scene-bgm-page>header{padding-right:140px}
@media(max-width:600px){.header-sound-toggle,.scene-bgm-toggle,#soundToggle{right:18px!important;min-width:98px;font-size:13px}.header-brand-controls{padding-right:113px}}

/* Map fills the display; controls float over the scenery. */
body[data-screen="shrineWorld"] .shrine-world{display:block!important}
body[data-screen="shrineWorld"] #worldViewport{position:absolute!important;inset:0!important;height:100%!important;width:100%!important}
body[data-screen="shrineWorld"] .world-heading{position:absolute;top:env(safe-area-inset-top,0px);left:0;right:130px;z-index:25;border-radius:0 0 12px 0;background:#fffaf0c9;flex-wrap:wrap}
body[data-screen="shrineWorld"] .world-bar{position:absolute;top:calc(env(safe-area-inset-top,0px) + 74px);left:0;z-index:25;background:#fffaf0c9;border-radius:0 0 12px 0;max-width:calc(100% - 135px);box-sizing:border-box;flex-wrap:wrap}
body[data-screen="shrineWorld"] .world-interaction{position:absolute;left:0;right:0;bottom:0;z-index:25;background:#fffaf0d9}
#shrineWorld.is-fishing .world-heading,#shrineWorld.is-fishing .world-bar,#shrineWorld.is-fishing .world-interaction{display:none!important}
body[data-screen="shrineWorld"] .world-dress{z-index:40}

.world-portal-guide{pointer-events:none!important;cursor:default!important;border:0!important;background:#fff4dadb!important;color:#294b3b!important;box-shadow:none!important;border-radius:5px!important;padding:4px 8px!important;font-size:12px!important;min-height:0!important}
#worldMapSwitch{display:none!important}

/* Keep the scenery clear: the scene tools live in a compact menu. */
body[data-screen="shrineWorld"] .world-heading{display:none!important}
.world-menu-toggle{position:fixed;top:calc(env(safe-area-inset-top,0px) + 70px);right:max(18px,calc((100vw - 1180px)/2 + 18px));z-index:100;min-width:108px;min-height:44px;border:1px solid #a98e62;border-radius:12px;background:#fffaf0ed;color:#294b3b;font:800 14px system-ui;cursor:pointer}
.world-menu-panel{position:fixed;top:calc(env(safe-area-inset-top,0px) + 122px);right:max(18px,calc((100vw - 1180px)/2 + 18px));width:min(280px,calc(100vw - 36px));max-height:calc(100dvh - 145px);overflow:auto;z-index:110;padding:12px;border:1px solid #b7a279;border-radius:14px;background:#fffaf0f5;box-shadow:0 12px 35px #102b2940;box-sizing:border-box;display:grid;gap:9px}
.world-menu-panel[hidden]{display:none!important}
.world-menu-panel>button,.world-menu-panel>a{position:static;display:flex;align-items:center;justify-content:center;width:100%;min-height:44px;box-sizing:border-box;border:1px solid #b7a279;border-radius:9px;font-size:14px;background:#fff;color:#294b3b;text-decoration:none}
.world-menu-panel>[hidden]{display:none!important}
body[data-screen="shrineWorld"] .world-menu-panel .world-bar{position:static!important;display:flex;flex-wrap:wrap;max-width:none;background:none;padding:8px 0;font-size:12px}
.world-menu-panel #worldMinimap{position:static!important;display:block!important;width:115px;max-height:none;margin:5px auto;pointer-events:auto}
body[data-screen="shrineWorld"] .world-interaction{display:none!important}
body[data-screen="shrineWorld"] .world-interaction:has(#worldInteract:not([hidden])){display:flex!important;justify-content:center;min-height:0!important;padding:8px;background:none!important;pointer-events:none}
#worldInteract{pointer-events:auto}#worldLocation,#worldHint{display:none!important}
.world-gate-roof{display:none;position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;z-index:9;clip-path:polygon(25% 22%,74% 22%,79% 29.5%,73% 35.7%,28% 35.7%,22% 29.5%)}
#worldPlane[data-map="checkpoint"] .world-gate-roof{display:block}
body[data-time="morning"] .world-gate-roof{filter:brightness(.94) saturate(.92)}body[data-time="evening"] .world-gate-roof{filter:brightness(.82) sepia(.12)}body[data-time="night"] .world-gate-roof{filter:brightness(.48) saturate(.76)}
@media(max-width:600px){.world-menu-toggle,.world-menu-panel{right:18px}.world-menu-toggle{min-width:98px}}

/* Full-bleed scenery; only the controls respect safe-area insets. */
body[data-screen="shrineWorld"] .shrine-world{padding:0!important;height:100dvh!important;inset:0!important}
body[data-screen="shrineWorld"] #worldViewport{border:0!important;border-radius:0!important;margin:0!important;padding:0!important;box-sizing:border-box}
body[data-screen="shrineWorld"] #worldMap,body[data-screen="shrineWorld"] #worldMapNight{width:100%!important;height:100%!important;object-fit:fill!important;display:block}
body.scene-bgm-page:has(#game){padding:0!important;margin:0!important;height:100dvh;overflow:hidden}
body.scene-bgm-page:has(#game) .shell,body.scene-bgm-page:has(#game) main{height:100dvh!important;margin:0!important}
.world-portal-guide{max-width:calc(100% - 24px);box-sizing:border-box}
#worldPlane[data-map="town"] #worldMapGate,#worldPlane[data-map="checkpoint"] #worldMapGate,#worldPlane[data-map="land"] #worldMapGate{top:max(5%,calc(env(safe-area-inset-top,0px) + 12px))!important}

/* The installed iPhone app draws scenery beneath the translucent status bar. */
html:has(body[data-screen="shrineWorld"]){background-image:var(--world-edge-image);background-size:cover;background-position:center top;background-attachment:fixed;background-repeat:no-repeat}
body[data-screen="shrineWorld"],body[data-screen="shrineWorld"] #worldViewport{background:transparent!important}
body[data-screen="shrineWorld"] .shrine-world{background:transparent!important}

.world-river-bridge{display:none;position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;z-index:9;clip-path:inset(16% 0 76% 0)}
#worldPlane[data-map="riverTown"] .world-river-bridge{display:block}
body[data-time="morning"] .world-river-bridge{filter:brightness(.94) saturate(.92)}body[data-time="evening"] .world-river-bridge{filter:brightness(.82) sepia(.12)}body[data-time="night"] .world-river-bridge{filter:brightness(.48) saturate(.76)}
.world-downstream-water{position:absolute;inset:0;width:100%;height:100%;z-index:2;pointer-events:none}

body[data-time="evening"] .world-downstream-water{opacity:.72}body[data-time="night"] .world-downstream-water{opacity:.3}
