/* ============================================
   AZAEL BLOG — Design System + Fixes
   Con fix del modo enfoque y botón salir
   ============================================ */

:root {
  --bg-main: #0a0a0c;
  --bg-elevated: #0f0f12;
  --bg-surface: #141418;
  --bg-surface-hover: #1c1c22;
  --border-color: #262630;
  --border-soft: #1a1a22;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-tertiary: #6a6a78;
  --accent-color: #e50914;
  --accent-soft: rgba(229, 9, 20, 0.12);
  --accent-glow: rgba(229, 9, 20, 0.35);
  --gold: #d4af37;

  --shadow-3d:
    -5px 8px 18px rgba(0, 0, 0, 0.7),
    inset 2px 0 4px rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.7);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --radius-pill: 100px;

  --font-serif: 'Playfair Display', 'Lora', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  --transition: .25s cubic-bezier(.2, .8, .2, 1);
}

[data-theme="light"] {
  --bg-main: #fbfaf6;
  --bg-elevated: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0ede7;
  --border-color: #e8e4dc;
  --border-soft: #f0ece4;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a55;
  --text-tertiary: #8a8a95;
  --accent-color: #c1121f;
  --accent-soft: rgba(193, 18, 31, 0.08);
  --accent-glow: rgba(193, 18, 31, 0.15);

  --shadow-3d:
    -4px 6px 16px rgba(0, 0, 0, 0.12),
    inset 2px 0 4px rgba(255, 255, 255, 0.9);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
  padding-bottom: 40px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg,
      transparent 0 4px,
      color-mix(in srgb, var(--text-primary) 4%, transparent) 4px 5px,
      transparent 5px 18px,
      color-mix(in srgb, var(--text-primary) 6%, transparent) 18px 22px,
      transparent 22px 40px
    ),
    repeating-linear-gradient(180deg,
      transparent 0 178px,
      color-mix(in srgb, var(--text-primary) 8%, transparent) 178px 181px,
      transparent 181px 200px
    );
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,.15) 35%, transparent 75%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,.15) 35%, transparent 75%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 45%),
              radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.35) 100%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

[data-theme="light"] body::after {
  background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 40%);
  opacity: 0.4;
}

/* ============ LAYOUT ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.page-main {
  position: relative;
  z-index: 1;
  flex: 1;
  padding-bottom: 60px;
  overflow-x: hidden;
}

/* ============ HEADER ============ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--bg-main) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.app-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 62px;
  padding: 0 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.hamburger {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.hamburger:hover, .hamburger:active {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.header-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-action {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.icon-action:hover, .icon-action:active {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.icon-action svg { width: 18px; height: 18px; }

/* ============ BOTÓN AJUSTES DE LECTURA DESTACADO ============ */
.reader-settings-btn-visible {
  background: var(--accent-soft) !important;
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
  position: relative;
  box-shadow: 0 0 16px var(--accent-glow);
}

.reader-settings-btn-visible:hover {
  background: var(--accent-color) !important;
  color: #ffffff !important;
  transform: scale(1.05);
}

.reader-settings-btn-visible::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--accent-color);
  border-radius: 50%;
  border: 2px solid var(--bg-main);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

/* ============ DRAWER ============ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

body.drawer-open .drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(82vw, 320px);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-color);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

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

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 10px;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.drawer-brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent-color);
  color: #ffffff;
  border-radius: 10px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 0 24px var(--accent-glow);
}

.drawer-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.drawer-brand-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
}

.drawer-brand-sub {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-top: 2px;
}

.drawer-close {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.drawer-close:hover { color: var(--text-primary); border-color: var(--text-tertiary); }

.drawer-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-section {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
  padding: 16px 12px 8px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.drawer-link:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.drawer-link.active { background: var(--accent-soft); color: var(--text-primary); font-weight: 600; }

.drawer-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%;
  height: 60%;
  width: 3px;
  background: var(--accent-color);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.drawer-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; }

.drawer-footer { padding: 16px; border-top: 1px solid var(--border-color); }

.drawer-user-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.drawer-user-btn:hover { background: var(--bg-surface-hover); border-color: var(--text-tertiary); }
.drawer-user-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ============ HERO ============ */
.hero-cinematic {
  position: relative;
  min-height: 68vh;
  display: flex;
  align-items: flex-end;
  margin-bottom: 40px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
  max-width: 100vw;
}

.hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.65) saturate(1.1); }

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent 0%, rgba(10,10,12,.4) 40%, var(--bg-main) 95%),
    linear-gradient(to right, rgba(10,10,12,.85) 0%, transparent 60%);
}

[data-theme="light"] .hero-bg::after {
  background:
    linear-gradient(to bottom, transparent 0%, rgba(251,250,246,.5) 50%, var(--bg-main) 95%),
    linear-gradient(to right, rgba(251,250,246,.6) 0%, transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 60px 0 40px;
  width: 100%;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-color);
  font-weight: 700;
  margin-bottom: 16px;
  padding: 6px 12px;
  background: rgba(229, 9, 20, 0.12);
  border: 1px solid rgba(229, 9, 20, 0.3);
  border-radius: var(--radius-pill);
}

[data-theme="light"] .hero-tag {
  background: rgba(193, 18, 31, 0.08);
  border-color: rgba(193, 18, 31, 0.25);
}

.hero-tag::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent-color);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero-title-c {
  font-family: var(--font-serif);
  font-size: clamp(34px, 7vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin-bottom: 16px;
  text-shadow: 0 4px 30px rgba(0,0,0,.5);
  max-width: 800px;
  word-break: break-word;
}

[data-theme="light"] .hero-title-c { text-shadow: 0 2px 20px rgba(255,255,255,.6); }

.hero-synopsis {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 28px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions-c { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-simple { padding: 60px 0 40px; text-align: left; position: relative; }

.hero-simple::before {
  content: '';
  position: absolute;
  top: 20%; left: 30%;
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, var(--accent-glow), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.5;
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-color);
  font-weight: 700;
  margin-bottom: 14px;
  position: relative;
}

/* ============ BOTONES ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.btn-primary {
  background: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--accent-glow);
  filter: brightness(1.08);
}

.btn-ghost {
  background: rgba(255,255,255,.06);
  color: var(--text-primary);
  border-color: var(--border-color);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .btn-ghost { background: rgba(0,0,0,.04); }

.btn-ghost:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateY(-2px);
}

.btn-block { width: 100%; }

/* ============ SECTIONS ============ */
.section { padding: 40px 0; position: relative; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3.5vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--accent-color);
  border-radius: 2px;
  box-shadow: 0 0 16px var(--accent-glow);
  flex-shrink: 0;
}

.section-sub { color: var(--text-secondary); font-size: 14px; padding-left: 16px; }

.section-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.section-link:hover { color: var(--accent-color); }
.section-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ============ CARRUSEL ============ */
.horizontal-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  padding-right: 20px;
  margin: 0 -20px;
  padding-left: 20px;
  scrollbar-width: none;
}

.horizontal-carousel::-webkit-scrollbar { display: none; }
.horizontal-carousel > * { scroll-snap-align: start; flex: 0 0 auto; }

/* ============ BOOK 3D ============ */
.book-cover {
  position: relative;
  width: 140px;
  height: 210px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 42px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-3d);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
  will-change: transform;
}

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

.book-cover::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  background: linear-gradient(90deg,
    rgba(0,0,0,.5) 0%,
    rgba(0,0,0,.15) 40%,
    rgba(255,255,255,.15) 60%,
    rgba(0,0,0,.15) 100%);
  z-index: 2;
}

.book-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg,
    transparent 25%,
    rgba(255,255,255,.1) 48%,
    transparent 75%);
  pointer-events: none;
  z-index: 1;
}

.book-cover:hover {
  transform: translateY(-8px) rotateY(-6deg) scale(1.03);
  box-shadow: -8px 12px 28px rgba(0,0,0,.8), inset 2px 0 4px rgba(255,255,255,.1);
}

.book-cover-lg { width: 180px; height: 270px; font-size: 56px; }

/* ============ STORY CARD ============ */
.story-card-c {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  width: 140px;
  transition: var(--transition);
}

.story-card-c .book-cover { margin-bottom: 12px; }

.story-card-c-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-c-meta { font-size: 11px; color: var(--text-tertiary); }

.stories-grid-c {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 28px 18px;
}

/* ============ CHAPTER CARD ============ */
.chapter-card {
  width: 260px;
  max-width: 85vw;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  gap: 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.chapter-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateY(-3px);
}

.chapter-card-cover {
  width: 60px; height: 90px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-3d);
}

.chapter-card-cover img { width: 100%; height: 100%; object-fit: cover; }

.chapter-card-body { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; }

.chapter-card-story {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chapter-card-meta { font-size: 11px; color: var(--text-tertiary); display: flex; gap: 10px; }

/* ============ PAGE HEAD ============ */
.page-head-c {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.page-title-c {
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
  line-height: 1.1;
  word-break: break-word;
}

.page-sub-c { color: var(--text-secondary); font-size: 15px; }

/* ============ GÉNEROS ============ */
.genres-grid-c {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.genre-card-c {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: var(--radius);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  transition: var(--transition);
}

.genre-card-c::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 65%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}

.genre-card-c:hover {
  transform: translateY(-6px);
  border-color: var(--accent-color);
  background: var(--bg-surface-hover);
}

.genre-card-c:hover::before { opacity: 1; }

.genre-card-c-icon {
  width: 40px; height: 40px;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.genre-card-c-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }

.genre-card-c:hover .genre-card-c-icon {
  color: var(--accent-color);
  transform: scale(1.1);
  filter: drop-shadow(0 0 16px var(--accent-glow));
}

.genre-card-c-name {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ============ BLOG ============ */
.blog-list-c { display: flex; flex-direction: column; gap: 12px; }

.blog-item-c {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.blog-item-c::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent-color);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.blog-item-c:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateX(4px);
}

.blog-item-c:hover::before { transform: scaleY(1); }

.blog-item-c-date {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.blog-item-c h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.blog-item-c p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ READER ============ */
.reader-c { padding: 40px 0 24px; }

.reader-title-c {
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
  word-break: break-word;
}

.reader-meta-c {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.reader-body-c {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.8;
  color: var(--text-primary);
  max-width: 680px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.reader-body-c p { margin-bottom: 1.3em; }
.reader-body-c h2, .reader-body-c h3 { font-family: var(--font-serif); margin: 1.8em 0 .8em; line-height: 1.3; }
.reader-body-c img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 1.2em 0; }
.reader-body-c blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 20px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 1.2em 0;
}

/* ============ CHAPTER READER ============ */
.reader-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
  z-index: 200;
  transition: width .1s linear;
  pointer-events: none;
}

.chapter-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 120px;
  overflow-x: hidden;
}

.chapter-head {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.chapter-story-link {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.chapter-story-link:hover { opacity: 0.8; }

.chapter-title-c {
  font-family: var(--font-serif);
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 12px;
  word-break: break-word;
}

.chapter-meta-c {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.chapter-meta-c span { display: inline-flex; align-items: center; gap: 6px; }
.chapter-meta-c svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.chapter-body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.85;
  color: var(--text-primary);
  margin-bottom: 40px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chapter-body p { margin-bottom: 1.3em; }
.chapter-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 1em 0; display: block; }

.chapter-note {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-color);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 40px 0;
  font-size: 15px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
}

.chapter-note-label {
  display: block;
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-color);
  font-weight: 700;
  margin-bottom: 8px;
}

.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

.chapter-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  min-width: 0;
  overflow: hidden;
}

.chapter-nav-btn:hover { background: var(--bg-surface-hover); border-color: var(--text-tertiary); }
.chapter-nav-btn.next { text-align: right; }
.chapter-nav-btn.disabled { opacity: 0.35; pointer-events: none; }

.chapter-nav-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chapter-nav-btn.next .chapter-nav-label { justify-content: flex-end; }
.chapter-nav-btn:nth-child(2) .chapter-nav-label { justify-content: center; }

.chapter-nav-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ PAYWALL ============ */
.paywall {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 28px;
  text-align: center;
  margin: 40px 0;
  position: relative;
  overflow: hidden;
}

.paywall::before {
  content: '';
  position: absolute;
  top: -50%; left: 50%;
  transform: translateX(-50%);
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.5;
}

.paywall-icon {
  width: 56px; height: 56px;
  margin: 0 auto 20px;
  color: var(--accent-color);
  position: relative;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.paywall-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }

.paywall h3 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
  position: relative;
  letter-spacing: -0.02em;
}

.paywall p {
  color: var(--text-secondary);
  font-size: 14.5px;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
  position: relative;
}

.paywall-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; position: relative; }

/* ============ STORY DETAIL ============ */
.story-header {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 40px 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.story-header-cover { position: relative; }

.story-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-genre { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-secondary); }
.badge-status {
  background: var(--accent-soft);
  border: 1px solid rgba(229,9,20,.3);
  color: var(--accent-color);
}

[data-theme="light"] .badge-status { border-color: rgba(193,18,31,.25); }

.story-h1 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 14px;
  word-break: break-word;
}

.story-synopsis-c {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 22px;
}

.story-stats { display: flex; gap: 24px; font-size: 13px; color: var(--text-tertiary); flex-wrap: wrap; }
.story-stats-item { display: flex; flex-direction: column; }
.story-stats-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; margin-bottom: 4px; }
.story-stats-value { font-family: var(--font-serif); font-size: 18px; color: var(--text-primary); font-weight: 600; }

.chapter-list { display: flex; flex-direction: column; gap: 8px; }

.chapter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
}

.chapter-row:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateX(4px);
}

.chapter-row-num {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-tertiary);
  min-width: 32px;
  flex-shrink: 0;
}

.chapter-row-body { flex: 1; min-width: 0; }

.chapter-row-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-row-meta { font-size: 11.5px; color: var(--text-tertiary); display: flex; gap: 14px; flex-wrap: wrap; }

.chapter-row-lock {
  width: 20px; height: 20px;
  color: var(--accent-color);
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.chapter-row-lock svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; }

.characters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }

.character-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}

.character-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateY(-4px);
}

.character-avatar {
  width: 90px; height: 90px;
  margin: 0 auto 14px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 32px;
  color: var(--text-tertiary);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.character-avatar img { width: 100%; height: 100%; object-fit: cover; }

.character-name { font-family: var(--font-serif); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.character-role { font-size: 11px; color: var(--accent-color); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; margin-bottom: 10px; }
.character-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }

/* ============ COMENTARIOS ============ */
.comments-list { display: flex; flex-direction: column; gap: 14px; }

.comment-c {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: var(--transition);
}

.comment-c:hover { border-color: var(--text-tertiary); }

.comment-head-c {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.comment-author-c {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
}

.comment-badge-c {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 3px 8px;
  border: 1px solid var(--gold);
  border-radius: 4px;
}

.comment-date-c { font-size: 11px; color: var(--text-tertiary); }
.comment-body-c { font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; color: var(--text-secondary); }

.comment-form-c {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.comment-form-c textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 14px;
  min-height: 100px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: var(--transition);
}

.comment-form-c textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.comment-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }

.comment-login-prompt-c {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 24px;
}

.comment-login-prompt-c p { color: var(--text-secondary); font-size: 14.5px; margin-bottom: 16px; }

/* ============ REDES ============ */
.social-grid-c {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.social-link-c {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.social-link-c:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-color);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.social-link-c-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  border-radius: 10px;
  color: var(--accent-color);
  flex-shrink: 0;
  transition: var(--transition);
}

.social-link-c:hover .social-link-c-icon {
  background: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.social-link-c-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.social-link-c-body { display: flex; flex-direction: column; min-width: 0; }
.social-link-c-name { font-weight: 600; }

.social-link-c-handle {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ BIO ============ */
.bio-card-c {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 36px;
  align-items: start;
  position: relative;
  overflow: hidden;
}

.bio-card-c::before {
  content: '';
  position: absolute;
  top: -30%; right: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.4;
}

.bio-avatar-c {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 64px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-lg);
  position: relative;
  border: 1px solid var(--border-color);
}

.bio-avatar-c img { width: 100%; height: 100%; object-fit: cover; }

.bio-name-c {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
  position: relative;
}

.bio-handle-c {
  color: var(--accent-color);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 24px;
  position: relative;
}

.bio-text-c {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--text-secondary);
  position: relative;
}

/* ============ EMPTY STATE ============ */
.empty-c {
  padding: 60px 24px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.empty-c::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}

.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  color: var(--text-tertiary);
  opacity: 0.7;
  position: relative;
}

.empty-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.4; }

.empty-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  position: relative;
}

.empty-sub { color: var(--text-tertiary); font-size: 13.5px; position: relative; }

/* ============ MODAL AUTH ============ */
.modal-overlay-c {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .25s ease;
}

.modal-overlay-c[hidden] { display: none; }

.modal-c {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-c::before {
  content: '';
  position: absolute;
  top: -40%; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(50px);
  pointer-events: none;
  opacity: 0.5;
}

.modal-close-c {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  z-index: 1;
}

.modal-close-c:hover { color: var(--text-primary); border-color: var(--text-tertiary); }
.modal-close-c svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.modal-title-c {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  position: relative;
}

.modal-sub-c {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  position: relative;
}

.modal-tabs-c {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.modal-tab-c {
  background: transparent;
  border: none;
  padding: 10px 4px;
  margin-right: 22px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
}

.modal-tab-c.active { color: var(--text-primary); border-bottom-color: var(--accent-color); }

.auth-form-c {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.auth-form-c label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-form-c input {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.auth-form-c input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.auth-consent-c {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.auth-consent-c input {
  width: 16px; height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent-color);
}

.auth-consent-c label {
  display: block;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 400;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.auth-error-c {
  font-size: 13px;
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.25);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.auth-switch-c {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 16px;
  position: relative;
}

.auth-switch-c button {
  background: none;
  border: none;
  color: var(--accent-color);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}

/* ============ FOOTER ============ */
.site-footer-c {
  padding: 40px 0 32px;
  margin-top: 60px;
  border-top: 1px solid var(--border-color);
  color: var(--text-tertiary);
  font-size: 12.5px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ LOADING ============ */
.global-loading {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}

.global-loading[hidden] { display: none; }

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-color);
  animation: spin .8s linear infinite;
  box-shadow: 0 0 24px var(--accent-glow);
}

/* ============ TOAST ============ */
#toast-mount {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  max-width: 90vw;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
  pointer-events: auto;
  max-width: 90vw;
  text-align: center;
  font-family: var(--font-sans);
  word-break: break-word;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok { border-color: rgba(76, 175, 80, 0.45); color: #6ecb7c; }
.toast-error { border-color: rgba(255, 107, 107, 0.45); color: #ff8a8a; }
.toast-info { border-color: var(--border-color); }

/* ============ ADMIN ============ */
.admin-body { padding-bottom: 40px; }

.admin-back-link {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
}

.admin-back-link:hover { color: var(--text-primary); background: var(--bg-surface-hover); }

.admin-view { animation: fadeIn .25s ease; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 24px 0 32px;
}

.admin-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.admin-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent-color);
}

.admin-stat-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-stat-value {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }

.admin-list { display: flex; flex-direction: column; gap: 8px; }

.admin-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.admin-item:hover { background: var(--bg-surface-hover); border-color: var(--text-tertiary); }

.admin-item-cover {
  width: 40px; height: 60px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  box-shadow: var(--shadow-3d);
}

.admin-item-cover img { width: 100%; height: 100%; object-fit: cover; }

.admin-item-body { flex: 1; min-width: 0; }

.admin-item-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-tertiary);
  align-items: center;
}

.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.admin-badge-ok { background: rgba(76, 175, 80, 0.15); color: #6ecb7c; }
.admin-badge-accent { background: var(--accent-soft); color: var(--accent-color); }

.admin-item-action {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.admin-item-action:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: var(--accent-soft);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 0;
  cursor: pointer;
  margin-bottom: 16px;
  transition: var(--transition);
}

.btn-back:hover { color: var(--accent-color); }

.admin-form { display: flex; flex-direction: column; gap: 20px; max-width: 800px; margin-top: 20px; }

.admin-form-grid { display: grid; grid-template-columns: 220px 1fr; gap: 28px; }

.admin-cover-uploader { display: flex; flex-direction: column; gap: 12px; }
.admin-cover-preview { display: flex; justify-content: center; }
.admin-hint { font-size: 11.5px; color: var(--text-tertiary); text-align: center; }

.admin-fields { display: flex; flex-direction: column; gap: 16px; }

.admin-field { display: flex; flex-direction: column; gap: 6px; }

.admin-field > span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
}

.admin-field input,
.admin-field textarea,
.admin-field select {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  width: 100%;
}

.admin-field textarea { resize: vertical; min-height: 80px; line-height: 1.6; font-family: inherit; }

.admin-field input:focus,
.admin-field textarea:focus,
.admin-field select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.admin-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  transition: var(--transition);
}

.admin-check:hover { border-color: var(--text-tertiary); }
.admin-check input { width: 18px; height: 18px; accent-color: var(--accent-color); flex-shrink: 0; }

.admin-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: stretch; }

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.admin-chapters { display: flex; flex-direction: column; gap: 8px; }

.admin-chapter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.admin-chapter-row:hover { background: var(--bg-surface-hover); }

.admin-chapter-num {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-tertiary);
  min-width: 34px;
}

.admin-chapter-body { flex: 1; min-width: 0; }

.admin-chapter-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-chapter-meta { font-size: 11.5px; color: var(--text-tertiary); display: flex; gap: 8px; align-items: center; }
.admin-chapter-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* EDITOR */
.editor-toolbar {
  position: sticky;
  top: 62px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: var(--shadow-md);
}

.editor-toolbar::-webkit-scrollbar { display: none; }

.ed-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
}

.ed-btn:hover { color: var(--text-primary); background: var(--bg-surface-hover); border-color: var(--border-color); }
.ed-btn:active { background: var(--accent-soft); color: var(--accent-color); border-color: var(--accent-color); }

.ed-spacer { flex: 1; }

.ed-counter {
  font-size: 11.5px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  font-weight: 600;
  padding-right: 8px;
  white-space: nowrap;
}

.editor-area {
  min-height: 400px;
  padding: 20px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.editor-area:focus { border-color: var(--accent-color); box-shadow: 0 0 0 4px var(--accent-soft); }

.editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
}

.editor-area h2 { font-family: var(--font-serif); font-size: 24px; margin: 1em 0 .5em; }
.editor-area h3 { font-family: var(--font-serif); font-size: 19px; margin: 1em 0 .5em; }
.editor-area blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 16px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 1em 0;
}
.editor-area hr { border: none; border-top: 1px solid var(--border-color); margin: 1.5em 0; }
.editor-area img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 1em 0; display: block; }

/* ============ ADMIN REDES / BIO ============ */
.admin-net-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.admin-net-item-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  border-radius: 10px;
  color: var(--accent-color);
  flex-shrink: 0;
}

.admin-net-item-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

.admin-net-item-body { flex: 1; min-width: 0; }

.admin-net-item-platform {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-color);
  font-weight: 700;
  margin-bottom: 2px;
}

.admin-net-item-url {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-net-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  align-items: center;
}

.admin-net-add-title {
  width: 100%;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-net-btn {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.admin-net-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.admin-net-btn svg {
  width: 24px; height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-net-btn:active {
  transform: scale(0.95);
  border-color: var(--accent-color);
  background: var(--accent-soft);
  color: var(--accent-color);
}

/* ============ MODAL SIN PERMISOS ============ */
.denied-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(30px) saturate(140%) brightness(0.5);
  -webkit-backdrop-filter: blur(30px) saturate(140%) brightness(0.5);
  animation: fadeIn .3s ease;
}

[data-theme="light"] .denied-overlay {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(30px) saturate(160%) brightness(1.05);
  -webkit-backdrop-filter: blur(30px) saturate(160%) brightness(1.05);
}

.denied-overlay[hidden] { display: none; }

.denied-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 28px 32px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: slideUp .35s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}

.denied-modal::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(50px);
  pointer-events: none;
  opacity: 0.55;
}

.denied-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(229, 9, 20, 0.3);
  border-radius: 50%;
  color: var(--accent-color);
  box-shadow: 0 0 50px var(--accent-glow);
  position: relative;
  z-index: 1;
}

.denied-icon svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.denied-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.denied-msg {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 26px;
  position: relative;
  z-index: 1;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.denied-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.denied-actions .btn {
  padding: 10px 18px;
  font-size: 13.5px;
}

/* ============ MODAL INPUT PERSONALIZADO ============ */
.custom-input-overlay {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .25s ease;
}

[data-theme="light"] .custom-input-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.custom-input-modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: slideUp .3s cubic-bezier(.2, .8, .2, 1);
}

.custom-input-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(229, 9, 20, 0.25);
  border-radius: 50%;
  color: var(--accent-color);
  box-shadow: 0 0 30px var(--accent-glow);
}

.custom-input-icon svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.custom-input-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.custom-input-desc {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
}

.custom-input-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
}

.custom-input-field label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
}

.custom-input-field input {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.custom-input-field input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.custom-input-hint {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.custom-input-actions {
  display: flex;
  gap: 10px;
}

.custom-input-actions .btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 13.5px;
}

/* ============ BLOG ITEM CON COVER ============ */
.blog-item-c.has-cover {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 16px;
  align-items: center;
}

.blog-item-c.has-cover .blog-item-c-date,
.blog-item-c.has-cover h3,
.blog-item-c.has-cover p {
  grid-column: 1;
}

.blog-item-c-cover {
  grid-column: 2;
  grid-row: 1 / span 3;
  width: 100%;
  height: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3d);
  align-self: center;
}

@media (max-width: 500px) {
  .blog-item-c.has-cover {
    grid-template-columns: 1fr 80px;
    gap: 10px;
  }
  .blog-item-c-cover {
    max-height: 90px;
  }
}

/* ============ BLOG PREVIEW EN HOME ============ */
.blog-preview-c {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 24px 26px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.blog-preview-c::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent-color);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.blog-preview-c:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateX(4px);
}

.blog-preview-c:hover::before { transform: scaleY(1); }

.blog-preview-c.has-cover {
  grid-template-columns: 1fr 140px;
  align-items: center;
}

.blog-preview-c-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.blog-preview-c-date {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.blog-preview-c-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.blog-preview-c-excerpt {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-preview-c-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  transition: gap .2s;
}

.blog-preview-c:hover .blog-preview-c-more { gap: 12px; }

.blog-preview-c-cover {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-3d);
  align-self: center;
  width: 100%;
}

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

@media (max-width: 600px) {
  .blog-preview-c.has-cover {
    grid-template-columns: 1fr 90px;
    gap: 14px;
  }
  .blog-preview-c { padding: 20px; }
  .blog-preview-c-title { font-size: 17px; }
}

/* ============ CAPÍTULO LEÍDO ============ */
.chapter-row-read {
  color: #6ecb7c;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chapter-row-read svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

/* ============ HERO CARRUSEL ============ */
.hero-carousel {
  position: relative;
  overflow: hidden;
  min-height: 68vh;
}

.hero-carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}

.hero-slide {
  flex: 0 0 100%;
  position: relative;
  min-height: 68vh;
  display: flex;
  align-items: flex-end;
  width: 100%;
}

.hero-slide .hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-slide .hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.65) saturate(1.1);
}

.hero-slide .hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent 0%, rgba(10,10,12,.4) 40%, var(--bg-main) 95%),
    linear-gradient(to right, rgba(10,10,12,.85) 0%, transparent 60%);
}

[data-theme="light"] .hero-slide .hero-bg::after {
  background:
    linear-gradient(to bottom, transparent 0%, rgba(251,250,246,.5) 50%, var(--bg-main) 95%),
    linear-gradient(to right, rgba(251,250,246,.6) 0%, transparent 60%);
}

.hero-slide .hero-content {
  position: relative;
  z-index: 1;
  padding: 60px 0 40px;
  width: 100%;
}

.hero-tag-alt {
  color: var(--text-secondary) !important;
  background: rgba(255,255,255,.06) !important;
  border-color: var(--border-color) !important;
}

.hero-tag-alt::before {
  background: var(--text-secondary) !important;
  box-shadow: none !important;
}

.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  z-index: 10;
  transition: all .25s;
  padding: 0;
}

.hero-nav:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: translateY(-50%) scale(1.05);
}

.hero-nav svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.hero-nav-prev { left: 16px; }
.hero-nav-next { right: 16px; }

.hero-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  border: none;
  cursor: pointer;
  transition: all .25s;
  padding: 0;
}

.hero-dot.active {
  background: var(--accent-color);
  width: 24px;
  border-radius: 4px;
  box-shadow: 0 0 12px var(--accent-glow);
}

@media (max-width: 700px) {
  .hero-nav { width: 38px; height: 38px; }
  .hero-nav-prev { left: 8px; }
  .hero-nav-next { right: 8px; }
  .hero-nav svg { width: 18px; height: 18px; }
}

/* ============ COMENTARIOS EN CAPÍTULOS ============ */
.chapter-comments-section {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
}

.chapter-comments-head {
  margin-bottom: 24px;
}

.chapter-comments-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chapter-comments-title::before {
  content: '';
  width: 4px;
  height: 22px;
  background: var(--accent-color);
  border-radius: 2px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.chapter-comments-count {
  color: var(--text-secondary);
  font-size: 13px;
  padding-left: 16px;
}

.comment-c-new {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: var(--transition);
}

.comment-c-new:hover {
  border-color: var(--text-tertiary);
}

.comment-head-c-new {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-body-wrap {
  position: relative;
}

.comment-body-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.comment-vermas {
  background: transparent;
  border: none;
  color: var(--accent-color);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 4px;
  text-decoration: underline;
}

.comment-vermas:hover { opacity: 0.8; }

/* ============ AJUSTES DE LECTURA ============ */
.rs-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
  position: relative;
}

.rs-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rs-label::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent-color);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow);
}

.rs-segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px;
}

.rs-seg-btn {
  padding: 12px 8px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.rs-seg-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.rs-seg-btn.active {
  background: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.rs-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px;
}

.rs-stepper button {
  width: 42px;
  height: 42px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: grid;
  place-items: center;
}

.rs-stepper button:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
}

.rs-stepper span {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  min-width: 70px;
  text-align: center;
  color: var(--text-primary);
}

#rsFullscreen {
  background: linear-gradient(135deg, var(--accent-color), #b00610);
  color: #ffffff !important;
  border: none !important;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px var(--accent-glow);
  margin-top: 8px !important;
  padding: 14px 20px !important;
  font-size: 14px !important;
}

#rsFullscreen:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--accent-glow);
  filter: brightness(1.08);
}

#rsFullscreen svg {
  width: 18px;
  height: 18px;
}

/* ============ MODO ENFOQUE ============ */
body.focus-mode {
  overflow-x: hidden;
}

body.focus-mode .app-header,
body.focus-mode .site-footer-c,
body.focus-mode .chapter-comments-section,
body.focus-mode .chapter-note,
body.focus-mode .chapter-nav,
body.focus-mode .reader-progress,
body.focus-mode #auth-mount,
body.focus-mode #toast-mount,
body.focus-mode .drawer,
body.focus-mode .drawer-backdrop,
body.focus-mode #globalLoading,
body.focus-mode .pwa-install-btn {
  display: none !important;
}

body.focus-mode .page-main {
  padding-top: 20px;
  padding-bottom: 40px;
}

body.focus-mode .chapter-shell {
  padding-top: 40px;
  padding-bottom: 40px;
  max-width: 720px;
}

body.focus-mode .chapter-head {
  margin-bottom: 32px;
}

body.focus-mode .chapter-story-link {
  color: var(--accent-color);
  font-size: 12px;
  letter-spacing: 0.16em;
}

/* Botón de salir del modo enfoque (elemento real, NO pseudo-elemento) */
.focus-exit-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9700;
  padding: 14px 28px;
  background: var(--accent-color);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 100px;
  box-shadow: 0 8px 24px var(--accent-glow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s, transform .3s, box-shadow .3s;
}

.focus-exit-btn.visible {
  opacity: 1;
  transform: translateY(0);
}

.focus-exit-btn:hover {
  box-shadow: 0 12px 32px var(--accent-glow);
  transform: translateY(-2px);
}

@media (max-width: 700px) {
  body.focus-mode .chapter-shell {
    padding: 20px 16px 40px;
  }
  body.focus-mode .chapter-title-c {
    font-size: 24px;
  }
  body.focus-mode .chapter-body {
    font-size: 17px;
  }
  .focus-exit-btn {
    bottom: 16px;
    right: 16px;
    padding: 12px 22px;
    font-size: 13px;
  }
}

/* ============ COMENTARIOS — ACCIONES ============ */
.comment-actions-c {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-delete-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.comment-delete-btn:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
}

.comment-delete-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ ESTADÍSTICAS ============ */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-card {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-family: inherit;
  color: inherit;
  width: 100%;
}

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

.stats-card-cover {
  width: 60px;
  height: 90px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-3d);
  flex-shrink: 0;
}

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

.stats-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.stats-card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-card-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stats-card-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 2px;
}

.stats-card-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #ff4d4d);
  border-radius: 100px;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
  min-width: 3px;
}

.stats-card-numbers {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 2px;
}

.stats-card-number {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stats-card-percent {
  font-size: 10px;
  color: var(--accent-color);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.stats-card-arrow {
  color: var(--text-tertiary);
  transition: var(--transition);
  flex-shrink: 0;
}

.stats-card:hover .stats-card-arrow {
  color: var(--accent-color);
  transform: translateX(4px);
}

/* ============ DETALLE DE HISTORIA (STATS) ============ */
.story-stats-header {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  align-items: start;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.story-stats-cover {
  width: 100px;
  height: 150px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 36px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-3d);
}

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

.story-stats-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-stats-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.story-stats-title {
  font-family: var(--font-serif);
  font-size: clamp(18px, 3.5vw, 24px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
}

.story-stats-synopsis {
  font-family: var(--font-serif);
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-chapter-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.stats-chapter-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.stats-chapter-num {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-tertiary);
  padding-top: 2px;
}

.stats-chapter-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.stats-chapter-title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-chapter-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 2px;
}

.stats-chapter-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #ff4d4d);
  border-radius: 100px;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
  min-width: 3px;
}

.stats-chapter-metrics {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 2px;
}

.stats-metric {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stats-metric svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  opacity: 0.7;
}

.stats-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 20px 0 24px;
}

.stats-total-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.stats-total-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent-color);
  box-shadow: 0 0 16px var(--accent-glow);
}

.stats-total-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
  margin-bottom: 6px;
}

.stats-total-value {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .stats-card {
    grid-template-columns: 50px 1fr auto;
    gap: 12px;
    padding: 12px 14px;
  }
  .stats-card-cover {
    width: 50px;
    height: 75px;
    font-size: 20px;
  }
  .stats-card-title { font-size: 14px; }
  .stats-card-meta { display: none; }
  .stats-card-numbers { font-size: 10.5px; gap: 8px; }

  .story-stats-header {
    grid-template-columns: 80px 1fr;
    gap: 14px;
    padding: 16px;
  }
  .story-stats-cover {
    width: 80px;
    height: 120px;
    font-size: 30px;
  }
  .story-stats-title { font-size: 17px; }

  .stats-chapter-metrics { font-size: 11px; gap: 10px; }
}

/* ============ BOTÓN DE LIKE SIN CONTADOR PÚBLICO ============ */
.like-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.like-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-2px);
}

.like-btn.liked {
  background: var(--accent-soft);
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 20px var(--accent-glow);
}

.like-btn svg {
  width: 18px;
  height: 18px;
  transition: transform .2s;
}

.like-btn:hover svg { transform: scale(1.15); }
.like-btn.liked svg { animation: likePulse .4s ease; }

@keyframes likePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.like-label {
  font-size: 13px;
  font-weight: 600;
}

/* ============ ANTI-COPIA (refuerzo visual) ============ */
.chapter-body {
  -webkit-touch-callout: none;
}

.chapter-body ::selection {
  background: var(--accent-soft);
  color: var(--accent-color);
}

/* ============ RESPONSIVE ============ */
@media (min-width: 900px) {
  .app-header-inner { padding: 0 24px; height: 68px; }
  .hamburger { display: none; }
  .header-title { display: none; }

  .desktop-nav { display: flex; gap: 4px; margin-left: 20px; }

  .desktop-nav a {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
  }

  .desktop-nav a:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
  .desktop-nav a.active { color: var(--accent-color); }

  .story-header { grid-template-columns: 220px 1fr; gap: 44px; }
  .bio-card-c { grid-template-columns: 220px 1fr; }
}

@media (max-width: 899px) {
  .desktop-nav { display: none; }
}

@media (max-width: 700px) {
  .container { padding: 0 16px; }
  .section { padding: 32px 0; }

  .hero-cinematic { min-height: 58vh; }
  .hero-content { padding: 40px 0 32px; }

  .story-header { grid-template-columns: 1fr; gap: 22px; padding: 28px 0; }
  .story-header-cover { max-width: 160px; }

  .bio-card-c { grid-template-columns: 1fr; padding: 26px; gap: 24px; }
  .bio-avatar-c { max-width: 140px; }

  .reader-body-c { font-size: 17px; }
  .chapter-body { font-size: 17px; line-height: 1.8; }

  .horizontal-carousel { gap: 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }

  .stories-grid-c { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 22px 12px; }
  .book-cover { width: 120px; height: 180px; }

  .genres-grid-c { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .modal-c { padding: 24px 22px; }

  .chapter-nav { grid-template-columns: 1fr 1fr; gap: 8px; }
  .chapter-nav-btn:nth-child(2) { grid-column: 1 / -1; order: -1; }

  .admin-form-grid { grid-template-columns: 1fr; gap: 20px; }
  .admin-cover-preview { max-width: 160px; margin: 0 auto; }
  .editor-toolbar { top: 58px; }
  .admin-chapter-actions { flex-wrap: wrap; }
}

@media (min-width: 701px) {
  .book-cover { width: 160px; height: 240px; }
  .story-card-c { width: 160px; }
  .book-cover-lg { width: 200px; height: 300px; font-size: 64px; }
}

@media (max-width: 480px) {
  .genres-grid-c { grid-template-columns: repeat(2, 1fr); }
  .admin-back-link span { display: none; }
  .chapter-nav { grid-template-columns: 1fr; }
  .chapter-nav-btn:nth-child(2) { grid-column: auto; order: 0; }
}

/* ============ ADAPTACIÓN PARA PC ============ */
@media (min-width: 1024px) {
  .container {
    max-width: 1320px;
    padding: 0 40px;
  }

  .stories-grid-c {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 32px 24px;
  }

  .book-cover {
    width: 180px;
    height: 270px;
  }
  .story-card-c {
    width: 180px;
  }

  .hero-cinematic {
    min-height: 78vh;
  }
  .hero-content {
    padding: 100px 0 60px;
  }

  .story-header {
    grid-template-columns: 240px 1fr;
    gap: 48px;
  }

  .chapter-shell {
    max-width: 780px;
    padding: 60px 40px 120px;
  }

  .genres-grid-c {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .blog-list-c {
    max-width: 900px;
    margin: 0 auto;
  }

  .bio-card-c {
    grid-template-columns: 260px 1fr;
    gap: 48px;
    padding: 56px;
  }

  .social-grid-c {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }

  .comment-body-c {
    max-width: 800px;
  }

  .admin-view .container {
    max-width: 1200px;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }

  .hero-title-c {
    font-size: clamp(48px, 5vw, 80px);
  }

  .page-title-c {
    font-size: clamp(38px, 4vw, 52px);
  }
}

@media (min-width: 1024px) and (hover: hover) {
  .book-cover:hover {
    transform: translateY(-10px) rotateY(-8deg) scale(1.05);
  }
}

/* ============================================
   PWA — Botón "Instalar app"
   ============================================ */

.pwa-install-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 12px 20px;
  border: none;
  border-radius: 50px;

  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;

  color: #0a0a0c;
  background: #e50914;

  box-shadow: 0 8px 24px rgba(229, 9, 20, 0.35),
              0 2px 8px rgba(0, 0, 0, 0.4);

  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  animation: pwaSlideIn 0.4s ease-out;
}

.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(229, 9, 20, 0.5),
              0 4px 12px rgba(0, 0, 0, 0.5);
}

.pwa-install-btn:active {
  transform: translateY(0);
}

@media (max-width: 600px) {
  .pwa-install-btn {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 13px;
  }
}

[data-theme="light"] .pwa-install-btn {
  color: #ffffff;
  background: #0a0a0c;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35),
              0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .pwa-install-btn:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45),
              0 4px 12px rgba(0, 0, 0, 0.25);
}

@keyframes pwaSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* ============ CONTADOR DE VISTAS PÚBLICO ============ */
.like-row-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.views-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  cursor: default;
}

.views-counter:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

.views-counter svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}
/* ============ AJUSTES DEL SITIO (ADMIN) ============ */
.admin-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.admin-setting-row:hover {
  border-color: var(--text-tertiary);
}

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

.admin-setting-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.admin-setting-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-color);
}

.admin-setting-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Switch estilo iOS */
.admin-toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
  cursor: pointer;
}

.admin-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.admin-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  transition: var(--transition);
}

.admin-toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: var(--text-tertiary);
  border-radius: 50%;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background .25s;
}

.admin-toggle input:checked + .admin-toggle-slider {
  background: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 0 20px var(--accent-glow);
}

.admin-toggle input:checked + .admin-toggle-slider::before {
  transform: translateX(22px);
  background: #ffffff;
}

.admin-toggle input:focus-visible + .admin-toggle-slider {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}
/* ============================================
   ÁRBOLES DE PERSONAJES
   ============================================ */

/* ---------- ESTANTE DE LIBROS ---------- */
.trees-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.tree-shelf-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
}

.tree-shelf-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-color);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.tree-shelf-cover {
  aspect-ratio: 2/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 48px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-3d);
}

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

.tree-shelf-info { display: flex; flex-direction: column; gap: 4px; }

.tree-shelf-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tree-shelf-meta {
  font-size: 11.5px;
  color: var(--text-tertiary);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- HEADER DEL LIBRO ---------- */
.arbol-book-header {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.arbol-book-cover {
  aspect-ratio: 2/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 40px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-3d);
}

.arbol-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.arbol-book-info { display: flex; flex-direction: column; justify-content: center; }

/* ---------- LISTA DE PERSONAJES ---------- */
.characters-admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.character-admin-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.character-admin-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.character-admin-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.character-admin-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-admin-body { flex: 1; min-width: 0; }

.character-admin-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.character-admin-alias {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
  font-style: italic;
}

.character-admin-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.character-admin-role {
  color: var(--accent-color);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
}

.character-admin-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- PREVIEW DE AVATAR EN FORM ---------- */
.character-avatar-preview {
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-size: 72px;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-lg);
  border: 3px solid var(--border-color);
  max-width: 180px;
  margin: 0 auto;
}

.character-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 700px) {
  .arbol-book-header {
    grid-template-columns: 80px 1fr;
    gap: 16px;
  }
  .arbol-book-cover { font-size: 30px; }
  .character-admin-avatar { width: 50px; height: 50px; font-size: 22px; }
  .character-admin-name { font-size: 15px; }
  .character-avatar-preview { max-width: 140px; font-size: 56px; }
  .trees-shelf { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
}
/* ============================================
   ÁRBOL — CANVAS VISUAL
   ============================================ */

.arbol-canvas-shell {
  position: fixed;
  inset: 0;
  top: 62px; /* debajo del header */
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
}

@media (min-width: 900px) {
  .arbol-canvas-shell { top: 68px; }
}

.arbol-canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.btn-sm {
  padding: 8px 14px !important;
  font-size: 12.5px !important;
}

.canvas-toolbar-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.canvas-toolbar-info strong {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-toolbar-info span {
  font-size: 11px;
  color: var(--text-tertiary);
}

.canvas-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.canvas-zoom-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 42px;
  text-align: center;
}

.arbol-canvas-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  cursor: grab;
  background-color: var(--bg-main);
  background-image:
    radial-gradient(circle, var(--border-soft) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  touch-action: none;
}

.arbol-canvas-viewport.panning {
  cursor: grabbing;
}

.arbol-canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  transition: transform 0.05s linear;
}

.arbol-canvas-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 10000px;
  height: 10000px;
  pointer-events: none;
  overflow: visible;
}

.arbol-canvas-nodes {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

/* ---------- NODOS DEL CANVAS ---------- */
.canvas-node {
  position: absolute;
  width: 130px;
  padding: 12px 10px;
  background: var(--bg-elevated);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  text-align: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  touch-action: none;
  will-change: left, top;
}

.canvas-node:hover {
  border-color: var(--accent-color);
  box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 16px var(--accent-glow);
}

.canvas-node.dragging {
  cursor: grabbing;
  border-color: var(--accent-color);
  box-shadow: 0 12px 32px rgba(0,0,0,.6), 0 0 24px var(--accent-glow);
  transform: scale(1.05);
  z-index: 100;
}

.canvas-node-avatar {
  width: 70px;
  height: 70px;
  margin: 0 auto 8px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  font-size: 36px;
  border: 2px solid var(--border-color);
  pointer-events: none;
}

.canvas-node-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.canvas-node-name {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 3px;
  pointer-events: none;
  word-break: break-word;
}

.canvas-node-role {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
  line-height: 1.2;
}

/* ---------- ESTADO VACÍO DEL CANVAS ---------- */
.canvas-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 40px;
  pointer-events: none;
}

.canvas-empty-icon {
  font-size: 72px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.canvas-empty-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.canvas-empty-sub {
  font-size: 13.5px;
  color: var(--text-tertiary);
}

/* ---------- HINT ---------- */
.arbol-canvas-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.arbol-canvas-hint svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .canvas-toolbar-info strong { font-size: 14px; }
  .canvas-zoom-label { display: none; }
  .arbol-canvas-toolbar { padding: 8px 12px; gap: 8px; }
  .canvas-node { width: 110px; padding: 10px 8px; }
  .canvas-node-avatar { width: 58px; height: 58px; font-size: 30px; }
  .canvas-node-name { font-size: 12px; }
}
/* ============ CAMPO DE ROL PERSONALIZADO ============ */
#customRoleField {
  animation: fadeInCustomRole 0.25s ease;
  border-left: 3px solid var(--accent-color);
  padding-left: 14px;
  margin-left: 2px;
}

@keyframes fadeInCustomRole {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ============================================
   CONECTORES — FASE 4A
   ============================================ */

/* Modo conectar */
.arbol-canvas-hint-connect {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-top-color: var(--accent-color);
}

.arbol-canvas-hint-connect svg {
  color: var(--accent-color);
}

#canvasHintConnectText {
  flex: 1;
}

#canvasCancelConnect {
  margin-left: auto;
  padding: 6px 12px !important;
  font-size: 12px !important;
}

.arbol-canvas-viewport.connect-mode {
  cursor: crosshair;
}

.arbol-canvas-viewport.connect-mode .canvas-node {
  cursor: pointer;
}

/* Estado "seleccionado como origen" */
.canvas-node.selecting-from {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 24px rgba(0,0,0,.5), 0 0 30px var(--accent-glow);
  transform: scale(1.05);
  z-index: 10;
}

/* Estado "disponible para seleccionar" */
.canvas-node.selecting-to {
  animation: pulseConnectNode 1.5s ease-in-out infinite;
  border-color: var(--accent-color);
}

@keyframes pulseConnectNode {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,.3); }
  50% { box-shadow: 0 4px 12px rgba(0,0,0,.3), 0 0 0 4px var(--accent-soft); }
}

/* Líneas SVG */
.canvas-edge-line {
  transition: stroke-width 0.15s;
}

.canvas-edge-line:hover {
  stroke-width: 4 !important;
  filter: drop-shadow(0 0 6px currentColor);
}

.canvas-edge-label-group:hover rect {
  stroke-width: 2.5;
}

/* Modal de conexión */
.edge-modal {
  max-width: 480px;
}

.edge-modal-node-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 600;
}

.edge-modal-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}

.edge-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#edgeTypeSelect {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

#edgeTypeSelect:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Color picker */
.edge-color-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#edgeColorInput {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 2px;
}

.edge-color-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.edge-color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.edge-color-preset:hover {
  transform: scale(1.15);
  border-color: var(--text-primary);
}

/* Style picker */
.edge-style-picker {
  display: flex;
  gap: 6px;
}

.edge-style-btn {
  flex: 1;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
}

.edge-style-btn:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

.edge-style-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Arrows picker */
.edge-arrows-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Botón conectar activo */
#canvasConnectBtn.active {
  background: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 0 16px var(--accent-glow);
}
/* ============ FIX: MODAL DE CONEXIÓN SCROLLABLE ============ */
.edge-modal {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 0;
  overflow: hidden;
}

.edge-modal > * {
  flex-shrink: 0;
}

/* Contenedor scrolleable interno */
.edge-modal .custom-input-fields-scroll {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
  margin-right: -4px;
  padding-bottom: 8px;
}

/* Botones fijos al fondo */
.edge-modal .custom-input-actions {
  flex-shrink: 0;
  padding: 16px 0 20px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}
/* Ajuste en móvil: modal más compacto */
@media (max-width: 500px) {
  .edge-modal {
    max-height: 92vh;
    padding: 20px 18px 16px;
  }

  .edge-modal .custom-input-field {
    margin-bottom: 14px;
  }

  .edge-modal .edge-color-presets {
    gap: 4px;
  }

  .edge-modal .edge-color-preset {
    width: 24px;
    height: 24px;
  }

  .edge-modal .edge-style-btn {
    padding: 8px;
  }

  .edge-modal .edge-style-btn svg {
    width: 32px;
  }
}
/* ============ FIX: CHECKBOXES DE FLECHAS EN MODAL EDGE ============ */
.edge-modal .edge-arrows-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.edge-modal .edge-arrows-picker .admin-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: var(--transition);
  min-height: 52px;
}

.edge-modal .edge-arrows-picker .admin-check:hover {
  border-color: var(--text-tertiary);
  background: var(--bg-surface-hover);
}

.edge-modal .edge-arrows-picker .admin-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent-color);
  margin: 0;
  cursor: pointer;
}

.edge-modal .edge-arrows-picker .admin-check span {
  flex: 1;
  text-align: left;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.3;
}
/* ============================================
   DROPDOWN PERSONALIZADO
   ============================================ */

.custom-dropdown {
  position: relative;
  width: 100%;
  user-select: none;
}

.custom-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.custom-dropdown-trigger:hover {
  border-color: var(--text-tertiary);
  background: var(--bg-surface-hover);
}

.custom-dropdown.open .custom-dropdown-trigger {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.custom-dropdown-trigger-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.custom-dropdown-trigger-emoji {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
}

.custom-dropdown-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.custom-dropdown-trigger-text.placeholder {
  color: var(--text-tertiary);
}

.custom-dropdown-arrow {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  transition: transform .2s ease;
}

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

/* Menú desplegable */
.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  padding: 6px;
  display: none;
  animation: dropdownSlideDown .18s ease-out;
}

.custom-dropdown.open .custom-dropdown-menu {
  display: block;
}

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

/* Categorías (optgroup equivalentes) */
.custom-dropdown-group {
  padding: 10px 12px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  pointer-events: none;
  user-select: none;
}

.custom-dropdown-group:not(:first-child) {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

/* Opciones */
.custom-dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.custom-dropdown-option:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.custom-dropdown-option.selected {
  background: var(--accent-soft);
  color: var(--accent-color);
  font-weight: 600;
}

.custom-dropdown-option.selected::after {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-glow);
  margin-left: auto;
}

.custom-dropdown-option-emoji {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  width: 20px;
  text-align: center;
}

.custom-dropdown-option-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Estado custom (Otro personalizado) */
.custom-dropdown-option.custom-option {
  color: var(--accent-color);
  font-weight: 600;
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
  padding-top: 12px;
}

.custom-dropdown-option.custom-option:hover {
  background: var(--accent-soft);
}
/* ============================================
   SLIDERS EN MODAL DE CONEXIÓN
   ============================================ */

.edge-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.edge-slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 100px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  outline: none;
  cursor: pointer;
  padding: 0;
}

.edge-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 0 12px var(--accent-glow), 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform .15s ease;
}

.edge-slider-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.edge-slider-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 0 12px var(--accent-glow), 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform .15s ease;
}

.edge-slider-row input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.edge-slider-row input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 100px;
  background: var(--bg-surface);
}

.edge-slider-value {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-color);
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* ============================================
   TEMAS DE LECTURA MEJORADOS
   ============================================ */

/* Los temas se aplican al body con data-reader-theme */
body[data-reader-theme="obsidian"] {
  --reader-bg: #0a0a0c;
  --reader-text: #e8e8ed;
  --reader-accent: #e50914;
}

body[data-reader-theme="midnight"] {
  --reader-bg: #0f0f1a;
  --reader-text: #d8d8e4;
  --reader-accent: #6a8cff;
}

body[data-reader-theme="parchment"] {
  --reader-bg: #f2ead8;
  --reader-text: #2a2620;
  --reader-accent: #b8860b;
}

body[data-reader-theme="neutral"] {
  --reader-bg: #1e1e22;
  --reader-text: #d0d0d6;
  --reader-accent: #e50914;
}

/* Aplicar el tema al fondo del capítulo */
body[data-reader-theme] .chapter-shell,
body[data-reader-theme] .reader-c {
  background: var(--reader-bg);
}

body[data-reader-theme] .chapter-body,
body[data-reader-theme] .reader-body-c {
  color: var(--reader-text);
}

body[data-reader-theme] .chapter-title-c,
body[data-reader-theme] .chapter-story-link,
body[data-reader-theme] .reader-title-c {
  color: var(--reader-text);
}

body[data-reader-theme] .chapter-story-link {
  color: var(--reader-accent);
}

body[data-reader-theme] .chapter-note {
  background: rgba(255, 255, 255, 0.04);
  color: var(--reader-text);
}

body[data-reader-theme="parchment"] .chapter-note {
  background: rgba(0, 0, 0, 0.04);
}

/* Cuando el tema es neutral, el fondo del capítulo NO es negro puro
   sino un gris suave y agradable */
body[data-reader-theme="neutral"] {
  --bg-main: #1e1e22;
  --bg-elevated: #25252a;
  --bg-surface: #2a2a30;
}

/* Redondear el fondo del capítulo */
.chapter-shell {
  border-radius: 0;
}

@media (min-width: 720px) {
  body[data-reader-theme] .chapter-shell {
    border-radius: var(--radius-lg);
    margin-top: 24px;
    margin-bottom: 24px;
  }
}

/* ============ NUEVOS ESTILOS PARA EL MODAL DE AJUSTES ============ */

/* Ajustar los 4 segmentos de tema ahora que son 4 en lugar de 3 */
.rs-segment[data-pref="theme"] {
  grid-template-columns: repeat(4, 1fr);
}

.rs-segment[data-pref="theme"] .rs-seg-btn {
  font-size: 12px;
  padding: 10px 6px;
}

@media (max-width: 500px) {
  .rs-segment[data-pref="theme"] .rs-seg-btn {
    font-size: 11px;
    padding: 10px 4px;
  }
}
/* ============================================
   NOTIFICACIONES
   ============================================ */

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent-color);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 100px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 12px var(--accent-glow);
  border: 2px solid var(--bg-main);
  z-index: 2;
}

.notif-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 20px;
  flex-wrap: wrap;
}

.notif-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.notif-filter {
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.notif-filter:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

.notif-filter.active {
  background: var(--accent-soft);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.notif-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.notif-item.unread {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-color);
}

.notif-item.read {
  opacity: 0.75;
}

.notif-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.notif-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.notif-icon-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--bg-main);
  color: #ffffff;
  z-index: 1;
}

.notif-icon-badge svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.notif-blue .notif-icon-badge { background: #2196f3; }
.notif-red .notif-icon-badge { background: #e50914; }
.notif-green .notif-icon-badge { background: #4caf50; }
.notif-gray .notif-icon-badge { background: #6a6a78; }

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
}

.notif-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.notif-text em {
  color: var(--text-secondary);
  font-style: normal;
}

.notif-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.notif-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-glow);
}

.notif-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
}

.notif-item:hover .notif-delete {
  opacity: 1;
}

.notif-delete:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
}

@media (max-width: 600px) {
  .notif-delete { opacity: 1; }
}
/* ============================================
   INTERLINEADO ESTILO WATTPAD
   ============================================ */

/* Aplicar al área de escritura del admin y al lector público */
.chapter-body,
.reader-body-c,
.editor-area {
  line-height: 1.55;
  letter-spacing: -0.003em;
}

.chapter-body p,
.reader-body-c p,
.editor-area p {
  margin-bottom: 1.4em;
  text-indent: 0;
}

/* Último párrafo sin margen extra */
.chapter-body p:last-child,
.reader-body-c p:last-child,
.editor-area p:last-child {
  margin-bottom: 0;
}

/* H2 y H3 dentro del contenido */
.chapter-body h2,
.reader-body-c h2,
.editor-area h2 {
  margin: 1.6em 0 0.8em;
  line-height: 1.3;
}

.chapter-body h3,
.reader-body-c h3,
.editor-area h3 {
  margin: 1.4em 0 0.7em;
  line-height: 1.35;
}

/* Blockquotes */
.chapter-body blockquote,
.reader-body-c blockquote,
.editor-area blockquote {
  margin: 1.2em 0;
  padding-left: 20px;
  border-left: 3px solid var(--accent-color);
}

/* Listas */
.chapter-body ul,
.chapter-body ol,
.reader-body-c ul,
.reader-body-c ol,
.editor-area ul,
.editor-area ol {
  margin: 1em 0 1.3em 1.5em;
}

.chapter-body li,
.reader-body-c li,
.editor-area li {
  margin-bottom: 0.5em;
  line-height: 1.55;
}

/* ============================================
   PANEL ADMIN — BOTONES EN CARDS AGRUPADOS
   ============================================ */

.admin-actions-grouped {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

.admin-action-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-action-section-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}

.admin-action-section-title::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--accent-color);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow);
}

.admin-action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.admin-action-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  min-height: 52px;
}

.admin-action-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateY(-2px);
}

.admin-action-card:active {
  transform: translateY(0);
}

.admin-action-card.primary {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.admin-action-card.primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.admin-action-card svg,
.admin-action-card i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}

.admin-action-card .admin-action-label {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge en botón de notificaciones */
.admin-action-card .notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent-color);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 100px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 12px var(--accent-glow);
  border: 2px solid var(--bg-main);
  z-index: 2;
}

@media (max-width: 600px) {
  .admin-action-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .admin-action-card {
    padding: 12px 12px;
    font-size: 12.5px;
    gap: 8px;
    min-height: 48px;
  }

  .admin-action-card svg,
  .admin-action-card i {
    width: 16px;
    height: 16px;
  }
}

@media (min-width: 900px) {
  .admin-action-cards {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}
/* ============================================
   INTERLINEADO ESTILO WATTPAD
   ============================================ */

.chapter-body,
.reader-body-c,
.editor-area {
  line-height: 1.55;
  letter-spacing: -0.003em;
}

.chapter-body p,
.reader-body-c p,
.editor-area p {
  margin-bottom: 1.4em;
  text-indent: 0;
}

.chapter-body p:last-child,
.reader-body-c p:last-child,
.editor-area p:last-child {
  margin-bottom: 0;
}

.chapter-body h2,
.reader-body-c h2,
.editor-area h2 {
  margin: 1.6em 0 0.8em;
  line-height: 1.3;
}

.chapter-body h3,
.reader-body-c h3,
.editor-area h3 {
  margin: 1.4em 0 0.7em;
  line-height: 1.35;
}

.chapter-body blockquote,
.reader-body-c blockquote,
.editor-area blockquote {
  margin: 1.2em 0;
  padding-left: 20px;
  border-left: 3px solid var(--accent-color);
}

.chapter-body ul,
.chapter-body ol,
.reader-body-c ul,
.reader-body-c ol,
.editor-area ul,
.editor-area ol {
  margin: 1em 0 1.3em 1.5em;
}

.chapter-body li,
.reader-body-c li,
.editor-area li {
  margin-bottom: 0.5em;
  line-height: 1.55;
}
/* ============================================
   RELATOS DE LA COMUNIDAD
   ============================================ */

/* Toolbar en la página de relatos */
.relatos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.relatos-toolbar-info {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Grid de relatos */
.relatos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Card de relato (en la lista pública) */
.relato-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  overflow: hidden;
}

.relato-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-color);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.relato-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateX(4px);
}

.relato-card:hover::before { transform: scaleY(1); }

.relato-card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.relato-card-author {
  font-size: 12.5px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.relato-card-author strong {
  color: var(--accent-color);
  font-weight: 700;
}

.relato-card-excerpt {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.relato-card-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-color);
  margin-top: auto;
  transition: gap .2s;
}

.relato-card:hover .relato-card-more { gap: 12px; }

.relato-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.relato-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.relato-card-meta-item svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

/* Vista individual del relato */
.relato-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.relato-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 12px;
  word-break: break-word;
}

.relato-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.relato-author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  flex-shrink: 0;
}

.relato-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.relato-author-name {
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   REACCIONES CON EMOJIS
   ============================================ */

.relato-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.reaction-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateY(-2px);
}

.reaction-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 16px var(--accent-glow);
}

.reaction-btn-emoji {
  font-size: 16px;
  line-height: 1;
}

.reaction-btn-count {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  min-width: 12px;
}

.reaction-btn-empty .reaction-btn-count {
  display: none;
}

/* Picker flotante de reacciones (cuando no se ha reaccionado aún) */
.reactions-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin: 20px 0;
}

.reaction-pick-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.reaction-pick-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-color);
  transform: scale(1.15);
}

/* ============================================
   FORMULARIO DE RELATO (mis-relatos.html)
   ============================================ */

.relato-form-shell {
  max-width: 800px;
  margin: 0 auto;
}

.relato-form-consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 20px 0;
}

.relato-form-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.relato-form-consent label {
  cursor: pointer;
  user-select: none;
}

/* Aviso de normas */
.relato-normas-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(229, 9, 20, 0.08);
  border-left: 3px solid var(--accent-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 16px 0;
}

.relato-normas-warning svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--accent-color);
  margin-top: 2px;
}

/* Lista de "mis relatos" en gestión */
.mis-relatos-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mi-relato-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.mi-relato-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.mi-relato-body {
  flex: 1;
  min-width: 0;
}

.mi-relato-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mi-relato-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mi-relato-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.mi-relato-action-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.mi-relato-action-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: var(--accent-soft);
}

.mi-relato-action-btn.danger:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

/* ============================================
   BOTÓN DE REPORTAR
   ============================================ */

.report-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition);
}

.report-btn:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.08);
}

/* ============================================
   CARRUSEL DE RELATOS EN EL HOME
   ============================================ */

.relatos-home-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  padding-left: 20px;
  padding-right: 20px;
  margin: 0 -20px;
  scrollbar-width: none;
}

.relatos-home-carousel::-webkit-scrollbar { display: none; }

.relato-home-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 260px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
}

.relato-home-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-color);
  transform: translateY(-3px);
}

.relato-home-card-title {
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.relato-home-card-author {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.relato-home-card-author strong {
  color: var(--accent-color);
  font-weight: 700;
}

.relato-home-card-excerpt {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 700px) {
  .relatos-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .relato-card {
    padding: 16px 18px;
  }

  .relato-card-title {
    font-size: 16px;
  }

  .relato-home-card {
    width: 220px;
    padding: 14px 16px;
  }

  .reaction-pick-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .mi-relato-item {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .mi-relato-actions {
    justify-content: flex-end;
    margin-top: 8px;
  }
}
/* ============================================
   RELATOS DE LA COMUNIDAD — FASE 2
   Añadir al final de styles.css
   ============================================ */

/* ---------- TOOLBAR ---------- */
.relatos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.relatos-toolbar-info {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- GRID ---------- */
.relatos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ---------- CARD DE RELATO ---------- */
.relato-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  overflow: hidden;
}

.relato-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-color);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.relato-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateX(4px);
}

.relato-card:hover::before { transform: scaleY(1); }

.relato-card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.relato-card-author {
  font-size: 12.5px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.relato-card-author strong {
  color: var(--accent-color);
  font-weight: 700;
}

.relato-card-excerpt {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.relato-card-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-color);
  margin-top: auto;
  transition: gap .2s;
}

.relato-card:hover .relato-card-more { gap: 12px; }

.relato-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.relato-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.relato-card-meta-item svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

/* ---------- VISTA INDIVIDUAL ---------- */
.relato-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.relato-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 12px;
  word-break: break-word;
}

.relato-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.relato-author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  flex-shrink: 0;
}

.relato-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.relato-author-name {
  font-weight: 600;
  color: var(--text-primary);
}

.relato-author-date {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ---------- BOTÓN REPORTAR ---------- */
.report-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition);
  margin-left: auto;
}

.report-btn:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.08);
}

.report-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- REACCIONES ---------- */
.relato-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.reaction-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  transform: translateY(-2px);
}

.reaction-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 16px var(--accent-glow);
}

.reaction-btn-emoji {
  font-size: 16px;
  line-height: 1;
}

.reaction-btn-count {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  min-width: 12px;
}

.reaction-btn-empty .reaction-btn-count {
  display: none;
}

/* ---------- FORMULARIO DE RELATO ---------- */
.relato-form-shell {
  max-width: 800px;
  margin: 0 auto;
}

.relato-form-consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 20px 0;
}

.relato-form-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.relato-form-consent label {
  cursor: pointer;
  user-select: none;
}

.relato-normas-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(229, 9, 20, 0.08);
  border-left: 3px solid var(--accent-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 16px 0;
}

.relato-normas-warning svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--accent-color);
  margin-top: 2px;
}

/* ---------- MIS RELATOS ---------- */
.mis-relatos-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mi-relato-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.mi-relato-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.mi-relato-body {
  flex: 1;
  min-width: 0;
}

.mi-relato-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mi-relato-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mi-relato-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.mi-relato-action-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.mi-relato-action-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: var(--accent-soft);
}

.mi-relato-action-btn.danger:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

/* ---------- CARRUSEL DE RELATOS EN HOME ---------- */
.relatos-home-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  padding-left: 20px;
  padding-right: 20px;
  margin: 0 -20px;
  scrollbar-width: none;
}

.relatos-home-carousel::-webkit-scrollbar { display: none; }

.relato-home-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 260px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
}

.relato-home-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-color);
  transform: translateY(-3px);
}

.relato-home-card-title {
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.relato-home-card-author {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.relato-home-card-author strong {
  color: var(--accent-color);
  font-weight: 700;
}

.relato-home-card-excerpt {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 700px) {
  .relatos-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .relato-card {
    padding: 16px 18px;
  }

  .relato-card-title {
    font-size: 16px;
  }

  .relato-home-card {
    width: 220px;
    padding: 14px 16px;
  }

  .mi-relato-item {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .mi-relato-actions {
    justify-content: flex-end;
    margin-top: 8px;
  }

  .report-btn {
    margin-left: 0;
    margin-top: 8px;
  }
}
/* ============================================
   ADMIN — REPORTES DE RELATOS
   ============================================ */

.admin-report-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: var(--transition);
}

.admin-report-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
}

.admin-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-report-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.admin-report-title a {
  color: inherit;
  text-decoration: none;
}

.admin-report-title a:hover {
  color: var(--accent-color);
}

.admin-report-meta {
  font-size: 11.5px;
  color: var(--text-tertiary);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-report-meta strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.admin-report-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-report-badge.pending {
  background: rgba(255, 152, 0, 0.15);
  color: #ff9800;
}

.admin-report-badge.resolved {
  background: rgba(76, 175, 80, 0.15);
  color: #6ecb7c;
}

.admin-report-badge.dismissed {
  background: rgba(158, 158, 158, 0.15);
  color: var(--text-tertiary);
}

.admin-report-reason {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-color);
  border-radius: var(--radius-sm);
}

.admin-report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.admin-report-actions .btn {
  padding: 8px 14px;
  font-size: 12.5px;
}

.admin-report-actions .btn-danger {
  background: rgba(255, 107, 107, 0.12);
  color: #ff8a8a;
  border-color: rgba(255, 107, 107, 0.3);
}

.admin-report-actions .btn-danger:hover {
  background: rgba(255, 107, 107, 0.22);
  border-color: #ff6b6b;
}

.admin-report-preview {
  font-size: 12.5px;
  color: var(--text-tertiary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-style: italic;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

/* Filtros de reportes */
.reportes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 20px;
  flex-wrap: wrap;
}

.reportes-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.reportes-filter {
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.reportes-filter:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

.reportes-filter.active {
  background: var(--accent-soft);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.reportes-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.reportes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 600px) {
  .admin-report-head {
    flex-direction: column;
  }
  .admin-report-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-report-actions .btn {
    width: 100%;
  }
}
/* ============================================
   FASE 2 — CIERRE: búsqueda, compartir, paginación
   ============================================ */

/* Barra de búsqueda de relatos */
.relatos-search-bar {
  margin-bottom: 20px;
}

.relatos-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  transition: var(--transition);
}

.relatos-search-wrap:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.relatos-search-wrap svg {
  flex-shrink: 0;
  color: var(--text-tertiary);
  width: 18px;
  height: 18px;
}

.relatos-search-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text-primary);
  min-width: 0;
}

.relatos-search-wrap input::placeholder {
  color: var(--text-tertiary);
}

/* Botón compartir */
.relato-share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.relato-share-label {
  font-size: 12.5px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 4px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.share-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-2px);
}

.share-btn svg {
  width: 14px;
  height: 14px;
}

/* Paginación */
.relatos-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.pagination-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.pagination-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  .relato-share-row {
    gap: 8px;
  }
  .share-btn {
    padding: 7px 12px;
    font-size: 12px;
  }
}
/* ============================================
   FASE 3 — PERFILES + SEGUIDORES
   ============================================ */

.perfil-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  padding: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.perfil-card::before {
  content: '';
  position: absolute;
  top: -40%; right: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.4;
}

.perfil-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.perfil-avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 72px;
  font-weight: 700;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-lg);
  border: 3px solid var(--border-color);
}

.perfil-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.perfil-badge-autor {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--gold);
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 100px;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.perfil-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.perfil-name {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  word-break: break-word;
}

.perfil-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.perfil-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perfil-stat-value {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.perfil-stat-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
}

.perfil-bio {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.perfil-meta-extra {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-tertiary);
}

.perfil-meta-extra span,
.perfil-meta-extra a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.perfil-meta-extra a:hover {
  color: var(--accent-color);
}

.perfil-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#btnFollow {
  min-width: 140px;
}

/* Notificaciones de nuevo seguidor */
.notif-item .notif-text strong {
  color: var(--text-primary);
}

@media (max-width: 700px) {
  .perfil-card {
    grid-template-columns: 1fr;
    padding: 24px 20px;
    gap: 20px;
    text-align: center;
  }

  .perfil-avatar {
    width: 140px;
    height: 140px;
    font-size: 56px;
  }

  .perfil-name {
    font-size: 26px;
  }

  .perfil-stats {
    justify-content: center;
    gap: 22px;
  }

  .perfil-meta-extra {
    justify-content: center;
  }

  .perfil-actions {
    justify-content: center;
  }

  #btnFollow {
    width: 100%;
  }
}
/* ============================================
   BLOQUE DE CORRECCIÓN RESPONSIVA (FIX PARA TODAS LAS PANTALLAS)
   Pega esto al final de tu styles.css
   ============================================ */

/* 1. Evitar el zoom automático en iPhones y mejorar inputs en móviles */
input, textarea, select {
  font-size: 16px !important;
  max-width: 100%;
}

/* 2. Formulario de registro: Apilar Nombre y Apellido en móviles */
.auth-form-c {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-form-c label {
  width: 100%;
}
/* Si tenías los inputs de nombre y apellido en un flex, los apilamos en pantallas pequeñas */
@media (max-width: 600px) {
  .auth-form-c > div {
    flex-direction: column !important;
    gap: 12px !important;
  }
}

/* 3. Arreglar los modales para que no se salgan de la pantalla (especialmente en móviles) */
.modal-overlay-c:not([hidden]) {
  padding: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.modal-overlay-c[hidden] {
  display: none !important;
}
.modal-c {
  max-height: 90vh !important;
  overflow-y: auto !important;
  width: 100% !important;
  max-width: 450px !important;
  margin: auto !important;
}

/* 4. Grillas automáticas (Libros, Géneros, Relatos) */
/* Esto hace que en PC se vean 5 o 6 columnas, en tablet 3, y en móvil 2 */
.stories-grid-c, 
.genres-grid-c, 
.relatos-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)) !important;
  gap: 16px !important;
}

/* 5. Textos que se adaptan a cualquier pantalla (Tipografía Fluida) */
.page-title-c { font-size: clamp(24px, 5vw, 46px) !important; }
.hero-title-c { font-size: clamp(28px, 6vw, 68px) !important; }
.section-title { font-size: clamp(20px, 3.5vw, 30px) !important; }
.chapter-title-c, .reader-title-c { font-size: clamp(22px, 4vw, 38px) !important; }
.chapter-body, .reader-body-c { font-size: clamp(16px, 2.5vw, 19px) !important; }

/* 6. Contenedor principal y espaciados */
.container {
  padding: 0 clamp(16px, 4vw, 40px) !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
}

/* 7. Formularios de administración (Para que no se aplasten en móvil) */
@media (max-width: 768px) {
  .admin-form-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .admin-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .admin-action-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* 8. Ajustes para Smart TVs y Pantallas 4K */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px !important;
    padding: 0 60px !important;
  }
  .hero-title-c { font-size: 90px !important; }
  .hero-synopsis { font-size: 22px !important; max-width: 800px !important; }
  .stories-grid-c, .genres-grid-c { 
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; 
    gap: 40px !important; 
  }
  .chapter-shell { max-width: 1000px !important; }
  .chapter-body, .reader-body-c { font-size: 24px !important; line-height: 1.8 !important; }
  .book-cover { font-size: 72px !important; }
  .desktop-nav a { font-size: 18px !important; padding: 10px 20px !important; }
  .app-header-inner { height: 80px !important; }
}

/* 9. Ajustes para pantallas muy pequeñas (iPhone SE, etc.) */
@media (max-width: 380px) {
  .container { padding: 0 12px !important; }
  .modal-c { padding: 16px !important; }
  .stories-grid-c, .genres-grid-c { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .admin-action-cards { grid-template-columns: 1fr !important; }
  .chapter-nav { grid-template-columns: 1fr !important; }
}

/* 10. Asegurar que el botón de instalar App no tape cosas importantes */
.pwa-install-btn {
  z-index: 99999 !important;
}
