/* LekhakAI. Uses the site's tokens (site.css): dark chrome, marigold accent. Writing and reading happen on
   warm paper, so a book feels like a book. */
:root {
  --paper: #FBF8F2; --paper-2: #F3EEE4; --ink: #1F1B16; --ink-2: #5E574D; --rule: #E3DBCD;
  --sepia: #F4ECDD; --sepia-ink: #3B2F22; --night: #17171A; --night-ink: #D9D5CD;
  --r-lg: 14px; --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 28px rgba(0,0,0,.28);
  --book-serif: "Noto Serif", "Noto Serif Devanagari", Georgia, serif;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.center { text-align: center; justify-content: center; }
.opt { color: var(--muted); font-weight: 400; font-size: .85em; }
.err { color: var(--err); font-size: .92rem; min-height: 1px; }
.err:empty { display: none; }
.warn-text { color: var(--marigold); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
body.reading .site-footer { display: none; }

/* ---------- app bar ---------- */
.lk-bar { position: sticky; top: 4.5rem; z-index: 35; border-bottom: 1px solid var(--line); background: rgba(21, 21, 22, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.lk-bar__inner { display: flex; align-items: center; gap: 1.4rem; min-height: 3.4rem; }
.lk-brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-stretch: 85%; font-size: 1.12rem; text-decoration: none; }
.lk-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--marigold); color: var(--marigold-ink); font-family: var(--book-serif); font-size: 1rem; font-weight: 700; }
.lk-nav { display: flex; align-items: center; gap: 1.2rem; margin-right: auto; }
.lk-nav a, .lk-nav button { position: relative; padding: .35rem 0; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 500; font-size: .95rem; text-decoration: none; cursor: pointer; }
.lk-nav a:hover, .lk-nav button:hover, .lk-nav [aria-current] { color: var(--bone); }
.lk-nav [aria-current]::after { content: ""; position: absolute; inset: auto 0 -.62rem 0; height: 2px; border-radius: 2px; background: var(--marigold); }
.lk-more-wrap { position: relative; }
.lk-lang { padding: .3rem .7rem; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--bone); font: inherit; font-size: .85rem; cursor: pointer; }
.lk-lang:hover { border-color: var(--bone); }
.badge { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; margin-left: .3rem; padding: 0 .3rem; border-radius: 999px; background: var(--marigold); color: var(--marigold-ink); font-size: .7rem; font-weight: 700; vertical-align: 1px; }
.lk-main { min-height: 60vh; padding-block: clamp(1.4rem, 3.5vw, 2.6rem) 2rem; outline: none; }

.lk-tabbar { display: none; }
@media (max-width: 860px) {
  .lk-nav, .lk-new { display: none; }
  .lk-bar__inner { justify-content: space-between; }
  .lk-main { padding-bottom: 6.5rem; }
  .site-footer { display: none; }
  .lk-tabbar { position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); padding: .3rem .2rem calc(.35rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(14, 14, 15, .96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .lk-tabbar a { position: relative; display: grid; justify-items: center; gap: .12rem; padding: .35rem .1rem; color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none; text-align: center; }
  .lk-tabbar a[aria-current] { color: var(--marigold); }
  .lk-tabbar .badge { position: absolute; top: .1rem; right: 22%; margin: 0; }
  .lk-tabbar__new .ic { background: var(--marigold); color: var(--marigold-ink); border-radius: 50%; }
}
.ic { display: grid; place-items: center; width: 26px; height: 26px; }
.ic::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.lk-tabbar__new .ic::before { width: 16px; height: 16px; }
.ic--home { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11 12 3l9 8'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3C/svg%3E"); }
.ic--books { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20V3H6.5A2.5 2.5 0 0 0 4 5.5z'/%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 0 6.5 22H20v-5'/%3E%3C/svg%3E"); }
.ic--plus { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ic--library { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h4v16H4zM10 4h4v16h-4z'/%3E%3Cpath d='m16 5 3.5-1 2.5 15.5-3.5 1z'/%3E%3C/svg%3E"); }
.ic--inbox { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 1 0-12 0c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.7 21a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E"); }

/* ---------- basics ---------- */
.btn--lg { padding: .95rem 1.7rem; font-size: 1.05rem; }
.btn--danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn--danger:hover:not(:disabled) { background: var(--err); color: var(--black); }
.btn--icon { width: 2.8rem; padding-inline: 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--marigold); font: inherit; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.lk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; align-items: end; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.2rem; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.eyebrow { color: var(--marigold); font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lede { color: var(--muted); font-size: 1.12rem; max-width: 60ch; }
.page-head { display: grid; gap: .45rem; margin-bottom: 1.6rem; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
.page-head--row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.back { color: var(--muted); font-size: .92rem; text-decoration: none; }
.back:hover { color: var(--bone); }
.block { margin-top: clamp(2.2rem, 5vw, 3.4rem); }
.block > h2, .block__head h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); }
.block > h2 { margin-bottom: 1rem; }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.block__head a { color: var(--marigold); font-weight: 600; font-size: .92rem; text-decoration: none; }

.panel { display: grid; gap: .9rem; margin-bottom: 1.2rem; padding: clamp(1.1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--charcoal); }
.panel > h2 { font-size: 1.35rem; }
.panel summary { cursor: pointer; font-weight: 600; }
details.panel[open] summary { margin-bottom: .4rem; }
details.panel > .panel { margin: 0; padding: 0; border: 0; }
.panel.danger { border-color: #4A2A22; }
.center-panel { justify-items: center; text-align: center; padding-block: 3rem; }
.gate { max-width: 40rem; margin: 2rem auto; }

/* forms */
.form label:not(.check):not(.opt-pill):not(.swatch):not(.pkg):not(.radio-card):not(.style-pick):not(.btn):not(.drop) { display: block; margin-top: .2rem; font-weight: 600; font-size: .92rem; }
.form { gap: .55rem; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--graphite); color: var(--bone); font: inherit; font-size: 1rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--marigold); box-shadow: 0 0 0 3px rgba(245, 165, 36, .18); }
textarea { resize: vertical; line-height: 1.55; }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type=range] { width: 100%; accent-color: var(--marigold); }
.fieldset { margin: .3rem 0 0; padding: 0; border: 0; min-width: 0; }
.fieldset legend { margin-bottom: .45rem; padding: 0; font-weight: 600; font-size: .92rem; }
.check { display: inline-flex; align-items: flex-start; gap: .55rem; font-size: .95rem; cursor: pointer; }
.check input { flex: none; width: 1.1rem; height: 1.1rem; margin-top: .2rem; accent-color: var(--marigold); }
output { color: var(--marigold); font-weight: 600; margin-left: .3rem; }
.pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.opt-pill { position: relative; cursor: pointer; }
.opt-pill input { position: absolute; opacity: 0; }
.opt-pill span { display: inline-block; padding: .42rem .9rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .9rem; transition: border-color .15s, background .15s; }
.opt-pill input:checked + span { border-color: var(--marigold); background: rgba(245,165,36,.14); color: var(--bone); }
.opt-pill input:focus-visible + span { outline: 3px solid var(--marigold); outline-offset: 2px; }
.toggles { display: grid; gap: .45rem; margin: .4rem 0; }
.radios { display: grid; gap: .45rem; margin: .4rem 0; }
.radios--cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: .7rem; }
.radio-card { position: relative; display: grid; gap: .2rem; padding: .9rem 1rem .9rem 2.6rem; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.radio-card input { position: absolute; left: 1rem; top: 1.05rem; accent-color: var(--marigold); }
.radio-card:has(input:checked) { border-color: var(--marigold); background: rgba(245,165,36,.07); }

/* packages */
.pkgs { display: grid; gap: .5rem; }
.pkg { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .1rem .8rem; padding: .75rem 1rem; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.pkg input { grid-row: span 2; accent-color: var(--marigold); width: 1.1rem; height: 1.1rem; }
.pkg__name { font-weight: 700; }
.pkg__pages { grid-column: 2; color: var(--muted); font-size: .88rem; }
.pkg__price { grid-row: 1 / span 2; grid-column: 3; font-weight: 700; font-size: 1.1rem; }
.pkg:has(input:checked) { border-color: var(--marigold); background: rgba(245,165,36,.07); }

/* notices, tags, chips, lists */
.notice--warn { background: #33270F; color: #F4D9A6; }
.notice--err { background: #3A1D16; color: #FFC9B8; }
.notice--ok { background: #123331; color: var(--ok); }
.notice a { color: inherit; font-weight: 700; }
.chips { display: flex; gap: .45rem; margin-bottom: 1.4rem; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: .38rem .85rem; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: .87rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chip:hover { color: var(--bone); }
.chip[aria-pressed="true"] { border-color: var(--marigold); background: var(--marigold); color: var(--marigold-ink); }
.chip--pkg { border-color: rgba(245,165,36,.5); color: var(--marigold); }
.seg { display: inline-flex; gap: .25rem; margin-bottom: 1.2rem; padding: .25rem; border-radius: 999px; background: var(--graphite); }
.seg a, .seg__btn { padding: .45rem 1rem; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: .92rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.seg [aria-selected="true"], .seg [aria-pressed="true"] { background: var(--bone); color: var(--black); }
.list { display: grid; gap: .6rem; }
.list__item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--charcoal); }
.list__item--new { border-color: rgba(245,165,36,.45); }
.list__main { display: grid; gap: .3rem; min-width: 0; flex: 1 1 22rem; text-decoration: none; }
.list__main p { color: var(--bone); }
.list__top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.list__acts { display: flex; flex-wrap: wrap; gap: .4rem; }
.ticks { display: grid; gap: .5rem; }
.ticks li { position: relative; padding-left: 1.6rem; color: var(--muted); }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

.empty { display: grid; justify-items: center; gap: .5rem; padding: 3rem 1rem; text-align: center; }
.empty__art { width: 74px; height: 74px; margin-bottom: .5rem; border-radius: 18px; background: linear-gradient(135deg, var(--graphite), var(--charcoal)); box-shadow: inset 0 0 0 1px var(--line-strong); position: relative; }
.empty__art::after { content: ""; position: absolute; inset: 20px 24px; border-radius: 3px 6px 6px 3px; background: var(--marigold); opacity: .85; box-shadow: -6px 0 0 -2px var(--teal); }
.empty h3 { font-size: 1.3rem; }
.empty .lk-actions { margin-top: .6rem; }

.loading { display: flex; align-items: center; justify-content: center; gap: .7rem; padding: 3rem 0; color: var(--muted); }
.spinner { display: inline-block; flex: none; width: 1.1rem; height: 1.1rem; border: 2.5px solid var(--line-strong); border-top-color: var(--marigold); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner--lg { width: 2.4rem; height: 2.4rem; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 8px; border-radius: 999px; background: var(--graphite); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--marigold); transition: width .25s; }
.bar--sm { flex: 0 0 120px; height: 6px; }

/* toasts, dialogs, menus */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); display: grid; gap: .5rem; width: min(92vw, 28rem); transform: translateX(-50%); pointer-events: none; }
@media (min-width: 861px) { .toasts { bottom: 1.6rem; } }
.toast { padding: .8rem 1rem; border-radius: 12px; background: var(--bone); color: var(--black); font-size: .94rem; font-weight: 500; box-shadow: var(--shadow); animation: up .2s ease-out; transition: opacity .4s, transform .4s; }
.toast--ok { background: #CFF3EF; }
.toast--err { background: #FFD8CC; }
.toast--out { opacity: 0; transform: translateY(6px); }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }
.lk-dialog { width: min(520px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 1.4rem 1.4rem 1.5rem; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--charcoal); color: var(--bone); box-shadow: var(--shadow); }
.lk-dialog--wide { width: min(820px, calc(100vw - 2rem)); }
.lk-dialog::backdrop { background: rgba(0,0,0,.66); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.lk-dialog > * + * { margin-top: .8rem; }
.lk-dialog h2 { font-size: 1.4rem; padding-right: 2rem; }
.lk-dialog label { display: block; font-weight: 600; font-size: .92rem; }
.lk-dialog__x { position: absolute; top: .7rem; right: .8rem; margin: 0; border: 0; background: none; color: var(--muted); font-size: 1.7rem; line-height: 1; cursor: pointer; }
.lk-dialog__x:hover { color: var(--bone); }
.menu { position: absolute; z-index: 50; display: grid; min-width: 220px; margin-top: .4rem; padding: .35rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--graphite); box-shadow: var(--shadow); }
.menu--right { right: 0; }
.menu a, .menu button { display: grid; gap: .1rem; padding: .55rem .75rem; border: 0; border-radius: 8px; background: none; color: var(--bone); font: inherit; font-size: .93rem; text-align: left; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover:not(:disabled) { background: #2A2A2E; }
.menu button:disabled { color: var(--muted); cursor: default; }
.menu .fine { font-size: .78rem; }

/* ---------- covers ---------- */
.cover { --c: #7A2E1D; position: relative; display: flex; flex-direction: column; aspect-ratio: 2 / 3; width: 100%; padding: 0; overflow: hidden; border-radius: 4px 8px 8px 4px; background: var(--c); color: #fff; box-shadow: var(--shadow), inset 4px 0 0 rgba(0,0,0,.18), inset 5px 0 0 rgba(255,255,255,.08); font-family: var(--book-serif); text-align: center; container-type: inline-size; }
.cover__title { margin-top: 30cqw; font-size: 11cqw; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cover__sub { margin-top: 5cqw; font-family: var(--font); font-size: 5cqw; opacity: .85; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cover__author { margin-top: auto; margin-bottom: 11cqw; font-family: var(--font); font-size: 5.2cqw; font-weight: 600; opacity: .95; }
.cover--img { padding: 0; background: var(--graphite); }
.cover--img img { width: 100%; height: 100%; object-fit: cover; }
.cover--classic::before { content: ""; position: absolute; inset: 5cqw; border: .6cqw solid rgba(240,214,160,.85); outline: .3cqw solid rgba(240,214,160,.6); outline-offset: -2.5cqw; pointer-events: none; }
.cover--sunrise { background: linear-gradient(180deg, color-mix(in srgb, var(--c), #fff 45%), color-mix(in srgb, var(--c), #000 35%)); }
.cover--sunrise::after { content: ""; position: absolute; left: 50%; bottom: -12%; width: 84%; aspect-ratio: 1; border-radius: 50%; transform: translateX(-50%); background: rgba(255,255,255,.2); box-shadow: 0 0 0 14cqw rgba(255,255,255,.08); }
.cover--sunrise .cover__title { margin-top: 18cqw; }
.cover--ink { background: #141416; text-align: left; font-family: var(--font); }
.cover--ink::before { content: ""; position: absolute; inset: 0 0 auto; height: 6%; background: var(--c); }
.cover--ink .cover__title { margin-top: 52cqw; font-stretch: 80%; }
.cover--forest { background: repeating-linear-gradient(-45deg, var(--c) 0 5cqw, color-mix(in srgb, var(--c), #fff 8%) 5cqw 7cqw); }
.cover--forest .cover__title { padding: 6cqw 0; background: rgba(0,0,0,.28); margin-inline: -10cqw; padding-inline: 10cqw; }
.cover--rose { background: color-mix(in srgb, var(--c), #fff 82%); color: color-mix(in srgb, var(--c), #000 55%); }
.cover--rose::before { content: ""; position: absolute; top: -6%; left: -8%; width: 34%; aspect-ratio: 1; border-radius: 50%; background: color-mix(in srgb, var(--c), #fff 55%); box-shadow: 70cqw 10cqw 0 -6cqw color-mix(in srgb, var(--c), #fff 55%), 60cqw 125cqw 0 4cqw color-mix(in srgb, var(--c), #fff 55%); }
.cover--minimal { background: #F6F2EA; color: #1A1A1A; text-align: left; }
.cover--minimal::before { content: ""; position: absolute; top: 8cqw; left: 8cqw; width: 12cqw; height: 12cqw; background: var(--c); }
.cover--minimal .cover__title { margin-top: 46cqw; }
.cover > span { position: relative; z-index: 1; margin-inline: 10cqw; }
.cover--xs { width: 46px; border-radius: 2px 4px 4px 2px; }
.cover--sm { width: 64px; flex: none; }
.cover--md { width: min(190px, 42vw); flex: none; }
.cover--lg { width: min(260px, 70vw); }
/* The home page's book stack. On hover (or a tap on phones) the side books fan out, the front book lifts,
   and its cover swings open on the spine to show the pages inside. */
.hero__books { perspective: 1600px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hb { position: absolute; width: 46%; transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.hb--1 { left: 4%; top: 12%; transform: rotate(-8deg); }
.hb--2 { left: 28%; top: 2%; z-index: 2; transform: rotate(2deg); transform-style: preserve-3d; }
.hb--3 { right: 2%; top: 16%; transform: rotate(9deg); }
.hb--2 .cover { transform-origin: left center; transition: transform .8s cubic-bezier(.2, .8, .2, 1), box-shadow .8s; }
.hb__pages { position: absolute; inset: 1.5% 0 1.5% 1%; border-radius: 3px 7px 7px 3px; background: var(--paper);
  box-shadow: 2px 2px 0 #ECE4D5, 4px 4px 0 #E1D8C7, var(--shadow); }
/* Lines of text on the first page, and the shadow the open cover casts on it. */
.hb__pages::before { content: ""; position: absolute; inset: 16% 14% 18% 20%; background: repeating-linear-gradient(to bottom, rgba(31, 27, 22, .2) 0 2px, transparent 2px 13px); }
.hb__pages::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 30%; border-radius: 3px 0 0 3px; background: linear-gradient(to right, rgba(0, 0, 0, .28), transparent); }
@media (hover: hover) {
  .hero__books:hover .hb--1 { transform: translate(-16%, 5%) rotate(-17deg); }
  .hero__books:hover .hb--3 { transform: translate(16%, 6%) rotate(18deg); }
  .hero__books:hover .hb--2 { transform: translateY(-6%) rotate(-1deg) scale(1.04); }
  .hero__books:hover .hb--2 .cover { transform: perspective(1400px) rotateY(-62deg); box-shadow: 18px 10px 30px rgba(0, 0, 0, .45); }
}
.hero__books.is-open .hb--1 { transform: translate(-16%, 5%) rotate(-17deg); }
.hero__books.is-open .hb--3 { transform: translate(16%, 6%) rotate(18deg); }
.hero__books.is-open .hb--2 { transform: translateY(-6%) rotate(-1deg) scale(1.04); }
.hero__books.is-open .hb--2 .cover { transform: perspective(1400px) rotateY(-62deg); box-shadow: 18px 10px 30px rgba(0, 0, 0, .45); }
/* The resting cover carries the same perspective, so the swing animates smoothly from flat. */
.hb--2 .cover { transform: perspective(1400px) rotateY(0deg); }
/* Small screens: a smaller fan that stays on the screen. */
@media (max-width: 860px) {
  .hero { overflow-x: clip; }
  .hero__books.is-open .hb--1 { transform: translate(-8%, 4%) rotate(-14deg); }
  .hero__books.is-open .hb--3 { transform: translate(8%, 5%) rotate(15deg); }
}

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(1.5rem, 5vw, 4rem); padding-block: clamp(1rem, 4vw, 2.5rem); }
.hero__text { display: grid; gap: 1.1rem; }
.hero h1 { font-size: clamp(2.6rem, 6.5vw, 4.6rem); }
.hero__books { position: relative; aspect-ratio: 1 / .95; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero__books { max-width: 420px; width: 100%; margin-inline: auto; order: -1; aspect-ratio: 1 / .72; } }

.methods { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
.methods--big { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 1rem; }
@media (max-width: 1000px) { .methods { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); } }
.method { display: grid; align-content: start; gap: .45rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--charcoal); text-decoration: none; transition: border-color .15s, transform .15s; }
.method:hover { border-color: var(--marigold); transform: translateY(-2px); }
.method b { font-size: 1.05rem; }
.method > span:last-child { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.methods--big .method { padding: 1.5rem; }
.method__icon { width: 42px; height: 42px; margin-bottom: .3rem; border-radius: 12px; background: var(--graphite); position: relative; }
.method__icon::after { content: ""; position: absolute; inset: 10px; background: var(--marigold); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.method__icon--ai { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E"); }
.method__icon--type { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E"); }
.method__icon--voice { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='9' y='2' width='6' height='12' rx='3'/%3E%3Cpath d='M5 10a7 7 0 0 0 14 0M12 17v5'/%3E%3C/svg%3E"); }
.method__icon--photos { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M3 7h4l2-3h6l2 3h4v13H3z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E"); }
.method__icon--import { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H6v18h12V7z'/%3E%3Cpath d='M14 3v4h4M12 11v6M9 14l3 3 3-3'/%3E%3C/svg%3E"); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: clamp(1.2rem, 3vw, 2rem); border-radius: var(--r-lg); background: linear-gradient(135deg, #1A1714, var(--charcoal)); border: 1px solid var(--line); }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr 1fr; } }
.step { display: grid; gap: .35rem; }
.step__n { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 1.5px solid var(--marigold); color: var(--marigold); font-weight: 700; font-size: .9rem; }
.step p { color: var(--muted); font-size: .92rem; }
.pricing { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1.5rem 3rem; align-items: center; }
@media (max-width: 860px) { .pricing { grid-template-columns: 1fr; } }
.pricing h2 { margin-bottom: .4rem; }
.prices { display: grid; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--charcoal); }
.prices li { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; padding: .85rem 1.1rem; border-top: 1px solid var(--line); }
.prices li:first-child { border-top: 0; }
.prices li span { color: var(--muted); }
.prices .price { min-width: 4.5rem; text-align: right; color: var(--bone); font-weight: 700; }

/* ---------- book cards ---------- */
.grid--books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 168px), 1fr)); gap: 1.6rem 1.1rem; }
.bcard { display: grid; align-content: start; gap: .75rem; text-decoration: none; }
.bcard .cover { transition: transform .2s; }
.bcard:hover .cover { transform: translateY(-4px); }
.bcard__body { display: grid; gap: .2rem; min-width: 0; }
.bcard__title { font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard__by { color: var(--muted); font-size: .88rem; }
.bcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; color: var(--muted); font-size: .8rem; }
.libbar { display: grid; grid-template-columns: 1fr auto auto; gap: .6rem; margin-bottom: .9rem; }
@media (max-width: 640px) { .libbar { grid-template-columns: 1fr 1fr; } .libbar input { grid-column: 1 / -1; } }
.count { margin-bottom: 1rem; font-size: .9rem; }

/* ---------- book workspace ---------- */
.bk-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.bk-head__main { display: grid; gap: .45rem; min-width: 0; }
.bk-head h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-stretch: 85%; line-height: 1.05; overflow-wrap: anywhere; }
.bk-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; color: var(--muted); font-size: .88rem; }
.bk-head__meta .chip { padding: .2rem .65rem; font-size: .8rem; }
.bk-head__meta a.tag { text-decoration: none; }
.bk-tabs { display: flex; gap: .2rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.bk-tabs::-webkit-scrollbar { display: none; }
.bk-tabs a { flex: none; padding: .65rem .95rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: .95rem; text-decoration: none; }
.bk-tabs a:hover { color: var(--bone); }
.bk-tabs a[aria-current] { color: var(--bone); border-bottom-color: var(--marigold); }
.jobs { display: grid; gap: .5rem; margin-bottom: .8rem; }
.jobs:empty { display: none; }
.jobbar { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; padding: .75rem 1rem; border-radius: 12px; background: #2A2213; color: #F4D9A6; font-size: .93rem; }
.jobbar--err { background: #3A1D16; color: #FFC9B8; justify-content: space-between; }
.dot { flex: none; width: .55rem; height: .55rem; border-radius: 50%; background: var(--line-strong); }
.dot--ok { background: var(--ok); }
.dot--warn { background: var(--marigold); }

.write { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
@media (max-width: 900px) { .write { grid-template-columns: 1fr; } }
.write__side { position: sticky; top: 9rem; display: grid; gap: .6rem; padding: .9rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--charcoal); max-height: calc(100vh - 10rem); overflow-y: auto; }
@media (max-width: 900px) { .write__side { position: static; max-height: 15rem; } }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.side-head h2 { font-size: 1rem; }
.chlist { display: grid; gap: .15rem; counter-reset: none; }
.ch { display: flex; align-items: center; gap: .2rem; border-radius: 9px; }
.ch.is-open { background: var(--graphite); }
.ch__btn { display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0; padding: .5rem .55rem; border: 0; background: none; color: var(--muted); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.ch.is-open .ch__btn, .ch__btn:hover { color: var(--bone); }
.ch__n { flex: none; width: 1.4rem; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.ch__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch__move { display: flex; padding-right: .3rem; }
.ch__move button { width: 1.6rem; height: 1.6rem; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.ch__move button:hover:not(:disabled) { background: #2F2F33; color: var(--bone); }
.ch__move button:disabled { opacity: .3; }
.wide { width: 100%; }
.write__main { display: grid; gap: .7rem; min-width: 0; }
.ch-title { padding: .3rem 0 !important; border: 0 !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; color: var(--bone) !important; font-family: var(--book-serif) !important; font-size: clamp(1.5rem, 3.5vw, 2rem) !important; font-weight: 700; }
.ch-title:focus { box-shadow: inset 0 -2px 0 var(--marigold) !important; }
.toolbar { position: sticky; top: 7.95rem; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .35rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(29, 29, 31, .97); }
.toolbar > button, .tool { min-width: 2.2rem; height: 2.2rem; padding: 0 .5rem; border: 0; border-radius: 8px; background: none; color: var(--bone); font: inherit; font-size: .95rem; cursor: pointer; }
.toolbar > button:hover, .tool:hover { background: #2F2F33; }
.tool-sep { width: 1px; height: 1.4rem; margin: 0 .25rem; background: var(--line-strong); }
.aimenu { position: relative; }
.ai-btn { height: 2.2rem; padding: 0 .85rem; border: 0; border-radius: 8px; background: rgba(245,165,36,.15); color: var(--marigold); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.ai-btn:hover { background: rgba(245,165,36,.25); }
.unsure { display: inline-flex; align-items: center; gap: .3rem; margin-left: .3rem; padding: .15rem .3rem .15rem .6rem; border-radius: 8px; background: #3A2C0E; color: var(--marigold); font-size: .82rem; font-weight: 600; }
.unsure button { padding: .2rem .5rem; border: 0; border-radius: 6px; background: rgba(245,165,36,.2); color: var(--marigold); font: inherit; font-size: .8rem; cursor: pointer; }
.save-state { margin-left: auto; padding-right: .5rem; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.save-state[data-state="offline"], .save-state[data-state="error"], .save-state[data-state="conflict"] { color: var(--err); }
.save-state[data-state="saved"]::before { content: "✓ "; color: var(--ok); }
.paper { padding: clamp(1.2rem, 5vw, 3.2rem) clamp(1rem, 6vw, 4rem); border-radius: 6px; background: var(--paper); box-shadow: var(--shadow); }
.editor { min-height: 55vh; outline: none; caret-color: #B45309; }
.editor.is-empty::before { content: attr(data-placeholder); position: absolute; color: #A89F92; pointer-events: none; }
.write__foot { display: flex; justify-content: space-between; align-items: center; }

/* book typography (editor, reader, previews) */
.book-text { color: var(--ink); font-family: var(--book-serif); font-size: var(--read-size, 1.15rem); line-height: 1.75; overflow-wrap: break-word; }
.book-text > * + * { margin-top: .95em; }
.book-text h2 { font-size: 1.35em; line-height: 1.3; margin-top: 1.6em; letter-spacing: 0; }
.book-text h3 { font-size: 1.12em; line-height: 1.35; margin-top: 1.3em; letter-spacing: 0; }
.book-text ul { list-style: disc; padding-left: 1.4em; }
.book-text ol { list-style: decimal; padding-left: 1.6em; }
.book-text li + li { margin-top: .3em; }
.book-text blockquote { margin-inline: 0; padding-left: 1.1em; border-left: 3px solid #D6C9B3; color: var(--ink-2); font-style: italic; }
.book-text mark, .book-text .unsure { padding: 0 .1em; border-radius: 3px; background: #FDE7A6; color: inherit; box-shadow: 0 2px 0 #E0A22B; }
.book-text--sm { font-size: .98rem; line-height: 1.6; }

.proposal { display: grid; gap: .7rem; padding: 1rem; border: 1px solid rgba(245,165,36,.45); border-radius: 12px; background: #1E1A12; }
.proposal__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; }
.proposal__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: .8rem; }
.proposal__cols > div { display: grid; gap: .3rem; }
.proposal__cols .book-text { max-height: 18rem; overflow: auto; padding: .9rem 1rem; border-radius: 8px; background: var(--paper); }
.proposal__new { box-shadow: inset 3px 0 0 var(--ok); }
.claims { padding: .8rem 1rem; border-radius: 10px; background: var(--graphite); font-size: .92rem; }
.claims summary { cursor: pointer; font-weight: 600; color: var(--marigold); }
.claims ul { margin-top: .5rem; padding-left: 1.2rem; list-style: disc; display: grid; gap: .3rem; color: var(--muted); }

/* outline */
.outline-edit { display: grid; gap: .6rem; }
.outline-edit li { display: grid; grid-template-columns: 2rem 1fr auto; gap: .6rem; align-items: start; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--black); }
.outline-edit .num { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--graphite); color: var(--marigold); font-weight: 700; font-size: .9rem; }
.outline-edit__fields { display: grid; gap: .45rem; }
.outline-edit__fields input { font-weight: 600; }
.outline-edit__acts { display: grid; gap: .2rem; }
.outline-edit__acts button { width: 2rem; height: 1.8rem; border: 0; border-radius: 6px; background: var(--graphite); color: var(--muted); cursor: pointer; }
.outline-edit__acts button:hover { color: var(--bone); }
.outline-done { display: grid; gap: .55rem; counter-reset: ch; }
.outline-done li { display: grid; grid-template-columns: auto 1fr; gap: .1rem .7rem; align-items: center; padding: .7rem .9rem; border-radius: 10px; background: var(--graphite); }
.outline-done a { font-weight: 600; text-decoration: none; }
.outline-done p { grid-column: 2; }

/* sources */
.source { display: grid; gap: .6rem; margin-bottom: .9rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--charcoal); }
.source__head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.source__title { flex: 1 1 14rem; width: auto !important; padding: .35rem .5rem !important; font-weight: 600; }
.source__text { min-height: 9rem; background: var(--paper) !important; color: var(--ink) !important; font-family: var(--book-serif) !important; border-color: var(--rule) !important; }
.recorder { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.4rem; padding: 1rem 1.2rem; border-radius: 14px; background: var(--graphite); }
.rec-btn { display: grid; place-items: center; width: 4rem; height: 4rem; border: 3px solid var(--bone); border-radius: 50%; background: none; cursor: pointer; }
.rec-btn span { width: 1.7rem; height: 1.7rem; border-radius: 50%; background: #E5484D; transition: all .2s; }
.recorder[data-state="recording"] .rec-btn span { width: 1.3rem; height: 1.3rem; border-radius: 4px; }
.recorder[data-state="recording"] .rec-btn { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); } 70% { box-shadow: 0 0 0 14px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }
.rec-info { display: grid; gap: .1rem; margin-right: auto; }
.rec-info .fine { font-variant-numeric: tabular-nums; font-size: 1rem; }
.transcript { position: relative; }
.transcript textarea { background: var(--paper); color: var(--ink); font-family: var(--book-serif); border-color: var(--rule); }
.interim { position: absolute; left: .9rem; right: .9rem; bottom: .6rem; color: #8B8376; font-style: italic; font-size: .95rem; pointer-events: none; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.page { position: relative; display: grid; gap: .4rem; justify-items: center; padding: .6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--graphite); }
.page__n { position: absolute; top: .4rem; left: .5rem; z-index: 1; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--black); font-size: .78rem; font-weight: 700; }
.page__img canvas { display: block; max-width: 100%; height: 150px; object-fit: contain; border-radius: 6px; background: #000; }
.page__acts { display: flex; gap: .2rem; }
.page__acts button { width: 1.9rem; height: 1.9rem; border: 0; border-radius: 6px; background: var(--charcoal); color: var(--bone); cursor: pointer; }
.page__acts button:disabled { opacity: .3; }
.drop { display: grid; justify-items: center; gap: .3rem; padding: 2.2rem 1rem; border: 2px dashed var(--line-strong); border-radius: 14px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.is-over { border-color: var(--marigold); background: rgba(245,165,36,.05); }
.drop.is-busy { opacity: .6; pointer-events: none; }

/* design */
.cover-studio { display: grid; grid-template-columns: minmax(160px, 260px) 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 640px) { .cover-studio { grid-template-columns: 1fr; justify-items: center; } }
.cover-canvas { width: 100%; max-width: 260px; height: auto; border-radius: 4px 8px 8px 4px; box-shadow: var(--shadow); }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .6rem; }
.style-pick { position: relative; display: grid; justify-items: center; gap: .3rem; padding: .5rem; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; font-size: .8rem; color: var(--muted); }
.style-pick input { position: absolute; opacity: 0; }
.style-pick:has(input:checked) { border-color: var(--marigold); color: var(--bone); }
.style-pick .cover__title { font-size: 26cqw; margin-top: 34cqw; }
.style-pick .cover__author, .style-pick .cover__sub { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: .45rem; }
.swatch { position: relative; width: 2rem; height: 2rem; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--black), 0 0 0 4px var(--marigold); }
.swatch:has(input:focus-visible) { outline: 3px solid var(--marigold); outline-offset: 3px; }
.swatch--custom { background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); }
.swatch--custom input { opacity: 0; width: 100%; height: 100%; }
.page-studio { display: grid; grid-template-columns: 1fr minmax(200px, 300px); gap: 1.5rem; align-items: start; }
@media (max-width: 760px) { .page-studio { grid-template-columns: 1fr; } }
.page-preview { position: sticky; top: 9rem; display: grid; gap: .5rem; }
.page-preview canvas { width: 100%; height: auto; border-radius: 3px; background: #fff; box-shadow: var(--shadow); }
.design { display: grid; }

/* finish */
.ready { display: grid; grid-template-columns: auto 1fr; gap: clamp(1.2rem, 4vw, 3rem); align-items: start; margin-bottom: 1.4rem; padding: clamp(1.2rem, 4vw, 2.2rem); border-radius: 18px; background: radial-gradient(120% 120% at 0% 0%, #2A2213 0%, var(--charcoal) 55%); border: 1px solid var(--line); }
@media (max-width: 760px) { .ready { grid-template-columns: 1fr; justify-items: center; } .ready__main { justify-self: stretch; } }
.ready__main { display: grid; gap: .8rem; }
.ready h2 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
.checklist { display: grid; gap: .4rem; }
.checklist li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .95rem; }
.checklist li::before { content: "✓"; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: #123331; color: var(--ok); font-size: .75rem; font-weight: 700; }
.checklist li.is-bad::before { content: "!"; background: #3A2C0E; color: var(--marigold); }
.checklist a { color: var(--marigold); font-weight: 600; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: .8rem; margin-top: .4rem; }
.act { position: relative; display: grid; align-content: start; gap: .55rem; padding: 1rem; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(14,14,15,.5); }
.act > b { font-size: 1rem; padding-right: 3rem; }
.act .free { position: absolute; top: .9rem; right: .9rem; padding: .1rem .5rem; border-radius: 999px; background: #123331; color: var(--ok); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.act .btn { justify-self: start; }
.issues { display: grid; gap: .6rem; }
.issue { display: grid; gap: .45rem; padding: .9rem 1rem; border-radius: 12px; background: var(--graphite); }
.diff { font-family: var(--book-serif); font-size: .95rem; }
.diff del { color: var(--err); text-decoration-thickness: 1.5px; }
.diff ins { color: var(--ok); text-decoration: none; background: rgba(95,211,200,.1); }
.version-preview { display: grid; gap: .6rem; max-height: 60vh; overflow: auto; padding: 1rem; border-radius: 8px; background: var(--paper); color: var(--ink); }
.version-preview h3 { color: var(--ink); font-family: var(--book-serif); }

/* ---------- reader ---------- */
.reader { --rbg: var(--paper); --rink: var(--ink); --rmut: var(--ink-2); --rline: var(--rule); margin-inline: calc(-1 * clamp(1rem, 4vw, 2.75rem)); padding: clamp(1.2rem, 4vw, 2.6rem) clamp(1rem, 4vw, 2.75rem) 3rem; background: var(--rbg); color: var(--rink); min-height: 80vh; }
.reader.theme-sepia { --rbg: var(--sepia); --rink: var(--sepia-ink); --rmut: #75644F; --rline: #E0D2B9; }
.reader.theme-dark { --rbg: var(--night); --rink: var(--night-ink); --rmut: #8F8A80; --rline: #2C2C30; }
.reader .book-text { color: var(--rink); }
.reader.theme-dark .book-text mark { background: #5A4710; box-shadow: none; }
.reader.theme-dark .book-text blockquote { border-color: #3A3A3F; color: var(--rmut); }
.reader__head { display: flex; gap: clamp(1rem, 4vw, 2.4rem); align-items: flex-start; max-width: 960px; margin: 0 auto 2rem; }
@media (max-width: 640px) { .reader__head { flex-direction: column; align-items: center; text-align: center; } .reader__head .lk-actions { justify-content: center; } }
.reader__info { position: relative; display: grid; gap: .6rem; min-width: 0; }
.reader__info h1 { color: var(--rink); font-family: var(--book-serif); font-stretch: 100%; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.01em; line-height: 1.1; }
.reader__info .lede, .reader__by, .reader__blurb { color: var(--rmut); }
.reader__by a { color: var(--rink); font-weight: 600; }
.reader__blurb { font-family: var(--book-serif); font-size: 1.05rem; line-height: 1.6; }
.reader .btn--ghost { border-color: color-mix(in srgb, var(--rink), transparent 70%); color: var(--rink); }
.reader .btn--ghost:hover:not(:disabled) { background: var(--rink); color: var(--rbg); }
.reader .menu { top: 100%; }
.like.is-on { border-color: #E5484D !important; color: #E5484D !important; }
.reader__body { display: grid; grid-template-columns: 230px minmax(0, 680px); gap: clamp(1.4rem, 4vw, 3rem); justify-content: center; }
@media (max-width: 900px) { .reader__body { grid-template-columns: 1fr; } }
.reader__toc { position: sticky; top: 9rem; align-self: start; display: grid; gap: .6rem; font-size: .92rem; }
@media (max-width: 900px) { .reader__toc { position: static; padding: 1rem; border: 1px solid var(--rline); border-radius: 12px; } }
.reader__toc h2 { color: var(--rmut); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.reader__toc ol { display: grid; gap: .1rem; padding-left: 1.3rem; list-style: decimal; color: var(--rmut); }
.reader__toc a { display: block; padding: .3rem .4rem; border-radius: 6px; color: var(--rink); text-decoration: none; line-height: 1.35; }
.reader__toc a:hover { background: color-mix(in srgb, var(--rink), transparent 92%); }
.reader__toc a[aria-current] { background: color-mix(in srgb, var(--rink), transparent 88%); font-weight: 700; }
.marks { display: grid; gap: .2rem; }
.marks li { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.marks a { color: var(--rink); font-size: .88rem; }
.marks .x { border: 0; background: none; color: var(--rmut); cursor: pointer; font-size: 1.1rem; }
.reader .fine { color: var(--rmut); }
.reader__page { min-width: 0; }
.reader__tools { position: sticky; top: 8.2rem; z-index: 5; display: flex; align-items: center; gap: .15rem; width: fit-content; margin-bottom: 1rem; padding: .25rem; border: 1px solid var(--rline); border-radius: 12px; background: var(--rbg); }
.reader__tools .tool { color: var(--rink); }
.reader__tools .tool:hover { background: color-mix(in srgb, var(--rink), transparent 90%); }
.reader__tools .tool-sep { background: var(--rline); }
.tool--theme { width: 2.2rem; padding: 0; }
.tool--theme::before { content: ""; display: block; width: 1.2rem; height: 1.2rem; margin: auto; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.tool--light::before { background: #FBF8F2; }
.tool--sepia::before { background: #E9DCC2; }
.tool--dark::before { background: #222; box-shadow: inset 0 0 0 1px #555; }
.tool--theme[aria-pressed="true"]::before { box-shadow: 0 0 0 2px var(--rbg), 0 0 0 3.5px var(--marigold); }
.reader__progress { height: 3px; margin-bottom: 1.6rem; border-radius: 3px; background: var(--rline); }
.reader__progress span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--marigold); transition: width .4s; }
.reader__chtitle { color: var(--rink); font-family: var(--book-serif); font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: 0; margin-bottom: 1.4rem; }
.reader__nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--rline); }
.reader__note { margin-top: 1.4rem; text-align: center; }

/* author */
.author-head { display: flex; gap: 1.4rem; align-items: center; margin-bottom: 2rem; }
.author-head h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .3rem; }
.author-head > div { display: grid; gap: .45rem; justify-items: start; }
.avatar { display: grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--c); color: var(--black); font-weight: 800; }
.avatar--xl { width: 5.5rem; height: 5.5rem; font-size: 2.4rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
body.reading .lk-main { padding-top: 0; }

/* Hindi interface: the display font has no Devanagari, so Noto Sans Devanagari takes over, with room for matras. */
html[lang="hi"] { --font: "Bricolage Grotesque", "Noto Sans Devanagari", "Segoe UI", system-ui, sans-serif; }
html[lang="hi"] h1, html[lang="hi"] h2, html[lang="hi"] h3 { line-height: 1.3; letter-spacing: 0; font-stretch: 100%; }
html[lang="hi"] .eyebrow { letter-spacing: 0; }
@media (max-width: 600px) { .bk-tabs a { padding: .6rem .65rem; font-size: .9rem; } }
