/* ===== CONTENEDOR PRINCIPAL DEL STORY MAP ===== */
.story-map-container {
  padding-top: 0; /* Sin padding ya que navbar está oculto */
  height: 100vh;
  overflow: hidden;
}

/* ===== PANTALLA INICIAL (PORTADA) ===== */
.story-intro {
  height: calc(100vh - 55px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: linear-gradient(
    135deg,
    var(--color-primary-light, rgba(37, 99, 235, 0.05)) 0%,
    var(--color-bg-white) 100%
  );
}

.story-intro-title {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  color: var(--color-title-purple);
  animation: fadeInUp 0.8s ease;
}

.story-intro-summary {
  font-size: 1.25rem;
  color: var(--color-text-gray);
  max-width: 700px;
  margin-bottom: 2rem;
  line-height: 1.8;
  animation: fadeInUp 0.8s ease 0.2s both;
}

.story-intro-map {
  width: 100%;
  max-width: 600px;
  height: 400px;
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px var(--color-shadow-lg);
  animation: fadeInUp 0.8s ease 0.4s both;
  position: relative;
}

.btn-start {
  padding: 1rem 3rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-bg-white);
  background: var(--color-btn-primary);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(162, 26, 92, 0.3);
  animation: fadeInUp 0.8s ease 0.6s both;
}

.btn-start:hover {
  background: var(--color-btn-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(162, 26, 92, 0.4);
}

/* ===== CONTENEDOR DE CAPÍTULOS (SCROLL SNAP) ===== */
.chapters-container {
  height: calc(100vh - 65px); /* viewport - timeline (navbar oculto) */
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

/* ===== CAPÍTULO INDIVIDUAL ===== */
.chapter {
  height: calc(100vh - 65px); /* viewport - timeline */
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  grid-template-columns: 70% 30%;
  grid-template-rows: auto 1fr 1fr;
  gap: 0.5rem;
  padding: 1rem;
  background-color: var(--color-bg-light);
}

/* ===== CAPÍTULO 2 - BIODIVERSIDAD (Layout especial con título completo) ===== */
.chapter-biodiversity {
  grid-template-columns: 70% 30%;
  grid-template-rows: auto 1fr 1fr;
  grid-template-areas:
    "map-title map-title"
    "chapter-map chapter-text"
    "chapter-map biodiversity-menu";
}

.chapter-biodiversity .map-title {
  grid-area: map-title;
}

.chapter-biodiversity .chapter-map {
  grid-area: chapter-map;
}

.chapter-biodiversity .chapter-text {
  grid-area: chapter-text;
}

.chapter-biodiversity .biodiversity-menu {
  grid-area: biodiversity-menu;
}

/* ===== TÍTULO DEL MAPA ===== */
.map-title {
  grid-column: 1 / -1; /* Ocupa todo el ancho (todas las columnas) */
  grid-row: 1;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-title-purple);
  margin: 0;
  padding: 1rem 1.5rem;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 10px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  text-align: center;
}

/* ===== MAPA (Ocupa 2 filas a la izquierda, debajo del título) ===== */
.chapter-map {
  grid-column: 1;
  grid-row: 2 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  position: relative;
}

.map-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ===== CONTROLES DE CAPAS (Panel derecho superior) ===== */
.map-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--color-bg-white);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 2px 10px var(--color-shadow-md);
  z-index: 100; /* ← Debajo de la toolbar de herramientas (z-index: 500) */
  max-width: 250px;
  transition: all 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

/* Estado colapsado del control de capas */
.map-controls.collapsed {
  padding: 0.5rem 1rem;
  max-height: none;
  overflow: visible;
}

.map-controls.collapsed .map-controls-content {
  display: none;
}

/* Controles de mapa específicos para subcapítulos de Capítulos 3 y 4 (Ganancia/Pérdida) - Vulnerabilidad */
[id^="chapter-3-"] .map-controls,
[id^="chapter-4-"] .map-controls {
  top: 4rem;
  right: 1rem;
  max-width: 300px;
  padding: 0.5rem;
}

/* Header del control de capas (título + botón toggle) */
.map-controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.map-controls.collapsed .map-controls-header {
  margin-bottom: 0;
}

.map-controls-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--color-text-dark);
}

/* Botón para colapsar/expandir */
.map-controls-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  color: var(--color-text-gray);
  transition: transform 0.3s ease;
  line-height: 1;
}

.map-controls-toggle:hover {
  color: var(--color-primary);
}

.map-controls.collapsed .map-controls-toggle {
  transform: rotate(180deg);
}

.layer-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 16px;
}

.layer-control input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--color-btn-secondary);
}

.layer-control label {
  cursor: pointer;
  color: var(--color-text-gray);
  user-select: none;
}

.layer-control:last-child {
  margin-bottom: 0;
}

/* Subtítulo de grupo de capas */
.layer-group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.layer-group-title:first-of-type {
  margin-top: 0;
}

/* ===== TOOLTIP DE HOVER EN MUNICIPIOS ===== */
.municipio-hover-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: var(--color-bg-white);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== PANEL DE LEYENDAS (inferior izquierda) ===== */
.map-legends {
  position: absolute;
  bottom: 0rem;
  left: 0rem;
  background: var(--color-bg-white);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 2px 10px var(--color-shadow-md);
  z-index: 100;
  max-width: 300px;
  max-height: 50vh;
  overflow-y: auto;
  transition: all 0.3s ease;
}

/* Estado colapsado del panel de leyendas */
.map-legends.collapsed {
  padding: 0.5rem 1rem;
  max-height: none;
  overflow: visible;
}

.map-legends.collapsed .map-legends-content {
  display: none;
}

/* Header del panel de leyendas (título + botón toggle) */
.map-legends-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.map-legends.collapsed .map-legends-header {
  margin-bottom: 0;
}

.map-legends-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--color-text-dark);
}

/* Botón para colapsar/expandir leyendas */
.map-legends-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  color: var(--color-text-gray);
  transition: transform 0.3s ease;
  line-height: 1;
}

.map-legends-toggle:hover {
  color: var(--color-primary);
}

.map-legends.collapsed .map-legends-toggle {
  transform: rotate(180deg);
}

/* Contenedor de las leyendas individuales */
.map-legends-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Item individual de leyenda */
.legend-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.legend-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.legend-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: 0.25rem;
}

.legend-item-image {
  width: 160px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  background: var(--color-bg-white);
}

/* Leyenda manual generada desde SLD */
.legend-simbologia {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.legend-categoria {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-simbolo {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  font-size: 0.9rem;
  color: var(--color-text-dark);
}

/* Mensaje cuando no hay leyendas */
.map-legends-empty {
  font-size: 0.95rem;
  color: var(--color-text-gray);
  font-style: italic;
  text-align: center;
  padding: 0.5rem;
}

/* ===== CAPÍTULO 2 - LAYOUT ANALYTICS (30% texto, 70% gráficas) ===== */
.chapter-analytics {
  grid-template-columns: 30% 70%;
  grid-template-rows: auto 1fr 1fr;
  grid-template-areas:
    "map-title map-title"
    "analytics-text analytics-chart-1"
    "analytics-text analytics-chart-2";
}

.analytics-text {
  grid-area: analytics-text;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  overflow-y: auto;
}

.analytics-chart-1 {
  grid-area: analytics-chart-1;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  display: flex;
  flex-direction: column;
}

.analytics-chart-2 {
  grid-area: analytics-chart-2;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: 0.75rem;
  text-align: center;
}

.analytics-chart-1 .chart-container,
.analytics-chart-2 .chart-container {
  flex: 1;
  position: relative;
  min-height: 0;
}

/* ===== CARD DE TEXTO (Arriba derecha) ===== */
.chapter-text {
  grid-column: 2;
  grid-row: 2;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  overflow-y: auto;
  transition: all var(--transition-normal);
}

/* ===== CAPÍTULO CON TEXTO COMPLETO (sin card inferior) ===== */
.chapter-full-text .chapter-text {
  grid-row: 2 / 4;
}

/* ===== CAPÍTULO 1 - LAYOUT ESPECIAL ===== */
/* En el Capítulo 1, el texto se expande a 2 filas */
/* #chapter-1 .chapter-text {
  grid-row: 2 / 4;
} */

/* ===== TODOS LOS CAPÍTULOS Y SUBCAPÍTULOS - TAMAÑO DE LETRA 16px ===== */
.chapter .chapter-content,
.chapter .chapter-content p,
.chapter .chapter-content li,
.chapter .chapter-title,
.chapter .info-content,
.chapter .info-content p,
.chapter .chart-info-title,
.chapter .text-content,
.chapter .text-content p,
.chapter .text-title {
  font-size: 16px;
}

.chapter-text:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

.chapter-number {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-btn-secondary);
  background-color: rgba(88, 37, 116, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}

.chapter-title {
  font-size: 1.2rem;
  margin-bottom: 0rem;
  color: var(--color-title-purple);
  line-height: 1.3;
}

.chapter-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text-gray);
}

.chapter-content p {
  margin-bottom: 0.4rem;
}

.chapter-content p:last-child {
  margin-bottom: 0;
}

/* ===== CARD DE GRÁFICO (Abajo derecha) ===== */
.chapter-chart {
  grid-column: 2;
  grid-row: 2;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.chapter-chart:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

/* ===== CARD DE INFORMACIÓN (Para capítulos sin gráfico) ===== */
.chapter-info {
  grid-column: 2;
  grid-row: 3;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  transition: all var(--transition-normal);
  overflow-y: auto;
}

.chapter-info:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

.chapter-info .info-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-title-purple);
}

.chapter-info .info-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text-gray);
}

.chapter-info .info-content p {
  margin-bottom: 1rem;
}

.chapter-info .info-content p:last-child {
  margin-bottom: 0;
}

/* ===== MENÚ DE BIODIVERSIDAD (Capítulo 2) ===== */
.biodiversity-menu {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  overflow-y: auto;
}

.menu-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-title-purple);
  text-align: center;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.5rem;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 0.4rem;
  background: linear-gradient(
    135deg,
    rgba(88, 37, 116, 0.05) 0%,
    rgba(162, 26, 92, 0.05) 100%
  );
  border: 2px solid var(--color-beige-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  min-height: 65px;
}

.menu-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--color-shadow-lg);
  border-color: var(--color-btn-secondary);
  background: linear-gradient(
    135deg,
    rgba(88, 37, 116, 0.1) 0%,
    rgba(162, 26, 92, 0.1) 100%
  );
}

.menu-card-icon {
  font-size: 1.5rem;
}

.menu-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-dark);
  text-align: center;
  line-height: 1.2;
}

/* ===== SUB-CAPÍTULOS DE BIODIVERSIDAD (Layout 30%-70%) ===== */
.subchapter-biodiversity {
  grid-template-columns: 30% 70%;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "subchapter-title subchapter-menu"
    "subchapter-text subchapter-map";
}

.subchapter-biodiversity .subchapter-title {
  grid-area: subchapter-title;
}

.subchapter-biodiversity .subchapter-text {
  grid-area: subchapter-text;
}

.subchapter-biodiversity .subchapter-menu {
  grid-area: subchapter-menu;
}

.subchapter-biodiversity .subchapter-map {
  grid-area: subchapter-map;
}

/* Título del sub-capítulo (30% izquierda arriba) */
.subchapter-title {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 2px 10px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.subchapter-title h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-title-purple);
  margin: 0;
}

/* Card de texto del sub-capítulo (30% izquierda abajo) */
.subchapter-text {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  overflow-y: auto;
  transition: all var(--transition-normal);
}

.subchapter-text:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

.subchapter-text .text-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-title-purple);
}

.subchapter-text .text-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text-gray);
}

.subchapter-text .text-content p {
  margin-bottom: 1rem;
}

.subchapter-text .text-content p:last-child {
  margin-bottom: 0;
}

/* Submenú de Modelos Climáticos */
.models-menu {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.models-menu-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-title-purple);
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-beige);
}

.models-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.model-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-background);
  border: 1px solid var(--color-beige-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
  font-size: 0.95rem;
}

.model-item:hover {
  background: var(--color-beige-light);
  border-color: var(--color-accent-magenta);
  transform: translateX(5px);
}

.model-item.active {
  background: var(--color-accent-magenta);
  color: var(--color-bg-white);
  border-color: var(--color-accent-magenta);
  font-weight: 600;
}

.model-item.active .model-icon {
  filter: brightness(0) invert(1);
}

/* Texto animado de instrucción para seleccionar modelo */
.models-hint {
  font-size: 0.9rem;
  color: var(--color-accent-magenta);
  text-align: center;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  animation: pulse-hint 2s ease-in-out infinite;
}

@keyframes pulse-hint {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

.model-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.model-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menú horizontal de navegación (70% derecha arriba) */
.subchapter-menu {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 0.6rem;
  box-shadow: 0 2px 10px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
}

.back-button {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  background: var(--color-btn-secondary);
  color: var(--color-bg-white);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
  white-space: nowrap;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.back-button:hover {
  background: var(--color-btn-primary-hover);
  transform: translateX(-3px);
}

.menu-divider {
  width: 2px;
  height: 30px;
  background: var(--color-beige);
  flex-shrink: 0;
}

.subchapter-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.3rem;
  flex: 1;
}

.nav-item {
  padding: 0.4rem 0.5rem;
  background: var(--color-bg-gray);
  border: 1px solid var(--color-beige-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-gray);
  text-align: center;
  line-height: 1.2;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item:hover {
  background: rgba(88, 37, 116, 0.1);
  border-color: var(--color-btn-secondary);
  color: var(--color-btn-secondary);
}

.nav-item.active {
  background: var(--color-btn-secondary);
  color: var(--color-bg-white);
  border-color: var(--color-btn-secondary);
}

/* Mapa del sub-capítulo (70% derecha abajo) */
.subchapter-map {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 15px var(--color-shadow-md);
  position: relative;
}

.subchapter-map .map-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ===== CARD COMBINADA DE GRÁFICO E INFO (Capítulo 1) ===== */
/* ===== CARD COMBINADA DE GRÁFICO E INFO (Capítulo 1) ===== */
.chapter-chart-info {
  grid-column: 2;
  grid-row: 3;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chapter-chart-info:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

/* Título único de la card combinada */
.chart-info-title {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 0.5rem 1rem 0.5rem 1rem;
  margin: 0;
  color: var(--color-title-purple);
  /*border-bottom: 1px solid var(--color-beige-light);*/
}

/* Contenedor del contenido (gráfico + info) */
.chart-info-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

/* Sección del gráfico (izquierda) */
.chart-section {
  /*padding: 1.5rem;*/
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-height: 100%;
  padding: 0.5rem;
}

/* Sección de información (derecha) */
.info-section {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /*border-left: 1px solid var(--color-beige-light);*/
}

.info-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-gray);
}

.info-content p {
  margin-bottom: 1rem;
}

.info-content p:last-child {
  margin-bottom: 0;
}

.info-content strong {
  color: var(--color-text-dark);
  font-weight: 600;
}

.chart-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-title-purple);
}

.chart-container {
  position: relative;
  width: 100%;
  max-width: 350px;
  max-height: 350px;
  margin: 0 auto;
}

.chart-container canvas {
  max-height: 100%;
  max-width: 100%;
}

/* ===== CAPÍTULO 3 - TEXTO EXPANDIDO ===== */
#chapter-3 .chapter-text {
  grid-row: 2;
}

/* ===== CAPÍTULO 4 - MAPA COMO IMAGEN Y TEXTO EXPANDIDO ===== */
#chapter-4 .chapter-text {
  grid-row: 2;
}

.chapter-map-image {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  transition: all var(--transition-normal);
}

.chapter-map-image:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

.map-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===== CURSORES PERSONALIZADOS PARA SUB-CAPÍTULOS DE BIODIVERSIDAD ===== */
#chapter-2-1 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🐝</text></svg>'),
    auto;
}

#chapter-2-2 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🌵</text></svg>'),
    auto;
}

#chapter-2-3 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🍄</text></svg>'),
    auto;
}

#chapter-2-4 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🦋</text></svg>'),
    auto;
}

#chapter-2-5 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🦇</text></svg>'),
    auto;
}

#chapter-2-6 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">⭐</text></svg>'),
    auto;
}

#chapter-2-7 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">⚠️</text></svg>'),
    auto;
}

#chapter-2-8 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🧬</text></svg>'),
    auto;
}

#chapter-2-9 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">📊</text></svg>'),
    auto;
}

/* ===== CURSORES PERSONALIZADOS PARA SUB-CAPÍTULOS DEL CAPÍTULO 3 (GANANCIA) ===== */
#chapter-3-1 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🐝</text></svg>'),
    auto;
}

#chapter-3-2 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🌵</text></svg>'),
    auto;
}

#chapter-3-3 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🍄</text></svg>'),
    auto;
}

#chapter-3-4 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🦋</text></svg>'),
    auto;
}

#chapter-3-5 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🦇</text></svg>'),
    auto;
}

#chapter-3-6 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">⭐</text></svg>'),
    auto;
}

#chapter-3-7 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">⚠️</text></svg>'),
    auto;
}

#chapter-3-8 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🧬</text></svg>'),
    auto;
}

/* ===== CURSORES PERSONALIZADOS PARA SUB-CAPÍTULOS DEL CAPÍTULO 4 (PÉRDIDA) ===== */
#chapter-4-1 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🐝</text></svg>'),
    auto;
}

#chapter-4-2 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🌵</text></svg>'),
    auto;
}

#chapter-4-3 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🍄</text></svg>'),
    auto;
}

#chapter-4-4 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🦋</text></svg>'),
    auto;
}

#chapter-4-5 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🦇</text></svg>'),
    auto;
}

#chapter-4-6 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">⭐</text></svg>'),
    auto;
}

#chapter-4-7 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">⚠️</text></svg>'),
    auto;
}

#chapter-4-8 {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 32 32"><text y="20" font-size="20">🧬</text></svg>'),
    auto;
}

/* ===== SUB-CAPÍTULO 2.9: COMPARATIVA GENERAL (Layout especial sin gap) ===== */
#chapter-2-9.subchapter-biodiversity {
  gap: 10;
}

#chapter-2-9 .subchapter-text {
  grid-area: subchapter-text;
}

#chapter-2-9 .subchapter-menu {
  grid-area: subchapter-menu;
  margin-bottom: 0;
}

#chapter-2-9 .chapter-chart {
  grid-area: subchapter-map;
  grid-row: 2;
  margin-top: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#chapter-2-9 .chart-container {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chapter-2-9 .chart-container img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

/* ===== TIMELINE INFERIOR ===== */
.timeline {
  position: fixed;
  bottom: 5px;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--color-header-bg);
  backdrop-filter: blur(10px);
  box-shadow: 0 -2px 10px var(--color-shadow-md);
  border-top: 2px solid var(--color-beige);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
  z-index: 999;
}

.timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.timeline-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--color-bg-gray);
  border: 3px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--color-text-gray);
  transition: all var(--transition-normal);
}

.timeline-circle:hover {
  transform: scale(1.15);
}

.timeline-item.active .timeline-circle {
  background-color: var(--color-accent-magenta);
  border: 4px solid var(--color-gold);
  color: var(--color-bg-white);
  transform: scale(1.3);
  box-shadow:
    0 0 0 4px rgba(198, 168, 106, 0.4),
    0 0 20px rgba(198, 168, 106, 0.6);
}

.timeline-label {
  font-size: 1rem;
  color: var(--color-bg-white);
  font-weight: 100;
  transition: all var(--transition-normal);
  text-align: center;
}

.timeline-item.active .timeline-label {
  color: var(--color-gold);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(198, 168, 106, 0.5);
}

/* Línea conectora entre círculos */
.timeline::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 200px);
  max-width: 600px;
  height: 2px;
  background-color: var(--color-border);
  z-index: -1;
}

/* ===== BOTONES DE NAVEGACIÓN ===== */
.nav-buttons {
  position: fixed;
  bottom: 15px;
  z-index: 500;
  display: flex;
  gap: 1rem;
}

.nav-buttons.left {
  left: 1rem;
}

.nav-buttons.right {
  right: 1rem;
}

.nav-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--color-bg-white);
  border: 2px solid var(--color-btn-secondary);
  box-shadow: 0 4px 15px var(--color-shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--color-btn-secondary);
  transition: all var(--transition-normal);
}

.nav-btn:hover {
  background-color: var(--color-btn-secondary);
  color: var(--color-bg-white);
  transform: scale(1.1);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: scale(1);
}

.nav-btn:disabled:hover {
  background-color: var(--color-bg-white);
  color: var(--color-btn-secondary);
}

/* ===== ANIMACIONES ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== RESPONSIVE - TABLET ===== */
@media (max-width: 968px) {
  .chapter {
    grid-template-columns: 55% 45%;
    gap: 1rem;
    padding: 1rem;
  }

  .chapter-text,
  .chapter-chart {
    padding: 1.5rem;
  }

  .chapter-title {
    font-size: 1.5rem;
  }

  .story-intro-title {
    font-size: 2.5rem;
  }

  .map-controls {
    max-width: 220px;
    padding: 0.85rem;
  }

  /* Ajustar tamaño del gráfico en tablet */
  .chart-container {
    max-width: 280px;
    max-height: 280px;
  }
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 768px) {
  .chapter {
    grid-template-columns: 1fr;
    grid-template-rows: auto 50vh auto auto;
    gap: 1rem;
    padding: 1rem;
    height: auto;
    min-height: calc(100vh - 55px - 60px);
  }

  .map-title {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.25rem;
    padding: 0.75rem 1rem;
  }

  .chapter-map {
    grid-column: 1;
    grid-row: 2;
    height: 50vh;
  }

  .chapter-text {
    grid-column: 1;
    grid-row: 3;
  }

  .chapter-chart {
    grid-column: 1;
    grid-row: 4;
    min-height: 300px;
  }

  .chapter-info {
    grid-column: 1;
    grid-row: 4;
    min-height: 200px;
  }

  /* Capítulo 1 - Layout especial en mobile */
  /* Capítulo 1 - Layout en mobile */
  .chapter-chart-info {
    grid-column: 1;
    grid-row: 4;
    min-height: 500px;
  }

  .chart-info-content {
    grid-template-columns: 1fr; /* Una sola columna en mobile */
    grid-template-rows: auto auto;
  }

  .chart-section {
    border-bottom: 1px solid var(--color-beige-light);
    min-height: 250px;
    padding: 1rem;
  }

  /* Ajustar tamaño del gráfico en mobile */
  .chart-container {
    max-width: 100%;
    max-height: 220px;
  }

  .info-section {
    min-height: 200px;
    border-left: none;
    border-top: 1px solid var(--color-beige-light);
  }

  .map-controls {
    max-width: 180px;
    padding: 0.75rem;
    font-size: 0.8rem;
  }

  .map-controls-title {
    font-size: 0.85rem;
  }

  .layer-control {
    font-size: 0.8rem;
  }

  .story-intro-title {
    font-size: 2rem;
  }

  .story-intro-summary {
    font-size: 1rem;
  }

  .story-intro-map {
    height: 300px;
  }

  .timeline {
    padding: 0 1rem;
    gap: 1rem;
  }

  .timeline-circle {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }

  .timeline-label {
    font-size: 0.7rem;
  }

  .nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .nav-buttons.left {
    left: 0.5rem;
  }

  .nav-buttons.right {
    right: 0.5rem;
  }
}

/* ===== SCROLLBAR PERSONALIZADO PARA CAPÍTULOS ===== */
.chapters-container::-webkit-scrollbar {
  width: 8px;
}

.chapters-container::-webkit-scrollbar-track {
  background: var(--color-bg-gray);
}

.chapters-container::-webkit-scrollbar-thumb {
  background: var(--color-text-light);
  border-radius: 4px;
}

.chapters-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-btn-secondary);
}

/* ===== SCROLLBAR PARA TEXTO DEL CAPÍTULO ===== */
.chapter-text::-webkit-scrollbar {
  width: 6px;
}

.chapter-text::-webkit-scrollbar-track {
  background: transparent;
}

.chapter-text::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.chapter-text::-webkit-scrollbar-thumb:hover {
  background: var(--color-btn-secondary);
}

/* ===== COMPATIBILIDAD CON HERRAMIENTAS DEL MAPA ===== */

/* Asegurar que la toolbar de herramientas no tape los controles de capas */
.chapter-map .map-toolbar {
  top: 10px;
  left: 10px;
}

/* Mantener controles de capas siempre en top-right */
.chapter-map .map-controls {
  top: 0rem;
  right: 0rem;
  left: auto;
}

/* ===== ESTADOS DE LOADING ===== */
.chapter-map.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* ===== CAPÍTULO 1 DE RIESGO - LAYOUT INVERTIDO (30% texto izquierda, 70% mapa derecha) ===== */
#risk-chapter-1 {
  grid-template-columns: 30% 70%;
  grid-template-rows: auto 1fr;
}

#risk-chapter-1 .chapter-text {
  grid-column: 1;
  grid-row: 2;
}

#risk-chapter-1 .chapter-map {
  grid-column: 2;
  grid-row: 2;
}

/* Botón Atlas de Riesgo */
.btn-atlas {
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-bg-white);
  background: var(--color-btn-primary);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(162, 26, 92, 0.3);
  width: 100%;
}

.btn-atlas:hover {
  background: var(--color-btn-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(162, 26, 92, 0.4);
}

/* ===== CAPÍTULO 2 DE RIESGO - LAYOUT 50%-50% ===== */
#risk-chapter-2 {
  grid-template-columns: 50% 50%;
  grid-template-rows: auto 1fr;
}

#risk-chapter-2 .map-title {
  grid-column: 1 / -1;
  grid-row: 1;
}

/* Contenedor izquierdo (50%) - texto arriba, imagen abajo */
.chapter-left {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chapter-left .chapter-text {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 50%;
  overflow-y: auto;
}

.chapter-left .chapter-chart-image {
  flex: 1 1 auto;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all var(--transition-normal);
  min-height: 0;
}

.chapter-left .chapter-chart-image:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

.chapter-left .chapter-chart-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 100%;
}

/* Contenedor derecho (50%) - imagen altura completa */
.chapter-right {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chapter-image-full {
  width: 100%;
  height: 100%;
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 15px var(--color-shadow-md);
  border: 1px solid var(--color-beige-light);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all var(--transition-normal);
  min-height: 0;
}

.chapter-image-full:hover {
  box-shadow: 0 8px 25px var(--color-shadow-lg);
  border-color: var(--color-beige);
}

.chapter-image-full img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 100%;
  max-width: 100%;
}

/* Lista de eventos con emojis */
.events-list {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0;
}

.events-list li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* ===== PRINT STYLES ===== */
@media print {
  .story-intro,
  .timeline,
  .nav-buttons,
  .map-toolbar,
  .layer-swipe-container {
    display: none !important;
  }

  .chapters-container {
    height: auto;
    overflow: visible;
  }

  .chapter {
    height: auto;
    page-break-inside: avoid;
    page-break-after: always;
  }
}

/* ===== CONTROL DE COMPARACIÓN DE CAPAS ===== */
.comparison-control {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
}

.comparison-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-white);
  border: 2px solid var(--color-btn-secondary);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow-md);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-btn-secondary);
  transition: all var(--transition-fast);
}

.comparison-toggle-btn:hover {
  background: var(--color-btn-secondary);
  color: var(--color-bg-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--color-shadow-lg);
}

.comparison-toggle-btn.active {
  background: var(--color-accent-magenta);
  border-color: var(--color-accent-magenta);
  color: var(--color-bg-white);
}

.comparison-icon {
  font-size: 1.2rem;
}

.comparison-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--color-bg-white);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px var(--color-shadow-lg);
  overflow: hidden;
  min-width: 200px;
}

.comparison-mode-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-bg-white);
  border: none;
  border-bottom: 1px solid var(--color-beige-light);
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
  transition: all var(--transition-fast);
}

.comparison-mode-btn:last-child {
  border-bottom: none;
}

.comparison-mode-btn:hover {
  background: var(--color-beige-light);
}

.comparison-mode-btn.comparison-mode-close {
  color: var(--color-pink-error);
  font-weight: 600;
}

.comparison-mode-btn.comparison-mode-close:hover {
  background: var(--color-pink-error-bg);
}

.mode-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.mode-label {
  flex: 1;
}

/* ===== MODO SPLIT ===== */
.comparison-split-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-bg-white);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  cursor: ew-resize;
  z-index: 999;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.comparison-split-bar::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 60px;
  background: var(--color-bg-white);
  border-radius: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.comparison-split-bar::after {
  content: "⇄";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-btn-secondary);
  font-size: 1.5rem;
  font-weight: bold;
}

/* Etiquetas de capas en modo Split */
.comparison-split-label {
  position: absolute;
  bottom: 10px;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.75);
  color: var(--color-bg-white);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 998;
  pointer-events: none;
  backdrop-filter: blur(4px);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comparison-split-label-left {
  left: 10px;
}

.comparison-split-label-right {
  right: 10px;
}

/* ===== MODO RAYOS X ===== */
.comparison-xray-circle {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 3px solid var(--color-bg-white);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 998;
  background: radial-gradient(circle, transparent 60%, rgba(0, 0, 0, 0.2) 100%);
}

.comparison-xray-circle::before {
  content: "👁️";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .comparison-control {
    top: 5px;
    right: 5px;
  }

  .comparison-toggle-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .comparison-label {
    display: none;
  }

  .comparison-menu {
    min-width: 180px;
  }

  .comparison-split-bar {
    width: 3px;
  }

  .comparison-xray-circle {
    width: 150px;
    height: 150px;
  }

  .comparison-split-label {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    max-width: 150px;
  }
}

/* ========================================== */
/* ===== AMENAZAS - ESTILOS ESPECÍFICOS ===== */
/* ========================================== */

/* Capítulo 3 de Amenazas - Card de texto ocupa toda la altura */
#chapter-3.amenazas-chapter-3 .chapter-text.amenazas-chapter-text {
  grid-row: 2 / 4 !important;
}
