/* ============================================================
   STORIMU - Reader styles
   ============================================================ */
.reader-body { background: var(--bg, #F2F9FF); }
.reader-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.reader-back { flex: 0 0 auto; color: var(--text); display: grid; place-items: center; }
.reader-head-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reader-story { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-chapter { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-main { max-width: 680px; margin: 0 auto; padding: 18px 18px 60px; }

.reader-chapter-title { font-size: 22px; font-weight: 800; line-height: 1.3; }
.reader-meta { display: flex; gap: 8px; color: var(--text-muted); font-size: 12px; margin: 8px 0 22px; }
.reader-audio { padding: 20px; margin: 0 0 28px; border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(135deg, var(--bg-elev), var(--bg-card)); }
.reader-audio-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.reader-audio-icon { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px; color: #fff; background: var(--primary); }
.reader-audio-heading h2 { font-size: 15px; font-weight: 800; }
.reader-audio-heading p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.reader-audio-badge { margin-left: auto; font-size: 10px; padding: 5px 9px; border-radius: 20px; border: 1px solid var(--border); color: var(--text-muted); }
.reader-audio-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.reader-audio-status { font-size: 11px; line-height: 1.6; color: var(--text-muted); margin-top: 12px; }
.episode-gesture { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 0 0 14px 14px; touch-action: none; user-select: none; }
.episode-gesture span { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1.6; }
.episode-gesture button { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); color: var(--text); font-size: 20px; }
.episode-gesture button:disabled { opacity: .35; }
.video-wrap:fullscreen { display: flex; flex-direction: column; width: 100vw; height: 100vh; background: #000; }
.video-wrap:fullscreen > .youtube-player,
.video-wrap:fullscreen > .local-video-player { flex: 1; min-height: 0; aspect-ratio: auto; }
.video-wrap:fullscreen [data-player-status] { background: #000; color: #fff; margin: 0; }
.video-wrap:fullscreen .episode-gesture { flex: 0 0 auto; border-radius: 0; }
.reader-content {
  font-family: 'Lora', Georgia, serif;
  font-size: var(--reader-font-size, 18px);
  line-height: var(--reader-line-height, 1.85);

  color: var(--reader-text, #14324A);
  word-wrap: break-word;
  filter: brightness(var(--reader-brightness, 1));
}
.reader-content p { margin-bottom: 1.1em; }
.reader-content h2, .reader-content h3 { margin: 1.4em 0 .6em; font-family: 'Plus Jakarta Sans', sans-serif; }
.reader-content img { margin: 1em 0; border-radius: 10px; }
.reader-content blockquote { border-left: 3px solid var(--primary); padding-left: 14px; color: var(--text-muted); font-style: italic; margin: 1em 0; }

/* Locked */
.reader-locked { text-align: center; padding: 48px 20px; background: var(--bg-elev); border-radius: 20px; border: 1px solid var(--border); }
.reader-locked .lock-icon { font-size: 40px; margin-bottom: 10px; }
.reader-locked h2 { font-size: 20px; margin-bottom: 6px; }
.reader-locked p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.lock-price { font-size: 24px; font-weight: 800; color: var(--secondary); margin-bottom: 6px; }
.lock-balance { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }

/* Nav */
.reader-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 36px; }
.reader-nav-btn { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 3px; min-height: 62px; }
.reader-nav-btn.next { text-align: right; }
.reader-nav-btn.disabled { opacity: .4; }
.reader-nav-label { font-size: 11px; color: var(--primary); font-weight: 700; }
.reader-nav-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Drawer */
.reader-drawer { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; }
.reader-drawer[hidden] { display: none; }
.reader-drawer-panel { width: 100%; max-width: 680px; max-height: 82vh; overflow-y: auto; margin: 0 auto; background: var(--bg-elev); border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
.reader-drawer-panel h3 { font-size: 15px; margin-bottom: 16px; }
.reader-setting { margin-bottom: 18px; }
.reader-setting label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.reader-size-btns, .reader-theme-btns { display: flex; gap: 8px; }
.reader-size-btns button, .reader-theme-btns button {
  flex: 1; padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: inherit; font-weight: 700; cursor: pointer;
}
.reader-size-btns button.active, .reader-theme-btns button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.reader-setting-hint { color: var(--text-muted); font-size: 11px; margin-top: 5px; }
.reader-setting input[type="range"] { width: 100%; accent-color: var(--primary); }

/* Themes applied to body */
body.reader-body[data-reader-theme="dark"] {
  --bg: #111820;
  --bg-elev: #1b2732;
  --bg-card: #253543;
  --text: #e6edf3;
  --text-muted: #a5b6c4;
  --border: #344654;
  background: var(--bg);
  color: var(--text);
}
body[data-reader-theme="dark"] .reader-header { background: rgba(24,34,44,.96); border-color: var(--border); }
body[data-reader-theme="dark"] .reader-content { --reader-text: #e0e7ed; }
body[data-reader-theme="dark"] .reader-chapter-title,
body[data-reader-theme="dark"] .reader-chapter,
body[data-reader-theme="dark"] .reader-story,
body[data-reader-theme="dark"] .reader-back { color: #e6edf3; }
body[data-reader-theme="dark"] .reader-drawer-panel,
body[data-reader-theme="dark"] .reader-locked,
body[data-reader-theme="dark"] .reader-nav-btn,
body[data-reader-theme="dark"] .profile-section { background: var(--bg-elev); color: var(--text); border-color: var(--border); }
body[data-reader-theme="dark"] .bottom-nav { background: rgba(24,34,44,.97); border-color: var(--border); }
body[data-reader-theme="dark"] .nav-item { color: var(--text-muted); }
body[data-reader-theme="dark"] .nav-item.active { color: var(--primary); }
body[data-reader-theme="sepia"] { background: #F5ECD9; }
body[data-reader-theme="sepia"] .reader-header { background: rgba(245,236,217,.92); border-color: #E0D2B5; }
body[data-reader-theme="sepia"] .reader-content { --reader-text: #4A3F2E; }
body[data-reader-theme="sepia"] .reader-chapter-title,
body[data-reader-theme="sepia"] .reader-chapter,
body[data-reader-theme="sepia"] .reader-story { color: #4A3F2E; }

body[data-reader-theme="light"] { background: #FFFFFF; }
body[data-reader-theme="light"] .reader-header { background: rgba(255,255,255,.95); border-color: #E5E5E5; }
body[data-reader-theme="light"] .reader-content { --reader-text: #1A1A1A; }
body[data-reader-theme="light"] .reader-chapter-title,
body[data-reader-theme="light"] .reader-chapter,
body[data-reader-theme="light"] .reader-story { color: #1A1A1A; }
body[data-reader-theme="light"] .reader-back { color: #1A1A1A; }
.reader-main { padding-bottom: 110px; }
.youtube-player,
.local-video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}
.youtube-player iframe,
.local-video-player video {
  display: block;
  width: 100%;
  height: 100%;
}
.youtube-player iframe {
  border: 0;
}
.youtube-player:fullscreen,
.local-video-player:fullscreen,
.youtube-player:-webkit-full-screen,
.local-video-player:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
}
.youtube-player:fullscreen iframe,
.local-video-player:fullscreen video,
.youtube-player:-webkit-full-screen iframe,
.local-video-player:-webkit-full-screen video {
  width: 100%;
  height: 100%;
}
.youtube-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  background: rgb(0 0 0 / 30%);
  color: #fff;
  font-size: 30px;
  cursor: pointer;
}
.youtube-play-overlay span {
  font-size: 14px;
  font-weight: 700;
}
.youtube-play-overlay[hidden] {
  display: none;
}
