:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #233229;
  background: #f9faf7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
a { color: inherit; }
button, input { font: inherit; }
button:disabled, input:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid #926c35; outline-offset: 3px; }
.container { width: min(1120px, calc(100% - 44px)); margin-inline: auto; }
.skip-link {
  position: absolute; top: -60px; left: 12px; z-index: 100;
  padding: 10px 16px; background: #fff; border-radius: 10px;
}
.skip-link:focus { top: 12px; }
.site-header {
  position: relative;
  border-bottom: 1px solid #e3e9e0;
  background: rgba(255, 255, 255, .95);
}
.site-header__inner {
  min-height: 80px; display: flex; align-items: center;
  justify-content: space-between; gap: 22px;
}
.brand {
  display: inline-flex; align-items: center; gap: 11px;
  color: #24412f; font-size: 21px; font-weight: 800;
  letter-spacing: -.04em; text-decoration: none;
}
.brand__symbol {
  display: grid; place-items: center; width: 35px; height: 35px;
  background: #2f6547; color: #fff; border-radius: 11px;
  font-size: 22px;
}
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 26px; }
.site-nav__link { font-weight: 600; font-size: 14px; text-decoration: none; }
.site-nav__link:hover, .text-link:hover { text-decoration: underline; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 12px; min-height: 48px; padding: 12px 22px;
  border: 1px solid #27613f; border-radius: 11px;
  background: #27613f; color: #fff; font-weight: 700;
  font-size: 14px; text-decoration: none; text-align: center;
  cursor: pointer; transition: background .15s ease;
}
.button:hover:not(:disabled) { background: #18472d; }
.button--small { min-height: 39px; padding: 9px 15px; }
.button--quiet {
  color: #275e3e; background: #fff;
  border-color: #d5e1d6;
}
.button--quiet:hover:not(:disabled) { background: #edf5ed; }
.button:disabled { opacity: .52; cursor: not-allowed; }
.hero {
  overflow: hidden;
  background: linear-gradient(115deg, #e9f2e8 0%, #f4f7ed 56%, #f8efe2 100%);
}
.hero__grid {
  display: grid; grid-template-columns: 1.1fr .9fr;
  align-items: center; gap: 50px; min-height: 460px; padding-block: 72px;
}
.eyebrow {
  margin: 0 0 14px; color: #4b7758;
  font-size: 12px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 570px; margin: 0; font-size: clamp(35px, 4.4vw, 58px);
  line-height: 1.1; letter-spacing: -.055em;
}
.hero__description {
  max-width: 480px; margin: 25px 0 28px;
  color: #5b695f; font-size: 17px; line-height: 1.65;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__illustration { position: relative; min-height: 290px; }
.book-stack {
  position: absolute; width: 210px; height: 268px;
  border-radius: 8px 21px 21px 8px;
  box-shadow: 0 23px 50px rgba(24, 56, 37, .14);
}
.book-stack--back {
  top: 0; left: 35%; transform: rotate(15deg);
  background: #c0d5c4; border-left: 13px solid #8faf98;
}
.book-stack--front {
  top: 27px; left: 16%; transform: rotate(-13deg);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 15px;
  background: linear-gradient(140deg, #326b4b, #214d37);
  border-left: 13px solid #193e2a;
}
.book-stack__ornament { color: #e2d4a0; font-size: 45px; }
.book-stack__line { display: block; width: 92px; height: 2px; background: #a7c3ac; }
.book-stack__line--short { width: 62px; }
.hero__glow {
  position: absolute; right: 2%; bottom: -36px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(221, 198, 144, .18);
}
.section { padding-block: 74px; }
.section__heading {
  display: flex; align-items: end; justify-content: space-between;
  flex-wrap: wrap; gap: 20px; margin-bottom: 28px;
}
.section h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.04em; }
.text-link { color: #2c6945; font-size: 14px; font-weight: 700; text-decoration: none; }
.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.book-card {
  overflow: hidden; min-width: 0; border: 1px solid #e2e8de;
  background: #fff; border-radius: 16px;
}
.book-card__cover {
  display: grid; place-items: center; height: 178px;
  background: linear-gradient(140deg, #e5eee0, #d9e3d6);
  color: #7da287; font-size: 68px; font-weight: 700;
}
.book-card__body { padding: 18px; }
.book-card__label { color: #617965; font-size: 12px; }
.book-card__title { margin: 8px 0 0; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.empty-state {
  grid-column: 1 / -1; padding: 36px;
  border: 1px dashed #cedccb; background: #fff;
  border-radius: 16px; color: #667568; line-height: 1.6;
}
.section--closing { padding-top: 0; }
.join-card {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 30px; padding: 36px 42px;
  border-radius: 20px; background: #e5eee3;
}
.join-card p { margin: 12px 0 0; color: #5d6f60; line-height: 1.6; }
.catalog-heading { min-height: 450px; }
.catalog-heading h1, .auth-card h1 {
  margin: 0; font-size: clamp(34px, 4vw, 46px); letter-spacing: -.04em;
}
.page-description { max-width: 620px; color: #657167; line-height: 1.7; }
.book-grid--catalog { margin-top: 35px; }
.auth-section { min-height: 65vh; background: #f4f7f2; }
.auth-card {
  width: min(440px, 100%); margin: 0 auto; padding: 34px;
  border: 1px solid #e0e8de; border-radius: 18px; background: #fff;
  box-shadow: 0 18px 42px rgba(34, 66, 43, .06);
}
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.auth-form label { font-size: 13px; font-weight: 700; }
/* AB-03: decoy has a real text input for automated form fillers, but is neither visible nor focusable. */
.auth-form__website-trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.auth-form input {
  width: 100%; height: 45px; margin-bottom: 12px; padding: 10px 12px;
  border: 1px solid #d2dcd1; border-radius: 9px; background: #f4f6f3;
}
.auth-form .button { width: 100%; margin-top: 8px; }
.auth-card__footer { margin: 22px 0 0; font-size: 13px; text-align: center; }
.auth-card__footer a { color: #23633f; font-weight: 700; }
.site-footer { border-top: 1px solid #e3e9e0; background: #fff; }
.site-footer__inner {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px;
  padding-block: 27px; color: #607064; font-size: 13px;
}
.site-footer a { color: #326b4b; }
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr .7fr; gap: 20px; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .container { width: min(100% - 28px, 1120px); }
  .site-header__inner { min-height: 75px; align-items: start; flex-direction: column; padding-block: 15px; }
  .site-nav { gap: 12px; }
  .hero__grid { grid-template-columns: 1fr; min-height: auto; padding-block: 55px; }
  .hero__illustration { display: none; }
  .hero__description { font-size: 16px; }
  .section { padding-block: 45px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .join-card { padding: 26px; }
}
@media (max-width: 420px) {
  .brand { font-size: 18px; }
  .book-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px; }
}

/* First read-only public chapter view: intentionally no client scripting. */
.book-card__title a { text-decoration: none; }
.book-card__title a:hover { text-decoration: underline; }
.book-detail h1, .reader-page h1 { font-size: clamp(28px, 4vw, 44px); overflow-wrap: anywhere; }
.chapter-list { display: grid; gap: 12px; padding-left: 24px; line-height: 1.7; }
.chapter-list a { color: #27613f; }
.reader-width { max-width: 820px; }
.chapter-content {
  margin-top: 30px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif; font-size: 19px;
  line-height: 1.85; background: #fff; border: 1px solid #e1e8e0;
  border-radius: 14px; padding: 28px; color: #29342e;
}

/* Narrow, keyboard-friendly author forms; the reader uses the same layout. */
.author-width { width: min(820px, 100%); margin-inline: auto; }
.author-form { max-width: 100%; }
.author-form textarea, .author-form select {
  width: 100%; padding: 12px; border: 1px solid #d2dcd1; border-radius: 9px;
  background: #fff; font: inherit; line-height: 1.6;
}
.author-form textarea { resize: vertical; min-height: 220px; white-space: pre-wrap; }
.author-chapters { padding-left: 25px; line-height: 2.25; overflow-wrap: anywhere; }

/* Private audience summaries retain readable labels on narrow screens. */
.audience-source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-block: 18px 28px; }
.audience-source-card { min-width: 0; }
.audience-source-card h4 { margin-top: 0; font-size: 18px; }
.audience-source-card dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.audience-source-card dt { overflow-wrap: anywhere; }
.audience-source-card dd { margin: 0; max-width: 140px; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 680px) { .audience-source-grid { grid-template-columns: minmax(0, 1fr); } }

/* Current public-book evidence, with paired periods and no page-wide overflow. */
.audience-books-width { width: min(1020px, 100%); margin-inline: auto; }
.audience-books-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-block: 24px; }
.audience-books-filters label { display: block; margin-bottom: 6px; }
.audience-books-filters input { width: 100%; min-width: 0; padding: 12px; border: 1px solid #d2dcd1; border-radius: 9px; background: #fff; font: inherit; line-height: 1.6; }
.audience-books-filter-actions { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 0; }
.audience-books-filters .audience-missing-label { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 15px; }
.audience-books-filters .audience-missing-label input { width: 18px; height: 18px; flex: 0 0 auto; padding: 0; }
.audience-groups-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.audience-book-row { margin-block: 20px; overflow-wrap: anywhere; }
.audience-book-row h3 { margin-top: 0; }
.audience-book-row .audience-source-grid { margin-bottom: 0; }
.audience-book-state { padding: 8px 12px; background: #eef4ec; border-radius: 8px; }
.audience-books-pagination { display: flex; flex-wrap: wrap; gap: 16px; margin-block: 24px; }
.audience-books-help { margin-block: 28px; }
@media (max-width: 680px) { .audience-books-filters { grid-template-columns: minmax(0, 1fr); } }

/* Hourly page-view evidence stays usable without scripts or inferred zeros. */
.audience-hour-period { min-width: 0; }
.audience-hour-period h3 { margin-top: 0; }
.audience-hour-total { padding-block: 12px; border-top: 1px solid var(--border-color, #e1e8e0); }
.audience-hour-total h4, .audience-hour-total p { margin: 4px 0; }
.audience-hour-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.audience-hours-chart { margin: 20px 0; padding: 16px; background: var(--bg-secondary, #f7faf6); border-radius: 14px; }
.audience-hours-chart figcaption { font-weight: 700; }
.audience-hours-plot { display: grid; grid-template-columns: minmax(2ch, max-content) minmax(0, 1fr); column-gap: 8px; }
.audience-hours-chart svg { display: block; width: 100%; height: 180px; overflow: visible; }
.audience-hours-scale { display: flex; flex-direction: column; justify-content: space-between; padding-block: 25px 14px; text-align: right; font-size: 12px; line-height: 14px; font-variant-numeric: tabular-nums; }
.audience-hours-times { grid-column: 2; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin: 4px 1.5625% 0 4.6875%; font-size: 12px; line-height: 1.5; }
.audience-hours-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; }
.audience-hours-current-key { color: #27613f; }
.audience-hours-previous-key { color: #7451a8; }
.audience-hours-current-key::before, .audience-hours-previous-key::before { content: ''; display: inline-block; width: 20px; margin-right: 6px; vertical-align: middle; border-top: 3px solid currentColor; }
.audience-hours-previous-key::before { border-top-style: dashed; }
.audience-hours-axis { stroke: #abb5aa; stroke-width: 1; vector-effect: non-scaling-stroke; }
.audience-hours-line-current, .audience-hours-line-previous { fill: none; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.audience-hours-chart circle { stroke-dasharray: none; }
.audience-hours-line-current { stroke: #27613f; }
.audience-hours-line-previous { stroke: #7451a8; stroke-dasharray: 5 3; }
.audience-hours-scroll { max-width: 100%; max-height: 34rem; overflow: auto; margin-top: 12px; }
.audience-hours-scroll:focus-visible { outline: 2px solid #27613f; outline-offset: 3px; }
.audience-hours-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
.audience-hours-table caption { text-align: left; padding-bottom: 10px; }
.audience-hours-table th, .audience-hours-table td { padding: 9px 10px; border-bottom: 1px solid var(--border-color, #e1e8e0); text-align: right; }
.audience-hours-table th:first-child { text-align: left; }
.audience-hours-table time { white-space: nowrap; }
.audience-hours-table thead { background: var(--bg-secondary, #f7faf6); }
.audience-hours-table td[data-period='previous'] { color: #7451a8; border-right: 1px solid var(--border-color, #e1e8e0); }


/* Private reader: at most 200 server-rendered, script-free places. */
.reading-library { padding-left: 24px; display: grid; gap: 16px; }
.reading-library li { overflow-wrap: anywhere; }
.reader-sections { margin-block: 30px; display: grid; gap: 14px; }
.reader-piece { scroll-margin-top: 22px; border: 1px solid #e1e8e0; border-radius: 12px; background: white; padding: 22px; }
.reader-piece:target { outline: 2px solid currentColor; }
.reader-piece__text { margin: 0; font: 19px/1.85 Georgia, "Times New Roman", serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-save-button { margin-top: 10px; border: 0; background: transparent; color: #27613f; text-decoration: underline; cursor: pointer; font: inherit; }
.reader-save-button:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

/* Accessible autosave feedback; never obstruct the reading surface. */
.reader-save-status { min-height: 1.6em; font-size: 0.92rem; color: #27613f; }

/* Adjacent chapter links are filtered by the public-reading SQL gate. */
.chapter-navigation { display: flex; flex-wrap: wrap; gap: 22px; justify-content: space-between; margin-block: 18px; }
.chapter-navigation a { text-decoration: underline; }
.chapter-navigation a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

/* Server-generated restricted Markdown; author HTML is always escaped. */
.reader-markdown { white-space: normal; overflow-wrap: anywhere; }
.reader-markdown p { margin: 0 0 1em; }
.reader-markdown p:last-child { margin-bottom: 0; }
.reader-markdown h1, .reader-markdown h2, .reader-markdown h3,
.reader-markdown h4, .reader-markdown h5, .reader-markdown h6 {
  line-height: 1.35; margin: 1.3em 0 0.55em; font-family: inherit; overflow-wrap: anywhere;
}
.reader-markdown h1:first-child, .reader-markdown h2:first-child,
.reader-markdown h3:first-child { margin-top: 0; }
.reader-markdown ul, .reader-markdown ol { padding-left: 1.7em; margin: 0 0 1em; }
.reader-markdown li { margin: 0.28em 0; }
.reader-markdown blockquote { border-left: 3px solid #b9d1bf; margin: 1em 0; padding: 0 1.15em; }
.reader-markdown a { color: #27613f; text-decoration: underline; }
.reader-markdown a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.reader-markdown pre { white-space: pre-wrap; background: #f1f5ef; padding: 0.8em; border-radius: 8px; }
.reader-markdown code { font-family: ui-monospace, monospace; font-size: 0.88em; overflow-wrap: anywhere; }
.reader-piece__text.reader-markdown { white-space: normal; }
.chapter-content.reader-markdown { white-space: normal; }

/* TOR H-01/H-02: responsive discovery and readable book-detail surfaces. */
:root { --surface: #fff; --paper: #f7f9f5; --ink: #233229; --line: #e1e7df; }
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.site-nav__link { min-height: 44px; display: inline-flex; align-items: center; }
.site-nav__link:hover { color: #27613f; }
.book-card { box-shadow: 0 6px 21px rgba(32,68,45,.04); transition: transform .15s ease, box-shadow .15s ease; }
.book-card:hover, .book-card:focus-within { transform: translateY(-2px); box-shadow: 0 15px 35px rgba(32,68,45,.10); }
.book-card__title a { display: inline-block; min-height: 40px; }
.catalog-heading { min-height: 0; }
.catalog-toolbar { margin-block: 35px 0; border-top: 1px solid var(--line); padding-top: 19px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.catalog-toolbar__title { font-size: 16px; font-weight: 700; }
.catalog-toolbar__info { color: #617965; font-size: 13px; }
.book-grid--catalog { margin-top: 18px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin: 0 0 32px; font-size: 13px; color: #607064; }
.breadcrumbs a { text-underline-offset: 4px; }
.breadcrumbs [aria-current="page"] { overflow-wrap: anywhere; }
.book-detail__layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: clamp(28px, 6vw, 80px); align-items: start; }
.book-detail__art { min-height: 395px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(150deg, #bfd3be, #3b7354 85%); color: #ecf7e8; box-shadow: 0 16px 36px rgba(27,70,43,.11); font: bold 7rem Georgia, serif; }
.book-detail__info h1 { font-size: clamp(30px, 4.6vw, 54px); line-height: 1.12; letter-spacing: -.035em; overflow-wrap: anywhere; margin: 0; }
.book-detail__description { color: #58685c; line-height: 1.75; font-size: 16px; max-width: 620px; margin: 22px 0 28px; }
.book-detail__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.book-detail__note { color: #647668; font-size: 13px; }
.auth-section { display: grid; align-items: center; padding-block: 70px; }
.auth-card .page-description { margin-bottom: 26px; }
@media (max-width: 680px) {
  .site-header { position: relative; }
  .site-nav { width: 100%; justify-content: space-between; }
  .book-detail__layout { grid-template-columns: 1fr; }
  .book-detail__art { min-height: 240px; max-width: 230px; }
  .breadcrumbs { margin-bottom: 22px; }
  .catalog-toolbar { margin-top: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* C-02/H: public reading surfaces and affordable server-rendered TOC. */
.chapter-toc { padding-top: 0; }
.chapter-toc h2 { margin: 0 0 22px; }
.chapter-toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 900px; }
.chapter-toc__item {
  padding: 16px 18px; background: var(--surface, #fff); border: 1px solid var(--line, #e1e7df);
  border-radius: 12px; display: flex; justify-content: space-between; align-items: center;
  gap: 16px; color: #233229; line-height: 1.5; overflow-wrap: anywhere;
}
.chapter-toc__item a { color: #205b39; text-underline-offset: 4px; font-weight: 600; }
.chapter-toc__item--paid { color: #6e796e; background: #f5f7f3; }
.chapter-toc__badge { white-space: nowrap; color: #7e6244; font-size: 12px; font-weight: 700; }
.chapter-toc__badge--free { color: #34734a; }
.reader-page h1 { margin: 0; line-height: 1.2; letter-spacing: -.04em; }
.reader-page__subtitle { color: #657167; line-height: 1.7; margin: 18px 0 30px; }
.reader-page__return { margin-top: 32px; }
.chapter-content { white-space: normal; }
.reader-markdown { font-family: Georgia, "Times New Roman", serif; font-size: clamp(17px, 2vw, 20px); }
.reader-markdown p { line-height: 1.85; }
@media (max-width: 680px) {
  .chapter-toc__item { align-items: flex-start; flex-direction: column; gap: 5px; padding: 13px 15px; }
  .chapter-content { padding: 18px 15px; border-radius: 10px; }
  .reader-width { width: 100%; }
}

/* A-02/A-03: usable registration and private account pages. */
.auth-section { min-height: min(700px, 78vh); }
.auth-card { margin-inline: auto; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: 14px; font-weight: 700; color: #33473a; }
.auth-form input { width: 100%; min-height: 46px; padding: 11px 14px; background: #fff; color: #1d3122; border-radius: 9px; border: 1px solid #bdcbbf; margin-bottom: 11px; }
.auth-form input:focus-visible { outline: 3px solid #44835b; outline-offset: 2px; }
.auth-form .button { width: 100%; min-height: 48px; justify-content: center; }
.auth-card__footer { margin-top: 20px; color: #68776b; }
.auth-card__footer a { color: #27613f; text-underline-offset: 4px; }
.account-profile__state { display: inline-flex; align-items: center; gap: 9px; padding: 7px 13px; border-radius: 18px; background: #eef5ed; color: #2b6540; font-size: 13px; font-weight: 600; }
.account-profile__status { background: #4b9f67; width: 7px; height: 7px; border-radius: 50%; }
.account-profile__hint { color: #68776b; font-size: 14px; line-height: 1.65; }
@media (max-width: 680px) { .auth-section { min-height: 0; padding-block: 36px; } .auth-card { padding: 25px 20px; } }

/* C-04: private book history, compact on desktop and touch-friendly on mobile. */
.library-page { min-height: 65vh; }
.library-heading { max-width: 760px; margin-bottom: 32px; }
.library-heading h1 { margin: 0 0 13px; }
.library-heading > p:last-child { color: #647366; line-height: 1.7; }
.library-grid { display: grid; gap: 14px; max-width: 930px; }
.library-card { background: #fff; border: 1px solid #dfebe1; border-radius: 15px; padding: 24px; display: flex; gap: 22px; align-items: center; justify-content: space-between; box-shadow: 0 9px 25px rgba(31,60,40,.04); }
.library-card h2 { font-size: clamp(19px,2.6vw,24px); margin: 0 0 8px; overflow-wrap: anywhere; }
.library-card p:not(.eyebrow) { margin: 0; color: #69796b; }
/* C-16: keep release actions tappable without crowding narrow cards. */
.library-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.library-card__actions form { margin: 0; }
.library-card__actions .button { min-height: 44px; }
@media (max-width: 680px) {
  .library-card__actions { justify-content: flex-start; }
}

.library-empty { max-width: 650px; border: 1px dashed #bdcfbf; border-radius: 15px; background: #f8faf7; padding: clamp(24px, 4vw, 42px); }
.library-empty h2 { margin-top: 0; font-size: 22px; }
.library-empty p { max-width: 460px; line-height: 1.7; color: #5f7462; }
@media (max-width: 680px) { .library-card { flex-direction: column; align-items: stretch; padding: 20px; } .library-card .button { align-self: start; min-height: 44px; } }

/* C-04: comfortable no-JavaScript reader and accurate private bookmarks. */
.reader-private { padding-top: clamp(28px,4vw,64px); }
.reader-private__content { margin-block: 24px; padding: clamp(18px,4vw,38px); background: #fff; }
.reader-piece { padding: 14px 0 18px; border-bottom: 1px solid #e8efe8; scroll-margin-top: 24px; }
.reader-piece:target { border-left: 3px solid #3d7b52; background: #f4f9f2; padding-left: 16px; }
.reader-piece__text { overflow-wrap: anywhere; line-height: 1.85; }
.reader-piece__form { display: flex; justify-content: flex-end; margin-top: 14px; }
.reader-save-button { appearance: none; cursor: pointer; border: 1px solid #d2dfd1; border-radius: 100px; background: #f6faf5; color: #28533a; padding: 10px 17px; min-height: 44px; font: inherit; font-size: 13px; font-weight: 700; }
.reader-save-button:hover { border-color: #4b815e; background: #edf6ea; }
.reader-save-button:focus-visible { outline: 3px solid #366d48; outline-offset: 3px; }
.reader-resume { display: inline-flex; align-items: center; min-height: 44px; border-radius: 12px; padding: 10px 16px; background: #ecf5ea; color: #2d6343; font-size: 14px; font-weight: 650; }
.reader-resume__link { color: #235d3a; text-underline-offset: 4px; }
.library-card__place { font-size: 13px; font-weight: 650; margin-top: 8px !important; color: #337150 !important; }
@media (max-width: 680px) {
  .reader-private__content { padding-inline: 14px; }
  .reader-save-button { width: 100%; font-size: 14px; }
  .reader-piece:target { padding-left: 9px; }
}


/* B-03/H: comfortable, bounded author chapter form on mobile and desktop. */
.auth-card.author-chapter-card { width: min(860px, 100%); }
.author-chapter-card h1 { overflow-wrap: anywhere; }
.author-chapter-card .author-form { display: grid; gap: 11px; }
.author-chapter-card .author-form textarea {
  display: block; width: 100%; min-height: 320px; resize: vertical;
  padding: 15px; border: 1px solid #bdcbbf; border-radius: 10px;
  background: #fff; color: #1d3122; font: 16px/1.7 ui-monospace, Consolas, monospace;
}
.author-chapter-card .author-form textarea:focus-visible { outline: 3px solid #44835b; outline-offset: 2px; }
.author-chapter-card .author-form .button { width: 100%; min-height: 48px; }
@media (max-width: 680px) {
  .auth-card.author-chapter-card { padding: 24px 18px; }
  .author-chapter-card .author-form textarea { min-height: 44vh; padding: 12px; }
}

/* B-02: author workspace readable on desktop and mobile. */
.auth-card.author-card { width: min(760px, 100%); }
.author-card > h1 { overflow-wrap: anywhere; }
.author-book-list { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 12px; }
.author-book-list li { min-width: 0; }
.author-book-link { display: block; padding: 16px 18px; border-radius: 12px; border: 1px solid #dce7dd; background: #f8fbf7; color: #26583a; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.author-book-link:hover { border-color: #6b9674; background: #edf5eb; }
.author-card .auth-form input { background: #fff; }
@media (max-width: 680px) {
  .auth-card.author-card { padding: 24px 20px; }
  .author-book-link { padding: 15px; }
  .author-card .button { min-height: 44px; }
}

/* B-04: make stale-revision guidance legible on small screens. */
.author-edit-warning { font-size: 13px; color: #536755; line-height: 1.6; }

/* An author preview may contain 50k Unicode characters; never overflow mobile. */
.author-release-preview {
  max-width: 100%; max-height: 45vh; overflow: auto; overflow-wrap: anywhere;
  white-space: pre-wrap; padding: 16px; border-radius: 10px;
  border: 1px solid #dce7dd; background: #f8fbf7; color: #263a2c;
}

/* C-10/S065: long Unicode, Markdown and fenced code never widen the viewport. */
.reader-page, .reader-width, .chapter-content, .reader-piece { min-width: 0; }
.reader-markdown pre, .reader-markdown code {
  max-width: 100%; overflow-wrap: anywhere; word-break: break-word;
}
.reader-markdown pre { overflow-x: auto; }
.reader-markdown a { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .reader-width { width: 100%; }
  .reader-page .chapter-content { margin-top: 16px; padding: 16px; font-size: 17px; line-height: 1.7; }
  .reader-page .reader-piece { padding: 14px; }
  .reader-page .reader-piece__text { font-size: 17px; line-height: 1.7; }
  .reader-page .chapter-navigation { gap: 10px; }
}

.book-card__meta {
  margin: 7px 0 0;
  color: #586e5f;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* A/H: Russian, script-free account feedback and a standalone error screen. */
.auth-form__help {
  margin: -8px 0 7px;
  color: #607566;
  font-size: 12px;
  line-height: 1.5;
}
.auth-form__error {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #e7c8b1;
  border-left: 4px solid #aa602e;
  border-radius: 8px;
  background: #fff6ef;
  color: #7c3d1c;
  font-size: 14px;
  line-height: 1.55;
}
.account-error {
  min-height: min(760px, 80svh);
  display: grid;
  align-items: center;
  background: radial-gradient(circle at 14% 15%, #e9f3e8 0%, transparent 42%),
    radial-gradient(circle at 90% 95%, #f7ebd6 0%, transparent 38%), #f5f8f3;
  padding-block: clamp(48px, 8vw, 100px);
}
.account-error__card {
  width: min(620px, 100%);
  margin-inline: auto;
  padding: clamp(28px, 6vw, 58px);
  border: 1px solid #dce7d9;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 22px 64px rgba(38, 75, 48, .09);
}
.account-error__symbol {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin-bottom: 26px;
  border: 1px solid #edca9c;
  border-radius: 21px;
  background: linear-gradient(145deg, #fff8ec, #fbe8d0);
  color: #99571e;
  font-size: 32px;
  font-weight: 800;
}
.account-error__card h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.17;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}
.account-error__message {
  margin: 22px 0 30px;
  color: #607166;
  font-size: 16px;
  line-height: 1.7;
}
.account-error__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.account-error__actions .button { min-height: 48px; }
.account-error__hint {
  border-top: 1px solid #e6ece4;
  margin: 32px 0 12px;
  padding-top: 20px;
  font-size: 13px;
  line-height: 1.65;
  color: #6a7b6c;
}
.account-error__catalog {
  color: #23633f;
  font-size: 14px;
  font-weight: 700;
  text-underline-offset: 4px;
}
@media (max-width: 480px) {
  .account-error { min-height: 0; padding-block: 30px; }
  .account-error__card { border-radius: 18px; }
  .account-error__actions { align-items: stretch; flex-direction: column; }
  .account-error__actions .button { width: 100%; }
}

/* B-18: catalog cursor navigation on narrow and wide screens. */
.catalog-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.catalog-pagination__current {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0.5rem 0.25rem;
}
