/*!
 * Coboni Education – Tablas de Multiplicar
 * Copyright (c) 2025 Coboni Education. All rights reserved.
 */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700&display=swap');

/* ══════════════════════════════════════
   VARIABLES
══════════════════════════════════════ */
:root {
  --naranja:        #FF6B35;
  --naranja-light:  #FFF0E9;
  --naranja-mid:    #FFD4BE;
  --azul:           #3B82F6;
  --azul-light:     #EFF6FF;
  --azul-mid:       #BFDBFE;
  --verde:          #22C55E;
  --verde-light:    #F0FDF4;
  --verde-mid:      #BBF7D0;
  --rojo:           #EF4444;
  --rojo-light:     #FEF2F2;
  --rojo-mid:       #FECACA;
  --amarillo:       #F59E0B;
  --amarillo-light: #FFFBEB;
  --amarillo-mid:   #FDE68A;
  --morado:         #7C3AED;
  --morado-light:   #F3E8FF;
  --gris-bg:        #F8F7F4;
  --gris-card:      #FFFFFF;
  --gris-borde:     #D1D5DB;
  --gris-borde-s:   #E5E7EB;
  --gris-texto:     #111827;
  --gris-muted:     #6B7280;
  --radio:          8px;
  --radio-lg:       14px;
}

/* ══════════════════════════════════════
   RESET & BASE
══════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--gris-bg);
  color: var(--gris-texto);
  min-height: 100vh;
  padding: 16px;
  -webkit-user-select: none;
  user-select: none;
}

/* Allow selection only inside inputs and textareas */
input, textarea { -webkit-user-select: text; user-select: text; }

h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(22px, 5vw, 30px);
  color: var(--naranja);
  text-align: center;
  margin-bottom: 2px;
}

.sub {
  text-align: center;
  color: var(--gris-muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.hidden { display: none !important; }

/* ══════════════════════════════════════
   BOTONES GENERALES
══════════════════════════════════════ */
.btn {
  font-family: 'Nunito', sans-serif;
  border: none;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radio);
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
  white-space: nowrap;
}
.btn:hover  { filter: brightness(1.08); }
.btn:active { transform: scale(0.95); }
.btn-azul   { background: var(--azul);    color: #fff; }
.btn-verde  { background: var(--verde);   color: #fff; }
.btn-amarillo{ background: var(--amarillo); color: #78350F; }
.btn-gris   { background: #E5E7EB;        color: var(--gris-texto); }
.btn-rojo   { background: var(--rojo);    color: #fff; }

/* ══════════════════════════════════════
   CARD BASE
══════════════════════════════════════ */
.card {
  background: var(--gris-card);
  border-radius: var(--radio-lg);
  border: 2px solid var(--gris-borde-s);
  padding: 22px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  max-width: 600px;
  margin: 0 auto 20px;
}

/* ══════════════════════════════════════
   PANTALLA DE INICIO
══════════════════════════════════════ */
.start-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.config-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gris-muted);
  margin-bottom: 8px;
}

.config-section { width: 100%; }

.config-row {
  display: flex;
  gap: 12px;
}

.config-section.half { flex: 1; }

/* Botones de modo */
.mode-btns {
  display: flex;
  gap: 10px;
}

.mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Nunito', sans-serif;
}

.mode-btn:hover {
  border-color: var(--azul);
  background: var(--azul-light);
}

.mode-btn.active {
  border-color: var(--naranja);
  background: var(--naranja-light);
}

.mode-icon { font-size: 26px; }
.mode-title { font-size: 13px; font-weight: 700; color: var(--gris-texto); }
.mode-desc  { font-size: 10px; color: var(--gris-muted); font-weight: 600; }

/* Select estilizado */
.styled-select {
  font-family: 'Nunito', sans-serif;
  width: 100%;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio);
  padding: 8px 12px;
  font-size: 13px;
  background: #fff;
  color: var(--gris-texto);
  cursor: pointer;
  font-weight: 600;
}
.styled-select:focus { outline: none; border-color: var(--azul); }

/* Botones de modo de respuesta */
.answer-mode-btns {
  display: flex;
  gap: 8px;
}

.answer-btn {
  flex: 1;
  padding: 9px 12px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio);
  background: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--gris-texto);
}

.answer-btn:hover {
  border-color: var(--azul);
  background: var(--azul-light);
  color: #1D4ED8;
}

.answer-btn.active {
  border-color: var(--verde);
  background: var(--verde-light);
  color: #166534;
}

.start-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.start-actions .btn { padding: 12px 28px; font-size: 15px; }

/* ══════════════════════════════════════
   BARRA SUPERIOR (JUEGO)
══════════════════════════════════════ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--gris-card);
  border: 2px solid var(--gris-borde-s);
  border-radius: var(--radio-lg);
  padding: 10px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  max-width: 780px;
  margin: 0 auto 14px;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Timer */
.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--azul-light);
  border: 2px solid var(--azul-mid);
  border-radius: 10px;
  padding: 6px 14px;
}

.timer-icon { font-size: 16px; }

.timer-val {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: var(--azul);
  min-width: 28px;
  text-align: center;
  line-height: 1;
}

.timer-track {
  width: 60px;
  height: 8px;
  background: var(--azul-mid);
  border-radius: 4px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  background: var(--azul);
  border-radius: 4px;
  transition: width 0.9s linear;
  width: 100%;
}

.timer-fill.urgent { background: var(--rojo); }

/* Score / Combo */
.score-box, .combo-box {
  background: var(--amarillo-light);
  border: 2px solid var(--amarillo-mid);
  border-radius: 10px;
  padding: 5px 14px;
  font-weight: 700;
  font-size: 14px;
  color: #78350F;
}

.combo-box {
  background: var(--rojo-light);
  border-color: var(--rojo-mid);
  color: #991B1B;
}

/* ══════════════════════════════════════
   LAYOUT JUEGO
══════════════════════════════════════ */
.main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  max-width: 780px;
  margin: 0 auto;
}

.game-panel {
  flex: 1;
  min-width: 280px;
  background: var(--gris-card);
  border-radius: var(--radio-lg);
  border: 2px solid var(--gris-borde-s);
  padding: 22px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.side-panel {
  width: 200px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .side-panel { width: 100%; }
  .main { flex-direction: column; }
}

/* ══════════════════════════════════════
   PANEL DE JUEGO
══════════════════════════════════════ */
.mode-badge {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: var(--morado);
  background: var(--morado-light);
  border: 1.5px solid #DDD6FE;
  border-radius: 20px;
  padding: 4px 16px;
  align-self: center;
}

.question-area {
  background: var(--gris-bg);
  border: 2px solid var(--gris-borde-s);
  border-radius: var(--radio-lg);
  padding: 24px 30px;
  text-align: center;
  width: 100%;
}

.question {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(36px, 10vw, 56px);
  color: var(--gris-texto);
  line-height: 1;
}

/* Input de respuesta */
.answer-field {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  padding: 10px;
  width: 60%;
  max-width: 180px;
  text-align: center;
  border-radius: var(--radio);
  border: 2px solid var(--gris-borde);
  background: #fff;
  color: var(--gris-texto);
  transition: border-color 0.15s;
}

.answer-field:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* Opciones múltiples */
.choices-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.choice-btn {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  padding: 12px 0;
  width: calc(50% - 5px);
  max-width: 130px;
  border: 2px solid var(--gris-borde);
  border-radius: var(--radio);
  background: #fff;
  color: var(--gris-texto);
  cursor: pointer;
  transition: all 0.15s;
}

.choice-btn:hover {
  border-color: var(--azul);
  background: var(--azul-light);
  color: #1D4ED8;
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(59,130,246,0.2);
}

.choice-btn:active { transform: scale(0.96); }

.choice-btn.correct-flash {
  border-color: var(--verde) !important;
  background: var(--verde-light) !important;
  color: #166534 !important;
}

.choice-btn.wrong-flash {
  border-color: var(--rojo) !important;
  background: var(--rojo-light) !important;
  color: #991B1B !important;
}

/* Botón de enviar */
.submit-btn {
  width: 60%;
  max-width: 200px;
  padding: 12px;
  font-size: 15px;
}

/* Feedback */
.feedback-box {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  min-height: 28px;
  padding: 6px 14px;
  border-radius: var(--radio);
  width: 100%;
  transition: all 0.2s;
}

.feedback-box.correct {
  background: var(--verde-light);
  border: 1.5px solid var(--verde-mid);
  color: #166534;
}

.feedback-box.wrong {
  background: var(--rojo-light);
  border: 1.5px solid var(--rojo-mid);
  color: #991B1B;
}

/* Botón volver */
.back-btn {
  font-size: 12px;
  padding: 6px 14px;
  align-self: flex-start;
}

/* ══════════════════════════════════════
   ESTADÍSTICAS (PANEL LATERAL)
══════════════════════════════════════ */
.stats-card {
  background: var(--gris-card);
  border-radius: var(--radio-lg);
  border: 2px solid var(--gris-borde-s);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 600px) {
  .stats-card {
    flex-direction: row;
    justify-content: space-around;
  }
}

.stat-item { text-align: center; }

.stat-val {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: var(--gris-texto);
  line-height: 1;
}

.stat-val.stat-green { color: var(--verde); }
.stat-val.stat-red   { color: var(--rojo); }
.stat-val.stat-gold  { color: var(--amarillo); }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gris-muted);
  margin-top: 2px;
}

/* ══════════════════════════════════════
   GAME OVER
══════════════════════════════════════ */
.result-card {
  text-align: center;
}

.result-icon {
  font-size: 56px;
  margin-bottom: 8px;
}

.result-title {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: var(--gris-texto);
  margin-bottom: 20px;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 24px;
  border: 2px solid var(--gris-borde-s);
  border-radius: var(--radio-lg);
  overflow: hidden;
}

.result-stat {
  flex: 1;
  min-width: 80px;
  padding: 16px 10px;
  border-right: 2px solid var(--gris-borde-s);
}

.result-stat:last-child { border-right: none; }

.result-stat-val {
  font-family: 'Fredoka One', cursive;
  font-size: 30px;
  color: var(--gris-texto);
  line-height: 1;
}

.result-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gris-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════
   REPORTE
══════════════════════════════════════ */
.report-card {
  max-width: 720px;
}

.report-title {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: var(--azul);
  margin-bottom: 16px;
  text-align: center;
}

/* Resumen para padres */
.parent-summary-box {
  background: var(--azul-light);
  border: 2px solid var(--azul-mid);
  border-radius: var(--radio);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.ps-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1D4ED8;
  margin-bottom: 12px;
}

.ps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ps-item {
  flex: 1;
  min-width: 80px;
  background: #fff;
  border: 1.5px solid var(--azul-mid);
  border-radius: var(--radio);
  padding: 10px 8px;
  text-align: center;
}

.ps-item.ps-wide {
  min-width: 160px;
  flex: 2;
}

.ps-val {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: var(--azul);
  line-height: 1.1;
}

.ps-val.ps-val-sm {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #1D4ED8;
}

.ps-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gris-muted);
  margin-top: 3px;
}

.insights-box {
  background: var(--amarillo-light);
  border: 2px solid var(--amarillo-mid);
  border-radius: var(--radio);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.insights-box p {
  font-size: 13px;
  font-weight: 700;
  color: #78350F;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radio);
  border: 2px solid var(--gris-borde-s);
  margin-bottom: 16px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: 'Nunito', sans-serif;
}

.report-table th {
  background: var(--gris-bg);
  padding: 8px 12px;
  font-weight: 700;
  color: var(--gris-muted);
  text-align: center;
  border-bottom: 2px solid var(--gris-borde-s);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.report-table td {
  padding: 7px 12px;
  text-align: center;
  border-bottom: 1px solid var(--gris-borde-s);
  font-weight: 600;
}

.report-table tr:last-child td { border-bottom: none; }

.report-table tr.good td { background: var(--verde-light); color: #166534; }
.report-table tr.bad  td { background: var(--rojo-light);  color: #991B1B; }

.report-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════
   ANIMACIONES
══════════════════════════════════════ */
@keyframes popIn {
  0%   { transform: scale(0.7); opacity: 0; }
  70%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.pop { animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }

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

.shake { animation: shake 0.35s ease; }

@media (max-width: 420px) {
  .choice-btn { width: calc(50% - 5px); }
  .mode-btns  { flex-direction: column; }
}

/* ══════════════════════════════════════
   LOGO HEADER
══════════════════════════════════════ */
.logo-header {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  margin-top: 4px;
}

.site-logo {
  width: clamp(120px, 30vw, 180px);
  height: auto;
  display: block;
}

/* ══════════════════════════════════════
   PRÓXIMAMENTE
══════════════════════════════════════ */
.coming-soon-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px dashed var(--gris-borde-s);
}

.coming-soon-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gris-muted);
  margin-bottom: 10px;
}

.coming-soon-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coming-soon-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
  border: 2px dashed var(--gris-borde);
  border-radius: var(--radio);
  background: var(--gris-bg);
  color: var(--gris-muted);
  cursor: pointer;
  text-align: left;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.coming-soon-btn:hover {
  opacity: 1;
  border-color: var(--amarillo);
  background: var(--amarillo-light);
  color: #78350F;
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 30px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 9999;
  white-space: nowrap;
  transition: opacity 0.3s;
}

.toast.hidden { display: none; }

/* ══════════════════════════════════════
   FOOTER DE PRIVACIDAD
══════════════════════════════════════ */
.privacy-footer {
  max-width: 600px;
  margin: 10px auto 4px;
  text-align: center;
  padding: 10px 16px;
  border-top: 1px solid var(--gris-borde-s);
}

.privacy-footer p {
  font-size: 11px;
  color: var(--gris-muted);
  line-height: 1.5;
}
