:root{--paper:#f3eee3;--ink:#292925;--muted:#655e54;--line:#b8b0a1;--accent:#743b32;--wash:#e9e2d5;--mark:#e5d2a3;--serif:'Iowan Old Style','Palatino Linotype',Palatino,Georgia,serif;--sans:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;--folio:ui-monospace,'Courier New',monospace;color-scheme:light;font-family:var(--sans);color:var(--ink);background:var(--paper)}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;overscroll-behavior:none}body{min-height:100svh;min-height:100dvh;display:flex;flex-direction:column}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;background:transparent;border:0;cursor:pointer;min-height:44px;min-width:44px;padding:8px 12px}a{color:inherit;text-underline-offset:4px}button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:3px}button:disabled{opacity:.38;cursor:default}[hidden]{display:none!important}.definitions,.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.icon{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex:none}.topbar{height:52px;flex:none;display:flex;align-items:center;justify-content:space-between;margin:0 28px;border-bottom:1px solid var(--line);padding-top:env(safe-area-inset-top)}.back{min-height:44px;display:inline-flex;align-items:center;gap:12px;text-decoration:none;font:23px var(--serif);font-variant:small-caps}.back>.left{transform:rotate(180deg)}.small-label,.eyebrow{font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}.small-label{margin-left:auto;margin-right:32px}.quiet{display:inline-flex;align-items:center;justify-content:center;gap:7px;font-size:12px;padding-inline:6px}.game-shell{width:min(100%,1000px);margin:auto;flex:1}.heading{height:70px;display:flex;align-items:center;justify-content:space-between;width:min(calc(100% - 40px),650px);margin:auto;gap:12px}.eyebrow{margin:0 0 6px}h1{font:38px/1 var(--serif);letter-spacing:-.035em;margin:0}.steps{display:flex;gap:8px;list-style:none;padding:0;margin:0;font:16px var(--serif);color:var(--muted)}.steps li{width:28px;height:28px;display:grid;place-items:center;border-bottom:1px solid var(--line)}.steps [aria-current]{color:var(--accent);border-color:var(--accent);border-bottom-width:3px}.steps [data-done=true]{background:var(--ink);color:var(--paper)}.arena{width:min(calc(100% - 28px),calc(100dvh - 260px),610px);margin:auto}.game-status{height:40px;display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px}.objective,.safety{display:flex;align-items:center;gap:6px}.objective{font-weight:600}.objective .icon{width:18px}.safety{color:var(--muted);white-space:nowrap}.safety[data-state=warning]{color:var(--accent);font-weight:600}.safety .icon{width:16px;height:16px}.board-wrap{width:100%;aspect-ratio:1;position:relative;isolation:isolate;user-select:none;-webkit-user-select:none}#castle{display:block;width:100%;height:100%;overflow:hidden;touch-action:none}#castle:focus{outline:none}#castle:focus-visible{outline:1px solid var(--accent);outline-offset:2px}.screen{position:absolute;inset:6%;display:block;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;background:rgb(243 238 227 / .96);z-index:4;box-shadow:0 0 20px 6px rgb(243 238 227 / .45);user-select:text;-webkit-user-select:text}.screen-inner{min-height:100%;width:100%;max-width:370px;margin:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:20px}.screen .eyebrow{font-size:9px;letter-spacing:.1em;margin:0 0 10px}.screen h2{font:clamp(25px,3.5vw,39px)/1.06 var(--serif);letter-spacing:-.025em;margin:0 0 12px}.screen p:not(.eyebrow){font:16px/1.45 var(--serif);margin:0 0 16px;max-width:32ch}.primary{display:inline-flex;align-items:center;justify-content:center;gap:18px;background:var(--accent);color:var(--paper);font-size:13px;padding:12px 18px;min-height:48px;flex:none}.primary:active{background:var(--ink)}.text-button{font-size:12px;text-decoration:underline;text-underline-offset:4px;flex:none}.screen .text-button{display:block;margin:4px auto 0;min-height:44px}.pickup{position:absolute;left:50%;bottom:6%;transform:translateX(-50%);display:flex;align-items:center;gap:8px;background:var(--paper);border:1px solid var(--accent);padding:9px 13px;max-width:90%;width:max-content;text-align:center;font:italic 18px var(--serif);pointer-events:none;z-index:2}.danger-track{position:absolute;bottom:1%;left:8.3%;width:83.4%;height:4px;overflow:hidden;pointer-events:none}#danger-fill{display:block;height:100%;width:0;background:var(--accent)}.controls{height:50px;display:flex;align-items:center;justify-content:center;gap:40px;padding:4px 12px}.control-title,.touch-note,.tiny,.dpad{display:none}.keyboard-note{font-size:11px;line-height:1.7;color:var(--muted);margin:0}.desktop-help{font:italic 14px/1.5 var(--serif);margin:0}.desktop-help span{display:block;color:var(--muted)}footer{min-height:45px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 28px;border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom);color:var(--muted)}footer>span{font:italic 12px var(--serif)}footer button{padding-inline:0}.screen #save-status,.save-status{margin:0 0 14px;padding:10px 0;color:var(--accent);border-top:1px solid var(--line);font:12px/1.45 var(--sans);text-align:left}dialog{border:1px solid var(--line);padding:0 24px 24px;background:var(--paper);color:var(--ink);width:min(560px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto}dialog::backdrop{background:#29292588}.dialog-head{position:sticky;top:0;background:var(--paper);display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-bottom:1px solid var(--line);margin-bottom:20px;z-index:1}.dialog-head h2{font:28px/1.15 var(--serif);margin:0}dialog p{font:17px/1.55 var(--serif);margin:18px 0}dialog .eyebrow{font:10px/1.6 var(--sans);margin:0}blockquote{font:23px/1.5 var(--serif);margin:18px 0 24px;padding-left:16px;border-left:2px solid var(--accent)}dialog .source-credit{font:12px/1.7 var(--sans);color:var(--muted);border-top:1px solid var(--line);padding-top:18px}.gentle{display:grid;grid-template-columns:24px 1fr;align-items:center;gap:8px;font-size:14px;cursor:pointer;min-height:70px;border-top:1px solid var(--line);padding-top:14px}.gentle input{width:19px;height:19px;accent-color:var(--accent);margin:0}.gentle span{grid-column:2;font:12px/1.5 var(--sans);color:var(--muted)}.no-script{position:fixed;inset:auto 12px 12px;background:var(--paper);border:1px solid var(--ink);padding:20px;z-index:20}
#castle .map-label{font:10px var(--folio);letter-spacing:1.3px;fill:#655e54;text-anchor:middle}#castle .cover-label{fill:#f3eee3;font:8px var(--sans);letter-spacing:1px;text-anchor:middle}#castle .target-label{font:10px var(--sans);font-weight:650;fill:#743b32;text-anchor:middle;paint-order:stroke;stroke:#f3eee3;stroke-width:3px;stroke-linejoin:round}#castle .sight{fill:#743b32;fill-opacity:.19;stroke:#743b32;stroke-opacity:.55;stroke-width:1.1}#castle .route{stroke:#a49a89;stroke-width:1;stroke-dasharray:2 6;fill:none}#castle .player-ring{stroke:#fffdf7;stroke-width:2;fill:none}#castle .danger-ring{fill:none;stroke:#743b32;stroke-width:3.7;transform:rotate(-90deg);stroke-linecap:round}#castle .object-halo{fill:#f3eee3;stroke:#743b32;stroke-width:1.1;stroke-dasharray:3 4}#castle .object[data-collected=true]{opacity:.33}#castle .door-leaves{transform-box:fill-box;transform-origin:center;transition:opacity .25s}#castle .door[data-open=true] .door-leaves{opacity:.13}#castle .door[data-open=true] .door-lock{display:none}#castle .candle-flame{fill:#e5d2a3;stroke:#743b32;stroke-width:.6}
@media(prefers-reduced-motion:no-preference){.primary,.direction{transition:background-color .12s,color .12s}.pickup{animation:found .2s ease-out}@keyframes found{from{opacity:0;translate:0 4px}to{opacity:1;translate:0 0}}#castle[data-playing=true] .candle-flame{animation:candle 2.4s ease-in-out infinite alternate}#castle[data-playing=true] .object:not([data-collected=true]) .object-halo{animation:breathe 2.4s ease-in-out infinite}@keyframes candle{to{opacity:.55}}@keyframes breathe{50%{stroke-opacity:.4}}}
@media(pointer:coarse),(max-width:900px){.topbar{height:48px;margin-inline:16px}.small-label{display:none}.game-shell{flex:1;display:flex;flex-direction:column;justify-content:center}.heading{height:62px;width:min(calc(100% - 32px),600px);margin:0 auto}.heading h1{font-size:32px}.heading .eyebrow{font-size:9px}.steps{gap:5px;font-size:15px}.steps li{width:24px;height:26px}.arena{width:min(calc(100% - 20px),calc(100dvh - 358px - env(safe-area-inset-bottom)),600px);margin:0 auto}.game-status{height:39px;font-size:11px}.safety .icon{display:none}.controls{height:160px;gap:28px;flex:none}.control-title{display:block;font:18px var(--serif)}.touch-note{display:block;font-size:12px;line-height:1.5;margin:5px 0;color:var(--muted)}.tiny{display:block;font:italic 12px var(--serif);color:var(--muted);margin:8px 0 0}.keyboard-note,.desktop-help{display:none}.dpad{display:grid;grid-template-columns:repeat(3,48px);grid-template-rows:repeat(3,48px);gap:2px;touch-action:none;user-select:none;-webkit-user-select:none}.direction{display:grid;place-items:center;border:1px solid var(--line);background:var(--wash);padding:0;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;border-radius:3px}.direction[aria-pressed=true]{color:var(--paper);background:var(--ink);border-color:var(--ink)}.direction .icon{width:23px;height:23px}.direction.up{grid-column:2;grid-row:1}.direction.up svg{transform:rotate(-90deg)}.direction.left{grid-column:1;grid-row:2}.direction.left svg{transform:rotate(180deg)}.direction.right{grid-column:3;grid-row:2}.direction.down{grid-column:2;grid-row:3}.direction.down svg{transform:rotate(90deg)}.dpad-centre{grid-row:2;grid-column:2;display:grid;place-items:center;color:var(--muted);pointer-events:none}footer{margin-inline:16px}footer>span{font-size:10px}.screen-inner{padding:15px}.screen h2{font-size:29px}.screen p:not(.eyebrow){font-size:15px;margin-bottom:12px}.screen .primary{font-size:12px;padding:10px 14px}.pickup{font-size:16px;padding:8px 12px}}
@media(max-height:720px) and (max-width:599px){.topbar{height:44px}.heading{height:54px}.heading h1{font-size:29px}.heading .eyebrow{font-size:8px}.game-status{height:37px;font-size:10px}.arena{width:min(calc(100% - 20px),calc(100dvh - 315px - env(safe-area-inset-bottom)))}.controls{height:135px;gap:26px}.dpad{grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);gap:1px}.screen-inner{padding:12px}.screen .eyebrow{font-size:8px;margin-bottom:8px}.screen h2{font-size:25px;margin-bottom:8px}.screen p:not(.eyebrow){font-size:13px;margin-bottom:10px}.screen .primary{min-height:44px}footer>span{display:none}}
@media(max-height:520px) and (min-width:600px){.topbar{height:44px;margin-inline:max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right))}.game-shell{display:grid;grid-template-columns:minmax(0,1fr) 170px;grid-template-rows:60px 1fr;width:min(calc(100% - 32px),calc(100dvh + 100px));padding:0 6px;gap:0 14px}.heading{grid-column:2;grid-row:1;width:100%;height:60px;display:block;padding-top:4px}.heading h1{font-size:25px}.heading .eyebrow{font-size:8px;letter-spacing:.04em}.steps{display:none}.arena{grid-column:1;grid-row:1/3;width:min(100%,calc(100dvh - 122px - env(safe-area-inset-bottom)));align-self:center}.game-status{height:30px;font-size:9px}.objective .icon{width:14px}.controls{grid-column:2;grid-row:2;flex-direction:column;height:auto;padding:0;gap:3px;justify-content:center}.control-note{order:2;text-align:center}.control-title,.tiny{display:none}.touch-note{font-size:10px;line-height:1.3;margin:4px 0}.touch-note br{display:none}.dpad{display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);gap:1px}.screen-inner{padding:12px}.screen h2{font-size:24px;margin-bottom:8px}.screen .eyebrow{font-size:8px;margin-bottom:8px}.screen p:not(.eyebrow){font-size:13px;margin-bottom:10px}.screen .primary{min-height:44px;font-size:11px;padding:8px 12px}.pickup{font-size:13px;padding:6px 8px}footer{min-height:45px;margin-inline:16px}footer>span{font-size:10px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

#bearing{width:14px;height:14px;color:var(--accent);flex:none}#floor-plan{display:block;width:100%;max-height:45dvh;font-family:var(--sans)}#map-panel #plan-summary{margin-top:0}#map-panel .plan-caption{display:flex;align-items:center;gap:7px;font:12px/1.5 var(--sans);color:var(--muted);margin:12px 0}.you-dot{display:inline-block;width:10px;height:10px;flex:none;border-radius:50%;background:var(--accent)}#plan-objects{padding-left:24px;font:14px/1.8 var(--sans)}#plan-objects span{color:var(--muted)}
/* Journal openings have their own reading space; Start stays within reach. */
body[data-mode=ready]{height:100svh;height:100dvh}
body[data-mode=ready] .game-shell{display:none}
/* Actual header and footer rows bound the opening, even when their text wraps. */
body[data-mode=ready] .chapter-screen{position:static;flex:1;min-height:0}
body[data-mode=ready] .chapter-actions{flex-wrap:wrap}
body[data-mode=ready] .chapter-actions .primary{max-width:100%}
.chapter-screen{position:fixed;inset:52px 0 calc(45px + env(safe-area-inset-bottom));z-index:6;display:flex;flex-direction:column;background:var(--paper);padding-inline:max(20px,env(safe-area-inset-left)) max(20px,env(safe-area-inset-right));user-select:text;-webkit-user-select:text}
.chapter-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y}
.chapter-sheet,.chapter-actions{width:min(100%,640px);margin:0 auto}
.chapter-sheet{padding-top:22px}.chapter-screen h2{font:40px/1.08 var(--serif);letter-spacing:-.025em;margin:6px 0 18px}.chapter-illustration{width:100%;margin-bottom:20px}.chapter-illustration svg{display:block;width:100%;height:auto;max-height:166px}.chapter-screen blockquote{font:25px/1.42 var(--serif);border:0;padding:0;margin:0;max-width:47ch}.chapter-source{display:flex;align-items:center;min-height:44px;font:11px/1.5 var(--sans);color:var(--muted);width:fit-content;padding:7px 0;max-width:100%}.chapter-goal{font:15px/1.55 var(--sans);margin:12px 0 9px;max-width:58ch}.chapter-scope{font:11px/1.5 var(--sans);color:var(--muted);margin:0 0 10px}.chapter-actions{flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 0;background:var(--paper);border-top:1px solid var(--line)}.chapter-actions .primary{min-width:160px}.chapter-actions .text-button{font-size:11px}.source-passage p{white-space:pre-wrap}.source-loading{font:13px/1.6 var(--sans);color:var(--muted)}
@media(pointer:coarse),(max-width:900px){.chapter-screen{top:48px}.chapter-sheet{padding-top:18px}.chapter-screen h2{font-size:34px;margin-bottom:14px}.chapter-screen blockquote{font-size:23px;line-height:1.4}.chapter-illustration{margin-bottom:18px}.chapter-actions{padding-block:10px}.steps{gap:3px;font-size:13px}.steps li{width:19px}.heading h1{font-size:30px}}
@media(max-width:380px){.heading h1{font-size:27px}.heading .eyebrow{max-width:175px;line-height:1.35}.steps{gap:2px;font-size:12px}.steps li{width:16px}.chapter-screen{padding-inline:18px}.chapter-screen h2{font-size:30px}.chapter-screen blockquote{font-size:21px}.chapter-goal{font-size:13px;line-height:1.5}.chapter-illustration{margin-bottom:14px}.chapter-actions .primary{min-width:150px;font-size:12px}.chapter-actions .text-button{max-width:110px}}
@media(max-height:720px) and (max-width:599px){.chapter-screen{top:44px}.chapter-sheet{padding-top:12px}.chapter-screen h2{margin-top:4px;margin-bottom:12px}.chapter-actions{padding-block:8px}}
@media(max-height:520px) and (min-width:600px){.chapter-screen{top:44px}.chapter-sheet{padding-top:12px}.chapter-screen h2{font-size:28px;margin-bottom:10px}.chapter-screen blockquote{font-size:21px}.chapter-illustration{float:right;width:40%;margin:0 0 12px 24px}.chapter-source{clear:none}.chapter-actions{padding-block:7px}}

@media(max-height:650px) and (max-width:380px){.chapter-sheet{padding-top:10px}.chapter-screen h2{font-size:28px;margin-bottom:10px}.chapter-illustration{height:54px;margin-bottom:12px;overflow:hidden}.chapter-illustration svg{height:100%;max-height:none}.chapter-screen blockquote{font-size:20px;line-height:1.35}.chapter-goal{margin-top:6px;line-height:1.4}}

.source-passage mark{background:#e5d2a380;color:inherit;box-decoration-break:clone;-webkit-box-decoration-break:clone}

.topbar,.heading,.game-status,.controls{height:auto}
.topbar{min-height:52px;flex-wrap:wrap}
.heading{min-height:70px;padding-block:0}
.heading>div{min-width:0}
.heading h1{overflow-wrap:break-word}
.steps{flex-shrink:0}
.game-status{min-height:40px;flex-wrap:wrap;padding-block:6px}
.controls{min-height:50px;flex-wrap:wrap;padding-block:0}
.control-note{min-width:0;max-width:100%}
footer{flex-wrap:wrap}
footer>span{min-width:0}
@media(pointer:coarse),(max-width:900px){.topbar{min-height:48px}.heading{min-height:62px}.game-status{min-height:39px}.controls{min-height:160px}.control-note{flex:0 1 120px}}
@media(max-height:720px) and (max-width:599px){.topbar{min-height:44px}.heading{min-height:54px}.game-status{min-height:37px}.controls{min-height:135px}}
@media(max-height:520px) and (min-width:600px){.topbar{min-height:44px}.heading{min-height:60px}.game-status{min-height:30px}.controls{min-height:0}.control-note{flex-basis:auto}}
