/* ==========================================================================
   The Wayfarer’s Hearth — Design System
   Tailored for iPhone 13/18 Pro Max & iPad Pro M4 (Tandem OLED)
   ========================================================================== */

:root,
[data-theme="hearth"] {
  --bg-primary: #14100d;
  --bg-secondary: #1d1713;
  --bg-card: #241c17;
  --bg-elevated: rgba(36, 28, 23, 0.88);
  --bg-glass: rgba(24, 18, 14, 0.84);
  --text-primary: #f5ead8;
  --text-secondary: #c9b59c;
  --text-muted: #8f7b66;
  --accent-amber: #e89b48;
  --accent-gold: #f5c26b;
  --accent-dragon: #d6653c;
  --accent-crimson: #9b3b28;
  --accent-sage: #6f8f72;
  --border-subtle: rgba(245, 216, 178, 0.11);
  --border-warm: rgba(232, 155, 72, 0.32);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.45);
  --glow-lantern: 0 0 28px rgba(232, 155, 72, 0.18);
  --reader-bg: #16110e;
  --reader-text: #f3e6d3;
  --reader-DropCap: #e89b48;
}

/* Pure 0-nit black for iPhone Pro Max OLED & iPad Pro M4 Tandem OLED */
[data-theme="oled"] {
  --bg-primary: #000000;
  --bg-secondary: #0a0806;
  --bg-card: #120e0b;
  --bg-elevated: rgba(18, 14, 11, 0.92);
  --bg-glass: rgba(8, 6, 5, 0.88);
  --text-primary: #ede0ce;
  --text-secondary: #b39f88;
  --text-muted: #756553;
  --accent-amber: #e59642;
  --accent-gold: #f0bc65;
  --accent-dragon: #cf5f36;
  --accent-crimson: #9b3b28;
  --accent-sage: #67876a;
  --border-subtle: rgba(245, 216, 178, 0.09);
  --border-warm: rgba(229, 150, 66, 0.28);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.85);
  --glow-lantern: 0 0 24px rgba(229, 150, 66, 0.14);
  --reader-bg: #000000;
  --reader-text: #e8dac6;
  --reader-DropCap: #e59642;
}

/* Warm Bellflower Daylight Parchment */
[data-theme="parchment"] {
  --bg-primary: #f6efe2;
  --bg-secondary: #ede2cf;
  --bg-card: #fffaf0;
  --bg-elevated: rgba(255, 250, 240, 0.92);
  --bg-glass: rgba(246, 239, 226, 0.88);
  --text-primary: #2b1e16;
  --text-secondary: #5c4636;
  --text-muted: #8a705b;
  --accent-amber: #b8621b;
  --accent-gold: #9c5114;
  --accent-dragon: #b84421;
  --accent-crimson: #8c2f1c;
  --accent-sage: #4a6b4d;
  --border-subtle: rgba(73, 52, 41, 0.12);
  --border-warm: rgba(184, 98, 27, 0.28);
  --shadow-soft: 0 10px 28px rgba(73, 52, 41, 0.1);
  --glow-lantern: 0 4px 20px rgba(184, 98, 27, 0.12);
  --reader-bg: #fbf5e9;
  --reader-text: #2a1d15;
  --reader-DropCap: #9b3b28;
}

:root {
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-serif: 'Newsreader', 'Lora', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --reader-font: var(--font-serif);
  --reader-size: 1.18rem;
  --reader-line-height: 1.82;
  --reader-para-gap: 1.35em;
  --reader-max-width: 68ch;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

button, input, select {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* ==========================================================================
   App Shell: Responsive iPhone Pro Max + iPad Pro M4 Architecture
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100dvh;
  width: 100%;
  position: relative;
}

/* iPad Pro M4 Studio Sidebar (Hidden on iPhone, visible in iPad Mode) */
.ipad-sidebar {
  display: none;
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: calc(var(--safe-top) + 1rem) 1.1rem calc(var(--safe-bottom) + 1.25rem) calc(var(--safe-left) + 1.1rem);
  flex-direction: column;
  gap: 1.15rem;
  height: 100dvh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 40;
  transition: margin-left 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

body.device-ipad .ipad-sidebar {
  display: flex;
}

body.device-ipad.sidebar-collapsed .ipad-sidebar {
  margin-left: -300px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border-warm);
  box-shadow: var(--glow-lantern);
}

.sidebar-brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--accent-gold);
}

.sidebar-brand-text span {
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.18s ease;
  text-align: left;
}

.sidebar-nav-btn:hover {
  background: rgba(232, 155, 72, 0.08);
  color: var(--text-primary);
}

.sidebar-nav-btn.active {
  background: rgba(232, 155, 72, 0.16);
  color: var(--accent-gold);
  border: 1px solid var(--border-warm);
}

.sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-top: 0.4rem;
  padding: 0 0.4rem;
  font-weight: 600;
}

.sidebar-episodes-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-ep-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-align: left;
  transition: all 0.18s ease;
}

.sidebar-ep-item:hover,
.sidebar-ep-item.active {
  border-color: var(--border-warm);
  transform: translateY(-1px);
}

.sidebar-ep-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--accent-amber);
  font-weight: 600;
}

.sidebar-ep-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-ep-progress {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.2rem;
}

.sidebar-ep-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dragon), var(--accent-gold));
  border-radius: 99px;
}

/* Sidebar Hearth Status Widget */
.sidebar-ledger-card {
  margin-top: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.85rem;
  font-size: 0.8rem;
}

.sidebar-ledger-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ledger-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.28rem 0;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--border-subtle);
}

.ledger-stat-row:last-child {
  border-bottom: none;
}

/* ==========================================================================
   Main Content Viewport
   ========================================================================== */

.main-viewport {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--safe-bottom) + 5.5rem);
}

body.device-ipad .main-viewport {
  padding-bottom: calc(var(--safe-bottom) + 4.5rem);
}

/* Top Progress Bar (Fixed at very top of screen) */
.reading-progress-track {
  position: fixed;
  top: var(--safe-top);
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}

.reading-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-crimson), var(--accent-amber), var(--accent-gold));
  box-shadow: 0 0 10px var(--accent-amber);
  transition: width 0.1s linear;
}

/* Sticky Top Header Bar */
.top-header {
  position: sticky;
  top: 0;
  z-index: 35;
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  padding: calc(var(--safe-top) + 0.65rem) calc(var(--safe-right) + 1rem) 0.65rem calc(var(--safe-left) + 1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

body.distraction-free .top-header {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.header-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--border-warm);
}

.header-titles {
  min-width: 0;
}

.header-series-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.icon-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.72rem;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.18s ease;
}

.icon-pill-btn:hover,
.icon-pill-btn.active {
  border-color: var(--border-warm);
  color: var(--accent-gold);
  background: rgba(232, 155, 72, 0.13);
}

/* ==========================================================================
   Home View: Hero Poster, Continue Reading, Anime OP & Episode Cards
   ========================================================================== */

.view-section {
  display: none;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.1rem calc(var(--safe-right) + 1rem) 2rem calc(var(--safe-left) + 1rem);
  animation: fadeIn 0.25s ease;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Banner Card */
.hero-showcase {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--border-warm);
  box-shadow: var(--shadow-soft), var(--glow-lantern);
  background: #100c09;
  margin-bottom: 1.35rem;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .hero-showcase {
    grid-template-columns: 320px 1fr;
    min-height: 390px;
  }
}

.hero-art-wrap {
  position: relative;
  height: 360px;
  overflow: hidden;
}

@media (min-width: 760px) {
  .hero-art-wrap {
    height: 100%;
  }
}

.hero-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  display: block;
  transition: transform 0.6s ease;
}

.hero-showcase:hover .hero-art-wrap img {
  transform: scale(1.02);
}

.hero-art-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #14100d 4%, rgba(20, 16, 13, 0.2) 55%, transparent 100%);
}

@media (min-width: 760px) {
  .hero-art-gradient {
    background: linear-gradient(to right, transparent 65%, #14100d 100%);
  }
}

.hero-content {
  padding: 1.35rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
  background: linear-gradient(145deg, rgba(29, 23, 19, 0.96), rgba(20, 16, 13, 0.98));
  color: #f5ead8;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #f5c26b;
  font-weight: 600;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  font-weight: 700;
  line-height: 1.08;
  color: #fff6e8;
}

.hero-motto {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: #e89b48;
  letter-spacing: 0.06em;
}

.hero-synopsis {
  font-size: 0.92rem;
  line-height: 1.62;
  color: #d4c1a9;
  max-width: 60ch;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.btn-primary-lantern {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.78rem 1.25rem;
  border-radius: 13px;
  background: linear-gradient(135deg, #e89b48, #c9642b);
  color: #17100b;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(232, 155, 72, 0.32);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.btn-primary-lantern:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(232, 155, 72, 0.45);
}

.btn-secondary-warm {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.78rem 1.15rem;
  border-radius: 13px;
  background: rgba(245, 216, 178, 0.1);
  border: 1px solid rgba(245, 216, 178, 0.24);
  color: #f5ead8;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.16s ease;
}

.btn-secondary-warm:hover {
  background: rgba(245, 216, 178, 0.18);
  border-color: #f5c26b;
}

/* Continue Reading Banner */
.continue-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(214, 101, 60, 0.16), rgba(232, 155, 72, 0.1));
  border: 1px solid var(--border-warm);
  border-radius: 16px;
  padding: 0.95rem 1.15rem;
  margin-bottom: 1.35rem;
}

.continue-banner.visible {
  display: flex;
}

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

.continue-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--accent-amber);
  font-weight: 700;
}

.continue-ep-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.continue-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Section Headers */
.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.75rem;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Episode Cards Grid */
.episodes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

@media (min-width: 720px) {
  .episodes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.episode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.episode-card:hover {
  border-color: var(--border-warm);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.episode-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.episode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  background: rgba(232, 155, 72, 0.15);
  color: var(--accent-amber);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.episode-stats {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.episode-card-title {
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.episode-card-excerpt {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-card-footer {
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.ep-read-cta {
  color: var(--accent-gold);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ep-progress-pill {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Next Episode Placeholder Card */
.episode-card.upcoming {
  border-style: dashed;
  opacity: 0.82;
  cursor: default;
}

/* ==========================================================================
   Reader View: iPhone Pro Max Scroll + iPad Pro M4 2-Page Book & Split Modes
   ========================================================================== */

.reader-view-wrap {
  width: 100%;
  background: var(--reader-bg);
  min-height: calc(100dvh - 60px);
  transition: background-color 0.25s ease;
}

.reader-toolbar {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}

.reader-layout-Workspace {
  display: flex;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  gap: 1.5rem;
  justify-content: center;
}

.reader-article-container {
  flex: 1;
  width: 100%;
  max-width: var(--reader-max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

@media (min-width: 768px) {
  .reader-article-container {
    padding: 2.8rem 2.5rem 5rem;
  }
}

/* iPad Pro M4 2-Column Hardcover Book Spread Mode */
body.ipad-book-mode .reader-article-container {
  max-width: 1180px;
  height: calc(100dvh - 175px);
  overflow: hidden;
  padding: 1.75rem 2.5rem;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  margin-top: 0.75rem;
  box-shadow: var(--shadow-soft);
}

body.ipad-book-mode .reader-prose {
  column-count: 2;
  column-gap: 3.5rem;
  column-rule: 1px solid var(--border-subtle);
  column-fill: auto;
  height: 100%;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.book-pagination-controls {
  display: none;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0.65rem auto 0;
  padding: 0 0.5rem;
}

body.ipad-book-mode .book-pagination-controls {
  display: flex;
}

/* iPad Pro M4 Story + Companion Split Mode */
.reader-companion-pane {
  display: none;
  width: 350px;
  flex-shrink: 0;
  padding: 1.75rem 1.25rem 3rem 0;
}

body.ipad-split-mode .reader-companion-pane {
  display: block;
}

.companion-sticky {
  position: sticky;
  top: 4.8rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100dvh - 7rem);
  overflow-y: auto;
}

.companion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1rem;
}

.companion-card img {
  width: 100%;
  border-radius: 11px;
  margin-bottom: 0.65rem;
  cursor: zoom-in;
}

/* Reader Typography */
.reader-ep-header {
  text-align: center;
  margin-bottom: 2.4rem;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--border-subtle);
}

.reader-ep-kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-amber);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.reader-ep-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.65rem;
}

.reader-ep-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.reader-prose {
  font-family: var(--reader-font);
  font-size: var(--reader-size);
  line-height: var(--reader-line-height);
  color: var(--reader-text);
  letter-spacing: 0.008em;
}

.reader-prose p {
  margin-bottom: var(--reader-para-gap);
  text-rendering: optimizeLegibility;
}

/* Cozy Drop Cap on First Paragraph */
.reader-prose > p:first-of-type::first-letter {
  font-family: var(--font-display);
  float: left;
  font-size: 3.45em;
  line-height: 0.82;
  padding-right: 0.12em;
  padding-top: 0.04em;
  color: var(--reader-DropCap);
  font-weight: 700;
}

.reader-prose em {
  font-style: italic;
  color: var(--accent-gold);
}

[data-theme="parchment"] .reader-prose em {
  color: var(--accent-crimson);
}

.reader-prose hr {
  border: none;
  text-align: center;
  margin: 2.2rem 0;
}

.reader-prose hr::after {
  content: "✦   ✦   ✦";
  color: var(--accent-amber);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
}

.reader-end-card {
  margin-top: 3rem;
  padding: 1.6rem;
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-warm);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.reader-end-card img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-amber);
}

/* ==========================================================================
   Typography & Theme Settings Drawer / Sheet
   ========================================================================== */

.settings-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 80;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.settings-drawer-backdrop.open {
  display: flex;
}

.settings-sheet {
  width: 100%;
  max-width: 540px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-warm);
  border-radius: 22px 22px 0 0;
  padding: 1.35rem 1.35rem calc(var(--safe-bottom) + 1.5rem);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

@media (min-width: 768px) {
  .settings-drawer-backdrop {
    align-items: center;
  }
  .settings-sheet {
    border-radius: 22px;
    border: 1px solid var(--border-warm);
    padding: 1.5rem;
  }
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.settings-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

.segmented-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 0.45rem;
}

.seg-btn {
  padding: 0.62rem 0.65rem;
  border-radius: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  transition: all 0.16s ease;
}

.seg-btn.active {
  border-color: var(--accent-amber);
  color: var(--accent-gold);
  background: rgba(232, 155, 72, 0.15);
}

/* ==========================================================================
   Anime Opening ("Where the Lanterns Glow") Full View & Synced Lyrics
   ========================================================================== */

.music-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.35rem;
}

@media (min-width: 820px) {
  .music-stage {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }
}

.music-turntable-card {
  background: var(--bg-card);
  border: 1px solid var(--border-warm);
  border-radius: 22px;
  padding: 1.35rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 5rem;
}

.album-cover-wrap {
  position: relative;
  width: 230px;
  height: 230px;
  margin: 0 auto 1.1rem;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--border-warm);
  box-shadow: var(--glow-lantern);
}

.album-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.equalizer-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.eq-bar {
  width: 3px;
  height: 4px;
  background: var(--accent-amber);
  border-radius: 2px;
  transition: height 0.2s ease;
}

body.audio-playing .eq-bar:nth-child(1) { animation: eqBounce 0.6s infinite alternate; }
body.audio-playing .eq-bar:nth-child(2) { animation: eqBounce 0.45s 0.15s infinite alternate; }
body.audio-playing .eq-bar:nth-child(3) { animation: eqBounce 0.7s 0.25s infinite alternate; }
body.audio-playing .eq-bar:nth-child(4) { animation: eqBounce 0.5s 0.05s infinite alternate; }

@keyframes eqBounce {
  from { height: 4px; }
  to { height: 16px; }
}

.audio-scrubber-wrap {
  margin: 1rem 0 0.75rem;
}

.audio-range {
  width: 100%;
  accent-color: var(--accent-amber);
  height: 5px;
  cursor: pointer;
}

.audio-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.lyrics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 1.4rem;
  max-height: 70dvh;
  overflow-y: auto;
}

.lyric-stanza {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  margin-bottom: 0.65rem;
  transition: all 0.25s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.lyric-stanza:hover {
  background: rgba(232, 155, 72, 0.06);
}

.lyric-stanza.active {
  background: rgba(232, 155, 72, 0.14);
  border-left-color: var(--accent-amber);
}

.lyric-jp {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.22rem;
}

.lyric-en {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   World, Cast & Artwork Gallery View
   ========================================================================== */

.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.cast-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cast-role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
  font-weight: 700;
}

.cast-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cast-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.art-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.15rem;
}

.art-frame {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.art-frame:hover {
  transform: translateY(-2px);
  border-color: var(--border-warm);
}

.art-frame img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}

.art-caption {
  padding: 0.85rem 1rem;
}

.art-caption h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text-primary);
}

.art-caption p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox-modal.open {
  display: flex;
}

.lightbox-modal img {
  max-width: 95vw;
  max-height: 88dvh;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   Persistent Mini OP Audio Bar & iPhone Bottom Tab Bar
   ========================================================================== */

.mini-audio-bar {
  position: fixed;
  left: calc(var(--safe-left) + 0.75rem);
  right: calc(var(--safe-right) + 0.75rem);
  bottom: calc(var(--safe-bottom) + 4.35rem);
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-elevated);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-warm);
  border-radius: 16px;
  padding: 0.55rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  z-index: 45;
  box-shadow: var(--shadow-soft);
  transition: transform 0.28s ease, opacity 0.28s ease;
}

body.device-ipad .mini-audio-bar {
  bottom: calc(var(--safe-bottom) + 0.85rem);
  left: auto;
  right: 1.25rem;
  width: 380px;
}

body.distraction-free .mini-audio-bar {
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
}

.mini-audio-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  cursor: pointer;
}

.mini-audio-left img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--border-warm);
}

.mini-song-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-song-sub {
  font-size: 0.7rem;
  color: var(--accent-amber);
}

.mini-audio-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.play-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-amber);
  color: #16100b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* iPhone Pro Max Bottom Navigation Bar */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 0.45rem calc(var(--safe-right) + 0.75rem) calc(var(--safe-bottom) + 0.45rem) calc(var(--safe-left) + 0.75rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 50;
  transition: transform 0.28s ease;
}

body.device-ipad .mobile-bottom-nav {
  display: none;
}

body.distraction-free .mobile-bottom-nav {
  transform: translateY(100%);
}

.mob-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.2rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 10px;
}

.mob-nav-btn.active {
  color: var(--accent-gold);
}

.mob-nav-icon {
  font-size: 1.15rem;
  line-height: 1;
}
