/* ==========================================================================
   NovelCraft Studio // Realistic 2-Page Book Spread & Print Typography
   ========================================================================== */

.spread-toolbar {
  height: 52px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
}

.spread-controls-left, .spread-controls-center, .spread-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spread-info {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(229, 169, 60, 0.1);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(229, 169, 60, 0.2);
}

.view-mode-toggles {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: 6px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-toggle.active {
  background: var(--bg-card);
  color: #fff;
  font-weight: 600;
}

.btn-page-nav {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-page-nav:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: var(--accent-gold);
}

.page-scrubber {
  width: 140px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 2px 6px;
}

.font-size-control button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 11px;
}

.font-size-control button:hover {
  color: #fff;
}

#font-size-indicator {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-main);
}

/* Book Stage & Presentation Chamber */
.book-stage {
  flex: 1;
  background: radial-gradient(circle at 50% 45%, #181f2c 0%, #0a0d13 85%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 30px;
  position: relative;
  perspective: 1600px;
}

/* Realistic 3D Hardcover Book Container */
.book-container {
  position: relative;
  display: flex;
  background: #fdfbf7;
  border-radius: 6px 12px 12px 6px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 10px 30px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  max-width: 1040px;
  width: 100%;
  height: 680px;
  max-height: 680px;
  overflow: hidden;
  align-items: stretch;
  flex-shrink: 0;
}

.book-container.single-page-mode {
  max-width: 540px;
}

.book-container.single-page-mode .left-page {
  display: none;
}

.book-container.single-page-mode .book-gutter-shadow {
  display: none;
}

/* Leather Hardcover Border simulation */
.book-container::before {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -8px;
  right: -8px;
  background: linear-gradient(135deg, #1e1b18 0%, #2c251f 100%);
  border-radius: 8px 14px 14px 8px;
  z-index: -1;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.85);
}

/* Book Spine / Binding Left Edge */
.book-spine-binding {
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -12px;
  width: 16px;
  background: linear-gradient(90deg, #15120f 0%, #3a322a 50%, #1a1613 100%);
  border-radius: 6px 0 0 6px;
  z-index: 1;
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.6);
}

/* Facing Pages */
.book-page {
  flex: 1;
  width: 50%;
  height: 100%;
  max-height: 100%;
  background: #fdfbf7;
  color: #1a1a1a;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.left-page {
  border-radius: 4px 0 0 4px;
  background: linear-gradient(90deg, #f0ebe1 0%, #fcfbf9 8%, #fdfbf7 95%, #eae3d6 100%);
}

.right-page {
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, #eae3d6 0%, #fdfbf7 5%, #fcfbf9 92%, #f0ebe1 100%);
}

/* Book Gutter & Spine Center Shadow */
.book-gutter-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 32px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, 
    rgba(0,0,0,0.15) 0%, 
    rgba(0,0,0,0.3) 45%, 
    rgba(0,0,0,0.35) 50%, 
    rgba(0,0,0,0.3) 55%, 
    rgba(0,0,0,0.15) 100%
  );
  pointer-events: none;
  z-index: 5;
}

/* Page Inner Layout */
.page-inner {
  flex: 1;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 30px 38px 24px 38px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Running Heads & Chapter Folios */
.page-running-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-serif);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  border-bottom: 1px solid #e2ded4;
  padding-bottom: 6px;
  margin-bottom: 18px;
  user-select: none;
  flex-shrink: 0;
  height: 22px;
}

.header-book-title, .header-author-name {
  font-weight: 600;
  color: #444;
}

.header-chapter-title, .header-scene-beat {
  font-style: italic;
  color: #777;
}

/* Page Content Body */
.page-body-content {
  flex: 1;
  outline: none;
  font-family: 'Spectral', Georgia, serif;
  font-size: 15px;
  line-height: 1.65;
  color: #242220;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  overflow: visible; /* Prevents browser contenteditable auto-scroll from shifting text up */
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  position: relative;
  padding-top: 4px;
  padding-bottom: 10px;
  margin-bottom: 6px;
}

.page-body-content p {
  margin-bottom: 0.9em;
  text-indent: 1.8em;
}

.page-body-content p:first-of-type {
  text-indent: 0;
}

/* Literary Drop-Cap on Chapter Opening */
.page-body-content.chapter-opener p:first-of-type::first-letter {
  font-family: 'Cinzel', serif;
  font-size: 3.4em;
  float: left;
  line-height: 0.8;
  margin: 0.1em 0.15em 0 0;
  color: #8c2514;
  font-weight: 700;
}

.chapter-title-heading {
  text-align: center;
  margin-bottom: 18px;
  margin-top: 4px;
}

.chapter-number-label {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #8c2514;
  margin-bottom: 4px;
}

.chapter-main-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.5px;
}

/* Page Footer with Centered Number & Word Meter */
.page-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #e2ded4;
  margin-top: auto;
  user-select: none;
  flex-shrink: 0;
  height: 26px;
}

.page-number {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 600;
  color: #555;
}

.page-word-meter {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #888;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.page-word-meter.good {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.2);
}

.page-word-meter.near-full {
  color: #d97706;
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.3);
}

.page-word-meter.overflow {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
  font-weight: 700;
}

/* Typography Classes */
.font-serif-spectral { font-family: 'Spectral', Georgia, serif !important; }
.font-serif-playfair { font-family: 'Playfair Display', Georgia, serif !important; }
.font-serif-lora { font-family: 'Lora', Georgia, serif !important; }
.font-serif-cinzel { font-family: 'Cinzel', Georgia, serif !important; }
.font-sans-inter { font-family: 'Inter', sans-serif !important; }

/* Print Margins & Bleed Guides Overlay */
.show-print-margins .page-inner {
  outline: 1px dashed rgba(220, 38, 38, 0.4);
  position: relative;
}

.show-print-margins .page-inner::after {
  content: "PRINT MARGIN GUIDE (0.75in)";
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 9px;
  font-family: var(--font-mono);
  color: rgba(220, 38, 38, 0.6);
  pointer-events: none;
}

/* ==========================================================================
   Book Physical Size & Trim Format Simulation
   ========================================================================== */
/* Children's Picture Book: Large, Expansive Landscape / Square 8.5"x8.5" */
.book-container.size-children_picture {
  max-width: 1180px;
  height: 590px;
  max-height: 590px;
}

.book-container.size-children_picture .page-inner {
  padding: 28px 32px;
}

.book-container.size-children_picture .page-body-content {
  font-size: 18px;
  line-height: 1.8;
}

/* Standard Trade Paperback 6"x9" (Teen, YA, Adult) */
.book-container.size-trade_6x9 {
  max-width: 1040px;
  height: 680px;
  max-height: 680px;
}

/* Digest 5.5"x8.5" (Thrillers, Crime, Literary) */
.book-container.size-digest_55x85 {
  max-width: 940px;
  height: 650px;
  max-height: 650px;
}

/* Mass Market Paperback 4.25"x6.87" */
.book-container.size-mass_market {
  max-width: 840px;
  height: 610px;
  max-height: 610px;
}

/* Royal Hardcover 6.14"x9.21" */
.book-container.size-hardcover_royalty {
  max-width: 1080px;
  height: 700px;
  max-height: 700px;
}

/* ==========================================================================
   Illustration & Artwork Layout Engine
   ========================================================================== */
.book-illustration-wrapper {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

.book-illustration-wrapper img {
  display: block;
  max-width: 100%;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

/* Full-Page Bleed (Children's Picture Book Artwork Page) */
.book-illustration-wrapper.layout-full {
  margin: 0;
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.book-illustration-wrapper.layout-full img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Half-Page Top Header */
.book-illustration-wrapper.layout-half {
  margin-bottom: 18px;
  width: 100%;
}

.book-illustration-wrapper.layout-half img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}

/* Spot Illustration - Floated Left */
.book-illustration-wrapper.layout-spot-left {
  float: left;
  margin: 4px 18px 12px 0;
  max-width: 45%;
}

/* Spot Illustration - Floated Right */
.book-illustration-wrapper.layout-spot-right {
  float: right;
  margin: 4px 0 12px 18px;
  max-width: 45%;
}

/* Chapter Opening Vignette */
.book-illustration-wrapper.layout-vignette {
  margin: 8px auto 20px auto;
  max-width: 60%;
}

.book-illustration-wrapper.layout-vignette img {
  max-height: 140px;
}

/* Artwork Caption */
.illustration-caption {
  font-family: var(--font-serif);
  font-size: 11px;
  font-style: italic;
  color: #666;
  text-align: center;
  margin-top: 6px;
  max-width: 90%;
  line-height: 1.4;
}

/* Artwork preview in Studio modal */
.art-preview-container {
  width: 100%;
  height: 180px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.art-preview-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Age-Appropriate Safety Guardrail Badge */
.age-safety-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 6px;
  color: #86efac;
  font-size: 11px;
  margin-bottom: 12px;
}

.age-safety-badge.teen {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: #bae6fd;
}

.age-safety-badge.adult {
  background: rgba(229, 169, 60, 0.12);
  border-color: rgba(229, 169, 60, 0.3);
  color: #fde68a;
}

/* FAL.AI Status Bar */
.fal-status-box {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fal-status-box.loading {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.fal-status-box.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.fal-status-box.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ==========================================================================
   Multi-Layer Storybook Illustration Studio Styles
   ========================================================================== */

.btn-deck-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-deck-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-deck-tab.active {
  color: #0f172a;
  background: var(--accent-gold);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(229, 169, 60, 0.3);
}

.bg-preset-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}

.bg-preset-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.bg-preset-thumb {
  width: 100%;
  height: 70px;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-preset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-preset-info {
  padding: 6px 8px;
}

.bg-preset-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.bg-preset-desc {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Pose Card */
.pose-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pose-card:hover {
  border-color: var(--accent-gold);
  background: rgba(229, 169, 60, 0.08);
  transform: scale(1.02);
}

.pose-card-thumb {
  width: 50px;
  height: 55px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.pose-card-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.pose-card-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.pose-card-desc {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}

/* Prop Card */
.prop-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.prop-card:hover {
  border-color: var(--accent-gold);
  background: rgba(229, 169, 60, 0.1);
  transform: translateY(-2px);
}

.prop-thumb {
  width: 100%;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.prop-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.prop-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Layer Item in Stack */
.layer-item-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.layer-item-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.layer-item-card.active {
  border-color: var(--accent-gold);
  background: rgba(229, 169, 60, 0.12);
  box-shadow: 0 0 0 1px var(--accent-gold);
}

.layer-thumb-wrap {
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.layer-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.layer-info {
  flex: 1;
  min-width: 0;
}

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

.layer-type-badge {
  font-size: 9px;
  color: var(--accent-gold);
  opacity: 0.85;
}

.layer-actions {
  display: flex;
  gap: 4px;
}

.btn-layer-tool {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
}

.btn-layer-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-layer-tool.active {
  color: var(--accent-gold);
}

.btn-layer-tool.text-danger:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   Front Matter & Publishing Pages (Title, Copyright, Dedication, Table of Contents)
   ========================================================================== */

/* Title Page */
.book-title-page-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  min-height: 480px;
  text-align: center;
  padding: 30px 10px;
  user-select: none;
}

.title-page-header {
  margin-top: 20px;
}

.title-page-main-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #1a1612;
  text-transform: uppercase;
  margin-bottom: 8px;
  line-height: 1.25;
}

.title-page-subtitle {
  font-family: 'Spectral', Georgia, serif;
  font-size: 14px;
  font-style: italic;
  color: #645a4e;
  letter-spacing: 0.5px;
}

.title-page-ornament {
  font-size: 20px;
  color: #8c2514;
  margin: 24px 0;
  opacity: 0.85;
  filter: drop-shadow(0 1px 2px rgba(140, 37, 20, 0.15));
}

.title-page-author-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.author-prefix {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #78716c;
}

.author-name-styled {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: #27272a;
  letter-spacing: 1px;
}

.title-page-footer {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.publisher-imprint-styled {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #44403c;
}

.edition-label {
  font-family: 'Spectral', Georgia, serif;
  font-size: 11px;
  font-style: italic;
  color: #78716c;
}

/* Copyright Page */
.book-copyright-page-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-height: 480px;
  padding: 20px 10px;
  font-family: 'Spectral', Georgia, serif;
  font-size: 10px;
  line-height: 1.5;
  color: #57534e;
  user-select: none;
}

.copyright-header-block {
  margin-bottom: 14px;
}

.copyright-book-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 12px;
  color: #292524;
  margin-bottom: 2px;
}

.copyright-notice {
  font-weight: 600;
  color: #44403c;
}

.copyright-rights {
  color: #78716c;
}

.copyright-publisher-block {
  margin-bottom: 12px;
}

.copyright-publisher-block p {
  margin-bottom: 2px;
  text-indent: 0 !important;
}

.copyright-disclaimer-block {
  margin-bottom: 12px;
  font-style: italic;
  color: #78716c;
  background: rgba(0, 0, 0, 0.02);
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid #d6d3d1;
}

.copyright-cip-block {
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(0, 0, 0, 0.03);
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  color: #44403c;
  line-height: 1.4;
}

.cip-heading {
  font-weight: 700;
  font-size: 8.5px;
  text-transform: uppercase;
  color: #78716c;
  margin-bottom: 2px;
}

.copyright-safety-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 9.5px;
  font-weight: 600;
  color: #15803d;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.copyright-footer-line {
  font-size: 9px;
  color: #a8a29e;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Dedication Page */
.book-dedication-page-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-height: 480px;
  padding: 40px 20px;
  text-align: center;
  user-select: none;
}

.dedication-ornament {
  font-size: 18px;
  color: #8c2514;
  margin-bottom: 20px;
  opacity: 0.8;
}

.dedication-text {
  font-family: 'Spectral', Georgia, serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.7;
  color: #292524;
  max-width: 80%;
  margin-bottom: 24px;
}

.dedication-rule {
  width: 40px;
  height: 1px;
  background: #d6d3d1;
  margin: 0 auto;
}

/* Table of Contents (TOC) Page */
.book-toc-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 480px;
  padding: 15px 8px;
  user-select: none;
}

.toc-header {
  text-align: center;
  margin-bottom: 22px;
}

.toc-main-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #1c1917;
  margin-bottom: 4px;
}

.toc-ornament {
  font-size: 14px;
  color: #8c2514;
  opacity: 0.8;
}

.toc-entries-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.toc-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.toc-entry:hover {
  background: rgba(140, 37, 20, 0.08);
  transform: translateX(2px);
}

.toc-entry-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  max-width: 75%;
}

.toc-chap-num {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #8c2514;
  letter-spacing: 1px;
}

.toc-chap-title {
  font-family: 'Spectral', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  color: #292524;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-dot-leader {
  flex: 1;
  border-bottom: 1px dotted #a8a29e;
  margin: 0 8px;
  height: 1px;
  opacity: 0.6;
}

.toc-page-pill {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #44403c;
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.toc-entry:hover .toc-page-pill {
  background: #8c2514;
  color: #fff;
  border-color: #8c2514;
}

.toc-empty-notice {
  text-align: center;
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  color: #a8a29e;
  padding: 30px;
}

/* ==========================================================================
   Cover Studio Modal & 3D Jacket Preview
   ========================================================================== */
.cover-studio-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 860px) {
  .cover-studio-layout {
    grid-template-columns: 1fr;
  }
}

.cover-presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.cover-preset-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cover-preset-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  color: #fff;
}

.cover-preset-chip.active {
  background: rgba(229, 169, 60, 0.15);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  font-weight: 600;
}

/* 3D Book Jacket Preview */
.cover-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #1c2433 0%, #0c0f15 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 24px;
  min-height: 380px;
  position: relative;
  overflow: hidden;
}

.cover-3d-wrapper {
  position: relative;
  width: 200px;
  height: 290px;
  perspective: 1200px;
  transition: transform 0.3s ease;
}

.cover-3d-wrapper:hover {
  transform: scale(1.03) rotateY(-8deg);
}

.cover-3d-book {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 4px 8px 8px 4px;
  box-shadow: 
    -8px 8px 24px rgba(0, 0, 0, 0.6),
    0 15px 35px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  background: #1e1b18;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cover-3d-book img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-3d-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 10px;
  background: linear-gradient(90deg, rgba(0,0,0,0.6) 0%, rgba(255,255,255,0.1) 40%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
}

.cover-3d-overlay {
  position: absolute;
  inset: 0;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 40%, rgba(0,0,0,0.7) 100%);
  color: #fff;
  pointer-events: none;
}

.cover-overlay-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
}

.cover-overlay-author {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
}

/* Quick TOC Modal List */
.quick-toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
}

.quick-toc-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  transform: translateX(4px);
}

.quick-toc-item .chapter-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-toc-item .chapter-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(229, 169, 60, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.quick-toc-item .chapter-title {
  font-weight: 600;
  font-size: 13px;
}

.quick-toc-item .page-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 12px;
}

/* ==========================================================================
   Multi-Layer Book Cover Plate & Exterior Hardcover Mode
   ========================================================================== */
.book-container.closed-cover-mode {
  max-width: 530px !important;
  width: 530px !important;
  border-radius: 4px 14px 14px 4px !important;
  box-shadow: 
    -14px 14px 40px rgba(0, 0, 0, 0.75),
    0 25px 60px rgba(0, 0, 0, 0.8),
    inset -3px 0 6px rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.book-container.closed-cover-mode.size-children_picture {
  max-width: 590px !important;
  width: 590px !important;
  height: 590px !important;
}

.book-container.closed-cover-mode.size-trade_6x9 {
  max-width: 520px !important;
  width: 520px !important;
  height: 680px !important;
}

.book-container.closed-cover-mode.size-digest_55x85 {
  max-width: 475px !important;
  width: 475px !important;
  height: 650px !important;
}

/* Spine binding overlay on the left of closed book exterior */
.book-container.closed-cover-mode::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 22px;
  background: linear-gradient(90deg, rgba(0,0,0,0.7) 0%, rgba(255,255,255,0.18) 35%, rgba(0,0,0,0.55) 100%);
  z-index: 10;
  pointer-events: none;
  border-radius: 4px 0 0 4px;
}

/* 3D Page block rim on the right edge of closed book */
.book-container.closed-cover-mode::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: -10px;
  width: 10px;
  background: repeating-linear-gradient(180deg, #f5f0e6 0px, #e8dfcf 2px, #d8cdb8 3px);
  border-radius: 0 4px 4px 0;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.4);
  z-index: -1;
}

.book-container.closed-cover-mode .left-page {
  flex: 1;
  border-right: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.book-container.closed-cover-mode .right-page,
.book-container.closed-cover-mode .book-gutter-shadow {
  display: none !important;
}

.book-container.closed-cover-mode .page-inner {
  padding: 0 !important;
  background: transparent !important;
}

.book-container.closed-cover-mode .page-running-head,
.book-container.closed-cover-mode .page-footer {
  display: none !important;
}

.front-matter-page.page-type-cover {
  padding: 0 !important;
  overflow: hidden;
  position: relative;
  height: 100%;
  border-radius: 4px 12px 12px 4px;
}

.book-cover-plate-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px 12px 12px 4px;
}

.book-cover-plate-wrapper .jacket-bg-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-plate-wrapper .jacket-typography-layer {
  padding: 34px 28px;
}

.book-cover-plate-wrapper .jacket-title.size-compact { font-size: 18px; }
.book-cover-plate-wrapper .jacket-title.size-standard { font-size: 24px; }
.book-cover-plate-wrapper .jacket-title.size-large { font-size: 30px; }
.book-cover-plate-wrapper .jacket-title.size-xl { font-size: 36px; }

.book-cover-plate-wrapper .jacket-genre-tag {
  font-size: 10.5px;
  padding: 3px 12px;
}

.book-cover-plate-wrapper .jacket-accolade-badge {
  font-size: 11.5px;
  padding: 4px 14px;
}

.book-cover-plate-wrapper .jacket-subtitle {
  font-size: 14px;
}

.book-cover-plate-wrapper .jacket-author {
  font-size: 13px;
  letter-spacing: 2px;
}

.book-cover-plate-wrapper .jacket-imprint-mini {
  font-size: 9.5px;
  letter-spacing: 1.5px;
}



