/* ==========================================================================
   MangaREADER - Feuille de Style Principale
   Design Premium, Moderne, Responsive PC & Mobile
   ========================================================================== */

:root,
[data-theme="mangapill"],
[data-theme="mangareader"] {
  /* Thème par défaut: MangaREADER Sombre */
  color-scheme: dark;
  --bg-body: #0b0c12;
  --bg-surface: #13151f;
  --bg-surface-elevated: #1a1d2c;
  --bg-card: #151824;
  --bg-input: #1d2133;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #ff4655;
  
  --primary: #ff4655;
  --primary-hover: #ff2a3b;
  --primary-glow: rgba(255, 70, 85, 0.35);
  
  --secondary: #6366f1;
  --secondary-hover: #4f46e5;
  
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --badge-ongoing: #10b981;
  --badge-completed: #3b82f6;
  --badge-rating: #f59e0b;

  --header-height: 68px;
  --bottom-nav-height: 64px;
  --border-radius: 12px;
  --card-radius: 10px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Thème OLED Pur Noir (Optimisé écrans mobiles AMOLED) */
[data-theme="oled"] {
  color-scheme: dark;
  --bg-body: #000000;
  --bg-surface: #0a0a0a;
  --bg-surface-elevated: #141414;
  --bg-card: #0c0c0c;
  --bg-input: #181818;
  --border-color: rgba(255, 255, 255, 0.12);
  --primary: #ff334b;
}

/* Thème Midnight Blue */
[data-theme="midnight"] {
  color-scheme: dark;
  --bg-body: #090e1a;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --bg-card: #131c31;
  --bg-input: #1a2540;
  --border-color: rgba(99, 102, 241, 0.15);
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-glow: rgba(56, 189, 248, 0.35);
}

/* Thème Light / Papier Sépia */
[data-theme="light"] {
  color-scheme: light;
  --bg-body: #f8f6f0;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1ede4;
  --bg-card: #ffffff;
  --bg-input: #ebe5d8;
  --border-color: rgba(0, 0, 0, 0.08);
  --text-main: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-glow: rgba(225, 29, 72, 0.2);
}

/* Reset de base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body.reader-active {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(19, 21, 31, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo stylisé MangaREADER */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  user-select: none;
}

.brand-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: var(--transition);
  flex-shrink: 0;
}

.brand-logo:hover .brand-logo-img {
  transform: scale(1.06);
}

.pill-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), #ff758c);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: rotate(-10deg);
  transition: var(--transition);
}

.brand-logo:hover .brand-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: var(--transition);
  flex-shrink: 0;
}

.brand-logo:hover .brand-logo-img {
  transform: scale(1.06);
}

.pill-icon {
  transform: rotate(0deg) scale(1.08);
}

.brand-accent {
  color: var(--primary);
}

/* Liens de navigation Desktop */
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: var(--primary);
}

/* Barre de recherche Header */
.header-search-wrap {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.header-search-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  text-align: left;
}

.header-search-icon {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: var(--transition);
}

.header-search-bar:hover {
  border-color: rgba(255, 70, 85, 0.45);
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.header-search-bar:hover .header-search-icon {
  color: var(--primary);
}

.header-search-text-desktop {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-search-text-mobile {
  display: none;
}

.search-shortcut-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-weight: 600;
}

/* Actions Header (Options, Raccourcis) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-select-wrap select {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.theme-select-wrap select:focus {
  border-color: var(--primary);
}

/* Boutons communs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: var(--transition);
  user-select: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 10px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid rgba(220, 38, 38, 0.4);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #ef4444;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.4);
}

.btn-danger:active {
  transform: translateY(0);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-fav-active {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

/* ==========================================================================
   Conteneur Principal
   ========================================================================== */

.app-main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ==========================================================================
   Hero Spotlight Section (Accueil)
   ========================================================================== */

.hero-spotlight {
  position: relative;
  min-height: 440px;
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 40px;
  margin-bottom: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 25%;
  filter: blur(28px) brightness(0.35);
  transform: scale(1.1);
  z-index: 1;
}

.hero-gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg-surface) 35%, rgba(19, 21, 31, 0.8) 70%, transparent 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  flex: 1;
  max-width: 720px;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 70, 85, 0.15);
  border: 1px solid rgba(255, 70, 85, 0.3);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.meta-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffb800;
  font-weight: 700;
}

.badge-status-ongoing {
  color: var(--badge-ongoing);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.badge-status-completed {
  color: var(--badge-completed);
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.hero-synopsis {
  color: #d1d5db;
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.tag-pill {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-poster-wrapper {
  position: relative;
  z-index: 3;
  margin-left: 40px;
  display: none;
}

@media (min-width: 900px) {
  .hero-poster-wrapper {
    display: block;
  }
}

.hero-poster-img {
  width: 220px;
  height: 310px;
  object-fit: cover;
  border-radius: var(--border-radius);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease;
}

.hero-poster-img:hover {
  transform: translateY(-4px) scale(1.02);
}

/* ==========================================================================
   Sections Communes & Titres
   ========================================================================== */

.content-section {
  margin-bottom: 48px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading-icon {
  color: var(--primary);
}

.section-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #ffffff;
}

.section-more-link {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.section-more-link:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

/* ==========================================================================
   Continuer la lecture (Continue Reading)
   ========================================================================== */

.continue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.continue-card {
  display: flex;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.continue-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 70, 85, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.continue-poster {
  position: relative;
  width: 65px;
  height: 90px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}

.continue-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continue-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.continue-card:hover .continue-play-overlay {
  opacity: 1;
}

.continue-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.continue-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.continue-chapter {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.continue-progress-wrapper {
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.continue-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

.continue-page-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Grilles de Cartes Manga (Manga Cards Grid)
   ========================================================================== */

.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
}

@media (max-width: 640px) {
  .manga-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }
}

.manga-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.manga-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 70, 85, 0.35);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.manga-card-cover-wrapper {
  position: relative;
  aspect-ratio: 2 / 2.9;
  overflow: hidden;
  background: #181b28;
}

.manga-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.manga-card:hover .manga-card-img {
  transform: scale(1.06);
}

.manga-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: opacity 0.22s ease;
}

.manga-card:hover .manga-card-overlay {
  opacity: 1;
}

.card-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.card-action-btn:hover {
  transform: scale(1.15);
  background: var(--primary);
  color: #fff;
}

.card-action-btn.active {
  background: var(--primary);
  color: #fff;
}

.rank-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rank-top {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
}

.rating-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #ffb800;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}

.manga-card-info {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.manga-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.manga-card-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
}

.manga-card-type {
  color: var(--text-secondary);
}

.manga-card-status {
  color: var(--badge-ongoing);
  font-weight: 600;
}

/* ==========================================================================
   Dernières Sorties (Latest Updates Cards)
   ========================================================================== */

.latest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.latest-card {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.latest-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 70, 85, 0.3);
}

.latest-poster {
  width: 55px;
  height: 75px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.latest-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.latest-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.latest-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.latest-ch-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.latest-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: normal;
}

.latest-genre {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Pilules de Genre (Genre Pills)
   ========================================================================== */

.genre-pills-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.genre-pills-scroll::-webkit-scrollbar {
  display: none;
}

.genre-pill-btn {
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.genre-pill-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.genre-pill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ==========================================================================
   Vue Explorer / Catalogue
   ========================================================================== */

.explore-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 18px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.explore-search-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
}

.explore-search-filter input {
  flex: 1;
  color: #fff;
  font-size: 0.95rem;
}

.explore-filters-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-select {
  background: var(--bg-surface-elevated);
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.explore-count-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ==========================================================================
   Vue Historique (History Items)
   ========================================================================== */

.history-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 14px 18px;
  transition: var(--transition);
}

.history-item-row:hover {
  border-color: rgba(255, 70, 85, 0.3);
}

.history-thumb {
  width: 55px;
  height: 75px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.history-details {
  flex: 1;
  min-width: 0;
}

.history-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  margin-bottom: 2px;
}

.history-title:hover {
  color: var(--primary);
}

.history-chapter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  display: block;
  margin-bottom: 6px;
}

.history-progress-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
  max-width: 320px;
}

.history-progress-bar {
  height: 100%;
  background: var(--primary);
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* État vide (Empty State) */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
}

.empty-state svg {
  color: var(--text-muted);
}

.empty-state h3 {
  color: #fff;
  font-size: 1.25rem;
}

.empty-state p {
  max-width: 440px;
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ==========================================================================
   Modals (Détails Manga & Recherche)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  touch-action: manipulation;
  overscroll-behavior: contain;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: var(--primary);
  transform: scale(1.1);
}

/* Détails Manga dans le Modal */
.detail-hero {
  position: relative;
  background-size: cover;
  background-position: center;
  padding: 40px 30px;
}

.detail-hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(19, 21, 31, 0.7) 0%, var(--bg-surface) 100%);
  backdrop-filter: blur(20px);
}

.detail-header-inner {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 28px;
}

@media (max-width: 640px) {
  .detail-header-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.detail-cover-img {
  width: 190px;
  height: 270px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.detail-header-info {
  flex: 1;
}

.detail-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.badge-type {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-year {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2px 4px;
}

.detail-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
  color: #fff;
}

.detail-alt-title {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.detail-genres-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-main-content {
  padding: 24px 30px 40px;
}

.detail-section {
  margin-bottom: 30px;
}

.section-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.detail-synopsis-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #d1d5db;
}

.chapters-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.chapters-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-field {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #fff;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.chapters-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 6px;
}

.chapter-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.chapter-row-item:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary);
  transform: translateX(4px);
}

.chapter-current-read {
  border-color: var(--primary) !important;
  background: rgba(255, 70, 85, 0.08) !important;
}

.chapter-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chapter-row-num {
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
}

.chapter-row-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.chapter-row-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.chapter-badge-read {
  background: var(--primary);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* Modal Recherche */
.search-dialog {
  max-width: 640px;
  background: var(--bg-surface);
}

#search-modal .search-dialog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-input-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.search-input-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 9px 14px;
  transition: var(--transition);
}

.search-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 70, 85, 0.18);
}

.search-input-icon {
  flex-shrink: 0;
  color: var(--primary);
}

.search-input-box input {
  flex: 1;
  min-width: 0;
  width: 100%;
  font-size: 1rem;
  color: var(--text-main);
  background: transparent;
}

.search-input-box input::-webkit-search-decoration,
.search-input-box input::-webkit-search-cancel-button,
.search-input-box input::-webkit-search-results-button,
.search-input-box input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

#close-search-modal {
  flex-shrink: 0;
}

.search-results-list {
  flex: 1;
  min-height: 0;
  max-height: 480px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-item {
  display: flex;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  background: var(--bg-surface-elevated);
}

.search-item-thumb {
  width: 48px;
  height: 68px;
  border-radius: 6px;
  object-fit: cover;
}

.search-item-info {
  flex: 1;
  min-width: 0;
}

.search-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.search-item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.search-item-synopsis {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-hint, .search-empty, .search-loading {
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Spinner de chargement */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   LE LECTEUR DE MANGA (READER VIEW)
   Mode Immersion, Haute Performance
   ========================================================================== */

#reader-view {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000000;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-anchor: none;
  user-select: none;
  --reader-dimmer-opacity: 0;
  --reader-brightness: 1;
}

/* Voile d'assombrissement pour lecture dans le noir */
.reader-dimmer-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 310;
  background: rgba(0, 0, 0, var(--reader-dimmer-opacity, 0));
  transition: background 0.25s ease;
}

/* Bouton raccourci Mode Nuit dans la topbar */
#reader-night-toggle-btn.active {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4) !important;
}

#reader-night-toggle-btn.active svg {
  stroke: #fbbf24;
  fill: rgba(251, 191, 36, 0.35);
}

/* Filtres visuels et confort nocturne */
.reader-pages {
  filter: brightness(var(--reader-brightness, 1));
  transition: filter 0.25s ease;
}

#reader-view[data-filter="night"] {
  --reader-dimmer-opacity: 0.35;
  --reader-brightness: 0.65;
}

#reader-view[data-filter="night"] .reader-pages {
  filter: brightness(var(--reader-brightness, 0.65)) contrast(0.95);
}

#reader-view[data-filter="deep-night"] {
  --reader-dimmer-opacity: 0.55;
  --reader-brightness: 0.45;
}

#reader-view[data-filter="deep-night"] .reader-pages {
  filter: brightness(var(--reader-brightness, 0.45)) contrast(0.92) sepia(0.12);
}

#reader-view[data-filter="warm"] .reader-pages {
  filter: brightness(var(--reader-brightness, 0.95)) sepia(0.2) contrast(0.95);
}

#reader-view[data-filter="sepia"] .reader-pages {
  filter: brightness(var(--reader-brightness, 0.95)) sepia(0.65) contrast(0.9);
}

#reader-view[data-filter="contrast"] .reader-pages {
  filter: brightness(var(--reader-brightness, 1)) contrast(1.25);
}

button[data-reader-brightness].active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

/* Barre supérieure flottante (Top Bar) */
.reader-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 320;
  height: 60px;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.reader-topbar.ui-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.reader-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.reader-manga-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.reader-chapter-select {
  background: #181a24;
  color: #ffffff;
  color-scheme: dark;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 240px;
}

.reader-chapter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.reader-chapter-select option,
select option {
  background-color: #181a24 !important;
  color: #ffffff !important;
  padding: 8px 12px;
}

.reader-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Menu déroulant des paramètres du lecteur */
.reader-settings-menu {
  position: absolute;
  top: 68px;
  right: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  width: 320px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  z-index: 330;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-options-row.wrap-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.setting-section-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 6px;
}

.setting-options-row {
  display: flex;
  gap: 6px;
}

.setting-btn {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.setting-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.setting-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
}

.hold-zoom-config-box {
  transition: opacity 0.2s ease;
}

.hold-zoom-config-box.disabled-config {
  opacity: 0.38;
  pointer-events: none;
}

/* Styles pour le Zoom au maintien sur une planche */
.reader-pages img {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.16s cubic-bezier(0.2, 0, 0.2, 1);
}

.reader-page-item.hold-zoom-item-active {
  position: relative;
  z-index: 60;
}

.reader-pages img.hold-zoom-active {
  position: relative;
  z-index: 65;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.9);
  cursor: move;
}

.reader-zoom-indicator {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 335;
  background: rgba(19, 21, 31, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
}

/* Zone des Pages */
.reader-pages {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 60px;
  margin-bottom: 70px;
  min-height: calc(100vh - 130px);
  overflow-anchor: none;
}

.reader-pages.mode-single,
.reader-pages.mode-double {
  justify-content: center;
}

/* Mode Cascade (Webtoon / Vertical Scroll) */
.reader-pages.mode-cascade {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 60px auto 70px auto;
  padding: 10px 0;
  text-align: center;
}

.cascade-item {
  display: block;
  width: 100%;
  margin: 0 auto 8px auto;
  padding: 0;
  scroll-margin-top: 70px;
}

.cascade-item img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 2px;
}

/* Mode Page Unique */
.reader-pages.mode-single {
  position: relative;
  width: 100%;
  height: calc(100vh - 130px);
}

.single-item {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.single-item img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
}

/* Zones de clic invisibles sur les côtés */
.click-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 10;
  cursor: pointer;
}

.click-zone-left {
  left: 0;
  width: 35%;
}

.click-zone-center {
  left: 35%;
  width: 30%;
}

.click-zone-right {
  right: 0;
  width: 35%;
}

/* Mode Double Page (Desktop) */
.reader-pages.mode-double .double-item {
  display: flex;
  gap: 6px;
  max-height: calc(100vh - 140px);
}

.double-item img {
  max-height: calc(100vh - 140px);
  width: auto;
  object-fit: contain;
}

/* Ajustements de taille (Fit) */
.reader-pages.fit-width .single-item img,
.reader-pages.fit-width .cascade-item img {
  width: 100%;
  max-width: 1100px;
}

.reader-pages.fit-height .single-item img {
  height: 90vh;
  width: auto;
}

/* Carte de fin de chapitre en cascade */
.reader-cascade-end {
  padding: 50px 20px;
  text-align: center;
}

.end-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 30px;
  max-width: 480px;
  margin: 0 auto;
}

.end-card h3 {
  font-size: 1.4rem;
  margin-bottom: 6px;
  color: #fff;
}

.end-card p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.end-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Barre inférieure flottante (Bottom Bar) */
.reader-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 320;
  height: 60px;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.reader-bottombar.ui-hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.reader-slider-wrap {
  flex: 1;
  max-width: 500px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 auto;
}

.reader-slider {
  flex: 1;
  height: 6px;
  accent-color: var(--primary);
  cursor: pointer;
}

.reader-page-info {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 120px;
  text-align: center;
}

.reader-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Navigation Mobile Inférieure (Mobile Bottom Bar)
   ========================================================================== */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(19, 21, 31, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  z-index: 90;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  flex: 1;
  height: 100%;
  transition: var(--transition);
}

.mobile-nav-btn.active, .mobile-nav-btn:hover {
  color: var(--primary);
}

@media (max-width: 768px) {
  /* Navigation & Header Mobile */
  .app-header {
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }
  .header-container {
    padding: 0 12px;
    gap: 8px;
  }
  .brand-logo {
    font-size: 1.15rem;
    gap: 6px;
  }
  .brand-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }
  .pill-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }
  .pill-icon svg {
    width: 16px;
    height: 16px;
  }
  .nav-links {
    display: none;
  }
  .header-search-wrap {
    flex: 0 0 auto;
    max-width: none;
    margin-left: auto;
  }
  .header-search-bar {
    width: auto;
    height: 36px;
    padding: 0 13px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.14);
    gap: 7px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  }
  .header-search-bar:active {
    transform: scale(0.96);
    border-color: var(--primary);
    background: rgba(255, 70, 85, 0.15);
  }
  .header-search-icon {
    width: 15px;
    height: 15px;
    color: var(--primary);
  }
  .header-search-text-desktop {
    display: none;
  }
  .header-search-text-mobile {
    display: inline;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
  }
  .search-shortcut-badge {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  #shortcuts-modal-btn {
    display: none; /* Raccourcis clavier masqués sur mobile tactile */
  }
  #options-modal-btn {
    height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    gap: 5px;
  }

  /* Barre de navigation inférieure mobile (Bottom Nav) */
  .mobile-bottom-nav {
    display: flex;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    touch-action: manipulation;
  }
  .mobile-nav-btn {
    font-size: 0.65rem;
    gap: 2px;
    padding: 2px;
  }
  .mobile-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  /* Espacement principal & sections */
  .app-main {
    padding: 0 10px 85px;
  }
  .content-section {
    margin-bottom: 28px;
  }
  .section-title {
    font-size: 1.15rem;
  }
  .section-header-row {
    margin-bottom: 12px;
  }

  /* Hero Spotlight compact pour smartphone */
  .hero-spotlight {
    min-height: auto;
    padding: 18px 14px;
    margin-bottom: 20px;
    border-radius: 12px;
  }
  .hero-badge-pill {
    padding: 4px 8px;
    font-size: 0.68rem;
    margin-bottom: 8px;
  }
  .hero-title {
    font-size: 1.45rem;
    line-height: 1.2;
    margin-bottom: 6px;
  }
  .hero-meta {
    font-size: 0.78rem;
    gap: 8px;
    margin-bottom: 10px;
  }
  .hero-synopsis {
    font-size: 0.82rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    margin-bottom: 12px;
  }
  .hero-tags {
    gap: 5px;
    margin-bottom: 14px;
  }
  .tag-pill {
    padding: 2px 7px;
    font-size: 0.7rem;
  }
  .hero-actions {
    gap: 8px;
    width: 100%;
  }
  .hero-actions .btn {
    padding: 8px 12px;
    font-size: 0.82rem;
    flex: 1;
    min-width: 120px;
  }
  #hero-fav-btn {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  /* Grilles sur mobile (2 colonnes pour les posters) */
  .manga-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .manga-card-info {
    padding: 8px 8px 10px;
  }
  .manga-card-title {
    font-size: 0.82rem;
    margin-bottom: 4px;
  }
  .manga-card-sub {
    font-size: 0.7rem;
  }
  .continue-grid,
  .latest-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .continue-card {
    padding: 8px 10px;
    gap: 10px;
  }
  .continue-poster {
    width: 55px;
    height: 75px;
  }

  /* Toolbar Explore / Filtres */
  .explore-toolbar {
    padding: 12px;
    gap: 10px;
  }
  .explore-filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-group {
    width: 100%;
    justify-content: space-between;
  }
  .filter-select {
    flex: 1;
    max-width: 65%;
  }

  /* Modals en style Bottom Sheet optimisé pour smartphone */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-dialog {
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px 18px 0 0;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
  }

  /* Modal de recherche aligné en haut sur mobile pour éviter que le clavier ne masque les résultats */
  #search-modal.modal-backdrop {
    align-items: flex-start;
    padding: 8px 8px 0;
  }
  #search-modal .search-dialog {
    border-radius: 16px;
    max-height: calc(100dvh - 16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #search-modal .search-input-header {
    padding: 10px 12px;
    gap: 8px;
  }
  #search-modal .search-input-box {
    padding: 8px 12px;
    border-radius: 10px;
  }
  #search-modal .search-input-box input {
    font-size: 16px; /* Empêche l'auto-zoom iOS Safari et la troncature */
  }
  #search-modal .search-source-selector-bar {
    padding: 7px 12px;
    gap: 6px;
  }
  #search-modal .search-source-label {
    display: none;
  }
  #search-modal .search-results-list {
    max-height: none;
    padding: 8px 10px 14px;
  }
  .options-modal-body {
    padding: 16px 14px;
    gap: 14px;
  }
  .option-group {
    padding: 14px 12px;
    gap: 10px;
  }
  .option-header-title h4 {
    font-size: 0.95rem;
  }
  .option-desc {
    font-size: 0.75rem;
  }
  .theme-picker-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .theme-card-btn {
    padding: 8px 6px;
    gap: 5px;
  }
  .theme-card-preview {
    height: 32px;
  }
  .theme-card-label {
    font-size: 0.7rem;
  }
  .db-status-box {
    padding: 10px 12px;
  }
  .db-stat-value {
    font-size: 1rem;
  }
  .db-actions-row {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .db-actions-row .btn {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  /* Lecteur de Manga sur Mobile (2 lignes propres sans superposition) */
  .reader-topbar {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
    gap: 6px;
  }
  .reader-top-left {
    width: 100%;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
  }
  #reader-close-btn {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }
  .reader-manga-title {
    flex: 1;
    min-width: 0;
    max-width: none;
    font-size: 0.85rem;
  }
  .reader-lang-select {
    font-size: 0.74rem;
    padding: 4px 6px;
    max-width: 82px;
    flex-shrink: 0;
  }
  .reader-chapter-select {
    font-size: 0.74rem;
    padding: 4px 6px;
    max-width: 118px;
    flex-shrink: 0;
    text-overflow: ellipsis;
  }
  .reader-top-right {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    justify-content: space-between;
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .reader-top-right .btn-icon {
    flex: 1 1 0;
    min-width: 0;
    padding: 0;
    height: 34px;
    width: auto;
    max-width: 44px;
  }
  #reader-fullscreen-btn {
    display: none;
  }
  .reader-settings-menu {
    top: calc(100% + 6px);
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 70vh;
  }
  .reader-pages,
  .reader-pages.mode-cascade {
    margin-top: 96px;
    margin-bottom: 60px;
  }
  .reader-pages.mode-single {
    height: calc(100dvh - 156px);
  }
  .reader-bottombar {
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding: 0 10px env(safe-area-inset-bottom, 0px);
    gap: 8px;
  }
  .reader-slider-wrap {
    gap: 8px;
    min-width: 0;
  }
  .reader-page-info {
    font-size: 0.75rem;
    min-width: 78px;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  #options-modal-btn span {
    display: none; /* Icône d'engrenage seule sur les très petits écrans */
  }
  #options-modal-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 350px) {
  .header-search-text-mobile {
    display: none;
  }
  .header-search-bar {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
}

/* ==========================================================================
   Pied de Page (Footer)
   ========================================================================== */

.app-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-disclaimer {
  max-width: 600px;
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ==========================================================================
   Styles Mode Hors-Ligne & Téléchargements
   ========================================================================== */

.offline-banner {
  position: sticky;
  top: 0;
  z-index: 150;
  background: linear-gradient(90deg, #d97706, #b45309);
  color: #fff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.nav-link-offline {
  color: #10b981 !important;
}

.nav-link-offline:hover {
  background: rgba(16, 185, 129, 0.12) !important;
}

.badge-offline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.offline-size-badge {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 4px;
}

.chapter-offline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ch-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}

.btn-ch-action:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-ch-action.download-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-ch-action.export-btn {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.btn-ch-action.export-btn:hover {
  background: rgba(59, 130, 246, 0.25);
}

.btn-ch-action.delete-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Grille et blocs de mangas hors-ligne */
.downloads-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.offline-manga-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
}

.offline-manga-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.offline-manga-thumb {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
}

.offline-manga-title-wrap {
  flex: 1;
}

.offline-manga-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  margin-bottom: 2px;
}

.offline-manga-title:hover {
  color: var(--primary);
}

.offline-manga-count {
  font-size: 0.82rem;
  color: #10b981;
  font-weight: 600;
}

.offline-chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.offline-chapter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 12px 14px;
  transition: var(--transition);
}

.offline-chapter-card:hover {
  border-color: rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.offline-ch-info {
  display: flex;
  flex-direction: column;
}

.offline-ch-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.offline-ch-pages {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.offline-ch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal Raccourcis Clavier */
.modal-header-simple {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

.shortcuts-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  gap: 12px;
}

.shortcut-desc {
  font-size: 0.88rem;
  color: var(--text-main);
  font-weight: 500;
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.1);
}

.search-cors-notice {
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.search-file-hint {
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #c7d2fe;
}

/* ==========================================================================
   Modal Options & Préférences (Theme Switcher & Gestion Base de données)
   ========================================================================== */

.options-modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.option-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-header-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.option-header-title h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.option-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Grille de sélection de thème visuelle */
.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 10px;
}

.theme-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 8px;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  text-align: center;
}

.theme-card-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.theme-card-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow);
  background: rgba(255, 70, 85, 0.08);
}

.theme-card-preview {
  width: 100%;
  height: 38px;
  border-radius: 6px;
  display: block;
}

.theme-preview-mangapill {
  background: linear-gradient(135deg, #0b0c12 60%, #ff4655 100%);
  border: 1px solid rgba(255, 70, 85, 0.4);
}

.theme-preview-oled {
  background: linear-gradient(135deg, #000000 60%, #ff334b 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-preview-midnight {
  background: linear-gradient(135deg, #090e1a 60%, #38bdf8 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.theme-preview-light {
  background: linear-gradient(135deg, #f5f0e8 60%, #d97706 100%);
  border: 1px solid rgba(217, 119, 6, 0.4);
}

.theme-card-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

/* Statut et actions Base de données */
.db-status-box {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
}

.db-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.db-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.db-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.db-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.db-feedback-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  animation: fadeIn 0.2s ease-out;
}

.db-feedback-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.db-feedback-danger {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #f87171;
}

/* ==========================================================================
   Options Arrière-Plan du Lecteur (Textures & Couleurs unies)
   ========================================================================== */

.bg-section-subtitle {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.reader-textures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.texture-choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  text-align: center;
}

.texture-choice-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.texture-choice-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow);
  background: rgba(255, 70, 85, 0.08);
}

.texture-thumb {
  width: 100%;
  height: 52px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.texture-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.reader-colors-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.color-swatch-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.color-swatch-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  background: rgba(255, 70, 85, 0.08);
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.custom-color-wrap {
  position: relative;
  display: inline-flex;
}

.custom-color-wrap input[type="color"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.custom-color-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-surface-elevated);
  border: 2px dashed var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.custom-color-wrap:hover .custom-color-label {
  border-color: var(--primary);
  color: #fff;
}

.custom-color-wrap.active .custom-color-label {
  border-color: var(--primary);
  border-style: solid;
  color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* ==========================================================================
   Multi-Sources Manga Selector & Badges
   ========================================================================== */

/* Badges de source sur les cartes & fiches */
.badge-source,
.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-source-mangapill,
.source-tag-pill {
  background: rgba(236, 72, 153, 0.16);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.35);
}

.badge-source-mangadex,
.source-tag-dex {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-source-local,
.source-tag-local {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.badge-source-all,
.source-tag-rec {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Grille de sélection des sources dans le modal Options */
.source-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .source-picker-grid {
    grid-template-columns: 1fr;
  }
}

.source-card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  color: inherit;
}

.source-card-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04);
}

.source-card-btn.active {
  border-color: var(--primary);
  background: rgba(255, 70, 85, 0.08);
  box-shadow: 0 0 16px var(--primary-glow);
}

.source-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.source-card-icon {
  font-size: 1.25rem;
}

.source-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
}

.source-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

/* Barre de filtres de source dans la recherche rapide (Ctrl+K) */
.search-source-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.search-source-selector-bar::-webkit-scrollbar {
  display: none;
}

.search-source-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-source-pills {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
}

.search-source-pill {
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.search-source-pill:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.search-source-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* État vide élégant dans le lecteur (quand aucune page sur une source) */
.reader-empty-chapter-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 24px;
  width: 100%;
}

.empty-state-card {
  max-width: 520px;
  background: rgba(20, 22, 32, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.empty-state-card svg {
  color: #f59e0b;
}

.empty-state-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.empty-state-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.empty-state-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}

/* ==========================================================================
   Home Page : Derniers Mangas Lus (Recent Reads)
   ========================================================================== */

.recent-reads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .recent-reads-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.recent-read-card {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 12px;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.recent-read-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 70, 85, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.recent-read-poster {
  position: relative;
  width: 72px;
  height: 102px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #181b28;
}

.recent-read-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.recent-read-card:hover .recent-read-poster img {
  transform: scale(1.06);
}

.recent-read-play-btn {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.recent-read-card:hover .recent-read-play-btn {
  opacity: 1;
}

.recent-read-play-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.recent-read-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.recent-read-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-read-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-read-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.recent-read-chapter {
  color: var(--primary);
  font-weight: 600;
}

.recent-read-progress-wrap {
  margin: 6px 0 4px 0;
}

.recent-read-progress-bar-bg {
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.recent-read-progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.recent-read-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recent-read-resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 70, 85, 0.15);
  border: 1px solid rgba(255, 70, 85, 0.3);
  border-radius: 20px;
  color: #ff8590;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.recent-read-card:hover .recent-read-resume-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==========================================================================
   Home Page : Mangas Similaires & Recommandations
   ========================================================================== */

.similar-match-summary {
  font-size: 0.8rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.similar-match-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.9);
  color: #ffffff;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.similar-reason-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ==========================================================================
   Home Page : Bannière de Bienvenue / Starter Guide
   ========================================================================== */

.welcome-starter-card {
  background: linear-gradient(135deg, rgba(255, 70, 85, 0.12) 0%, rgba(20, 24, 38, 0.9) 100%);
  border: 1px solid rgba(255, 70, 85, 0.25);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.welcome-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.welcome-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 680px;
  margin-bottom: 20px;
}

.welcome-desc strong {
  color: #fff;
}

.welcome-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Sélection de la Langue du Manga (Modal Détails)
   ========================================================================== */

.detail-lang-selector-bar {
  margin: 12px 0 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-pills-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-pills-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.lang-pill-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.lang-pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px var(--primary-glow);
}

.lang-single-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.lang-single-badge {
  font-size: 0.84rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* ==========================================================================
   Sélecteur de Langue dans le Lecteur (Reader Topbar)
   ========================================================================== */

.reader-lang-select {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  max-width: 105px;
}

.reader-lang-select:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
}

.reader-lang-select option {
  background: #181b28;
  color: #fff;
}

/* ==========================================================================
   Grille de Choix de Langue dans le Modal Options
   ========================================================================== */

.lang-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.lang-choice-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.lang-choice-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.lang-choice-btn.active {
  background: rgba(255, 70, 85, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow);
}

.lang-choice-flag {
  font-size: 1.6rem;
  line-height: 1;
}

.lang-choice-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lang-choice-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.lang-choice-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.25;
}

/* ==========================================================================
   Toasts de notification (Partage de lien, etc.)
   ========================================================================== */
.app-toast-container {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.app-toast {
  background: rgba(19, 21, 31, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 70, 85, 0.4);
  color: #fff;
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75);
  animation: toastSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.app-toast.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
}

.app-toast svg {
  color: #10b981;
  flex-shrink: 0;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Homepage Première Connexion : "Découvrez un manga"
   ========================================================================== */
.home-first-visit {
  min-height: calc(100vh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 40px;
}

.discover-hero-card {
  width: 100%;
  max-width: 740px;
  background: radial-gradient(circle at top right, rgba(255, 70, 85, 0.14), transparent 55%),
              var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 44px 36px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.discover-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 70, 85, 0.14);
  border: 1px solid rgba(255, 70, 85, 0.3);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.discover-title {
  font-size: 2.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.discover-subtitle {
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 540px;
  margin: 0 auto 28px;
  line-height: 1.55;
}

.discover-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 8px 10px 8px 16px;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.discover-search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 70, 85, 0.18);
}

.discover-search-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.discover-search-bar input {
  flex: 1;
  min-width: 0;
  color: var(--text-main);
  font-size: 1rem;
  background: transparent;
}

.discover-source-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.discover-results-wrap {
  margin-top: 20px;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.discover-footer-links {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

@media (max-width: 640px) {
  .home-first-visit {
    min-height: calc(100vh - 180px);
    padding: 16px 0;
  }
  .discover-hero-card {
    padding: 28px 16px;
    border-radius: 16px;
  }
  .discover-title {
    font-size: 1.65rem;
  }
  .discover-subtitle {
    font-size: 0.86rem;
    margin-bottom: 20px;
  }
  .discover-search-bar {
    padding: 6px 8px 6px 12px;
  }
  .discover-search-bar input {
    font-size: 16px;
  }
  #home-discover-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   Aperçu Marques-pages sur la Homepage
   ========================================================================== */
.home-bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.home-bookmark-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition);
}

.home-bookmark-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 70, 85, 0.45);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.home-bookmark-thumb {
  width: 48px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.home-bookmark-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.home-bookmark-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-bookmark-loc {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.home-bookmark-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Lecteur : Bouton Marque-page actif
   ========================================================================== */
#reader-bookmark-btn.bookmark-active {
  background: rgba(255, 70, 85, 0.22) !important;
  color: var(--primary) !important;
  border-color: rgba(255, 70, 85, 0.55) !important;
  box-shadow: 0 0 12px var(--primary-glow) !important;
}

/* ==========================================================================
   Onglets Favoris & Gestionnaire de Marques-pages par Manga / Chapitre
   ========================================================================== */
.bookmarks-tabs-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.bookmarks-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}

.bookmarks-tab-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.bookmarks-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.tab-count-pill {
  background: rgba(0, 0, 0, 0.28);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.page-bookmarks-manager {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pb-manga-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 18px;
}

.pb-manga-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pb-manga-thumb {
  width: 48px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.pb-manga-meta {
  flex: 1;
  min-width: 160px;
}

.pb-manga-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  margin-bottom: 2px;
}

.pb-manga-title:hover {
  color: var(--primary);
}

.pb-manga-stats {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pb-chapters-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pb-chapter-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
}

.pb-chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pb-chapter-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pb-chapter-badge {
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
}

.pb-chapter-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pb-chapter-count {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.pb-chapter-delete-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: var(--transition);
}

.pb-chapter-delete-btn:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.pb-pages-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pb-page-chip {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: var(--transition);
}

.pb-page-chip:hover {
  border-color: var(--primary);
}

.pb-page-go-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: var(--text-main);
  font-size: 0.8rem;
}

.pb-page-go-btn svg {
  color: var(--primary);
}

.pb-page-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pb-page-remove-btn {
  padding: 6px 9px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  border-left: 1px solid var(--border-color);
  transition: var(--transition);
}

.pb-page-remove-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* ==========================================================================
   Mon Compte, Statistiques, Notes & Studio Polaroid
   ========================================================================== */
#account-nav-btn {
  border-radius: 999px;
}

@media (max-width: 480px) {
  #account-nav-btn span {
    display: none;
  }
  #account-nav-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
  }
}

.account-dashboard {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.account-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.account-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.account-card-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.account-auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.account-auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-auth-box h4 {
  font-size: 0.98rem;
  color: #fff;
  font-weight: 700;
}

.account-form-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.account-form-row .input-field {
  flex: 1;
  min-width: 0;
}

.account-profile-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.account-profile-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #ff758c);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-username {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.account-sync-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
  flex-wrap: wrap;
}

.sync-key-code {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--primary);
  font-weight: 700;
}

.account-last-sync {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.account-sync-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.stat-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
}

.stat-kpi-value small {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.stat-period-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.stat-period-rows strong {
  color: #fff;
}

.stats-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.stats-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.stats-bars-wrap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  height: 140px;
  align-items: end;
}

.stats-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 6px;
}

.stats-bar-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  min-height: 14px;
  white-space: nowrap;
}

.stats-bar-track {
  flex: 1;
  width: 100%;
  max-width: 34px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.stats-bar-fill {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  transition: height 0.3s ease;
}

.stats-bar-fill.has-data {
  background: linear-gradient(to top, var(--primary), #ff758c);
  box-shadow: 0 0 12px var(--primary-glow);
}

.stats-bar-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.account-notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
}

.account-note-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.account-note-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.account-note-meta strong {
  color: #fff;
}

.account-note-date {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.account-note-text {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.45;
  margin: 0;
}

.note-color-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.note-color-dot.active {
  transform: scale(1.18);
  border-color: #fff;
}

/* Studio Polaroid */
.polaroid-dialog {
  max-width: 820px;
  background: var(--bg-surface);
}

.polaroid-studio-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
  align-items: start;
}

.polaroid-preview-col {
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
}

#polaroid-canvas {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#polaroid-canvas.dragging {
  cursor: grabbing;
}

.polaroid-controls-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.polaroid-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

@media (max-width: 768px) {
  .polaroid-studio-body {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 14px;
  }
  #polaroid-canvas {
    max-width: 240px;
  }
}



