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

:root {
  /* iOS Native Colors */
  --ios-bg: #F2F2F7;
  --ios-card-bg: #FFFFFF;
  --ios-text: #000000;
  --ios-text-secondary: #6E6E73;
  --ios-text-tertiary: #8E8E93;
  --ios-separator: #E5E5EA;
  --ios-blue: #007AFF;
  --ios-blue-hover: #0056B3;
  
  /* Brand Accents */
  --primary-orange: #EA580C;
  --vip-gold: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --rank-1: #2563EB;
  --rank-2: #EA580C;
  --rank-3: #0D9488;
  --rank-other: #94A3B8;

  /* Reader Warm Sepia (Screen D default) */
  --sepia-bg: #F4ECD8;
  --sepia-text: #3D2E1E;
  --sepia-border: #E8DCC2;

  /* Safe Area Variables */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Be Vietnam Pro", sans-serif;
  background-color: var(--ios-bg);
  color: var(--ios-text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Mobile App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: #FFFFFF;
  position: relative;
  padding-bottom: calc(72px + var(--safe-bottom));
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

@media (min-width: 768px) {
  .app-container {
    max-width: 500px;
  }
}

/* VIP Badge */
.vip-badge {
  background: var(--vip-gold);
  color: #FFFFFF;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ==========================================================================
   SCREEN A: "KHÁM PHÁ" (Explore Storefront)
   ========================================================================== */

/* Header */
.explore-header {
  padding: max(16px, var(--safe-top)) 16px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 30;
}

.explore-large-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #000000;
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.header-icon-btn:hover {
  background: #F2F2F7;
}

/* Section Common */
.explore-section {
  padding: 16px 0;
  border-bottom: 8px solid #F2F2F7;
}

.section-title-bar {
  padding: 0 16px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-bold-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #000000;
  letter-spacing: -0.01em;
}

.section-see-all {
  font-size: 0.8rem;
  color: var(--ios-blue);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Section 1: Đề Cử (Horizontal 3:4 Cards) */
.horizontal-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 16px 8px 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.horizontal-scroll-row::-webkit-scrollbar { display: none; }

.recommend-card {
  flex: 0 0 115px;
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.recommend-card:active {
  transform: scale(0.97);
}

.recommend-cover-wrap {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  background: #E5E5EA;
}

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

.cover-vip-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
}

.recommend-title {
  font-size: 0.825rem;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 6px;
  color: #1C1C1E;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.1em;
}

.recommend-author {
  font-size: 0.7rem;
  color: var(--ios-text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section 2: Top Truyện (2-Column Ranked Grid) */
.ranked-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 16px;
}

.rank-card-item {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid #F2F2F7;
  display: flex;
  gap: 10px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.rank-badge-pill {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  z-index: 3;
}

.rank-1 { background-color: var(--rank-1); }
.rank-2 { background-color: var(--rank-2); }
.rank-3 { background-color: var(--rank-3); }
.rank-4 { background-color: var(--rank-other); }
.rank-5 { background-color: var(--rank-other); }

.rank-thumb-wrap {
  width: 52px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #E5E5EA;
}

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

.rank-content-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rank-novel-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1C1C1E;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.rank-meta-author {
  font-size: 0.68rem;
  color: var(--ios-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 2px 0;
}

.genre-pill-tag {
  display: inline-block;
  background: #F2F2F7;
  color: #48484A;
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  align-self: flex-start;
}

/* Section 3: Mới Cập Nhật */
.update-card-item {
  flex: 0 0 100px;
  scroll-snap-align: start;
  cursor: pointer;
}

.update-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 8px;
  overflow: hidden;
  background: #E5E5EA;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

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

.update-title {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.update-ch-badge {
  font-size: 0.65rem;
  color: var(--primary-orange);
  font-weight: 600;
}

/* ==========================================================================
   SCREEN B: "TỦ SÁCH" (Bookshelf & Offline Manager)
   ========================================================================== */

.bookshelf-header {
  padding: max(16px, var(--safe-top)) 16px 8px 16px;
  background: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 30;
}

.bookshelf-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Segmented Control iOS Style */
.segmented-control {
  display: flex;
  background: #E5E5EA;
  padding: 2px;
  border-radius: 9px;
  position: relative;
}

.seg-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 0;
  font-size: 0.785rem;
  font-weight: 600;
  color: #636366;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.seg-tab-btn.active {
  background: #FFFFFF;
  color: #000000;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Novel Row Item in Bookshelf */
.bookshelf-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bookshelf-row-card {
  background: #FFFFFF;
  border: 1px solid #F2F2F7;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.bookshelf-row-card:active {
  transform: scale(0.985);
}

.bookshelf-row-thumb {
  width: 60px;
  height: 84px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #E5E5EA;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.bookshelf-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.bookshelf-row-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #000000;
  line-height: 1.25;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookshelf-ch-pill {
  display: inline-block;
  background: #F2F2F7;
  color: #1C1C1E;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.bookshelf-time-ago {
  font-size: 0.7rem;
  color: var(--ios-text-tertiary);
}

.bookshelf-quick-jump-btn {
  padding: 6px 12px;
  border: 1px solid var(--ios-blue);
  background: #FFFFFF;
  color: var(--ios-blue);
  font-size: 0.785rem;
  font-weight: 700;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.bookshelf-quick-jump-btn:hover {
  background: var(--ios-blue);
  color: #FFFFFF;
}

/* ==========================================================================
   SCREEN C: NOVEL DETAIL VIEW
   ========================================================================== */

.detail-modal-view {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #F2F2F7;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: calc(80px + var(--safe-bottom));
}

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

.detail-top-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: max(12px, var(--safe-top)) 16px 12px 16px;
  background: rgba(242, 242, 247, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.detail-cover-hero {
  width: 120px;
  height: 168px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  margin-bottom: 12px;
  background: #E5E5EA;
}

.detail-cover-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 4px;
}

.detail-hero-author {
  font-size: 0.825rem;
  color: var(--ios-text-secondary);
  margin-bottom: 12px;
}

.detail-epub-btn {
  padding: 6px 16px;
  border-radius: 99px;
  background: #FFFFFF;
  border: 1px solid #D1D1D6;
  font-size: 0.785rem;
  font-weight: 700;
  color: #1C1C1E;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 3-Column Stats Card */
.detail-stats-card {
  margin: 0 16px 16px 16px;
  background: #FFFFFF;
  border-radius: 14px;
  padding: 12px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.stat-col {
  border-right: 1px solid #F2F2F7;
  padding: 0 8px;
}
.stat-col:last-child { border-right: none; }

.stat-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: #000000;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--ios-text-secondary);
  font-weight: 600;
  margin-top: 2px;
}

/* Synopsis Card */
.detail-synopsis-card {
  margin: 0 16px 16px 16px;
  background: #FFFFFF;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.synopsis-text {
  font-size: 0.85rem;
  color: #3C3C43;
  line-height: 1.6;
  margin-bottom: 12px;
}

.genre-tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.detail-ch-count-row {
  border-top: 1px solid #F2F2F7;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1C1C1E;
  cursor: pointer;
}

/* Latest Chapters List (CHƯƠNG MỚI) */
.detail-latest-card {
  margin: 0 16px 20px 16px;
  background: #FFFFFF;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.latest-header-text {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ios-text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.ch-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #F2F2F7;
  cursor: pointer;
}
.ch-row-item:last-child { border-bottom: none; }

.ch-row-title {
  font-size: 0.825rem;
  font-weight: 600;
  color: #1C1C1E;
  margin-bottom: 2px;
}

.ch-row-time {
  font-size: 0.7rem;
  color: var(--ios-text-tertiary);
}

.ch-headphone-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #E5E5EA;
  background: #FFFFFF;
  color: var(--ios-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.ch-headphone-btn:hover {
  background: var(--ios-blue);
  color: #FFFFFF;
}

/* Sticky Bottom Action Bar */
.detail-sticky-bar {
  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(226, 232, 240, 0.8);
  padding: 10px 16px calc(10px + var(--safe-bottom)) 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 95;
}

.sticky-read-btn {
  flex: 1;
  height: 48px;
  border-radius: 99px;
  background: var(--ios-blue);
  color: #FFFFFF;
  font-size: 0.92rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 16px;
}

.sticky-download-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #F2F2F7;
  border: 1px solid #E5E5EA;
  color: var(--ios-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================================================
   SCREEN D: READER VIEW & AUDIO TTS (Warm Sepia Theme #F4ECD8)
   ========================================================================== */

.reader-view-native {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--sepia-bg);
  color: var(--sepia-text);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

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

/* Top Minimal Bar */
.reader-native-top-bar {
  padding: max(10px, var(--safe-top)) 16px 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(61, 46, 30, 0.08);
  background: inherit;
  z-index: 10;
}

.reader-native-title-box {
  flex: 1;
  text-align: center;
  padding: 0 8px;
  overflow: hidden;
}

.reader-novel-top-name {
  font-size: 0.72rem;
  opacity: 0.7;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-ch-top-name {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Reader Content Wrap */
.reader-native-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px calc(90px + var(--safe-bottom)) 20px;
  scroll-behavior: smooth;
}

.reader-native-body {
  max-width: 650px;
  margin: 0 auto;
  font-family: 'Merriweather', 'Noto Serif', serif;
  font-size: 1.125rem;
  line-height: 1.85;
}

.reader-centered-ch-title {
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 32px;
  line-height: 1.35;
}

.reader-native-body p {
  margin-bottom: 1.35em;
  text-align: justify;
  letter-spacing: 0.01em;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background-color 0.25s ease, border-left 0.25s ease, transform 0.15s ease;
}

.reader-native-body p:hover {
  background-color: rgba(61, 46, 30, 0.03);
}

/* Audio TTS Active Paragraph Highlighting (Warm Sepia #E6D8B5) */
.tts-active-paragraph {
  background-color: #E6D8B5 !important;
  color: #2D2012 !important;
  border-left: 4px solid #EA580C !important;
  box-shadow: 0 2px 8px rgba(61, 46, 30, 0.06);
}

/* Bottom Reader Toolbar (5 Icons) */
.reader-native-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: inherit;
  border-top: 1px solid rgba(61, 46, 30, 0.08);
  padding: 8px 16px calc(8px + var(--safe-bottom)) 16px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 10;
}

.reader-tool-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.reader-tool-btn:active {
  opacity: 0.5;
}

.reader-tool-label {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.8;
}

/* Reader Themes */
.theme-sepia {
  background-color: #F4ECD8 !important;
  color: #3D2E1E !important;
}
.theme-sepia .reader-native-top-bar,
.theme-sepia .reader-native-bottom-bar {
  border-color: rgba(61, 46, 30, 0.1) !important;
}

.theme-white {
  background-color: #FFFFFF !important;
  color: #1A1A1A !important;
}
.theme-white .reader-native-top-bar,
.theme-white .reader-native-bottom-bar {
  border-color: rgba(0, 0, 0, 0.08) !important;
}

.theme-night {
  background-color: #121212 !important;
  color: #E0E0E0 !important;
}
.theme-night .reader-native-top-bar,
.theme-night .reader-native-bottom-bar {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ==========================================================================
   AUDIO TTS MINI-PLAYER BAR
   ========================================================================== */

.audio-mini-player {
  position: fixed;
  bottom: calc(75px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  max-width: 448px;
  margin: 0 auto;
  background: #1C1C1E;
  color: #FFFFFF;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 150;
  display: none;
  animation: slideUpAudio 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.audio-mini-player.active {
  display: block;
}

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

.audio-player-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audio-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

/* Animated Equalizer */
.audio-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 16px;
  height: 16px;
}

.audio-equalizer .bar {
  width: 3px;
  background: #EA580C;
  border-radius: 2px;
  height: 4px;
}

.audio-equalizer.playing .bar1 { animation: eqBar 0.5s ease infinite alternate; }
.audio-equalizer.playing .bar2 { animation: eqBar 0.7s ease infinite alternate 0.15s; }
.audio-equalizer.playing .bar3 { animation: eqBar 0.4s ease infinite alternate 0.3s; }

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

.audio-text-meta {
  min-width: 0;
}

.audio-novel-name {
  font-size: 0.785rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-ch-title {
  font-size: 0.68rem;
  color: #A1A1A6;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-ctrl-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #FFFFFF;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.audio-ctrl-btn.primary {
  background: #EA580C;
}

.audio-ctrl-btn.close {
  background: transparent;
  color: #8E8E93;
}

.audio-speed-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #FFFFFF;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   GLOBAL BOTTOM NAVIGATION BAR (3 TABS)
   ========================================================================== */

.bottom-nav-3tabs {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 16px calc(8px + var(--safe-bottom)) 16px;
  z-index: 50;
}

.nav-tab-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #8E8E93;
  cursor: pointer;
  padding: 4px 16px;
  border-radius: 12px;
  transition: all 0.2s ease;
  flex: 1;
}

.nav-tab-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  transition: stroke 0.2s ease;
}

.nav-tab-item-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.nav-tab-item.active svg {
  stroke: var(--ios-blue);
}

/* ==========================================================================
   STUDIO BENTO & PIPELINE (Inside "Cá Nhân" tab)
   ========================================================================== */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.bento-card {
  background: #FFFFFF;
  border: 1px solid #E5E5EA;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.bento-card-full {
  grid-column: span 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

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

.metric-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6E6E73;
}

.metric-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: #000000;
  letter-spacing: -0.02em;
}

.metric-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6E6E73;
  margin-left: 4px;
}

.metric-footer {
  font-size: 0.72rem;
  color: #8E8E93;
}

.sparkline-svg {
  width: 60px;
  height: 20px;
}

/* Pipeline Multi-color Progress */
.progress-track {
  width: 100%;
  height: 6px;
  background-color: #E5E5EA;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.progress-segment-published { background-color: #EA580C; height: 100%; }
.progress-segment-translated { background-color: #EAB308; height: 100%; }
.progress-segment-raw { background-color: #FB7185; height: 100%; }

/* Alert Box */
.alert-banner-card {
  background-color: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-title {
  color: #1E40AF;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
}

.alert-subtitle {
  color: #3B82F6;
  font-size: 0.775rem;
}

.alert-action-btn {
  background: #FFFFFF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.785rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Modals & Popups */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-box {
  background: #FFFFFF;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.toast-notice {
  position: fixed;
  top: max(20px, var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-50px);
  background: rgba(28, 28, 30, 0.95);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.825rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   SMART SEARCH & LIVE PREVIEW STYLES
   ========================================================================== */
.search-pulsing-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  text-align: center;
}

.search-pulsing-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EA580C 0%, #F97316 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4);
  animation: pulse-ring 1.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  color: #FFFFFF;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.6);
    transform: scale(0.95);
  }
  50% {
    box-shadow: 0 0 0 16px rgba(234, 88, 12, 0);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0);
    transform: scale(0.95);
  }
}

.search-pulsing-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1F2937;
  line-height: 1.5;
  max-width: 320px;
}

.search-pulsing-subtext {
  font-size: 0.72rem;
  color: #6B7280;
  margin-top: 6px;
}

/* Sticky Reader CTA */
.sticky-reader-cta {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(244, 236, 216, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(232, 220, 194, 0.8);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  z-index: 110;
  display: flex;
  justify-content: center;
  animation: slide-up 0.3s ease-out;
}

.theme-white .sticky-reader-cta {
  background: rgba(255, 255, 255, 0.95);
  border-top-color: #E5E5EA;
}

.theme-night .sticky-reader-cta {
  background: rgba(18, 18, 18, 0.95);
  border-top-color: #333333;
}

.sticky-reader-cta-btn {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(135deg, #EA580C 0%, #C2410C 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(234, 88, 12, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

