*{box-sizing:border-box}html,body{margin:0;height:100%;overflow:hidden}body{background:#07121b;color:#fff0d8;font-family:Georgia,'Noto Serif',serif}body:before{content:'';position:fixed;inset:0;background:linear-gradient(#07121bbd,#07121bee),url('media/chapter-37.jpg') center/cover;filter:blur(5px);z-index:-1}main{height:100dvh;max-width:780px;margin:auto;padding:8px 14px max(8px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:8px}header{height:38px;display:flex;align-items:center;justify-content:space-between;font-size:14px;letter-spacing:2px;color:#d7b775}small{display:block;font:14px/1.3 system-ui,sans-serif;letter-spacing:0}button,a.download{font:16px/1.2 system-ui,sans-serif;border:1px solid #9d7b44;background:#122333;color:#f7e7c8;border-radius:6px;padding:7px 12px;text-decoration:none;cursor:pointer}button:focus-visible,a:focus-visible{outline:3px solid #f4cf89;outline-offset:3px}button:disabled{opacity:.3;cursor:default}header button{padding:3px 10px;font-size:14px}#stage{position:relative;flex:1;min-height:0;perspective:1500px;filter:drop-shadow(0 15px 22px #0008)}article,#turn{position:absolute;inset:0;border:1px solid #9d7b44;border-radius:5px;background:linear-gradient(#091927d9,#091927ed),url('media/chapter-37.jpg') 82% center/auto 110%;padding:clamp(18px,4vw,32px);overflow:hidden;display:flex;flex-direction:column}#turn{display:none;z-index:2;transform-origin:left center;backface-visibility:hidden;pointer-events:none}#turn.flipping{display:flex;animation:flip .48s ease-in-out forwards}#turn.back{animation:unflip .48s ease-in-out forwards}@keyframes flip{to{transform:rotateY(-175deg);opacity:.2}}@keyframes unflip{from{transform:rotateY(-175deg);opacity:.2}to{transform:rotateY(0);opacity:1}}.chapter{font:14px system-ui;color:#d6b77f;margin-bottom:10px}.chapter small{margin-top:2px}h1{font-size:clamp(28px,5vw,44px);font-weight:normal;line-height:1.1;margin:0 0 10px}h2{font-size:clamp(22px,4.2vw,30px);font-weight:normal;line-height:1.15;margin:0 0 5px}.title-ja{font:19px/1.4 system-ui;margin:0 0 18px;color:#dfc998}p{font:17px/1.5 Georgia,serif;margin:0 0 12px}p.ja{font:16px/1.55 system-ui,sans-serif;color:#ded4c3;margin-bottom:18px}.media{margin-top:auto;display:flex;flex-direction:column;align-items:center;gap:7px;min-height:0}video{width:100%;max-height:min(29dvh,220px);background:#000;border-radius:5px;object-fit:contain}.art{display:block;max-width:100%;max-height:38dvh;object-fit:contain;border-radius:4px}a.download{padding:5px 12px;text-align:center;font-size:14px}.portrait{width:min(43vw,210px);height:min(43vw,210px);border-radius:50%;object-fit:cover;object-position:27% 50%;border:2px solid #d7b775;box-shadow:0 0 50px #d9a74722;margin-bottom:24px}.cover{text-align:center;align-items:center;justify-content:center}.cover .subtitle{font-size:25px;font-style:italic}.cover p{font:16px/1.4 system-ui}.cover .hint{color:#d4bd8d;margin-top:22px}nav{display:flex;align-items:center;justify-content:space-between;gap:7px;min-height:57px}nav button{min-width:128px}#counter{font:14px system-ui;text-align:center;color:#c6b698;white-space:nowrap}.continuation{color:#b5a489;font:14px system-ui;margin-top:auto;padding-top:10px}@media(max-width:480px){main{padding-left:8px;padding-right:8px;gap:5px}article,#turn{padding:18px 20px}p{font-size:16px;line-height:1.42}p.ja{line-height:1.45}h2{font-size:23px}.title-ja{font-size:17px;margin-bottom:14px}nav button{font-size:14px;min-width:113px;padding:7px}video{max-height:23dvh}}@media(prefers-reduced-motion:reduce){#turn.flipping,#turn.back{animation-duration:.01s}}

/* Keep the entire chapter artwork inside the available page space. */
.media.artwork{flex:1 1 0;min-height:0;margin-top:10px;overflow:hidden}.media.artwork .art{width:100%;height:0;flex:1 1 0;min-height:0;max-height:none;object-fit:contain;object-position:center}.media.artwork .download{flex:0 0 auto}

/* One compact contents sheet, with the full bilingual chapter list. */
.contents h2{font-size:24px;flex:0 0 auto}.contents .title-ja{font-size:16px;margin-bottom:6px;flex:0 0 auto}.toc-label{font:11px/1.15 system-ui;color:#dfc998;margin-bottom:6px;flex:0 0 auto}.toc-label small{font-size:10px}.toc-list{display:grid;grid-auto-flow:column;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(19,minmax(0,1fr));gap:0 12px;flex:1;min-height:0}.toc-entry{display:flex;width:100%;height:100%;min-width:0;min-height:0;justify-content:space-between;align-items:center;text-align:left;gap:4px;background:#0b1b2966;border:0;border-bottom:1px solid #9d7b4440;border-radius:0;padding:2px 0;font-size:var(--toc-font,12px);line-height:1.08}.toc-name{min-width:0}.toc-name small{color:#dfc998;margin-top:1px;font-size:calc(var(--toc-font,12px)*.85);line-height:1.1;letter-spacing:0}.toc-count{flex:0 0 auto;text-align:right;font-size:var(--toc-font,12px);color:#dfc998}.toc-entry:focus-visible{outline-offset:-2px}video{height:min(29dvh,220px)}@media(max-width:480px){video{height:23dvh}.contents{padding:14px 15px}.contents h2{font-size:22px}}@media(orientation:landscape) and (min-width:600px){.toc-list{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(13,minmax(0,1fr))}.contents h2{font-size:20px}.contents .title-ja{margin-bottom:2px}.toc-label{margin-bottom:3px}}

/* Cover token link. */
.cover .portrait{width:min(32vw,150px,20dvh);height:min(32vw,150px,20dvh);flex:0 0 auto;margin-bottom:14px}.cover .title-ja{margin-bottom:10px}.cover .hint{margin-top:12px;margin-bottom:0}.coin-link{display:block;max-width:100%;flex:0 0 auto;border:1px solid #c19a59;border-radius:6px;padding:8px 12px;background:#122333;color:#f7e7c8;font:16px/1.2 system-ui,sans-serif;text-decoration:none}.coin-link:hover{background:#203348}.coin-link small{margin-top:3px}.coin-address{display:block;margin-top:6px;word-break:break-all;font:12px/1.35 ui-monospace,monospace;color:#dfc998}@media(max-height:700px){.cover .portrait{width:min(24vw,95px,15dvh);height:min(24vw,95px,15dvh);margin-bottom:8px}.cover .title-ja{margin-bottom:6px}.cover .hint{margin-top:8px}.cover p{margin-bottom:8px;font-size:14px}.cover h1{margin-bottom:5px}.coin-link{padding:6px 10px}}

/* The token link stays below each page's reading area. */
.page-body{display:flex;flex-direction:column;flex:1;min-height:0}.page-body+.coin-link{width:100%;margin-top:8px;text-align:center;padding:5px 8px;font-size:14px;line-height:1.15}.page-body+.coin-link small{font-size:12px;line-height:1.15;margin-top:2px}.page-body+.coin-link .coin-address{margin-top:4px;font-size:12px;line-height:1.15}

/* Navigation sits above the reading area, clear of in-app browser toolbars. */
header,nav{flex-shrink:0}nav{position:relative;z-index:3;min-height:58px;background:#07121b}nav button{min-height:48px}main{padding-top:max(8px,env(safe-area-inset-top))}#page{overflow-y:auto;overscroll-behavior:contain}.cover{justify-content:safe center}.cover>*{flex-shrink:0}

/* A separate footer reserves room for the buy link; mobile browser chrome
   gets its own clearance rather than covering the page or footer. */
main{padding-bottom:max(12px,env(safe-area-inset-bottom))}#buy-footer{flex:0 0 auto}#buy-footer .coin-link{width:100%;text-align:center;padding:8px 12px;font-size:16px}#buy-footer .coin-link small{font-size:14px}#buy-footer .coin-address{font-size:12px;line-height:1.3}.page-body>p,.page-body>h2,.page-body>.chapter,.page-body>.title-ja{flex-shrink:0}.cover .portrait{width:min(27vw,130px,17dvh);height:min(27vw,130px,17dvh)}
@media(max-width:600px){main{padding-bottom:calc(88px + env(safe-area-inset-bottom))}#buy-footer .coin-link{padding:6px 10px}.cover .portrait{width:min(24vw,110px,15dvh);height:min(24vw,110px,15dvh)}.cover .hint{font-size:14px}}

/* Let every page grow to its content instead of clipping a fixed-height sheet. */
html,body{height:auto;min-height:100%;overflow:auto}main{height:auto;min-height:100dvh;padding-bottom:calc(100px + env(safe-area-inset-bottom))}nav{position:sticky;top:0;padding:5px 0}#stage{flex:none;min-height:0;perspective:none;filter:none}#page{position:relative;inset:auto;overflow:visible;min-height:58dvh}#turn{display:none!important}.page-body{flex:none;min-height:0}.media{margin-top:18px;min-height:0;flex:none}.media.artwork{flex:none;overflow:visible;min-height:0}.media.artwork .art{height:auto;flex:none;min-height:0;max-height:none;width:100%;object-fit:contain}video{height:auto!important;max-height:none!important;width:100%;aspect-ratio:auto}.art{max-height:none;height:auto}.cover{padding-top:28px;padding-bottom:28px;justify-content:flex-start}.cover .portrait{width:min(32vw,150px);height:min(32vw,150px)}#buy-footer{position:relative;margin-top:6px}#page.contents .page-body{flex:none}.toc-list{display:flex;flex-direction:column;gap:0}.toc-entry{height:auto;min-height:48px;padding:8px 0;font-size:14px}.toc-name small{font-size:14px}.toc-count{font-size:14px}.toc-label,.toc-label small{font-size:14px}

.pdf-download{display:block;flex:none;text-align:center;margin-top:8px}

/* One document scroll surface; viewport chrome must not repaginate the book. */
html{overflow-x:hidden;overflow-y:auto;scroll-behavior:auto}body{overflow:visible;min-height:100svh}main{min-height:100svh}#page{min-height:58svh;overscroll-behavior:auto;touch-action:pan-y pinch-zoom}video{touch-action:pan-y pinch-zoom}nav{touch-action:pan-y pinch-zoom}
