:root{color-scheme:dark;--ink:#101016;--paper:#e7ddc8;--gold:#c6a273;--muted:#938a82;--line:#353039;--surface:#191820}
*{box-sizing:border-box}body{margin:0;background:var(--ink);color:var(--paper);font-family:Georgia,'Times New Roman',serif}body:before{content:"";position:fixed;inset:0;pointer-events:none;opacity:.12;background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.18' d='M0 0h180v180H0z'/%3E%3C/svg%3E")}main{width:min(100% - 80px,1040px);margin:auto}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer}button:focus-visible,a:focus-visible,canvas:focus-visible{outline:2px solid var(--gold);outline-offset:5px}.skip{position:absolute;left:20px;top:-100px;z-index:5;padding:12px;background:var(--paper);color:var(--ink)}.skip:focus{top:10px}.masthead{height:112px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.wordmark{display:flex;gap:14px;align-items:center;color:var(--paper);text-decoration:none;font-family:Arial,sans-serif;font-weight:600;font-size:13px;letter-spacing:3px;line-height:1.5}.wordmark svg{width:30px;height:38px;fill:none;stroke:var(--gold);stroke-width:1.3}.edition{font:9px/1.8 'Courier New',monospace;letter-spacing:1.6px;text-align:right;color:var(--gold)}.edition-line{display:block;color:var(--muted)}.chapter{display:flex;align-items:flex-end;justify-content:space-between;padding:38px 0 28px}.overline{margin:0 0 14px;font:10px 'Courier New',monospace;letter-spacing:2.1px;color:var(--gold);display:flex;align-items:center;gap:10px}.chapter-number{border:1px solid #66513e;display:inline-grid;place-items:center;width:21px;height:21px;letter-spacing:0}h1{font-weight:400;font-size:clamp(30px,4vw,46px);line-height:1.1;letter-spacing:-1.5px;margin:0}.chapter-note{font-size:13px;font-style:italic;line-height:1.65;color:var(--muted);margin:0 0 2px;text-align:right}.game-section{border:1px solid #66503a;box-shadow:0 15px 55px #0004;position:relative}.frame-top{height:34px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;border-bottom:1px solid #66503a;background:#1d1a20;font:8px 'Courier New',monospace;letter-spacing:1.5px;color:var(--gold)}.status-dot{display:inline-block;width:4px;height:4px;margin-right:5px;background:var(--gold);vertical-align:2px}.divider{color:#6c5d50;padding:0 7px}.canvas-wrap{position:relative;background:#09090e;aspect-ratio:8/5}canvas{display:block;width:100%;height:100%;image-rendering:auto;touch-action:none;-webkit-touch-callout:none;user-select:none;outline:none}#loading{position:absolute;inset:0;background:#111018;display:flex;align-items:center;justify-content:center;flex-direction:column;font-family:'Courier New',monospace;text-align:center}.loading-emblem{color:var(--gold);font:44px Georgia,serif;border:1px solid #514332;width:64px;height:80px;display:grid;place-items:center}.loading-emblem:after{content:"";width:20px;height:1px;background:var(--gold);animation:breath 1.6s infinite}#loading p{font-size:12px;color:var(--paper);margin:26px 20px 12px}#loading small{font-size:10px;color:var(--muted)}#loading.hidden{display:none}.game-toolbar{min-height:45px;display:flex;justify-content:space-between;align-items:center;padding:0 14px;background:#1d1a20;border-top:1px solid #43372e;font:11px 'Courier New',monospace}.game-toolbar button{border:0;background:transparent;color:var(--muted);padding:12px 8px;font:inherit;min-height:44px}.game-toolbar button:hover{color:var(--paper)}#play{color:var(--gold)}#play span{margin-right:7px}.toolbar-right{display:flex;align-items:center;gap:14px}kbd{display:inline-grid;place-items:center;border:1px solid #4d4544;border-bottom:2px solid #4d4544;border-radius:2px;min-width:23px;height:23px;padding:0 5px;font:10px 'Courier New',monospace;color:#c1b6a6}.game-toolbar kbd{height:16px;min-width:16px;font-size:8px;margin-left:5px}.field-notes{display:grid;grid-template-columns:1fr 1fr 1.2fr;padding:27px 0 28px;border-bottom:1px solid var(--line);gap:22px}.note-label{font:8px 'Courier New',monospace;letter-spacing:1.7px;color:var(--gold)}.control p{display:flex;align-items:center;gap:4px;margin:13px 0 0}.control p span{font-size:11px;color:var(--muted);margin-left:7px;white-space:nowrap}.control p kbd+span+kbd{margin-left:8px}footer{display:flex;align-items:center;justify-content:space-between;padding:24px 0 32px;font-size:12px;line-height:1.8;color:var(--muted)}footer p{margin:0}footer p span{font-size:10px;color:#746d68}footer a{font:9px 'Courier New',monospace;color:var(--gold);text-decoration:none;letter-spacing:1.3px}footer a span{margin-left:8px}.rotate-note{display:none}@keyframes breath{50%{opacity:.2;transform:scaleX(.4)}}@media(prefers-reduced-motion:reduce){*{animation:none!important}}@media(max-width:800px){main{width:calc(100% - 40px)}.masthead{height:88px}.chapter{padding-top:28px}h1{font-size:36px}.field-notes{grid-template-columns:1fr 1fr}.control:last-child{grid-column:1/-1}.chapter-note{font-size:11px}.edition{font-size:8px;letter-spacing:1px}}@media(max-width:520px){main{width:calc(100% - 24px)}.masthead{height:76px}.wordmark{font-size:10px;letter-spacing:2px;gap:10px}.wordmark svg{width:24px}.edition{font-size:7px}.edition-line{display:none}.chapter{padding:24px 0 20px}.overline{font-size:8px;margin-bottom:10px}h1{font-size:30px;letter-spacing:-1px}.chapter-note{display:none}.frame-top{font-size:7px;letter-spacing:.6px;padding:0 8px}.frame-top>span:last-child{font-size:6px}.toolbar-right{gap:0}.game-toolbar{padding:0 4px;font-size:9px}.game-toolbar kbd{display:none}#fullscreen span{display:none}.field-notes{gap:18px;padding:22px 0}.control p span{font-size:10px;white-space:normal}.control kbd{min-width:18px;height:21px;font-size:9px}.control p{gap:2px}.note-label{font-size:7px;letter-spacing:1px}footer{gap:15px;font-size:11px;align-items:flex-start}footer a{white-space:nowrap;font-size:7px}footer p span{font-size:9px}}@media(pointer:coarse){.canvas-wrap{aspect-ratio:320/264}.field-notes{display:none}.game-section{touch-action:none}.rotate-note{display:block;color:var(--muted);font-size:11px;text-align:center;margin:18px 0}}@media(pointer:coarse) and (orientation:landscape){main{width:min(100% - env(safe-area-inset-left) - env(safe-area-inset-right),760px)}.masthead,.chapter,.frame-top,.field-notes,footer,.rotate-note{display:none}.game-section{border:0;box-shadow:none;width:min(100%,calc((100dvh - 44px)*320/264));margin:auto}.game-toolbar{font-size:9px;min-height:40px}.game-toolbar button{min-height:40px;padding:8px}.game-toolbar kbd{display:none}}.game-section:fullscreen{background:var(--ink);width:100%;height:100%;border:0;display:flex;flex-direction:column;justify-content:center}.game-section:fullscreen .canvas-wrap{height:calc(100% - 45px);width:100%;aspect-ratio:auto}.game-section:fullscreen .frame-top{display:none}

/* The mobile webview is a viewport-sized handheld, with a separate input deck. */
.handheld-controls{display:none}
@media(pointer:coarse){
  html,body{width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
  body:before{display:none}
  main{width:100%;height:100dvh;margin:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);background:#282631}
  .masthead,.chapter,.field-notes,footer,.rotate-note{display:none}
  #game,#game:fullscreen{width:100%;height:100%;margin:0;border:0;box-shadow:none;background:#282631;display:flex;flex-direction:column;justify-content:initial;overflow:hidden}
  .frame-top{display:flex;flex:none;height:30px;padding:0 14px;background:#201e28;font-size:7px;letter-spacing:.8px}
  .frame-top>span:last-child{display:none}
  #game .canvas-wrap,#game:fullscreen .canvas-wrap{position:relative;container-type:size;flex:1;min-height:0;width:100%;height:auto;aspect-ratio:auto;background:#101016;border:10px solid #201e28;border-radius:0 0 20px 20px}
  #game canvas{position:absolute;width:min(100cqw,160cqh);height:min(62.5cqw,100cqh);left:50%;top:50%;transform:translate(-50%,-50%);border:1px solid #554a3b;border-radius:2px}
  .game-toolbar{flex:none;min-height:44px;padding:0 8px;background:#282631;border:0;font-size:9px;gap:4px}
  .toolbar-right{gap:0;flex:1;justify-content:flex-end;min-width:0}
  .game-toolbar button{padding:8px 6px;min-height:44px;white-space:nowrap}
  .game-toolbar kbd,#fullscreen span{display:none}
  #play span{margin-right:3px}
  .handheld-controls{display:flex;flex-direction:column;flex:none;height:clamp(200px,33dvh,290px);padding:10px 20px 14px;touch-action:none;user-select:none;-webkit-touch-callout:none;border-top:1px solid #49434f;background:#302d3b}
  .console-label,.console-bottom{display:flex;justify-content:space-between;align-items:center;font:8px 'Courier New',monospace;letter-spacing:1.4px;color:#a8a0b3}
  .console-label span:last-child{font-size:7px;color:#80788f}
  .control-deck{display:flex;align-items:center;justify-content:space-between;flex:1;gap:14px}
  .dpad{--key:min(14vw,56px);display:grid;grid-template:repeat(3,var(--key))/repeat(3,var(--key));filter:drop-shadow(0 4px 1px #17151d)}
  .dpad button,.pad-center{border:0;border-radius:5px;background:#17161e;color:#c7bdce;display:grid;place-items:center;font:16px Arial,sans-serif;padding:0;touch-action:none}
  .pad-up{grid-area:1/2}.pad-left{grid-area:2/1}.pad-center{grid-area:2/2}.pad-right{grid-area:2/3}.pad-down{grid-area:3/2}
  .pad-center:after{content:'';width:17px;height:17px;border-radius:50%;background:#24222d;box-shadow:inset 0 2px 3px #0b0a10}
  .action-pad{display:flex;gap:14px;padding-right:2px}
  .action-control{display:flex;flex-direction:column;align-items:center;gap:10px}
  .action-control button{width:clamp(56px,16vw,74px);height:clamp(56px,16vw,74px);border-radius:50%;border:2px solid #b65372;background:#97344f;box-shadow:0 5px 0 #551d32,0 7px 7px #19151d;color:#f2dbe2;font:italic bold 25px Georgia,serif;touch-action:none;padding:0}
  .action-b{transform:translateY(15px)}.action-a{transform:translateY(-12px)}
  .action-control span{font:7px 'Courier New',monospace;letter-spacing:.8px;color:#c5b9cd;white-space:nowrap}
  [data-key].is-held{background:#c49a61;color:#17161e;box-shadow:0 2px 0 #3b2935;transform:translateY(3px)}
  .console-bottom{font-size:7px;letter-spacing:.7px;margin-top:8px;color:#90869f}
  .console-bottom i{width:40px;height:12px;background:repeating-linear-gradient(90deg,#17151e 0 3px,transparent 3px 7px);transform:skewY(-10deg)}
}
@media(pointer:coarse) and (orientation:landscape){
  .frame-top{display:none}
  .handheld-controls{height:132px;padding:6px 24px 8px}
  .console-label{display:none}
  .dpad{--key:34px}
  .action-control button{width:52px;height:52px;font-size:22px}
  .action-control{gap:6px}.action-pad{gap:22px}
  .action-b{transform:translateY(9px)}.action-a{transform:translateY(-8px)}
  .console-bottom{margin-top:0}
  .game-toolbar{min-height:36px}.game-toolbar button{min-height:36px;padding:6px}
  #game .canvas-wrap{border-width:4px 10px}
}
@media(pointer:coarse) and (max-width:360px){.handheld-controls{padding-left:12px;padding-right:12px}.action-pad{gap:9px}.game-toolbar{font-size:8px}.game-toolbar button{padding:8px 4px}}

/* Shrine checkpoint menu remains usable above the handheld controls. */
#checkpoint-dialog{width:min(480px,94vw);max-height:90dvh;overflow:auto;padding:28px;border:1px solid #8c724e;border-radius:12px;background:#191820;color:#e5d8bf;box-shadow:0 20px 100px #000b;font:14px/1.6 system-ui,sans-serif}
#checkpoint-dialog::backdrop{background:#08070dcc}
#checkpoint-dialog h2{font:32px Georgia,serif;margin:8px 0 18px;color:#e7c58a}
#checkpoint-dialog p{margin:12px 0}.save-heading{display:flex;align-items:center;justify-content:space-between}.save-heading p{margin:0}
#checkpoint-dialog button{border:1px solid #7d6649;padding:10px 14px;min-height:44px;background:#d2ae72;color:#191820;border-radius:5px;font:inherit;cursor:pointer}
#checkpoint-dialog button:disabled{opacity:.45;cursor:default}#checkpoint-close{font-size:22px!important;background:transparent!important;color:#ddc8a7!important;border:0!important}
.save-unlock,.save-actions{display:flex;gap:10px;margin:8px 0 16px}.save-unlock input{min-width:0;flex:1;background:#0f1016;color:#f1e2c9;border:1px solid #655a4b;padding:10px;border-radius:4px;font:inherit}.save-actions>*{flex:1}
#checkpoint-feedback{min-height:24px;color:#9cd4e4}#checkpoint-dialog small,#checkpoint-slot{color:#b2a99c}#shrine-status{padding:10px 12px;background:#252735;border-left:2px solid #8dc9e2}
@media(pointer:coarse){#checkpoint-open{font-size:8px;padding-inline:4px}#checkpoint-dialog{padding:20px}.save-actions{flex-wrap:wrap}#checkpoint-dialog h2{font-size:27px}}
.save-unlock select{min-width:0;flex:1;background:#0f1016;color:#f1e2c9;border:1px solid #655a4b;padding:10px;border-radius:4px;font:inherit}#checkpoint-dialog hr{border:0;border-top:1px solid #4a4237;margin:24px 0}
@media(pointer:coarse){.save-unlock input,.save-unlock select{font-size:16px}}
