/* ==========================================================================
   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.free {
  color: #f4efe6;
  border-color: rgba(255, 255, 255, 0.24);
}

.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;
  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;
}

.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 {
    padding: 0 12px;
    gap: 8px;
  }
  .novel-reader-select {
    max-width: 120px;
  }
  .novel-reader-shell {
    padding: 24px 16px 84px;
  }
  .novel-paywall-card {
    margin-top: 24px;
    padding: 24px 18px 20px;
  }
}
