:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-2: #222634;
  --text: #e6e9f2;
  --muted: #949bb0;
  --border: #2c3244;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --reader-bg: #141720;
  --reader-text: #dde2ef;
  --reader-font-size: 18px;
  --reader-font-family: Georgia, "Noto Serif", serif;
  --reader-line-height: 1.85;
  --reader-max-width: 100%;
  --reader-text-align: justify;
}

body.theme-light {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #1c2030;
  --muted: #5b6278;
  --border: #dcdfe9;
  --reader-bg: #ffffff;
  --reader-text: #1e2230;
}

body.theme-sepia {
  --bg: #ece3d2;
  --surface: #f7f1e3;
  --surface-2: #ede3cf;
  --text: #3a2e22;
  --muted: #766452;
  --border: #d8cbb4;
  --reader-bg: #f9f3e6;
  --reader-text: #382c1f;
}

body.theme-amoled {
  --bg: #000000;
  --surface: #0a0a0d;
  --surface-2: #141419;
  --text: #e2e4ec;
  --muted: #8b90a0;
  --border: #20222b;
  --reader-bg: #000000;
  --reader-text: #d8dae3;
}

body.theme-forest {
  --bg: #0b1612;
  --surface: #11211b;
  --surface-2: #192e26;
  --text: #dff0e8;
  --muted: #8cb0a0;
  --border: #234034;
  --reader-bg: #0e1c17;
  --reader-text: #d6ebe0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 0.5rem; }
.badge-ver {
  font-size: 0.72rem;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.nav-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.nav-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-btn.active { background: var(--primary); color: #fff; }

.container { max-width: 1120px; margin: 1.5rem auto; padding: 0 1.25rem 3rem; }
.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; font-weight: 500; }
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 0.32rem 0.65rem; font-size: 0.8rem; }

.novel-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}
.novel-title { font-weight: 700; font-size: 1.05rem; }
.novel-orig { font-size: 0.85rem; color: var(--muted); }
.novel-meta { font-size: 0.8rem; color: var(--muted); display: flex; gap: 0.75rem; flex-wrap: wrap; }

.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.reader-paper {
  background: var(--reader-bg);
  color: var(--reader-text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem clamp(1.2rem, 4vw, 3.2rem);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  font-family: var(--reader-font-family);
  max-width: var(--reader-max-width);
  margin: 0 auto;
}
.reader-paper h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin-bottom: 1.25rem;
  font-size: 1.45em;
  line-height: 1.3;
}
.reader-paper p { margin-bottom: 1.1em; text-align: var(--reader-text-align); }

.split-view { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 820px) { .split-view { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; background: var(--surface-2); }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.pill-verified { background: rgba(16, 185, 129, 0.15); color: var(--success); border-color: var(--success); }
.pill-auto { background: rgba(245, 158, 11, 0.15); color: var(--warning); border-color: var(--warning); }

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--primary);
  padding: 0.75rem 1.15rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  z-index: 999;
  display: none;
  max-width: 380px;
}
.toast.show { display: block; }
.toast.error { border-color: var(--danger); }

.alert-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--danger);
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}
.context-box {
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  color: var(--muted);
}
.form-row { margin-bottom: 0.85rem; }
.flex-gap { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }


/* --- v1.2.0: Resaltado interactivo de Glosario, Modales y Cola por Lotes --- */
.glossary-hit {
  border-bottom: 1.5px dotted var(--primary);
  background: rgba(99, 102, 241, 0.12);
  border-radius: 3px;
  padding: 0 2px;
  cursor: pointer;
  transition: background 0.15s;
}
.glossary-hit:hover {
  background: rgba(99, 102, 241, 0.28);
}
.glossary-hit.verified {
  border-bottom-color: var(--success);
  background: rgba(16, 185, 129, 0.11);
}
.glossary-hit.verified:hover {
  background: rgba(16, 185, 129, 0.25);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 520px;
  width: 100%;
  padding: 1.35rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}

.progress-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 12px;
  overflow: hidden;
  margin: 0.65rem 0;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.25s ease;
}
.batch-log {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.6rem;
}
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.panel-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}


/* --- v1.3.0: Reproductor Audiolibro TTS y Duplicados --- */
.tts-bar {
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.tts-bar.open { display: flex; }
.tts-speaking {
  background: rgba(99, 102, 241, 0.16);
  border-left: 3px solid var(--primary);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}
.dup-group {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}
.dup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}
.dup-item:first-of-type { border-top: none; }


/* --- v1.4.0: Selección Rápida Glosario, Modo Inmersivo y Explorador --- */
.selection-fab {
  position: fixed;
  z-index: 300;
  display: none;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 0.42rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.selection-fab:hover { background: var(--primary-hover); }

body.immersive-mode .topbar,
body.immersive-mode #reader-controls-card,
body.immersive-mode .reader-toolbar {
  display: none !important;
}
body.immersive-mode .container {
  max-width: 860px;
  margin-top: 1rem;
  padding-bottom: 5rem;
}

.immersive-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.45rem 0.85rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  gap: 0.45rem;
  z-index: 250;
  opacity: 0.88;
  transition: opacity 0.2s;
}
.immersive-bar:hover { opacity: 1; }
body.immersive-mode .immersive-bar { display: flex; }

.search-result-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
}
.search-snippet {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}
.chip-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.28rem 0.72rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }


/* --- v1.5.0: Preload, VIP Banner, Notas, Detección Gratis --- */
.selection-fab-wrap {
  position: fixed;
  z-index: 300;
  display: none;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 99px;
  padding: 0.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.selection-fab-wrap button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 0.35rem 0.78rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.selection-fab-wrap button.fab-note {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.selection-fab-wrap button:hover { opacity: 0.9; }

.vip-banner {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid var(--warning);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.preload-badge {
  font-size: 0.76rem;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.note-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0.65rem;
}
.note-quote {
  border-left: 3px solid var(--primary);
  padding-left: 0.65rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}


/* --- v1.6.0: Estadísticas, Estanterías, Favoritos y Optimización Móvil PWA --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}
.stat-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.shelf-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.shelf-pill {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.32rem 0.78rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.shelf-pill.active, .shelf-pill:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.fav-btn {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}
.tag-chip {
  display: inline-block;
  background: rgba(99, 102, 241, 0.14);
  color: var(--text);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 0.72rem;
}
.chapter-meta-strip {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

@media (max-width: 640px) {
  .topbar {
    padding: 0.65rem 0.85rem;
    flex-direction: column;
    align-items: stretch;
  }
  .nav-tabs {
    justify-content: space-between;
  }
  .nav-btn {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.4rem;
    font-size: 0.82rem;
  }
  .container {
    padding: 0 0.75rem 4rem;
    margin-top: 1rem;
  }
  .reader-paper {
    padding: 1.25rem 1rem;
    line-height: 1.8;
  }
  .reader-toolbar {
    padding: 0.6rem;
  }
}


/* --- v1.7.0: Portadas, Tipografía Avanzada y Búsqueda en Capítulos --- */
.novel-top-row {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.novel-cover {
  width: 68px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #1b2a38, #133c33);
}
.novel-cover-placeholder {
  width: 68px;
  height: 96px;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #1e293b, #0f3d33);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: #34d399;
  letter-spacing: 1px;
  user-select: none;
}

.typo-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: none;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
}
.typo-bar.open { display: flex; }
.typo-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.typo-group select {
  width: auto;
  padding: 0.3rem 0.55rem;
  font-size: 0.82rem;
}

.search-hit-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.search-hit-item:hover {
  border-color: var(--primary);
}
mark.search-mark {
  background: rgba(245, 158, 11, 0.35);
  color: var(--text);
  padding: 0 2px;
  border-radius: 3px;
}


/* --- v1.8.0: Scroll Infinito, Aliases y Editor Directo --- */
.infinite-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.infinite-divider::before,
.infinite-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.infinite-loader {
  text-align: center;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.alias-chip {
  display: inline-block;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.75rem;
  margin: 2px 3px 0 0;
}


/* --- v1.9.0: Barra de Progreso Superior, Historial Reciente, Usuarios y Plan Pro --- */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  z-index: 9999;
  transition: width 0.1s linear;
  display: none;
}

.recent-strip {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}
.recent-item {
  min-width: 210px;
  max-width: 245px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.recent-item:hover { border-color: var(--primary); }
.recent-novel { font-weight: 700; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-chap { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.novel-progress-bar {
  width: 100%;
  height: 5px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.45rem;
}
.novel-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
}

.plan-pill-pro {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  font-weight: 700;
}
.pro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
@media (max-width: 560px) { .pro-grid { grid-template-columns: 1fr; } }
.pro-tier-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.95rem;
}
.pro-tier-card.featured {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.08);
}
.pro-tier-card ul {
  padding-left: 1.1rem;
  font-size: 0.84rem;
  margin-top: 0.5rem;
  color: var(--muted);
}


/* --- v2.0.0: Catálogo Público, Comentarios, Perfil y Cupones --- */
.pill-public {
  background: rgba(52, 211, 153, 0.16);
  color: #34d399;
  border-color: #34d399;
}
.comments-section {
  margin-top: 1.75rem;
}
.comment-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.6rem;
}
.comment-card.hidden-comment {
  opacity: 0.55;
  border-style: dashed;
}
.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.stars-text {
  color: var(--warning);
  letter-spacing: 1px;
}


/* --- v2.1.0: Banner Offline PWA, Analíticas Admin y Sugerencias --- */
#offline-banner {
  background: rgba(245, 158, 11, 0.18);
  border-bottom: 1px solid var(--warning);
  color: var(--text);
  text-align: center;
  padding: 0.45rem 1rem;
  font-size: 0.84rem;
  font-weight: 600;
  display: none;
}
.offline-pill {
  background: rgba(16, 185, 129, 0.14);
  color: var(--success);
  border-color: var(--success);
}


/* --- v2.2.0: Estilo LNMTL (Tap Chino Inline, Volúmenes, Votos y Peticiones) --- */
.para-tap-enabled {
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.para-tap-enabled:hover {
  background: rgba(99, 102, 241, 0.06);
}
.raw-inline-box {
  background: var(--surface-2);
  border-left: 3px solid var(--success);
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85em;
  line-height: 1.55;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  margin: -0.65em 0 1.1em 0;
  display: none;
}
.raw-inline-box.open {
  display: block;
}
.vote-pill-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.22rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}
.vote-pill-btn:hover {
  border-color: var(--primary);
}


/* --- v2.3.0: Campanita Notificaciones, Monitor Cron y Comparador de Motores --- */
.bell-btn {
  position: relative;
}
.bell-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  text-align: center;
  border-radius: 99px;
  padding: 0 4px;
  display: none;
}
.notif-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.55rem;
  cursor: pointer;
}
.notif-item.unread {
  border-left: 3px solid var(--primary);
  background: rgba(99, 102, 241, 0.08);
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 820px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.compare-text {
  background: var(--reader-bg);
  color: var(--reader-text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem;
  max-height: 46vh;
  overflow-y: auto;
  font-family: Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.7;
  white-space: pre-wrap;
}


/* --- v2.4.0: Panel de Términos del Capítulo y Modo Viaje --- */
.chap-glossary-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  display: none;
}
.chap-glossary-panel.open {
  display: block;
}
.chap-glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
  margin-top: 0.65rem;
}
.chap-gloss-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  font-size: 0.82rem;
  transition: border-color 0.15s;
}
.chap-gloss-chip:hover {
  border-color: var(--primary);
}


/* --- v2.6.0: Colecciones, Logros/Racha y Diagnóstico Health Check --- */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}
.ach-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  opacity: 0.55;
}
.ach-card.unlocked {
  opacity: 1;
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.09);
}
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
  margin-top: 0.65rem;
}
.health-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.83rem;
}
.streak-stat-card {
  cursor: pointer;
  border-color: rgba(245, 158, 11, 0.45);
}
.streak-stat-card:hover {
  border-color: var(--warning);
}


/* --- v2.7.0: Banner Global Admin, Auto-Scroll y Recomendaciones --- */
.announcement-banner {
  display: none;
  padding: 0.55rem 1rem;
  font-size: 0.86rem;
  font-weight: 500;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.announcement-banner.show { display: flex; }
.announcement-banner.type-info { background: rgba(99, 102, 241, 0.16); border-color: var(--primary); }
.announcement-banner.type-promo { background: rgba(245, 158, 11, 0.18); border-color: var(--warning); }
.announcement-banner.type-warning { background: rgba(239, 68, 68, 0.16); border-color: var(--danger); }
.announcement-banner.type-success { background: rgba(16, 185, 129, 0.16); border-color: var(--success); }

.autoscroll-bar {
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.autoscroll-bar.open { display: flex; }

.color-swatch {
  width: 34px;
  height: 28px;
  padding: 2px;
  border-radius: 6px;
  cursor: pointer;
}


/* --- v2.8.0: Nota del Traductor, Salto Rápido, Revisiones y Atajos --- */
.translator-note-box {
  margin-top: 1.75rem;
  padding: 0.9rem 1.1rem;
  border-left: 3.5px solid var(--primary);
  background: var(--surface-2);
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}
.translator-note-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.35rem;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.jump-chap-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.jump-chap-input {
  width: 78px !important;
  padding: 0.36rem 0.5rem !important;
  font-size: 0.82rem !important;
}
.revision-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  margin-bottom: 0.65rem;
}
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.shortcut-key-input {
  width: 115px !important;
  text-align: center;
  font-family: monospace;
  font-weight: 700;
}
.lib-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.9rem;
}
.lib-filters-row select {
  width: auto;
  font-size: 0.8rem;
  padding: 0.32rem 0.55rem;
}


/* --- v3.0.0: Wiki Automática, Meta Diaria / Pomodoro y Lectura Rápida RSVP --- */
.goal-bar-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  align-items: center;
}
.goal-meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}
.goal-track {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.3s ease;
}

.pomodoro-bar {
  background: var(--surface);
  border: 1px solid var(--warning);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.pomodoro-bar.open { display: flex; }
.pomodoro-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--warning);
  min-width: 68px;
}

.wiki-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.wiki-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
}
.wiki-card:hover {
  border-color: var(--primary);
}

.rsvp-stage {
  background: var(--reader-bg);
  color: var(--reader-text);
  border: 2px solid var(--border);
  border-radius: 14px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0.85rem 0;
  padding: 1.5rem 1rem;
  font-size: clamp(1.8rem, 4.5vw, 2.7rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  user-select: none;
}
.rsvp-guide-top, .rsvp-guide-bottom {
  position: absolute;
  left: 50%;
  width: 2px;
  height: 14px;
  background: var(--primary);
  opacity: 0.65;
  transform: translateX(-50%);
}
.rsvp-guide-top { top: 8px; }
.rsvp-guide-bottom { bottom: 8px; }
.rsvp-orp {
  color: #f43f5e;
}


/* --- v3.1.0: Gráfico de Actividad (14d/30d) y Modo Bilingüe Interlineal Opcional --- */
.activity-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 115px;
  padding: 0.75rem 0.25rem 0.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.act-col {
  flex: 1;
  min-width: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}
.act-bar {
  width: 100%;
  max-width: 26px;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--success));
  transition: height 0.25s ease;
}
.act-bar.zero {
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-height: 4px;
}
.act-val {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1;
}
.act-lbl {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.raw-inline-box.interlinear-always {
  display: block;
  background: transparent;
  border-left: 2px solid var(--border);
  color: var(--muted);
  opacity: 0.78;
  font-size: 0.8em;
  padding: 0.22rem 0.65rem;
  margin: -0.75em 0 1.25em 0;
}


/* ==========================================================================
   v3.2.0: REDISEÑO PROFESIONAL — JERARQUÍA VISUAL, FICHA DE NOVELA Y SUB-TABS
   ========================================================================== */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.topbar {
  background: rgba(24, 27, 36, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  padding: 0.7rem 1.5rem;
}
body.theme-light .topbar {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}
body.theme-sepia .topbar {
  background: rgba(247, 241, 227, 0.9);
}
body.theme-amoled .topbar {
  background: rgba(8, 8, 12, 0.9);
}
body.theme-forest .topbar {
  background: rgba(17, 33, 27, 0.88);
}

.brand {
  letter-spacing: -0.3px;
  font-size: 1.18rem;
}

.container {
  max-width: 1180px;
}

.card {
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
  transition: border-color 0.2s ease;
}
body.theme-light .card {
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

.novel-card {
  border-radius: 14px;
  padding: 1.05rem;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.novel-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
.novel-cover, .novel-cover-placeholder {
  width: 76px;
  height: 108px;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}
.novel-title {
  cursor: pointer;
  line-height: 1.3;
}
.novel-title:hover {
  color: var(--primary);
}

/* Sub-tabs profesionales para Ajustes */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.45rem;
  margin-bottom: 1.25rem;
}
.settings-tab-btn {
  flex: 1;
  min-width: 155px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 9px;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.settings-tab-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.settings-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.settings-pane { display: none; }
.settings-pane.active { display: block; }

/* Encabezado ejecutivo de Biblioteca */
.lib-hero-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}
.lib-hero-title h2 {
  font-size: 1.45rem;
  letter-spacing: -0.3px;
}
.lib-hero-title p {
  font-size: 0.84rem;
  color: var(--muted);
}

/* Barra de herramientas limpia del Lector */
.reader-toolbar-pro {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.reader-toolbar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.reader-tools-drawer {
  display: none;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}
.reader-tools-drawer.open {
  display: flex;
}

/* Vista de Ficha de Detalle de Novela */
.detail-hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.65rem;
  margin-bottom: 1.25rem;
}
.detail-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(28px) brightness(0.32);
  transform: scale(1.12);
  opacity: 0.42;
  pointer-events: none;
}
body.theme-light .detail-hero-bg {
  filter: blur(28px) brightness(1.15);
  opacity: 0.22;
}
.detail-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
}
@media (max-width: 700px) {
  .detail-hero-inner { flex-direction: column; align-items: center; text-align: center; }
  .detail-hero-inner .flex-gap { justify-content: center; }
}
.detail-cover-lg {
  width: 165px;
  height: 235px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  background: linear-gradient(135deg, #1b2a38, #133c33);
}
.detail-cover-lg-ph {
  width: 165px;
  height: 235px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #1e293b, #0f3d33);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  font-weight: 800;
  color: #34d399;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}
.detail-synopsis {
  font-size: 0.92rem;
  color: var(--text);
  opacity: 0.9;
  line-height: 1.65;
  margin: 0.75rem 0 1rem;
  white-space: pre-wrap;
}
.chap-dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 0.55rem;
}
.chap-dir-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  transition: border-color 0.15s, background 0.15s;
}
.chap-dir-item:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}
.chap-dir-item.is-read {
  opacity: 0.72;
}
.chap-dir-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrollbar sutil */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }


/* --- v3.3.0: Bottom Tab Bar Móvil (App Nativa) e Ilustraciones / Lightbox --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(24, 27, 36, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  justify-content: space-around;
  align-items: center;
}
body.theme-light .mobile-bottom-nav { background: rgba(255, 255, 255, 0.95); }
body.theme-sepia .mobile-bottom-nav { background: rgba(247, 241, 227, 0.95); }
body.theme-amoled .mobile-bottom-nav { background: rgba(6, 6, 8, 0.96); }
body.theme-forest .mobile-bottom-nav { background: rgba(17, 33, 27, 0.95); }

.mbn-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  flex: 1;
}
.mbn-btn .mbn-ico { font-size: 1.18rem; line-height: 1.1; }
.mbn-btn.active { color: var(--primary); }

@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; }
  .topbar .nav-tabs .nav-btn[data-view] { display: none; }
  body { padding-bottom: 66px; }
  body.immersive-mode .mobile-bottom-nav { display: none !important; }
  body.immersive-mode { padding-bottom: 0; }
}

.chapter-illustration {
  margin: 1.4em 0;
  text-align: center;
}
.chapter-illustration img {
  max-width: 100%;
  max-height: 540px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  cursor: zoom-in;
  transition: transform 0.15s ease;
}
.chapter-illustration img:hover {
  transform: scale(1.01);
}

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 1.25rem;
  cursor: zoom-out;
}
.lightbox-backdrop.open { display: flex; }
.lightbox-backdrop img {
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
