/* ==========================================================================
   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;
}

@font-face {
  font-family: "Yellow Banana";
  src: url("YellowBanana.otf") format("opentype"),
       url("Yellow%20Banana.otf") format("opentype");
  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-banana: "Yellow Banana", "Gummy Bear", 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;
  color: inherit;
  font: inherit;
  text-align: left;
  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;
}

/* 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;
}

/* SOLO EN PC (min-width: 821px):
   Degradado leve en los bordes izquierdo y derecho directamente sobre la imagen
   para que se funda suavemente con el fondo y no se note el corte rectangular ni bloques oscuros */
@media (min-width: 821px) {
  .cover-image {
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0%,
      black 5%,
      black 95%,
      transparent 100%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0%,
      black 5%,
      black 95%,
      transparent 100%
    );
  }
}

.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="banana"], body[data-font="yellow_banana"], .font-banana, .font-yellow_banana {
  font-family: var(--font-banana);
}
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;
}

.credits-text a {
  color: var(--accent-magenta);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.credits-text a:hover {
  color: #FFAAD9;
  text-shadow: 0 0 8px rgba(197, 83, 148, 0.6);
}

.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;
}

.lab-floating-link {
  position: fixed;
  left: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 99999;
  display: block;
  line-height: 0;
}

.lab-floating-link img {
  display: block;
  width: 64px;
  height: auto;
  filter: drop-shadow(0 3px 8px rgba(108, 220, 129, 0.3));
  transform-origin: center;
  animation: lab-slime-float 3.4s ease-in-out infinite;
  transition: filter 0.2s ease;
}

.lab-floating-link:hover img,
.lab-floating-link:focus-visible img {
  filter: drop-shadow(0 4px 11px rgba(108, 220, 129, 0.48));
  animation-play-state: paused;
}

@keyframes lab-slime-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lab-floating-link img {
    animation: none;
  }
}

@media (min-width: 821px) and (max-width: 912px) {
  .lab-floating-link img {
    width: 46px;
  }
}

.account-setting-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.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) {
  .lab-floating-link img {
    width: 32px;
  }

  .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;
}

/* ==========================================================================
   EXPORTACIÓN A PDF (IMPRESIÓN) EXCLUSIVA PARA GENADMIN
   ========================================================================== */
@media print {
  /* Configuración de página */
  @page {
    margin: 1.5cm;
    size: auto;
  }

  /* Ocultar barra superior, volver a nerume, cuenta/login */
  .genrupto-header,
  .btn-back-nerume,
  .header-left,
  .header-right,
  #user-header-area,
  .badge-genadmin,
  .btn-login,
  .user-pill {
    display: none !important;
  }

  /* Ocultar comentarios, formulario de comentarios y llamada a login */
  .comments-section,
  #comments-section,
  .comment-form,
  .comment-login-invite,
  .comments-feed {
    display: none !important;
  }

  /* Ocultar controles de interfaz, edición, marcapáginas, likes, botones interactivos y modales */
  .genadmin-floating-panel,
  .lab-floating-link,
  #account-settings-modal,
  #genadmin-tools,
  .pencil-fab,
  .admin-quick-menu,
  .block-admin-controls,
  .block-bookmark-btn,
  .btn-edit-credits-inline,
  .book-actions-bar,
  .genrupto-modal-overlay,
  .toast-notification,
  .is-hidden-draft {
    display: none !important;
  }

  /* Asegurar que el fondo y contenido del libro se visualice limpio */
  html, body {
    background: #140E1B !important;
    background-image: none !important;
    color: #F3EDF8 !important;
    min-height: auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .genrupto-main {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .cover-showcase {
    page-break-after: always;
    break-after: page;
    margin-bottom: 2rem !important;
  }

  .cover-fade-bottom {
    display: none !important;
  }

  .block-card {
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .block-dialogue {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Si hay audios o videos en la web, evitar controles rotos en la hoja */
  audio, video {
    display: none !important;
  }
}

/* ==========================================================================
   EXPORTADOR DE LIBRO Y GESTOR DE BLOQUES (SUDO / GENADMIN)
   ========================================================================== */

/* Modales amplios */
.genrupto-modal.modal-itchio {
  max-width: 980px;
  width: 95vw;
}

.genrupto-modal.modal-blocks-io {
  max-width: 660px;
  width: 95vw;
}

.modal-head-title-group h3 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-head-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* Toolbar superior del exportador */
.itchio-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(18, 12, 24, 0.7);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
}

.itchio-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-accent {
  background: linear-gradient(135deg, var(--accent-magenta), var(--accent-purple));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

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

.itchio-quick-options {
  display: flex;
  align-items: center;
  gap: 16px;
}

.itchio-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-normal);
  cursor: pointer;
  user-select: none;
}

.itchio-toggle-label input[type="checkbox"] {
  accent-color: var(--accent-magenta);
  width: 16px;
  height: 16px;
}

/* Layout principal del exportador */
.itchio-main-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .itchio-main-layout {
    grid-template-columns: 1fr;
  }
}

/* Panel de previsualización celular */
.itchio-preview-pane {
  background: rgba(12, 8, 18, 0.6);
  border: 1px solid rgba(155, 113, 207, 0.2);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.itchio-nav-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  gap: 12px;
}

.itchio-nav-btn {
  background: var(--bg-card);
  color: var(--text-normal);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.itchio-nav-btn:hover:not(:disabled) {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-magenta);
}

.itchio-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.itchio-page-indicator {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 6px;
}

.itchio-page-total {
  font-weight: normal;
  color: var(--text-muted);
}

/* Simulador de Celular */
.itchio-phone-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 6px 0;
}

.itchio-phone-bezel {
  box-sizing: content-box;
  width: 310px;
  height: 551px; /* Proporción 9:16 exacta para escala visual */
  background: #000;
  border: 10px solid #281B38;
  border-radius: 36px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9), 0 0 0 2px rgba(197, 83, 148, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.itchio-phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 16px;
  background: #281B38;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 10;
}

.itchio-phone-screen {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #140E1B;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.itchio-phone-screen .itchio-mobile-page {
  /* Escala la página original (414x736) para caber exactamente en el bezel de 310px de ancho */
  transform: scale(0.7488);
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}

.itchio-loading-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

/* Tiras de miniaturas */
.itchio-thumbs-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding: 8px 4px;
}

.itchio-thumb-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.itchio-thumb-btn:hover {
  background: rgba(197, 83, 148, 0.2);
  color: #fff;
}

.itchio-thumb-btn.active {
  background: var(--accent-magenta);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 10px rgba(197, 83, 148, 0.6);
}

/* Panel Lateral */
.itchio-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.itchio-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: 0.4px;
}

.itchio-smart-notice {
  display: flex;
  gap: 10px;
  background: rgba(155, 113, 207, 0.12);
  border: 1px solid rgba(155, 113, 207, 0.25);
  border-radius: 10px;
  padding: 10px;
}

.notice-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.notice-text strong {
  display: block;
  font-size: 0.85rem;
  color: var(--accent-magenta);
  margin-bottom: 2px;
}

.notice-text p {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Botones grandes de exportación */
.download-actions-card {
  gap: 12px;
}

.btn-export-action {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #fff;
  font-family: inherit;
}

.btn-export-action .btn-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.btn-export-action .btn-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-export-action .btn-text-group strong {
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.btn-export-action .btn-text-group span {
  font-size: 0.74rem;
  opacity: 0.85;
}

.btn-export-zip {
  background: linear-gradient(135deg, #6B3BA7, #8B44B8);
  box-shadow: 0 4px 14px rgba(107, 59, 167, 0.4);
}

.btn-export-zip:hover:not(:disabled) {
  background: linear-gradient(135deg, #7C45C2, #9C4FD0);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(107, 59, 167, 0.6);
}

.btn-export-pdf {
  background: linear-gradient(135deg, #C55394, #A83677);
  box-shadow: 0 4px 14px rgba(197, 83, 148, 0.4);
}

.btn-export-pdf:hover:not(:disabled) {
  background: linear-gradient(135deg, #D461A3, #B83F85);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(197, 83, 148, 0.6);
}

.btn-export-both {
  background: linear-gradient(135deg, #E6A23C, #C55394);
  box-shadow: 0 4px 14px rgba(230, 162, 60, 0.4);
}

.btn-export-both:hover:not(:disabled) {
  background: linear-gradient(135deg, #F0AF4C, #D461A3);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(230, 162, 60, 0.6);
}

.btn-export-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Barra de progreso de exportación */
.itchio-progress-card {
  background: rgba(10, 6, 14, 0.9);
  border: 1px solid var(--accent-magenta);
  border-radius: 12px;
  padding: 12px 14px;
}

.progress-label {
  font-size: 0.82rem;
  color: var(--text-normal);
  margin-bottom: 8px;
  font-weight: 600;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-magenta));
  border-radius: 4px;
  transition: width 0.25s ease;
}

/* ==========================================================================
   ESTILOS DE LA PÁGINA MÓVIL (414px x 736px)
   ========================================================================== */
.itchio-mobile-page {
  width: 414px;
  height: 736px;
  box-sizing: border-box;
  background: #140E1B;
  color: #E8DFF5;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  font-family: var(--font-gummy);
  -webkit-font-smoothing: antialiased;
}

.itchio-page-header {
  height: 38px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(155, 113, 207, 0.25);
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  box-sizing: border-box;
}

.itchio-page-hdr-title {
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--accent-magenta);
}

.itchio-page-hdr-chap {
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.itchio-page-body {
  height: 668px;
  max-height: 668px;
  flex: 1 1 668px;
  padding: 8px 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.itchio-page-footer {
  height: 30px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(155, 113, 207, 0.2);
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  box-sizing: border-box;
  margin-top: auto;
}

.itchio-page-ftr-brand {
  opacity: 0.75;
}

.itchio-page-ftr-num {
  font-weight: 700;
  color: var(--text-normal);
}

/* Bloques acoplados dentro de la página móvil */
.itchio-page-body .block-card {
  padding: 6px 10px;
  margin: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  font-size: 0.86rem;
  border-radius: 7px;
}

.itchio-page-body .block-title {
  font-size: 0.92rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.itchio-page-body .block-body {
  font-size: 0.85rem;
  line-height: 1.38;
  white-space: pre-line;
  word-wrap: break-word;
}

/* Diálogo compacto para móvil / exportación */
.itchio-page-body .block-dialogue {
  padding: 4px 8px;
}

.itchio-page-body .rpg-dialogue-wrapper {
  gap: 8px !important;
  align-items: flex-start !important;
}

.itchio-page-body .rpg-avatar-col {
  flex: 0 0 38px !important;
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
}

.itchio-page-body .rpg-avatar-frame {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 7px;
  box-shadow: 0 0 6px rgba(197, 83, 148, 0.25);
}

.itchio-page-body .rpg-avatar-placeholder {
  font-size: 1.05rem;
}

.itchio-page-body .rpg-speech-col {
  gap: 1px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.itchio-page-body .rpg-char-name {
  font-size: 0.72rem !important;
  padding: 1px 5px !important;
  border-radius: 4px;
  margin-bottom: 1px;
}

.itchio-page-body .rpg-dialogue-box {
  padding: 4px 8px !important;
  border-radius: 6px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
}

.itchio-page-body .rpg-dialogue-text {
  font-size: 0.84rem;
  line-height: 1.35 !important;
}

.itchio-page-body .rpg-dialogue-arrow {
  display: none !important;
}

.itchio-page-body .block-quote {
  padding: 6px 10px;
}

.itchio-page-body .block-media-container {
  margin-top: 4px;
}

.itchio-page-body .block-media-container img {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

/* Capítulo en página móvil */
.itchio-chapter-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(197, 83, 148, 0.15);
  border: 1px solid var(--accent-magenta);
  border-radius: 7px;
  margin: 2px 0;
}

.itchio-chapter-card .chapter-star {
  color: var(--accent-magenta);
  font-size: 0.95rem;
}

.itchio-chapter-card .chapter-title {
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  text-align: center;
  letter-spacing: 0.5px;
}

/* Portada de escala celular: imagen completa bien escalada y sin cortes */
.itchio-cover-page {
  width: 414px;
  height: 736px;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #140E1B;
  overflow: hidden;
  position: relative;
}

.itchio-cover-art-box {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
  background: transparent;
}

.itchio-cover-art-box picture {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

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

.itchio-cover-details {
  display: none !important;
}

.itchio-cover-badge {
  display: none !important;
}

/* Página de Créditos Final */
.itchio-credits-page {
  display: flex;
  flex-direction: column;
}

.itchio-credits-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  gap: 16px;
}

.itchio-credits-icon {
  font-size: 2.8rem;
}

.itchio-credits-heading {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--accent-magenta);
  letter-spacing: 1px;
}

.itchio-credits-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 18px 20px;
  width: 100%;
  box-sizing: border-box;
}

.itchio-credits-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-normal);
}

.itchio-credits-thankyou {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.itchio-credits-thankyou strong {
  color: #fff;
}

/* ==========================================================================
   MODAL DE EXPORTAR / IMPORTAR BLOQUES (JSON)
   ========================================================================== */
.io-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.io-section h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-bright);
}

.io-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.io-desc code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-purple);
}

.io-actions-row {
  margin-top: 6px;
}

.io-divider {
  border: none;
  border-top: 1px solid var(--bg-card-border);
  margin: 16px 0;
}

/* Zona de arrastre de archivo */
.import-dropzone {
  border: 2px dashed rgba(155, 113, 207, 0.4);
  border-radius: 12px;
  background: rgba(18, 12, 24, 0.5);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.import-dropzone:hover,
.import-dropzone.drag-over {
  border-color: var(--accent-magenta);
  background: rgba(197, 83, 148, 0.1);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropzone-icon {
  font-size: 2.2rem;
}

.dropzone-text {
  font-size: 0.9rem;
  color: var(--text-normal);
}

/* Vista previa de inspección de archivo importado */
.import-preview-box {
  background: rgba(15, 10, 20, 0.9);
  border: 1px solid var(--accent-purple);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.import-file-info {
  font-size: 0.9rem;
  color: var(--text-normal);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.import-stats-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-stat-chip {
  background: rgba(155, 113, 207, 0.15);
  border: 1px solid rgba(155, 113, 207, 0.3);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-bright);
}

.import-mode-radios {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-card);
  padding: 10px 14px;
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  accent-color: var(--accent-magenta);
  margin-top: 3px;
}

.radio-option div strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-normal);
}

.radio-option div small {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.import-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.btn-confirm-import {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  border: none;
  font-weight: 800;
}

.btn-confirm-import:hover {
  background: linear-gradient(135deg, #34D399, #10B981);
}

/* Escenarios ocultos para canvas y medición */
.itchio-render-stage {
  position: fixed;
  left: 0;
  top: 0;
  width: 414px;
  height: 736px;
  overflow: hidden;
  pointer-events: none;
  opacity: 1;
  z-index: -9999;
}

.itchio-measure-sandbox {
  position: fixed;
  left: 0;
  top: 0;
  width: 414px;
  height: 736px;
  visibility: hidden;
  pointer-events: none;
  z-index: -9999;
}
