:root {
  --bg: #0f1115;
  --bg2: #171a21;
  --bg3: #20242d;
  --line: #2a2f3a;
  --tx: #eceef2;
  --tx2: #a4a9b5;
  --tx3: #6f7584;
  --acc: #f2a93b;
  --acc2: #ffcf7a;
  --paper: #fbf6ec;
  --ink: #2a2520;
  --r: 12px;
  --w: 1240px;
  --serif: "Fraunces", Georgia, serif;
  --read: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--tx); font: 15px/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
.wrap { max-width: var(--w); margin: 0 auto; padding: 0 20px; }

/* Header */
.hd { position: sticky; top: 0; z-index: 50; background: rgba(15,17,21,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.hd-in { max-width: var(--w); margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; font: 800 20px var(--serif); letter-spacing: -.01em; }
.logo img { width: 32px; height: 32px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--tx2); font-weight: 600; }
.nav a:hover { color: var(--tx); }
.nav a.on { color: var(--tx); background: var(--bg3); }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--tx3); width: 260px; }
.search:focus-within { border-color: var(--acc); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--tx); font: inherit; padding: 9px 0; }
.coins { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-weight: 700; }
.coin { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe3a3, var(--acc) 60%, #c7801c); color: #6b3f00; font: 800 10px var(--sans); flex: none; }
.btn-signin { padding: 8px 16px; border-radius: 999px; background: var(--acc); color: #1b1304; font-weight: 700; }
.btn-signin:hover { background: var(--acc2); }

/* Hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-slide { display: none; min-height: 480px; }
.hero-slide.on { display: flex; align-items: center; padding-top: 40px; padding-bottom: 48px; animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.hero-bg { position: absolute; inset: 0; z-index: -1; }
.hero-bg .cover-img { position: absolute; inset: 0 0 0 28%; background-size: cover; background-position: center 25%; animation: fade .6s ease; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 22%, rgba(15,17,21,.75) 45%, rgba(15,17,21,.1) 80%), linear-gradient(0deg, var(--bg), transparent 35%); }
.hero-txt { padding: 56px 0; max-width: 620px; }
.hero-eyebrow { color: var(--acc); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { font: 800 clamp(32px, 5vw, 54px)/1.05 var(--serif); margin: 10px 0 16px; letter-spacing: -.02em; }
.hero p { color: var(--tx2); font-size: 17px; margin: 0 0 24px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero .cover { box-shadow: 0 30px 60px rgba(0,0,0,.5); }
.hero-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.hero-dots button { width: 8px; height: 8px; border-radius: 99px; background: var(--tx3); transition: .3s; }
.hero-dots button.on { width: 24px; background: var(--acc); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tag { padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--tx2); font-size: 13px; font-weight: 600; }
.tag.hot { background: var(--acc); color: #1b1304; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 26px; border-radius: 999px; background: var(--tx); color: var(--bg); font-weight: 700; font-size: 16px; transition: transform .15s; }
.btn:hover { transform: translateY(-1px); }
.btn.acc { background: var(--acc); color: #1b1304; }
.btn.ghost { background: var(--bg3); color: var(--tx); }

/* Covers — generated, no image files needed */
.cover { position: relative; aspect-ratio: 2/3; border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; isolation: isolate; }
.cover::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 70% 20%, rgba(255,255,255,.18), transparent 50%), repeating-linear-gradient(135deg, rgba(255,255,255,.03) 0 2px, transparent 2px 10px); }
.cover-img { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center 30%; }
.cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.8)); }
.cover-t { font: 800 clamp(15px, 1.6vw, 19px)/1.15 var(--serif); text-align: center; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.cover-g { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; opacity: .7; margin-bottom: 6px; }
.cover-badge { position: absolute; top: 10px; right: 10px; background: var(--acc); color: #1b1304; font: 800 10px var(--sans); padding: 3px 8px; border-radius: 6px; letter-spacing: .05em; }
.c0 { background: linear-gradient(160deg, #6b4a2b, #2c1d12 70%); }
.c1 { background: linear-gradient(160deg, #36584a, #13241d 70%); }
.c2 { background: linear-gradient(160deg, #4b3c6e, #1b1530 70%); }
.c3 { background: linear-gradient(160deg, #7a3b3b, #2b1212 70%); }
.c4 { background: linear-gradient(160deg, #2f4f78, #111c2d 70%); }
.c5 { background: linear-gradient(160deg, #6e5a2a, #2a220e 70%); }

/* Rows & grids */
.sec { margin: 44px auto; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.sec-h h2 { font: 700 24px var(--serif); margin: 0; }
.sec-h a { color: var(--tx2); font-weight: 600; font-size: 14px; }
.sec-h a:hover { color: var(--acc); }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 180px; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: thin; }
.row > * { scroll-snap-align: start; }
.row::-webkit-scrollbar { display: none; }
.row { scrollbar-width: none; }
.row-wrap { position: relative; }
.row-nav { position: absolute; top: calc(50% - 44px); width: 44px; height: 44px; border-radius: 50%; background: rgba(15,17,21,.85); border: 1px solid var(--line); color: var(--tx); font-size: 26px; line-height: 1; display: none; place-items: center; z-index: 2; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.row-nav:hover { background: var(--bg3); }
.row-nav.prev { left: -18px; }
.row-nav.next { right: -18px; }
@media (hover: hover) and (min-width: 721px) {
  .row-wrap.can-prev .prev, .row-wrap.can-next .next { display: grid; }
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px 18px; }
.card { display: block; }
.card .cover { transition: transform .2s, box-shadow .2s; }
.card:hover .cover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(0,0,0,.4); }
.card-t { margin-top: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-m { color: var(--tx3); font-size: 13px; }
.prog { height: 3px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--acc); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0; }
.chip { padding: 8px 16px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); color: var(--tx2); font-weight: 600; }
.chip.on { background: var(--acc); border-color: var(--acc); color: #1b1304; }
.page-h { font: 800 34px var(--serif); margin: 32px 0 0; }
.empty { color: var(--tx3); padding: 40px 0; text-align: center; }

/* Story page */
.story { display: grid; grid-template-columns: 260px 1fr; gap: 44px; margin-top: 40px; }
.story h1 { font: 800 clamp(28px, 4vw, 44px)/1.1 var(--serif); margin: 0 0 14px; }
.story .blurb { color: var(--tx2); font-size: 17px; max-width: 640px; }
.story-meta { display: flex; gap: 18px; color: var(--tx3); font-size: 14px; margin: 16px 0 24px; }
.story-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.parts { margin-top: 40px; }
.parts h2 { font: 700 20px var(--serif); margin: 0 0 14px; }
.part-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.part { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; }
.part:hover { border-color: var(--tx3); }
.part b { font: 700 13px var(--sans); color: var(--tx3); width: 26px; }
.part span { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part .free { color: #7ed69a; font-size: 12px; font-weight: 700; }
.part.read span { color: var(--tx2); }
.lock-ic { color: var(--acc); flex: none; }

/* Reader */
.reader { display: grid; grid-template-columns: 1fr 300px; gap: 32px; margin-top: 28px; align-items: start; }
.paper { background: var(--paper); color: var(--ink); border-radius: 16px; padding: 40px clamp(20px, 5vw, 64px) 48px; }
.paper-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e6dcc8; padding-bottom: 16px; margin-bottom: 24px; }
.paper-top small { display: block; color: #9b8c74; font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.paper-top h1 { font: 700 26px var(--serif); margin: 2px 0 0; }
.fs { display: flex; gap: 6px; }
.fs button { width: 36px; height: 36px; border-radius: 8px; background: #efe5d2; color: var(--ink); font-weight: 700; }
.fs button:hover { background: #e5d8bf; }
.prose { font-family: var(--read); line-height: 1.75; }
.prose p { margin: 0 0 1.1em; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.pager .btn { font-size: 15px; padding: 11px 20px; }
.pager .btn.ghost { background: #efe5d2; color: var(--ink); }
.pager .btn.acc { margin-left: auto; }
.side { position: sticky; top: 84px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.side h3 { font: 700 18px var(--serif); margin: 8px 0 6px; }
.side p { color: var(--tx2); font-size: 14px; margin: 0 0 16px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.crumb { color: var(--tx3); font-size: 13px; }
.crumb a:hover { color: var(--acc); }
.ep-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ep { position: relative; aspect-ratio: 1; border-radius: 8px; background: var(--bg3); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.ep:hover { background: var(--line); }
.ep.cur { background: var(--acc); color: #1b1304; }
.ep.lk::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--acc); }
.ep.cur.lk::after { background: #1b1304; }

/* Paywall */
.teaser { position: relative; }
.teaser::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; background: linear-gradient(transparent, var(--paper)); }
.lockbox { margin-top: 8px; background: #fff; border: 1px solid #e6dcc8; border-radius: 16px; padding: 28px; text-align: center; box-shadow: 0 10px 30px rgba(80,60,20,.08); }
.lockbox h2 { font: 700 22px var(--serif); margin: 0 0 6px; }
.lockbox .lb-d { color: #6f6556; margin: 0 0 20px; }
.lb-btn { display: block; width: 100%; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 15px; margin-top: 10px; }
.lb-coin { background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.lb-vip { background: linear-gradient(135deg, #f2a93b, #ffcf7a); color: #1b1304; text-align: left; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 16px 18px; }
.lb-vip small { display: block; font-weight: 600; opacity: .75; }
.lb-vip b { font-size: 20px; }
.lb-vip s { opacity: .6; font-weight: 500; margin-right: 6px; }
.lb-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lb-plan { background: #f6efe2; color: var(--ink); }
.lb-plan span { display: block; font-size: 12px; font-weight: 600; color: #8a7d68; }
.lb-story { background: none; border: 1.5px solid #d9ccb3; color: var(--ink); }
.lb-or { display: flex; align-items: center; gap: 10px; color: #a3957c; font-size: 13px; margin: 16px 0 6px; }
.lb-or::before, .lb-or::after { content: ""; flex: 1; height: 1px; background: #e6dcc8; }
.lb-note { color: #9b8c74; font-size: 12px; margin-top: 14px; }

/* Wallet */
.wallet-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 28px; max-width: 560px; margin-top: 24px; }
.wallet-bal { display: flex; align-items: center; gap: 12px; font: 800 44px var(--serif); }
.wallet-bal .coin { width: 36px; height: 36px; font-size: 18px; }
.wallet-card p { color: var(--tx2); }
.demo-note { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--acc); background: rgba(242,169,59,.12); padding: 4px 10px; border-radius: 6px; }

.tx h3 { font: 700 16px var(--serif); margin: 24px 0 8px; }
.tx-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tx-row small { display: block; color: var(--tx3); font-size: 12px; }
.tx-row .pos { color: #7ed69a; }
.tx-row .neg { color: var(--tx2); }

/* Auth form */
.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; border-radius: 999px; background: #fff; color: #1f1f1f; font-weight: 600; font-size: 15px; border: 1px solid #dadce0; }
.btn-google:hover { background: #f5f5f5; }
.btn-google:disabled { opacity: .6; }
.au-gis { display: flex; justify-content: center; min-height: 0; }
.au-gis:empty { display: none; }
.au-or { display: flex; align-items: center; gap: 10px; color: var(--tx3); font-size: 13px; margin: 16px 0 12px; }
.au-or::before, .au-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.au-f { display: grid; gap: 10px; text-align: left; }
.au-f input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--tx); font: inherit; outline: 0; }
.au-f input:focus { border-color: var(--acc); }
.au-err { color: #ff8a80; font-size: 13px; min-height: 1em; }
.au-sw { margin-top: 14px; color: var(--tx2); font-size: 14px; text-decoration: underline; }
.au-sw:hover { color: var(--tx); }

/* Modal & toast */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 28px; width: 100%; max-width: 400px; text-align: center; }
.modal-box h2 { font: 700 22px var(--serif); margin: 0 0 8px; }
.modal-box p { color: var(--tx2); margin: 0 0 20px; }
.modal-box .btn { width: 100%; justify-content: center; margin-top: 8px; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--tx); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: calc(100% - 32px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.ft { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: var(--w); width: 100%; margin-left: auto; margin-right: auto; color: var(--tx3); font-size: 13px; }
.ft-links { display: flex; gap: 16px; }
.ft-links a:hover { color: var(--tx); }

/* Responsive */
@media (max-width: 900px) {
  .reader { grid-template-columns: 1fr; }
  .side { position: static; }
  .story { grid-template-columns: 180px 1fr; gap: 24px; }
}
@media (max-width: 720px) {
  .hd-in { gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
  .logo span { display: none; }
  .coins { margin-left: auto; }
  .search { order: 2; flex: 1 1 100%; width: auto; margin-left: 0; }
  .nav { order: 3; width: 100%; }
  .btn-signin { padding: 7px 12px; font-size: 14px; }
  .wrap { padding: 0 16px; }
  .hero-slide.on { grid-template-columns: 1fr; min-height: 0; }
  .hero-txt { padding: 36px 0 56px; }
  .row { grid-auto-columns: 140px; gap: 12px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
  .story { grid-template-columns: 1fr; }
  .story .cover { width: 180px; }
  .paper { border-radius: 0; margin: 0 -16px; padding: 28px 20px 36px; }
  .reader { margin-top: 0; }
  .lb-plans { grid-template-columns: 1fr; }
  .ft { flex-direction: column; }
}

/* Legal pages (privacy / terms) */
.legal { max-width: 760px; padding-top: 40px; padding-bottom: 40px; color: var(--tx2); font-size: 16px; line-height: 1.7; }
.legal h1 { font: 800 clamp(30px, 5vw, 42px)/1.1 var(--serif); color: var(--tx); margin: 0 0 6px; }
.legal-date { color: var(--tx3); margin: 0 0 28px; font-size: 14px; }
.legal h2 { font: 700 21px var(--serif); color: var(--tx); margin: 36px 0 10px; }
.legal h3 { font-size: 16px; color: var(--tx); margin: 20px 0 6px; }
.legal p { margin: 0 0 14px; }
.legal ul { margin: 0 0 14px; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal b { color: var(--tx); }
.legal a { color: var(--acc); text-decoration: underline; }
.au-legal { color: var(--tx3); font-size: 12px; margin: 12px 0 0; }
.au-legal a { text-decoration: underline; }
