:root {
  --ink: #0f0d0c; --paper: #f3ece1; --muted: #a39887; --accent: #c8102e; --card: #1a1715; --line: #2c2723;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--ink); color: var(--paper); }
body {
  font: 16px/1.6 Georgia, "Iowan Old Style", "Times New Roman", serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--paper); }
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 32px 16px; }
header.site { border-bottom: 1px solid var(--line); padding: 18px 16px; text-align: center; }
.wordmark { font-size: 22px; letter-spacing: .32em; text-transform: uppercase; text-decoration: none; }
.wordmark b { color: var(--accent); font-weight: 400; }
footer.site {
  border-top: 1px solid var(--line); padding: 20px 16px; font-size: 13px; color: var(--muted);
  text-align: center; font-family: system-ui, sans-serif;
}
footer.site a { color: var(--muted); margin: 0 8px; }
button, .btn {
  font: 600 14px system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
  padding: 14px 26px; border: 1px solid var(--paper); background: transparent; color: var(--paper);
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* age gate */
.gate { position: fixed; inset: 0; background: rgba(8,7,6,.97); display: grid; place-items: center; z-index: 10; padding: 16px; }
.gate .box { max-width: 520px; text-align: center; }
.gate h1 { font-weight: 400; font-size: 30px; margin: 0 0 12px; }
.gate p { color: var(--muted); font-size: 15px; }
.gate .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.gate .code { display: grid; gap: 8px; max-width: 320px; margin: 20px auto 0; }
.gate .code label { color: var(--paper); font-size: 15px; }
.gate .code input { font: 18px system-ui, sans-serif; letter-spacing: .12em; text-align: center; padding: 12px;
  background: #0b0a09; color: var(--paper); border: 1px solid var(--muted); -webkit-user-select: text; user-select: text; }
.gate .code input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.gate .code .err { color: #ff8a8a; margin: 0; font: 14px system-ui, sans-serif; }

/* catalog */
.series { margin-bottom: 56px; }
.series h2 { font-weight: 400; font-size: 34px; margin: 0; }
.series .tag { color: var(--muted); font-style: italic; margin: 4px 0 24px; }
.episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px; }
.ep { text-decoration: none; display: block; }
.ep .cover { position: relative; aspect-ratio: 2/3; background: var(--card); overflow: hidden; }
.ep .cover img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; display: block; }
.ep .meta { padding: 10px 0; font-size: 15px; }
.ep .meta span { color: var(--muted); display: block; font-size: 13px; font-family: system-ui, sans-serif; }
/* coming soon: the teaser cover, dimmed, or the episode number on a blank card */
.ep.soon .cover { background: linear-gradient(160deg, #26201c, var(--card) 65%); border: 1px solid var(--line); }
.ep.soon .cover img { filter: none; } /* a teaser cover is shown as painted; the badge says it is not out yet */
.ep.soon .big { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; color: var(--line); }
.ep .badge { position: absolute; left: 10px; top: 10px; padding: 5px 10px; border-radius: 999px; background: var(--accent);
  color: #fff; font: 600 11px system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }

/* legal */
.prose { max-width: 720px; margin: 0 auto; user-select: text; -webkit-user-select: text; }
.prose h1 { font-weight: 400; }
.prose h2 { font-weight: 400; font-size: 20px; margin-top: 32px; }
.prose p, .prose li { color: #d9d0c3; }

@media print { body * { display: none !important; } body::after { content: "Printing is disabled."; display: block !important; } }

/* ---------- reader ---------- */
body.reading { height: 100dvh; overflow: hidden; background: #0b0a09; }
#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: pointer; }
body.idle #stage { cursor: none; }
.sheet-wrap { position: absolute; inset: 0; z-index: 1; }
.sheet { position: absolute; left: 0; top: 0; display: flex; transform-origin: 0 0; will-change: transform;
  box-shadow: 0 40px 120px rgba(0,0,0,.65); }
.sheet canvas { display: block; }
.sheet.spread::after { /* the book's spine */
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 90px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.28) 45%, rgba(0,0,0,.4) 50%, rgba(0,0,0,.28) 55%, transparent);
  pointer-events: none; }
#spot { position: absolute; z-index: 2; pointer-events: none; border-radius: 2px;
  box-shadow: 0 0 0 200vmax rgba(8,7,6,.9); }

#scroller { position: fixed; inset: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top, 0px) + 56px) 0 calc(env(safe-area-inset-bottom, 0px) + 48px); }
.pg { width: min(100%, 960px); margin: 0 auto 10px; background: #161311; }
.pg canvas { display: block; width: 100%; height: auto; }
.scroll-end { padding: 64px 16px 32px; }

.chrome { position: fixed; left: 0; right: 0; z-index: 5; transition: opacity .35s ease, transform .35s ease;
  font: 14px system-ui, sans-serif; }
body.idle .chrome { opacity: 0; pointer-events: none; }
.chrome.top { top: 0; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 18px;
  background: linear-gradient(rgba(11,10,9,.95) 55%, rgba(11,10,9,0)); }
body.idle .chrome.top { transform: translateY(-8px); }
.chrome .back { color: var(--paper); text-decoration: none; white-space: nowrap; }
.chrome .ttl { flex: 1; text-align: center; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctls { display: flex; gap: 8px; align-items: center; }
.seg { display: flex; border: 1px solid #3a332d; border-radius: 999px; overflow: hidden; }
.seg button, .chrome .ctl { font: 500 13px system-ui, sans-serif; letter-spacing: 0; text-transform: none;
  padding: 7px 14px; border: 0; background: transparent; color: var(--muted); border-radius: 0; }
.chrome .ctl { border: 1px solid #3a332d; border-radius: 999px; }
.seg button[aria-pressed="true"], .chrome .ctl[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.chrome.bottom { bottom: 0; display: flex; align-items: center; gap: 14px;
  padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: linear-gradient(rgba(11,10,9,0), rgba(11,10,9,.95) 45%); color: var(--muted); }
#track { flex: 1; height: 16px; display: flex; align-items: center; cursor: pointer; position: relative; }
#track::before { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: #2c2723; border-radius: 3px; }
#fill { position: relative; height: 3px; background: var(--accent); border-radius: 3px; transition: width .3s ease; }
#count { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }

.endcard { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px;
  background: rgba(8,7,6,.94); animation: fade .4s ease; }
.endcard .box, .scroll-end .box { text-align: center; max-width: 600px; margin: 0 auto; }
.endcard .kicker, .scroll-end .kicker { font: 12px system-ui, sans-serif; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); margin: 0; }
.endcard h2, .scroll-end h2 { font-weight: 400; font-size: 30px; margin: 8px 0; }
.muted { color: var(--muted); }
.endcard .actions, .scroll-end .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.caught-up { margin: 16px 0 0; }

/* up next: the next episode, or the one coming soon */
.upnext { display: flex; gap: 16px; align-items: center; text-align: left; max-width: 440px; margin: 24px auto 0; padding: 14px;
  background: var(--card); border: 1px solid var(--line); }
.upnext .thumb { flex: none; width: 72px; aspect-ratio: 2/3; background: #0b0a09; overflow: hidden; }
.upnext .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upnext .info { min-width: 0; }
.upnext .info p { margin: 0; }
.upnext .up-title { font-size: 19px; margin: 4px 0 2px; }
.upnext .up-tag { font-size: 14px; font-style: italic; }
/* the countdown fills the "Next episode" button left to right, then the episode opens */
.btn.next { position: relative; overflow: hidden; }
.btn.next > span { position: relative; }
.btn.next.counting::before { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.24);
  transform-origin: left; animation: countdown var(--countdown, 10s) linear forwards; }
@keyframes countdown { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .btn.next.counting::before { animation: none; opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 64px); transform: translateX(-50%);
  z-index: 7; margin: 0; padding: 10px 18px; border-radius: 999px; background: rgba(26,23,21,.92);
  color: var(--paper); font: 14px system-ui, sans-serif; }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 640px) {
  .chrome .ttl { display: none; }
  .chrome.top { justify-content: space-between; }
  .seg button, .chrome .ctl { padding: 7px 11px; }
}
