*{box-sizing:border-box}body{margin:0;background:#0b1320;color:#fff7e9;font-family:system-ui,-apple-system,sans-serif}button{font:inherit;cursor:pointer;touch-action:manipulation}button:focus-visible{outline:3px solid #b8edff;outline-offset:4px}main{max-width:1280px;margin:auto}header{height:62px;padding:0 24px;display:flex;justify-content:space-between;align-items:center}header>span{font-family:serif;letter-spacing:3px}header button,footer button{border:1px solid #ffffff30;background:transparent;color:#cfdae2;border-radius:20px;font-size:11px;padding:8px 12px}#stage{aspect-ratio:16/10;position:relative;overflow:hidden;background:#16253c}#picture,#shade,#fx,#bars{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}#picture{background-image:none;background-size:cover;background-position:center 42%;transform:scale(1.04);will-change:transform;transition:filter .5s}#shade{background:linear-gradient(0deg,#06101dd9,transparent 52%,#07132135)}#chapter{position:absolute;top:26px;left:30px;font-size:10px;letter-spacing:4px;color:#fff0c4;text-shadow:0 2px 8px #000}#cover{position:absolute;inset:0;background:linear-gradient(90deg,#08152dde,#08152d66,transparent);padding:9% 7%}#cover>span{letter-spacing:4px;font-size:12px;color:#f3dbaa}h1{font-family:serif;font-size:clamp(48px,7vw,88px);line-height:1.25;font-weight:500;margin:28px 0;text-shadow:0 4px 20px #001329}#cover p{font-size:14px;letter-spacing:2px}#start,#next{background:linear-gradient(120deg,#f8da93,#fff1c9);color:#503c28;border:1px solid #fff3cf;border-radius:5px;padding:16px 28px;box-shadow:0 8px 24px #0003;font-weight:700}#start{margin-top:20px}small{display:block;margin-top:15px;font-size:11px;color:#bacbdb}button:disabled{opacity:.6}#dialogue{position:absolute;bottom:5%;left:6%;right:6%;padding:22px 28px;border:1px solid #e8d09c90;border-radius:8px;background:linear-gradient(110deg,#101d32f2,#14273aeb);box-shadow:0 12px 36px #0004;display:none}#speaker{color:#f4d68f;font-size:13px;letter-spacing:3px}#line{font-size:clamp(16px,1.8vw,21px);line-height:1.9;margin:9px 0 16px;min-height:40px;white-space:pre-line}#next{display:block;margin-left:auto;min-width:156px;padding:12px 24px}#dialogue.action{border-color:#ffe7a5;box-shadow:0 0 35px #f1bd6233}#dialogue.action #next{width:100%;font-size:18px}#words{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:20px;font-family:serif;font-size:clamp(30px,5vw,58px);font-weight:bold;white-space:pre-line;text-shadow:0 3px 10px #152141,0 0 35px #152141;pointer-events:none}#bars{border-top:0 solid #08101c;border-bottom:0 solid #08101c;transition:border-width .45s}#stage.cinema #bars{border-width:38px 0}footer{display:flex;justify-content:space-between;align-items:center;padding:16px 24px;color:#94a9ba;font-size:11px}#replay{display:none}@media(max-width:600px){header{height:54px;padding:0 13px}header>span{font-size:13px;letter-spacing:1px}header button{padding:7px 9px;font-size:10px}#stage{height:calc(100svh - 118px);min-height:570px;max-height:850px;aspect-ratio:auto}#picture{background-size:auto 75%;background-repeat:no-repeat;background-position:center top;background-color:#15253a}#shade{background:linear-gradient(0deg,#071321 12%,#0a172699 33%,transparent 66%)}#cover{padding:16% 8%;background:linear-gradient(90deg,#08152d9c,transparent)}h1{margin-top:26px;font-size:59px}#cover p{margin-top:32px;font-size:13px}#cover small{max-width:240px;line-height:1.8}#dialogue{bottom:4%;left:5%;right:5%;padding:20px}#line{min-height:84px;font-size:16px}#words{font-size:32px;padding-bottom:70px}#chapter{top:18px;left:20px;font-size:9px;letter-spacing:2px}#stage.cinema #picture{background-size:auto 100%}#stage.cinema #bars{border-width:45px 0}footer{padding:11px 14px;font-size:10px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}#picture,#bars{transition:none}}
.reading-controls{display:flex;align-items:center;gap:14px}.reading-controls #next{margin-left:auto}.reading-controls #back{border:0;background:transparent;color:#c5d2de;font-size:12px;padding:12px 0;white-space:nowrap}#progress{font-size:10px;color:#8c9fb0;white-space:nowrap}#dialogue.action .reading-controls{flex-wrap:wrap}#dialogue.action #next{flex-basis:100%}#saved{font-size:10px;color:#7e9b94}dialog{width:min(90vw,430px);max-height:85svh;background:#13243a;color:#fff0d1;border:1px solid #c4a975;border-radius:12px;padding:26px}dialog::backdrop{background:#020b16b9}dialog h2{font-family:serif;font-size:23px}dialog p{font-size:12px;color:#b9c9d9}#chapters{display:grid;gap:8px;margin:20px 0}#chapters button,#closeMenu{background:#21354a;border:1px solid #7c7765;color:#f4e5c3;border-radius:5px;padding:13px;text-align:left}#chapters button:disabled{opacity:.3;cursor:default}dialog a{display:block;font-size:12px;color:#b6d8e7;margin:18px 0}#closeMenu{width:100%;text-align:center;background:#e8cf93;color:#302f31}@media(max-width:600px){#line{font-size:15px;line-height:1.85;min-height:110px}#dialogue{bottom:3%;padding:17px}#next{min-width:118px;padding:12px 15px}.reading-controls{gap:9px}#saved{display:none}#stage{min-height:610px}#picture{background-size:auto 64%;background-position:center top}#dialogue.action #line{min-height:80px}footer{gap:10px}}@media(max-height:550px) and (min-width:601px){header{height:40px}#stage{aspect-ratio:16/9}#dialogue{padding:12px 22px;bottom:3%}#line{font-size:16px;line-height:1.6;margin:5px 0 8px}#next{padding:8px 18px}}
rt{font-size:.55em;font-weight:400;letter-spacing:0;color:#d0dce6}#next rt{color:#614824}#line{line-height:2.1}#chapter{line-height:2}#chapter rt{color:#fff0c4}#dialogue{max-height:70%;overflow-y:auto}@media(max-width:600px){#line{font-size:16px;line-height:2.05}#dialogue{max-height:62%}}

/* Standalone release: reachable controls, pausable cinematics. */
header>div{display:flex;gap:5px;align-items:center}footer .home{color:#cfdae2;white-space:nowrap}#pauseNotice{position:absolute;z-index:8;top:55px;left:50%;transform:translateX(-50%);padding:8px 18px;border-radius:20px;background:#0b1320ed;border:1px solid #f4d68f;color:#fff0c4;font-size:13px}#pauseNotice[hidden]{display:none}.paused #picture,.paused #bars{transition:none}#dialogue{grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}#line{overflow-y:auto;overscroll-behavior:contain;min-height:0}.reading-controls{flex-shrink:0}#loadnote{max-width:300px}
@media(max-width:600px){header{height:58px;padding:0 9px;gap:6px}header>span{font-size:11px;letter-spacing:0;white-space:nowrap}header button{padding:7px 6px;font-size:10px}#stage{height:calc(100svh - 110px);min-height:290px;max-height:850px}#dialogue{bottom:2%;max-height:62%;height:56%;padding:12px 14px;left:3%;right:3%}#dialogue.action #line,#line{min-height:0;margin:6px 0 10px;font-size:16px}#speaker{font-size:12px}.reading-controls{gap:8px}#next{min-width:104px;padding:10px 12px}#dialogue.action #next{font-size:16px}.reading-controls #back{padding:10px 0}footer{min-height:52px;padding:8px 12px;gap:8px}#hint{display:none}#cover{padding:5% 8%;overflow-y:auto}#cover h1{font-size:clamp(36px,12vw,59px);margin:14px 0}#cover p{margin-top:12px}#start{margin-top:10px;padding:12px 22px}small{margin-top:10px}#loadnote{font-size:10px}}
@media(max-width:360px){header{height:76px;flex-wrap:wrap;align-content:center;gap:5px}header>span{flex-basis:100%;line-height:15px}header>div{width:100%;justify-content:flex-end}#stage{height:calc(100svh - 128px)}#dialogue{padding:10px 12px}.reading-controls{gap:6px}}

#imageStatus{position:absolute;z-index:2;top:54px;left:20px;right:20px;color:#d4e0ec;font-size:11px;text-shadow:0 1px 4px #000;pointer-events:none}#imageStatus:empty{display:none}

/* Ending: replay is a separate, deliberate action. */
#readAgain{justify-self:end;margin-top:10px;border:1px solid #ffffff45;background:transparent;color:#cfdae2;border-radius:5px;padding:10px 16px;font-size:12px}#readAgain[hidden]{display:none}


/* Shared reader navigation and a stable, deliberate ending. */
[hidden]{display:none!important}.site-return{display:flex;justify-content:space-between;gap:12px;padding:0 16px}.site-return a,.end-links a{display:inline-flex;align-items:center;min-height:44px;color:#f2d495;text-underline-offset:4px;font-size:12px}header{height:auto;min-height:62px;flex-wrap:wrap;gap:8px;padding:8px 16px}header>div{flex-wrap:wrap;justify-content:flex-end}header .brand{border:0;color:#fff0d1;font-size:14px;padding:8px 0;min-height:44px}header button{min-height:44px}#chapterBar{position:absolute;top:0;left:0;right:0;height:58px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:7px 20px;background:#15253a;border-bottom:1px solid #f2d49533;z-index:3}#chapter{position:static;letter-spacing:1px;text-shadow:none;font-size:11px}#replay{display:block;min-height:44px;flex:none;border:1px solid #ffffff30;background:#0b1320;color:#f2d495;border-radius:6px;font-size:11px;padding:8px 10px}body.reading #picture{top:58px;height:calc(100% - 58px);transform:none}#dialogue{grid-template-rows:auto minmax(0,1fr) auto auto;background:linear-gradient(130deg,#fffaf0fa,#ede8dcfa);color:#44392e}#speaker{color:#885c2c}#line rt{color:#786448}#progress{color:#786b5c}.reading-controls #back{color:#66594b}#readAgain{color:#655238;border-color:#a68b65;min-height:44px}.ruby-off rt{display:none}#ending{position:absolute;inset:0;display:grid;place-items:center;background:linear-gradient(0deg,#101e30ed,#101e3050);padding:20px;overflow:auto}.ending-card{text-align:center;background:#13243aec;border:1px solid #f2d49566;border-radius:12px;padding:28px 20px;max-width:470px;width:100%}.ending-card h2{font-size:32px}.ending-card p{line-height:1.9}.eyebrow{color:#f2d495;font-size:13px}.end-links{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 20px;margin:16px 0}#endRestart,.restart-choices button{min-height:44px;padding:10px 16px;background:#21354a;border:1px solid #bca57a;color:#fff0d1;border-radius:5px}.restart-choices{display:flex;flex-wrap:wrap;gap:12px;justify-content:flex-end}#confirmRestart{background:#f2d495;color:#44392e}a:focus-visible{outline:3px solid #b8edff;outline-offset:3px}
@media(max-width:600px){header{padding:5px 10px;min-height:60px}header .brand{font-size:12px}header>div{gap:3px}header button{padding:7px 6px}#stage{height:calc(100svh - 170px);min-height:450px}#chapterBar{padding:7px 12px}#chapter{font-size:10px}body.reading #picture{top:58px;height:calc(48% - 58px);background-size:cover;background-position:center 42%}#dialogue{height:50%;max-height:50%;bottom:1%}#chapterBar #replay{font-size:10px}footer{flex-wrap:wrap}#ending{padding:12px}.ending-card{padding:18px 12px}}
