@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap');
*{box-sizing:border-box}body{margin:0;background:#f5f3e9;color:#243e3c;font-family:'DM Sans',sans-serif}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer}header{max-width:1400px;margin:auto;padding:26px 48px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #d9ded2}.brand{font-family:'Fraunces',Georgia,serif;font-size:28px;text-decoration:none;color:inherit}.brand span{color:#bd7c37;font-size:36px;vertical-align:middle;margin-right:8px}.edition, .eyebrow{font-size:10px;letter-spacing:2px;font-weight:700}header button{border:1px solid #d1d8ca;background:transparent;border-radius:24px;padding:10px 16px;color:#435650;font-size:12px}main{max-width:1400px;margin:auto;padding:0 48px}.intro{display:flex;justify-content:space-between;align-items:center;padding:36px 0 30px}.eyebrow{color:#7e8d68}h1{font-family:'Fraunces',Georgia,serif;font-weight:500;font-size:43px;letter-spacing:-1.8px;line-height:1.13;margin:13px 0 0}h1 em{font-weight:500;color:#7c8c62}.intro>p{font-size:13px;line-height:1.85;color:#718078;margin-right:30px}.game{position:relative;border-radius:18px;overflow:hidden;background:#78bfc3;box-shadow:0 16px 35px #223e3b16;aspect-ratio:2/1}canvas{display:block;width:100%;height:100%;outline:none}.hud{position:absolute;top:22px;left:26px;right:26px;display:flex;justify-content:space-between;pointer-events:none;color:#fff;text-shadow:0 1px 4px #254c54}.hud>div>span{font-size:10px;letter-spacing:1.5px}.hud strong{display:block;font-size:12px;margin-top:6px;font-weight:500}.stats{display:flex;gap:18px;align-items:center}.stats span{white-space:nowrap}.stats button{pointer-events:auto;background:#183e4250;border:1px solid #ffffff60;border-radius:50%;color:white;width:32px;height:32px}.overlay{position:absolute;inset:0;background:linear-gradient(90deg,#123e42e8,#183c4270 52%,transparent 80%);display:flex;align-items:flex-start;justify-content:center;flex-direction:column;padding:55px;color:#fff}.overlay.hidden{display:none}.overlay .eyebrow{color:#f0cf86}h2{font-family:'Fraunces',Georgia,serif;font-weight:500;font-size:54px;line-height:1.05;letter-spacing:-1px;margin:18px 0}.overlay p{max-width:325px;font-size:13px;line-height:1.7;color:#e0e9df}.primary{background:#f0ca7d;color:#29463f;border:0;padding:16px 23px;border-radius:7px;margin:16px 0;font-weight:700;font-size:12px;box-shadow:0 4px 0 #b48d49}.primary span{margin-left:28px}.overlay small{font-size:10px;color:#c9d9cf}.under{display:flex;justify-content:space-between;padding:18px 2px;font-size:10px;color:#879081}kbd{display:inline-block;border:1px solid #d5d9cc;border-radius:4px;padding:3px 6px;margin:0 3px;font:9px 'DM Sans',sans-serif}.chapters{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin:14px 0 34px}.chapters button{display:flex;align-items:center;text-align:left;background:#efefe3;border:1px solid #dce1d1;border-radius:10px;padding:22px;gap:18px;color:inherit}.chapters button.selected{background:#e6ebdc;border-color:#8e9d76}.number{font-family:Georgia,serif;font-size:21px;color:#82916f}.chapters small{font-size:8px;letter-spacing:1.4px;color:#7b8a6b}.chapters strong{display:block;font-family:'Fraunces',Georgia,serif;font-size:21px;font-weight:500;margin:6px 0}.chapters div>span{font-size:11px;color:#7b8675}.chapter-icon{font-size:37px;margin-left:auto;color:#9daa85}footer{display:flex;align-items:center;justify-content:space-between;border-top:1px solid #d9ded2;padding:20px 0;font-size:8px;letter-spacing:1px;color:#8c9586}footer p{letter-spacing:0;font-size:10px}.touch{position:absolute;bottom:14px;left:16px;right:16px;display:none;gap:10px}.touch button{background:#143e4260;border:1px solid #ffffff80;border-radius:50%;color:white;font-size:24px;width:48px;height:48px;touch-action:none}.touch button:nth-child(3){margin-left:auto}#toast{position:absolute;bottom:25px;left:50%;transform:translateX(-50%);color:white;background:#244641d9;border-radius:30px;padding:10px 22px;font-size:12px;opacity:0;pointer-events:none;transition:opacity .2s;white-space:nowrap}button:focus-visible,a:focus-visible{outline:3px solid #cb9143;outline-offset:4px}@media(pointer:coarse){.touch{display:flex}.under>span:first-child{visibility:hidden}#toast{bottom:75px}}@media(max-width:700px){header{padding:18px 20px}.edition{display:none}main{padding:0 16px}.intro{padding:25px 4px}.intro>p{display:none}h1{font-size:32px}.game{aspect-ratio:1.1}.overlay{padding:26px}h2{font-size:40px}.hud{left:16px;right:16px;top:15px}.hud strong{max-width:160px;font-size:10px}.stats{gap:10px}.chapters{gap:8px}.chapters button{padding:13px 9px;gap:6px;align-items:flex-start}.number{font-size:13px}.chapters small{font-size:6px;letter-spacing:.5px}.chapters strong{font-size:16px}.chapters div>span{font-size:9px}.chapter-icon{display:none}.under{font-size:8px}.under>span:last-child{display:none}footer>span:last-child{display:none}footer p{max-width:220px;font-size:8px}}

@media(max-width:700px){.overlay{overflow-y:auto;justify-content:flex-start;padding-top:64px}.overlay h2{font-size:32px;margin:12px 0}.overlay p{margin:6px 0;font-size:12px}.primary{padding:12px 18px;margin:10px 0}.overlay small{padding-bottom:8px}.hud{z-index:2;pointer-events:none}.stats button{pointer-events:auto}}
/* Responsive playfield: world units follow the viewport, never stretch the artwork. */
.header-actions{display:flex;gap:8px}.game{isolation:isolate;height:clamp(390px,52vw,640px);aspect-ratio:auto;background:#1e403c}.game canvas{width:100%;height:100%;touch-action:none}.hud{z-index:3;gap:12px}.hud>div:first-child{padding:10px 14px;background:#173b376b;border:1px solid #ffffff20;backdrop-filter:blur(8px);border-radius:10px}.stats{align-self:flex-start;padding-top:8px}.stats>span{padding:7px 10px;background:#173b376b;border-radius:18px;font-size:11px!important;letter-spacing:.5px!important}.stats button{width:38px;height:38px;font-size:18px}.overlay{z-index:5;padding:34px 52px;background:linear-gradient(90deg,#112e32e8 0%,#142f3299 48%,#12343a18 85%);overflow-y:auto;overscroll-behavior:contain}.overlay-content{max-width:450px;margin:auto 0;padding:45px 0 10px}.overlay h2{font-size:clamp(35px,4.5vw,57px)}.overlay p{font-size:14px;max-width:370px}.overlay small{display:block;max-width:360px;line-height:1.6}.primary{min-height:48px;font-size:13px}.touch{z-index:4;pointer-events:none;align-items:center;justify-content:space-between;bottom:max(16px,env(safe-area-inset-bottom));left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right))}.touch button{pointer-events:auto;width:64px;height:64px;border:1px solid #f8e9c17a;background:#193f39a8;box-shadow:inset 0 2px 0 #ffffff20,0 4px 0 #102a3266;backdrop-filter:blur(8px);font-weight:700;display:flex;align-items:center;justify-content:center;flex-direction:column;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.touch button small{font-size:8px;letter-spacing:1px;margin-top:0;color:#e5e4c5}.touch button span{font-size:27px;line-height:1.1}.touch button[data-action="jump"]{width:74px;height:74px;background:#cfab68dd;color:#203e35;border-color:#fff1bb}.touch button[data-action="jump"] small{color:#324c3a}.touch button.pressed{transform:translateY(3px);background:#f2d99a;color:#243f39;box-shadow:inset 0 2px 8px #66593244}.move-controls,.action-controls{display:flex;align-items:center;gap:12px}.game:not(.is-playing) .touch{visibility:hidden}.under{gap:15px;align-items:center;flex-wrap:wrap}.under button,#menu-actions button{background:none;border:0;color:#718268;font:inherit;cursor:pointer;padding:10px;min-height:40px}#menu-actions{display:flex;gap:12px;margin-top:9px;font-size:11px}#menu-actions button{color:#e6dabd;padding-left:0}#toast{z-index:6;max-width:90%;white-space:normal;text-align:center;line-height:1.4;width:max-content}#controller-status{font-size:10px}.level-progress{position:absolute;left:0;right:0;bottom:0;height:3px;background:#102c3355;z-index:4}.level-progress i{display:block;height:100%;background:#f6d993;width:0}.game-focus{overflow:hidden}.game-focus .game{position:fixed;inset:0;width:100%;height:100vh;height:100dvh;z-index:100;border-radius:0}.game-focus .hud{top:max(15px,env(safe-area-inset-top));left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right))}.game-focus .overlay{padding-left:max(30px,env(safe-area-inset-left));padding-right:max(24px,env(safe-area-inset-right))}dialog{border:1px solid #ccd5bd;border-radius:18px;padding:32px;max-width:440px;width:calc(100% - 32px);max-height:85vh;overflow:auto;background:#f5f3e9;color:#243e3c;box-shadow:0 25px 80px #071d3055}dialog::backdrop{background:#102e38bb;backdrop-filter:blur(5px)}dialog h2{font-size:36px;margin-top:12px}dialog p{font-size:13px;line-height:1.65}.close{float:right;background:none;border:0;font-size:28px;color:#526659;width:40px;height:40px}.file-picker{display:block;background:#e8dfc5;border:1px dashed #b49d6b;border-radius:8px;padding:16px;font-size:13px;cursor:pointer}.file-picker input{display:block;width:100%;margin-top:12px;font-size:12px}.volume-label{display:flex;gap:15px;align-items:center;font-size:12px;margin:20px 0}.volume-label input{flex:1;min-width:0;accent-color:#7c9063}#music-toggle{border:0;border-radius:6px;padding:13px 22px;background:#274f43;color:white}#music-toggle:disabled{opacity:.4}.music-note{color:#7e886e}.chapters button{position:relative;overflow:hidden}.chapters button::after{content:'';position:absolute;right:0;top:0;width:35%;height:100%;opacity:.15;background:url('assets/david-worlds.png') top right/auto 300%;mask-image:linear-gradient(90deg,transparent,#000)}.chapters button:nth-child(2)::after{background-position:right center}.chapters button:nth-child(3)::after{background-position:right bottom}@media(any-pointer:coarse){.touch{display:flex}.keyboard-hint{display:none!important}#toast{bottom:110px}.game{height:clamp(400px,65vh,660px)}}@media(max-width:700px){header{padding:16px 18px}.brand{font-size:24px}.brand span{font-size:29px}header button{font-size:10px;padding:9px 12px}.intro{padding:22px 4px}main{padding:0 12px}.game{height:clamp(460px,67svh,620px);border-radius:14px}.hud{left:12px;right:12px;top:12px;gap:6px}.hud>div:first-child{padding:8px 9px;max-width:52%}.hud>div>span{font-size:8px;letter-spacing:.8px}.hud strong{max-width:180px;font-size:9px;line-height:1.4}.stats{gap:5px;padding-top:3px;flex-wrap:wrap;justify-content:flex-end;max-width:49%}.stats>span{font-size:9px!important;padding:7px}.stats button{height:34px;width:34px;font-size:16px}.overlay{padding:22px}.overlay-content{padding:65px 0 10px;max-width:100%;margin:auto 0}.overlay h2{font-size:38px}.overlay p{font-size:13px}.overlay small{font-size:10px}.under{padding:8px 1px;gap:2px}#controller-status{max-width:63%;font-size:9px;line-height:1.5}.under button{font-size:10px}footer{padding-bottom:calc(20px + env(safe-area-inset-bottom))}.chapters{margin-top:10px}.chapters button{min-height:115px}.chapter-icon{display:none}}@media(max-height:540px) and (orientation:landscape){.game{height:100svh;min-height:280px}.game-focus .game{height:100dvh}.hud{top:8px}.overlay{padding:12px 28px}.overlay-content{padding-top:42px;max-width:70%;margin:auto 0}.overlay h2{font-size:30px;margin:8px 0}.overlay h2 br{display:none}.overlay p{font-size:12px;line-height:1.4;margin:8px 0;max-width:470px}.primary{padding:10px 18px;min-height:42px;margin:8px 0}.overlay small{font-size:9px}#menu-actions{margin:0}.touch button{width:55px;height:55px}.touch button[data-action="jump"]{width:63px;height:63px}.touch{bottom:max(10px,env(safe-area-inset-bottom))}.hud strong{margin-top:3px}.hud>div:first-child{padding:6px 10px}.overlay .eyebrow{font-size:8px}#toast{bottom:90px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
@media(max-width:900px){.touch{display:flex}.keyboard-hint{display:none!important}#toast{bottom:110px}.under>span:first-child{visibility:visible}}
@media(max-width:360px){.touch{left:12px;right:12px}.touch button{width:56px;height:56px}.touch button[data-action="jump"]{width:64px;height:64px}.move-controls,.action-controls{gap:8px}.stats>span{padding:5px;font-size:8px!important}.hud>div:first-child{max-width:50%}.overlay{padding:18px}.overlay h2{font-size:33px}}
#prayer-hud{color:#d0efff!important;border:1px solid #6dbaff80;background:#183e68bb}.stats{flex-wrap:wrap;justify-content:flex-end;max-width:55%}.touch [data-action="pray"]{position:absolute;right:9px;bottom:88px;width:58px;height:58px;background:#174e87dd;border-color:#93dfff;color:#d4f4ff;box-shadow:0 0 18px #379dff44}.touch [data-action="pray"] small{color:#d4f4ff}.touch [data-action="pray"][hidden],#prayer-hud[hidden]{display:none!important}@media(max-width:700px){.stats{max-width:50%}#prayer-hud{order:5;font-size:9px!important}.hud>div:first-child{max-width:47%}}@media(max-height:540px) and (orientation:landscape){.touch [data-action="pray"]{right:76px;bottom:72px;width:48px;height:48px}}@media(max-width:360px){.touch [data-action="pray"]{right:3px;bottom:78px;width:54px;height:54px}}
.scroll-tip{position:absolute;z-index:8;width:310px;padding:18px 20px;border:1px solid #d8cda8;border-radius:14px;background:#fff9eaf5;color:#294338;box-shadow:0 12px 40px #132f4255;backdrop-filter:blur(8px);max-height:calc(100% - 105px);overflow-y:auto}.scroll-tip[hidden]{display:none}.scroll-tip::after{content:'';position:absolute;left:45%;bottom:-7px;width:14px;height:14px;background:#fff9ea;transform:rotate(45deg)}.tip-kicker{font-size:9px;letter-spacing:1.5px;color:#8b7754;font-weight:700}.scroll-tip h3{font:500 23px/1.15 'Fraunces',Georgia,serif;margin:10px 0}.scroll-tip p{font-size:13px;line-height:1.6;margin:0 0 10px}.scroll-tip small{display:block;font-size:10px;color:#817b65}.scroll-tip button{margin-top:14px;border:0;border-radius:7px;background:#e5d4a2;color:#294338;padding:10px 13px;min-height:44px;font:600 11px 'DM Sans',sans-serif}@media(max-height:540px) and (orientation:landscape){.scroll-tip{padding:12px 16px}.scroll-tip h3{font-size:20px;margin:6px 0}.scroll-tip p{font-size:12px;line-height:1.4}.scroll-tip button{margin-top:8px}}
/* Keep touch controls below the playfield, never over David or the flock. */
@media(any-pointer:coarse),(max-width:900px){.game canvas{height:calc(100% - 94px)}.touch [data-action="pray"]{left:50%;right:auto;bottom:8px;transform:translateX(-50%);width:50px;height:50px}.touch [data-action="pray"].pressed{transform:translate(-50%,3px)}}
@media(max-width:700px){.touch{left:12px;right:12px}.touch button{width:56px;height:56px}.touch button[data-action="jump"]{width:64px;height:64px}.move-controls,.action-controls{gap:8px}.touch [data-action="pray"]{width:48px;height:48px;bottom:6px}}
@media(max-width:360px){.touch button{width:48px;height:48px}.touch button[data-action="jump"]{width:56px;height:56px}.touch [data-action="pray"]{width:44px;height:44px;bottom:6px}}
@media(max-height:540px) and (orientation:landscape){.game canvas{height:calc(100% - 76px)}.touch [data-action="pray"]{bottom:5px}}
