:root {
  --paper: #fbf8f1;
  --paper-2: #f5efe5;
  --ink: #191713;
  --ink-soft: #3c3830;
  --muted: #776f63;
  --line: #e4d8c8;
  --line-strong: #d7c6b1;
  --panel: #fffdf8;
  --panel-warm: #f8f1e7;
  --gold: #b77a2f;
  --gold-deep: #81501c;
  --sage: #61735f;
  --sage-soft: #e4eadf;
  --rose: #a85b58;
  --rose-soft: #f4ddda;
  --blue: #344d68;
  --blue-soft: #dde8ef;
  --shadow: 0 18px 45px rgba(53, 43, 31, 0.08);
  --shadow-soft: 0 10px 28px rgba(53, 43, 31, 0.07);
  --radius: 8px;
  --serif: "Playfair Display", Georgia, serif;
  --reader: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 239, 229, 0.38)),
    var(--paper);
  color: var(--ink);
}

body.reader-dark {
  background: #151515;
  color: #f6efe5;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px 22px;
  border-right: 1px solid var(--line);
  background: rgba(252, 248, 241, 0.9);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-lockup {
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 0 12px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 0.98;
  font-weight: 800;
}

.brand-sub {
  margin-left: 80px;
  font-size: 13px;
  color: var(--ink-soft);
}

.nav-stack,
.genre-menu {
  display: grid;
  gap: 8px;
}

.nav-item,
.genre-menu button,
.mobile-item {
  border: 0;
  color: var(--ink);
  background: transparent;
}

.nav-item,
.genre-menu button {
  min-height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  text-align: left;
}

.nav-item i,
.genre-menu i,
.mobile-item i,
.icon-button i,
.button-link i,
.dark-button i,
.light-button i,
.ghost-button i,
.tiny-button i,
.profile-chip i,
.stat-icon i,
.field-icon i,
.chapter-state i,
.reader-tool i,
.search-shell i,
.inline-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav-item.active,
.nav-item:hover,
.genre-menu button:hover {
  background: var(--panel-warm);
}

.side-label,
.section-kicker,
.meta-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.genre-menu {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.genre-menu button {
  min-height: 28px;
  padding: 0 14px;
  color: var(--ink-soft);
  justify-content: space-between;
}

.write-callout {
  margin-top: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.write-callout h2,
.quote-panel strong,
.modal-card h2,
.writer-name,
.book-title,
.section-title,
.work-title,
.reader-title,
.profile-name {
  font-family: var(--serif);
}

.write-callout h2 {
  margin: 0;
  font-size: 20px;
}

.write-callout p {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.side-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.main-column {
  min-width: 0;
  padding: 24px 34px 54px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-height: 54px;
  padding-bottom: 12px;
  background: rgba(251, 248, 241, 0.86);
  backdrop-filter: blur(16px);
}

.search-shell {
  width: min(430px, 54vw);
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 253, 248, 0.82);
}

.search-shell input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.top-actions,
.hero-actions,
.filter-row,
.book-actions,
.card-actions,
.row-between,
.work-meta,
.author-line,
.chapter-actions,
.reader-actions,
.tabs,
.mode-buttons,
.price-row,
.profile-stats,
.publish-bar,
.result-meta,
.metric-row,
.toast-action-row,
.library-row-top,
.payment-copy {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
}

.icon-button,
.profile-chip,
.dark-button,
.light-button,
.ghost-button,
.button-link,
.tiny-button,
.reader-tool,
.chip-button,
.pill-button {
  border-radius: var(--radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.icon-button {
  width: 42px;
  padding: 0;
  border-radius: 50%;
  position: relative;
}

.has-dot::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c0463b;
  border: 2px solid var(--panel);
}

.profile-chip {
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
}

.avatar-img,
.writer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fffaf1;
  font-weight: 800;
  background: #223c4b;
  overflow: hidden;
}

.avatar-k {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), transparent),
    #71453d;
}

.dark-button {
  padding: 0 16px;
  min-height: 40px;
  border-color: #191713;
  background: #191713;
  color: #fffaf2;
}

.light-button,
.ghost-button,
.button-link,
.tiny-button,
.chip-button,
.pill-button {
  padding: 0 14px;
}

.light-button:hover,
.ghost-button:hover,
.button-link:hover,
.tiny-button:hover,
.chip-button:hover,
.pill-button:hover,
.icon-button:hover,
.profile-chip:hover {
  border-color: var(--line-strong);
  background: var(--panel-warm);
}

.ghost-button {
  background: transparent;
}

.button-link {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.tiny-button {
  min-height: 34px;
  font-size: 13px;
  padding: 0 12px;
}

.chip-button,
.pill-button {
  min-height: 34px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  font-size: 13px;
}

.chip-button.active,
.pill-button.active,
.reader-tool.active {
  background: #191713;
  border-color: #191713;
  color: #fffaf2;
}

.hero {
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(340px, 1.1fr);
  align-items: center;
  gap: 34px;
  min-height: 270px;
  padding: 8px 0 24px;
}

.hero-copy h1 {
  margin: 0;
  max-width: 520px;
  font-family: var(--serif);
  font-size: 58px;
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 560px;
  margin: 18px 0 22px;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.7;
}

.filter-row {
  gap: 10px;
  flex-wrap: wrap;
}

.hero-art {
  min-height: 250px;
  position: relative;
  overflow: hidden;
}

.window-scene {
  position: absolute;
  inset: 12px 0 20px 22%;
  opacity: 0.68;
}

.window-frame {
  position: absolute;
  right: 25%;
  top: 18px;
  width: 148px;
  height: 136px;
  border: 1px solid rgba(161, 128, 86, 0.28);
  background:
    linear-gradient(90deg, transparent 48%, rgba(161, 128, 86, 0.24) 49%, rgba(161, 128, 86, 0.24) 51%, transparent 52%),
    linear-gradient(180deg, transparent 48%, rgba(161, 128, 86, 0.24) 49%, rgba(161, 128, 86, 0.24) 51%, transparent 52%);
}

.branch,
.branch::before,
.branch::after {
  position: absolute;
  content: "";
  height: 1px;
  background: rgba(161, 128, 86, 0.34);
  transform-origin: left center;
}

.branch {
  width: 210px;
  top: 68px;
  right: 34%;
  transform: rotate(-22deg);
}

.branch::before {
  width: 128px;
  left: 56px;
  top: -22px;
  transform: rotate(34deg);
}

.branch::after {
  width: 112px;
  left: 118px;
  top: 24px;
  transform: rotate(38deg);
}

.leaf {
  position: absolute;
  width: 7px;
  height: 13px;
  border-radius: 50%;
  background: rgba(196, 158, 112, 0.26);
  transform: rotate(28deg);
}

.leaf:nth-child(1) { top: 42px; right: 52%; }
.leaf:nth-child(2) { top: 76px; right: 49%; }
.leaf:nth-child(3) { top: 106px; right: 37%; }
.leaf:nth-child(4) { top: 58px; right: 29%; }
.leaf:nth-child(5) { top: 118px; right: 23%; }
.leaf:nth-child(6) { top: 38px; right: 18%; }

.desk-scene {
  position: absolute;
  left: 10%;
  right: 3%;
  bottom: 0;
  height: 120px;
}

.open-book {
  position: absolute;
  left: 24%;
  right: 4%;
  bottom: 0;
  height: 58px;
  border-radius: 8px 8px 24px 24px;
  background:
    linear-gradient(110deg, #eadcca 0 47%, #d2bfa8 48% 50%, #fff4e2 51% 100%);
  box-shadow: 0 16px 30px rgba(55, 42, 28, 0.12);
}

.open-book::before,
.open-book::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 14px;
  width: 32%;
  border-top: 1px solid rgba(109, 84, 56, 0.18);
  border-bottom: 1px solid rgba(109, 84, 56, 0.12);
}

.open-book::before {
  left: 11%;
}

.open-book::after {
  right: 11%;
}

.book-stack {
  position: absolute;
  left: 5%;
  bottom: 42px;
  width: 174px;
  height: 70px;
}

.book-stack span {
  position: absolute;
  height: 18px;
  border-radius: 3px;
  background: #cdb797;
  border: 1px solid rgba(95, 72, 45, 0.18);
  box-shadow: 0 6px 14px rgba(55, 42, 28, 0.08);
}

.book-stack span:nth-child(1) {
  bottom: 0;
  left: 0;
  width: 168px;
}

.book-stack span:nth-child(2) {
  bottom: 18px;
  left: 18px;
  width: 140px;
  background: #a89178;
}

.book-stack span:nth-child(3) {
  bottom: 36px;
  left: 4px;
  width: 150px;
  background: #e2cfb6;
}

.tea-cup {
  position: absolute;
  left: 34%;
  bottom: 49px;
  width: 56px;
  height: 52px;
  border-radius: 5px 5px 24px 24px;
  background: #171512;
  box-shadow: inset -10px 0 0 rgba(255, 255, 255, 0.06);
}

.tea-cup::before {
  content: "";
  position: absolute;
  right: -25px;
  top: 12px;
  width: 31px;
  height: 26px;
  border: 7px solid #171512;
  border-left: 0;
  border-radius: 0 24px 24px 0;
}

.tagline-script {
  position: absolute;
  right: 0;
  top: 92px;
  max-width: 190px;
  color: #50443a;
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 21px;
  line-height: 1.62;
}

.content-section {
  margin-top: 24px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.section-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.featured-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.78);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.featured-main {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 26px;
  padding: 22px;
}

.featured-copy {
  min-width: 0;
  align-self: center;
}

.featured-copy .section-kicker {
  color: var(--gold);
}

.work-title {
  margin: 8px 0 8px;
  font-size: 29px;
  line-height: 1.08;
}

.work-summary,
.book-description,
.reader-body p,
.profile-bio,
.modal-card p,
.empty-state,
.note-copy {
  color: var(--ink-soft);
  line-height: 1.7;
}

.author-line {
  gap: 6px;
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 14px;
}

.x-handle {
  color: var(--muted);
}

.work-summary {
  max-width: 580px;
  margin: 16px 0;
}

.work-meta {
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.work-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.book-actions {
  margin-top: 22px;
  gap: 10px;
  flex-wrap: wrap;
}

.quote-panel {
  border-left: 1px solid var(--line);
  display: grid;
  place-items: center;
  padding: 26px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.42), rgba(246, 236, 222, 0.5)),
    var(--panel);
}

.quote-panel strong {
  font-size: 16px;
}

.quote-panel blockquote {
  margin: 28px 0 14px;
  font-family: var(--reader);
  font-size: 19px;
  line-height: 1.55;
}

.quote-panel span {
  color: var(--muted);
  font-size: 13px;
}

.book-cover {
  width: 120px;
  aspect-ratio: 0.68;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  padding: 14px 12px;
  color: #fffaf2;
  box-shadow: 0 18px 28px rgba(38, 29, 20, 0.2);
  display: grid;
  align-content: space-between;
  isolation: isolate;
}

.book-cover.large {
  width: 154px;
}

.book-cover.detail {
  width: min(260px, 100%);
}

.book-cover::before,
.book-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
}

.book-cover::before {
  background: rgba(0, 0, 0, 0.12);
}

.book-cover::after {
  inset: auto 10px 12px;
  height: 1px;
  background: rgba(255, 255, 255, 0.58);
}

.cover-title {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.18;
  text-align: center;
  text-transform: uppercase;
}

.book-cover.large .cover-title,
.book-cover.detail .cover-title {
  font-size: 22px;
}

.cover-author {
  text-align: center;
  font-size: 10px;
  color: rgba(255, 250, 242, 0.82);
}

.cover-ember {
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 180, 100, 0.38), transparent 28%),
    linear-gradient(165deg, #18202b, #603727 48%, #d59a55);
}

.cover-water {
  background:
    radial-gradient(circle at 46% 70%, rgba(205, 232, 232, 0.24), transparent 24%),
    linear-gradient(165deg, #0e3346, #0a6174 46%, #1a1a21);
}

.cover-echo {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 6%, transparent 7% 30%, rgba(255, 255, 255, 0.1) 31% 32%, transparent 33%),
    linear-gradient(165deg, #171818, #41433e 45%, #a27751);
}

.cover-pink {
  color: #7b3f38;
  background:
    radial-gradient(circle at 72% 26%, rgba(255, 255, 255, 0.76), transparent 20%),
    linear-gradient(160deg, #f8dad6, #f0b5aa 52%, #f5eadf);
}

.cover-starry {
  background:
    radial-gradient(circle at 34% 36%, #f6f0c5 0 2px, transparent 3px),
    radial-gradient(circle at 72% 24%, #f6f0c5 0 2px, transparent 3px),
    linear-gradient(160deg, #15162d, #2e315b 48%, #6a4a75);
}

.cover-wild {
  background:
    linear-gradient(90deg, rgba(239, 234, 205, 0.13) 0 3%, transparent 4% 8%),
    linear-gradient(160deg, #465648, #223328 48%, #8a785f);
}

.cover-rose {
  color: #3f2520;
  background:
    radial-gradient(circle at 28% 34%, rgba(255, 255, 255, 0.56), transparent 22%),
    linear-gradient(160deg, #f5cfc3, #d98570 52%, #79504a);
}

.cover-ink {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 12%, transparent 12% 100%),
    linear-gradient(160deg, #111111, #2c2c2a 52%, #79614d);
}

.book-scroller,
.writer-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(310px, 1fr);
  gap: 22px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 1px 14px;
  scrollbar-width: thin;
}

.story-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.story-card .book-cover {
  width: 96px;
}

.story-card:hover .book-title,
.book-title-link:hover {
  color: var(--gold-deep);
}

.book-title {
  display: block;
  font-size: 17px;
  line-height: 1.2;
}

.byline,
.read-count,
.price-badge,
.status-badge,
.genre-badge,
.notification-time {
  font-size: 12px;
  color: var(--muted);
}

.price-badge,
.status-badge,
.genre-badge {
  width: max-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--ink-soft);
}

.status-badge.complete {
  background: var(--sage-soft);
  border-color: #ccd9c2;
  color: #405642;
}

.price-badge.paid {
  background: #f6e7d5;
  border-color: #e3c4a0;
  color: #6f4418;
}

.story-meta-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.writer-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.64);
  padding: 14px;
}

.writer-info {
  min-width: 0;
}

.writer-name {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.writer-detail {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
}

.writer-follower {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.writer-avatar.avatar-lena {
  background: linear-gradient(145deg, #193f47, #c78970);
}

.writer-avatar.avatar-noah {
  background: linear-gradient(145deg, #2f2f31, #b98862);
}

.writer-avatar.avatar-isabella {
  background: linear-gradient(145deg, #6a3d46, #d6a26a);
}

.writer-avatar.avatar-ethan {
  background: linear-gradient(145deg, #192437, #785e46);
}

.writer-avatar.avatar-james {
  background: linear-gradient(145deg, #2d3c29, #c9a47a);
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 12px;
}

.genre-tile {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.68);
  padding: 14px;
  display: grid;
  align-content: space-between;
}

.genre-tile:hover {
  border-color: var(--line-strong);
  background: var(--panel);
}

.genre-tile strong {
  font-family: var(--serif);
  font-size: 18px;
}

.genre-tile span {
  color: var(--muted);
  font-size: 12px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 34px;
  align-items: start;
  padding-top: 22px;
}

.sticky-rail {
  position: sticky;
  top: 88px;
}

.detail-stack {
  display: grid;
  gap: 18px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.stat-card,
.chapter-row,
.library-row,
.notification-row,
.search-result,
.dashboard-panel,
.editor-panel,
.profile-hero,
.payment-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.76);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  padding: 16px;
  display: grid;
  gap: 7px;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  font-size: 22px;
}

.chapter-list {
  display: grid;
  gap: 10px;
}

.chapter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.chapter-title {
  display: block;
  font-weight: 700;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.chapter-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.payment-strip {
  margin-top: 22px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.payment-copy {
  gap: 10px;
  color: var(--ink-soft);
}

.payment-copy i {
  width: 20px;
  height: 20px;
  color: var(--gold-deep);
}

.reader-view {
  min-height: calc(100vh - 98px);
  display: grid;
  grid-template-rows: auto 1fr;
}

.reader-toolbar {
  position: sticky;
  top: 66px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  background: rgba(251, 248, 241, 0.9);
  backdrop-filter: blur(14px);
}

.reader-progress {
  flex: 1;
  height: 6px;
  min-width: 120px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7d9c8;
}

.reader-progress span {
  display: block;
  height: 100%;
  width: 38%;
  background: #191713;
}

.reader-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reader-page {
  width: min(760px, 100%);
  margin: 38px auto 80px;
}

.reader-kicker {
  color: var(--muted);
  margin-bottom: 12px;
}

.reader-title {
  margin: 0;
  font-size: 44px;
  line-height: 1.12;
}

.reader-body {
  margin-top: 30px;
  font-family: var(--reader);
  font-size: var(--reader-font-size, 19px);
}

.reader-body p {
  margin: 0 0 24px;
  color: inherit;
}

.reader-view.sepia .reader-page {
  background: #f7eddd;
  border: 1px solid #e6d4bc;
  border-radius: var(--radius);
  padding: 34px;
}

.reader-view.dark {
  color: #efe7db;
}

.reader-view.dark .reader-toolbar,
body.reader-dark .topbar {
  background: rgba(21, 21, 21, 0.92);
}

.reader-view.dark .reader-progress {
  background: #333;
}

.reader-view.dark .reader-progress span {
  background: #efe7db;
}

.reader-view.dark .reader-tool,
.reader-view.dark .ghost-button,
.reader-view.dark .light-button {
  color: #efe7db;
  border-color: #4a4944;
  background: #20201e;
}

.end-chapter {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.reader-actions {
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.library-shell,
.write-shell,
.search-shell-page,
.profile-shell,
.notifications-shell {
  display: grid;
  gap: 22px;
  padding-top: 18px;
}

.page-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.page-heading {
  margin: 0;
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.08;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.tabs {
  gap: 8px;
  flex-wrap: wrap;
}

.library-grid {
  display: grid;
  gap: 12px;
}

.library-row,
.search-result {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.library-row .book-cover,
.search-result .book-cover {
  width: 80px;
}

.progress-line {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7d9c8;
  margin-top: 10px;
}

.progress-line span {
  display: block;
  height: 100%;
  background: #191713;
}

.write-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.editor-panel,
.dashboard-panel,
.profile-hero {
  padding: 20px;
}

.work-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.type-card {
  min-height: 82px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 8px;
}

.type-card.active {
  border-color: #191713;
  box-shadow: inset 0 0 0 1px #191713;
}

.type-card i {
  width: 20px;
  height: 20px;
  color: var(--gold-deep);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.declaration span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--ink);
  padding: 12px;
  outline: 0;
}

.field textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.7;
  font-family: var(--reader);
  font-size: 17px;
}

.declaration {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--panel-warm);
}

.declaration input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
}

.declaration p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.publish-bar {
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.autosave {
  color: var(--sage);
  font-size: 13px;
}

.chapter-management {
  display: grid;
  gap: 10px;
}

.mini-chapter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
}

.mini-chapter b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-warm);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  display: grid;
  gap: 6px;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  font-size: 24px;
}

.search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.large-search {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--panel);
}

.large-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.filter-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-results {
  display: grid;
  gap: 12px;
}

.result-copy {
  min-width: 0;
}

.result-copy p {
  margin: 8px 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.result-meta {
  gap: 10px;
  flex-wrap: wrap;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.profile-avatar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fffaf1;
  font-size: 31px;
  font-weight: 800;
  background: linear-gradient(145deg, #713f34, #1f3447);
}

.profile-name {
  font-size: 34px;
  line-height: 1.05;
}

.profile-bio {
  max-width: 680px;
  margin: 8px 0 0;
}

.profile-stats {
  gap: 22px;
  flex-wrap: wrap;
}

.profile-stats span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.profile-stats strong {
  color: var(--ink);
  font-size: 19px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-panel h3,
.editor-panel h3,
.modal-card h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.metric-row {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span {
  color: var(--muted);
}

.notification-list {
  display: grid;
  gap: 12px;
}

.notification-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.notification-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-warm);
  color: var(--gold-deep);
}

.notification-icon i {
  width: 19px;
  height: 19px;
}

.notification-row p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(25, 23, 19, 0.42);
}

.modal-card {
  width: min(520px, 100%);
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 26px 72px rgba(25, 23, 19, 0.24);
  padding: 24px;
}

.modal-card h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.modal-card p {
  margin: 12px 0 18px;
}

.price-row {
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 20px;
}

.price-option {
  min-width: 76px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--panel-warm);
  border-radius: var(--radius);
  font-weight: 800;
}

.price-option.active {
  background: #191713;
  color: #fffaf2;
  border-color: #191713;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 110;
  transform: translate(-50%, 22px);
  opacity: 0;
  pointer-events: none;
  min-height: 42px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: #191713;
  color: #fffaf2;
  padding: 0 16px;
  box-shadow: 0 12px 34px rgba(25, 23, 19, 0.24);
  transition: opacity 160ms ease, transform 160ms ease;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-nav {
  display: none;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--panel);
}

@media (max-width: 1160px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 210px;
  }

  .featured-shell {
    grid-template-columns: 1fr;
  }

  .quote-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .genre-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100vh;
    overflow: hidden;
  }

  .sidebar {
    display: none;
  }

  .main-column {
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px 96px;
  }

  .topbar {
    justify-content: space-between;
    gap: 10px;
  }

  .search-shell {
    width: 100%;
  }

  .top-actions {
    flex: 0 0 auto;
  }

  .top-actions .icon-button:first-child {
    display: none;
  }

  .hero-copy h1 {
    font-size: 44px;
  }

  .hero-copy p {
    font-size: 16px;
  }

  .featured-main,
  .page-grid,
  .write-layout,
  .profile-hero {
    grid-template-columns: 1fr;
  }

  .sticky-rail {
    position: static;
  }

  .book-cover.large,
  .book-cover.detail {
    width: 146px;
  }

  .stat-grid,
  .metric-grid,
  .dashboard-grid,
  .work-type-grid {
    grid-template-columns: 1fr 1fr;
  }

  .library-row,
  .search-result {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .library-row > .card-actions,
  .search-result > .card-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .mobile-nav {
    position: static;
    z-index: 80;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin: 0 12px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.94);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
  }

  .mobile-item {
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 8px 0;
    font-size: 11px;
  }

  .mobile-item.active {
    color: var(--gold-deep);
  }
}

@media (max-width: 620px) {
  .main-column {
    padding-inline: 12px;
  }

  .topbar {
    align-items: stretch;
  }

  .top-actions {
    gap: 6px;
  }

  .profile-chip i {
    display: none;
  }

  .hero {
    gap: 12px;
  }

  .hero-copy h1 {
    font-size: 38px;
  }

  .hero-art {
    min-height: 170px;
  }

  .tagline-script {
    display: none;
  }

  .featured-main {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    align-items: start;
  }

  .featured-main .book-cover.large {
    width: 118px;
  }

  .featured-copy {
    align-self: start;
  }

  .work-title {
    font-size: 23px;
  }

  .work-summary {
    margin: 10px 0;
    line-height: 1.48;
  }

  .work-meta {
    gap: 8px;
    font-size: 11px;
  }

  .book-actions {
    margin-top: 12px;
  }

  .book-scroller,
  .writer-scroller {
    grid-auto-columns: minmax(215px, 78vw);
  }

  .writer-name {
    font-size: 14px;
  }

  .writer-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .writer-card .tiny-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .genre-grid,
  .stat-grid,
  .metric-grid,
  .dashboard-grid,
  .form-grid,
  .work-type-grid,
  .search-controls {
    grid-template-columns: 1fr;
  }

  .chapter-row {
    grid-template-columns: 1fr;
  }

  .chapter-actions {
    justify-content: flex-start;
  }

  .reader-toolbar {
    top: 58px;
    align-items: stretch;
    flex-direction: column;
  }

  .reader-controls {
    justify-content: flex-start;
  }

  .reader-title {
    font-size: 34px;
  }

  .reader-view.sepia .reader-page {
    padding: 20px;
  }

  .page-heading {
    font-size: 34px;
  }

  .page-title-row {
    align-items: start;
    flex-direction: column;
  }

  .profile-stats {
    gap: 14px;
  }

  .notification-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .notification-time {
    grid-column: 2;
  }
}
