/* ==========================================================================
   Story Cinema — Ultra-Premium Netflix Story Reader CSS
   ========================================================================== */

.cinema-reader-body {
  background-color: #0e0e0e;
  color: #e5e5e5;
  min-height: 100vh;
  font-family: var(--font-main);
  letter-spacing: -0.01em;
}

/* 1. Top Reading Progress Bar */
.cinema-reading-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 10000;
}

.top-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--netflix-red);
  box-shadow: 0 0 10px var(--netflix-red-glow);
  transition: width 0.1s linear;
}

/* 2. Ultra-Clean Single-Row Topbar */
.cinema-player-topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;
  z-index: 1000;
  background: rgba(14, 14, 14, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 20px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.player-topbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0 1 320px;
}

.btn-back-netflix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-back-netflix:hover {
  background: #ffffff;
  color: #000000;
}

.topbar-story-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-story-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-chap-tag {
  font-size: 0.72rem;
  color: var(--netflix-red);
  font-weight: 700;
}

/* Center Chapter Selector */
.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 340px;
  justify-content: center;
}

.btn-chap-nav {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-chap-nav:hover:not(.is-disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.btn-chap-nav.is-disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.btn-open-toc-modal {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.btn-open-toc-modal:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Right Tools */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.topbar-tool-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.topbar-tool-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.topbar-tool-btn.is-active {
  background: var(--netflix-red);
  color: #fff;
  border-color: var(--netflix-red);
}

@media (max-width: 900px) {
  .topbar-story-info { display: none; }
  .topbar-left { flex: 0 0 auto; }
}

@media (max-width: 768px) {
  .cinema-player-topbar {
    padding: 0 8px;
    height: 52px;
  }
  .player-topbar-container {
    gap: 6px;
  }
  .topbar-left {
    flex: 0 0 auto;
  }
  .topbar-story-info {
    display: none;
  }
  .btn-back-netflix {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .btn-back-netflix .back-text {
    display: none;
  }
  .topbar-center {
    flex: 1;
    gap: 3px;
    justify-content: center;
  }
  .btn-chap-nav {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
  .btn-open-toc-modal {
    padding: 0 8px;
    font-size: 0.74rem;
    height: 30px;
    gap: 4px;
  }
  .topbar-right {
    gap: 4px;
    flex: 0 0 auto;
  }
  .topbar-tool-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
  }
  .topbar-tool-btn .tool-label {
    display: none;
  }
}

/* 3. Slide-in Table of Contents Drawer */
.cinema-toc-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-smooth);
}

.cinema-toc-drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cinema-toc-drawer {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  max-width: 88vw;
  height: 100%;
  background: #141414;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-smooth);
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.9);
}

.cinema-toc-drawer-overlay.is-open .cinema-toc-drawer {
  transform: translateX(0);
}

.toc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.toc-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toc-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.toc-search-wrap {
  position: relative;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-search-wrap i {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.toc-search-wrap input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 8px 12px 8px 36px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
}

.toc-chapters-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  color: #cccccc;
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.toc-item-row:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.toc-item-row.is-current-active {
  background: rgba(229, 9, 20, 0.15);
  color: #fff;
  font-weight: 700;
  border-left: 3px solid var(--netflix-red);
}

.toc-chap-num {
  color: var(--netflix-red);
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.toc-chap-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-now-reading {
  font-size: 0.72rem;
  color: var(--netflix-green);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

/* 4. Reading Settings Popover Modal */
.cinema-settings-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.cinema-settings-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cinema-settings-modal {
  width: 100%;
  max-width: 440px;
  background: #181818;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--transition-fast);
}

.cinema-settings-modal-overlay.is-open .cinema-settings-modal {
  transform: scale(1);
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-modal-header h4 {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  /* Thêm 27/10/2026: nút này vốn chỉ 18x23px. Khối @media (pointer: coarse) ở
     cuối tệp nới vùng chạm bằng ::after nhưng chỉ nới được chiều cao lên 44px,
     còn chiều ngang vẫn 21,2px — dưới mức 24px của WCAG 2.5.8. Nút nằm trong
     bảng cài đặt chứ không phải thanh công cụ chật, nên nới thẳng được. */
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.theme-palette-grid, .font-family-grid, .line-height-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.font-family-grid {
  grid-template-columns: repeat(2, 1fr);
}

.btn-theme-choice, .btn-font-choice, .btn-lh-choice {
  padding: 10px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-theme-choice.is-active, .btn-font-choice.is-active, .btn-lh-choice.is-active {
  border-color: var(--netflix-red);
  box-shadow: 0 0 8px var(--netflix-red-glow);
}

.font-size-stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-size-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.size-range-slider {
  flex: 1;
  accent-color: var(--netflix-red);
  cursor: pointer;
}

/* 5. Floating Audio TTS Dock (Seekable Audiobook Player) */
.cinema-audio-floating-dock {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 1000;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(229, 9, 20, 0.15);
  width: 380px;
  max-width: calc(100vw - 32px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.audio-dock-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audio-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audio-dock-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.audio-wave-anim {
  color: var(--netflix-red);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(229, 9, 20, 0.12);
  flex-shrink: 0;
}

.audio-wave-anim.is-playing {
  animation: audioPulse 1.2s infinite ease-in-out;
}

@keyframes audioPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 12px rgba(229, 9, 20, 0.6); }
}

.audio-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.audio-status-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--netflix-red);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.audio-chap-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-audio-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-audio-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Scrubber Bar Section */
.audio-scrubber-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.audio-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.audio-chunk-indicator {
  color: #fff;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

.audio-progress-bar-wrap {
  position: relative;
  width: 100%;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.audio-seek-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
  margin: 0;
}

.audio-progress-bar-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  transition: height 0.2s ease;
}

.audio-progress-bar-wrap:hover::before {
  height: 7px;
}

.audio-progress-bar-fill {
  position: absolute;
  left: 0;
  height: 5px;
  background: var(--netflix-red);
  border-radius: 3px;
  pointer-events: none;
  transition: height 0.2s ease, width 0.1s linear;
}

.audio-progress-bar-wrap:hover .audio-progress-bar-fill {
  height: 7px;
}

/* Playback Controls */
.audio-dock-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.audio-ctrl-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-audio-action {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.btn-audio-action:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.btn-audio-action.btn-audio-main-play {
  width: 36px;
  height: 36px;
  background: var(--netflix-red);
  border-color: var(--netflix-red);
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
}

.btn-audio-action.btn-audio-main-play:hover {
  background: var(--netflix-red-hover);
  transform: scale(1.08);
}

.audio-speed-pills {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
}

.btn-audio-speed {
  padding: 3px 7px;
  font-size: 0.7rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-audio-speed.is-active {
  background: #fff;
  color: #000;
}

/* Audio Paragraph Highlight in Text */
.story-reading-content p.is-audio-highlight {
  background: rgba(229, 9, 20, 0.12);
  border-left: 4px solid var(--netflix-red);
  padding-left: 14px;
  border-radius: 0 6px 6px 0;
  transition: all 0.3s ease;
}

/* Thanh công cụ trượt khỏi màn hình khi người đọc cuộn xuống.

   Trên điện thoại 375x812, thanh trên và khay dưới chiếm khoảng 120px — gần một phần
   sáu màn hình — trong suốt cả chương. Khi đang đọc xuôi thì không ai cần tới chúng;
   chỉ cần cuộn ngược lên một chút là chúng trở lại. */
.cinema-player-topbar,
.cinema-playback-dock {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}

body.reader-chrome-hidden .cinema-player-topbar {
  transform: translateY(-100%);
  opacity: 0;
}

body.reader-chrome-hidden .cinema-playback-dock {
  transform: translateY(120%);
  opacity: 0;
}

/* Khi đang phát giọng đọc hoặc tự động cuộn thì luôn giữ khay điều khiển lại,
   vì đó là lúc người dùng cần bấm dừng nhất. */
body.reader-chrome-hidden.reader-audio-active .cinema-playback-dock,
body.reader-chrome-hidden.reader-autoscroll-active .cinema-playback-dock {
  transform: none;
  opacity: 1;
}

/* 6. Main Reading Canvas */
.cinema-reader-container {
  padding-top: 80px;
  padding-bottom: 100px;
  display: flex;
  justify-content: center;
}

.cinema-screen-card {
  width: 100%;
  max-width: 780px;
  padding: 48px 40px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  transition: background-color 0.3s ease, color 0.3s ease;
}

@media (max-width: 768px) {
  .cinema-screen-card {
    padding: 24px 16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

.cinema-scene-intro {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.scene-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(229, 9, 20, 0.15);
  border: 1px solid var(--netflix-red);
  color: var(--netflix-red);
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.scene-heading {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

/* Story Content Typography */
.story-reading-content {
  font-size: 1.12rem;
  line-height: 1.85;
  color: #e5e5e5;
}

.story-reading-content.font-serif {
  font-family: 'Merriweather', Georgia, serif;
}

.story-reading-content p {
  margin-bottom: 1.6rem;
  /* Không căn đều hai bên. Trình duyệt không tự ngắt từ tiếng Việt, nên để căn đều
     thì nó chỉ còn cách giãn khoảng trắng giữa các từ — trên điện thoại, nơi mỗi dòng
     chỉ chứa khoảng 35 ký tự, các khoảng trắng đó phình to loang lổ giữa dòng và mắt
     phải liên tục dò lại chỗ đang đọc. */
  text-align: left;
  /* Tránh để dòng cuối đoạn trơ trọi một chữ. Trình duyệt chưa hỗ trợ thì bỏ qua. */
  text-wrap: pretty;
  overflow-wrap: break-word;
}

/* Drop Cap: Stylized First Letter for Chapter Opening */
.story-reading-content p:first-of-type::first-letter {
  font-size: 3.6rem;
  float: left;
  line-height: 0.82;
  margin-right: 12px;
  margin-top: 4px;
  color: var(--netflix-red);
  font-weight: 900;
  font-family: var(--font-primary, sans-serif);
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(229, 9, 20, 0.45);
}

/* Next Episode Banner Card */
.next-episode-banner-card {
  margin-top: 44px;
  padding: 30px;
  background: var(--bg-darker);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  text-align: center;
}

.next-ep-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.next-ep-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* 7. Bottom Playback Dock (Single Solid Row) */
.cinema-playback-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 56px;
  z-index: 1000;
  background: rgba(14, 14, 14, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.8);
}

.dock-inner-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.dock-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.dock-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  background: var(--netflix-red);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.dock-play-btn:hover {
  background: var(--netflix-red-hover);
}

.dock-speed-pills {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 2px;
}

.btn-speed-pill {
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  cursor: pointer;
  /* Thêm 29/10/2026: nút chọn tốc độ đọc vốn cao 21px, dưới mức 24px của
     WCAG 2.5.8. Khối @media (pointer: coarse) ở cuối tệp chỉ lo thiết bị cảm
     ứng, còn tiêu chuẩn áp cho cả chuột. Nới bằng min-height nên chữ không
     xê dịch. */
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-speed-pill.is-active {
  background: #ffffff;
  color: #000;
}

.dock-center {
  flex: 1;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dock-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.dock-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--netflix-red);
  transition: width 0.1s linear;
}

.dock-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  z-index: 10;
}

.dock-toc-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: #fff;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  transition: all var(--transition-fast);
}

.dock-toc-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--netflix-red);
}

.dot-divider {
  margin: 0 4px;
}

.dock-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.dock-step-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.dock-step-btn:hover:not(.is-disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.dock-step-btn.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .cinema-playback-dock { padding: 0 12px; height: 50px; }
  .dock-center { display: none; }
  .dock-step-btn .step-label { display: none; }
  .dock-step-btn { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 50%; }
}

/* 8. Themes */
body.reader-theme-sepia {
  background-color: #f4ecd8 !important;
  color: #433422 !important;
}
body.reader-theme-sepia .cinema-screen-card {
  background-color: #faf6eb !important;
  color: #433422 !important;
  border-color: #dcd1ba !important;
}
body.reader-theme-sepia .story-reading-content { color: #433422 !important; }
body.reader-theme-sepia .scene-heading { color: #2c2013 !important; }

body.reader-theme-white {
  background-color: #f0f0f0 !important;
  color: #111111 !important;
}
body.reader-theme-white .cinema-screen-card {
  background-color: #ffffff !important;
  color: #111111 !important;
  border-color: #dddddd !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}
body.reader-theme-white .story-reading-content { color: #111111 !important; }
body.reader-theme-white .scene-heading { color: #000000 !important; }

body.reader-theme-cyberpunk {
  background-color: #050811 !important;
  color: #c9e4ff !important;
}
body.reader-theme-cyberpunk .cinema-screen-card {
  background-color: #0b1122 !important;
  color: #c9e4ff !important;
  border-color: rgba(0, 240, 255, 0.2) !important;
}
body.reader-theme-cyberpunk .story-reading-content { color: #c9e4ff !important; }
body.reader-theme-cyberpunk .scene-heading { color: #00f0ff !important; }

/* Lights Out Mode (OLED Pure Black) */
body.theater-lights-off {
  background-color: #000000 !important;
}
body.theater-lights-off .cinema-screen-card {
  background-color: #060606 !important;
  border-color: #141414 !important;
  box-shadow: 0 0 60px rgba(0, 0, 0, 1) !important;
}
body.theater-lights-off .cinema-player-topbar {
  opacity: 0.15;
}
body.theater-lights-off .cinema-player-topbar:hover {
  opacity: 1;
}
body.theater-lights-off .cinema-playback-dock {
  opacity: 0.25;
}
body.theater-lights-off .cinema-playback-dock:hover {
  opacity: 1;
}

/* ==========================================================================
   Vùng chạm trên thiết bị cảm ứng

   Các nút điều khiển rộng 28–32px, đã đạt mức tối thiểu 24px của WCAG 2.2 AA nhưng vẫn
   nhỏ so với đầu ngón tay. Thanh công cụ trên màn hình 375px chỉ còn khoảng 16px trống,
   nên không thể nới ngang thành 44px: làm vậy thì vùng bấm của các nút liền kề chồng lên
   nhau và người dùng bấm nhầm sang nút bên cạnh. Vì thế chỉ nới theo chiều dọc — nơi còn
   chỗ — và nới ngang đúng bằng nửa khoảng cách giữa hai nút.
   ========================================================================== */
@media (pointer: coarse) {
  .btn-back-netflix,
  .btn-chap-nav,
  .topbar-tool-btn,
  .toc-close-btn,
  .settings-close-btn,
  .btn-size-step,
  .btn-audio-action,
  .btn-audio-close {
    position: relative;
  }

  .btn-back-netflix::after,
  .btn-chap-nav::after,
  .topbar-tool-btn::after,
  .toc-close-btn::after,
  .settings-close-btn::after,
  .btn-size-step::after,
  .btn-audio-action::after,
  .btn-audio-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(100% + 2px);
    height: 44px;
    transform: translate(-50%, -50%);
    border-radius: inherit;
  }

  /* Nút có nhãn chữ thì nới thẳng chiều cao, không cần lớp phủ. */
  .btn-open-toc-modal,
  .btn-speed-pill,
  .btn-audio-speed,
  .btn-font-choice {
    min-height: 44px;
  }
}

/* ==========================================================================
   Trình đọc trên màn hình rất hẹp (≤ 420px)

   Ở 320px thanh công cụ trên cần 339px và thanh điều khiển dưới cần 352px, nên nút
   "Tắt đèn" và cả hai nút chuyển chương ở dock bị đẩy ra ngoài mép — không bấm được.
   Bỏ bớt phần trùng lặp thay vì thu nhỏ tất cả: hai mũi tên chuyển chương đã có sẵn ở
   dock dưới, còn nút tự động cuộn thì biểu tượng đủ để hiểu.

   Ngưỡng 380px: thanh công cụ cần khoảng 355px kể cả lề, nên từ 390px trở lên (iPhone
   14, 15, các máy Android phổ thông) vẫn đủ chỗ giữ nguyên đầy đủ nút.
   ========================================================================== */
@media (max-width: 380px) {
  .topbar-center .btn-chap-nav {
    display: none;
  }

  .btn-open-toc-modal {
    max-width: 150px;
  }

  .player-topbar-container {
    gap: 4px;
  }

  .topbar-right {
    gap: 2px;
  }

  /* Nút tự động cuộn thu về biểu tượng; nhãn chữ đã lặp lại ý nghĩa của icon play. */
  #autoscroll-status-text {
    display: none;
  }

  .dock-play-btn {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .dock-inner-container {
    gap: 8px;
  }

  .dock-speed-pills {
    gap: 2px;
  }

  .btn-speed-pill {
    padding: 4px 7px;
    font-size: 0.72rem;
  }
}

/* Nút giọng đọc khi thiết bị không có giọng phù hợp.
   Vẫn bấm được để hiện lời giải thích, nhưng nhìn là biết ngay tính năng chưa dùng
   được — giọng đọc do hệ điều hành cung cấp, trang web không tự cài thay được. */
.topbar-tool-btn.is-unavailable {
  opacity: 0.4;
}
