/* One floor, centered between the header and the handheld controls. */
:root{--bg:#142019;--text:#ece7cd;--muted:#a9b09b;--gold:#c0aa70;--gold-bright:#ecdaa0}
html,body,#game-shell{background:#142019}
/* An absolute surface uses document coordinates, avoiding iOS's separate
   fixed-position compositor offset. Clip prevents focus from silently scrolling
   the shell itself; the world panel and dialogs keep their own scrolling. */
html{height:100%;height:100dvh;overflow:hidden;overflow-anchor:none}
body{position:static;inset:auto;width:100%;height:100%;overflow:hidden;overflow-anchor:none;-webkit-text-size-adjust:100%;text-size-adjust:100%}
#game-shell{position:absolute;inset:auto;left:var(--viewport-page-left,0px);top:var(--viewport-page-top,0px);overflow:clip;width:var(--viewport-w,100vw);height:var(--viewport-h,100dvh)}
#game-shell dialog{position:absolute;left:calc(var(--viewport-page-left,0px) + var(--viewport-w)/2);top:calc(var(--viewport-page-top,0px) + var(--viewport-h)/2);overscroll-behavior:contain}
.game-panel{overflow:clip}
.form-field input,.form-field select{font-size:16px}
#scene{inset:132px 155px 140px;overflow:hidden;border-radius:12px;background:#11251d}
#game-canvas{outline:none}
.vignette{background:radial-gradient(ellipse,transparent 75%,#0b1b1038);border:1px solid #83926924;border-radius:inherit}
.location-toast{top:35%;font-size:22px;z-index:4}
.scene-loading{background:#11251d}.scene-loading strong{color:#e6d8a7}
.brand{color:#ddd2a4}.room-line>span{white-space:nowrap;background:#233323;border-color:#9b8a58;color:#eee0aa;font:600 15px var(--sans);padding:5px 9px}
.game-hud{height:120px}.location-hud{top:19px}.room-line{margin-top:9px}h1{font-size:22px}
.name-line small{font:11px var(--sans);color:#bbc2ac}.adventurer-stats{gap:6px}.portrait{background:radial-gradient(ellipse,#6b7751,#213423);border-color:#b5a36d}
.objective-hud{top:88px;color:#e7e5ce;background:#223223ed;border:1px solid #78825b7a;border-radius:5px;font-size:14px;padding:9px 17px}
.quest-gem{color:#dbca8d}.objective-hud #quest-fraction{color:#d0c18c}
.camera-controls{top:auto;bottom:92px;right:50%;transform:translateX(50%)}
.glass-icon,.camera-controls .reset-view{background:#243629;border-color:#889367;color:#eee1ad}
.orbit-help{color:#aebda5}
.scene-caption{bottom:42px;left:220px;right:240px;color:#dce4d2;font-size:14px;line-height:1.6}
.save-status{top:80px;right:28px;bottom:auto;left:auto;transform:none;color:#b4c49c;font-size:12px;z-index:6;cursor:pointer}
.save-status.error{color:#ffb895;text-decoration:underline}.save-status .icon{width:14px;height:14px}
.object-label{background:#213327f5;color:#e8e1ba;border-color:#a39d6b}.object-label::after{background:#213327;border-color:#a39d6b}.marker-copy strong{color:#f0ead3}.marker-copy small{color:#b8c6a6}
.compact-marker .marker-status{background:#233725}.object-label .marker-icon{color:var(--accent,#d7c68b)}
.minimap-shell,#game-shell.compact .minimap-shell{background:#1a2c21f5;border-color:#87966c;width:224px}
#game-shell.portrait-mode .minimap-shell{width:218px;top:164px;max-height:calc(100% - 390px)}
.round-button{border-color:#c9b57c;background:radial-gradient(circle at 38% 24%,#677b4777,#243929eb 68%);box-shadow:0 0 0 1px #817045,inset 0 0 0 2px #536040,0 4px 8px #07120880;color:#f2eed9}
.system-hud #pause{background:#647046;border-color:#c9b57c}
.joystick{border-color:#c9b57c;background:radial-gradient(circle,#69815850,#21382dd9);box-shadow:0 0 0 1px #897b53,inset 0 0 0 2px #536040,0 4px 12px #08180b80}
.stick-knob{border-color:#e1d297;background:radial-gradient(circle at 37% 29%,#fffce4,#d2dcb5);box-shadow:0 0 0 2px #a8b58e,0 2px 6px #081a0e80}
.action-main .action-inner{background:#2d442d;border-color:#cec48e}.action-main.available .action-inner{background:#465638}.action-main.available{box-shadow:0 0 0 2px #33462b,0 0 15px #d6d8a14d}
.count{background:#52613d;border-color:#b4b478}
#toast{background:#263e2aef;color:#edf0cf;border-color:#9aab74}
#modal{background:linear-gradient(140deg,#283729,#18271d);border-color:#9ba074}.dialog-eyebrow{color:#cabc88}.dialog-description,.note-entry p{color:#c8d0ba}
.note-entry{background:#253829;border-color:#60744e}.clue-paper{background:#ded6ae;color:#344231;border-color:#aaa57b;line-height:1.9}.clue-paper small{color:#5e694e}
.primary-button{background:#cbb477;color:#23321f;border-color:#e9d899}.secondary-button,.menu-item{background:#354530;color:#e3dec2;border-color:#76815a}
#modal[data-mechanism] .symbol-button{background:#293e2d}#modal[data-mechanism] .symbol-button.active{background:#586546;box-shadow:inset 0 0 0 2px #32492b}
.level-meta{display:flex;gap:12px;justify-content:center;color:#b7c69f;font-size:13px;margin:8px 0 20px}
.tutorial-intro{padding:14px 16px;background:#394a2a;border-left:3px solid #c5bc78;line-height:1.8;color:#e6e7c8;margin:16px 0}
.sequence-slots{display:flex;gap:5px;flex-wrap:wrap;justify-content:center;margin-bottom:14px}.sequence-slot{display:grid;place-items:center;min-width:34px;height:42px;padding:3px;border:1px solid #7c8b66;color:#ead6a2;background:#17291d;font-size:25px;border-radius:4px}
.puzzle-controls.sequence-puzzle{display:block}.symbol-keypad{display:flex;justify-content:center;gap:8px;flex-wrap:wrap}.symbol-keypad .symbol-button{width:64px;height:77px}.puzzle-controls.rune-puzzle{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}.rune-puzzle .symbol-button{width:66px}
.water-field{display:flex;flex-direction:column;gap:8px;text-align:center;font-size:14px;color:#d3ddc3}.water-field input{width:130px;max-width:32vw;background:#152b20;border:2px solid #a8c19b;padding:12px 8px;color:#eef2d7;border-radius:5px;font-size:24px;text-align:center}.water-stepper{display:flex;gap:6px;justify-content:center}.water-stepper button{background:#435937;border:1px solid #aab982;width:42px;height:34px;border-radius:4px}
#game-shell.booting .game-hud,#game-shell.booting .objective-hud,#game-shell.booting .joystick-zone,#game-shell.booting .action-zone,#game-shell.booting .camera-controls{pointer-events:none;opacity:.5}
@media(orientation:portrait){
 #game-shell.portrait-mode .game-hud{padding:12px 16px 0;height:104px}
 #game-shell.portrait-mode .location-hud{top:78px;width:calc(100% - 24px)}
 #game-shell.portrait-mode .brand{display:none}
 #game-shell.portrait-mode .room-line{margin-top:0;gap:9px}#game-shell.portrait-mode .room-line>span{font-size:14px;padding:4px 7px}
 #game-shell.portrait-mode h1{font-size:17px;letter-spacing:1px}
 #game-shell.portrait-mode .objective-hud{top:115px;width:calc(100% - 30px);padding:7px 9px;font-size:12px;min-height:34px}
 #game-shell.portrait-mode #scene{inset:160px 10px 224px}
 #game-shell.portrait-mode .camera-controls{top:auto;bottom:178px;left:50%;right:auto;transform:translateX(-50%);gap:0}
 #game-shell.portrait-mode .orbit-help{display:none}
 #game-shell.portrait-mode .camera-controls .glass-icon{height:32px;min-height:32px;width:32px;min-width:32px}
 #game-shell.portrait-mode .camera-controls .reset-view{width:130px;font-size:12px}
 #game-shell.portrait-mode .scene-caption{bottom:226px;left:18px;right:18px;font-size:12px;line-height:1.6;padding:0;background:#142019}
 #game-shell.portrait-mode .joystick-zone{bottom:max(20px,env(safe-area-inset-bottom));left:22px}
 #game-shell.portrait-mode .action-zone{bottom:max(29px,env(safe-area-inset-bottom));right:21px}
 #game-shell.portrait-mode .save-status{display:block;top:58px;right:18px;font-size:11px;max-width:125px;white-space:normal;text-align:right}
 #game-shell.portrait-mode #toast{bottom:258px}
}
@media(orientation:landscape) and (max-height:640px){
 #game-shell.compact #scene{inset:100px 155px 26px}
 #game-shell.compact .objective-hud{top:65px;font-size:12px;min-height:28px;padding:5px 14px}
 #game-shell.compact .camera-controls{top:70px;bottom:auto;right:14px;transform:none}
 #game-shell.compact .orbit-help{display:none}
 #game-shell.compact .scene-caption{bottom:3px;left:165px;right:175px;font-size:11px}
 #game-shell.compact .save-status{display:block;top:48px;right:18px;font-size:10px}
 #game-shell.compact .location-hud{top:9px}#game-shell.compact .brand{font-size:10px}#game-shell.compact h1{font-size:17px}
 #game-shell.compact .room-line>span{font-size:12px;padding:2px 5px}
}
/* Short portrait: lift camera and caption together by 32px so the 44px
   toolbar clears the compact action-map button by 9px. */
/* Use the actual visible height, including when browser bars are expanded. */
@media(orientation:portrait){
 #game-shell.short-portrait #scene{top:149px;bottom:277px}
 #game-shell.short-portrait .scene-caption{bottom:229px;height:40px;font-size:11px;white-space:normal;overflow:visible;text-align:left;align-items:flex-start}
 #game-shell.short-portrait .camera-controls{bottom:181px}
 #game-shell.short-portrait .joystick{width:100px;height:100px}
 #game-shell.short-portrait .action-zone{transform:scale(.88);transform-origin:bottom right}
 #game-shell.short-portrait .objective-hud{top:111px}
}

.legend-clue{color:#d8d3a3}.legend-fire{color:#efbd6b}.legend-water{color:#a5d3bb}.legend-rune{color:#c7b5d5}.legend-treasure{color:#edd088}

/* Captions sit 4px above the 44px camera controls, including short portrait. */
/* Insets protect controls in standalone mode and beside a landscape notch. */
#game-shell.portrait-mode .game-hud{padding-top:calc(12px + env(safe-area-inset-top,0px))}
#game-shell.portrait-mode .location-hud{top:calc(78px + env(safe-area-inset-top,0px))}
#game-shell.portrait-mode .objective-hud{top:calc(115px + env(safe-area-inset-top,0px))}
#game-shell.portrait-mode #scene{top:calc(160px + env(safe-area-inset-top,0px));bottom:calc(224px + env(safe-area-inset-bottom,0px))}
#game-shell.portrait-mode .save-status{top:calc(58px + env(safe-area-inset-top,0px))}
#game-shell.portrait-mode .camera-controls{bottom:calc(178px + env(safe-area-inset-bottom,0px))}
#game-shell.portrait-mode .scene-caption{bottom:calc(226px + env(safe-area-inset-bottom,0px))}
#game-shell.portrait-mode .joystick-zone{bottom:calc(20px + env(safe-area-inset-bottom,0px))}
#game-shell.portrait-mode .action-zone{bottom:calc(29px + env(safe-area-inset-bottom,0px))}
#game-shell.short-portrait #scene{top:calc(149px + env(safe-area-inset-top,0px));bottom:calc(277px + env(safe-area-inset-bottom,0px))}
#game-shell.short-portrait .objective-hud{top:calc(111px + env(safe-area-inset-top,0px))}
#game-shell.short-portrait .camera-controls{bottom:calc(181px + env(safe-area-inset-bottom,0px))}
#game-shell.short-portrait .scene-caption{bottom:calc(229px + env(safe-area-inset-bottom,0px))}
@media(orientation:landscape) and (max-height:640px){
 #game-shell.compact .joystick-zone{left:max(22px,env(safe-area-inset-left,0px));bottom:max(24px,env(safe-area-inset-bottom,0px))}
 #game-shell.compact .action-zone{right:max(24px,env(safe-area-inset-right,0px));bottom:max(30px,env(safe-area-inset-bottom,0px))}
}

/* One circular arc: equal radii and 45-degree steps around Investigate.
   All breakpoints share these centers instead of independent edge offsets. */
#game-shell .game-panel .action-zone{
 --action-size:174px;
 --action-main-size:92px;
 --action-small-size:56px;
 --action-radius:98px;
 --action-center:calc(var(--action-size) - var(--action-main-size) / 2);
 --action-diagonal:calc(var(--action-radius) * .7071067811865476);
 width:var(--action-size);height:var(--action-size);transform:none;
}
#game-shell.compact .game-panel .action-zone{
 --action-size:150px;
 --action-main-size:78px;
 --action-small-size:48px;
 --action-radius:80px;
}
#game-shell .action-zone .action-main{
 inset:auto 0 0 auto;
 width:var(--action-main-size);height:var(--action-main-size);
}
#game-shell .action-zone .action-inner{
 width:calc(var(--action-main-size) * .64);height:calc(var(--action-main-size) * .64);
}
#game-shell .action-zone :is(.action-map,.action-journal,.action-bag){
 inset:auto;
 left:var(--action-center);top:var(--action-center);
 width:var(--action-small-size);height:var(--action-small-size);
 transform:translate(-50%,-50%);
}
#game-shell .action-zone .action-map{top:calc(var(--action-center) - var(--action-radius))}
#game-shell .action-zone .action-journal{
 left:calc(var(--action-center) - var(--action-diagonal));
 top:calc(var(--action-center) - var(--action-diagonal));
}
#game-shell .action-zone .action-bag{left:calc(var(--action-center) - var(--action-radius))}

/* Keep the current learning step readable without covering the dungeon. */
.tutorial-guide{position:absolute;left:50%;top:136px;transform:translateX(-50%);max-width:min(520px,92%);padding:6px 12px;border-radius:8px;background:#10231ded;color:#f0e8c2;font-size:12px;text-align:center;pointer-events:none;z-index:5}
#game-shell.portrait-mode .tutorial-guide{top:calc(154px + env(safe-area-inset-top,0px));font-size:11px;max-width:94%;width:max-content;padding:3px 6px}
#game-shell.compact:not(.portrait-mode) .tutorial-guide{top:92px;max-width:50%;font-size:11px}
#game-shell.tiny .tutorial-guide{display:none}
.tutorial-checklist{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:8px 16px;color:#e4d49d}
.staged-hints button{min-height:44px;width:100%;margin-top:8px}
#game-shell .object-label.compact-marker{width:44px;height:44px;min-width:44px;min-height:44px}
#game-shell .object-label.nearby{outline:2px solid var(--accent);outline-offset:3px}
.chest-skip{position:absolute;right:max(16px,env(safe-area-inset-right));top:max(16px,env(safe-area-inset-top));min-height:44px;background:#10231df2}
.chest-skip[hidden]{display:none}
.reward-crystal{color:#ffe39a;filter:drop-shadow(0 0 16px #f5c561);margin:16px auto}
.reward-crystal .icon{width:64px;height:64px}
@media(max-height:500px){.reward-crystal{margin:4px auto}.reward-crystal .icon{width:36px;height:36px}}
#game-shell.portrait-mode:not(.minimal-portrait):has(.tutorial-guide:not([hidden])) #scene{top:calc(194px + env(safe-area-inset-top,0px))}
#game-shell.portrait-mode .camera-controls .glass-icon{width:44px;min-width:44px;height:44px;min-height:44px}
#game-shell.portrait-mode .camera-controls .reset-view{width:130px;min-height:44px}

/* Reserve a separate caption row above the camera in short portrait.
   277 = camera bottom 181 + button 44 + gap 4 + caption 40 + scene gap 8. */
#game-shell.short-portrait #scene-caption{pointer-events:auto;touch-action:pan-y;flex:1;min-width:0;max-height:40px;overflow-y:auto;overflow-wrap:anywhere;white-space:normal;overscroll-behavior:contain}
#game-shell.short-portrait .caption-diamond{flex-shrink:0}

#game-shell.short-portrait #scene-caption:focus-visible{outline:2px solid #ffe995;outline-offset:2px}

/* Below 600px of visible portrait height, the objective and checklist replace
   the floating tutorial guide. Reclaim its 45px without moving the controls. */
#game-shell.minimal-portrait .tutorial-guide{display:none}
