#story{position:fixed;left:0;right:0;bottom:0;top:auto;width:100%;max-height:50dvh;z-index:8;display:grid;grid-template-columns:112px minmax(0,1fr) 170px;grid-template-rows:auto auto;gap:5px 18px;padding:24px max(22px,var(--safe-right)) calc(14px + var(--safe-bottom)) max(22px,var(--safe-left));border:2px solid #171a14;border-top-color:#877347;background-color:#30312b;background-image:linear-gradient(120deg,#46433799,#252b27dd),url('assets/ui-steel.png');box-shadow:inset 0 0 0 1px #aa925444,0 -3px 12px #0007;animation:story-in .14s ease-out;overflow:auto;overscroll-behavior:contain}
#story:before{content:'';position:absolute;left:0;right:0;top:0;height:7px;background:repeating-linear-gradient(135deg,#e3b34d 0 10px,#26271e 10px 21px)}
#story-portrait{grid-column:1;grid-row:1/3;width:112px;height:106px;object-fit:contain;align-self:center}
#story-speaker{grid-column:2;grid-row:1;font:900 30px 'Big Shoulders Display',Impact,sans-serif;color:#ffd17b;line-height:1.05;margin:0 34px 0 0;text-transform:uppercase;letter-spacing:.045em;align-self:end}
#story-text{grid-column:2;grid-row:2;margin:0;font:600 21px 'Barlow Condensed',Arial,sans-serif;line-height:1.2;color:#f0e2c2;overflow-wrap:break-word;align-self:start}
#story-next{grid-column:3;grid-row:1/3;align-self:center;min-height:48px;padding:10px;font-size:18px;letter-spacing:.025em;margin-right:28px}
#story-close{position:absolute;right:5px;top:8px;width:44px;min-height:44px;padding:0;font-size:25px;border:0;background:none;box-shadow:none;color:#dbc88f}
#story-close:hover{color:#fff0bb;background:#454539}
@keyframes story-in{from{opacity:0;translate:0 8px}to{opacity:1;translate:0 0}}
@media(max-width:600px){#story{grid-template-columns:82px minmax(0,1fr);gap:5px 10px;padding:22px 16px calc(12px + var(--safe-bottom));max-height:52dvh}#story-portrait{width:82px;height:114px;grid-row:1/4}#story-speaker{font-size:25px;margin-right:30px}#story-text{font-size:19px}#story-next{grid-column:2;grid-row:3;margin:4px 0 0;min-height:44px;font-size:17px}}
@media(max-height:430px){#story{max-height:57dvh;grid-template-columns:72px minmax(0,1fr) 122px;padding:20px 16px 10px;gap:4px 10px}#story-portrait{width:72px;height:78px;grid-row:1/3}#story-speaker{font-size:23px}#story-text{font-size:18px}#story-next{grid-column:3;grid-row:1/3;margin:0 20px 0 0;font-size:16px}}
@media(max-width:600px) and (max-height:430px){
 #story{max-height:calc(100dvh - 64px);grid-template-columns:44px minmax(0,1fr);padding:18px 12px calc(8px + var(--safe-bottom));gap:4px 8px}
 #story-portrait{width:44px;height:40px;grid-row:1;grid-column:1}
 #story-speaker{font-size:21px;align-self:center;margin-right:34px}
 #story-text{grid-column:1/-1;grid-row:2;font-size:16px}
 #story-next{grid-column:1/-1;grid-row:3;min-height:44px;padding:6px;margin:0;font-size:16px}
}
@media(prefers-reduced-motion:reduce){#story{animation:none}}
@media(max-width:600px){#story-speaker{margin-right:44px}}
@media(max-width:300px){#story-speaker{font-size:18px;letter-spacing:.02em;overflow-wrap:anywhere}}
/* Under 360px wide every pixel counts: the dialogue deck keeps its original tight spacing there. */
@media(max-width:359px){#story{padding:17px 12px calc(10px + var(--safe-bottom))}}
@media(max-width:359px) and (max-height:520px){#story{padding:12px 10px calc(8px + var(--safe-bottom))}}
/* Cinematics: only the world and the skip control stay on screen. */
#cine-skip{position:fixed;right:calc(14px + env(safe-area-inset-right,0px));bottom:calc(14px + env(safe-area-inset-bottom,0px));z-index:60;min-height:44px;padding:8px 18px;font:900 18px 'Big Shoulders Display',Impact,sans-serif;letter-spacing:.06em}
#cine-skip.hide{display:none}
body.cine #p1,body.cine #p2,body.cine #od,body.cine #mb,body.cine #offer,body.cine #pn,body.cine #tutorial,body.cine #story,body.cine #toast,body.cine #dbg-toggle{visibility:hidden}

/* Crystal Peak: the same plates in cold steel-blue; the icons keep their own colours. */
body.snow #p1,body.snow #p2,body.snow #od,body.snow #mb,body.snow #pn,body.snow #story,body.snow #cine-skip{filter:hue-rotate(172deg) saturate(1.15)}
body.snow #ic1,body.snow #ic2,body.snow #story-portrait{filter:hue-rotate(-172deg)}
#cine-skip{filter:none}

/* Clean reboot card. */
.reboot-clean{text-align:center}
.reboot-clean .reboot-lead{margin:26px 12px 8px;font:800 30px/1.15 'Big Shoulders Display',Impact,sans-serif;color:#ffe2a0}
.reboot-clean .reboot-small{margin:0 12px 24px;font:600 16px/1.3 'Barlow Condensed',Arial,sans-serif;color:var(--muted)}
.reboot-clean #reboot-confirm{width:100%}
/* The way home, while Tinker points it out. */
@keyframes home-pulse{0%,100%{box-shadow:0 0 0 0 #ffc060cc,0 0 10px #ffc06088;transform:scale(1)}50%{box-shadow:0 0 0 9px #ffc06000,0 0 34px #ffc060;transform:scale(1.08)}}
#od.home-pulse{animation:home-pulse 1s ease-in-out infinite!important;z-index:40}

/* The reboot has changed: players from older saves get a marker until they open it. */
#od .od-new{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;background:#e0402e;color:#fff;font:900 16px/1 'Big Shoulders Display',Impact,sans-serif}
@keyframes reboot-news{0%,100%{box-shadow:0 0 0 0 #ff5a46cc,0 0 10px #ff5a4688;transform:scale(1)}50%{box-shadow:0 0 0 9px #ff5a4600,0 0 30px #ff5a46;transform:scale(1.07)}}
#od.reboot-news{animation:reboot-news 1s ease-in-out infinite!important;z-index:9}

.reboot-clean .reboot-map{display:block;width:100%;max-height:44vh;object-fit:contain;margin:14px 0 4px}
.reboot-clean .reboot-lead{margin-top:10px}
/* Tutorial spotlight on the way home. */
#spot{position:fixed;border-radius:10px;box-shadow:0 0 0 200vmax rgba(4,8,14,.74);pointer-events:none;z-index:20}
#spot.hide{display:none}
body.spotlight #od{z-index:41}
body.spotlight #story{z-index:45}
