/* ==========================================================================
   MANGADEX PERSONAL READER - PREMIUM DARK THEME DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-base: #0d0e11;
  --bg-surface: #14151a;
  --bg-card: #1b1d24;
  --bg-card-hover: #242731;
  --bg-elevated: #21242d;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-card: #282b36;
  --border-focus: #ff6740;
  
  /* Brand MangaDex Accent */
  --accent: #ff6740;
  --accent-hover: #ff7f5c;
  --accent-active: #e5532d;
  --accent-glow: rgba(255, 103, 64, 0.3);
  --accent-subtle: rgba(255, 103, 64, 0.12);
  
  /* Auxiliary Accents */
  --badge-blue: #3b82f6;
  --badge-green: #10b981;
  --badge-yellow: #f59e0b;
  --badge-purple: #8b5cf6;
  
  /* Typography Colors */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --text-inverse: #0d0e11;
  
  /* Fonts */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Transitions & Shadows */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 8px 24px var(--accent-glow);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent !important;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent !important;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent !important;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent !important;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent !important;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  outline: none !important;
}

.hidden {
  display: none !important;
}

.text-accent {
  color: var(--accent);
}

/* ==========================================================================
   NAVBAR & HEADER
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20, 21, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: transform var(--transition-normal);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #ff4500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(255, 103, 64, 0.3);
  border-radius: var(--radius-sm);
  margin-left: 0.35rem;
  vertical-align: middle;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.nav-link.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.nav-actions {
  display: flex;
  align-items: center;
}

.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 240px;
}

.search-trigger-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.search-kbd {
  margin-left: auto;
  font-size: 0.7rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--text-subtle);
}

/* ==========================================================================
   SEARCH MODAL (Ctrl + K)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 14, 0.8);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: fadeIn 150ms ease-out;
}

.search-modal-box {
  width: 90%;
  max-width: 650px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideDown 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.search-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--text-main);
}

.search-input-wrapper input::placeholder {
  color: var(--text-subtle);
}

.search-esc-kbd {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-subtle);
  cursor: pointer;
}

.search-quick-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.quick-tag-label {
  font-size: 0.75rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.quick-tag-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}

.quick-tag-chip:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.search-results-container {
  max-height: 480px;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  color: var(--text-subtle);
  text-align: center;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-item:hover {
  background: var(--bg-card);
}

.search-thumb {
  width: 48px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-card);
}

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

.search-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.search-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

/* ==========================================================================
   MAIN LAYOUT & VIEWS
   ========================================================================== */

.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.view-section {
  animation: fadeIn 200ms ease-out;
}

/* ==========================================================================
   HERO CAROUSEL
   ========================================================================== */

.hero-carousel-container {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.hero-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 2.5rem;
  background-size: cover;
  background-position: center 25%;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
}

.hero-slide::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(13, 14, 17, 0.95) 15%, rgba(13, 14, 17, 0.6) 60%, rgba(13, 14, 17, 0.2) 100%),
              linear-gradient(90deg, rgba(13, 14, 17, 0.95) 0%, rgba(13, 14, 17, 0.5) 60%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 650px;
}

.hero-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 26px;
  line-height: 1;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0.7rem;
  border-radius: var(--radius-full);
  background: rgba(20, 21, 26, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.badge-tag i,
.badge-tag svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.badge-tag.accent {
  background: var(--accent);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.6rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hero-nav-dots {
  position: absolute;
  bottom: 1.5rem;
  right: 2rem;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.3);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.dot.active {
  width: 24px;
  background: var(--accent);
}

/* ==========================================================================
   FILTER TABS & SECTION HEADERS
   ========================================================================== */

.filter-bar {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.filter-tab.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
}

.section-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--badge-green);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--badge-green);
  box-shadow: 0 0 8px var(--badge-green);
}

/* ==========================================================================
   MANGA GRID & CARDS
   ========================================================================== */

.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.25rem;
}

.manga-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
}

.manga-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 103, 64, 0.4);
}

.card-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4.2;
  overflow: hidden;
  background: var(--bg-card);
}

.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.manga-card:hover .card-poster img {
  transform: scale(1.05);
}

.card-overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(20, 21, 26, 0.95) 0%, rgba(20, 21, 26, 0.2) 50%, transparent 100%);
  pointer-events: none;
}

.card-status-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(13, 14, 17, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 1px solid var(--border-subtle);
}

.card-content {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-main);
  transition: color var(--transition-fast);
}

.manga-card:hover .card-title {
  color: var(--accent);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-languages {
  display: flex;
  gap: 0.25rem;
}

.lang-flag {
  font-size: 0.85rem;
}

/* ==========================================================================
   VIEW 2: MANGA DETAIL PAGE
   ========================================================================== */

.detail-container {
  position: relative;
  z-index: 2;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(50px) brightness(0.25);
  transform: scale(1.1);
  pointer-events: none;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.btn-back:hover {
  color: #fff;
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.detail-hero {
  display: flex;
  gap: 2.5rem;
  background: rgba(27, 29, 36, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.detail-poster-col {
  width: 260px;
  flex-shrink: 0;
}

.detail-poster {
  width: 100%;
  aspect-ratio: 3 / 4.4;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
}

.detail-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.detail-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.detail-alt-titles {
  font-size: 0.9rem;
  color: var(--text-subtle);
  margin-bottom: 1rem;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-meta-item strong {
  color: var(--text-main);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.detail-tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.detail-synopsis {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: auto;
}

/* ==========================================================================
   CHAPTER FEED / LIST
   ========================================================================== */

.chapters-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

.chapters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.source-tabs {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  border: 1px solid var(--border-subtle);
  gap: 0.25rem;
}

.source-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.source-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.source-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.mirror-search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: var(--bg-card);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.mirror-search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  padding: 0.2rem 0.4rem;
}

.mirror-search-box input::placeholder {
  color: var(--text-subtle);
}

.mirror-search-box button {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 2px 6px var(--accent-glow);
}

.mirror-search-box button:hover {
  background: var(--accent-hover);
}

.mirror-matches-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.mirror-matches-row .quick-tag-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.mirror-chapters-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chapters-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chapters-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.chapters-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(255, 103, 64, 0.25);
}

.chapters-filter-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  color: var(--text-muted);
}

.custom-select {
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.btn-sort:hover {
  color: #fff;
  border-color: var(--accent);
}

.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.chapters-list::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chapter-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateX(4px);
}

.chapter-item-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chapter-number-pill {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  min-width: 80px;
}

.chapter-title-text {
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text-main);
}

.chapter-group-badge {
  font-size: 0.75rem;
  color: var(--text-subtle);
  background: var(--bg-surface);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-left: 0.5rem;
}

.chapter-item-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   VIEW 3: MANGA READER ENGINE
   ========================================================================== */

#view-reader {
  max-width: 100%;
  padding: 0;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.reader-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 14, 17, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1), opacity 250ms ease;
  transform: translateY(0);
  opacity: 1;
}

.reader-toolbar.hidden-bar {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.reader-toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reader-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.reader-btn:hover {
  color: #fff;
  border-color: var(--accent);
}

.reader-title-info {
  display: flex;
  flex-direction: column;
}

.reader-manga-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-chapter-title {
  font-size: 0.78rem;
  color: var(--accent);
}

.reader-toolbar-center {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Custom Chapter Dropdown in Reader Toolbar */
.custom-chapter-dropdown {
  position: relative;
  display: inline-block;
}

.custom-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.42rem 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 250px;
  backdrop-filter: blur(8px);
}

.custom-dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
  color: #fff;
}

.custom-dropdown-trigger .trigger-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.custom-dropdown-trigger .trigger-arrow {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.custom-chapter-dropdown.open .trigger-arrow {
  transform: rotate(180deg);
  color: var(--accent);
}

.custom-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  max-width: 90vw;
  background: rgba(18, 19, 24, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(255, 103, 64, 0.15);
  z-index: 300;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dropdownFadeIn 180ms ease-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.dropdown-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
}

.dropdown-search-wrap svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.dropdown-search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.82rem;
  font-family: inherit;
  width: 100%;
}

.dropdown-search-wrap input::placeholder {
  color: var(--text-muted);
}

.custom-dropdown-list {
  max-height: 290px;
  overflow-y: auto;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.custom-dropdown-list::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.custom-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
}

.custom-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.custom-dropdown-item.active {
  background: rgba(255, 103, 64, 0.15);
  border-color: rgba(255, 103, 64, 0.4);
  color: var(--accent);
  font-weight: 600;
}

.custom-item-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.custom-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.83rem;
}

.custom-item-tag {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 600;
}

.custom-item-tag.id {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.custom-item-tag.en {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

/* Inline 2-step confirmation delete button */
.btn-confirm-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #ef4444 !important;
  color: #fff !important;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  transition: all var(--transition-fast);
  animation: pulseDelete 1.2s infinite;
}

@keyframes pulseDelete {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.btn-confirm-delete:hover {
  background: #dc2626 !important;
}

.reader-select-wrap select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.reader-page-counter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
}

.reader-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reader-btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reader-btn-icon:hover {
  color: #fff;
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

/* 3-Dots Reader Settings & Mode Dropdown Wrap */
.reader-more-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.reader-more-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: rgba(18, 20, 26, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 103, 64, 0.1);
  padding: 0.75rem;
  z-index: 105;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: fadeIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reader-more-menu.hidden {
  display: none !important;
}

.reader-menu-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem 0.6rem 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
}

.reader-menu-header i {
  color: var(--accent);
}

.reader-menu-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.reader-menu-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  padding: 0.25rem 0.5rem 0.15rem 0.5rem;
}

.reader-mode-opt,
.reader-menu-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reader-mode-opt:hover,
.reader-menu-action:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.reader-mode-opt.active {
  background: rgba(255, 103, 64, 0.12);
  color: var(--accent);
  border-color: rgba(255, 103, 64, 0.3);
}

.reader-mode-opt .opt-text,
.reader-menu-action .opt-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.reader-mode-opt .opt-name,
.reader-menu-action .opt-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
}

.reader-mode-opt .opt-sub,
.reader-menu-action .opt-sub {
  font-size: 0.72rem;
  color: var(--text-subtle);
  line-height: 1.2;
}

.reader-mode-opt.active .opt-sub {
  color: rgba(255, 103, 64, 0.8);
}

.reader-mode-opt .opt-check {
  display: none;
  color: var(--accent);
  flex-shrink: 0;
}

.reader-mode-opt.active .opt-check {
  display: block;
}

.reader-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.2rem 0;
}

/* Reader Viewport */
.reader-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* CRITICAL FIX: never center overflowing column flexbox */
  min-height: 80vh;
  padding: 4.5rem 0 6rem 0;
  position: relative;
  cursor: pointer;
}

/* Long Strip Mode (Webtoon) */
.reader-viewport.long-strip-mode {
  gap: 0;
  justify-content: flex-start;
}

.reader-page-wrapper {
  position: relative;
  max-width: 850px;
  width: 100%;
  min-height: 480px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0d0e12;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

@media (max-width: 600px) {
  .reader-page-wrapper {
    min-height: 380px;
  }
}

/* Page Skeleton Loader */
.page-skeleton-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #101218 0%, #171922 50%, #101218 100%);
  z-index: 2;
  transition: opacity 300ms ease;
  pointer-events: none;
}

.page-skeleton-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-skeleton-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 103, 64, 0.06) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: skeletonShimmer 1.8s infinite linear;
  pointer-events: none;
}

@keyframes skeletonShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.page-skeleton-label {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1rem;
  background: rgba(20, 22, 28, 0.88);
  border: 1px solid rgba(255, 103, 64, 0.25);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.page-skeleton-label .spinner-small {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.reader-page-img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 280ms ease-in-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 1;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  outline: none !important;
}

.reader-page-img.visible {
  opacity: 1;
}

/* Page Error / Retry Card */
.page-error-retry {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: rgba(18, 20, 26, 0.95);
  z-index: 4;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.5rem;
  text-align: center;
}

.page-error-retry i {
  color: var(--accent);
  width: 28px;
  height: 28px;
}

.btn-retry-page {
  padding: 0.45rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-retry-page:hover {
  background: #ff4500;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.reader-page-number {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  z-index: 5;
}

/* Single Page Mode */
.reader-viewport.single-mode {
  height: calc(100vh - 120px);
  padding: 0;
  justify-content: center;
}

.single-page-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent !important;
  user-select: none !important;
}

.single-page-img {
  max-height: 88vh;
  max-width: 95vw;
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.9);
  transition: opacity 150ms ease;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Single Mode: Auto-Cut Panel Slice Window for Long Strips */
.single-page-slice-window {
  position: relative;
  width: min(850px, 92vw);
  height: min(88vh, 850px * 1.4);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.9);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: center;
  background: #0a0a0a;
}

.single-page-slice-img {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.slice-indicator-badge {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(18, 19, 24, 0.88);
  backdrop-filter: blur(10px);
  color: var(--accent);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255, 103, 64, 0.35);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  z-index: 15;
  pointer-events: none;
}

/* Double Page Mode */
.reader-viewport.double-mode {
  height: calc(100vh - 120px);
  padding: 0;
  justify-content: center;
}

.double-page-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.double-pages-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-height: 90vh;
  max-width: 96vw;
  user-select: none;
}

.double-page-item {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  max-height: 88vh;
}

.double-page-img {
  max-height: 88vh;
  max-width: 47vw;
  object-fit: contain;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.85);
  user-select: none;
}

.double-page-item.left .double-page-img {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.double-page-item.spread .double-page-img {
  max-width: 94vw;
}

.double-page-tag {
  position: absolute;
  bottom: 0.5rem;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
}
.double-page-item.left .double-page-tag {
  left: 0.5rem;
}
.double-page-item.right .double-page-tag {
  right: 0.5rem;
}

.nav-click-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38%;
  cursor: pointer;
  z-index: 10;
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
  user-select: none !important;
}

.nav-click-zone.left {
  left: 0;
}

.nav-click-zone.right {
  right: 0;
}

/* Webtoon Chapter End Card */
.webtoon-chapter-end-card {
  max-width: 850px;
  width: 100%;
  margin: 2.5rem auto 4.5rem auto;
  padding: 2.5rem 1.75rem;
  background: linear-gradient(180deg, rgba(20, 21, 26, 0.75) 0%, rgba(13, 14, 18, 0.98) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  position: relative;
  overflow: hidden;
}

.webtoon-chapter-end-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

/* Compact Chapter Selector in End Card */
.end-card-chapter-selector-wrap {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  z-index: 25;
}

.end-card-select-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
}

.end-card-dropdown {
  position: relative;
}

.end-card-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  background: var(--bg-card);
  border: 1px solid rgba(255, 103, 64, 0.35);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  max-width: 260px;
}

.end-card-dropdown-trigger:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 4px 18px var(--accent-glow);
  transform: translateY(-1px);
}

.end-card-trigger-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.end-card-dropdown-panel {
  position: absolute;
  bottom: calc(100% + 0.65rem);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  max-height: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  animation: panelSlideUp 180ms ease-out;
}

.end-card-search-wrap {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
}

.end-card-search-wrap input {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}

.end-card-dropdown-list {
  overflow-y: auto;
  max-height: 220px;
  padding: 0.25rem 0;
}

.end-card-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.end-card-dropdown-item:hover,
.end-card-dropdown-item.active {
  background: var(--bg-elevated);
  color: #fff;
}

.end-card-dropdown-item.active {
  color: var(--accent);
  font-weight: 700;
}

.end-card-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.end-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.end-card-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.end-card-sub #countdown-sec {
  color: var(--accent);
  font-weight: 700;
}

.end-card-progress {
  width: 100%;
  max-width: 320px;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.end-card-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 1s linear;
}

.btn-auto-next {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
}

/* Chapter Transition View (Instant Feedback, Zero Lag) */
.chapter-transition-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
  animation: fadeIn 150ms ease-out;
}

.transition-spinner-box {
  padding: 3rem 1.5rem 2rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.transition-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

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

.reader-skeleton-stream {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-skeleton-loader.preview-stream {
  position: relative;
  height: 480px;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* Floating Reader Footer */
.reader-footer {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(20, 21, 26, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.45rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.75), 0 0 16px rgba(255, 103, 64, 0.18);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1), opacity 250ms ease;
  opacity: 1;
}

.reader-footer.hidden-bar {
  transform: translate(-50%, calc(100% + 3.5rem));
  opacity: 0;
  pointer-events: none;
}

/* Hide middle footer info as requested - moved to end card */
.reader-footer-info {
  display: none !important;
}

.reader-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.reader-nav-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.reader-nav-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.reader-nav-btn.primary:hover {
  background: var(--accent-hover);
}

@media (max-width: 640px) {
  .reader-footer {
    bottom: 1rem;
    padding: 0.35rem 0.6rem;
    gap: 0.5rem;
    max-width: 94%;
  }
  .reader-nav-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
  }
  .reader-nav-btn .btn-text {
    font-size: 0.75rem;
  }
  .reader-footer-info {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
  }
}

.reader-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 103, 64, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

/* ==========================================================================
   VIEW 4: HISTORY & BOOKMARKS
   ========================================================================== */

.history-container {
  max-width: 1000px;
  margin: 0 auto;
}

.btn-clear-history {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #ef4444;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-clear-history:hover {
  background: rgba(239, 68, 68, 0.1);
}

.history-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all var(--transition-fast);
}

.history-card:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.history-thumb {
  width: 70px;
  height: 95px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.history-info {
  flex: 1;
}

.history-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.history-chapter {
  font-size: 0.88rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.history-date {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  gap: 1rem;
}

.empty-state i {
  width: 48px;
  height: 48px;
  color: var(--text-subtle);
}

.btn-explore {
  margin-top: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.5rem;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-subtext {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 0.35rem;
}

.footer-subtext a {
  color: var(--accent);
  text-decoration: underline;
}

.footer-badges {
  display: flex;
  gap: 0.5rem;
}

.footer-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* ==========================================================================
   SKELETON ANIMATIONS & TOASTS
   ========================================================================== */

.skeleton-pulse {
  background: linear-gradient(90deg, #1b1d24 25%, #242731 50%, #1b1d24 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.hero-skeleton {
  width: 100%;
  height: 100%;
}

.grid-loading-placeholder {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.25rem;
}

.card-skeleton {
  width: 100%;
  aspect-ratio: 3 / 4.2;
  border-radius: var(--radius-md);
}

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  animation: slideInRight 250ms ease-out;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInRight {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive adjustments */
@media (max-width: 868px) {
  .nav-links {
    display: none;
  }
  .search-trigger-btn {
    min-width: auto;
  }
  .search-trigger-text, .search-kbd {
    display: none;
  }
  .hero-carousel-container {
    height: 300px;
  }
  .hero-title {
    font-size: 1.6rem;
  }
  .detail-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .detail-poster-col {
    width: 180px;
  }
  .detail-meta-row {
    justify-content: center;
  }
  .detail-tags {
    justify-content: center;
  }
  .detail-actions {
    justify-content: center;
  }
}

/* ==========================================
   OFFLINE DOWNLOAD MANAGER & QUEUE WIDGET
   ========================================== */

.chapters-download-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.btn-download-all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  transition: all var(--transition-fast);
}

.btn-download-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.download-dropdown-wrap {
  position: relative;
}

.btn-download-options {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-download-options:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-subtle);
}

.download-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  z-index: 100;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  animation: fadeIn 150ms ease-out;
}

.download-dropdown-menu.hidden {
  display: none;
}

.download-dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.download-dropdown-menu .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}

/* Chapter item download status */
.btn-ch-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-ch-download:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
  transform: scale(1.08);
}

.badge-downloaded-success {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.btn-delete-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.btn-delete-download:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.ch-download-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(255, 103, 64, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Floating Download Queue Widget */
.download-queue-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 320px;
  background: rgba(26, 29, 36, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 103, 64, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  animation: slideInRight 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.download-queue-widget.hidden {
  display: none;
}

.queue-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border-subtle);
}

.queue-widget-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 103, 64, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.queue-widget-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.queue-action-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.queue-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.queue-widget-body {
  padding: 0.85rem 1rem;
}

.queue-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.4rem;
}

.queue-chapter-label {
  font-weight: 600;
  color: var(--text-main);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-pages-label {
  color: var(--accent);
  font-weight: 600;
}

.queue-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.queue-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #10b981 100%);
  border-radius: 3px;
  transition: width 200ms ease;
}

.queue-footer-row {
  font-size: 0.75rem;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
}

/* OFFLINE LIBRARY & STORAGE MANAGER VIEW */
.offline-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.storage-usage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.storage-info-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.storage-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.storage-numbers {
  font-size: 0.88rem;
  color: var(--text-subtle);
}

.storage-progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
}

.storage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: 5px;
  transition: width 400ms ease;
}

.offline-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-clean-read {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-clean-read:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}

.offline-manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.offline-manga-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  transition: all var(--transition-fast);
}

.offline-manga-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px);
}

.offline-card-thumb {
  width: 80px;
  height: 110px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.offline-card-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
  min-width: 0;
}

.offline-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
}

.offline-card-meta {
  font-size: 0.8rem;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.offline-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-read-offline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* Badge Offline Active in Reader (Hidden per user request) */
.badge-offline-mode {
  display: none !important;
}

/* Language Filter Pills & Dual-Language Badges */
.lang-pills-wrap {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  border: 1px solid var(--border-subtle);
  gap: 0.25rem;
}

.lang-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.lang-pill.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.lang-pill .pill-count {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.85);
}

.badge-lang-id {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.badge-lang-en {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   COLLECTION (BOOKMARK & HISTORY) STYLES
   ========================================================================== */

.nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.35rem;
}

.collection-tabs-wrap {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  overflow-x: auto;
}

.collection-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.collection-tab:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.15);
}

.collection-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.collection-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
}

.bookmark-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all var(--transition-fast);
  position: relative;
}

.bookmark-card:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.bookmark-thumb {
  width: 75px;
  height: 105px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

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

.bookmark-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.bookmark-status {
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 103, 64, 0.15);
  color: var(--accent);
  font-weight: 700;
}

.bookmark-date {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.bookmark-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-remove-bookmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-remove-bookmark:hover {
  background: #ef4444;
  color: #fff;
}

.btn-secondary.bookmarked {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: #f59e0b;
}

.btn-secondary.bookmarked:hover {
  background: rgba(245, 158, 11, 0.25);
}

/* ==========================================================================
   MOBILE HEADER & SIDEBAR DRAWER (SWIPE GESTURE SUPPORT)
   ========================================================================== */

.mobile-menu-btn,
.mobile-search-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover,
.mobile-search-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent);
}

/* Backdrop */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer Aside */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 86vw;
  background: rgba(18, 20, 26, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -8px 0 36px rgba(0, 0, 0, 0.75);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.drawer-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.drawer-close-btn:hover {
  color: var(--text-main);
  border-color: var(--accent);
}

.drawer-search-wrap {
  padding: 1rem 1.25rem 0.5rem 1.25rem;
}

.drawer-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-subtle);
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
}

.drawer-search-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  flex: 1;
  overflow-y: auto;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.drawer-nav-item:hover {
  background: var(--bg-card);
  color: var(--text-main);
  transform: translateX(4px);
}

.drawer-nav-item.active {
  background: rgba(255, 103, 64, 0.15);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.drawer-item-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.drawer-badge.highlight {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.drawer-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.drawer-footer-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.drawer-footer-tip {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   COMPREHENSIVE & HIGH-PRECISION MOBILE RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* Tablet & Smaller Desktops (<= 1024px) */
@media (max-width: 1024px) {
  .nav-container {
    padding: 0 1.25rem;
  }
  
  .nav-links {
    gap: 0.25rem;
  }
  
  .nav-link span {
    font-size: 0.85rem;
  }
  
  .manga-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
  
  .hero-slide {
    height: 360px;
  }
}

/* Mobile & Small Tablets (<= 768px) */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  body {
    overflow-x: hidden;
  }

  /* Header & Navbar */
  .navbar {
    height: 58px;
    padding: 0;
  }

  .nav-container {
    padding: 0 0.85rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-brand .brand-title {
    font-size: 1.2rem;
  }

  .nav-links {
    display: none !important; /* Moved to mobile sidebar drawer */
  }

  .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .search-trigger-btn {
    display: none !important; /* Replaced by compact mobile search trigger */
  }

  .mobile-search-btn,
  .mobile-menu-btn {
    display: flex !important;
  }

  /* Main Container */
  .main-content {
    padding: 0.75rem 0.75rem 2rem 0.75rem;
  }

  /* Hero Banner Carousel */
  .hero-carousel-container {
    margin-bottom: 1.25rem;
  }

  .hero-slide {
    height: 280px;
  }

  .hero-content {
    padding: 1.25rem;
    max-width: 100%;
  }

  .hero-title {
    font-size: 1.35rem;
    line-height: 1.25;
    margin-bottom: 0.35rem;
  }

  .hero-synopsis {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
  }

  .hero-meta {
    gap: 0.4rem;
    margin-bottom: 0.75rem;
  }

  .hero-badge-row {
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
  }

  .badge-tag {
    height: 24px;
    font-size: 0.68rem;
    padding: 0 0.55rem;
    gap: 0.3rem;
  }

  .badge-tag i,
  .badge-tag svg {
    width: 11px;
    height: 11px;
  }

  .hero-actions {
    display: flex;
    gap: 0.5rem;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
  }

  /* Filter Tabs Bar */
  .filter-bar {
    margin: 0.75rem 0 1rem 0;
  }

  .filter-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.45rem;
    padding: 0.25rem 0.1rem;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-tab {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
  }

  /* Section Headers */
  .section-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
  }

  .section-title {
    font-size: 1.2rem;
  }

  .status-indicator {
    display: none;
  }

  /* Manga Grid */
  .manga-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }

  .manga-card-body {
    padding: 0.65rem;
  }

  .manga-card-title {
    font-size: 0.85rem;
    line-height: 1.25;
  }

  .manga-card-meta {
    font-size: 0.72rem;
    margin-top: 0.35rem;
  }

  /* Search Modal */
  .search-modal-box {
    width: 95%;
    max-width: 95%;
    max-height: 88vh;
    padding: 1rem;
    border-radius: var(--radius-lg);
  }

  .search-input-wrapper {
    padding: 0.65rem 0.85rem;
  }

  .search-input-wrapper input {
    font-size: 0.95rem;
  }

  .search-esc-kbd {
    display: none;
  }

  .search-quick-tags {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .search-quick-tags::-webkit-scrollbar {
    display: none;
  }

  /* Manga Detail View */
  .detail-container {
    padding: 0.85rem 0.5rem;
  }

  .btn-back {
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    margin-bottom: 1rem;
  }

  .detail-hero {
    flex-direction: column !important;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    padding: 1.25rem 0.85rem;
  }

  .detail-poster-col {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .detail-poster {
    width: 160px;
    max-width: 55vw;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
  }

  .detail-info-col {
    width: 100%;
    text-align: center;
  }

  .detail-title {
    font-size: 1.4rem;
    line-height: 1.25;
    margin-bottom: 0.65rem;
  }

  .detail-meta-row {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }

  .detail-tags {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
  }

  .detail-tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
  }

  .detail-synopsis {
    text-align: left;
    font-size: 0.85rem;
    max-height: 130px;
    overflow-y: auto;
    padding: 0.65rem 0.85rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
  }

  .detail-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    width: 100%;
  }

  .detail-actions button {
    justify-content: center;
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
  }

  /* Chapters Section Container on Mobile */
  .chapters-wrapper {
    padding: 1rem 0.75rem;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Chapters Header & Controls */
  .chapters-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
  }

  .chapters-title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .chapters-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chapters-count-badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
    flex-shrink: 0;
  }

  /* Smooth horizontally scrolling source tabs within card container */
  .source-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding: 0.25rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .source-tabs::-webkit-scrollbar {
    display: none;
  }

  .source-tab {
    flex-shrink: 0;
    padding: 0.4rem 0.65rem;
    font-size: 0.76rem;
    white-space: nowrap;
  }

  /* Filter Controls: Dual Language pills and Sort button */
  .chapters-filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .lang-pills-wrap {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-width: 0;
  }

  .lang-pills-wrap::-webkit-scrollbar {
    display: none;
  }

  .lang-pill {
    padding: 0.3rem 0.5rem;
    font-size: 0.74rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .btn-sort {
    flex-shrink: 0;
    padding: 0.32rem 0.6rem;
    font-size: 0.74rem;
    white-space: nowrap;
    margin-left: auto;
  }

  /* Chapters Download Bar */
  .chapters-download-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    margin: 0.75rem 0;
  }

  .btn-download-all {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    padding: 0.45rem 0.65rem;
    white-space: nowrap;
    justify-content: center;
  }

  .download-dropdown-wrap {
    flex-shrink: 0;
  }

  .btn-download-options {
    font-size: 0.78rem;
    padding: 0.45rem 0.65rem;
    white-space: nowrap;
  }

  /* Chapter Feed List & Item on Mobile */
  .chapters-list {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-right: 0;
    gap: 0.45rem;
    max-height: 520px;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .chapters-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    gap: 0.45rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
  }

  .chapter-item-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .chapter-number-pill {
    min-width: unset;
    font-size: 0.82rem;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .chapter-lang-badge {
    font-size: 0.68rem;
    padding: 0.15rem 0.35rem;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .chapter-title-text {
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
  }

  .chapter-group-badge {
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
    padding: 0.15rem 0.35rem;
    flex-shrink: 0;
    margin-left: 0;
  }

  .chapter-item-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    font-size: 0.75rem;
  }

  .chapter-item-right span {
    display: none; /* Hide "Baca Chapter" text on narrow mobile so chevron and download icon fit gracefully */
  }

  .btn-ch-download {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }

  .badge-downloaded-success {
    font-size: 0.68rem;
    padding: 0.2rem 0.45rem;
    flex-shrink: 0;
  }

  .btn-delete-download {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }

  /* Mirror Search Box on Mobile */
  .mirror-search-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }

  .mirror-search-box input {
    min-width: 0;
    flex: 1 1 100%;
    font-size: 0.82rem;
  }

  .mirror-search-box button {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
  }

  .mirror-matches-row {
    width: 100%;
    box-sizing: border-box;
    padding: 0.4rem 0.5rem;
    overflow-x: auto;
  }

  .mirror-chapters-grid {
    width: 100%;
    box-sizing: border-box;
  }

  /* Reader Engine Toolbar */
  .reader-toolbar {
    height: 52px;
    padding: 0.35rem 0.65rem;
    gap: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .reader-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 1 auto;
    min-width: 0;
  }

  .reader-btn#reader-btn-back span {
    display: none; /* Hide text on mobile for compact navbar */
  }

  .reader-btn#reader-btn-back {
    padding: 0.4rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
  }

  .reader-manga-title {
    max-width: 95px;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .reader-chapter-title {
    display: none; /* Shown in center dropdown and footer */
  }

  .reader-toolbar-center {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
  }

  .badge-offline-mode span {
    display: none;
  }

  .badge-offline-mode {
    padding: 0.2rem 0.4rem;
  }

  .custom-chapter-dropdown {
    flex: 0 1 auto;
    max-width: 130px;
  }

  .custom-dropdown-trigger {
    padding: 0.35rem 0.5rem;
    max-width: 120px;
    font-size: 0.78rem;
  }

  .trigger-label {
    max-width: 75px;
    font-size: 0.75rem;
  }

  .custom-dropdown-panel {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: 56px !important;
    width: calc(100vw - 24px) !important;
    max-width: 440px !important;
    margin: 0 auto !important;
    transform: none !important;
    animation: dropdownMobileFadeIn 180ms cubic-bezier(0.16, 1, 0.3, 1) !important;
    max-height: 65vh !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--border-medium) !important;
  }

  @keyframes dropdownMobileFadeIn {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .reader-page-counter {
    font-size: 0.75rem;
    padding: 0.25rem 0.45rem;
    white-space: nowrap;
  }

  .reader-page-counter i {
    display: none;
  }

  .reader-toolbar-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  }

  .reader-btn-icon {
    width: 36px;
    height: 36px;
  }

  .reader-more-menu {
    position: fixed !important;
    right: 0.65rem !important;
    top: 56px !important;
    width: 270px !important;
    max-width: calc(100vw - 1.3rem) !important;
  }

  /* Reader Footer */
  .reader-footer {
    position: fixed;
    bottom: 0.85rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: 360px;
    margin: 0 auto;
    transform: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    z-index: 100;
  }

  .reader-footer.hidden-bar {
    transform: translateY(160%);
    opacity: 0;
    pointer-events: none;
  }

  .reader-nav-btn {
    flex: 1;
    max-width: none;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    justify-content: center;
    gap: 0.4rem;
  }

  .reader-footer-info {
    display: none !important;
  }

  /* History & Bookmarks */
  .history-container {
    padding: 0.5rem;
  }

  .history-card,
  .bookmark-card {
    flex-direction: row;
    gap: 0.85rem;
    padding: 0.75rem;
  }

  .history-thumb,
  .bookmark-thumb {
    width: 60px;
    height: 85px;
  }

  .history-title,
  .bookmark-title {
    font-size: 0.95rem;
  }

  .history-card .btn-primary,
  .bookmark-card .btn-primary {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
  }

  /* Offline Storage */
  .offline-container {
    padding: 0.5rem;
  }

  .offline-actions {
    margin-top: 0.5rem;
  }

  .btn-clean-read {
    font-size: 0.78rem;
    padding: 0.4rem 0.75rem;
  }

  .offline-manga-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .offline-manga-card {
    padding: 0.85rem;
  }

  /* Download Queue Floating Widget */
  .download-queue-widget {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: auto;
    max-width: 100%;
  }

  /* Site Footer */
  .site-footer {
    padding: 2rem 1rem;
    text-align: center;
  }

  .footer-container {
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
  }

  .footer-badges {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
  .nav-brand .brand-title {
    font-size: 1.05rem;
  }

  .detail-title {
    font-size: 1.25rem;
  }

  .detail-poster {
    width: 140px;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }

  .reader-manga-title {
    max-width: 75px;
  }

  .custom-dropdown-trigger {
    max-width: 105px;
  }

  .trigger-label {
    max-width: 65px;
  }
}

/* ==========================================================================
   PWA INSTALL UI & OFFLINE STYLES
   ========================================================================== */

/* Navbar Install Button */
.btn-install-app {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(255, 103, 64, 0.18), rgba(255, 69, 0, 0.28));
  border: 1px solid rgba(255, 103, 64, 0.45);
  color: #fff;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 10px rgba(255, 103, 64, 0.2);
  white-space: nowrap;
}

.btn-install-app:hover {
  background: linear-gradient(135deg, var(--accent), #ff4500);
  border-color: transparent;
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
  color: #fff;
}

.btn-install-app i {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .btn-install-app {
    display: none !important; /* On mobile, the install button is shown in the mobile drawer */
  }
}

/* Drawer Install App Button */
.drawer-install-wrap {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.drawer-install-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 103, 64, 0.15), rgba(255, 69, 0, 0.25));
  border: 1px solid rgba(255, 103, 64, 0.4);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.drawer-install-btn:hover {
  background: linear-gradient(135deg, rgba(255, 103, 64, 0.25), rgba(255, 69, 0, 0.35));
  border-color: var(--accent);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.drawer-install-btn:active {
  transform: scale(0.98);
}

.drawer-install-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.drawer-install-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
  flex-shrink: 0;
}

.drawer-install-icon i {
  width: 18px;
  height: 18px;
}

.drawer-install-text {
  display: flex;
  flex-direction: column;
}

.drawer-install-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.drawer-install-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.drawer-install-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* iOS PWA Install Modal */
.ios-install-box {
  position: relative;
  width: 90%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  animation: modalPop 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ios-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ios-modal-close:hover {
  color: #fff;
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.ios-install-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ios-install-app-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.ios-install-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.ios-install-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ios-steps-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.ios-step-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.ios-step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px var(--accent-glow);
}

.ios-step-content p {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.45;
}

.inline-ios-icon {
  display: inline-block;
  vertical-align: middle;
  width: 17px;
  height: 17px;
  color: var(--accent);
  margin: 0 2px;
}

.ios-confirm-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ios-confirm-btn:hover {
  background: #ff4500;
  box-shadow: 0 4px 14px var(--accent-glow);
}

