/* ==========================================================================
   ESTILOS - MUNDO RESTA (CENTRO INTEGRAL TALENTIA)
   Diseñado para alumnos de 4º de Primaria (9-10 años)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
  --primary: #5c35eb;
  --primary-light: #7b5af5;
  --primary-dark: #401ec4;
  --accent: #ff9f1c;
  --accent-light: #ffbf69;
  --accent-pink: #ff477e;
  --success: #10b981;
  --success-bg: #d1fae5;
  --error: #ef4444;
  --error-bg: #fee2e2;
  --bg-gradient: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #fdf2f8 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: #e0e7ff;
  --text-main: #1e1b4b;
  --text-muted: #64748b;
  --shadow-sm: 0 4px 6px -1px rgba(92, 53, 235, 0.08);
  --shadow-md: 0 10px 25px -5px rgba(92, 53, 235, 0.15);
  --shadow-lg: 0 20px 35px -10px rgba(92, 53, 235, 0.25);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-main);
  overflow-x: hidden;
  position: relative;
}

/* Fondo decorativo con burbujas matemáticas flotantes */
.bg-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floating-shape {
  position: absolute;
  opacity: 0.12;
  font-family: 'Fredoka', cursive;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--primary);
  animation: floatSlow 12s infinite ease-in-out;
}

.shape-1 { top: 10%; left: 5%; animation-delay: 0s; }
.shape-2 { top: 75%; left: 8%; animation-delay: 2s; }
.shape-3 { top: 20%; right: 7%; animation-delay: 4s; }
.shape-4 { top: 80%; right: 6%; animation-delay: 6s; }
.shape-5 { top: 45%; left: 88%; animation-delay: 1s; }
.shape-6 { top: 60%; left: 45%; animation-delay: 3s; }

@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-25px) rotate(15deg); }
}

/* ==========================================================================
   BANNER FLOTANTE DISIMULADO (DEDICATORIA)
   ========================================================================== */
.floating-dedication-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(92, 53, 235, 0.2);
  box-shadow: 0 6px 20px rgba(92, 53, 235, 0.12);
  border-radius: 50px;
  padding: 6px 16px 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-main);
  animation: dropBannerAnim 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 92vw;
}

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

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

.floating-dedication-banner .talentia-name-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  transition: color 0.2s;
}

.floating-dedication-banner .talentia-name-link:hover {
  color: var(--accent);
}

.banner-sparkle {
  font-size: 1rem;
}

.btn-close-banner {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
  line-height: 1;
  transition: all 0.2s;
  margin-left: 4px;
}

.btn-close-banner:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* ==========================================================================
   HEADER Y BARRA SUPERIOR
   ========================================================================== */
header {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 3px solid #e2e8f0;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  margin-top: 48px;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.brand-logo-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(92, 53, 235, 0.35);
  transition: transform 0.2s;
}

.brand-logo-badge:hover {
  transform: scale(1.08) rotate(-6deg);
}

.brand-titles h1 {
  font-family: 'Fredoka', cursive;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-titles h1 span.highlight {
  color: var(--accent);
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

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

.stat-pill {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.stat-pill.ops-config {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.ops-select-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.header-select {
  border: none;
  background: transparent;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

.stat-pill.points {
  color: #b45309;
  background: #fefce8;
  border-color: #fef08a;
}

.btn-header-action {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-header-action:hover {
  transform: scale(1.06);
  border-color: var(--primary-light);
}

/* ==========================================================================
   ALERTAS FLOTANTES DE PUNTOS
   ========================================================================== */
#floating-points-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.floating-points-alert {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50px;
  padding: 8px 18px;
  font-family: 'Fredoka', cursive;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  animation: floatUpFade 1.8s forwards cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.floating-points-alert.positive {
  color: #15803d;
  border: 2px solid #86efac;
}

.floating-points-alert.negative {
  color: #b91c1c;
  border: 2px solid #fca5a5;
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translateY(20px) scale(0.8); }
  20% { opacity: 1; transform: translateY(0) scale(1.05); }
  80% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(0.9); }
}

/* ==========================================================================
   VISTAS Y SECCIONES
   ========================================================================== */
main {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.view-section {
  display: none;
  animation: fadeInView 0.35s ease-out;
}

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

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

/* ==========================================================================
   VISTA 1: MENÚ PRINCIPAL Y HERO
   ========================================================================== */
.welcome-hero {
  background: white;
  border: 3px solid #e0e7ff;
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.welcome-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-mascot-avatar {
  font-size: 4rem;
  margin-bottom: 8px;
  display: inline-block;
  animation: bounceSoft 2.5s infinite ease-in-out;
}

@keyframes bounceSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-hero h2 {
  font-family: 'Fredoka', cursive;
  font-size: 2.2rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.welcome-hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 650px;
  margin: 0 auto 20px;
}

.hero-config-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}

.player-input-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: white;
  padding: 8px 16px;
  border-radius: 50px;
  border: 2px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.player-input-card input {
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--primary-dark);
  width: 180px;
}

.levels-grid-container {
  margin-top: 20px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title-wrap h3 {
  font-family: 'Fredoka', cursive;
  font-size: 1.6rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.level-card {
  background: white;
  border: 3px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 22px;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.level-card:hover:not(.locked) {
  transform: translateY(-6px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.level-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.level-num-badge {
  background: var(--primary);
  color: white;
  font-family: 'Fredoka', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
}

.level-card.cifras-2 .level-num-badge {
  background: var(--accent);
}

.level-stars-display {
  color: #fbbf24;
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.level-card h4 {
  font-family: 'Fredoka', cursive;
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.level-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
  flex-grow: 1;
}

.level-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 2px dashed #f1f5f9;
}

.level-progress-tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-start-level {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  font-family: 'Fredoka', cursive;
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(92, 53, 235, 0.3);
  transition: all 0.2s;
}

.level-card:hover:not(.locked) .btn-start-level {
  transform: scale(1.05);
}

.btn-diploma-hub {
  background: white;
  border: 3px solid #cbd5e1;
  border-radius: 50px;
  padding: 14px 32px;
  font-family: 'Fredoka', cursive;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-diploma-hub.locked {
  color: var(--text-muted);
  background: #f8fafc;
  cursor: pointer;
}

.btn-diploma-hub.unlocked {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border-color: #fef08a;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4);
  animation: pulseGold 2s infinite ease-in-out;
}

@keyframes pulseGold {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 15px 35px rgba(245, 158, 11, 0.6); }
}

/* ==========================================================================
   VISTA 2: ÁREA DE JUEGO Y RESTA INTERACTIVA
   ========================================================================== */
.game-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.game-level-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-back-levels {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 14px;
  font-family: 'Fredoka', cursive;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-back-levels:hover {
  background: #e2e8f0;
}

.level-current-badge {
  font-family: 'Fredoka', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.division-indicator-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.div-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: all 0.3s;
}

.div-dot.active {
  background: var(--primary);
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(92, 53, 235, 0.5);
}

.div-dot.completed {
  background: var(--success);
}

/* Panel Principal de Resta */
.division-workspace {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .division-workspace {
    grid-template-columns: 1fr;
  }
}

.division-board-card {
  background: white;
  border: 3px solid #e0e7ff;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.division-prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px dashed #f1f5f9;
}

.instruction-step-pill {
  background: #e0e7ff;
  color: var(--primary-dark);
  font-family: 'Fredoka', cursive;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: pulseLight 2s infinite;
}

@keyframes pulseLight {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.division-points-badge {
  background: #fffbeb;
  border: 2px solid #fde047;
  color: #a16207;
  font-family: 'Fredoka', cursive;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 6px 14px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   TABLERO DE LA RESTA VERTICAL TRADICIONAL
   ========================================================================== */
.subtraction-math-layout {
  font-family: 'Fredoka', cursive;
  font-size: 2.4rem;
  margin: 10px auto 25px;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
}

.subtraction-vertical-grid {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 10px 20px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
}

.math-grid-row {
  display: flex;
  justify-content: flex-end;
  position: relative;
  height: 58px;
  align-items: center;
}

.math-grid-row.carries-row {
  height: 38px;
  margin-bottom: 2px;
}

.carry-slot-cell {
  width: 52px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carry-bubble {
  background: #fee2e2;
  border: 2px solid #f87171;
  color: #b91c1c;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 50px;
  padding: 2px 8px;
  animation: popSuccess 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.2);
}

.math-col-cell {
  width: 52px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  position: relative;
  transition: all 0.2s;
}

.math-col-cell.col-active {
  background: rgba(92, 53, 235, 0.1);
  color: var(--primary);
  border-radius: 10px;
  transform: scale(1.06);
}

.math-col-cell.col-borrowed {
  position: relative;
}

.math-col-cell.col-borrowed::after {
  content: '1';
  position: absolute;
  top: 2px;
  left: 6px;
  font-size: 1.1rem;
  color: var(--accent-pink);
  font-weight: 800;
}

.subtrahend-row {
  position: relative;
}

.subtraction-minus-sign {
  position: absolute;
  left: -32px;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--error);
  line-height: 1;
}

.subtrahend-digits-wrap {
  display: flex;
  justify-content: flex-end;
}

.subtraction-line-bar {
  height: 4px;
  background: var(--text-main);
  border-radius: 4px;
  margin: 6px 0 10px;
  width: calc(100% + 36px);
  margin-left: -36px;
}

.difference-row {
  height: 60px;
}

.math-input-slot {
  width: 48px;
  height: 54px;
  margin: 0 2px;
  border: 3px solid #cbd5e1;
  border-radius: 12px;
  font-family: 'Fredoka', cursive;
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-main);
  background: white;
  outline: none;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  padding: 0;
}

.math-input-slot:focus,
.math-input-slot.active-focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(92, 53, 235, 0.25);
  transform: scale(1.08);
  background: #fdf4ff;
}

.math-input-slot.correct {
  border-color: var(--success) !important;
  background: var(--success-bg) !important;
  color: #065f46 !important;
  animation: popSuccess 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.math-input-slot.incorrect {
  border-color: var(--error) !important;
  background: var(--error-bg) !important;
  color: #991b1b !important;
  animation: shakeError 0.4s ease;
}

@keyframes popSuccess {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ==========================================================================
   TECLADO VIRTUAL
   ========================================================================== */
.virtual-keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-width: 420px;
  margin: 15px auto 0;
  width: 100%;
}

.key-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  font-family: 'Fredoka', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  height: 52px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-2px);
}

.key-btn:active {
  transform: translateY(1px);
}

.key-btn.action-btn {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
  font-size: 1.15rem;
}

/* ==========================================================================
   BARRA LATERAL / MASCOTA Y RINCÓN ILUSTRADO DE LA RESTA
   ========================================================================== */
.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.talentin-mascot-card {
  background: white;
  border: 3px solid #e0e7ff;
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.mascot-avatar-circle {
  width: 60px;
  height: 60px;
  min-width: 60px;
  background: #eef2ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  border: 2px solid #c7d2fe;
}

.talentin-speech-bubble {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-main);
}

.reparto-visual-card {
  background: white;
  border: 3px solid #e0e7ff;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reparto-card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reparto-title {
  font-family: 'Fredoka', cursive;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.reparto-tag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.reparto-theme-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.theme-pill {
  background: #f1f5f9;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.theme-pill.active {
  background: #eef2ff;
  border-color: var(--primary);
  color: var(--primary);
}

.reparto-visual-box {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
}

.reparto-formula-pill {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
  background: white;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.reparto-items-stream {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.reparto-item {
  font-size: 1.5rem;
  display: inline-block;
  animation: popSuccess 0.4s ease-out;
}

.reparto-item.removed {
  opacity: 0.35;
  filter: grayscale(1);
  text-decoration: line-through;
  transform: scale(0.85);
}

.reparto-more-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 6px;
}

.division-terms-guide {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  padding: 12px;
  border-radius: 12px;
}

.term-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.term-badge {
  color: white;
  font-family: 'Fredoka', cursive;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 80px;
  text-align: center;
}

.term-text {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.cartoon-sharing-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.4rem;
  padding-top: 6px;
}

/* ==========================================================================
   MODALES Y VENTANAS EMERGENTES
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.25s ease-out;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: scaleUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-icon-header {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.modal-content-card h3 {
  font-family: 'Fredoka', cursive;
  font-size: 1.8rem;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.modal-content-card p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-modal-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  font-family: 'Fredoka', cursive;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(92, 53, 235, 0.35);
  transition: all 0.2s;
}

.btn-modal-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(92, 53, 235, 0.45);
}

.btn-modal-secondary {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  color: var(--text-main);
  font-family: 'Fredoka', cursive;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-modal-secondary:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   DIPLOMA DE EXCELENCIA
   ========================================================================== */
.diploma-card {
  background: #fffbeb;
  border: 8px double #d97706;
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  position: relative;
  box-shadow: inset 0 0 20px rgba(217, 119, 6, 0.15);
}

.diploma-header h2 {
  font-family: 'Fredoka', cursive;
  color: #78350f;
  font-size: 1.5rem;
  letter-spacing: 1px;
}

.diploma-student-name {
  font-family: 'Fredoka', cursive;
  font-size: 2.2rem;
  color: var(--primary-dark);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  margin: 10px 0;
  font-weight: 700;
}

.diploma-seal-badge {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(180, 83, 9, 0.4);
  transform: rotate(-10deg);
}

/* ==========================================================================
   MODAL LEGAL (AVISO LEGAL, PRIVACIDAD, COOKIES)
   ========================================================================== */
.modal-legal-card {
  max-width: 780px;
  padding: 24px;
  text-align: left;
}

.modal-legal-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
}

.legal-tab-nav {
  display: flex;
  gap: 8px;
}

.tab-legal-btn {
  background: #f1f5f9;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 14px;
  font-family: 'Fredoka', cursive;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-legal-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-close-modal-x {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 8px;
}

.btn-close-modal-x:hover {
  background: #fee2e2;
  color: #ef4444;
}

.modal-legal-body-scroll {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 12px;
}

.legal-tab-pane {
  display: none;
}

.legal-tab-pane.active {
  display: block;
}

.legal-tab-pane h3 {
  font-family: 'Fredoka', cursive;
  font-size: 1.4rem;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

.legal-tab-pane h4 {
  font-family: 'Fredoka', cursive;
  font-size: 1.1rem;
  color: var(--text-main);
  margin: 14px 0 6px;
}

.legal-tab-pane p,
.legal-tab-pane li {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.legal-tab-pane ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

/* ==========================================================================
   FOOTER CORPORATIVO
   ========================================================================== */
.app-footer {
  position: relative;
  z-index: 10;
  background: white;
  border-top: 3px solid #e2e8f0;
  padding: 30px 24px 20px;
  margin-top: 60px;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-talentia-logo {
  height: 52px;
  width: auto;
}

.footer-brand-info h4 {
  font-family: 'Fredoka', cursive;
  font-size: 1.15rem;
  color: var(--primary-dark);
}

.footer-brand-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-address {
  font-size: 0.8rem !important;
  color: #94a3b8 !important;
  margin-top: 2px;
}

.footer-info-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

@media (max-width: 768px) {
  .footer-info-col {
    align-items: flex-start;
  }
}

.footer-contact-items {
  display: flex;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.footer-contact-items a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-legal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.btn-legal-trigger {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.82rem;
}

.btn-legal-trigger:hover {
  color: var(--primary);
}

.legal-separator {
  color: #cbd5e1;
}

.footer-bottom-copy {
  max-width: 1280px;
  margin: 20px auto 0;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Confeti Canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10001;
}

/* Ajustes de Impresión para Diploma */
@media print {
  body * {
    visibility: hidden;
  }
  #modal-diploma,
  #modal-diploma * {
    visibility: visible;
  }
  #modal-diploma {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: block !important;
  }
  .modal-actions {
    display: none !important;
  }
  .diploma-card {
    border: 10px double #d97706 !important;
    box-shadow: none !important;
  }
}
