/* ===== RESET Y CONFIGURACIÓN BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colores modo claro (default) */
  --primary: #4ecdc4;
  --primary-dark: #45b8b0;
  --secondary: #ff6b6b;
  --accent: #ffd166;
  --background: #f7f9fc;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --white: #ffffff;
  --success: #2ecc71;
  --warning: #f39c12;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
  --border-radius: 16px;
  --border-radius-sm: 8px;

  /* Variables para modo oscuro */
  --dark-bg: #1a1a2e;
  --dark-card: #16213e;
  --dark-text: #e2e8f0;
  --dark-text-light: #94a3b8;
  --dark-border: #2d3748;
}

body {
  font-family: "Arial Rounded MT Bold", "Arial", sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== MODO OSCURO ===== */
body.dark-mode {
  --background: var(--dark-bg);
  --card-bg: var(--dark-card);
  --text: var(--dark-text);
  --text-light: var(--dark-text-light);
  --white: var(--dark-card);
  background-color: var(--dark-bg);
  color: var(--dark-text);
}

/* ===== TIPOGRAFÍA ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: bold;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  color: var(--primary);
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* ===== LAYOUT GENERAL ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== PÁGINAS DE AUTENTICACIÓN ===== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  padding: 40px 20px;
}

.auth-card {
  background: var(--white);
  padding: 3rem 4rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  min-width: 500px;
  text-align: center;
  transition: all 0.3s ease;
}

/* Registro más ancho - diseño horizontal */
.registro-page .auth-card {
  max-width: 800px;
  min-width: 700px;
  padding: 3rem 4rem;
}

/* Para pantallas más grandes */
@media (min-width: 1200px) {
  .auth-card {
    max-width: 650px;
    padding: 4rem 5rem;
  }

  .registro-page .auth-card {
    max-width: 900px;
    padding: 4rem 5rem;
  }
}

/* Ajustes para móviles */
@media (max-width: 768px) {
  .auth-card {
    min-width: unset;
    max-width: 450px;
    padding: 2.5rem;
  }

  .registro-page .auth-card {
    min-width: unset;
    max-width: 450px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.5rem;
    max-width: 100%;
  }

  .registro-page .auth-card {
    padding: 2rem 1.5rem;
    max-width: 100%;
  }
}

body.dark-mode .auth-card {
  background: var(--dark-card);
  color: var(--dark-text);
}

.logo h1 {
  font-size: 3.2rem;
  margin-bottom: 1rem;
}

.logo p {
  color: var(--text-light);
  font-size: 1.3rem;
  margin-bottom: 2.5rem;
}

body.dark-mode .logo p {
  color: var(--dark-text-light);
}

/* ===== FORMULARIOS ===== */
.auth-form {
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}

/* Formulario de registro en grid de 2 columnas */
.registro-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2rem;
  max-width: 100%;
  margin: 0 auto;
}

/* Los grupos de formulario que ocupen 2 columnas */
.form-group-full {
  grid-column: 1 / -1;
}

/* Ajustar el botón para que ocupe todo el ancho */
.registro-form .btn-primary {
  grid-column: 1 / -1;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .registro-form {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-group-full {
    grid-column: 1;
  }
}

.form-group {
  margin-bottom: 1.8rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.8rem;
  font-weight: bold;
  color: var(--text);
  font-size: 1.2rem;
}

body.dark-mode .form-group label {
  color: var(--dark-text);
}

.form-group input {
  width: 100%;
  padding: 18px;
  border: 3px solid #e8f0fe;
  border-radius: var(--border-radius-sm);
  font-size: 1.2rem;
  font-family: "Arial Rounded MT Bold", sans-serif;
  transition: all 0.3s ease;
  background: var(--white);
  color: var(--text);
}

body.dark-mode .form-group input {
  background: var(--dark-bg);
  border-color: var(--dark-border);
  color: var(--dark-text);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.auth-links {
  margin-top: 2rem;
  text-align: center;
}

.auth-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.auth-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

body.dark-mode .auth-links a {
  color: var(--primary);
}

body.dark-mode .auth-links a:hover {
  color: var(--accent);
}

/* ===== BOTONES ===== */
.btn {
  display: inline-block;
  padding: 15px 30px;
  border: none;
  border-radius: var(--border-radius-sm);
  font-family: "Arial Rounded MT Bold", sans-serif;
  font-size: 1.1rem;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  width: 100%;
  font-size: 1.3rem;
  padding: 20px;
  margin-top: 1rem;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--accent);
  color: var(--text);
}

.btn-secondary:hover {
  background: #ffc44d;
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
}

/* ===== HEADER DE LA APLICACIÓN ===== */
.header {
  background: var(--white);
  box-shadow: var(--shadow);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

body.dark-mode .header {
  background: var(--dark-card);
  border-bottom: 1px solid var(--dark-border);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header .logo {
  font-size: 2rem;
  margin: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  font-weight: bold;
  color: var(--text);
  margin-right: 1rem;
}

body.dark-mode .user-info {
  color: var(--dark-text);
}

/* ===== SWITCH MODO OSCURO ===== */
.theme-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 1rem;
  color: var(--text);
}

body.dark-mode .theme-container {
  color: var(--dark-text);
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-light);
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: var(--white);
  transition: 0.4s;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  content: "";
  transform: translateX(26px);
}

/* ===== CONTENIDO PRINCIPAL ===== */
.app-page .main {
  padding: 2rem 0;
  min-height: calc(100vh - 80px);
}

.welcome-section {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

body.dark-mode .welcome-section {
  background: var(--dark-card);
  color: var(--dark-text);
}

.welcome-section h2 {
  color: var(--primary);
  margin-bottom: 1rem;
}

/* ===== TARJETAS DE JUEGO ===== */
.game-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.game-card {
  background: var(--white);
  padding: 2.5rem;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  border: 4px solid transparent;
}

body.dark-mode .game-card {
  background: var(--dark-card);
  color: var(--dark-text);
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.suma-card:hover {
  border-color: var(--primary);
}

.resta-card:hover {
  border-color: var(--secondary);
}

/* ===== VISTA DE EJERCICIOS ===== */
.exercises-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

body.dark-mode .exercises-header {
  background: var(--dark-card);
  color: var(--dark-text);
}

.progress-indicator {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary);
  background: var(--background);
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
}

body.dark-mode .progress-indicator {
  background: var(--dark-bg);
}

.exercises-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.exercise-card {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
  text-align: center;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode .exercise-card {
  background: var(--dark-card);
  color: var(--dark-text);
  border-color: var(--dark-border);
}

.exercise-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.exercise-card.completed {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}

.exercise-card.incorrect {
  background: var(--secondary);
  color: var(--white);
  border-color: var(--secondary);
}

.exercise-content {
  text-align: center;
}

.exercise-number {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

body.dark-mode .exercise-number {
  color: var(--dark-text-light);
}

.exercise-card.completed .exercise-number,
.exercise-card.incorrect .exercise-number {
  color: var(--white);
}

.exercise-problem {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text);
}

body.dark-mode .exercise-problem {
  color: var(--dark-text);
}

.exercise-card.completed .exercise-problem,
.exercise-card.incorrect .exercise-problem {
  color: var(--white);
}

/* ===== MODAL DE EJERCICIO EXPANDIDO ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transition: all 0.3s ease;
}

body.dark-mode .modal-content {
  background: var(--dark-card);
  color: var(--dark-text);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  border-bottom: 2px solid var(--background);
}

body.dark-mode .modal-header {
  border-bottom-color: var(--dark-border);
}

.modal-header h3 {
  margin: 0;
  color: var(--primary);
}

.exercise-display {
  padding: 2rem;
  text-align: center;
}

.problem-large {
  font-size: 3.5rem;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--background);
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
}

body.dark-mode .problem-large {
  background: var(--dark-bg);
  color: var(--dark-text);
}

.answer-display {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary);
  margin: 2rem 0;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  border-radius: var(--border-radius);
  border: 3px dashed var(--primary);
  transition: all 0.3s ease;
}

body.dark-mode .answer-display {
  background: var(--dark-bg);
  border-color: var(--primary);
}

/* ===== TECLADO VIRTUAL ===== */
.virtual-keyboard {
  margin-top: 2rem;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.key {
  width: 80px;
  height: 80px;
  border: none;
  background: var(--white);
  border: 3px solid var(--primary);
  border-radius: var(--border-radius-sm);
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Arial Rounded MT Bold", sans-serif;
}

body.dark-mode .key {
  background: var(--dark-card);
  border-color: var(--primary);
  color: var(--dark-text);
}

.key:hover {
  background: var(--primary);
  color: var(--white);
  transform: scale(1.05);
}

.key.special {
  background: var(--accent);
  border-color: var(--accent);
}

.key.special:hover {
  background: #ffc44d;
}

#submit-key {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}

#submit-key:hover {
  background: #27ae60;
}

/* ===== MENSAJES DE RETROALIMENTACIÓN ===== */
.feedback-message {
  padding: 1rem 2rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  border-top: 2px solid var(--background);
  transition: all 0.3s ease;
}

body.dark-mode .feedback-message {
  border-top-color: var(--dark-border);
}

.feedback-correct {
  background: var(--success);
  color: var(--white);
}

.feedback-incorrect {
  background: var(--secondary);
  color: var(--white);
}

/* ===== PÁGINA DE PERFIL ===== */
.profile-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

body.dark-mode .profile-header {
  background: var(--dark-card);
  color: var(--dark-text);
}

.avatar {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.user-email {
  color: var(--text-light);
  font-size: 1.1rem;
}

body.dark-mode .user-email {
  color: var(--dark-text-light);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: transform 0.3s ease;
}

body.dark-mode .stat-card {
  background: var(--dark-card);
  color: var(--dark-text);
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-icon {
  font-size: 3rem;
  flex-shrink: 0;
}

.stat-info h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--text-light);
}

body.dark-mode .stat-info h3 {
  color: var(--dark-text-light);
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary);
}

.progress-charts {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

body.dark-mode .progress-charts {
  background: var(--dark-card);
  color: var(--dark-text);
}

.chart-section {
  margin-bottom: 2rem;
}

.chart-section:last-child {
  margin-bottom: 0;
}

.chart-section h3 {
  margin-bottom: 1rem;
  color: var(--text);
}

body.dark-mode .chart-section h3 {
  color: var(--dark-text);
}

.progress-bar {
  width: 100%;
  height: 25px;
  background: var(--background);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

body.dark-mode .progress-bar {
  background: var(--dark-bg);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  transition: width 0.5s ease;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 2rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .exercises-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .game-cards {
    grid-template-columns: 1fr;
  }

  .key {
    width: 60px;
    height: 60px;
    font-size: 1.4rem;
  }

  .problem-large {
    font-size: 2.5rem;
  }

  .modal-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .progress-stats,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .keyboard-row {
    gap: 5px;
  }

  .key {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
}

/* ===== ANIMACIONES ===== */
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.bounce {
  animation: bounce 0.6s;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.pulse {
  animation: pulse 0.3s ease-in-out;
}

/* ===== MENSAJES DE ALERTA ===== */
.error-message {
  background: var(--secondary);
  color: var(--white);
  padding: 1rem;
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: bold;
}

.success-message {
  background: var(--success);
  color: var(--white);
  padding: 1rem;
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: bold;
}

/* ===== ANIMACIONES ESPECÍFICAS PARA EJERCICIOS ===== */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.exercise-card {
  animation: slideIn 0.5s ease-out;
}

.exercise-card:nth-child(1) {
  animation-delay: 0.1s;
}
.exercise-card:nth-child(2) {
  animation-delay: 0.2s;
}
.exercise-card:nth-child(3) {
  animation-delay: 0.3s;
}
.exercise-card:nth-child(4) {
  animation-delay: 0.4s;
}
.exercise-card:nth-child(5) {
  animation-delay: 0.5s;
}
.exercise-card:nth-child(6) {
  animation-delay: 0.6s;
}
.exercise-card:nth-child(7) {
  animation-delay: 0.7s;
}
.exercise-card:nth-child(8) {
  animation-delay: 0.8s;
}

/* Transición suave para el modal */
.modal-content {
  animation: slideIn 0.3s ease-out;
}

/* Efecto de pulso para la respuesta */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.pulse {
  animation: pulse 0.3s ease-in-out;
}

/* Efecto de shake para respuestas incorrectas */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* ===== MEJORAS PARA EL SISTEMA DE EJERCICIOS ===== */
.feedback-info {
  background: var(--accent);
  color: var(--text);
}

/* Progress bar para ejercicios */
.session-progress {
  width: 100%;
  height: 8px;
  background: var(--background);
  border-radius: 4px;
  margin: 10px 0;
  overflow: hidden;
}

.session-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

body.dark-mode .session-progress {
  background: var(--dark-bg);
}

/* Timer */
.timer {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary);
  background: var(--background);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
}

body.dark-mode .timer {
  background: var(--dark-bg);
}

/* Mejoras para ejercicios completados */
.exercise-card.completed {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
  cursor: default;
}

.exercise-card.completed:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.exercise-card.completed .exercise-problem {
  color: var(--white);
}

.exercise-card.incorrect {
  background: var(--secondary);
  color: var(--white);
  border-color: var(--secondary);
  cursor: default;
}

.exercise-card.incorrect:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.exercise-card.incorrect .exercise-problem {
  color: var(--white);
}

/* Animación para confeti */
@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--primary);
  animation: confetti 2s ease-in-out forwards;
  pointer-events: none;
  z-index: 10000;
}

/* ===== SISTEMA DE NIVELES Y LOGROS ===== */
.level-card {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  text-align: center;
}

body.dark-mode .level-card {
  background: var(--dark-card);
}

.level-badge {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 1rem;
}

.exp-bar {
  width: 100%;
  height: 20px;
  background: var(--background);
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem 0;
}

.exp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 10px;
  transition: width 0.5s ease;
}

.exp-text {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: bold;
}

body.dark-mode .exp-bar {
  background: var(--dark-bg);
}

/* Logros */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.achievement-card {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left: 4px solid var(--accent);
}

body.dark-mode .achievement-card {
  background: var(--dark-card);
}

.achievement-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.achievement-info h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
}

.achievement-info p {
  margin: 0 0 0.5rem 0;
  color: var(--text-light);
  font-size: 0.9rem;
}

.achievement-info small {
  color: var(--text-light);
  font-size: 0.8rem;
}

body.dark-mode .achievement-info h4 {
  color: var(--dark-text);
}

body.dark-mode .achievement-info p,
body.dark-mode .achievement-info small {
  color: var(--dark-text-light);
}

/* ===== ESPACIADO ESPECÍFICO PARA DASHBOARD ===== */

/* Sección de estadísticas */
.stats-section {
  margin-bottom: 2.5rem;
  padding: 2rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

/* Sección de logros */
.achievements-section {
  margin-top: 1rem;
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

/* Aumentar espacio entre tarjetas de logros */
.achievements-grid {
  gap: 1.5rem; /* Aumentado de 1rem a 1.5rem */
  margin-top: 1.5rem;
}

.achievement-card {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
}

/* Modo oscuro */
body.dark-mode .stats-section,
body.dark-mode .achievements-section {
  background: var(--dark-card);
}

/* Ajustar el level-card */
.level-card {
  margin-bottom: 2.5rem;
  padding: 2.5rem;
}

/* Game cards con más espacio */
.game-cards {
  margin-bottom: 3rem;
  gap: 2.5rem;
}

/* Welcome section con más espacio */
.welcome-section {
  margin-bottom: 2.5rem;
  padding: 2.5rem;
}

/* ===== SOLUCIÓN INMEDIATA - FORZAR VISIBILIDAD ===== */
body.dark-mode .exercise-card.completed,
body.dark-mode .exercise-card.completed * {
  background: #27ae60 !important;
  color: white !important;
  border-color: #27ae60 !important;
}

body.dark-mode .exercise-card.incorrect,
body.dark-mode .exercise-card.incorrect * {
  background: #e74c3c !important;
  color: white !important;
  border-color: #e74c3c !important;
}

/* Asegurar que TODO el texto sea blanco */
body.dark-mode .exercise-card.completed .exercise-number,
body.dark-mode .exercise-card.completed .exercise-problem,
body.dark-mode .exercise-card.completed div,
body.dark-mode .exercise-card.completed span,
body.dark-mode .exercise-card.incorrect .exercise-number,
body.dark-mode .exercise-card.incorrect .exercise-problem,
body.dark-mode .exercise-card.incorrect div,
body.dark-mode .exercise-card.incorrect span {
  color: white !important;
  font-weight: bold;
}

/* ===== MODAL DE CONFIRMACIÓN PERSONALIZADO ===== */
#reset-modal .modal-content {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s ease-out;
}

body.dark-mode #reset-modal .modal-content {
  background: var(--dark-card);
  color: var(--dark-text);
}

#reset-modal .modal-header {
  background: linear-gradient(135deg, var(--accent), var(--warning));
  color: var(--text);
  padding: 1.5rem;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

body.dark-mode #reset-modal .modal-header {
  color: var(--dark-text);
}

#reset-modal .modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

#reset-modal .exercise-display {
  padding: 2rem;
}

#reset-modal h3 {
  color: var(--text);
  margin-bottom: 1rem;
}

body.dark-mode #reset-modal h3 {
  color: var(--dark-text);
}

#reset-modal p {
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 0;
}

body.dark-mode #reset-modal p {
  color: var(--dark-text-light);
}

/* Botones del modal de confirmación */
#reset-modal .btn {
  min-width: 120px;
  padding: 12px 20px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

#reset-modal .btn-outline {
  border: 2px solid var(--text-light);
  color: var(--text-light);
}

#reset-modal .btn-outline:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: transparent;
  transform: translateY(-2px);
}

#reset-modal .btn-primary {
  background: var(--primary);
  border: 2px solid var(--primary);
}

#reset-modal .btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
}

/* Animación para el modal */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Efecto de shake para enfatizar la advertencia */
@keyframes warningShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

#reset-modal .exercise-display {
  animation: warningShake 0.5s ease-in-out;
}

/* ===== SEPARACIÓN ENTRE SECCIONES DEL DASHBOARD ===== */

/* Aumentar espacio después de cada sección */
.progress-section {
  margin-bottom: 3rem !important;
  padding: 2.5rem !important;
}

/* Espacio específico para la sección de estadísticas */
.stats-section {
  margin-bottom: 3rem !important;
}

/* Espacio específico para la sección de logros */
.achievements-section {
  margin-top: 2rem !important;
  margin-bottom: 3rem !important;
}

/* Aumentar espacio entre tarjetas de logros */
.achievements-grid {
  gap: 1.5rem !important;
  margin-top: 2rem !important;
}

.achievement-card {
  margin-bottom: 1.5rem !important;
  padding: 1.5rem !important;
}

/* Más espacio alrededor del level-card */
.level-card {
  margin-bottom: 3rem !important;
  padding: 2.5rem !important;
}

/* Más espacio alrededor de las game-cards */
.game-cards {
  margin-bottom: 3rem !important;
  gap: 2.5rem !important;
}

/* Asegurar que todas las secciones tengan buen espaciado */
.app-page .main .container > * {
  margin-bottom: 3rem !important;
}

.app-page .main .container > *:last-child {
  margin-bottom: 2rem !important;
}

/* Separación adicional específica para dashboard */
.welcome-section {
  margin-bottom: 3rem !important;
  padding: 2.5rem !important;
}

/* ===== ESTILOS ESPECÍFICOS PARA PERFIL ===== */

.profile-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2.5rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

body.dark-mode .profile-header {
  background: var(--dark-card);
  color: var(--dark-text);
}

.avatar {
  font-size: 5rem;
  margin-bottom: 1rem;
}

.level-badge-profile {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  margin-top: 1rem;
}

/* Barra de experiencia grande para perfil */
.exp-bar-large {
  width: 100%;
  height: 25px;
  background: var(--background);
  border-radius: 12px;
  overflow: hidden;
  margin: 1.5rem 0;
}

.exp-fill-large {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 12px;
  transition: width 0.5s ease;
}

.exp-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-light);
}

body.dark-mode .exp-bar-large {
  background: var(--dark-bg);
}

/* Gráficos de progreso */
.progress-charts {
  background: var(--white);
  padding: 2.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 3rem;
}

body.dark-mode .progress-charts {
  background: var(--dark-card);
  color: var(--dark-text);
}

.chart-section {
  margin-bottom: 2rem;
}

.chart-section:last-child {
  margin-bottom: 0;
}

.chart-section h3 {
  margin-bottom: 1rem;
  color: var(--text);
}

body.dark-mode .chart-section h3 {
  color: var(--dark-text);
}

.chart-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-light);
}

body.dark-mode .chart-stats {
  color: var(--dark-text-light);
}

/* Sin logros */
.no-achievements {
  text-align: center;
  padding: 3rem;
  background: var(--background);
  border-radius: var(--border-radius);
  color: var(--text-light);
}

body.dark-mode .no-achievements {
  background: var(--dark-bg);
  color: var(--dark-text-light);
}

/* Ajustes de espaciado para perfil */
.stats-grid {
  margin-bottom: 3rem;
}

.achievements-section {
  margin-top: 2rem;
}

/* ===== HEADER DE PERFIL CON FONDO DIFUMINADO ===== */
.profile-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2.5rem;
  background: linear-gradient(
    135deg,
    rgba(78, 205, 196, 0.1) 0%,
    rgba(255, 209, 102, 0.1) 50%,
    rgba(255, 107, 107, 0.1) 100%
  );
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Efecto de partículas/brillo en el fondo */
.profile-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(78, 205, 196, 0.1) 0%,
    rgba(255, 209, 102, 0.05) 25%,
    rgba(255, 107, 107, 0.02) 50%,
    transparent 70%
  );
  animation: rotateBackground 20s linear infinite;
  z-index: -1;
}

@keyframes rotateBackground {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Modo oscuro - ajustar colores */
body.dark-mode .profile-header {
  background: linear-gradient(
    135deg,
    rgba(78, 205, 196, 0.15) 0%,
    rgba(255, 209, 102, 0.1) 50%,
    rgba(255, 107, 107, 0.08) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Contenido del header sobre el fondo difuminado */
.profile-header-content {
  position: relative;
  z-index: 2;
}

.avatar {
  font-size: 5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.level-badge-profile {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: bold;
  margin-top: 1rem;
  box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(5px);
}

.user-email {
  color: var(--text);
  font-size: 1.1rem;
  margin: 0.5rem 0;
  font-weight: 500;
}

body.dark-mode .user-email {
  color: var(--dark-text);
}

.profile-header h2 {
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 2.2rem;
}

body.dark-mode .profile-header h2 {
  color: var(--dark-text);
}

/* ===== SISTEMA DE AVATAR ===== */
.avatar-container {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
}

.avatar-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.avatar-wrapper:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.6);
}

.user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--primary);
}

.avatar-default {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.avatar-wrapper:hover .avatar-overlay {
  opacity: 1;
}

.avatar-upload-btn {
  color: white;
  background: var(--primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

.avatar-upload-btn:hover {
  background: var(--primary-dark);
}

/* Mensajes de subida */
.upload-message {
  margin-top: 1rem;
  padding: 10px 15px;
  border-radius: var(--border-radius-sm);
  font-weight: bold;
  text-align: center;
  transition: all 0.3s ease;
}

.upload-success {
  background: var(--success);
  color: white;
}

.upload-error {
  background: var(--secondary);
  color: white;
}

.upload-loading {
  background: var(--accent);
  color: var(--text);
}

/* Asegurar que el directorio de uploads tenga permisos */
.uploads-info {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  text-align: center;
}

.math-symbols-container {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.math-symbol {
  position: absolute;
  font-weight: bold;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
  font-family: "Poppins", sans-serif;
  z-index: 0;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.3s ease;
}

.math-particle {
  position: absolute;
  pointer-events: none;
}

/* Efecto de brillo al pasar el mouse */
.math-symbol:hover {
  filter: brightness(1.5);
  transform: scale(1.8) !important;
}

/* ESTILOS PARA NAVEGACIÓN ENTRE SECCIONES */
.seccion-navegacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin: 2rem 0;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.nav-btn {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.nav-btn:disabled {
  background: var(--disabled-color);
  cursor: not-allowed;
  opacity: 0.5;
}

.seccion-info {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-color);
  min-width: 120px;
  text-align: center;
}

/* INDICADORES DE SECCIONES */
.seccion-indicadores {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.indicador {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
  background: var(--card-bg);
  color: var(--text-color);
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
}

.indicador.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.indicador:hover:not(.active) {
  background: var(--primary-light);
  border-color: var(--primary-color);
  transform: scale(1.1);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .seccion-navegacion {
    gap: 1rem;
    padding: 0.8rem;
  }

  .nav-btn {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }

  .seccion-info {
    font-size: 1.1rem;
    min-width: 100px;
  }

  .indicador {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }
}

/* ✅ ESTILOS PARA OPERACIONES VERTICALES */
.exercise-problem-vertical {
  text-align: center;
  font-family: "Courier New", monospace;
  margin: 10px 0;
}

.operacion-vertical {
  display: inline-block;
  text-align: right;
  font-size: 1.4rem;
  line-height: 1.2;
}

.numero-superior {
  padding-right: 10px;
}

.linea-operacion {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.linea-divisoria {
  border-bottom: 2px solid var(--text-color);
  margin: 4px 0;
  min-width: 60px;
}

.resultado {
  font-weight: bold;
  color: var(--primary-color);
  min-height: 1.4em;
}

/* ✅ ESTILOS PARA EL MODAL VERTICAL */
.problem-large.vertical {
  font-family: "Courier New", monospace;
  font-size: 2.5rem;
  text-align: center;
  line-height: 1.3;
  margin: 20px 0;
}

.problem-large.vertical .numero-superior {
  padding-right: 15px;
}

.problem-large.vertical .linea-operacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 2rem;
}

.problem-large.vertical .linea-divisoria {
  border-bottom: 3px solid var(--text-color);
  margin: 8px auto;
  min-width: 120px;
  max-width: 150px;
}

.problem-large.vertical .resultado {
  font-size: 2.2rem;
  font-weight: bold;
  min-height: 1.5em;
  color: var(--primary-color);
}

/* Ajustar tarjetas de ejercicio para formato vertical */
.exercise-card .exercise-content {
  padding: 15px;
}

.exercise-problem-vertical {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ✅ ESTILOS MEJORADOS PARA MODAL VERTICAL */
.operacion-vertical-large {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    line-height: 1.3;
    margin: 0 auto;
    display: inline-block;
}

.operacion-vertical-large .numero-superior {
    padding-right: 15px;
    letter-spacing: 2px;
}

.operacion-vertical-large .linea-operacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 2.2rem;
    letter-spacing: 2px;
}

.operacion-vertical-large .linea-divisoria {
    border-bottom: 3px solid var(--text-color);
    margin: 10px auto;
    min-width: 140px;
    max-width: 180px;
    letter-spacing: 1px;
}

.operacion-vertical-large .resultado {
    font-size: 2.3rem;
    font-weight: bold;
    min-height: 1.6em;
    color: var(--primary-color);
    letter-spacing: 2px;
    background: var(--card-bg);
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

/* ✅ MEJORAR TECLADO VIRTUAL PARA FORMATO VERTICAL */
.virtual-keyboard {
    margin-top: 30px;
}

.answer-display {
    margin: 25px 0;
    font-size: 2.2rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-display span {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--primary-color);
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    min-width: 100px;
    text-align: center;
}