/* ==========================================================================
   EquisUvePalitoPalito - Estilo Greco-Romano Acuarela Infantil (Kids Watercolor)
   Alegre, claro, amigable para niños y niñas con ilustraciones de caricatura
   ========================================================================== */

:root {
  /* Paleta Acuarela Mediterránea y Pastel Infantil */
  --bg-space: #fbf8f2;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;

  /* Azules Mar Egeo / Cielo Griego */
  --aegean-blue: #3498db;
  --aegean-dark: #2980b9;
  --aegean-light: #ebf5fb;
  --aegean-glow: rgba(52, 152, 219, 0.22);

  /* Oro Sol / Miel del Olimpo */
  --gold-primary: #f39c12;
  --gold-secondary: #f1c40f;
  --gold-dark: #d68910;
  --gold-light: #fef9e7;
  --gold-glow: rgba(243, 156, 18, 0.25);

  /* Terracota y Coral de Ánfora */
  --terracotta: #e76f51;
  --terracotta-light: #fbeee9;
  --subtractive-red: #e74c3c;
  --subtractive-light: #fdedec;

  /* Verde Laurel y Menta */
  --laurel-green: #27ae60;
  --additive-green: #2ecc71;
  --green-light: #eafaf1;

  /* Púrpura Imperial Suave */
  --purple-tyrian: #8e44ad;
  --purple-light: #f4ecf7;

  /* Tinta de Dibujo Animado y Tipografía Legible */
  --text-primary: #2c3e50;
  --text-secondary: #566573;
  --text-muted: #7f8c8d;

  /* Bordes de Lápiz y Trazos de Acuarela */
  --border-subtle: #e5ded4;
  --border-active: #3498db;
  --border-pencil: #dcd3c5;

  /* Tipografía Amigable y Redondeada */
  --font-sans: 'Fredoka', 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Fredoka', 'Cinzel', Georgia, cursive, sans-serif;
  --font-monument: 'Cinzel', 'Fredoka', Georgia, serif;

  /* Bordes Orgánicos y Redondos */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 40px;

  /* Sombras Suaves Tipo Acuarela Difusa */
  --shadow-card: 0 10px 30px rgba(100, 115, 140, 0.08), 0 2px 6px rgba(100, 115, 140, 0.04);
  --shadow-gold: 0 8px 24px rgba(243, 156, 18, 0.18);
  --shadow-pop: 0 6px 0 #d9cebf;
  --shadow-btn: 0 4px 0 #b38848;
  --transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-space);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fondo de luz ambiental con manchas de acuarela mediterráneas */
.background-ambient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 15%, rgba(142, 68, 173, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(52, 152, 219, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(243, 156, 18, 0.08) 0%, transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(46, 204, 113, 0.07) 0%, transparent 45%),
    linear-gradient(180deg, #fbf8f2 0%, #f6f1e7 100%);
  pointer-events: none;
}

.watercolor-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.6;
}

.blob-1 {
  width: 380px;
  height: 380px;
  background: #d4effc;
  top: -60px;
  right: -60px;
}

.blob-2 {
  width: 320px;
  height: 320px;
  background: #fde8cd;
  bottom: 80px;
  left: -60px;
}

.blob-3 {
  width: 280px;
  height: 280px;
  background: #e8f8f5;
  top: 45%;
  left: 35%;
}

/* ==========================================================================
   ILUSTRACIONES DE FONDO (Columnas Romanas & Matemáticas Arábigas en Acuarela)
   ========================================================================== */

.bg-illustration {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  opacity: 0.65;
  transition: opacity 0.4s ease;
}

.bg-roman-columns {
  top: 100px;
  left: 15px;
  width: 165px;
  height: auto;
  animation: floatColumn 8s ease-in-out infinite alternate;
}

.bg-arabic-elements {
  top: 110px;
  right: 18px;
  width: 205px;
  height: auto;
  animation: floatArabic 9s ease-in-out infinite alternate;
}

.svg-roman-column,
.svg-arabic-art {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 14px rgba(120, 100, 70, 0.08));
}

@keyframes floatColumn {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-8px) rotate(-0.5deg); }
}

@keyframes floatArabic {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-10px) rotate(0.8deg); }
}

@media (max-width: 1400px) {
  .bg-roman-columns {
    opacity: 0.35;
    left: -15px;
    width: 140px;
  }
  .bg-arabic-elements {
    opacity: 0.35;
    right: -20px;
    width: 170px;
  }
}

@media (max-width: 900px) {
  .bg-illustration {
    opacity: 0.2;
  }
  .bg-roman-columns {
    width: 95px;
    left: -20px;
  }
  .bg-arabic-elements {
    width: 120px;
    right: -25px;
  }
}

/* ==========================================================================
   HEADER Y BRANDING AMIGABLE
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 2px solid #ecdcc8;
  box-shadow: 0 4px 20px rgba(140, 120, 100, 0.08);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-monogram {
  min-width: 110px;
  height: 48px;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fff3d6 0%, #ffeaa7 100%);
  border: 2.5px solid var(--gold-primary);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.25), inset 0 2px 0 #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: #7d4e04;
  letter-spacing: 3px;
  flex-shrink: 0;
  transition: var(--transition);
}

.brand-monogram:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 18px rgba(243, 156, 18, 0.35);
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--aegean-dark);
  letter-spacing: 0.3px;
}

.brand-tagline {
  font-size: 0.88rem;
  color: #e67e22;
  font-weight: 600;
}

.theme-toggle-btn {
  background: #ffffff;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  padding: 0.55rem 1.15rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: var(--gold-light);
  border-color: var(--gold-primary);
  color: #a05a00;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
}

/* ==========================================================================
   NAVEGACIÓN POR PESTAÑAS (Estilo Acuarela)
   ========================================================================== */

.main-tabs-nav {
  border-top: 1px solid #f1e9dd;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-container::-webkit-scrollbar {
  display: none;
}

.main-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.9rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
  position: relative;
  transition: var(--transition);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 3px solid transparent;
}

.main-nav-btn .nav-icon {
  font-size: 1.25rem;
  transition: var(--transition);
}

.main-nav-btn:hover {
  color: var(--aegean-dark);
  background: rgba(52, 152, 219, 0.06);
}

.main-nav-btn.active {
  color: var(--aegean-dark);
  background: rgba(52, 152, 219, 0.1);
  border-bottom: 3.5px solid var(--aegean-blue);
  font-weight: 700;
}

.main-nav-btn.active .nav-icon {
  transform: scale(1.2) rotate(-5deg);
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL
   ========================================================================== */

.app-main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.25rem 1.5rem 4rem;
}

.tab-pane {
  display: none;
  animation: popIn 0.3s ease-out forwards;
}

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

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

.tab-intro-card {
  text-align: center;
  margin-bottom: 2.25rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.tab-heading {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--aegean-dark);
  margin-bottom: 0.65rem;
}

.tab-subheading {
  font-size: 1.08rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   PESTAÑA 1: CONVERSOR Y DESGLOSE VISUAL
   ========================================================================== */

.converter-box-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.converter-card {
  background: var(--bg-card);
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
}

.converter-card:focus-within {
  border-color: var(--aegean-blue);
  box-shadow: 0 10px 28px var(--aegean-glow);
  transform: translateY(-2px);
}

.card-top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.field-badge {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-xl);
}

.arabic-badge {
  background: #e8f8f5;
  color: #16a085;
  border: 1.5px solid #a3e4d7;
}

.roman-badge {
  background: #fef9e7;
  color: #d68910;
  border: 1.5px solid #f9e79f;
}

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

.input-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.primary-number-input,
.primary-roman-input {
  width: 100%;
  background: #ffffff;
  border: 2px solid #e0d8cc;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.primary-roman-input {
  font-family: var(--font-serif);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #b7791f;
  padding-right: 5.5rem;
}

.primary-number-input:focus,
.primary-roman-input:focus {
  border-color: var(--aegean-blue);
  box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
}

.copy-field-btn {
  position: absolute;
  right: 0.75rem;
  background: #fef9e7;
  border: 1.5px solid #f9e79f;
  border-radius: var(--radius-sm);
  color: #a05a00;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.copy-field-btn:hover {
  background: var(--gold-secondary);
  color: #5d3600;
  transform: scale(1.05);
}

.field-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.converter-flow-divider {
  display: flex;
  align-items: center;
  justify-content: center;
}

.divider-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 2px solid #90caf9;
  color: var(--aegean-dark);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

/* Teclado Virtual Romano */
.roman-keypad-panel {
  background: #ffffff;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
}

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

.keypad-buttons-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.roman-keypad-btn {
  background: #fffbf0;
  border: 2px solid #f0d5a1;
  border-radius: var(--radius-sm);
  color: #8c5304;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #e4c386;
  transition: var(--transition);
}

.roman-keypad-btn:hover {
  background: #ffeaa7;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #e4c386;
}

.roman-keypad-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #e4c386;
}

.roman-keypad-btn.action-key {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  background: #fdedec;
  border-color: #f5b7b1;
  box-shadow: 0 3px 0 #ea9e98;
  color: #c0392b;
}

.roman-keypad-btn.action-key:hover {
  background: #fadbd8;
}

/* Caja de Estado y Errores Didácticos */
.converter-status-box {
  padding: 1rem 1.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  font-size: 0.98rem;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  animation: popIn 0.25s ease-out;
}

.status-success {
  background: #eafaf1;
  border: 2px solid #a9dfbf;
  color: #1e8449;
}

.status-error {
  background: #fdedec;
  border: 2px solid #f5b7b1;
  color: #c0392b;
}

.status-warning {
  background: #fef9e7;
  border: 2px solid #f9e79f;
  color: #b7950b;
}

.status-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.status-fix-btn {
  margin-top: 0.4rem;
  display: inline-block;
  background: var(--gold-secondary);
  color: #5d3600;
  border: 1.5px solid #d68910;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
}

.status-fix-btn:hover {
  background: #f39c12;
  color: #ffffff;
  transform: scale(1.03);
}

/* Presets Históricos estilo Sellos de Acuarela */
.presets-section {
  margin-bottom: 2rem;
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.presets-group {
  margin-bottom: 0.5rem;
}

.presets-label {
  display: block;
  font-size: 0.92rem;
  color: var(--aegean-dark);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.preset-pill {
  background: #fefcf8;
  border: 1.5px solid #e0d5c3;
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1.05rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
}

.preset-pill:hover {
  background: var(--gold-light);
  border-color: var(--gold-primary);
  color: #935300;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(243, 156, 18, 0.2);
}

.preset-pill.pill-chile {
  background: #ebf9f7;
  border-color: #a3e4d7;
  color: #0e6655;
}

.preset-pill.pill-chile:hover {
  background: #d1f2eb;
  border-color: #16a085;
  color: #0b5345;
  box-shadow: 0 4px 12px rgba(22, 160, 133, 0.2);
}

/* Deslizador Continuo Rápido */
.slider-interactive-bar {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.slider-header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.slider-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 700;
}

.slider-current-badge {
  background: #e8f8f5;
  color: #16a085;
  border: 1.5px solid #a3e4d7;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-xl);
}

.slider-control-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.roman-range-slider {
  flex-grow: 1;
  min-width: 140px;
  height: 12px;
  border-radius: 6px;
  background: #e9ecef;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  accent-color: var(--aegean-blue);
  cursor: pointer;
}

.roman-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #3498db;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
  cursor: pointer;
  transition: var(--transition);
}

.roman-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.step-btn {
  background: #f8f9fa;
  border: 1.5px solid #ced4da;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  box-shadow: 0 2px 0 #ced4da;
  transition: var(--transition);
}

.step-btn:hover {
  background: #e3f2fd;
  border-color: #90caf9;
  color: var(--aegean-dark);
  transform: translateY(-1px);
}

.step-rnd {
  background: #f4ecf7;
  border-color: #d7bde2;
  box-shadow: 0 2px 0 #d7bde2;
  color: #7d3c98;
}

.step-rnd:hover {
  background: #ebdef0;
}

/* ==========================================================================
   DESGLOSE VISUAL (VisualBreakdown en Acuarela)
   ========================================================================== */

.visual-breakdown-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.empty-breakdown-state {
  background: #ffffff;
  border: 2px dashed #dcd3c5;
  border-radius: var(--radius-lg);
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.breakdown-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #fefcf8 100%);
  border: 2.5px solid var(--gold-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: var(--shadow-card);
  gap: 1rem;
}

.hero-val-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.hero-arabic {
  font-size: 2.6rem;
  font-weight: 700;
  color: #16a085;
}

.hero-equal {
  font-size: 2.4rem;
  color: var(--gold-primary);
  font-weight: 700;
}

.hero-roman {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 700;
  color: #b7791f;
  letter-spacing: 2px;
}

.breakdown-section {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.section-title-wrap {
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--aegean-dark);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-secondary);
  color: #5d3600;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(241, 196, 15, 0.4);
}

.section-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 0.35rem;
}

/* Tarjetas de Valor Posicional */
.place-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.place-card {
  background: #fdfcf9;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.place-card.additive-glow:hover {
  border-color: #2ecc71;
  background: #f4fbf7;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(46, 204, 113, 0.15);
}

.place-card.subtractive-glow:hover {
  border-color: #e74c3c;
  background: #fdf5f5;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(231, 76, 60, 0.15);
}

.place-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.place-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.place-arabic-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--aegean-dark);
}

.place-roman-display {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0;
  background: #ffffff;
  border: 1.5px dashed #ded4c5;
  border-radius: var(--radius-sm);
}

.roman-token-badge {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.roman-token-badge.additive {
  color: #b7791f;
}

.roman-token-badge.subtractive {
  color: #c0392b;
}

.formula-rule-badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.badge-add {
  background: #eafaf1;
  color: #1e8449;
  border: 1px solid #a9dfbf;
}

.badge-sub {
  background: #fdedec;
  color: #c0392b;
  border: 1px solid #f5b7b1;
}

.formula-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
  font-weight: 500;
}

.token-piles {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.mini-roman-coin {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef3c7 0%, #f59e0b 80%);
  border: 2px solid #d97706;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  color: #78350f;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Ecuación Matemática Completa */
.math-equation-banner {
  background: #fbf9f4;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 1.15rem;
}

.eq-token {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1.5px solid #ded5c5;
}

.eq-token.sub-token {
  border-color: #f5b7b1;
  background: #fdedec;
}

.eq-token.add-token {
  border-color: #a9dfbf;
  background: #eafaf1;
}

.eq-symbol {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.35rem;
  color: #b7791f;
}

.eq-token.sub-token .eq-symbol {
  color: #c0392b;
}

.eq-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.eq-plus, .eq-equals {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-muted);
}

.eq-result {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1.15rem;
  background: #e8f8f5;
  border: 2px solid #a3e4d7;
  border-radius: var(--radius-sm);
}

.res-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: #16a085;
}

.res-roman {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: #d68910;
}

/* ==========================================================================
   ÁBACO ROMANO INFANTIL (Estilo Madera y Canicas de Colores)
   ========================================================================== */

.roman-abacus-board {
  margin-top: 1rem;
}

.abacus-frame {
  background: linear-gradient(145deg, #f7efe2 0%, #ede0cb 100%);
  border: 4px solid #c8a87b;
  box-shadow: 0 10px 24px rgba(120, 90, 50, 0.12), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  position: relative;
}

.abacus-title-plate {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #7a4e1d;
  letter-spacing: 3px;
  margin-bottom: 1.5rem;
  border-bottom: 2px dashed #d9c2a3;
  padding-bottom: 0.5rem;
}

.abacus-grooves-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.abacus-column {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  border: 2px solid #e2d2bd;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

.abacus-column-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
}

.col-symbol {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--aegean-dark);
}

.col-name {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.col-digit-badge {
  background: #fef9e7;
  color: #b7791f;
  border: 1.5px solid #f9e79f;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
}

.abacus-slot {
  width: 58px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.slot-rail {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: #d8c8b4;
  border-radius: 3px;
  z-index: 1;
}

.slot-upper {
  height: 75px;
}

.slot-lower {
  height: 190px;
}

.abacus-divider {
  width: 100%;
  height: 14px;
  background: #c8a87b;
  border-top: 2px solid #dfc7a5;
  border-bottom: 2px solid #ad895a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.4rem 0;
  position: relative;
  z-index: 5;
  border-radius: 4px;
}

.divider-mark {
  color: #ffffff;
  font-size: 0.6rem;
}

/* Cuentas de Ábaco estilo Canicas / Gomitas de Color */
.bead {
  width: 44px;
  height: 32px;
  border-radius: 16px;
  background: radial-gradient(circle at 35% 30%, #fef3c7 0%, #f59e0b 60%, #b45309 100%);
  border: 2px solid #fde68a;
  box-shadow: 0 4px 8px rgba(180, 83, 9, 0.25), inset 0 2px 3px rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 3;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: default;
}

.bead-inner {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Cuenta superior (5):
   Inactiva: arriba; Activa: abajo pegada a la barra */
.upper-bead.inactive {
  transform: translateY(4px);
  filter: saturate(0.6) brightness(0.95);
  opacity: 0.65;
}

.upper-bead.active {
  transform: translateY(36px);
  filter: saturate(1.2) brightness(1.05);
  box-shadow: 0 0 14px rgba(243, 156, 18, 0.5);
  opacity: 1;
}

/* Ranura inferior (1):
   Activas: pegadas arriba; Inactivas: al fondo */
.beads-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 3;
}

.active-group {
  margin-top: 4px;
}

.inactive-group {
  margin-top: auto;
  margin-bottom: 4px;
}

.lower-bead {
  background: radial-gradient(circle at 35% 30%, #e0f2fe 0%, #38bdf8 60%, #0284c7 100%);
  border-color: #bae6fd;
}

.lower-bead.active {
  filter: saturate(1.2) brightness(1.05);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  opacity: 1;
}

.lower-bead.inactive {
  filter: saturate(0.5);
  opacity: 0.55;
}

.abacus-column-footer {
  margin-top: 0.75rem;
}

.col-formula-hint {
  font-size: 0.85rem;
  color: #7a4e1d;
  font-weight: 700;
}

.abacus-footer-note {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

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

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.bead-active-dot {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.bead-inactive-dot {
  background: #d1d5db;
}

/* ==========================================================================
   PESTAÑA 2: APRENDE LAS REGLAS (Tarjetas Didácticas)
   ========================================================================== */

.learn-sub-section {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
}

.sub-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sub-header-bar h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--aegean-dark);
}

.sub-info-pill {
  font-size: 0.85rem;
  color: #a05a00;
  background: #fef9e7;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-xl);
  border: 1.5px solid #f9e79f;
  font-weight: 700;
}

/* Símbolos Sagrados */
.symbols-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.symbol-card {
  background: #fdfcf9;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.symbol-card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--aegean-blue);
  box-shadow: 0 10px 24px rgba(52, 152, 219, 0.15);
  background: #ffffff;
}

.symbol-card-top {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.symbol-badge {
  font-family: var(--font-serif);
  font-size: 2.3rem;
  font-weight: 700;
  color: var(--aegean-dark);
}

.symbol-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #27ae60;
}

.symbol-icon-wrap {
  font-size: 2.2rem;
  margin: 0.4rem 0;
}

.symbol-latin-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.symbol-origin-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Reglas */
.rules-tabs-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.rule-tab-btn {
  background: #f8f9fa;
  border: 1.5px solid #ded5c5;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  transition: var(--transition);
}

.rule-tab-btn:hover {
  background: var(--aegean-light);
  color: var(--aegean-dark);
}

.rule-tab-btn.active {
  background: var(--aegean-blue);
  border-color: var(--aegean-dark);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.rule-detail-card {
  background: #fdfbf7;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.rule-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rule-card-header h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--aegean-dark);
}

.rule-pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-xl);
}

.badge-neutral {
  background: #edf2f7;
  color: #4a5568;
}

.badge-special {
  background: #f4ecf7;
  color: #8e44ad;
}

.rule-main-desc {
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.rule-bullets {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.rule-bullet-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.98rem;
  color: var(--text-secondary);
}

.bullet-arrow {
  color: var(--gold-primary);
  font-size: 1.1rem;
}

.examples-title {
  font-size: 0.92rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.examples-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.ex-mini-card {
  background: #ffffff;
  border: 1.5px solid #ded5c5;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ex-roman {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: #b7791f;
}

.ex-calc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Sandbox / Laboratorio de Reglas */
.sandbox-builder-card {
  background: #fdfcf9;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.sandbox-visor {
  background: #ffffff;
  border: 2px dashed #ded4c5;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.visor-tag {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.sandbox-tiles-stream {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.sandbox-placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

.sandbox-active-tile {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: #b7791f;
  background: #fef9e7;
  border: 2px solid #f9e79f;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.visor-actions {
  display: flex;
  gap: 0.5rem;
}

.sandbox-btn-util {
  background: #f8f9fa;
  border: 1.5px solid #ced4da;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.sandbox-btn-util:hover {
  background: #e9ecef;
  color: var(--text-primary);
}

.sandbox-tiles-picker {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.sandbox-tile-btn {
  background: linear-gradient(135deg, #fef9e7 0%, #fff1b8 100%);
  border: 2px solid #f39c12;
  border-radius: var(--radius-md);
  color: #8c5304;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  padding: 0.85rem 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #d68910;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.sandbox-tile-btn span {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: #8c5304;
  font-weight: 600;
}

.sandbox-tile-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 #d68910;
}

.sandbox-tile-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #d68910;
}

.sandbox-status-card {
  padding: 1.35rem;
  border-radius: var(--radius-md);
}

.sandbox-status-card.valid-card {
  background: #eafaf1;
  border: 2px solid #a9dfbf;
}

.sandbox-status-card.invalid-card {
  background: #fdedec;
  border: 2px solid #f5b7b1;
}

.status-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.status-badge-ok {
  color: #1e8449;
  font-weight: 700;
  font-size: 1rem;
}

.status-badge-err {
  color: #c0392b;
  font-weight: 700;
  font-size: 1rem;
}

.eval-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: #16a085;
}

.status-explanation {
  font-size: 0.98rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.eval-breakdown-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.eval-token-pill {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
}

.eval-token-pill.additive {
  background: #d5f5e3;
  color: #1e8449;
}

.eval-token-pill.subtractive {
  background: #fadbd8;
  color: #c0392b;
}

.suggestion-row {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.apply-suggestion-btn {
  background: var(--gold-secondary);
  color: #5d3600;
  border: 1.5px solid #d68910;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #b38848;
}

/* ==========================================================================
   RELOJ ROMANO (Reloj de Sol Mediterráneo Infantil)
   ========================================================================== */

.clock-special-section {
  margin-top: 2rem;
}

.clock-showcase-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: center;
}

@media (max-width: 850px) {
  .clock-showcase-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.clock-widget-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.roman-clock-dial {
  width: 270px;
  height: 270px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fefcf6 70%, #f6ecd6 100%);
  border: 8px solid #f1c40f;
  box-shadow: 
    0 12px 30px rgba(243, 156, 18, 0.2),
    inset 0 0 15px rgba(241, 196, 15, 0.2),
    0 0 0 4px #e0a526;
  position: relative;
}

.clock-face {
  width: 100%;
  height: 100%;
  position: relative;
}

.clock-center-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e67e22;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.clock-hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom center;
  border-radius: 6px;
  z-index: 5;
}

.hand-hour {
  width: 6px;
  height: 65px;
  background: #d35400;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.hand-minute {
  width: 4px;
  height: 90px;
  background: #2980b9;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.hand-second {
  width: 2px;
  height: 100px;
  background: #e74c3c;
  z-index: 8;
}

.dial-mark {
  position: absolute;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: #7d4e04;
  transform: translate(-50%, -50%);
}

.dial-12 { top: 12%; left: 50%; }
.dial-1  { top: 17%; left: 70%; }
.dial-2  { top: 30%; left: 83%; }
.dial-3  { top: 50%; left: 88%; }
.dial-4  { top: 70%; left: 83%; }
.dial-5  { top: 83%; left: 70%; }
.dial-6  { top: 88%; left: 50%; }
.dial-7  { top: 83%; left: 30%; }
.dial-8  { top: 70%; left: 17%; }
.dial-9  { top: 50%; left: 12%; }
.dial-10 { top: 30%; left: 17%; }
.dial-11 { top: 17%; left: 30%; }

.clock-toggle-bar {
  display: flex;
  gap: 0.5rem;
}

.clock-mode-btn {
  background: #ffffff;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.clock-mode-btn.active {
  background: #fef9e7;
  color: #b7791f;
  border-color: #f1c40f;
  box-shadow: 0 3px 8px rgba(241, 196, 15, 0.25);
}

.clock-realtime-readout {
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: center;
  font-weight: 600;
}

.clock-realtime-readout strong {
  color: #d35400;
  font-family: var(--font-serif);
}

.readout-arabic {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.clock-story-explanation h4 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--aegean-dark);
  margin-bottom: 0.75rem;
}

.clock-story-explanation p {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
}

/* ==========================================================================
   PESTAÑA 3: ARENA DE PRÁCTICA (Divertida y Gamificada)
   ========================================================================== */

.practice-modes-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.practice-nav-tab {
  background: #ffffff;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 4px 0 #ded5c5;
  transition: var(--transition);
}

.practice-nav-tab:hover {
  background: var(--aegean-light);
  color: var(--aegean-dark);
  transform: translateY(-2px);
}

.practice-nav-tab.active {
  background: var(--aegean-blue);
  border-color: var(--aegean-dark);
  color: #ffffff;
  box-shadow: 0 4px 0 #1b6ca8;
}

.practice-view-pane {
  display: none;
}

.practice-view-pane.active {
  display: block;
  animation: popIn 0.25s ease-out;
}

/* MODO 1: CUESTIONARIO */
.quiz-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.difficulty-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

.diff-selector-btn {
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}

.diff-selector-btn.active {
  background: #fef9e7;
  color: #b7791f;
  border-color: #f1c40f;
  box-shadow: 0 2px 6px rgba(241, 196, 15, 0.3);
}

.score-pills-row {
  display: flex;
  gap: 0.75rem;
}

.score-pill {
  background: #ffffff;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 0.45rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
}

.score-pill strong {
  color: #d35400;
}

.quiz-arena-card {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-card);
}

.question-header {
  text-align: center;
  margin-bottom: 2rem;
}

.question-subtitle {
  font-size: 0.9rem;
  color: var(--aegean-blue);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.question-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-top: 0.5rem;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.quiz-opt-btn {
  background: #fdfcf9;
  border: 2px solid #e0d5c3;
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 4px 0 #ded5c5;
  transition: var(--transition);
}

.quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--aegean-blue);
  background: #e3f2fd;
  color: var(--aegean-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #90caf9;
}

.quiz-opt-btn.opt-correct {
  background: #eafaf1 !important;
  border-color: #2ecc71 !important;
  color: #1e8449 !important;
  box-shadow: 0 4px 0 #27ae60 !important;
}

.quiz-opt-btn.opt-wrong {
  background: #fdedec !important;
  border-color: #e74c3c !important;
  color: #c0392b !important;
  box-shadow: 0 4px 0 #c0392b !important;
}

.quiz-feedback {
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.feedback-correct {
  background: #eafaf1;
  border: 2px solid #a9dfbf;
}

.feedback-wrong {
  background: #fdedec;
  border: 2px solid #f5b7b1;
}

.feedback-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  font-size: 1.15rem;
}

.feedback-correct .feedback-title { color: #1e8449; }
.feedback-wrong .feedback-title { color: #c0392b; }

.feedback-text {
  font-size: 0.98rem;
  color: var(--text-primary);
}

.quiz-footer-actions {
  display: flex;
  justify-content: flex-end;
}

.primary-action-btn {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.95rem 1.95rem;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 #b35900, 0 8px 18px rgba(243, 156, 18, 0.3);
  transition: var(--transition);
}

.primary-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #b35900, 0 12px 24px rgba(243, 156, 18, 0.4);
}

.primary-action-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b35900;
}

/* MODO 2: CONSTRUCTOR ROMANO */
.builder-card {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.builder-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.target-big-num {
  font-size: 3rem;
  font-weight: 700;
  color: #16a085;
  display: block;
}

.target-hint {
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.refresh-target-btn {
  background: #fef9e7;
  border: 2px solid #f9e79f;
  border-radius: var(--radius-md);
  color: #b7791f;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #e4c386;
  transition: var(--transition);
}

.refresh-target-btn:hover {
  background: #f1c40f;
  color: #5d3600;
  transform: translateY(-2px);
}

.builder-workspace {
  background: #fdfcf9;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.workspace-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.val-valid {
  color: #16a085;
  font-weight: 700;
}

.val-invalid {
  color: #e74c3c;
  font-weight: 600;
}

.builder-chips-track {
  min-height: 75px;
  background: #ffffff;
  border: 2px dashed #ded4c5;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.builder-empty-hint {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

.builder-token-chip {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: #b7791f;
  background: #fef9e7;
  border: 2px solid #f9e79f;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.85rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.builder-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.builder-tool-btn {
  background: #f8f9fa;
  border: 1.5px solid #ced4da;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 0.55rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.builder-tool-btn:hover {
  background: #e9ecef;
  color: var(--text-primary);
}

.builder-check-btn {
  background: #27ae60;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.35rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #1e8449;
  transition: var(--transition);
}

.builder-check-btn:hover {
  background: #2ecc71;
  transform: translateY(-2px);
}

.builder-coins-deck {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.builder-coin-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef3c7 0%, #f59e0b 60%, #b45309 100%);
  border: 3px solid #fde68a;
  box-shadow: 0 4px 10px rgba(180, 83, 9, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  color: #ffffff;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.builder-coin-btn span {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: -3px;
}

.builder-coin-btn:hover {
  transform: translateY(-5px) scale(1.08);
  box-shadow: 0 8px 18px rgba(180, 83, 9, 0.4);
}

.next-challenge-btn {
  margin-top: 0.75rem;
  background: #27ae60;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.15rem;
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
}

/* MODO 3: COLISEO CONTRARRELOJ */
.coliseum-card {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.coliseum-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  background: #fdfcf9;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 2px solid var(--border-subtle);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.hud-val {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hud-time .hud-val { color: #d35400; }
.hud-score .hud-val { color: #27ae60; }
.hud-streak .hud-val { color: #e74c3c; }

.coliseum-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

.overlay-welcome-card,
.coliseum-end-card {
  text-align: center;
  max-width: 520px;
}

.arena-icon, .end-trophy {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.overlay-welcome-card h3,
.coliseum-end-card h3 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--aegean-dark);
  margin-bottom: 0.75rem;
}

.overlay-welcome-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
}

.coliseum-big-start-btn {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-xl);
  padding: 1rem 2.5rem;
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 #962d22, 0 10px 24px rgba(231, 76, 60, 0.35);
  transition: var(--transition);
}

.coliseum-big-start-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 6px 0 #962d22, 0 14px 28px rgba(231, 76, 60, 0.45);
}

.coliseum-gameplay {
  text-align: center;
}

.coliseum-prompt-card {
  margin-bottom: 2rem;
}

.coliseum-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

.coliseum-big-arabic {
  display: block;
  font-size: 4.5rem;
  font-weight: 700;
  color: #16a085;
  line-height: 1.1;
  margin-top: 0.35rem;
}

.coliseum-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.coliseum-opt-btn {
  background: #fdfcf9;
  border: 2px solid #ded5c5;
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 4px 0 #ded5c5;
  transition: var(--transition);
}

.coliseum-opt-btn:hover {
  border-color: var(--aegean-blue);
  background: #e3f2fd;
}

.coliseum-opt-btn.correct-flash {
  background: #a9dfbf !important;
  border-color: #27ae60 !important;
}

.coliseum-opt-btn.wrong-flash {
  background: #f5b7b1 !important;
  border-color: #c0392b !important;
}

.coliseum-cancel-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* Galería de Medallas */
.achievements-section {
  margin-top: 3rem;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.badge-card {
  background: #ffffff;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.badge-card.unlocked {
  border-color: var(--gold-secondary);
  background: linear-gradient(135deg, #ffffff 0%, #fefcf4 100%);
  box-shadow: 0 6px 18px rgba(241, 196, 15, 0.2);
}

.badge-card.locked {
  opacity: 0.6;
  filter: grayscale(0.8);
}

.badge-icon-wrap {
  font-size: 2.4rem;
}

.badge-title {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.badge-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.badge-status {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.badge-card.unlocked .badge-status { color: #d68910; }
.badge-card.locked .badge-status { color: var(--text-muted); }

/* Notificación Flotante de Medalla */
.achievement-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  background: #ffffff;
  border: 2.5px solid var(--gold-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 0 20px rgba(243, 156, 18, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  font-size: 2.4rem;
}

.toast-tag {
  display: block;
  font-size: 0.78rem;
  color: #b7791f;
  text-transform: uppercase;
  font-weight: 700;
}

.toast-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   PESTAÑA 4: CRÓNICAS DE LA HISTORIA (Acuarela Ilustrada)
   ========================================================================== */

.history-timeline-section {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
}

.timeline-stepper-track {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 0.5rem 0 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px dashed #ded4c5;
  scrollbar-width: thin;
}

.timeline-step-node {
  background: #fdfcf9;
  border: 2px solid #e0d5c3;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 135px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
}

.timeline-step-node:hover {
  background: var(--aegean-light);
  border-color: var(--aegean-blue);
  transform: translateY(-2px);
}

.timeline-step-node.active {
  background: #e3f2fd;
  border-color: var(--aegean-blue);
  color: var(--aegean-dark);
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
}

.node-year {
  font-size: 0.85rem;
  font-weight: 700;
}

.node-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-primary);
  box-shadow: 0 0 6px rgba(243, 156, 18, 0.5);
}

.node-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.timeline-card-content {
  background: #fdfcf9;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2rem;
}

.timeline-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.timeline-year-badge {
  background: #fef9e7;
  color: #b7791f;
  border: 1.5px solid #f9e79f;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-xl);
}

.timeline-tag-pill {
  background: #f4ecf7;
  color: #8e44ad;
  border: 1.5px solid #d7bde2;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-xl);
}

.timeline-icon-big {
  margin-left: auto;
  font-size: 2.2rem;
}

.timeline-story-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  color: var(--aegean-dark);
  margin-bottom: 0.75rem;
}

.timeline-summary-lead {
  font-size: 1.15rem;
  color: #b7791f;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  font-weight: 600;
}

.timeline-rich-body {
  font-size: 1.02rem;
  color: var(--text-primary);
  line-height: 1.7;
}

.history-list {
  margin: 1rem 0 1rem 1.5rem;
}

.history-list li {
  margin-bottom: 0.5rem;
}

.historical-quote {
  background: #fefcf4;
  border-left: 4px solid var(--gold-primary);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  margin: 1.25rem 0;
  color: #6d4c1b;
}

/* 3 Pilares */
.revolution-pillars-section {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.pillar-card {
  background: #fdfcf9;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: var(--transition);
}

.pillar-card:hover {
  transform: translateY(-4px);
  border-color: var(--aegean-blue);
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.12);
}

.pillar-icon {
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
}

.pillar-card h4 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--aegean-dark);
  margin-bottom: 0.75rem;
}

.pillar-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Simulador Comparativo */
.comparison-lab-section {
  background: #ffffff;
  border: 2.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.comparison-input-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #fdfcf9;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.factor-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.factor-group label {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 700;
}

.factor-group input {
  width: 75px;
  background: #ffffff;
  border: 2px solid #ced4da;
  border-radius: var(--radius-sm);
  color: #16a085;
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  padding: 0.4rem;
  outline: none;
}

.mult-sign {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-muted);
}

.run-calc-btn {
  background: var(--aegean-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.35rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #1b6ca8;
  transition: var(--transition);
}

.run-calc-btn:hover {
  background: #2980b9;
  transform: translateY(-2px);
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.system-column {
  background: #fdfcf9;
  border-radius: var(--radius-md);
  padding: 1.75rem;
  border: 2px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.col-roman {
  border-top: 5px solid #e74c3c;
}

.col-arabic {
  border-top: 5px solid #2ecc71;
}

.col-head {
  text-align: center;
  margin-bottom: 1.5rem;
}

.col-head h4 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-primary);
  margin: 0.35rem 0 0.2rem;
}

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

.operation-prompt {
  background: #ffffff;
  border: 1.5px dashed #ded4c5;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  text-align: center;
}

.math-expr {
  display: block;
  font-size: 1.45rem;
  font-weight: 700;
  color: #b7791f;
}

.roman-expr, .arabic-expr {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.procedure-box {
  flex-grow: 1;
  font-size: 0.95rem;
  line-height: 1.5;
}

.steps-list {
  margin: 0.75rem 0 0.75rem 1.25rem;
}

.steps-list li {
  margin-bottom: 0.6rem;
}

.distrib-box {
  background: #fdedec;
  border: 1px solid #f5b7b1;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  margin: 0.4rem 0;
  font-size: 0.85rem;
  color: #c0392b;
  font-weight: 600;
}

.paper-multiplication {
  font-family: monospace;
  font-size: 1.35rem;
  background: #ffffff;
  border: 2px solid #a9dfbf;
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  display: inline-block;
  margin: 0.5rem 0 1rem;
}

.step-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.bold-result {
  color: #16a085;
  font-weight: 900;
}

.arabic-merit {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.col-footer-stat {
  margin-top: 1.5rem;
  text-align: center;
}

.stat-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius-xl);
}

.stat-hard {
  background: #fdedec;
  color: #c0392b;
  border: 1.5px solid #f5b7b1;
}

.stat-easy {
  background: #eafaf1;
  color: #1e8449;
  border: 1.5px solid #a9dfbf;
}

/* ==========================================================================
   FOOTER (Acuarela)
   ========================================================================== */

.app-footer {
  border-top: 2px solid #ecdcc8;
  background: #ffffff;
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.footer-quote {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: #b7791f;
  margin-bottom: 0.5rem;
}

.footer-copy {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   RESPONSIVIDAD MÓVIL Y TABLET
   ========================================================================== */

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

  .converter-flow-divider {
    transform: rotate(90deg);
  }

  .abacus-grooves-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .hud-val {
    font-size: 1.35rem;
  }
}

@media (max-width: 600px) {
  .brand-monogram {
    min-width: 90px;
    height: 42px;
    font-size: 1.1rem;
    letter-spacing: 2px;
    padding: 0 0.85rem;
  }

  .brand-title {
    font-size: 1.25rem;
  }

  .header-container {
    padding: 0.75rem 1rem;
  }

  .tab-heading {
    font-size: 1.7rem;
  }

  .hero-arabic, .hero-roman {
    font-size: 2rem;
  }

  .coliseum-options-grid {
    grid-template-columns: 1fr;
  }

  .abacus-slot {
    width: 48px;
  }

  .bead {
    width: 38px;
    height: 28px;
  }

  .primary-number-input,
  .primary-roman-input {
    font-size: 1.35rem;
  }
}

/* ==========================================================================
   MODO OSCURO: MÁRMOL IMPERIAL & ORO ROMANO (Tema Clásico Anterior)
   ========================================================================== */

body.dark-theme {
  --bg-space: #0b0d13;
  --bg-card: rgba(22, 26, 38, 0.88);
  --bg-card-hover: rgba(28, 33, 50, 0.96);
  --bg-input: rgba(12, 15, 23, 0.92);

  --aegean-blue: #f5c542;
  --aegean-dark: #f5c542;
  --aegean-light: rgba(245, 197, 66, 0.12);
  --aegean-glow: rgba(245, 197, 66, 0.25);

  --gold-primary: #f5c542;
  --gold-secondary: #d4af37;
  --gold-dark: #99751e;
  --gold-light: rgba(245, 197, 66, 0.12);
  --gold-glow: rgba(245, 197, 66, 0.28);

  --terracotta: #c94a38;
  --terracotta-light: rgba(201, 74, 56, 0.15);
  --subtractive-red: #ff5964;
  --subtractive-light: rgba(255, 89, 100, 0.18);

  --laurel-green: #2ec4b6;
  --additive-green: #2ecc71;
  --green-light: rgba(46, 204, 113, 0.15);

  --purple-tyrian: #6f2dbd;
  --purple-light: rgba(111, 45, 189, 0.22);

  --text-primary: #f8f6f0;
  --text-secondary: #c2c6d4;
  --text-muted: #838a9d;

  --border-subtle: rgba(212, 175, 55, 0.2);
  --border-active: rgba(245, 197, 66, 0.65);
  --border-pencil: rgba(212, 175, 55, 0.25);

  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 6px 0 #12151f;
  --shadow-btn: 0 4px 0 #7a5814;
}

/* Fondo ambiente en modo noche */
body.dark-theme .background-ambient {
  background: 
    radial-gradient(circle at 10% 15%, rgba(111, 45, 189, 0.16) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(212, 175, 55, 0.14) 0%, transparent 50%),
    radial-gradient(circle at 50% 85%, rgba(201, 74, 56, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, #090b10 0%, #11141e 100%);
}

body.dark-theme .watercolor-blob {
  opacity: 0.15;
  filter: blur(80px);
}

body.dark-theme .bg-illustration {
  opacity: 0.45;
}

body.dark-theme .svg-roman-column rect,
body.dark-theme .svg-roman-column path {
  filter: brightness(0.65) sepia(0.35) contrast(1.1);
}

body.dark-theme .svg-arabic-art text {
  fill: #ffd166 !important;
}

body.dark-theme .svg-arabic-art path {
  filter: brightness(0.85);
}

/* Header & Nav en Modo Oscuro */
body.dark-theme .app-header {
  background: rgba(11, 13, 19, 0.94);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

body.dark-theme .brand-title {
  background: linear-gradient(120deg, #ffffff 30%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark-theme .brand-tagline {
  color: var(--text-muted);
}

body.dark-theme .brand-monogram {
  background: linear-gradient(135deg, #2b2316 0%, #151822 100%);
  border-color: var(--gold-secondary);
  color: var(--gold-primary);
  box-shadow: 0 4px 18px var(--gold-glow);
}

body.dark-theme .theme-toggle-btn {
  background: rgba(245, 197, 66, 0.12);
  border-color: var(--gold-secondary);
  color: var(--gold-primary);
}

body.dark-theme .theme-toggle-btn:hover {
  background: rgba(245, 197, 66, 0.25);
  color: #ffffff;
}

body.dark-theme .main-tabs-nav {
  border-top-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .main-nav-btn {
  color: var(--text-muted);
}

body.dark-theme .main-nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

body.dark-theme .main-nav-btn.active {
  color: var(--gold-primary);
  background: rgba(245, 197, 66, 0.12);
  border-bottom-color: var(--gold-primary);
}

/* Tarjetas y Contenedores */
body.dark-theme .converter-card,
body.dark-theme .roman-keypad-panel,
body.dark-theme .presets-section,
body.dark-theme .slider-interactive-bar,
body.dark-theme .breakdown-section,
body.dark-theme .breakdown-hero-card,
body.dark-theme .place-card,
body.dark-theme .math-equation-banner,
body.dark-theme .learn-sub-section,
body.dark-theme .symbol-card,
body.dark-theme .rule-detail-card,
body.dark-theme .sandbox-builder-card,
body.dark-theme .quiz-arena-card,
body.dark-theme .builder-card,
body.dark-theme .coliseum-card,
body.dark-theme .badge-card,
body.dark-theme .history-timeline-section,
body.dark-theme .timeline-card-content,
body.dark-theme .revolution-pillars-section,
body.dark-theme .pillar-card,
body.dark-theme .comparison-lab-section,
body.dark-theme .system-column,
body.dark-theme .app-footer {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-card);
}

body.dark-theme .tab-heading,
body.dark-theme .section-title,
body.dark-theme .sub-header-bar h3,
body.dark-theme .rule-card-header h3,
body.dark-theme .timeline-story-title,
body.dark-theme .pillar-card h4,
body.dark-theme .col-head h4,
body.dark-theme .clock-story-explanation h4,
body.dark-theme .overlay-welcome-card h3,
body.dark-theme .coliseum-end-card h3 {
  color: var(--gold-primary);
}

body.dark-theme .primary-number-input,
body.dark-theme .primary-roman-input {
  background: var(--bg-input);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

body.dark-theme .primary-roman-input {
  color: var(--gold-primary);
}

body.dark-theme .roman-keypad-btn,
body.dark-theme .preset-pill,
body.dark-theme .step-btn,
body.dark-theme .diff-selector-btn,
body.dark-theme .quiz-opt-btn,
body.dark-theme .coliseum-opt-btn,
body.dark-theme .timeline-step-node,
body.dark-theme .builder-tool-btn,
body.dark-theme .sandbox-btn-util,
body.dark-theme .refresh-target-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  box-shadow: none;
}

body.dark-theme .roman-keypad-btn:hover,
body.dark-theme .preset-pill:hover,
body.dark-theme .step-btn:hover,
body.dark-theme .timeline-step-node:hover {
  background: rgba(245, 197, 66, 0.15);
  border-color: var(--gold-secondary);
  color: var(--gold-primary);
}

body.dark-theme .preset-pill.pill-chile {
  background: rgba(46, 196, 182, 0.12);
  border-color: rgba(46, 196, 182, 0.35);
  color: #a3f7bf;
}

body.dark-theme .preset-pill.pill-chile:hover {
  background: rgba(46, 196, 182, 0.25);
  border-color: var(--laurel-green);
  color: #ffffff;
}

body.dark-theme .place-card {
  background: rgba(14, 18, 27, 0.85);
}

body.dark-theme .place-roman-display,
body.dark-theme .sandbox-visor,
body.dark-theme .builder-chips-track,
body.dark-theme .operation-prompt,
body.dark-theme .paper-multiplication {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Ábaco en Modo Oscuro (Tabula Clásica Bronce/Mármol) */
body.dark-theme .abacus-frame {
  background: linear-gradient(145deg, #2b2318 0%, #171512 60%, #201a14 100%);
  border: 4px solid #5a462b;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 0 16px 40px rgba(0, 0, 0, 0.6);
}

body.dark-theme .abacus-column {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(209, 180, 116, 0.18);
}

body.dark-theme .abacus-title-plate {
  color: #d1b474;
  border-bottom: 1px solid rgba(209, 180, 116, 0.2);
}

body.dark-theme .abacus-divider {
  background: linear-gradient(180deg, #443522 0%, #1d170f 100%);
  border-top: 2px solid #6b5536;
  border-bottom: 2px solid #231b11;
}

body.dark-theme .slot-rail {
  background: linear-gradient(90deg, #111 0%, #2c251e 50%, #0d0a08 100%);
}

body.dark-theme .bead,
body.dark-theme .lower-bead {
  background: radial-gradient(circle at 35% 30%, #f6d37b 0%, #c49931 50%, #684a0d 100%);
  border: 1px solid #ffe69c;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* Reloj Romano en Modo Oscuro */
body.dark-theme .roman-clock-dial {
  background: radial-gradient(circle, #252018 0%, #151310 70%, #0c0b09 100%);
  border: 8px solid #5a462b;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 0 25px rgba(0, 0, 0, 0.9), 0 0 0 2px rgba(212, 175, 55, 0.3);
}

body.dark-theme .dial-mark {
  color: #d1b474;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

body.dark-theme .hand-hour {
  background: #f5c542;
}

body.dark-theme .hand-minute {
  background: #ffffff;
}

body.dark-theme .clock-mode-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

body.dark-theme .clock-mode-btn.active {
  background: var(--gold-secondary);
  color: #10121a;
  border-color: var(--gold-primary);
}

body.dark-theme .score-pill,
body.dark-theme .sub-info-pill,
body.dark-theme .timeline-year-badge {
  background: rgba(22, 26, 38, 0.8);
  border-color: var(--border-subtle);
  color: var(--gold-primary);
}
