/* ==========================================================================
   GENRUPTO - ESTILOS Y TIPOGRAFÍAS
   ========================================================================== */

@font-face {
  font-family: "Gummy Bear";
  src: url("GummyBear.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  /* Paleta base de la portada */
  --bg-dark: #140E1B;
  --bg-card: #22172D;
  --bg-card-border: #4D355F;
  --bg-card-hover: #2E1F3D;

  --accent-purple: #9B71CF;
  --accent-magenta: #C55394;
  --accent-gold: #E8C17A;
  --accent-rose: #D8A8B1;
  --accent-lavender: #CBAFC4;

  --text-primary: #F3EDF8;
  --text-secondary: #BFAECB;
  --text-muted: #857294;

  --border-subtle: rgba(155, 113, 207, 0.25);
  --border-glow: rgba(197, 83, 148, 0.45);

  --font-gummy: "Gummy Bear", "Nunito", cursive, sans-serif;
  --font-title: var(--font-gummy);
  --font-body: var(--font-gummy);
  --font-pixel: 'Press Start 2P', monospace;

  --shadow-sm: 0 2px 8px rgba(10, 6, 15, 0.5);
  --shadow-lg: 0 8px 32px rgba(10, 6, 15, 0.75);
  --shadow-glow: 0 0 25px rgba(155, 113, 207, 0.3);
}

/* Reset y base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(197, 83, 148, 0.22) 0%, transparent 70%),
    radial-gradient(ellipse 70% 50% at 80% 20%, rgba(155, 113, 207, 0.18) 0%, transparent 60%),
    radial-gradient(circle at 15% 45%, rgba(124, 42, 144, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(34, 23, 45, 0.8) 0%, transparent 80%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* ==========================================================================
   HEADER SUPERIOR FLOTANTE
   ========================================================================== */
.genrupto-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(20, 14, 27, 0.95) 0%, rgba(20, 14, 27, 0.7) 80%, transparent 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  border-bottom: 1px solid rgba(155, 113, 207, 0.15);
}

.header-left .btn-back-nerume {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(34, 23, 45, 0.85);
  border: 1px solid var(--bg-card-border);
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-rose);
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.header-left .btn-back-nerume:hover {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
  box-shadow: 0 0 16px rgba(155, 113, 207, 0.5);
  transform: translateX(-2px);
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.brand-link:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 0 10px rgba(197, 83, 148, 0.5));
}

.brand-logo-img {
  height: 38px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

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

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(34, 23, 45, 0.85);
  border: 1px solid var(--bg-card-border);
  border-radius: 30px;
  padding: 4px 14px 4px 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-pill:hover {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

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

.user-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.badge-genadmin {
  background: linear-gradient(135deg, #7C2A90, #BE3B78);
  color: #FFF;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 8px rgba(190, 59, 120, 0.6);
}

.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #4A275E 0%, #2A1738 100%);
  border: 1px solid var(--accent-purple);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: all 0.25s ease;
}

.btn-login:hover {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-magenta) 100%);
  box-shadow: 0 0 16px rgba(155, 113, 207, 0.4);
  transform: translateY(-1px);
}

/* ==========================================================================
   PORTADA SHOWCASE - FUSIÓN SIN CORTE
   ========================================================================== */
.genrupto-main {
  width: 100%;
  margin-top: 64px;
}

.cover-showcase {
  position: relative;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cover-art-container {
  position: relative;
  width: 100%;
  max-height: 80vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: var(--bg-dark);
}

.cover-picture {
  width: 100%;
  display: flex;
  justify-content: center;
}

.cover-image {
  width: 100%;
  max-width: 1100px;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.7));
}

/* Transición suave hacia abajo para que NO exista corte visible */
.cover-fade-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(
    to bottom,
    rgba(20, 14, 27, 0) 0%,
    rgba(34, 23, 45, 0.25) 35%,
    rgba(20, 14, 27, 0.75) 70%,
    var(--bg-dark) 100%
  );
  pointer-events: none;
}

.book-header-info {
  position: relative;
  margin-top: -60px;
  z-index: 10;
  text-align: center;
  max-width: 860px;
  padding: 0 20px 40px;
}

.book-title {
  font-family: var(--font-title);
  font-size: 3.2rem;
  letter-spacing: 6px;
  font-weight: 900;
  line-height: 1.1;
  background: linear-gradient(180deg, #FFFFFF 20%, var(--accent-rose) 70%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.book-subtitle {
  font-size: 1.25rem;
  color: var(--accent-lavender);
  font-style: italic;
  margin-bottom: 16px;
}

.book-meta-tags {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.meta-tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Fuentes configurables */
body[data-font="gummy"], .font-gummy {
  font-family: var(--font-gummy);
}
body[data-font="nunito"], .font-nunito {
  font-family: 'Nunito', sans-serif;
}
body[data-font="pixel"], .font-pixel {
  font-family: var(--font-pixel);
}

.status-tag {
  background: rgba(197, 83, 148, 0.2);
  border: 1px solid var(--accent-magenta);
  color: #FFA6D8;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 14px;
  letter-spacing: 1px;
}

.book-synopsis {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 680px;
  margin: 0 auto 28px;
}

.book-actions-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.btn-heart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--accent-rose);
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.btn-heart:hover, .btn-heart[data-liked="true"] {
  background: rgba(197, 83, 148, 0.25);
  border-color: var(--accent-magenta);
  color: #FF5E9A;
  box-shadow: 0 0 20px rgba(197, 83, 148, 0.4);
}

.btn-heart .heart-icon {
  font-size: 1.2rem;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-heart:active .heart-icon {
  transform: scale(1.4);
}

.btn-notify {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.btn-notify:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow);
}

.btn-notify[data-following="true"] {
  background: rgba(197, 83, 148, 0.25);
  border-color: var(--accent-magenta);
  color: #FFA6D8;
  box-shadow: 0 0 16px rgba(197, 83, 148, 0.4);
}

.btn-notify .notify-icon {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.btn-notify:hover .notify-icon {
  transform: rotate(15deg);
}

.btn-comment-anchor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.25s ease;
}

.btn-comment-anchor:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow);
}

.btn-quick-edit {
  background: linear-gradient(135deg, #572A7A, #3B1B54);
  border: 1px solid var(--accent-purple);
  color: #F8EDFF;
  padding: 10px 18px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.25s ease;
}

.btn-quick-edit:hover {
  background: var(--accent-purple);
  color: #FFF;
}

/* ==========================================================================
   SEPARADOR ORNAMENTAL
   ========================================================================== */
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 600px;
  margin: 30px auto 45px;
  opacity: 0.7;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-purple), transparent);
}

.divider-glyph {
  font-size: 1.1rem;
  color: var(--accent-rose);
  letter-spacing: 4px;
}

/* ==========================================================================
   STREAM DE BLOQUES DEL LIBRO
   ========================================================================== */
.book-content-section {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.blocks-stream {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.block-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.block-card.is-bookmarked {
  border-color: var(--accent-magenta) !important;
  box-shadow: 0 0 20px rgba(197, 83, 148, 0.35) !important;
}

.bookmark-highlight {
  animation: bookmarkPulse 2s ease;
}

@keyframes bookmarkPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(197, 83, 148, 0); }
  50% { transform: scale(1.02); box-shadow: 0 0 35px rgba(197, 83, 148, 0.7); border-color: var(--accent-magenta); }
  100% { transform: scale(1); box-shadow: 0 0 15px rgba(197, 83, 148, 0.3); }
}

/* Botón Marcapáginas: estilo pin integrado en la esquina superior derecha */
.block-bookmark-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(20, 14, 27, 0.85);
  border: 1px solid var(--bg-card-border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  z-index: 10;
  padding: 0;
}

/* Para administradores con controles de edición, se sitúa justo debajo de la X de borrar */
.block-card.has-admin-controls .block-bookmark-btn {
  top: 46px; /* 12px + 28px botón + 6px gap = 46px */
}

.block-bookmark-btn .bm-icon {
  font-size: 0.95rem;
  line-height: 1;
  filter: grayscale(100%);
  opacity: 0.55;
  transition: all 0.2s ease;
}

.block-bookmark-btn .bm-label {
  display: none; /* Icono tipo botón pin cuadrado limpio */
}

.block-bookmark-btn:hover {
  background: var(--accent-magenta);
  border-color: var(--accent-magenta);
  color: #FFF;
  box-shadow: 0 0 10px rgba(197, 83, 148, 0.5);
  transform: scale(1.05);
}

.block-bookmark-btn:hover .bm-icon {
  filter: none;
  opacity: 1;
}

.block-bookmark-btn.active {
  background: linear-gradient(135deg, #D4428D, #9B71CF);
  border-color: #FF94CE;
  color: #FFF;
  box-shadow: 0 0 12px rgba(212, 66, 141, 0.65);
}

.block-bookmark-btn.active .bm-icon {
  filter: none;
  opacity: 1;
  transform: scale(1.15);
}

.block-bookmark-btn.active:hover {
  transform: scale(1.18);
  box-shadow: 0 0 16px rgba(212, 66, 141, 0.9);
}

.block-card:hover {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow);
}

/* Tipos específicos de bloques */
.block-card.block-chapter {
  text-align: center;
  padding: 36px 28px;
  border-width: 2px;
  border-color: var(--accent-rose);
}

.block-card.block-chapter .chapter-header {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  color: #FFF;
  margin-bottom: 12px;
}

.block-card.block-quote {
  border-left: 4px solid var(--accent-magenta);
  font-style: italic;
  padding-left: 32px;
}

.block-card.block-quote .quote-content {
  font-size: 1.15rem;
}

/* Bloque de Diálogo tipo RPG */
.block-card.block-dialogue {
  background: linear-gradient(135deg, rgba(28, 18, 38, 0.95), rgba(18, 12, 25, 0.95));
  border: 1px solid rgba(197, 83, 148, 0.45);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(155, 113, 207, 0.08);
  padding: 18px 22px;
}

.block-card.block-dialogue.has-admin-controls {
  padding-top: 48px; /* Deja despejada la zona superior para los botones de editar y borrar */
}

.rpg-dialogue-wrapper {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 18px !important;
  width: 100% !important;
}

.rpg-dialogue-wrapper.avatar-pos-right {
  flex-direction: row-reverse !important;
}

.rpg-dialogue-wrapper.avatar-pos-right .rpg-char-name {
  align-self: flex-end;
}

.rpg-avatar-col {
  flex: 0 0 76px !important;
  width: 76px !important;
  max-width: 76px !important;
  min-width: 76px !important;
}

.rpg-avatar-frame {
  width: 76px !important;
  height: 76px !important;
  max-width: 76px !important;
  max-height: 76px !important;
  border-radius: 12px;
  border: 2px solid var(--accent-magenta);
  background: #140E1B;
  box-shadow: 0 0 14px rgba(197, 83, 148, 0.35), inset 0 0 8px rgba(0, 0, 0, 0.8);
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

.rpg-avatar-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  image-rendering: auto;
  display: block !important;
  user-select: none;
  -webkit-user-drag: none;
}

.rpg-avatar-placeholder {
  background: linear-gradient(135deg, #2E1B42, #180F22);
  font-size: 1.8rem;
  color: #FFAAD9;
  font-weight: 800;
}

.rpg-speech-col {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rpg-char-name {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 800;
  color: #FFAAD9;
  letter-spacing: 0.5px;
  display: inline-block;
  padding: 2px 10px;
  background: rgba(36, 17, 51, 0.8);
  border: 1px solid rgba(197, 83, 148, 0.5);
  border-radius: 6px;
  align-self: flex-start;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.rpg-dialogue-box {
  position: relative;
  background: rgba(20, 14, 27, 0.75);
  border: 1px solid rgba(155, 113, 207, 0.3);
  border-radius: 10px;
  padding: 12px 16px 22px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.5);
}

.rpg-dialogue-text {
  font-size: 1rem;
  white-space: pre-line;
  word-wrap: break-word;
}

.rpg-dialogue-arrow {
  position: absolute;
  right: 14px;
  bottom: 4px;
  font-size: 0.75rem;
  color: var(--accent-magenta);
  animation: rpgBlink 1.2s infinite ease-in-out;
}

@keyframes rpgBlink {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(3px); }
}

@media (max-width: 600px) {
  .rpg-dialogue-wrapper {
    gap: 12px !important;
  }
  .rpg-avatar-col {
    flex: 0 0 60px !important;
    width: 60px !important;
    max-width: 60px !important;
    min-width: 60px !important;
  }
  .rpg-avatar-frame {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    border-radius: 10px;
  }
  .rpg-char-name {
    font-size: 0.9rem;
  }
  .rpg-dialogue-text {
    font-size: 0.9rem;
  }
  .rpg-dialogue-box {
    padding: 10px 12px 20px;
  }
}

.block-card.block-spacer {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.block-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: #FFF;
}

.block-body {
  white-space: pre-line;
  word-wrap: break-word;
}

.block-media-container {
  margin-top: 18px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.cover-picture,
.cover-image,
.block-media-container img {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
}

.block-media-container img,
.block-media-container video {
  max-width: 100%;
  max-height: 520px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.block-media-container audio {
  width: 100%;
  max-width: 500px;
}

.block-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #4A275E, #321941);
  border: 1px solid var(--accent-purple);
  border-radius: 8px;
  color: #FFF;
  font-weight: 700;
  margin-top: 12px;
  transition: all 0.2s ease;
}

.block-link-btn:hover {
  background: var(--accent-purple);
  box-shadow: var(--shadow-glow);
}

/* Herramientas de edición sobre cada bloque para genadmin */
.block-admin-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  opacity: 0.3;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.block-card:hover .block-admin-controls {
  opacity: 1;
}

.block-control-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(20, 14, 27, 0.85);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.block-control-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.block-control-btn:not(:disabled):hover {
  background: var(--accent-purple);
  color: #FFF;
  border-color: var(--accent-purple);
  transform: translateY(-1px);
}

.block-control-btn.btn-delete:hover {
  background: #A62846;
  border-color: #A62846;
}

/* Estado de carga y vacío */
.loading-state, .empty-blocks {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-secondary);
}

.pixel-loader {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  margin-bottom: 16px;
}

/* ==========================================================================
   SECCIÓN DE COMENTARIOS
   ========================================================================== */
.comments-section {
  max-width: 880px;
  margin: 0 auto 100px;
  padding: 0 20px;
}

.comments-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.comments-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(155, 113, 207, 0.2);
}

.comments-card-header h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: #FFF;
}

.comments-total {
  font-size: 0.85rem;
  color: var(--accent-rose);
  font-weight: 700;
}

.comment-form {
  margin-bottom: 30px;
}

.comment-input-wrap textarea {
  width: 100%;
  background: #140E1B;
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.2s ease;
}

.comment-input-wrap textarea:focus {
  border-color: var(--accent-purple);
  outline: none;
  box-shadow: 0 0 12px rgba(155, 113, 207, 0.25);
}

.comment-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.char-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-submit-comment {
  background: linear-gradient(135deg, var(--accent-magenta), var(--accent-purple));
  color: #FFF;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 0.25s ease;
}

.btn-submit-comment:hover {
  box-shadow: 0 0 16px rgba(197, 83, 148, 0.5);
  transform: translateY(-1px);
}

.comment-login-invite {
  text-align: center;
  padding: 24px;
  background: rgba(20, 14, 27, 0.6);
  border-radius: 12px;
  border: 1px dashed var(--bg-card-border);
  margin-bottom: 28px;
}

.comment-login-invite p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.btn-login-secondary {
  background: var(--bg-card-border);
  color: #FFF;
  padding: 8px 18px;
  border-radius: 18px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.2s ease;
}

.btn-login-secondary:hover {
  background: var(--accent-purple);
}

/* Lista de comentarios */
.comments-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comment-item {
  background: rgba(20, 14, 27, 0.65);
  border: 1px solid rgba(155, 113, 207, 0.15);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color 0.2s ease;
}

.comment-item.is-pinned {
  border-color: var(--accent-rose);
  background: rgba(44, 28, 56, 0.5);
}

.comment-pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-rose);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 8px;
}

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

.comment-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: #FFF;
  overflow: hidden;
}

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

.comment-username {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.comment-time {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}

.comment-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.8rem;
}

.btn-comment-action {
  background: transparent;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-comment-action:hover {
  color: #FFF;
  background: rgba(155, 113, 207, 0.2);
}

.btn-comment-action.active-heart {
  color: #FF5E9A;
}

/* ==========================================================================
   SECCIÓN DE CRÉDITOS EDITABLES (DEBAJO DE COMENTARIOS)
   ========================================================================== */
.credits-section {
  max-width: 860px;
  margin: 0 auto 50px;
  padding: 0 16px;
}

.credits-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 14px;
  padding: 24px 28px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(155, 113, 207, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.credits-badge {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  color: var(--accent-magenta);
  text-transform: uppercase;
  padding: 3px 12px;
  background: rgba(197, 83, 148, 0.12);
  border: 1px solid rgba(197, 83, 148, 0.35);
  border-radius: 20px;
}

.credits-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 720px;
  white-space: pre-line;
  word-wrap: break-word;
}

.btn-edit-credits-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  background: rgba(155, 113, 207, 0.15);
  border: 1px dashed rgba(155, 113, 207, 0.4);
  color: var(--accent-purple);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-edit-credits-inline:hover {
  background: var(--accent-purple);
  color: #FFF;
  border-style: solid;
  transform: translateY(-1px);
}

body.preview-mode-user .btn-edit-credits-inline {
  display: none !important;
}

/* ==========================================================================
   BOTÓN FLOTANTE DE LÁPIZ (GENADMIN / NERE1D)
   ========================================================================== */
.genadmin-floating-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
}

.pencil-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C2A90 0%, #BE3B78 100%);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124, 42, 144, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.25);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pencil-fab:hover {
  transform: scale(1.1) rotate(-8deg);
  box-shadow: 0 6px 28px rgba(190, 59, 120, 0.8);
}

.admin-quick-menu {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--accent-purple);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-menu-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--bg-card-border);
  font-size: 0.8rem;
  color: var(--accent-rose);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quick-menu-header .user-badge {
  background: rgba(155, 113, 207, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
}

.admin-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.admin-menu-item:hover {
  background: var(--bg-card-hover);
  color: #FFF;
}

/* ==========================================================================
   MODALES
   ========================================================================== */
.genrupto-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 15, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.genrupto-modal {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  background: #1E1528;
  border: 1px solid var(--accent-purple);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.genrupto-modal.modal-small {
  max-width: 420px;
}

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head h3 {
  font-family: var(--font-title);
  color: #FFF;
  font-size: 1.15rem;
}

.btn-close-modal {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: color 0.2s ease;
}

.btn-close-modal:hover {
  color: #FFF;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-lavender);
}

.input-text, .input-textarea, .input-select {
  background: #120C19;
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.input-text:focus, .input-textarea:focus, .input-select:focus {
  border-color: var(--accent-purple);
  outline: none;
}

.block-type-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.type-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #140E1B;
  border: 1px solid var(--bg-card-border);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.type-opt:has(input:checked) {
  border-color: var(--accent-purple);
  background: rgba(155, 113, 207, 0.2);
  color: #FFF;
}

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

.styling-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.media-upload-row {
  display: flex;
  gap: 8px;
}

.btn-file-upload {
  position: relative;
  background: var(--bg-card-border);
  color: #FFF;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-file-upload:hover {
  background: var(--accent-purple);
}

.btn-file-upload.uploading {
  opacity: 0.7;
  pointer-events: none;
}

.media-preview-box {
  margin-top: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--bg-card-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.media-preview-img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  object-fit: contain;
}

.media-preview-info {
  font-size: 0.8rem;
  color: var(--accent-lavender);
  text-align: center;
  word-break: break-all;
}

.hidden-input {
  display: none;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.btn-cancel {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: 8px;
}

.btn-save {
  background: linear-gradient(135deg, var(--accent-magenta), var(--accent-purple));
  color: #FFF;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(197, 83, 148, 0.4);
}

.error-msg {
  color: #FF6B8B;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: rgba(255, 107, 139, 0.1);
  border-radius: 6px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2D1A3E;
  border: 1px solid var(--accent-purple);
  color: #FFF;
  padding: 12px 24px;
  border-radius: 25px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 400;
  animation: fadeIn 0.3s ease;
}

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

.hidden {
  display: none !important;
}

/* Responsividad y botones adaptados a móvil */
@media (max-width: 820px) {
  .genrupto-header {
    height: 56px;
    padding: 0 12px;
  }
  .genrupto-main {
    margin-top: 56px;
  }
  .header-left .btn-back-nerume {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 4px;
  }
  .brand-logo-img {
    height: 30px;
    max-width: 140px;
  }
  .user-pill {
    padding: 3px 8px 3px 4px;
    gap: 6px;
  }
  .user-name {
    font-size: 0.8rem;
  }
  .badge-genadmin {
    display: none; /* Ahorra espacio en la barra móvil */
  }
  .btn-login {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  .book-title {
    font-size: 2.1rem;
    letter-spacing: 2px;
  }
  .book-header-info {
    margin-top: -30px;
    padding: 0 14px 24px;
  }
  .book-subtitle {
    font-size: 1.05rem;
    margin-bottom: 12px;
  }
  .book-synopsis {
    font-size: 0.95rem;
    margin-bottom: 20px;
  }

  /* Botones de acción del libro adaptados a celulares */
  .book-actions-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
  }
  .btn-heart, .btn-notify, .btn-comment-anchor, .btn-quick-edit {
    padding: 8px 14px;
    font-size: 0.84rem;
    border-radius: 20px;
    flex: 1 1 auto;
    min-width: 110px;
    max-width: 180px;
    justify-content: center;
  }

  .block-card {
    padding: 18px 14px 16px 14px;
    margin-bottom: 18px;
  }
  .block-bookmark-btn {
    right: 8px;
    top: 8px;
    width: 26px;
    height: 26px;
  }
  .block-card.has-admin-controls .block-bookmark-btn {
    top: 38px;
  }
  .block-bookmark-btn .bm-icon {
    font-size: 0.85rem;
  }
  .block-title {
    font-size: 1.2rem;
  }
  .block-body {
    font-size: 0.95rem;
  }

  /* Comentarios */
  .comments-section {
    padding: 0 12px;
    margin-bottom: 60px;
  }
  .comments-card {
    padding: 18px 14px;
  }
  .btn-submit-comment {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  .comment-form-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  /* Modales en móvil */
  .genrupto-modal {
    max-height: 94vh;
    border-radius: 12px;
  }
  .modal-body {
    padding: 16px;
    gap: 12px;
  }
  .block-type-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  .styling-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .pencil-fab {
    width: 48px;
    height: 48px;
    bottom: 20px;
    right: 20px;
  }
  .pencil-fab svg {
    width: 20px;
    height: 20px;
  }
  .admin-quick-menu {
    width: 200px;
    bottom: 60px;
  }
}

/* Modo vista previa para administrador */
body.preview-mode-user .block-admin-controls,
body.preview-mode-user .admin-tools-row,
body.preview-mode-user .block-drag-handle {
  display: none !important;
}
body.preview-mode-user .block-card.has-admin-controls .block-bookmark-btn {
  top: 12px !important;
}
body.preview-mode-user .block-card.hidden-block {
  display: none !important;
}
