/* ==========================================================================
   CineTale · TRUYỆN CHỮ HỘI VIÊN (EDITORIAL MINIMAL · DARK / SEPIA / LIGHT)
   Clean Apple Books / MUBI-grade typography · Zero bloated boxes or emoji clutter
   ========================================================================== */

/* Top Nav Novel Button */
.nav-novels-btn {
  border-color: var(--border-gold-soft);
  background: rgba(229, 190, 112, 0.08);
}

.nav-novels-btn.active {
  border-color: var(--border-gold);
  background: var(--gold-glow);
  color: var(--gold-primary);
}

.nav-novels-vip-tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f2da9e, #c99434);
  color: #161108;
  line-height: 1.1;
}

/* ================= HOME SHOWCASE SHELF (BORDERLESS · MATCHES CINETALE LIBRARY) ================= */

.home-novels-section {
  margin-top: 48px;
  padding-top: 34px;
  border-top: 1px solid var(--border-subtle);
}

.home-novels-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.home-novels-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.home-novels-title {
  font-size: clamp(19px, 2.2vw, 23px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.home-novels-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.home-novels-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-primary);
  padding: 6px 2px;
  white-space: nowrap;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.home-novels-link:hover {
  opacity: 0.85;
  transform: translateX(2px);
}

/* ================= NOVELS HUB HEADER (#novels — COMPACT EDITORIAL) ================= */

.novels-editorial-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0 22px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.novels-head-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.novels-head-title-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.novels-editorial-head h1 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
}

.novels-head-count {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.novels-head-sub {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.novels-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.novels-member-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #161108;
  background: linear-gradient(180deg, #f2da9e 0%, #d4a654 100%);
  border: 1px solid rgba(255, 245, 214, 0.35);
  box-shadow: 0 6px 20px rgba(210, 166, 87, 0.22);
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.15s ease;
}

.novels-member-cta:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.novels-member-cta:active {
  transform: scale(0.97);
}

.novel-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald-safe);
  background: rgba(107, 196, 156, 0.12);
  border: 1px solid rgba(107, 196, 156, 0.32);
  white-space: nowrap;
}

.novels-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

/* ================= NOVEL BOOK CARDS GRID (3:4 PORTRAIT JACKETS) ================= */

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

.novels-grid.compact {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 15px;
}

.novel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease-cinema);
}

.novel-card:hover {
  transform: translateY(-4px);
}

.novel-cover-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.novel-card:hover .novel-cover-wrap {
  border-color: var(--border-gold);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.novel-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s var(--ease-cinema);
}

.novel-card:hover .novel-cover-img {
  transform: scale(1.04);
}

.novel-cover-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 11, 18, 0.24) 0%,
    rgba(8, 11, 18, 0) 32%,
    rgba(8, 11, 18, 0.84) 100%
  );
  pointer-events: none;
}

.novel-cover-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  z-index: 2;
}

.novel-lock-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(10, 13, 22, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f3d58c;
  border: 1px solid rgba(229, 190, 112, 0.34);
}

.novel-lock-chip svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.novel-lock-chip.unlocked {
  color: #7ee3b4;
  border-color: rgba(107, 196, 156, 0.4);
}

.novel-lock-chip.full-free {
  color: #062116;
  background: linear-gradient(135deg, #7be6b7, #3ec48d);
  border-color: rgba(123, 230, 183, 0.65);
  box-shadow: 0 4px 12px rgba(62, 196, 141, 0.34);
}

.novel-lock-chip.free {
  color: #f4efe6;
  border-color: rgba(255, 255, 255, 0.24);
}

.novel-detail-free-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #062116;
  background: linear-gradient(135deg, #7be6b7, #3ec48d);
}

.novels-empty-state {
  padding: 40px 20px;
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--bg-card-soft);
  border: 1px dashed var(--border-medium);
}

.novels-empty-state p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.55;
}

.novel-cover-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
}

.novel-cover-genre {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(244, 239, 230, 0.78);
  margin-bottom: 3px;
}

.novel-cover-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.26;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.novel-card-body {
  padding: 10px 2px 2px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.novel-card-tagline {
  font-size: 12.8px;
  line-height: 1.48;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.novel-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.novels-grid.compact .novel-cover-title {
  font-size: 13.5px;
}

.novels-grid.compact .novel-card-tagline {
  display: none;
}

.novels-grid.compact .novel-card-body {
  padding: 8px 2px 0;
}

/* ================= NOVEL DETAIL VIEW (#novel/:id) ================= */

.novel-detail-hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-soft);
  padding: 28px;
  margin-bottom: 28px;
}

.novel-detail-bg {
  position: absolute;
  inset: -24px;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  object-fit: cover;
  filter: blur(40px) saturate(1.15);
  opacity: 0.22;
  pointer-events: none;
}

html[data-theme='light'] .novel-detail-bg,
html[data-theme='sepia'] .novel-detail-bg {
  opacity: 0.12;
}

.novel-detail-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.novel-detail-jacket {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.42);
  background: var(--surface-1);
}

.novel-detail-jacket img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.novel-detail-info {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}

.novel-detail-kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-primary);
  letter-spacing: 0.02em;
}

.novel-detail-title {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.16;
}

.novel-detail-synopsis {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 68ch;
}

.novel-detail-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

.novel-detail-metrics strong {
  color: var(--text-primary);
  font-weight: 600;
}

.novel-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.novel-cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.novel-cast-card {
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
}

.novel-cast-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.novel-cast-role {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* 12-Chapter Table of Contents */
.novel-chapters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.novel-ch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.novel-ch-row:hover {
  border-color: var(--border-gold);
  background: var(--bg-card-hover);
}

.novel-ch-row.read {
  border-color: rgba(107, 196, 156, 0.35);
}

.novel-ch-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.novel-ch-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-segment);
  flex-shrink: 0;
}

.novel-ch-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.novel-ch-sub {
  font-size: 11.8px;
  color: var(--text-muted);
  margin-top: 2px;
}

.novel-ch-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--gold-primary);
  opacity: 0.9;
}

.novel-ch-status svg {
  width: 12px;
  height: 12px;
}

.novel-ch-status.unlocked {
  color: var(--emerald-safe);
}

/* ================= DEDICATED LITERARY READER (#novel-read/:id/:ch) ================= */

.novel-reader-bar {
  position: sticky;
  top: 0;
  z-index: 45;
  padding-top: var(--safe-top, env(safe-area-inset-top, 0px));
  background: var(--bg-reader-bar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.novel-reader-bar-inner {
  max-width: 980px;
  height: 54px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.novel-reader-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.novel-reader-crumb {
  min-width: 0;
}

.novel-reader-book-name {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.novel-reader-ch-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.novel-reader-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.novel-reader-select {
  height: 32px;
  max-width: 185px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  line-height: 30px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.novel-reader-progress {
  height: 2px;
  width: 100%;
  background: var(--border-subtle);
}

.novel-reader-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold-primary));
  transition: width 0.12s linear;
}

.novel-reader-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 24px 96px;
}

.novel-prose-header {
  text-align: center;
  padding-bottom: 26px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-subtle);
}

.novel-prose-kicker {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-primary);
  margin-bottom: 8px;
}

.novel-prose-title {
  font-size: clamp(24px, 3.6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.25;
}

.novel-prose-meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.novel-prose-body {
  font-size: var(--novel-font-size, 18px);
  line-height: 1.9;
  color: var(--text-prose-vi, var(--text-primary));
  font-family: var(--novel-font-family, var(--font-ui));
  user-select: none;
  -webkit-user-select: none;
}

.novel-prose-body.serif {
  font-family: 'Lora', 'Times New Roman', serif;
  line-height: 1.95;
}

.novel-prose-body p {
  margin-bottom: 1.25em;
  text-align: left;
}

.novel-prose-body p.novel-dialogue {
  color: var(--text-primary);
}

.novel-prose-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.novel-prose-body em {
  font-style: italic;
}

.novel-scene-break {
  text-align: center;
  margin: 2.1em 0;
  letter-spacing: 0.6em;
  color: var(--gold-primary);
  opacity: 0.65;
  font-size: 12px;
}

.novel-watermark-foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  opacity: 0.72;
}

/* ================= BILINGUAL CHINESE & RUBY PINYIN CONTROLS ================= */

.novel-bi-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f6dfaa;
  background: rgba(20, 18, 15, 0.72);
  border: 1px solid rgba(229, 190, 112, 0.45);
  backdrop-filter: blur(8px);
}

.novel-detail-bi-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold-primary);
  background: rgba(229, 190, 112, 0.12);
  border: 1px solid var(--border-gold);
}

.novel-bilingual-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.novel-bilingual-group[hidden] {
  display: none !important;
}

.novel-lang-seg {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 9px;
  background: var(--bg-segment);
  border: 1px solid var(--border-medium);
  gap: 2px;
}

.novel-lang-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 11.8px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.novel-lang-btn:hover {
  color: var(--text-primary);
}

.novel-lang-btn.active {
  background: var(--gold-primary);
  color: #161412;
  font-weight: 700;
}

.novel-pinyin-btn.on {
  border-color: var(--border-gold);
  background: rgba(229, 190, 112, 0.18);
  color: var(--gold-primary);
  font-weight: 700;
}

.novel-prose-title-zh {
  font-family: 'Noto Serif SC', 'Songti SC', 'PingFang SC', 'Microsoft YaHei', serif;
  font-size: clamp(22px, 3.2vw, 31px);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 6px;
}

.novel-reader-shell.show-pinyin .novel-prose-title-zh {
  line-height: 2.15;
}

.novel-prose-title-sub {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}

.novel-bi-pair {
  margin-bottom: 1.55em;
  padding-bottom: 1.25em;
  border-bottom: 1px dashed var(--border-subtle);
}

.novel-bi-pair:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.novel-prose-body .novel-zh-para {
  font-family: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  font-size: calc(var(--novel-font-size, 18px) * 1.06);
  line-height: 1.95;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  margin-bottom: 0.55em;
}

.novel-prose-body.serif .novel-zh-para {
  font-family: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
}

.novel-prose-body.mode-zh .novel-zh-para {
  margin-bottom: 1.35em;
}

.novel-prose-body.show-pinyin .novel-zh-para {
  line-height: 2.65;
  letter-spacing: 0.05em;
}

.novel-prose-body .novel-vi-para {
  font-size: calc(var(--novel-font-size, 18px) * 0.94);
  line-height: 1.82;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.novel-reader-shell ruby {
  ruby-position: over;
  ruby-align: center;
}

.novel-reader-shell ruby rt {
  display: none;
  font-family: var(--font-ui), -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.55em;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  color: var(--gold-primary);
  opacity: 0.92;
  padding: 0 2px;
  user-select: none;
}

.novel-reader-shell.show-pinyin ruby rt {
  display: ruby-text;
}

html[data-theme='light'] .novel-reader-shell ruby rt,
html[data-theme='sepia'] .novel-reader-shell ruby rt {
  color: #9e6b1e;
  opacity: 0.95;
}

.novel-chapter-pager {
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ================= SLEEK MINIMAL MEMBER LOCK SHEET (HTTP 402) ================= */

.novel-paywall-card {
  max-width: 440px;
  margin: 44px auto 0;
  padding: 28px 26px 24px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.novel-paywall-thumb {
  width: 92px;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  object-fit: cover;
  margin: 0 auto 16px;
  display: block;
  border: 1px solid var(--border-medium);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

.novel-paywall-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-primary);
  margin-bottom: 6px;
}

.novel-paywall-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.25;
}

.novel-paywall-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.novel-paywall-desc {
  margin: 16px 0 20px;
  font-size: 13.8px;
  line-height: 1.62;
  color: var(--text-secondary);
}

.novel-paywall-actions {
  display: grid;
  gap: 10px;
}

.novel-paywall-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.novel-paywall-back {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.18s ease;
}

.novel-paywall-back:hover {
  color: var(--text-primary);
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1120px) {
  .novels-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .novels-editorial-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 18px;
  }
  .novels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .novel-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .novel-detail-jacket {
    max-width: 200px;
    margin: 0 auto;
  }
  .novel-chapters-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-novels-btn {
    display: none;
  }
}

@media (max-width: 600px) {
  .home-novels-section {
    margin-top: 34px;
    padding-top: 26px;
  }
  .novels-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .novels-member-cta {
    width: 100%;
    justify-content: center;
  }
  .novels-head-right {
    width: 100%;
  }
  .novel-detail-hero {
    padding: 18px 16px;
  }
  .novel-reader-bar-inner {
    height: auto;
    min-height: 50px;
    padding: 8px 12px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .novel-reader-bar-left {
    width: 100%;
  }
  .novel-reader-tools {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
  }
  .novel-bilingual-group {
    width: 100%;
    justify-content: space-between;
  }
  .novel-reader-select {
    flex: 1 1 92px;
    min-width: 88px;
    max-width: none;
    height: 30px;
    line-height: 28px;
    font-size: 11.5px;
    padding: 0 7px;
  }
  .novel-reader-tools > .quiet-btn {
    height: 30px;
    padding: 0 7px;
    font-size: 11.2px;
    white-space: nowrap;
  }
  .novel-audio-top-btn span {
    display: none;
  }
  .novel-audio-top-btn {
    padding: 0 8px !important;
  }
  .novel-lang-btn {
    padding: 0 9px;
    font-size: 11.5px;
  }
  .novel-reader-shell {
    padding: 24px 16px 84px;
  }
  .novel-paywall-card {
    margin-top: 24px;
    padding: 24px 18px 20px;
  }
  .novel-chapter-pager {
    flex-direction: column;
    align-items: stretch;
  }
  .novel-chapter-pager > button {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 42px;
    padding: 10px 14px;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.36;
  }
}

/* ================= AUDIOBOOK PLAYER & LIVE PARAGRAPH SYNC ================= */

.novel-audio-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #14120c;
  background: linear-gradient(135deg, #f3d796, #d9ae57);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.novel-detail-audio-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold-primary);
  background: rgba(231, 194, 125, 0.14);
  border: 1px solid rgba(231, 194, 125, 0.35);
}

.novel-audio-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--gold-primary) !important;
  border-color: rgba(231, 194, 125, 0.42) !important;
}

.novel-audio-top-btn.playing {
  background: rgba(231, 194, 125, 0.18) !important;
  box-shadow: 0 0 0 1px rgba(231, 194, 125, 0.45);
}

.novel-reader-shell.has-audio-dock {
  padding-bottom: 148px;
}

.novel-prose-body.audio-clickable [data-p-idx] {
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.25s ease, border-color 0.25s ease, padding-left 0.22s ease;
}

.novel-prose-body.audio-clickable [data-p-idx]:hover {
  background: rgba(231, 194, 125, 0.06);
}

.novel-prose-body [data-p-idx].novel-para-active {
  background: rgba(231, 194, 125, 0.13) !important;
  border-left: 3px solid var(--gold-primary);
  padding: 6px 12px 6px 14px;
  margin-left: -14px;
  margin-right: -12px;
  border-radius: 0 10px 10px 0;
}

html[data-theme='light'] .novel-prose-body [data-p-idx].novel-para-active,
html[data-theme='sepia'] .novel-prose-body [data-p-idx].novel-para-active {
  background: rgba(186, 134, 42, 0.14) !important;
  border-left-color: #a6701d;
}

.novel-audio-dock {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 24px));
  z-index: 60;
  border-radius: 18px;
  background: var(--bg-reader-bar);
  border: 1px solid rgba(231, 194, 125, 0.34);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  padding: 10px 16px 11px;
}

html[data-theme='light'] .novel-audio-dock,
html[data-theme='sepia'] .novel-audio-dock {
  box-shadow: 0 12px 34px rgba(28, 22, 12, 0.18);
  border-color: rgba(158, 107, 30, 0.3);
}

.novel-audio-dock-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.novel-audio-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.novel-audio-time {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  min-width: 38px;
  text-align: center;
  user-select: none;
}

.novel-audio-seek {
  flex: 1;
  height: 5px;
  accent-color: var(--gold-primary);
  cursor: pointer;
}

.novel-audio-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.novel-audio-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.novel-audio-voice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  flex-shrink: 0;
  opacity: 0.7;
}

.novel-audio-dock.playing .novel-audio-voice-dot {
  opacity: 1;
  box-shadow: 0 0 0 4px rgba(231, 194, 125, 0.24);
  animation: naPulse 1.6s ease-in-out infinite;
}

@keyframes naPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.65; }
}

.novel-audio-voice-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.novel-audio-main-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.novel-audio-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #16130d;
  background: linear-gradient(135deg, #f3d796, #d4a64a);
  box-shadow: 0 4px 16px rgba(212, 166, 74, 0.36);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.novel-audio-play-btn:hover {
  transform: scale(1.06);
  filter: brightness(1.06);
}

.novel-audio-icon-btn {
  height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-segment);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.novel-audio-icon-btn:hover {
  border-color: var(--border-gold);
}

.novel-audio-extra-btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
}

.novel-audio-pill-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 11.2px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.novel-audio-pill-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.novel-audio-pill-btn.on {
  color: var(--gold-primary);
  border-color: rgba(231, 194, 125, 0.48);
  background: rgba(231, 194, 125, 0.14);
}

@media (max-width: 640px) {
  .novel-audio-dock {
    width: calc(100vw - 16px);
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 9px 11px 10px;
    border-radius: 15px;
  }
  .novel-audio-controls-row {
    flex-wrap: wrap;
    row-gap: 7px;
  }
  .novel-audio-info {
    order: 1;
    flex: 1 1 100%;
    justify-content: center;
  }
  .novel-audio-main-btns {
    order: 2;
  }
  .novel-audio-extra-btns {
    order: 3;
    flex: 1;
    justify-content: flex-end;
    gap: 4px;
  }
  .novel-audio-pill-btn {
    padding: 0 7px;
    font-size: 10.8px;
  }
  .novel-reader-shell.has-audio-dock {
    padding-bottom: 175px;
  }
}
