/* =========================================================================
   CHOCOAVENTURA: EL CIRCUITO MÁGICO DEL CHOCOLATE
   Ciencias Sociales y Tecnología • 3er Grado de Primaria • Nodo Andino
   Estilos CSS Modernos y Adaptables
   ========================================================================= */

:root {
  --font-title: 'Fredoka', cursive, system-ui, sans-serif;
  --font-body: 'Quicksand', system-ui, -apple-system, sans-serif;

  /* Paleta Chocolatosa */
  --c-dark-chocolate: #2b1408;
  --c-milk-chocolate: #5a2e17;
  --c-rich-brown: #7b3f1d;
  --c-caramel: #c86d26;
  --c-golden: #f59e0b;
  --c-warm-gold: #fbbf24;
  --c-cream-light: #fffbeb;
  --c-cream-bg: #fdf6ec;
  --c-cream-card: #ffffff;
  
  /* Colores de las 4 Etapas del Circuito Curricular */
  --c-stage-agricola: #16a34a;    /* Verde Selva Cacao */
  --c-stage-transporte: #0284c7;  /* Azul Viaje y Barco */
  --c-stage-industrial: #b45309;  /* Caramelo Fábrica */
  --c-stage-comercial: #9333ea;   /* Violeta Tienda & Fiesta */

  --shadow-sm: 0 2px 8px rgba(43, 20, 8, 0.08);
  --shadow-md: 0 6px 18px rgba(43, 20, 8, 0.14);
  --shadow-lg: 0 12px 32px rgba(43, 20, 8, 0.22);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-full: 9999px;

  --transition-fast: 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--c-cream-bg);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(123, 63, 29, 0.07) 0%, transparent 40%),
    repeating-linear-gradient(45deg, rgba(90, 46, 23, 0.02) 0, rgba(90, 46, 23, 0.02) 1px, transparent 0, transparent 20px);
  color: var(--c-dark-chocolate);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Canvas Confeti */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99999;
}

/* =========================================================================
   1. HEADER SUPERIOR DIDÁCTICO
   ========================================================================= */
.choco-header-bar {
  background: linear-gradient(135deg, #381a0b 0%, #522713 100%);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-bounce);
}

.brand-badge:hover {
  transform: scale(1.02);
}

.brand-icon-circle {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.brand-texts h1 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fef3c7;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-texts span {
  font-size: 0.8rem;
  color: #fed7aa;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-ctrl {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-family: var(--font-title);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-ctrl:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-ctrl.active {
  background: var(--c-golden);
  color: #2b1408;
  border-color: #fef3c7;
  font-weight: 700;
}

/* =========================================================================
   2. BARRA DE NAVEGACIÓN DE MODOS (PESTAÑAS GRANDES PARA CHICOS)
   ========================================================================= */
.modes-nav-container {
  max-width: 1200px;
  width: 95%;
  margin: 1.25rem auto 0.75rem auto;
}

.modes-nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.mode-tab-btn {
  background: var(--c-cream-card);
  border: 3px solid #e7d5c4;
  border-radius: var(--radius-md);
  padding: 0.85rem 0.6rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-bounce);
  box-shadow: var(--shadow-sm);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.mode-tab-btn:hover {
  transform: translateY(-3px);
  border-color: var(--c-caramel);
  box-shadow: var(--shadow-md);
}

.mode-tab-btn.active {
  border-color: var(--c-milk-chocolate);
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  box-shadow: 0 8px 20px rgba(90, 46, 23, 0.25);
  transform: translateY(-4px) scale(1.02);
}

.mode-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--c-caramel), var(--c-golden));
}

.tab-emoji {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.tab-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-dark-chocolate);
}

.tab-subtitle {
  font-size: 0.75rem;
  color: #78350f;
  font-weight: 600;
}

/* =========================================================================
   3. BANNER DE TECLITA & LOCOMOTORA PEDAGÓGICA
   ========================================================================= */
.teclita-guide-bar {
  max-width: 1200px;
  width: 95%;
  margin: 0.5rem auto 1.25rem auto;
  background: linear-gradient(135deg, #fff8f0 0%, #ffedd5 100%);
  border: 2px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.teclita-mini-avatar {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  border: 3px solid var(--c-golden);
  background: #3b1d0e;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.teclita-guide-content {
  flex: 1;
}

.teclita-guide-content h2 {
  font-family: var(--font-title);
  font-size: 1.05rem;
  color: var(--c-rich-brown);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.teclita-speech-text {
  font-size: 0.95rem;
  color: #451a03;
  font-weight: 600;
}

.btn-speak-guide {
  background: var(--c-golden);
  color: var(--c-dark-chocolate);
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: transform var(--transition-bounce);
  white-space: nowrap;
}

.btn-speak-guide:hover {
  transform: scale(1.05);
  background: #f59e0b;
}

/* =========================================================================
   4. CONTENEDOR PRINCIPAL Y VISTAS
   ========================================================================= */
.main-stage {
  max-width: 1200px;
  width: 95%;
  margin: 0 auto 2.5rem auto;
  flex: 1;
}

.app-view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.app-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   VISTA 1: RECORRIDO DEL CIRCUITO PRODUCTIVO (8 ESTACIONES INTERACTIVAS)
   ========================================================================= */
.circuit-stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.station-card {
  background: var(--c-cream-card);
  border-radius: var(--radius-md);
  border: 3px solid #e2d2c1;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-bounce);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}

.station-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-caramel);
}

.station-card.active-step {
  border-color: var(--c-golden);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.3), var(--shadow-md);
}

.station-header-badge {
  padding: 0.4rem 0.85rem;
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}

/* Colores de Etapa Curricular */
.stage-agricola { background: var(--c-stage-agricola); }
.stage-transporte { background: var(--c-stage-transporte); }
.stage-industrial { background: var(--c-stage-industrial); }
.stage-comercial { background: var(--c-stage-comercial); }

.station-visual-box {
  height: 140px;
  background: linear-gradient(180deg, #fefaf4 0%, #f7ebe1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-bottom: 2px dashed #eedbc9;
}

.station-big-emoji {
  font-size: 4rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.12));
  transition: transform var(--transition-bounce);
}

.station-card:hover .station-big-emoji {
  transform: scale(1.15) rotate(5deg);
}

.station-content-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.station-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--c-dark-chocolate);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.station-desc {
  font-size: 0.88rem;
  color: #4a3427;
  font-weight: 500;
  margin-bottom: 0.85rem;
  flex: 1;
}

.station-interactive-hint {
  background: #fdf2e9;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  color: #9a3412;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Modal Detalle de la Estación */
.station-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(43, 20, 8, 0.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.station-modal-overlay.open {
  display: flex;
}

.station-modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 4px solid var(--c-caramel);
  box-shadow: var(--shadow-lg);
  animation: zoomIn 0.3s ease;
  position: relative;
}

@keyframes zoomIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header-banner {
  padding: 1.25rem 1.5rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-banner h3 {
  font-family: var(--font-title);
  font-size: 1.5rem;
}

.btn-close-modal {
  background: rgba(0,0,0,0.25);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.btn-close-modal:hover {
  transform: rotate(90deg);
  background: rgba(0,0,0,0.4);
}

.modal-body-content {
  padding: 1.5rem;
}

.modal-fun-fact {
  background: #fffbeb;
  border-left: 5px solid var(--c-golden);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
  color: #78350f;
  font-weight: 600;
}

.modal-interactive-action {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  margin-top: 1rem;
}

/* =========================================================================
   VISTA 2: EL GRAFICADOR DEL CIRCUITO (DIAGRAMADOR INTERACTIVO)
   ========================================================================= */
.grapher-tool-container {
  background: var(--c-cream-card);
  border: 3px solid #dfcfbe;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.grapher-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0e4d7;
}

.grapher-title-area h2 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  color: var(--c-dark-chocolate);
}

.grapher-title-area p {
  font-size: 0.88rem;
  color: #78350f;
  font-weight: 600;
}

.grapher-action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-graph-action {
  background: var(--c-milk-chocolate);
  color: #fff;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-title);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-graph-action:hover {
  transform: translateY(-2px);
  background: var(--c-rich-brown);
  box-shadow: var(--shadow-md);
}

.btn-graph-action.golden {
  background: linear-gradient(135deg, var(--c-golden), #d97706);
  color: #2b1408;
  font-weight: 700;
}

/* Selector del Tipo de Chocolate a Graficar */
.recipe-selector-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.recipe-chip {
  background: #fdfaf6;
  border: 2px solid #dfcfbe;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--c-dark-chocolate);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.recipe-chip:hover {
  border-color: var(--c-caramel);
}

.recipe-chip.selected {
  background: var(--c-dark-chocolate);
  color: #fffbeb;
  border-color: var(--c-golden);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Lienzo Gráfico / Diagrama de Flujo del Proceso */
.flowchart-canvas-wrapper {
  background: #ffffff;
  border: 3px solid #eedbc9;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  position: relative;
  min-height: 480px;
}

.flowchart-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 760px;
  position: relative;
}

/* 4 Carriles de las Macro-Etapas */
.flow-lane {
  background: #faf6f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 2px dashed #cbd5e1;
  position: relative;
}

.flow-lane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.flow-lane-badge {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.flow-nodes-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.flow-node {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all var(--transition-fast);
}

.flow-node:hover {
  transform: translateY(-2px);
  border-color: var(--c-golden);
  box-shadow: var(--shadow-md);
}

.flow-node-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
}

.flow-node-text h4 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--c-dark-chocolate);
  margin-bottom: 2px;
}

.flow-node-text p {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.3;
}

/* Conectores con Flechas Animadas */
.flow-connector-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-golden);
  font-size: 1.6rem;
  animation: pulseArrow 1.5s infinite;
}

@keyframes pulseArrow {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(4px); opacity: 1; color: var(--c-caramel); }
}

/* Tarjeta escolar con datos del alumno */
.student-stamp-box {
  margin-top: 1.5rem;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.student-inputs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.student-input-field {
  padding: 0.45rem 0.75rem;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  outline: none;
}

.student-input-field:focus {
  border-color: var(--c-golden);
}

/* =========================================================================
   VISTA 3: EL MINIJUEGO "TALLER DEL CHOCOLATERO"
   ========================================================================= */
.workshop-container {
  background: var(--c-cream-card);
  border: 3px solid #dfcfbe;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.workshop-progress-tracker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
  padding: 0 1rem;
}

.workshop-progress-line {
  position: absolute;
  top: 50%;
  left: 2rem;
  right: 2rem;
  height: 6px;
  background: #e2d2c1;
  transform: translateY(-50%);
  z-index: 1;
}

.workshop-progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--c-stage-agricola), var(--c-golden));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.workshop-step-dot {
  position: relative;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: #fff;
  border: 4px solid #e2d2c1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  color: #78350f;
  transition: all var(--transition-bounce);
}

.workshop-step-dot.active {
  border-color: var(--c-golden);
  background: var(--c-warm-gold);
  color: #2b1408;
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.workshop-step-dot.completed {
  border-color: var(--c-stage-agricola);
  background: #dcfce7;
  color: #166534;
}

/* Pantallas del Taller */
.workshop-stage-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.workshop-stage-panel.current {
  display: block;
}

.workshop-hero-title {
  text-align: center;
  font-family: var(--font-title);
  font-size: 1.45rem;
  color: var(--c-dark-chocolate);
  margin-bottom: 0.35rem;
}

.workshop-hero-sub {
  text-align: center;
  font-size: 0.95rem;
  color: #78350f;
  margin-bottom: 1.25rem;
  font-weight: 600;
}

/* TALLER RETO 1: EL ÁRBOL DE CACAO Y COSECHA */
.cacao-tree-game-area {
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 35%, #86efac 75%, #4ade80 100%);
  border: 4px solid #16a34a;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  min-height: 480px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.06);
}

.tree-canopy-bar {
  background: linear-gradient(135deg, #78350f, #451a03);
  color: #fef3c7;
  border: 3px solid #b45309;
  border-radius: var(--radius-full);
  padding: 0.5rem 1.25rem;
  font-family: var(--font-title);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  margin-bottom: 0.75rem;
  z-index: 5;
}

.harvest-counter-badge {
  background: #ffffff;
  border: 3px solid var(--c-golden);
  border-radius: var(--radius-full);
  padding: 0.5rem 1.25rem;
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--c-dark-chocolate);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  z-index: 20;
}

.cacao-pods-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  z-index: 10;
  max-width: 820px;
  margin: 0.5rem auto 1.5rem auto;
  width: 100%;
}

.cacao-pod-target {
  width: 110px;
  min-height: 168px;
  background: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.4rem 0.6rem 0.4rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.16);
  cursor: pointer;
  transition: all var(--transition-bounce);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  border: 3px solid #cbd5e1;
  animation: swayPod 3.5s ease-in-out infinite alternate;
}

.cacao-pod-target:nth-child(2n) {
  animation-duration: 4.2s;
  animation-delay: 0.4s;
}

.cacao-pod-target:nth-child(3n) {
  animation-duration: 3.2s;
  animation-delay: 0.8s;
}

@keyframes swayPod {
  0% { transform: rotate(-3deg); }
  100% { transform: rotate(3deg); }
}

.cacao-pod-target:hover {
  transform: scale(1.12) translateY(-6px) !important;
  box-shadow: 0 16px 32px rgba(0,0,0,0.25);
  border-color: var(--c-golden);
  z-index: 20;
}

.cacao-pod-target.green {
  border-color: #84cc16;
  background: linear-gradient(180deg, #ffffff 0%, #f7fee7 100%);
}

.cacao-pod-target.ripe-yellow {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #ffffff 0%, #fefce8 100%);
}

.cacao-pod-target.ripe-red {
  border-color: #ef4444;
  background: linear-gradient(180deg, #ffffff 0%, #fef2f2 100%);
}

.cacao-pod-target.ripe-orange {
  border-color: #f97316;
  background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
}

.cacao-pod-badge {
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-top: 4px;
  text-align: center;
  white-space: nowrap;
}

.badge-ripe {
  background: #16a34a;
  color: #ffffff;
}

.badge-unripe {
  background: #ca8a04;
  color: #ffffff;
}

.cacao-pod-target.harvested {
  opacity: 0;
  transform: scale(0.2) translateY(120px) !important;
  pointer-events: none;
}

.harvest-basket-box {
  background: #fff8f0;
  border: 3px solid #d97706;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 0.5rem;
  z-index: 10;
  max-width: 500px;
  width: 90%;
}

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

.basket-info {
  flex: 1;
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--c-dark-chocolate);
  display: flex;
  flex-direction: column;
}

.basket-info span {
  font-size: 0.8rem;
  color: #78350f;
  font-weight: 600;
}

.basket-collected-pods {
  display: flex;
  gap: 4px;
  font-size: 1.4rem;
}

/* TALLER RETO 2: EL HORNO TOSTADOR DE PRECISIÓN */
.roaster-interactive-area {
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
  border: 3px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.roaster-drum {
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, #78350f, #451a03);
  border-radius: var(--radius-full);
  border: 6px solid #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  box-shadow: 0 8px 24px rgba(69, 26, 3, 0.3);
  position: relative;
}

.roaster-drum.spinning {
  animation: spinDrum 2s linear infinite;
}

@keyframes spinDrum {
  100% { transform: rotate(360deg); }
}

.temp-gauge-wrapper {
  width: 100%;
  max-width: 450px;
}

.temp-bar-bg {
  height: 28px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  border: 2px solid #cbd5e1;
}

.temp-bar-indicator {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #38bdf8 0%, #10b981 40%, #eab308 65%, #ef4444 100%);
  transition: width 0.3s ease;
}

.temp-ideal-zone {
  position: absolute;
  top: 0;
  left: 50%;
  width: 30%;
  height: 100%;
  border-left: 2px dashed #166534;
  border-right: 2px dashed #166534;
  background: rgba(34, 197, 94, 0.25);
  pointer-events: none;
}

/* TALLER RETO 3: LABORATORIO DE RECETAS Y MEZCLADOR */
.mixer-lab-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .mixer-lab-area { grid-template-columns: 1fr; }
}

.ingredients-palette {
  background: #fdfaf6;
  border: 2px solid #e7d5c4;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.ingredients-palette h4 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--c-dark-chocolate);
}

.ingredient-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.ingredient-item {
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.ingredient-item:hover {
  border-color: var(--c-golden);
  transform: translateY(-2px);
}

.ingredient-item.added {
  background: #fef3c7;
  border-color: var(--c-golden);
}

.mixing-bowl-card {
  background: #faf5ee;
  border: 3px solid #e2d2c1;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

.mixing-bowl-graphic {
  width: 130px;
  height: 130px;
  background: #5a2e17;
  border-radius: 0 0 100px 100px;
  border: 6px solid #381a0b;
  position: relative;
  overflow: hidden;
  margin: 1rem auto;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.mixing-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(180deg, #78350f 0%, #451a03 100%);
  transition: all 0.4s ease;
}

.mixing-liquid.white-choco {
  background: linear-gradient(180deg, #fef08a 0%, #fef9c3 100%);
}

.mixing-liquid.milk-choco {
  background: linear-gradient(180deg, #9a3412 0%, #78350f 100%);
}

.mixing-liquid.stirring {
  animation: stirWave 0.8s infinite alternate;
}

@keyframes stirWave {
  from { transform: scaleY(0.9) skewX(-2deg); }
  to { transform: scaleY(1.05) skewX(2deg); }
}

/* TALLER RETO 4: DESMOLDE CRACK Y ENVOLTORIO */
.bar-customizer-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.choco-bar-preview {
  width: 240px;
  height: 140px;
  background: linear-gradient(135deg, #5a2e17 0%, #3b1d0e 100%);
  border-radius: var(--radius-sm);
  border: 4px solid #2b1408;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  padding: 6px;
  box-shadow: 0 10px 25px rgba(43, 20, 8, 0.35);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-bounce);
}

.choco-bar-preview:hover {
  transform: scale(1.04);
}

.choco-bar-square {
  background: linear-gradient(135deg, #7b3f1d, #522713);
  border-radius: 4px;
  border-top: 1px solid rgba(255,255,255,0.25);
  border-left: 1px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
}

.wrapper-foil {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #d97706 100%);
  border-right: 3px dashed #fff;
  box-shadow: 2px 0 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: #2b1408;
  font-family: var(--font-title);
  font-size: 0.75rem;
  text-align: center;
  font-weight: 700;
  overflow: hidden;
}

/* =========================================================================
   VISTA 4: TRIVIA DE 3ER GRADO & DIPLOMA ESCOLAR
   ========================================================================= */
.trivia-container {
  background: var(--c-cream-card);
  border: 3px solid #dfcfbe;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  max-width: 800px;
  margin: 0 auto;
}

.trivia-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #f0e4d7;
  padding-bottom: 0.75rem;
}

.trivia-score-badge {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.95rem;
  font-family: var(--font-title);
  font-weight: 700;
  color: #92400e;
}

.trivia-question-card {
  background: #fff8f0;
  border: 2px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.trivia-question-text {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--c-dark-chocolate);
  line-height: 1.4;
}

.trivia-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.trivia-opt-btn {
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-family: var(--font-title);
  font-size: 1.05rem;
  color: var(--c-dark-chocolate);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  transition: all var(--transition-fast);
}

.trivia-opt-btn:hover {
  border-color: var(--c-golden);
  background: #fffbeb;
  transform: translateX(4px);
}

.trivia-opt-btn.correct {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
}

.trivia-opt-btn.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #7f1d1d;
}

/* =========================================================================
   DIPLOMA OFICIAL DE MAESTRO CHOCOLATERO
   ========================================================================= */
.diploma-certificate {
  background: #ffffff;
  border: 12px double #c86d26;
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  margin: 1.5rem auto;
  position: relative;
  max-width: 680px;
}

.diploma-certificate::before {
  content: '🍫';
  position: absolute;
  top: 15px;
  left: 20px;
  font-size: 2rem;
}

.diploma-certificate::after {
  content: '🍫';
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2rem;
}

.diploma-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: #7b3f1d;
  margin-bottom: 0.5rem;
}

.diploma-subtitle {
  font-size: 1rem;
  color: #78350f;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.diploma-student-name {
  font-family: var(--font-title);
  font-size: 2rem;
  color: #b45309;
  border-bottom: 3px dashed #d97706;
  display: inline-block;
  padding: 0 1.5rem 0.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.diploma-seals-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-top: 2rem;
}

.diploma-seal {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, #fde68a 0%, #f59e0b 100%);
  border: 4px solid #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* =========================================================================
   FOOTER PEDAGÓGICO
   ========================================================================= */
.choco-footer {
  background: #381a0b;
  color: #fed7aa;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.88rem;
  margin-top: auto;
}

.choco-footer a {
  color: var(--c-golden);
  text-decoration: none;
  font-weight: 700;
}

.choco-footer a:hover {
  text-decoration: underline;
}

/* =========================================================================
   ESTILOS DE IMPRESIÓN ESCOLAR (@media print)
   ========================================================================= */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .choco-header-bar,
  .modes-nav-container,
  .teclita-guide-bar,
  .grapher-toolbar,
  .header-controls,
  .choco-footer,
  #confetti-canvas,
  .btn-graph-action,
  .recipe-selector-row {
    display: none !important;
  }

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

  .app-view {
    display: none !important;
  }

  .app-view.print-active {
    display: block !important;
  }

  .flowchart-canvas-wrapper,
  .diploma-certificate {
    box-shadow: none !important;
    border: 2px solid #000 !important;
    width: 100% !important;
  }
}

/* =========================================================================
   RESPONSIVE DESIGN (TABLETS Y SMARTPHONES)
   ========================================================================= */
@media (max-width: 768px) {
  .modes-nav-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .brand-texts h1 {
    font-size: 1.1rem;
  }

  .tab-title {
    font-size: 0.95rem;
  }

  .tab-emoji {
    font-size: 1.6rem;
  }

  .flowchart-grid {
    min-width: 100%;
  }
}
