/* Pagehush design tokens and components.
   Direction: a bookshop, not a dashboard. Warm-neutral paper, very few boxes; the colour comes from the covers. */
:root {
  --bg: #F8F7F4; --surface: #FFFFFF; --surface-2: #F0EEEA; --surface-3: #E4E1DB;
  --ink: #171B26; --muted: #565D6D; --faint: #666C7B; --line: #E3E0DA;
  --accent: #1D6B73; --accent-hover: #175A61; --accent-ink: #FFFFFF; --accent-soft: #E0EEEE;
  --amber: #855604; --amber-soft: #F6EAD2;
  --mature: #AE3445; --mature-soft: #F6DDE0;
  --ok: #2C7A4B; --ok-soft: #DCEFE3;
  --cover1: #1D6B73; --cover2: #3B2F5C; --cover3: #7A3B2E; --cover4: #2F4A2A; --cover5: #1E2F52; --cover6: #5B3A5E;
  --shadow: 0 1px 2px rgba(23,27,38,.05), 0 10px 30px rgba(23,27,38,.08);
  --book-shadow: 0 1px 1px rgba(23,27,38,.08), 0 12px 24px -12px rgba(23,27,38,.45);
  --display: "Young Serif", Georgia, "Times New Roman", serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --read: "Newsreader", Georgia, serif;
  --easy: "Atkinson Hyperlegible", "Figtree", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 14px;
  color-scheme: light;
}
/* Dark theme: follows the device unless the member picked Light or Dark (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12141B; --surface: #191C25; --surface-2: #20242F; --surface-3: #2A2F3C;
    --ink: #E9E7E2; --muted: #A5A9B5; --faint: #8F94A2; --line: #282C38;
    --accent: #6CBDC4; --accent-hover: #86CBD1; --accent-ink: #0F1218; --accent-soft: #19343A;
    --amber: #E2AA4A; --amber-soft: #3A2E17;
    --mature: #E57A88; --mature-soft: #3C1E25;
    --ok: #6BC78F; --ok-soft: #173226;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --book-shadow: 0 1px 1px rgba(0,0,0,.4), 0 12px 24px -10px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #12141B; --surface: #191C25; --surface-2: #20242F; --surface-3: #2A2F3C;
    --ink: #E9E7E2; --muted: #A5A9B5; --faint: #8F94A2; --line: #282C38;
    --accent: #6CBDC4; --accent-hover: #86CBD1; --accent-ink: #0F1218; --accent-soft: #19343A;
    --amber: #E2AA4A; --amber-soft: #3A2E17;
    --mature: #E57A88; --mature-soft: #3C1E25;
    --ok: #6BC78F; --ok-soft: #173226;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --book-shadow: 0 1px 1px rgba(0,0,0,.4), 0 12px 24px -10px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(30px, 4.5vw, 44px); }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 19px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow, .kicker { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.kicker:hover { text-decoration: none; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 20px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding-inline: 20px; }
main { padding-block: 32px 96px; min-height: 60vh; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; }
@media (max-width: 860px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* Top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); transition: transform .25s; }
.topbar.hide { transform: translateY(-100%); }
.topbar-inner { display: flex; align-items: center; gap: 20px; padding-block: 12px; flex-wrap: wrap; }
.logo { font-family: var(--display); font-size: 22px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 15px; height: 22px; color: var(--accent); flex: none; margin-top: -2px; }
.nav { display: flex; gap: 20px; font-weight: 500; font-size: 14.5px; }
.nav a { color: var(--muted); }
.nav a.on, .nav a:hover { color: var(--ink); text-decoration: none; }
.search-box { flex: 1; min-width: 160px; max-width: 320px; }
.search-box input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; font: inherit; font-size: 14px; color: var(--ink); }
.search-box input:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.topbar .sp { flex: 1; }
.icon-link { position: relative; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; }
.icon-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-link svg { width: 20px; height: 20px; }
.dot { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--mature); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.mobile-only { display: none !important; }
@media (max-width: 760px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: revert !important; }
  .bottom-nav.mobile-only, .icon-link.mobile-only { display: flex !important; }
  .topbar-inner { flex-wrap: nowrap; padding-block: 8px; }
  .top-actions { margin-left: auto; gap: 2px; }
  .chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin-inline: -20px; padding-inline: 20px; }
  .chips.scroll-x .chip { flex: none; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}

/* User menu */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 40; display: flex; flex-direction: column; }
.menu-panel a, .menu-panel button { display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px; color: var(--ink); font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-panel .who { padding: 8px 12px; font-size: 13px; color: var(--faint); }

/* 18+ switch */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer; font-family: inherit; padding: 4px; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .2s; }
.switch[aria-checked="true"] .track { background: var(--mature); }
.switch[aria-checked="true"] .track::after { left: 17px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-family: inherit; cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { background: var(--accent-hover); }
.btn.warn { background: var(--mature); border-color: var(--mature); color: #fff; }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 13px; font-size: 13px; }
.btn.lg { padding: 12px 24px; font-size: 15px; }
.btn.pri:active, .btn.lg:active { transform: translateY(1px); }
.btn.on { border-color: var(--mature); color: var(--mature); }
.btn.tip { border-color: var(--amber); color: var(--amber); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

/* Tags and chips */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.mature { background: var(--mature-soft); color: var(--mature); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; font-size: 13.5px; color: var(--muted); background: var(--surface-2); font-weight: 500; }
.chip:hover { text-decoration: none; color: var(--ink); background: var(--surface-3); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.panel-title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.callout { border-left: 3px solid var(--amber); background: var(--amber-soft); padding: 12px 16px; border-radius: 0 10px 10px 0; font-size: 14.5px; }
.callout.red { border-color: var(--mature); background: var(--mature-soft); }
.callout.teal { border-color: var(--accent); background: var(--accent-soft); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* Flash messages */
.flash-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { padding: 10px 14px; border-radius: 10px; font-size: 14.5px; background: var(--accent-soft); color: var(--ink); border: 1px solid var(--line); }
.flash.error { background: var(--mature-soft); }
.flash.warning { background: var(--amber-soft); }

/* Avatars */
.av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--cover2), var(--accent)); flex: none; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.lg { width: 92px; height: 92px; font-size: 30px; border: 4px solid var(--surface); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .name { font-weight: 600; font-size: 14px; color: var(--ink); display: block; }
.who .sub { font-size: 12.5px; color: var(--faint); }

/* Covers: drawn per category so shelves look like a bookshop. Uploaded covers replace the drawing. */
.cover { container-type: inline-size; position: relative; aspect-ratio: 3 / 4; width: 100%; max-width: 100%; border-radius: 3px 7px 7px 3px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 11% 10% 10% 13%; color: #fff;
  --c1: #2E6E78; --c2: #143A42; background: linear-gradient(165deg, var(--c1), var(--c2)); box-shadow: var(--book-shadow); transition: transform .25s ease, box-shadow .25s ease; }
.cover::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
.cover::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 5%; background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.08) 70%, transparent); pointer-events: none; }
.cover > * { position: relative; z-index: 1; }
.cv-g { font-family: var(--body); font-size: 9.5px; font-size: clamp(8.5px, 6.6cqi, 12px); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; opacity: .82; }
.cv-t { font-family: var(--display); font-size: 15px; font-size: clamp(11px, 11.5cqi, 30px); line-height: 1.12; text-wrap: balance; overflow-wrap: anywhere; hyphens: auto; margin-top: auto; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.cv-a { font-family: var(--body); font-size: 10px; font-size: clamp(8.5px, 7cqi, 13px); opacity: .85; letter-spacing: .02em; }
.cover.has-img { padding: 0; background: var(--surface-2); }
.cover.has-img::before { display: none; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.card:hover .cover, a:hover > .cover, .hero-cover:hover .cover { transform: translateY(-3px); box-shadow: 0 2px 2px rgba(0,0,0,.08), 0 18px 30px -14px rgba(0,0,0,.55); }
/* Colour schemes */
.h-ember { --c1: #8A4B2F; --c2: #47210F; } .h-night { --c1: #2B3A5C; --c2: #111A2D; } .h-sea { --c1: #2E6E78; --c2: #123840; }
.h-forest { --c1: #3D6B3A; --c2: #1A3320; } .h-plum { --c1: #6B4E8A; --c2: #2C1F40; } .h-blood { --c1: #74202E; --c2: #22090E; }
.h-rose { --c1: #B0566A; --c2: #592234; } .h-slate { --c1: #4A5D73; --c2: #212B37; } .h-ochre { --c1: #9A6B2A; --c2: #4A3112; }
.h-ink { --c1: #33384A; --c2: #101219; } .h-dusk { --c1: #8C5A7A; --c2: #3A2440; }
/* Patterns, one per category */
.cv-rings::before { background: repeating-radial-gradient(circle at 78% 22%, transparent 0 9px, rgba(255,255,255,.13) 9px 10px); }
.cv-orbit::before { background: radial-gradient(circle at 70% 30%, rgba(255,255,255,.9) 0 2.2%, transparent 2.6%), radial-gradient(circle at 50% 40%, transparent 0 28%, rgba(255,255,255,.16) 28.5% 29.5%, transparent 30% 44%, rgba(255,255,255,.1) 44.5% 45.5%, transparent 46%); }
.cv-rain::before { background: repeating-linear-gradient(104deg, transparent 0 8px, rgba(255,255,255,.1) 8px 9px); }
.cv-bars::before { background: repeating-linear-gradient(90deg, transparent 0 14%, rgba(255,255,255,.07) 14% 16%), radial-gradient(circle at 50% 38%, rgba(255,255,255,.18), transparent 40%); }
.cv-glow::before { background: radial-gradient(circle at 50% 38%, rgba(255,150,160,.75) 0 4%, rgba(200,60,80,.4) 13%, transparent 42%); }
.cv-waves::before { background: radial-gradient(130% 42% at 50% 104%, rgba(255,255,255,.2) 0 40%, transparent 41%), radial-gradient(130% 42% at 22% 96%, rgba(255,255,255,.12) 0 40%, transparent 41%); }
.cv-frame::before { inset: 6%; border: 1px solid rgba(255,255,255,.35); box-shadow: inset 0 0 0 4px transparent, inset 0 0 0 5px rgba(255,255,255,.18); }
.cv-river::before { background: repeating-linear-gradient(0deg, transparent 0 10px, rgba(255,255,255,.09) 10px 12px); -webkit-mask-image: linear-gradient(transparent 35%, #000); mask-image: linear-gradient(transparent 35%, #000); }
.cv-split::before { background: linear-gradient(128deg, transparent 0 58%, rgba(255,255,255,.12) 58%); }
.cv-dots::before { background: radial-gradient(circle, rgba(255,255,255,.18) 0 2px, transparent 2.5px) 0 0 / 14px 14px; }
.cv-windows::before { background: linear-gradient(rgba(255,226,150,.35), rgba(255,226,150,.35)) 62% 22% / 14% 11% no-repeat, linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.1)) 82% 22% / 14% 11% no-repeat, linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.1)) 62% 38% / 14% 11% no-repeat, linear-gradient(rgba(255,226,150,.25), rgba(255,226,150,.25)) 82% 38% / 14% 11% no-repeat; }
.cv-stars::before { background: radial-gradient(circle at 20% 30%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 70% 18%, #fff 0 1.3px, transparent 1.8px), radial-gradient(circle at 85% 45%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 40% 52%, rgba(255,255,255,.8) 0 1px, transparent 1.5px), radial-gradient(circle at 60% 36%, rgba(255,255,255,.7) 0 .8px, transparent 1.2px); }
.cv-moon::before { background: radial-gradient(circle at 74% 24%, rgba(255,255,255,.85) 0 11%, transparent 11.5%), radial-gradient(circle at 74% 24%, rgba(255,255,255,.12) 0 22%, transparent 23%); }
.cv-ruled::before { background: repeating-linear-gradient(0deg, transparent 0 13px, rgba(255,255,255,.1) 13px 14px), linear-gradient(90deg, transparent 0 22%, rgba(255,140,140,.3) 22% calc(22% + 1px), transparent calc(22% + 1px)); }
.cv-shelf::before { background: repeating-linear-gradient(90deg, rgba(0,0,0,.16) 0 3px, transparent 3px 11px, rgba(255,255,255,.06) 11px 13px, transparent 13px 19px); -webkit-mask-image: linear-gradient(#000 30%, transparent 75%); mask-image: linear-gradient(#000 30%, transparent 75%); }
.cv-stamp::before { background: radial-gradient(circle at 72% 26%, transparent 0 15%, rgba(255,255,255,.3) 15.5% 16.5%, transparent 17% 19%, rgba(255,255,255,.18) 19.5% 20%, transparent 20.5%); }
.c0 { --c1: #2E6E78; --c2: #123840; } .c1 { --c1: #6B4E8A; --c2: #2C1F40; } .c2 { --c1: #8A4B2F; --c2: #47210F; } .c3 { --c1: #3D6B3A; --c2: #1A3320; } .c4 { --c1: #2B3A5C; --c2: #111A2D; } .c5 { --c1: #8C5A7A; --c2: #3A2440; }
.adult-badge { position: absolute; top: 7px; right: 7px; z-index: 2; background: var(--mature); color: #fff; font-family: var(--body); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; letter-spacing: .02em; }
.new-badge { position: absolute; top: 7px; left: 9%; z-index: 2; background: #F3C969; color: #2A1E05; font-family: var(--body); font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px; letter-spacing: .04em; text-transform: uppercase; }
.card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); min-width: 0; }
.card:hover { text-decoration: none; }
.card:hover .t { color: var(--accent); }
.card .t { font-weight: 600; font-size: 14px; line-height: 1.3; margin-top: 4px; }
.card .s { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; line-height: 1.35; }
.card .s.faint { color: var(--faint); }
.shelf { display: flex; gap: 20px; overflow-x: auto; padding: 4px 2px 12px; margin-inline: -2px; scrollbar-width: none; scroll-snap-type: x proximity; }
.shelf::-webkit-scrollbar { display: none; }
.shelf > .card { flex: 0 0 140px; scroll-snap-align: start; }
@media (max-width: 560px) { .shelf { gap: 14px; } .shelf > .card { flex-basis: 116px; } }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: clamp(21px, 2.6vw, 25px); }
.section-head a { font-size: 13.5px; font-weight: 600; }

.gate-strip { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; color: var(--muted); }
.gate-strip b { color: var(--ink); }

/* Story page */
.story-head { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; align-items: start; }
@media (max-width: 760px) { .story-head { grid-template-columns: minmax(0, 1fr); gap: 24px; } .story-side { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 18px; align-items: end; } }
.stats { display: flex; gap: 24px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.stats b { display: block; font-size: 18px; }
.stats span { font-size: 12px; color: var(--faint); }
.toc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.toc-list li { border-bottom: 1px solid var(--line); }
.toc-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 13px 6px; color: var(--ink); font-weight: 500; }
.toc-list a:hover { background: var(--surface-2); text-decoration: none; border-radius: 8px; }
.toc-list .n { display: inline-block; min-width: 1.8em; font-variant-numeric: tabular-nums; color: var(--faint); font-weight: 400; }

/* Reader */
.reader-shell { background: var(--surface); color: var(--ink); transition: background .25s, color .25s; }
.reader-shell.paper { color-scheme: light; --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F1F2F4; --surface-3: #E3E6EA; --ink: #1A1A1A; --muted: #555B66; --faint: #7A808B; --line: #DDE0E5;
  --accent: #1D6B73; --accent-hover: #175A61; --accent-ink: #FFFFFF; --accent-soft: #DCEDEE; --mature: #AE3445; --mature-soft: #F6DDE0; --amber: #9A6508; --amber-soft: #F6EAD2; }
.reader-shell.sepia { color-scheme: light; --bg: #F3E9D6; --surface: #F3E9D6; --surface-2: #EADDC4; --surface-3: #DDCDAE; --ink: #3B2F20; --muted: #6E5E48; --faint: #8A7A62; --line: #D8C8AA;
  --accent: #7A4E1D; --accent-hover: #653F15; --accent-ink: #FFF8EC; --accent-soft: #E8D6B8; --mature: #A2372E; --mature-soft: #F0D5C8; --amber: #8A5A0A; --amber-soft: #EFDDB8; }
.reader-shell.night { color-scheme: dark; --bg: #0B0D12; --surface: #0B0D12; --surface-2: #151922; --surface-3: #1E2330; --ink: #B9BFCB; --muted: #8C93A3; --faint: #6B7282; --line: #222835;
  --accent: #5FA9B0; --accent-hover: #74B9BF; --accent-ink: #0B0D12; --accent-soft: #14282C; --mature: #D9727F; --mature-soft: #2E181D; --amber: #D09A40; --amber-soft: #2B2314; }
.reader-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); width: 0; z-index: 50; transition: width .1s linear; }
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 60px; gap: 24px; max-width: 860px; margin: 0 auto; padding: 32px 20px 60px; }
@media (max-width: 640px) { .reader { grid-template-columns: minmax(0, 1fr); } }
.reader h1 { font-size: clamp(28px, 4vw, 36px); }
.reader .meta { color: var(--muted); font-size: 13.5px; }
.story-text { --size: 19px; --line: 1.75; --width: 64ch; font-family: var(--read); font-size: var(--size); line-height: var(--line); max-width: var(--width); display: flex; flex-direction: column; gap: 1em; }
.story-text.clean { font-family: var(--body); }
.story-text.easy { font-family: var(--easy); }
.story-text h2 { font-size: 1.35em; margin-top: .6em; }
.story-text h3 { font-size: 1.15em; margin-top: .4em; }
.story-text blockquote { margin: 0; padding-left: 1em; border-left: 3px solid var(--line); font-style: italic; }
.story-text .ql-align-center { text-align: center; }
.story-text .ql-align-right { text-align: right; }
.rail { display: flex; flex-direction: column; gap: 10px; align-items: center; position: sticky; top: 90px; align-self: start; }
@media (max-width: 640px) { .rail { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); flex-direction: row; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; box-shadow: var(--shadow); z-index: 20; top: auto; } }
.rail-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.1; font-variant-numeric: tabular-nums; cursor: pointer; font-family: inherit; }
.rail-btn:hover { border-color: var(--faint); text-decoration: none; }
.rail-btn svg { width: 18px; height: 18px; }
.rail-btn.on { border-color: var(--mature); color: var(--mature); }
.rail-btn.saved { border-color: var(--accent); color: var(--accent); }
.warn-box { border: 1px solid var(--mature); background: var(--mature-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.chapter-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 20px; }
.prefs-panel { position: fixed; right: 16px; top: 76px; width: min(300px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 14px; z-index: 45; }
.prefs-panel label, .prefs-panel .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); display: flex; flex-direction: column; gap: 6px; }
.prefs-panel input[type=range] { width: 100%; accent-color: var(--accent); }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; font-family: var(--read); font-weight: 700; font-size: 13px; }
.swatches button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { letter-spacing: 0; text-transform: none; border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); font-family: var(--body); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* Comments */
.comments { display: flex; flex-direction: column; gap: 18px; }
.cmt { display: flex; gap: 10px; }
.cmt .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cmt .body .head { font-size: 13.5px; font-weight: 600; }
.cmt .body .head span { font-weight: 400; color: var(--faint); margin-left: 6px; }
.cmt .body p { font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.cmt .actions { display: flex; gap: 14px; font-size: 12.5px; color: var(--faint); align-items: center; flex-wrap: wrap; }
.cmt .actions button, .cmt .actions a { background: none; border: 0; padding: 0; color: var(--faint); font: inherit; cursor: pointer; }
.cmt .actions button:hover, .cmt .actions a:hover { color: var(--ink); }
.cmt .actions .liked { color: var(--mature); }
.replies { margin-left: 42px; display: flex; flex-direction: column; gap: 14px; }
.writer-badge { font-size: 10px; background: var(--accent); color: var(--accent-ink); padding: 1px 6px; border-radius: 4px; margin-left: 6px; font-weight: 700; vertical-align: 1px; }
.held { font-size: 12px; color: var(--amber); }

/* Forms */
form.stack > p, .form-row { display: flex; flex-direction: column; gap: 6px; }
label { font-weight: 600; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=datetime-local], input[type=search], input[type=number], select, textarea {
  width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font: inherit; font-size: 15px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.helptext, .help { font-size: 13px; color: var(--faint); font-weight: 400; }
.errorlist { list-style: none; padding: 0; margin: 0; color: var(--mature); font-size: 13.5px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check-row input { margin-top: 3px; flex: none; }
.choice-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.choice-list label { font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.form-card { max-width: 520px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.form-card form { display: flex; flex-direction: column; gap: 14px; }
.form-card form p { display: flex; flex-direction: column; gap: 6px; }
.form-card form p:has(input[type=checkbox]) { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Settings */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; }
@media (max-width: 760px) { .settings { grid-template-columns: minmax(0, 1fr); } }
.side-nav { display: flex; flex-direction: column; gap: 2px; font-size: 14px; align-self: start; position: sticky; top: 80px; }
@media (max-width: 760px) { .side-nav { flex-direction: row; overflow-x: auto; position: static; } }
.side-nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; display: flex; justify-content: space-between; gap: 8px; }
.side-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav em { font-style: normal; font-family: var(--mono); font-size: 11px; }
.pref-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 16px; align-items: center; padding-block: 14px; border-bottom: 1px solid var(--line); }
.pref-row:last-child { border-bottom: 0; }
@media (max-width: 620px) { .pref-row { grid-template-columns: minmax(0, 1fr); } }

/* Profile */
.banner { height: 180px; border-radius: 16px 16px 0 0; background: linear-gradient(120deg, var(--cover5), var(--cover1) 60%, var(--cover2)); overflow: hidden; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.prof { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.prof-head { display: flex; gap: 6px 18px; align-items: flex-start; padding: 0 22px; margin-top: -46px; flex-wrap: wrap; }
.prof-head .nm, .prof-head .acts { padding-top: 56px; }
@media (max-width: 560px) { .prof-head .nm { padding-top: 0; flex-basis: 100%; } .prof-head .acts { padding-top: 0; } }
.prof-head .nm { flex: 1; min-width: 200px; }
.prof-head .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 22px; padding: 0 22px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; overflow-x: auto; }
.tabs a { padding: 12px 0; white-space: nowrap; color: var(--muted); }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* Tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 500; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.flagged td { background: var(--mature-soft); }
.score { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { width: 54px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 620px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; font-weight: 600; }
.kpi span { font-size: 12px; color: var(--faint); }

/* Studio editor */
.editor-shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
@media (max-width: 900px) { .editor-shell { grid-template-columns: minmax(0, 1fr); } }
.editor-main { padding: 20px 26px 30px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.editor-main .title-input { border: 0; padding: 0; font-family: var(--display); font-size: 28px; background: none; box-shadow: none; }
.editor-main .title-input:focus { box-shadow: none; }
.editor-aside { border-left: 1px solid var(--line); background: var(--surface-2); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) { .editor-aside { border-left: 0; border-top: 1px solid var(--line); } }
#editor { font-family: var(--read); font-size: 18px; line-height: 1.75; min-height: 420px; }
#editor .ql-editor { padding: 8px 0; min-height: 420px; }
#editor .ql-editor.ql-blank::before { left: 0; color: var(--faint); font-style: normal; }
.ql-toolbar.ql-snow { border: 0 !important; border-bottom: 1px solid var(--line) !important; padding: 0 0 10px !important; font-family: var(--body) !important; }
.ql-container.ql-snow { border: 0 !important; font-family: var(--read) !important; font-size: 18px !important; }
.ql-snow .ql-stroke { stroke: var(--muted) !important; }
.ql-snow .ql-fill { fill: var(--muted) !important; }
.ql-snow .ql-picker { color: var(--muted) !important; }
.ql-snow .ql-picker-options { background: var(--surface) !important; }
.ql-editor .ql-align-center { text-align: center; }
.ql-editor blockquote { border-left: 3px solid var(--line) !important; padding-left: 1em; font-style: italic; }
.ql-scene::after { content: "⁂"; font-size: 16px; color: var(--muted); }
.sug { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.sug del { color: var(--mature); }
.sug ins { color: var(--ok); text-decoration: none; font-weight: 600; }
.sug .why { color: var(--muted); font-size: 13px; }
.save-state { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.status-pill { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.st-draft { background: var(--surface-2); color: var(--muted); }
.st-review { background: var(--amber-soft); color: var(--amber); }
.st-live { background: var(--ok-soft); color: var(--ok); }
.st-changes { background: var(--mature-soft); color: var(--mature); }

/* Modal (native dialog) */
dialog { border: 0; border-radius: 16px; padding: 0; max-width: 440px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10,13,24,.55); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { font-size: 24px; }
dialog p { color: var(--muted); font-size: 14.5px; }
dialog .acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* Notifications */
.notes { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.notes li + li { border-top: 1px solid var(--line); }
.notes a { display: flex; gap: 12px; padding: 14px 16px; color: var(--ink); align-items: flex-start; }
.notes a:hover { background: var(--surface-2); text-decoration: none; }
.notes .unread { background: var(--accent-soft); }
.notes time { font-size: 12.5px; color: var(--faint); display: block; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-block: 28px; color: var(--faint); font-size: 13.5px; }
.footer a { color: var(--muted); }
.footer .row { gap: 18px; }

/* Long-form static pages */
.prose { max-width: 68ch; display: flex; flex-direction: column; gap: 14px; }
.prose h2 { margin-top: 18px; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* allauth pages */
.allauth h1 { font-size: 28px; }
.allauth form { display: flex; flex-direction: column; gap: 14px; }
.allauth form p { display: flex; flex-direction: column; gap: 6px; }
.allauth form p:has(> input[type=checkbox]) { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.allauth button[type=submit], .allauth form button { display: inline-flex; justify-content: center; border-radius: 8px; padding: 9px 16px; font-weight: 600; font-size: 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-family: inherit; cursor: pointer; }
.allauth ul { padding-left: 18px; }

/* Reader extras */
.recap-box { border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 10px 14px; font-size: 14.5px; }
.recap-box summary { cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.recap-box p { margin-top: 6px; color: var(--muted); }
.listen-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.listen-bar select { width: auto; padding: 4px 8px; font-size: 13px; }
.listen-bar label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.story-text .speaking { background: var(--accent-soft); border-radius: 4px; box-shadow: 0 0 0 4px var(--accent-soft); }

/* Moderation photo grid */
.mod-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.mod-photo { display: flex; flex-direction: column; gap: 6px; font-weight: 400; }
.mod-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.mod-photo.is-partial img { border: 2px solid var(--mature); }

/* Albums */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.thumb-wrap, .album-cover { position: relative; display: block; aspect-ratio: 1; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.thumb-wrap img, .album-cover img { width: 100%; height: 100%; object-fit: cover; transition: filter .3s; }
.album-cover { display: grid; place-items: center; }
.album-cover img { position: absolute; inset: 0; }
.album-badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; z-index: 2; }
.blur-gate img { filter: blur(18px) saturate(.6); transform: scale(1.08); }
.blur-gate.revealed img { filter: none; transform: none; }
.blur-veil { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; cursor: pointer; }
.blur-veil span { background: var(--surface); color: var(--mature); font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--mature); }
.blur-gate.revealed .blur-veil { display: none; }
.is-pending img { opacity: .65; }
.pending-tag { position: absolute; bottom: 8px; left: 8px; z-index: 2; }
.upload-box { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.upload-box label { display: flex; flex-direction: column; gap: 4px; }
.photo-full { margin: 0; position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; max-height: 80vh; }
.photo-full img { max-height: 80vh; width: auto; max-width: 100%; object-fit: contain; }
.album-card .t { margin-top: 2px; }

/* Messages */
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.msg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 80%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .bubble { background: var(--surface-2); padding: 9px 13px; border-radius: 14px 14px 14px 4px; font-size: 15px; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--accent); color: var(--accent-ink); border-radius: 14px 14px 4px 14px; }
.msg .meta { font-size: 11.5px; color: var(--faint); display: flex; gap: 10px; }
.msg .meta a, .msg .meta .linkish { color: var(--faint); font-size: 11.5px; }
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; }

/* Paragraph reactions and quote sharing */
.react-strip { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; vertical-align: middle; font-family: var(--body); font-size: 12px; font-style: normal; }
.react-chip { background: var(--accent-soft); color: var(--ink); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.react-chip.mine { box-shadow: inset 0 0 0 1px var(--accent); }
.react-add { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; font-size: 11px; padding: 1px 7px; cursor: pointer; opacity: 0; transition: opacity .15s; font-family: var(--body); }
#story-text > *:hover .react-add, .react-add:focus-visible { opacity: 1; }
@media (hover: none) { .react-add { opacity: .7; } }
.react-pop { position: absolute; z-index: 60; display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.react-pop button { border: 0; background: none; font-size: 20px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; }
.react-pop button:hover, .react-pop button:focus-visible { background: var(--surface-2); }
.quote-btn { position: absolute; z-index: 55; }

/* Charts (single series; accent hue; text in ink tokens) */
.chart { position: relative; margin: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ytick { fill: var(--faint); font-size: 11px; text-anchor: end; dominant-baseline: middle; font-family: var(--body); font-variant-numeric: tabular-nums; }
.chart .xtick { fill: var(--faint); font-size: 11px; text-anchor: middle; font-family: var(--body); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .end, .chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 4px 9px; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Challenges, lists, updates, badges */
.challenge-card { color: inherit; gap: 8px; }
.challenge-card:hover { text-decoration: none; border-color: var(--faint); }
.challenge-prompt { font-family: var(--display); font-size: 22px; line-height: 1.25; text-wrap: balance; }
.challenge-card.big .challenge-prompt { font-size: clamp(24px, 3.4vw, 32px); }
.phase-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .phase-steps { grid-template-columns: minmax(0, 1fr); } }
.phase-steps li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.phase-steps li span { font-size: 12.5px; color: var(--faint); }
.phase-steps li.now { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.phase-steps li.done { opacity: .6; }
.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.entry { gap: 8px; }
.entry.winner { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.entry-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.place { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.place-1 { background: var(--amber-soft); color: var(--amber); }
.list-picker { position: absolute; left: 0; right: auto; top: calc(100% + 6px); }
.post p { font-size: 15.5px; }
.story-link { align-self: flex-start; font-size: 13.5px; font-weight: 600; background: var(--surface-2); padding: 5px 10px; border-radius: 8px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.badge { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.badge .medal { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-family: var(--display); font-size: 15px; }
.badge.gold .medal { background: var(--amber-soft); color: var(--amber); }
.badge b { font-size: 13.5px; display: block; }
.badge span { font-size: 12px; color: var(--faint); }
.streak { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; color: var(--amber); background: var(--amber-soft); padding: 3px 10px; border-radius: 999px; }

/* Audio and tips */
.narration { display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.narration audio { width: 100%; }
.tip-amounts { display: flex; gap: 8px; flex-wrap: wrap; }
.tip-amounts button { min-width: 72px; }
.tip-amounts button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.audio-badge { position: absolute; bottom: 8px; left: 8px; z-index: 2; background: rgba(0,0,0,.6); color: #fff; font-family: var(--body); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }

/* 18+ teaser cover: no artwork until the reader passes the age gate */
.cover-locked { background: repeating-linear-gradient(135deg, var(--surface-3) 0 10px, var(--surface-2) 10px 20px); color: var(--ink); }
.cover-locked::before { display: none; }
.teaser-gate { border: 1px solid var(--mature); background: var(--mature-soft); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--faint); list-style: none; padding: 0; margin: 0; }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--muted); }

/* Writing flow */
.steps-bar { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; font-size: 13.5px; font-weight: 600; color: var(--faint); }
.steps-bar li { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--surface-2); }
.steps-bar li a { color: inherit; display: inline-flex; align-items: center; gap: 8px; }
.steps-bar li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-family: var(--mono); font-size: 11.5px; }
.steps-bar li.done { color: var(--ok); }
.steps-bar li.done span { background: var(--ok-soft); }
.steps-bar li.now { color: var(--accent-ink); background: var(--accent); }
.steps-bar li.now span { background: rgba(255,255,255,.25); color: var(--accent-ink); }
.kind-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.kind-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; font-weight: 500; background: var(--surface); }
.kind-card:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.kind-card input { margin-top: 4px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); font-size: 12px; }
.checklist li.ok .tick { background: var(--ok-soft); color: var(--ok); }
select optgroup { font-weight: 700; }
.cat-children { list-style: none; margin: 0; padding: 0 0 0 16px; display: flex; flex-direction: column; gap: 6px; border-left: 2px solid var(--line); }

/* Skip link */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* Bottom navigation (phones) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); justify-content: space-around; }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--faint); padding: 4px 0; text-decoration: none; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.on { color: var(--accent); }
.bottom-nav a.write svg { background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 3px; width: 30px; height: 26px; }

/* Toasts */
.toasts { position: fixed; z-index: 70; right: 16px; top: calc(70px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 760px) { .toasts { left: 16px; right: 16px; width: auto; top: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 11px 12px 11px 14px; font-size: 14.5px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; transition: opacity .25s, transform .25s; }
.toast span { flex: 1; }
.toast.error { background: var(--mature); color: #fff; }
.toast.warning { background: var(--amber); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-6px); }
.toast-x { background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .8; padding: 0 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Search suggestions */
.search-box { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.suggest:empty { display: none; }
.suggest .grp { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 8px 12px 4px; }
.suggest a { display: flex; gap: 10px; align-items: center; padding: 7px 12px; color: var(--ink); font-size: 14px; }
.suggest a:hover, .suggest a:focus { background: var(--surface-2); text-decoration: none; outline: none; }
.suggest a .faint { margin-left: auto; font-size: 12px; }
.suggest .all { border-top: 1px solid var(--line); color: var(--accent); font-weight: 600; }

/* Theme switch */
.theme-switch { display: flex; align-items: center; gap: 4px; padding: 6px 12px; }
.theme-switch button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.theme-switch.compact { padding: 0; }
.theme-switch .small { margin-right: auto; }
.menu-row { padding: 4px 6px; }
.menu-row .switch { width: 100%; justify-content: flex-start; font-size: 14px; color: var(--ink); }

/* Password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--surface-2); color: var(--muted); border-radius: 6px; padding: 4px 9px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }

/* Working state for buttons */
button[aria-busy="true"], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.htmx-request.btn, .htmx-request .btn { opacity: .65; }
.load-more { grid-column: 1 / -1; display: flex; justify-content: center; padding-top: 8px; }
.search-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search-filters select, .search-filters input[type=search] { width: auto; flex: 1; min-width: 160px; }
.search-filters label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }

/* Sign in / join */
.auth-card { max-width: 440px; }
.auth-card .form-row label { font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
fieldset.dob { border: 0; padding: 0; margin: 0; }
fieldset.dob legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.dob-selects { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 8px; }
.dob-selects select { width: 100%; }

/* Welcome: interests */
.pick-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pick-group legend { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick input, .pick-writer input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 14px; cursor: pointer; }
.pick input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pick input:focus-visible + span, .pick-writer:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-writers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick-writer { position: relative; display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 400; }
.pick-writer > span:not(.pick-state) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pick-state::after { content: "Follow"; font-size: 12px; font-weight: 700; color: var(--accent); }
.pick-writer:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick-writer:has(input:checked) .pick-state::after { content: "✓ Following"; }
.prompt-card { color: inherit; border-style: dashed; }
.prompt-card:hover { text-decoration: none; border-color: var(--accent); }
.error-page { max-width: 560px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }

/* Studio cards */
.work-list { display: flex; flex-direction: column; gap: 12px; }
.work-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.work-cover .cover { padding: 8px 6px 8px 9px; }
.work-cover .cv-g, .work-cover .cv-a, .work-cover .adult-badge, .work-cover .audio-badge { display: none; }
.work-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.work-title { font-weight: 700; font-size: 16.5px; color: var(--ink); }

/* Editor comfort */
#editor .ql-editor p { margin-bottom: .85em; }
#editor .ql-editor h2, #editor .ql-editor h3 { margin: .6em 0 .4em; }
.editor-bar { position: sticky; bottom: env(safe-area-inset-bottom, 0px); z-index: 30; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow); }
.editor-bar .save-state { margin-right: auto; }
@media (max-width: 760px) { .editor-bar.mobile-only { display: flex !important; } .editor-main { padding: 16px; } }
.preview-banner { position: sticky; top: 0; z-index: 35; background: var(--amber-soft); color: var(--ink); text-align: center; padding: 8px 12px; font-size: 14px; border-bottom: 1px solid var(--line); }
.progress-mini { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.progress-mini i { display: block; height: 100%; background: var(--accent); }

/* Notifications */
.notes a { align-items: center; }
.note-who { display: flex; align-items: center; flex: none; }
.note-who .av { margin-right: -8px; border: 2px solid var(--surface); }
.note-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; position: relative; }
.note-who .av + .note-icon { width: 22px; height: 22px; margin-left: 0; align-self: flex-end; }
.note-icon svg { width: 15px; height: 15px; }
.k-badge, .k-challenge { color: var(--amber); background: var(--amber-soft); }
.k-tip { color: var(--mature); background: var(--mature-soft); }
.k-new_chapter { color: var(--accent); background: var(--accent-soft); }
.k-warning { color: var(--mature); background: var(--mature-soft); }
.k-follow { color: var(--ok); background: var(--ok-soft); }
.note-text { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 12px; }
.note-text time { flex: none; }
.note-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.crop-preview { position: relative; max-width: 240px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.crop-preview img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.crop-preview .help { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; padding: 4px 8px; font-size: 11.5px; }
.dropzone { transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-label { cursor: pointer; }
.queue-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.queue-thumbs:empty { display: none; }
.queue-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.queue-thumbs img.too-big { outline: 2px solid var(--mature); opacity: .5; }
.upload-progress { display: flex; align-items: center; gap: 10px; }
.upload-progress .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.upload-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.back-link { align-self: flex-start; color: var(--muted); font-weight: 600; }
.login-prompt { align-items: stretch; text-align: center; }
.login-prompt .logo { justify-content: center; font-size: 20px; }
.login-prompt h2 { font-size: 24px; }
dialog#login-prompt { max-width: 380px; }
.browse-tabs { padding: 0; }
.album-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.albums-shelf > .card { flex: 0 0 150px; }

/* Full-screen photo viewer */
body.viewer-open { overflow: hidden; padding-bottom: 0; }
body.viewer-open .topbar, body.viewer-open .footer { display: none; }
.viewer { position: fixed; inset: 0; z-index: 80; background: #05070C; color: #F2F4F8; display: flex; flex-direction: column; transition: opacity .2s; }
.viewer-top, .viewer-bottom { position: absolute; left: 0; right: 0; z-index: 2; display: flex; gap: 12px; padding: 12px 14px; transition: opacity .2s, transform .2s; }
.viewer-top { top: 0; align-items: center; padding-top: calc(12px + env(safe-area-inset-top, 0px)); background: linear-gradient(rgba(0,0,0,.7), transparent); }
.viewer-bottom { bottom: 0; flex-direction: column; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.viewer.bare .viewer-top, .viewer.bare .viewer-bottom, .viewer.bare .viewer-nav { opacity: 0; pointer-events: none; }
.viewer-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; flex: none; }
.viewer-btn svg { width: 20px; height: 20px; }
.viewer-btn:hover, .viewer-btn:focus-visible { background: rgba(255,255,255,.26); text-decoration: none; }
.viewer-title { flex: 1; min-width: 0; color: #fff; display: flex; flex-direction: column; line-height: 1.25; }
.viewer-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-title span { font-size: 12.5px; opacity: .75; }
.viewer-title:hover { text-decoration: none; }
.viewer-count { font-family: var(--mono); font-size: 13px; background: rgba(255,255,255,.14); padding: 4px 10px; border-radius: 999px; }
.viewer-stage { flex: 1; display: grid; place-items: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.viewer-figure { margin: 0; position: relative; max-width: 100vw; max-height: 100%; display: grid; place-items: center; }
.viewer-figure img { max-width: 100vw; max-height: 100dvh; width: auto; height: auto; object-fit: contain; transition: opacity .18s, transform .15s; user-select: none; -webkit-user-drag: none; }
.viewer-figure img.swap { opacity: .25; }
@media (min-width: 761px) { .viewer-figure img { max-width: calc(100vw - 140px); max-height: calc(100dvh - 140px); } }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 64px; display: grid; place-items: center; font-size: 40px; line-height: 1; color: #fff; background: rgba(255,255,255,.1); border-radius: 12px; transition: opacity .2s; }
.viewer-nav:hover { background: rgba(255,255,255,.22); text-decoration: none; }
.viewer-nav.prev { left: 14px; } .viewer-nav.next { right: 14px; }
@media (hover: none) { .viewer-nav { display: none; } }
.viewer-caption { font-size: 15px; max-width: 70ch; }
.viewer-caption:empty { display: none; }
.viewer-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.viewer-meta .who { color: #fff; font-size: 13.5px; }
.viewer-report { color: rgba(255,255,255,.7); font-size: 13px; }
.viewer-hint { font-size: 12px; opacity: .55; text-align: center; }
@media (hover: hover) { .viewer-hint { display: none; } }

/* Album grid as a tight gallery on phones */
@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .photo-grid .thumb-wrap { border-radius: 4px; }
}
.blur-veil { flex-direction: column; gap: 8px; }
.blur-veil { display: flex; align-items: center; justify-content: center; }
.blur-veil[hidden] { display: none; }
.veil-always { background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.veil-always:hover, .veil-always:focus-visible { background: rgba(0,0,0,.75); }

/* Category row: always one line, scrolls sideways */
.chip-row { position: relative; }
.chips.one-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; padding-bottom: 2px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.chips.one-row::-webkit-scrollbar { display: none; }
.chips.one-row.at-end { -webkit-mask-image: none; mask-image: none; }
.chips.one-row .chip { flex: none; }
.chip.more { border-style: dashed; color: var(--accent); font-weight: 600; }
.chip-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 20px; line-height: 1; cursor: pointer; }
.chip-arrow.left { left: -6px; } .chip-arrow.right { right: -6px; }
@media (hover: none) { .chip-arrow { display: none; } }
.cat-directory { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cat-card { gap: 8px; }
.cat-top { display: flex; justify-content: space-between; align-items: baseline; color: var(--ink); font-size: 17px; }
.cat-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cat-card li { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }

/* ---------- Bookshop redesign: home, story page, reader ---------- */
.home { gap: 44px; }
@media (max-width: 760px) { .home { gap: 34px; } main { padding-top: 20px; } }

/* Greeting for signed-in readers */
.greeting { display: flex; flex-direction: column; gap: 6px; }
.greeting h1 { font-size: clamp(28px, 4vw, 40px); }
.greeting p { color: var(--muted); font-size: 16.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Hero: one story, its first line, one button */
.hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: center; padding-block: 8px; }
.hero-cover { display: block; }
.hero-cover:hover { text-decoration: none; }
.hero-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero h2 { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.08; }
.hero h2 a { color: inherit; }
.hero h2 a:hover { text-decoration: none; color: var(--accent); }
.hero-quote { margin: 0; font-family: var(--read); font-style: italic; font-size: clamp(18px, 2vw, 21px); line-height: 1.55; color: var(--ink); max-width: 58ch; }
.hero-blurb { color: var(--muted); font-size: 17px; max-width: 58ch; }
.hero-meta { color: var(--faint); font-size: 14px; }
.hero .row { gap: 12px; margin-top: 4px; }
.hero-empty { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  .hero { grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: start; }
  .hero h2 { font-size: 25px; }
  .hero-quote { font-size: 16px; grid-column: 1 / -1; }
  .hero-body { display: contents; }
  .hero-body > .kicker { grid-column: 2; grid-row: 1; align-self: end; }
  .hero-body > h2 { grid-column: 2; grid-row: 2; }
  .hero-body > .hero-meta { grid-column: 2; grid-row: 3; align-self: start; }
  .hero-body > .hero-quote, .hero-body > .hero-blurb { grid-column: 1 / -1; grid-row: 4; }
  .hero-body > .row { grid-column: 1 / -1; grid-row: 5; }
  .hero-cover { grid-column: 1; grid-row: 1 / span 3; }
}

/* Continue reading: wide cards with progress */
.cont-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cont-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; align-items: center; background: var(--surface); border-radius: 12px; padding: 12px 14px 12px 12px; color: var(--ink); box-shadow: 0 1px 2px rgba(23,27,38,.04); border: 1px solid var(--line); }
.cont-card:hover { text-decoration: none; border-color: var(--surface-3); }
.cont-card:hover .t { color: var(--accent); }
.cont-card .cover { padding: 6px; }
.cont-card .cover .cv-g, .cont-card .cover .cv-a, .cont-card .cover .cv-t, .cont-card .audio-badge, .cont-card .adult-badge { display: none; }
.cont-card .new-badge { left: 50%; transform: translateX(-50%); top: auto; bottom: 6px; font-size: 8.5px; padding: 1px 5px; }
.cont-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cont-body .t { font-weight: 600; font-size: 15px; line-height: 1.3; }
.cont-body .s { font-size: 13px; color: var(--muted); }
.cont-body .progress-mini { margin-top: 6px; height: 4px; }
.new-text { color: var(--amber); font-weight: 700; }

/* First lines */
.first-lines { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px 28px; }
.first-line { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 4px 18px; border-left: 2px solid var(--accent); color: var(--ink); }
.first-line:hover { text-decoration: none; }
.first-line:hover q { color: var(--accent); }
.first-line q { font-family: var(--read); font-size: 18px; line-height: 1.5; quotes: "“" "”"; transition: color .15s; }
.first-line span { font-size: 13px; color: var(--muted); }

/* Writers to follow */
.writer-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 28px; }
.writer-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.writer-chip .who { min-width: 0; }
.writer-chip .sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30ch; }

/* Gentle prompts */
.prompt-strip { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 15px; }
.prompt-strip:hover { text-decoration: none; }
.write-band { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding: 32px; border-radius: 18px; background: var(--ink); color: var(--bg); }
.write-band h2 { font-size: clamp(24px, 3vw, 32px); }
.write-band p { color: color-mix(in srgb, var(--bg) 78%, transparent); max-width: 56ch; margin-top: 8px; }
.write-band .btn.pri { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.write-band .btn.pri:hover { background: var(--surface-2); }
@media (max-width: 560px) { .write-band { padding: 24px 20px; } }

/* Challenge card sits in the flow now: lighter */
.challenge-card.big { background: var(--surface); border-color: var(--line); padding: 22px 24px; }

/* Story page */
.story-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.facts { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.facts div { display: flex; flex-direction: column; gap: 1px; }
.facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.facts dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.story-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.story-main h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.06; }
.kicker-row { gap: 12px; }
.blurb { font-size: 18px; line-height: 1.55; color: var(--muted); white-space: pre-line; max-width: 62ch; }
.warn-line { font-size: 14px; color: var(--mature); }
.warn-line b { font-weight: 600; }
.actions-row { gap: 10px; }
.opening { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 30px 22px; color: var(--ink); margin-top: 6px; }
.opening:hover { text-decoration: none; border-color: var(--surface-3); }
.opening:hover .opening-more { text-decoration: underline; }
.opening-k { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.opening-text { display: flex; flex-direction: column; gap: .9em; font-family: var(--read); font-size: 19px; line-height: 1.7; max-height: 15em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.opening-more { color: var(--accent); font-weight: 600; font-size: 14.5px; }
@media (max-width: 560px) { .opening { padding: 20px 18px 18px; } .opening-text { font-size: 17.5px; } }
.h-sm { font-size: 22px; }
.tags-quiet .chip { font-size: 12.5px; padding: 4px 11px; }

/* Reader: calmer header and end-of-chapter card */
.reader-crumb { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13.5px; color: var(--faint); }
.reader-crumb a { color: var(--muted); font-weight: 600; }
.reader-crumb span + span::before, .reader-crumb a + span::before { content: "·"; margin-right: 14px; color: var(--faint); }
.reader-crumb .tag::before { content: none !important; }
.reader-title { font-size: clamp(30px, 4.4vw, 42px); }
.reader-by { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.reader-by .who .name { font-size: 14px; }
.reader-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
@media (max-width: 560px) { .reader-tools .btn.sm { padding-inline: 10px; } }
.endcard { margin-top: 28px; display: flex; flex-direction: column; gap: 20px; background: var(--surface-2); border-radius: 18px; padding: 24px 26px 26px; }
.end-mark { text-align: center; color: var(--faint); font-size: 18px; letter-spacing: .3em; }
.end-next { display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap; }
.end-next > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.end-next b { font-family: var(--display); font-weight: 400; font-size: clamp(20px, 2.6vw, 24px); line-height: 1.2; }
.end-links { display: flex; gap: 8px 22px; flex-wrap: wrap; font-size: 14px; font-weight: 600; border-top: 1px solid var(--line); padding-top: 14px; }
.end-links a { color: var(--muted); }
.end-more { display: flex; flex-direction: column; gap: 12px; }
.end-shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .endcard { padding: 20px 16px; margin-inline: -4px; } .end-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } .end-shelf > :nth-child(4) { display: none; } .end-next .btn { width: 100%; } }
.reader-shell .rail-btn { background: var(--surface); }

@media (max-width: 760px) {
  .story-side { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 18px; align-items: end; }
  .top-actions .btn.sm { padding: 6px 11px; }
  .top-actions { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { .cover { transition: none; } }

/* Free narration player (female / male readings) */
.voice-player { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface-2); border-radius: 16px; padding: 12px 14px; }
.vp-play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 6px 16px -8px var(--accent); }
.vp-play svg { width: 20px; height: 20px; }
.vp-play .i-pause, .voice-player.playing .vp-play .i-play { display: none; }
.voice-player.playing .vp-play .i-pause { display: block; }
.vp-mid { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 4px; }
.vp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; }
.vp-top b { font-weight: 600; }
.vp-time { color: var(--faint); font-size: 12.5px; }
.vp-mid input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.vp-opts { display: flex; align-items: center; gap: 8px; }
.vp-opts select { width: auto; padding: 5px 8px; font-size: 13px; border-radius: 8px; background: var(--surface); }
.vp-opts #vp-voice { max-width: 240px; }
.vp-note { flex-basis: 100%; font-size: 13.5px; color: var(--muted); margin: 0; }
@media (max-width: 560px) { .vp-opts { width: 100%; } .vp-opts #vp-voice { flex: 1; max-width: none; min-width: 0; } }
