/* Explicit device layouts make the same readable game available on phone and desktop. */
.world-view-dock{position:fixed;right:max(8px,env(safe-area-inset-right));top:43%;z-index:10500;display:flex;flex-direction:column;gap:5px;opacity:.6;transition:opacity .2s}.world-view-dock:focus-within,.world-view-dock:hover{opacity:1}.world-view-dock button{color:#f4e9cc;background:#182e3ac9;border:1px solid #dbd1a16b;border-radius:50%;width:46px;height:46px;font:700 13px system-ui;backdrop-filter:blur(8px);cursor:pointer}.world-view-dock button+button{font-size:9px;height:35px;border-radius:18px}.realm-3d-host{position:relative}.realm-3d-canvas{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;z-index:2;display:block;pointer-events:auto;touch-action:none;border-radius:inherit}.realm-3d-canvas[hidden]{display:none!important}.display-settings{position:fixed;inset:0;z-index:24000;background:#07151ee6;display:flex;align-items:center;justify-content:center;padding:16px;overflow:auto;color:#e9eadb;font:16px/1.5 system-ui}.display-settings article{position:relative;max-height:calc(100dvh - 32px);overflow:auto;width:min(560px,100%);padding:24px;border:1px solid #c1c7a35e;border-radius:18px;background:#19313b}.display-settings h2{font:30px Georgia;margin:0 80px 12px 0}.display-settings article>button:first-of-type{position:absolute;right:16px;top:16px}.display-settings button{min-height:44px;padding:8px 13px;color:#ede4bd;background:#263f48;border:1px solid #bbcba456;border-radius:9px;font:inherit}.display-settings [aria-pressed=true]{background:#c3d5b1;color:#18343b}.display-settings fieldset{margin:14px 0;border:1px solid #afc1b540;border-radius:10px}.display-settings fieldset button{margin:3px}.display-settings label{display:block;margin:14px 0}.display-settings input{display:block;width:100%;min-height:44px}.display-settings p{color:#c5d4ca}.display-settings :focus-visible{outline:3px solid #ffdb88;outline-offset:2px}
html[data-view-mode=3d] #town-world{opacity:0;pointer-events:none}html[data-view-mode=3d] .rpg-world>canvas:not(.realm-3d-canvas),html[data-view-mode=3d] #rpg-scene,html[data-view-mode=3d] .character-render-stage>canvas:not(.realm-3d-canvas),html[data-view-mode=3d] .story-room>canvas:not(.realm-3d-canvas){visibility:hidden}.rpg-world-hud,.rpg-world>.floating-controls{z-index:22}.rpg-battle-stage .realm-3d-canvas{z-index:1}.rpg-health,.rpg-enemy-roster,.rpg-boss-warning,.rpg-round-label,.battle-discovery{z-index:4!important}.character-render-stage{position:relative;width:100%;height:340px;isolation:isolate}.character-render-stage>canvas{width:100%;height:100%;object-fit:contain}.character-render-stage .realm-3d-canvas{filter:none}.story-room .realm-3d-canvas{z-index:1}.story-room>button,.story-room .story-room-link{z-index:6}.buddy-dialogue{z-index:15000}.buddy-dialogue .dialogue-window{display:flex;flex-direction:column;max-height:calc(100dvh - 40px);padding:18px 20px 80px;min-height:0}.dialogue-window>header,.dialogue-window>footer{flex-shrink:0}.dialogue-passage{overflow-y:auto;min-height:0;overscroll-behavior:contain;font-size:clamp(18px,2.4vw,24px)}.dialogue-choices{display:flex;gap:8px;flex-direction:column}.dialogue-choices button{text-align:left}.dialogue-choices button:hover{background:#492237}.linked-prologue{align-items:center;background:radial-gradient(ellipse at 50% 30%,#48276cdb,#05141ef5 75%)}.linked-story-scene .dialogue-window{border-color:#b6c9a5;background:linear-gradient(145deg,#243c43fa,#101e30fc);box-shadow:0 18px 100px #08061acc}.linked-prologue .dialogue-window>header{letter-spacing:.14em}.linked-prologue .dialogue-speaker{color:#c9e6cf}.linked-story-scene .dialogue-passage{font-weight:500;line-height:1.65}.character-shared-memories{border-top:1px solid #b4c7b333;padding-top:14px}.character-book-top .character-display{font-size:12px}
body:has(.buddy-dialogue) .world-view-dock,body:has(.display-settings) .world-view-dock,body:has(.keeper-overlay) .world-view-dock{display:none}html[data-layout=mobile] .character-book{height:100dvh;max-height:100dvh;overflow-y:auto;overscroll-behavior:contain;padding-bottom:max(18px,env(safe-area-inset-bottom))}html[data-layout=mobile] .character-book-top{position:relative;padding:12px;gap:8px;align-items:flex-start}html[data-layout=mobile] .character-book-top h1{font-size:26px}html[data-layout=mobile] .character-book-top p{font-size:13px}html[data-layout=mobile] .character-book-layout{display:flex;flex-direction:column;padding:10px;gap:12px;min-width:0}html[data-layout=mobile] .character-book-portrait{position:static;top:auto;padding:10px;min-width:0;width:100%}html[data-layout=mobile] .character-render-stage{height:210px}html[data-layout=mobile] .character-book-portrait canvas{max-height:none;height:100%}html[data-layout=mobile] .character-book-body{width:100%;min-width:0}html[data-layout=mobile] .character-book-body nav{position:sticky;top:0;z-index:6;padding:8px 0;background:#19303bf5;gap:5px;flex-wrap:nowrap;overflow-x:auto}html[data-layout=mobile] .character-book-body nav button{min-height:44px;padding:8px 12px;flex:1;font-size:14px}html[data-layout=mobile] .character-book-content{padding:14px;min-width:0}html[data-layout=mobile] .character-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}html[data-layout=mobile] .character-book-content p,html[data-layout=mobile] .character-quote{font-size:16px;line-height:1.6;overflow-wrap:anywhere}html[data-layout=mobile] .character-book .equipment-body{display:block}html[data-layout=mobile] .character-book .equipment-portrait{display:none}html[data-layout=mobile] .character-book .equipment-total{display:grid;grid-template-columns:repeat(3,1fr)}html[data-layout=mobile] .dialogue-window{width:100%;max-height:calc(100dvh - 28px);padding:14px 14px 76px}html[data-layout=mobile] .dialogue-window>header{font-size:11px;letter-spacing:.03em}html[data-layout=mobile] .dialogue-speaker{font-size:23px;margin:12px 0 8px}html[data-layout=mobile] .dialogue-passage{font-size:19px;line-height:1.5;max-height:48dvh;margin-bottom:14px}html[data-layout=mobile] .dialogue-window>footer{font-size:12px}html[data-layout=mobile] .nest-story-overlay .story-dialogue{min-height:140px;max-height:48dvh;padding:12px;overflow-y:auto}html[data-layout=mobile] .nest-story-overlay .story-dialogue p{font-size:18px;line-height:1.5}html[data-layout=mobile] .keeper-card{padding:18px 14px}html[data-layout=mobile] .keeper-grid{grid-template-columns:1fr}html[data-layout=desktop] .character-book-layout{display:grid;grid-template-columns:minmax(220px,35%) minmax(0,1fr);gap:22px;max-width:1400px}html[data-layout=desktop] .character-book-portrait{position:sticky;top:120px}html[data-layout=desktop] .character-book-body nav{position:static;flex-wrap:wrap}html[data-reading-size=large] .character-book-content p,html[data-reading-size=large] .character-skill p{font-size:17px;line-height:1.65}
@media(max-height:500px){html[data-layout=mobile] .character-render-stage{height:150px}.buddy-dialogue{padding:8px}.dialogue-window{max-height:calc(100dvh - 16px)!important}.dialogue-passage{max-height:42dvh!important}.world-view-dock{top:30%}}

.realm-3d-caption{position:absolute;top:18px;left:14px;right:75px;z-index:5;padding:10px 14px;border:1px solid #b5d4bf55;border-radius:10px;background:#132c3ccc;color:#eee2bb;font:600 14px/1.5 system-ui;pointer-events:none}.realm-3d-caption[hidden]{display:none}
