/* ==========================================================================
   TRUYỆN DỊCH VIP - READER & CUPERTINO DESIGN SYSTEM
   Modern iOS 18 PWA Stylesheet: Typography, Cupertino Sheets & Music Player
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=Literata:ital,opsz,wght@0,7..72,400;0,7..72,600;0,7..72,700;1,7..72,400&family=Merriweather:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ios-blue: #007AFF;
  --ios-green: #34C759;
  --ios-orange: #EA580C;
  --ios-card-bg: #FFFFFF;
  --ios-subtext: #8E8E93;
  --ios-border: rgba(60, 60, 67, 0.12);

  /* Theme Defaults: Giấy Ngà (Vintage Ivory - Default) */
  --reader-bg: #F5EEDB;
  --reader-text: #382B22;
  --reader-sub: rgba(56, 43, 34, 0.6);
  --reader-border: rgba(56, 43, 34, 0.15);
  --reader-card: rgba(255, 255, 255, 0.5);

  /* Typography Defaults */
  --reader-font: "Georgia", "Bookerly", "Literata", serif;
  --reader-size: 18px;
  --reader-line: 1.75;
  --reader-weight: 400;
  --reader-indent: 1.5em;
  --reader-align: justify;
}

/* 4 Core Reader Themes */
body.theme-ivory {
  --reader-bg: #F5EEDB;
  --reader-text: #382B22;
  --reader-sub: rgba(56, 43, 34, 0.6);
  --reader-border: rgba(56, 43, 34, 0.15);
  --reader-card: rgba(255, 255, 255, 0.6);
}

body.theme-white {
  --reader-bg: #FFFFFF;
  --reader-text: #1F2937;
  --reader-sub: #6B7280;
  --reader-border: #E5E7EB;
  --reader-card: #F9FAFB;
}

body.theme-dark {
  --reader-bg: #1C1C1E;
  --reader-text: #D1D1D6;
  --reader-sub: #8E8E93;
  --reader-border: rgba(255, 255, 255, 0.12);
  --reader-card: #2C2C2E;
}

body.theme-oled {
  --reader-bg: #000000;
  --reader-text: #8E8E93;
  --reader-sub: #636366;
  --reader-border: rgba(255, 255, 255, 0.08);
  --reader-card: #121212;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background-color: #F2F2F7;
  color: #000000;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background-color: #F2F2F7;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

@media (min-width: 768px) {
  #app {
    max-width: 768px;
  }
}

/* ==========================================================================
   1. EXPLORE & BOOKSHELF SCREENS
   ========================================================================== */
.header-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(242, 242, 247, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: max(12px, var(--safe-top)) 16px 12px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #111827;
}

.novel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 16px;
  padding-bottom: calc(100px + var(--safe-bottom));
}

@media (min-width: 600px) {
  .novel-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.novel-card {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}

.novel-card:active {
  transform: scale(0.98);
}

.novel-cover-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #E5E7EB;
  position: relative;
}

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

.novel-info-box {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.novel-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.novel-meta {
  font-size: 0.75rem;
  color: #6B7280;
  margin-top: 6px;
}

/* Bottom Tab Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(60, 60, 67, 0.12);
  display: flex;
  justify-content: space-around;
  padding: 8px 16px calc(8px + var(--safe-bottom));
  z-index: 80;
}

@media (min-width: 768px) {
  .bottom-nav {
    max-width: 768px;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #8E8E93;
  background: none;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 16px;
}

.nav-item.active {
  color: var(--ios-orange);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* ==========================================================================
   2. NOVEL DETAIL MODAL VIEW
   ========================================================================== */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #F2F2F7;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: calc(100px + var(--safe-bottom));
}

.detail-modal.active {
  display: flex;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: max(12px, var(--safe-top)) 16px 12px;
  background: rgba(242, 242, 247, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

.icon-btn {
  background: none;
  border: none;
  color: #111827;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background 0.15s;
}

.icon-btn:active {
  background: rgba(0, 0, 0, 0.06);
}

.detail-hero {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.detail-cover {
  width: 130px;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  object-fit: cover;
  margin-bottom: 14px;
}

.detail-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 4px;
}

.detail-author {
  font-size: 0.85rem;
  color: #6B7280;
  margin-bottom: 12px;
}

.detail-stats-row {
  display: flex;
  gap: 16px;
  background: #FFFFFF;
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 16px;
  width: 100%;
  max-width: 440px;
  justify-content: space-around;
}

.detail-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
}

.stat-label {
  font-size: 0.7rem;
  color: #8E8E93;
}

.detail-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 16px;
  margin: 0 16px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.detail-synopsis {
  font-size: 0.88rem;
  color: #374151;
  line-height: 1.6;
}

.detail-toc-trigger {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #F3F4F6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: #111827;
  cursor: pointer;
}

.detail-toc-trigger span:last-child {
  color: var(--ios-blue);
  font-weight: 600;
}

/* Sticky Action Bar on Novel Detail */
.detail-sticky-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(60, 60, 67, 0.12);
  padding: 10px 16px calc(10px + var(--safe-bottom));
  display: flex;
  gap: 12px;
  z-index: 120;
  pointer-events: auto !important;
}

@media (min-width: 768px) {
  .detail-sticky-bar {
    max-width: 768px;
  }
}

.sticky-read-btn {
  flex: 1;
  height: 50px;
  border-radius: 99px;
  background: var(--ios-orange);
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.sticky-read-btn:active {
  transform: scale(0.98);
}

.sticky-audio-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #F3F4F6;
  color: #111827;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   3. READER VIEW & TYPOGRAPHY (SCREENSHOT 2)
   ========================================================================== */
.reader-view {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: var(--reader-bg);
  color: var(--reader-text);
  display: none;
  flex-direction: column;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.reader-view.active {
  display: flex;
}

/* Reader Top Minimal Bar */
.reader-top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: max(10px, var(--safe-top)) 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  user-select: none;
}

.reader-sub-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--reader-sub);
  opacity: 0.65;
  letter-spacing: 0.3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.reader-top-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reader-tool-icon-btn {
  background: none;
  border: none;
  color: var(--reader-text);
  opacity: 0.85;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.reader-tool-icon-btn:active {
  transform: scale(0.9);
  opacity: 1;
}

/* Scrollable Reading Content */
.reader-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 10px 24px calc(60px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.reader-content-box {
  max-width: 680px;
  margin: 0 auto;
}

/* Centered Elegant Serif Chapter Title (Screenshot 2) */
.reader-heading {
  font-family: var(--reader-font);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  color: var(--reader-text);
  margin-top: 14px;
  margin-bottom: 28px;
  padding: 0 10px;
}

/* Reading Paragraphs */
.reader-body {
  font-family: var(--reader-font);
  font-size: var(--reader-size);
  line-height: var(--reader-line);
  font-weight: var(--reader-weight);
  color: var(--reader-text);
  text-align: var(--reader-align);
  text-justify: inter-word;
}

.reader-body p {
  text-indent: var(--reader-indent);
  margin-bottom: 0.85em;
  word-break: break-word;
}

.reader-body p.highlighted {
  background: rgba(234, 88, 12, 0.18);
  border-radius: 4px;
  padding: 2px 4px;
}

/* Footer Page/Progress Indicator (Screenshot 2: "1/16") */
.reader-footer-progress {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--reader-sub);
  opacity: 0.6;
  margin-top: 40px;
  margin-bottom: 20px;
  user-select: none;
}

/* Next Chapter Navigation Card */
.reader-next-nav {
  text-align: center;
  padding: 24px 0 40px;
}

.reader-next-btn {
  background: var(--ios-orange);
  color: #FFFFFF;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 32px;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  touch-action: manipulation;
}

/* Empty / Error Action Card */
.empty-action-card {
  background: var(--reader-card);
  border: 1px solid var(--reader-border);
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  margin: 30px auto;
  max-width: 460px;
}

.empty-icon-box {
  width: 56px;
  height: 56px;
  background: rgba(234, 88, 12, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--ios-orange);
}

.empty-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--reader-text);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 0.85rem;
  color: var(--reader-sub);
  line-height: 1.5;
  margin-bottom: 20px;
}

.empty-btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.empty-btn {
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.empty-btn.primary {
  background: var(--ios-orange);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

.empty-btn.secondary {
  background: rgba(0, 0, 0, 0.08);
  color: var(--reader-text);
}

/* ==========================================================================
   4. IOS CUPERTINO READING SETTINGS SHEET (SCREENSHOT 1)
   ========================================================================== */
.cupertino-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cupertino-sheet-overlay.active {
  display: block;
  opacity: 1;
}

.cupertino-sheet-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  background: #F2F2F7;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  z-index: 310;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: calc(16px + var(--safe-bottom));
  max-height: 85vh;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .cupertino-sheet-panel {
    max-width: 560px;
  }
}

.cupertino-sheet-panel.active {
  transform: translateX(-50%) translateY(0%);
}

/* Cupertino Header (Hủy - Cài đặt hiển thị - Xong) */
.cupertino-nav-header {
  position: sticky;
  top: 0;
  background: rgba(242, 242, 247, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.18);
  z-index: 20;
}

.cupertino-nav-btn {
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 8px;
}

.cupertino-nav-btn.cancel {
  color: var(--ios-blue);
  font-weight: 500;
}

.cupertino-nav-btn.done {
  color: var(--ios-blue);
  font-weight: 700;
}

.cupertino-nav-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

/* iOS Grouped Inset Card */
.cupertino-group {
  background: #FFFFFF;
  border-radius: 14px;
  margin: 14px 16px 0;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cupertino-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 48px;
  position: relative;
}

.cupertino-row:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 0;
  height: 0.5px;
  background: rgba(60, 60, 67, 0.12);
}

.cupertino-row-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cupertino-row-label svg, .cupertino-row-label span.badge-icon {
  width: 20px;
  font-weight: 700;
}

/* iOS Cupertino Switch (Green Toggle) */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #E5E5EA;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 31px;
}

.ios-slider::before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.ios-switch input:checked + .ios-slider {
  background-color: var(--ios-green);
}

.ios-switch input:checked + .ios-slider::before {
  transform: translateX(20px);
}

/* Segmented Control (Nhỏ / Vừa / Lớn) */
.segmented-control {
  display: flex;
  background: #E5E5EA;
  padding: 2px;
  border-radius: 9px;
  width: 170px;
}

.segment-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 5px 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #111827;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.segment-btn.active {
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Font Selector Dropdown */
.font-select {
  border: none;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ios-blue);
  cursor: pointer;
  padding-right: 4px;
  outline: none;
  text-align-last: right;
}

/* Color Presets Palette */
.palette-row {
  display: flex;
  gap: 12px;
}

.palette-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.palette-circle.active {
  border-color: var(--ios-blue);
  transform: scale(1.1);
}

.palette-circle.ivory {
  background: #F5EEDB;
}
.palette-circle.white {
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}
.palette-circle.dark {
  background: #1C1C1E;
}
.palette-circle.oled {
  background: #000000;
}

/* Font Size Stepper (A- / A+) */
.stepper-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper-btn {
  width: 36px;
  height: 32px;
  border: 1px solid #D1D1D6;
  background: #FFFFFF;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111827;
}

.stepper-btn:active {
  background: #E5E5EA;
}

.stepper-value {
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 38px;
  text-align: center;
}

/* ==========================================================================
   5. FULLSCREEN MUSIC AUDIO PLAYER (SCREENSHOT 3)
   ========================================================================== */
.music-player-view {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: #0D0D11;
  color: #FFFFFF;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: max(16px, var(--safe-top)) 24px calc(20px + var(--safe-bottom));
  overflow: hidden;
}

.music-player-view.active {
  display: flex;
}

/* Blurred Album Art Backdrop */
.music-player-backdrop {
  position: absolute;
  inset: -30px;
  background-size: cover;
  background-position: center;
  filter: blur(50px) brightness(0.4);
  -webkit-filter: blur(50px) brightness(0.4);
  z-index: 1;
  opacity: 0.85;
  transform: scale(1.1);
}

.music-player-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

/* Player Top Nav */
.player-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-chevron-down {
  background: none;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 8px;
}

.player-now-playing {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

/* Centered Square Book Cover with Glow */
.player-artwork-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
}

.player-artwork {
  width: 250px;
  height: 250px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 60px rgba(234, 88, 12, 0.25);
}

@media (min-height: 750px) {
  .player-artwork {
    width: 280px;
    height: 280px;
  }
}

/* Track Metadata */
.player-meta-box {
  text-align: center;
  margin-bottom: 16px;
}

.player-novel-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.player-ch-title {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.65);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Scrubber Seek Bar */
.player-scrubber-box {
  margin-bottom: 20px;
}

.player-seek-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.25);
  outline: none;
  cursor: pointer;
}

.player-seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.player-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Center Controls: -30, Big Play/Pause, +30 */
.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-bottom: 20px;
}

.player-skip-btn {
  background: none;
  border: none;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  width: 48px;
  height: 48px;
}

.player-skip-btn span {
  position: absolute;
  font-size: 0.68rem;
  font-weight: 800;
  top: 17px;
}

.player-play-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #FFFFFF;
  color: #000000;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s;
}

.player-play-btn:active {
  transform: scale(0.92);
}

/* Speed Pill Button */
.player-speed-row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.player-speed-pill {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: none;
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 99px;
  cursor: pointer;
}

/* Bottom Strip: 5 Circular Icons (<, >, ☰, 📖, ⚙) */
.player-bottom-strip {
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px;
}

.player-strip-icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #FFFFFF;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.player-strip-icon:active {
  background: rgba(255, 255, 255, 0.25);
}

/* Mini Audio Player Floating Bar */
.mini-audio-bar {
  position: fixed;
  bottom: calc(75px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  max-width: 448px;
  margin: 0 auto;
  background: rgba(28, 28, 30, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #FFFFFF;
  border-radius: 16px;
  padding: 8px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.mini-audio-bar.active {
  display: flex;
}

.mini-thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  margin-right: 10px;
}

.mini-meta {
  flex: 1;
  min-width: 0;
}

.mini-title {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-sub {
  font-size: 0.7rem;
  color: #8E8E93;
}

/* ==========================================================================
   6. TOC MODAL (MỤC LỤC CHƯƠNG)
   ========================================================================== */
.toc-modal-view {
  position: fixed;
  inset: 0;
  z-index: 280;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.toc-modal-view.active {
  display: flex;
}

.toc-drawer-panel {
  background: #FFFFFF;
  width: 100%;
  max-width: 480px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(16px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}

.toc-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #F3F4F6;
}

.toc-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
}

.toc-list-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
  font-size: 0.88rem;
  color: #111827;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto !important;
}

.chapter-item:active {
  background-color: #F3F4F6;
}

.chapter-item.active {
  color: var(--ios-orange);
  font-weight: 700;
  background-color: rgba(234, 88, 12, 0.08);
}


/* ==========================================================================
   MODULE: SIMPLE AUTH, ADVANCED 3-TIER SEARCH & SCRAPING STUDIO
   ========================================================================== */

/* Top Header Profile & Search Styles */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(60, 60, 67, 0.15);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-user-btn:active {
  transform: scale(0.96);
  background: rgba(0, 0, 0, 0.1);
}

.user-avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ios-green);
}

/* 3-Tier Search Bar */
.search-container {
  padding: 8px 16px 12px 16px;
  position: relative;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(60, 60, 67, 0.12);
  border-radius: 14px;
  padding: 0 12px;
  transition: border-color 0.2s, background 0.2s;
}

body.theme-dark .search-input-wrap,
body.theme-oled .search-input-wrap {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.search-input-wrap:focus-within {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--ios-orange);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

body.theme-dark .search-input-wrap:focus-within,
body.theme-oled .search-input-wrap:focus-within {
  background: #2C2C2E;
}

.search-icon {
  color: var(--ios-subtext);
  margin-right: 8px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 0.92rem;
  font-family: inherit;
  color: inherit;
  outline: none;
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--ios-subtext);
  padding: 4px;
  cursor: pointer;
  display: none;
}

/* Search Dropdown Panel */
.search-results-panel {
  display: none;
  margin-top: 10px;
  background: var(--reader-bg);
  border: 1px solid var(--reader-border);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 480px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 100;
  padding: 12px;
}

.search-results-panel.active {
  display: block;
}

.search-section-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ios-subtext);
  margin: 8px 4px 6px 4px;
}

/* Tier 1: Local Item */
.search-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-item-card:hover,
.search-item-card:active {
  background: rgba(0, 0, 0, 0.05);
}

body.theme-dark .search-item-card:active,
body.theme-oled .search-item-card:active {
  background: rgba(255, 255, 255, 0.08);
}

.search-thumb {
  width: 44px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.search-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-sub {
  font-size: 0.78rem;
  color: var(--ios-subtext);
  margin-top: 2px;
}

/* Tier 2: Detected Raw URL Card */
.raw-url-card {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.08), rgba(234, 88, 12, 0.03));
  border: 1.5px dashed var(--ios-orange);
  border-radius: 12px;
  padding: 14px;
  margin: 6px 0 12px 0;
}

.raw-url-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ios-orange);
}

.raw-url-link {
  font-size: 0.75rem;
  color: var(--ios-subtext);
  word-break: break-all;
  margin: 6px 0 10px 0;
  font-family: monospace;
}

.raw-import-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 14px;
  background: var(--ios-orange);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.raw-import-btn:active {
  opacity: 0.85;
}

/* Tier 3: Foreign Source Results */
.foreign-results-box {
  margin-top: 10px;
  border-top: 1px solid var(--reader-border);
  padding-top: 10px;
}

.btn-trigger-foreign-search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: rgba(0, 122, 255, 0.08);
  border: 1px solid rgba(0, 122, 255, 0.2);
  color: var(--ios-blue);
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  margin: 6px 0;
}

/* Scraping Studio Screen */
.studio-container {
  padding: 16px;
  padding-bottom: 90px;
}

.studio-badges-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--reader-card);
  border: 1px solid var(--reader-border);
}

.badge-pill.success {
  color: var(--ios-green);
  border-color: rgba(52, 199, 89, 0.3);
}

.badge-pill.warning {
  color: var(--ios-orange);
  border-color: rgba(234, 88, 12, 0.3);
}

.studio-input-card {
  background: var(--reader-card);
  border: 1px solid var(--reader-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 18px;
}

.studio-input-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.studio-input-group {
  display: flex;
  gap: 8px;
}

.studio-input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--reader-border);
  background: var(--reader-bg);
  color: inherit;
  font-size: 0.88rem;
  outline: none;
}

.studio-input:focus {
  border-color: var(--ios-orange);
}

.studio-start-btn {
  padding: 11px 18px;
  background: var(--ios-orange);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}

.studio-start-btn:active {
  opacity: 0.85;
}

/* Active Scraping Novel Cards */
.studio-novels-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-novel-card {
  display: flex;
  flex-direction: column;
  background: var(--reader-card);
  border: 1px solid var(--reader-border);
  border-radius: 16px;
  padding: 14px;
  gap: 12px;
}

.studio-card-top {
  display: flex;
  gap: 12px;
}

.studio-cover {
  width: 58px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.studio-meta {
  flex: 1;
  min-width: 0;
}

.studio-title-vi {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
}

.studio-title-zh {
  font-size: 0.8rem;
  color: var(--ios-subtext);
  margin-top: 2px;
}

.studio-author {
  font-size: 0.78rem;
  color: var(--ios-subtext);
  margin-top: 4px;
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ios-subtext);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

body.theme-dark .progress-bar-track,
body.theme-oled .progress-bar-track {
  background: rgba(255, 255, 255, 0.12);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ios-orange), #F59E0B);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.studio-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.studio-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--reader-border);
  background: var(--reader-bg);
  color: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}

.studio-btn.primary {
  background: var(--ios-orange);
  color: #FFFFFF;
  border-color: var(--ios-orange);
}

.studio-btn:active {
  opacity: 0.8;
}

/* ==========================================================================
   CUPERTINO AUTH MODAL
   ========================================================================== */
.cupertino-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cupertino-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.cupertino-auth-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--reader-bg);
  border-radius: 24px 24px 0 0;
  padding: 20px 24px calc(24px + var(--safe-bottom)) 24px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--reader-text);
}

.cupertino-modal-backdrop.active .cupertino-auth-sheet {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .cupertino-modal-backdrop {
    align-items: center;
  }
  .cupertino-auth-sheet {
    border-radius: 24px;
    padding: 24px;
  }
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.auth-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.auth-close-btn {
  background: rgba(0, 0, 0, 0.07);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1rem;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Segmented Tabs */
.auth-segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 18px;
}

body.theme-dark .auth-segmented-control,
body.theme-oled .auth-segmented-control {
  background: rgba(255, 255, 255, 0.12);
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ios-subtext);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: #FFFFFF;
  color: #000000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

body.theme-dark .auth-tab-btn.active,
body.theme-oled .auth-tab-btn.active {
  background: #2C2C2E;
  color: #FFFFFF;
}

/* Auth Input Fields */
.auth-input-group {
  display: flex;
  flex-direction: column;
  background: var(--reader-card);
  border: 1px solid var(--reader-border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
}

.auth-field {
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}

.auth-field:not(:last-child) {
  border-bottom: 1px solid var(--reader-border);
}

.auth-field::placeholder {
  color: var(--ios-subtext);
}

.auth-submit-btn {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  background: var(--ios-orange);
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.auth-submit-btn:active {
  opacity: 0.88;
  transform: scale(0.98);
}

.auth-message {
  font-size: 0.82rem;
  margin-top: 10px;
  text-align: center;
  min-height: 18px;
}

.auth-message.error {
  color: #EF4444;
}

.auth-message.success {
  color: var(--ios-green);
}

/* Logged-In Profile Card */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0;
}

.profile-avatar-large {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ios-orange), #F59E0B);
  color: #FFFFFF;
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.3);
}

.profile-username {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.profile-badge {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(52, 199, 89, 0.15);
  color: var(--ios-green);
  font-weight: 700;
  margin-bottom: 18px;
}

.profile-stats-row {
  display: flex;
  width: 100%;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-stat-box {
  flex: 1;
  background: var(--reader-card);
  border: 1px solid var(--reader-border);
  border-radius: 14px;
  padding: 12px;
}

.profile-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ios-orange);
}

.profile-stat-label {
  font-size: 0.72rem;
  color: var(--ios-subtext);
  margin-top: 2px;
  font-weight: 600;
}

.profile-logout-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: #EF4444;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.profile-logout-btn:active {
  opacity: 0.8;
}

/* ==========================================================================
   FEATURE: TOP 20 TRENDING RAW NOVELS SHOWCASE (2 HORIZONTAL ROWS)
   ========================================================================== */
.trending-showcase-section {
  padding: 12px 14px 18px 14px;
  background: var(--reader-card);
  border-top: 1px solid var(--reader-border);
  border-bottom: 1px solid var(--reader-border);
  margin-top: 10px;
  margin-bottom: 10px;
}

.trending-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.trending-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: inherit;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trending-sub {
  font-size: 0.74rem;
  color: var(--ios-subtext);
  margin: 3px 0 0 0;
  line-height: 1.3;
}

.trending-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid var(--ios-border);
  background: rgba(0, 0, 0, 0.04);
  color: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.trending-refresh-btn:active {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0.96);
}

.trending-carousel-container {
  display: flex;
  flex-direction: column;
}

.trending-row-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ios-subtext);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding: 0 2px;
}

.trending-row-indicator {
  font-size: 0.65rem;
  color: var(--ios-orange);
  font-weight: 600;
}

.trending-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.trending-row::-webkit-scrollbar {
  display: none;
}

/* Responsive Card Width: 3.2 visible on mobile, 6.2 visible on desktop */
.trending-card {
  flex: 0 0 calc((100% - 24px) / 3.25);
  min-width: 105px;
  max-width: 140px;
  scroll-snap-align: start;
  background: var(--ios-card-bg);
  border: 1px solid var(--reader-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.trending-card:active {
  transform: scale(0.96);
  opacity: 0.9;
}

@media (min-width: 768px) {
  .trending-card {
    flex: 0 0 calc((100% - 60px) / 6.25);
    min-width: 130px;
    max-width: 170px;
  }
}

.trending-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4.1;
  background: #E5E5EA;
  overflow: hidden;
}

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

.trending-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.trending-badge.top-1 {
  background: linear-gradient(135deg, #FF3B30 0%, #FF9500 100%);
}

.trending-badge.top-2 {
  background: linear-gradient(135deg, #FF9500 0%, #FFCC00 100%);
}

.trending-badge.top-3 {
  background: linear-gradient(135deg, #5856D6 0%, #AF52DE 100%);
}

.trending-badge.top-other {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
}

.trending-avail-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  background: rgba(52, 199, 89, 0.95);
  color: #FFFFFF;
  padding: 2px 5px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.trending-card-body {
  padding: 8px 7px 8px 7px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.trending-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.45em;
}

.trending-card-cn {
  font-size: 0.66rem;
  color: var(--ios-subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.trending-card-author {
  font-size: 0.66rem;
  color: var(--ios-subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.trending-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--reader-border);
}

.trending-card-cat {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--ios-orange);
  background: rgba(234, 88, 12, 0.08);
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
}

.trending-card-read-btn {
  font-size: 0.64rem;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--ios-orange);
  border: none;
  border-radius: 99px;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
}
