.spi-reader{--spi-ink:#202027;--spi-muted:#6d6d74;--spi-paper:#fffdfa;--spi-bg:#ece9e4;--spi-line:#d9d6d1;position:relative;display:flex;flex-direction:column;width:100vw;max-width:none!important;height:clamp(620px,90dvh,1200px);margin:36px 0 36px calc(50% - 50vw)!important;background:var(--spi-bg);color:var(--spi-ink);border:1px solid var(--spi-line);box-sizing:border-box;isolation:isolate;overflow:hidden;font-family:system-ui,-apple-system,Segoe UI,sans-serif}
.spi-reader *{box-sizing:border-box}.spi-reader button{cursor:pointer;font:inherit}.spi-toolbar{flex:0 0 auto;min-height:62px;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:10px clamp(14px,3vw,44px);background:#15151a;color:white}.spi-book-name{font-size:14px;font-weight:600;letter-spacing:.015em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.spi-controls{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.spi-controls button{border:1px solid #55555d;border-radius:5px;padding:8px 12px;background:#292931;color:#fff;font-size:12px;line-height:1.2}.spi-controls button[aria-pressed=true]{background:#f2e5c9;color:#16161b;border-color:#f2e5c9}.spi-controls button:hover,.spi-controls button:focus-visible{outline:2px solid #d8ad72;outline-offset:1px}.spi-stage{flex:1;min-height:0;display:flex;align-items:stretch;justify-content:center;position:relative;padding:clamp(12px,2vw,30px) clamp(40px,5vw,76px)}.spi-spread{width:100%;max-width:1600px;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);justify-content:center;gap:0;filter:drop-shadow(0 8px 18px #00000014)}.spi-reader.is-double .spi-spread{grid-template-columns:repeat(2,minmax(0,1fr))}.spi-sheet{background:var(--spi-paper);min-height:0;height:100%;overflow-y:auto;overscroll-behavior:contain;padding:clamp(22px,4vw,66px);font:clamp(16px,1.23vw,21px)/1.75 Georgia,'Noto Serif Tamil',serif;color:var(--spi-ink);scrollbar-width:thin;overflow-wrap:anywhere}.spi-sheet:only-child{max-width:920px;justify-self:center;width:100%}.spi-reader.is-double .spi-sheet{padding:clamp(22px,3vw,56px);font-size:clamp(15px,1vw,19px)}.spi-reader.is-double .spi-sheet:first-child{border-right:1px solid #e7e0d6}.spi-sheet h1,.spi-sheet h2,.spi-sheet h3{line-height:1.3;color:#252125}.spi-sheet h1{font-size:clamp(27px,3vw,46px)}.spi-sheet h2{font-size:clamp(22px,2.1vw,34px)}.spi-sheet img{max-width:100%;height:auto;display:block;object-fit:contain;margin-inline:auto}.spi-sheet figure{max-width:100%;margin:1.5em auto}.spi-sheet blockquote{border-left:3px solid #b5996e;padding-left:1em;margin-left:0}.spi-sheet a{color:#74562d}.spi-arrow{position:absolute;z-index:2;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:36px;height:64px;padding:0;border:1px solid #cdc7bf;border-radius:4px;background:#fffdfae8;color:#2a2825;font-size:24px;box-shadow:0 2px 12px #00000010}.spi-arrow:hover{background:#fff}.spi-arrow:disabled{opacity:.22;cursor:default}.spi-prev{left:7px}.spi-next{right:7px}.spi-footer{min-height:48px;flex:0 0 auto;padding:10px clamp(15px,3vw,45px);display:flex;gap:12px;justify-content:space-between;align-items:center;color:var(--spi-muted);font-size:12px;background:#f6f3ed}.spi-chapter{max-width:50%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.spi-counter{white-space:nowrap;font-weight:600}.spi-hint{white-space:nowrap}.spi-locked{text-align:center;min-height:100%;display:flex;justify-content:center;align-items:center;flex-direction:column;gap:15px}.spi-locked h2,.spi-locked p{margin:0!important}.spi-locked>span{font-size:35px}.spi-buy{display:inline-block;background:#1c1b20;color:white!important;text-decoration:none!important;padding:12px 20px;border-radius:4px}.spi-reader.is-full{position:fixed!important;inset:0!important;z-index:2147483000!important;width:100vw!important;max-width:none!important;height:100dvh!important;margin:0!important;border:0!important;border-radius:0!important}.spi-reader.is-full .spi-stage{padding:clamp(8px,1.4vw,22px) clamp(40px,4vw,70px)}body.spi-no-scroll{overflow:hidden!important}.spi-editor-note{padding:18px;border:1px solid #e9ca8d;background:#fff9e9;color:#332e24;margin:20px 0}.spi-reader [hidden]{display:none!important}
@media(max-width:800px){.spi-reader{height:88dvh}.spi-toolbar{align-items:flex-start;flex-direction:column;gap:8px;padding:10px 12px}.spi-book-name{max-width:100%}.spi-controls{justify-content:flex-start}.spi-controls button{padding:7px 9px}.spi-stage{padding:9px 36px}.spi-sheet,.spi-reader.is-double .spi-sheet{padding:20px;font-size:16px}.spi-footer{padding:8px 12px}.spi-hint{display:none}.spi-arrow{width:30px;height:52px}.spi-prev{left:2px}.spi-next{right:2px}}
@media(max-width:640px){.spi-reader.is-double .spi-spread{grid-template-columns:minmax(0,1fr)}.spi-reader.is-double .spi-sheet:first-child{border-right:none}.spi-reader.is-double .spi-sheet:nth-child(2){display:none}.spi-reader.is-double .spi-sheet:only-child{max-width:none}}
/* v1.1: per-reader appearance, reading controls and progress */
.spi-reader{--spi-font-scale:1;--spi-toolbar-bg:#15151a;--spi-toolbar-ink:#fff;--spi-footer-bg:#f6f3ed;--spi-heading:#252125;--spi-link:#74562d;--spi-arrow-bg:#fffdfa;--spi-arrow-ink:#2a2825;--spi-book-shadow:#00000014;--spi-selection:#c7ab78;color-scheme:light}
.spi-reader[data-theme="dark"]{--spi-ink:#eeeae5;--spi-muted:#c5bdb6;--spi-paper:#202126;--spi-bg:#101115;--spi-line:#414249;--spi-toolbar-bg:#0b0c0f;--spi-toolbar-ink:#f6f1eb;--spi-footer-bg:#17181d;--spi-heading:#f8f1ea;--spi-link:#dfbb82;--spi-arrow-bg:#292a31;--spi-arrow-ink:#f4f0e9;--spi-book-shadow:#0000005c;--spi-selection:#92724c;color-scheme:dark}
@media(prefers-color-scheme:dark){.spi-reader[data-theme="system"]{--spi-ink:#eeeae5;--spi-muted:#c5bdb6;--spi-paper:#202126;--spi-bg:#101115;--spi-line:#414249;--spi-toolbar-bg:#0b0c0f;--spi-toolbar-ink:#f6f1eb;--spi-footer-bg:#17181d;--spi-heading:#f8f1ea;--spi-link:#dfbb82;--spi-arrow-bg:#292a31;--spi-arrow-ink:#f4f0e9;--spi-book-shadow:#0000005c;--spi-selection:#92724c;color-scheme:dark}}
.spi-reader .spi-toolbar{background:var(--spi-toolbar-bg);color:var(--spi-toolbar-ink)}
.spi-reader .spi-footer{background:var(--spi-footer-bg);color:var(--spi-muted)}
.spi-reader .spi-sheet{font-size:calc(clamp(16px,1.23vw,21px)*var(--spi-font-scale))}
.spi-reader.is-double .spi-sheet{font-size:calc(clamp(15px,1vw,19px)*var(--spi-font-scale))}
.spi-reader .spi-sheet h1,.spi-reader .spi-sheet h2,.spi-reader .spi-sheet h3{color:var(--spi-heading)}
.spi-reader .spi-sheet a{color:var(--spi-link)}
.spi-reader .spi-arrow{background:var(--spi-arrow-bg);color:var(--spi-arrow-ink);border-color:var(--spi-line)}
.spi-reader .spi-arrow:hover{background:var(--spi-bg)}
.spi-reader.is-double .spi-sheet:first-child{border-color:var(--spi-line)}
.spi-reader .spi-spread{filter:drop-shadow(0 8px 18px var(--spi-book-shadow))}
.spi-reader .spi-sheet ::selection{background:var(--spi-selection)}
.spi-reader .spi-control-label{align-self:center;font-size:12px;color:var(--spi-toolbar-ink)}
.spi-reader .spi-theme{height:33px;padding:5px 7px;border:1px solid #55555d;border-radius:5px;background:#292931;color:#fff;font-size:12px;cursor:pointer}
.spi-reader .spi-controls button,.spi-reader .spi-theme{min-height:33px}
.spi-reader .spi-theme:focus-visible,.spi-reader .spi-chapter-picker:focus-visible{outline:2px solid #d8ad72;outline-offset:2px}
.spi-reader .spi-chapter-picker-label{display:flex;align-items:center;gap:7px;max-width:40%;white-space:nowrap}
.spi-reader .spi-chapter-picker{width:clamp(115px,18vw,260px);min-height:28px;padding:4px 7px;background:var(--spi-paper);color:var(--spi-ink);border:1px solid var(--spi-line);border-radius:4px;font:inherit;text-overflow:ellipsis}
.spi-reader .spi-progress{height:3px;background:var(--spi-line);flex:0 0 3px}
.spi-reader .spi-progress-fill{height:100%;width:0;background:#b39363;transition:width .2s ease}
.spi-reader .spi-sheet{scrollbar-color:var(--spi-line) transparent}
.spi-reader .spi-sheet *{max-width:100%}
@media(max-width:800px){.spi-reader .spi-sheet,.spi-reader.is-double .spi-sheet{font-size:calc(16px*var(--spi-font-scale))}.spi-reader .spi-chapter{display:none}.spi-reader .spi-chapter-picker-label{max-width:65%}.spi-reader .spi-control-label{display:none}}
@media(prefers-reduced-motion:reduce){.spi-reader .spi-progress-fill{transition:none}}
/* Keep page surfaces edge to edge; internal page padding protects readable text. */
.spi-reader .spi-spread{max-width:none}
.spi-reader .spi-sheet:only-child{max-width:none}
.spi-reader.is-full .spi-stage{padding:clamp(5px,.75vw,12px) clamp(35px,3vw,52px)}

/* v1.2: one-row compact reading toolbar in both embedded and full-screen views */
.spi-reader .spi-toolbar{height:52px;min-height:52px;max-height:52px;padding:6px clamp(10px,1.6vw,26px);gap:12px;flex-flow:row nowrap;align-items:center;justify-content:space-between;overflow:hidden}
.spi-reader .spi-book-name{flex:0 1 270px;min-width:0;line-height:1.25;font-size:13px}
.spi-reader .spi-controls{display:flex;flex:0 1 auto;min-width:0;max-width:100%;flex-flow:row nowrap;align-items:center;justify-content:flex-end;gap:5px;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;white-space:nowrap}
.spi-reader .spi-controls>*{flex-shrink:0}
.spi-reader .spi-controls button,.spi-reader .spi-controls .spi-theme{height:34px;min-height:34px;line-height:1.1;padding:6px 10px;font-size:12px}
.spi-reader .spi-control-label{font-size:12px;margin-left:5px}
.spi-reader .spi-theme{width:102px;max-width:102px}
.spi-reader .spi-chapter-picker-label{display:flex;align-items:center;gap:6px;max-width:none;color:var(--spi-toolbar-ink);font-size:12px}
.spi-reader .spi-chapter-picker{width:clamp(105px,13vw,190px);height:34px;min-height:34px;padding:5px 7px;background:#292931;color:#fff;border:1px solid #55555d;font-size:12px}
.spi-reader .spi-footer{min-height:35px;padding:5px clamp(12px,2vw,32px)}
@media(max-width:1050px){.spi-reader .spi-toolbar{gap:7px}.spi-reader .spi-book-name{flex-basis:180px}.spi-reader .spi-controls button{padding-inline:8px}.spi-reader .spi-chapter-picker-label>span,.spi-reader .spi-control-label{display:none}.spi-reader .spi-chapter-picker{width:125px}}
@media(max-width:800px){.spi-reader .spi-toolbar{height:48px;min-height:48px;max-height:48px;flex-direction:row;align-items:center;padding:5px 8px}.spi-reader .spi-book-name{flex:0 1 135px;font-size:11px}.spi-reader .spi-controls{flex:1 1 auto;justify-content:flex-start}.spi-reader .spi-controls button,.spi-reader .spi-controls .spi-theme,.spi-reader .spi-chapter-picker{height:32px;min-height:32px}.spi-reader .spi-chapter-picker{width:104px}.spi-reader .spi-theme{width:86px}.spi-reader .spi-footer{min-height:32px}}
@media(max-width:480px){.spi-reader .spi-book-name{display:none}.spi-reader .spi-controls{flex:1 1 100%;justify-content:flex-start}}
/* v1.4: true viewport-fit pagination. No internal vertical scrollbars. */
.spi-reader .spi-sheet{overflow:hidden!important;min-height:0;overscroll-behavior:auto;overflow-wrap:break-word;}
.spi-reader .spi-measure{position:absolute!important;left:-100000px!important;top:0!important;z-index:-1;visibility:hidden;pointer-events:none;max-width:none!important;min-width:0!important;display:block!important;contain:layout style;}
.spi-reader .spi-spread{position:relative;height:100%;}
.spi-reader.is-double.is-tail .spi-spread{grid-template-columns:minmax(0,1fr)!important;}
.spi-reader.is-double.is-tail .spi-sheet{width:min(100%,900px);justify-self:center;border-right:0!important;}
.spi-reader .spi-sheet:only-child{max-width:none;}
.spi-reader .spi-sheet .sprb-page{min-height:0!important;height:auto!important;display:block!important;}
.spi-reader .spi-sheet .sprb-page-footer{margin-top:1.1em!important;}
.spi-reader .spi-sheet .sprb-page-title{padding:.35em 0 .4em!important;}
.spi-reader .spi-sheet .sprb-page-title h2{font-size:clamp(1.35em,2vw,1.9em)!important;line-height:1.45!important;overflow:visible!important;}
.spi-reader .spi-sheet .sprb-hero{margin:.25em 0 .8em!important;}
.spi-reader .spi-sheet .sprb-hero img{max-height:min(35dvh,360px)!important;max-width:100%!important;object-fit:contain!important;}
.spi-reader .spi-sheet .sprb-prose{line-height:1.55;}
.spi-reader .spi-sheet .sprb-prose p{margin:.3em 0 .8em;}
.spi-reader .spi-sheet p:empty{display:none;}
.spi-reader .spi-sheet img{max-height:min(55dvh,520px);object-fit:contain;}
@media(max-width:640px){.spi-reader .spi-sheet .sprb-hero img{max-height:26dvh!important;}}

/* V2.1 Purchase & Library: visible optional commerce, no reader replacement */
.spi-reader .spi-toolbar-buy,.spi-reader .spi-toolbar-library{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;border:1px solid #c9a26c;border-radius:5px;background:#b99663;color:#141314!important;min-height:33px;padding:6px 11px;font:650 12px/1.2 system-ui,sans-serif;text-decoration:none!important;white-space:nowrap}.spi-reader .spi-toolbar-library{background:transparent;color:var(--spi-toolbar-ink)!important}.spi-reader .spi-toolbar-buy:hover,.spi-reader .spi-toolbar-library:hover{filter:brightness(1.1)}.spi-reader .spi-gate-actions{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:center;margin-top:18px}.spi-reader .spi-gate-secondary{display:inline-flex;padding:10px 14px;border:1px solid currentColor;border-radius:6px;text-decoration:none!important}.spi-reader .spi-locked .spi-buy{display:inline-flex;align-items:center;justify-content:center;background:#b99663;color:#1a1713!important;padding:11px 18px;border-radius:6px;font:650 14px/1.3 system-ui,sans-serif;text-decoration:none!important}.spi-reader .spi-locked{max-width:720px;margin:auto;text-align:center}.spi-reader .spi-gate-actions a{max-width:100%;overflow-wrap:anywhere}@media(max-width:800px){.spi-reader .spi-toolbar-buy,.spi-reader .spi-toolbar-library{min-height:32px;padding:6px 9px;font-size:11px}}
