/* =============================================
   DivisiMath – Hoja de estilos principal
   Archivo: styles.css
============================================= */

/* =============================================
   VARIABLES Y RESET
============================================= */
:root {
  --bg:        #f0f4ff;
  --card:      #ffffff;
  --primary:   #5b6ef5;
  --primary-d: #3d4fd4;
  --accent:    #ff8c42;
  --success:   #30c48d;
  --danger:    #f05575;
  --text:      #1e2048;
  --muted:     #8890c4;
  --shadow:    0 8px 32px rgba(91,110,245,.15);
  --radius:    20px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* Fondo decorativo suave */
  background-image:
    radial-gradient(circle at 15% 25%, #d4dbff 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, #ffd9c0 0%, transparent 45%);
}

/* =============================================
   LAYOUT PRINCIPAL
============================================= */
.game-wrapper {
  width: 100%;
  max-width: 560px;
}

/* Header con logo */
.header {
  text-align: center;
  margin-bottom: 28px;
}
.header h1 {
  font-family: 'Fredoka One', cursive;
  font-size: 2.6rem;
  color: var(--primary);
  letter-spacing: 1px;
  line-height: 1;
}
.header h1 span { color: var(--accent); }
.header p { color: var(--muted); font-size: .95rem; margin-top: 4px; }

/* =============================================
   TARJETA BASE
============================================= */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px;
  animation: slideUp .4s var(--transition) both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   PANTALLA DE SELECCIÓN DE NIVEL
============================================= */
.level-screen h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.level-screen p.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: 28px;
}
.level-grid {
  display: grid;
  gap: 14px;
}
.level-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border: 2.5px solid transparent;
  border-radius: 14px;
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-family: 'Nunito', sans-serif;
}
.level-btn:hover {
  border-color: var(--primary);
  background: #eef0ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(91,110,245,.18);
}
.level-icon {
  font-size: 2rem;
  line-height: 1;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}
.level-info strong {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}
.level-info span {
  font-size: .83rem;
  color: var(--muted);
}

/* =============================================
   PANTALLA DE JUEGO
============================================= */
/* Barra superior: nivel + score */
.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.badge {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  padding: 5px 14px;
  border-radius: 99px;
}
.score-display {
  font-weight: 800;
  color: var(--text);
  font-size: .95rem;
}
.score-display span { color: var(--primary); font-size: 1.1rem; }

/* Barra de progreso */
.progress-wrap {
  background: #e8eaf6;
  border-radius: 99px;
  height: 10px;
  margin-bottom: 28px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* Contador */
.question-counter {
  text-align: center;
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: .3px;
}

/* Número grande */
.number-display {
  text-align: center;
  margin-bottom: 10px;
}
.number-display .big-num {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(3.5rem, 12vw, 5rem);
  color: var(--text);
  line-height: 1;
  display: inline-block;
  transition: transform .2s;
}

/* Pregunta */
.question-text {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  line-height: 1.4;
}
.question-text .divisor {
  color: var(--primary);
  font-family: 'Fredoka One', cursive;
  font-size: 1.4em;
}

/* Botones Sí / No */
.answer-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.ans-btn {
  padding: 20px 10px;
  border: none;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ans-btn.yes {
  background: #d1fae5;
  color: #065f46;
}
.ans-btn.no {
  background: #fee2e2;
  color: #7f1d1d;
}
.ans-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
}
.ans-btn:active:not(:disabled) { transform: scale(.97); }
.ans-btn:disabled { opacity: .55; cursor: default; transform: none !important; }

/* Feedback */
.feedback {
  border-radius: 12px;
  padding: 14px 18px;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 18px;
  display: none;
  animation: pop .3s var(--transition);
}
@keyframes pop {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.feedback.correct {
  display: block;
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--success);
}
.feedback.incorrect {
  display: block;
  background: #fee2e2;
  color: #7f1d1d;
  border-left: 4px solid var(--danger);
}
.feedback .verdict {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

/* Botón siguiente */
.next-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  display: none;
}
.next-btn:hover { opacity: .9; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(91,110,245,.35); }
.next-btn:active { transform: scale(.98); }
.next-btn.visible { display: block; animation: pop .3s var(--transition); }

/* Animación wobble al contestar */
@keyframes wobble {
  0%,100%{ transform: rotate(0); }
  20%    { transform: rotate(-6deg) scale(1.08); }
  50%    { transform: rotate(5deg) scale(1.08); }
  80%    { transform: rotate(-3deg); }
}
.big-num.wobble { animation: wobble .5s ease; }

/* =============================================
   PANTALLA FINAL
============================================= */
.end-screen { text-align: center; }
.trophy {
  font-size: 4rem;
  margin-bottom: 12px;
  display: block;
  animation: bounce .7s ease infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}
.end-screen h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 8px;
}
.final-score {
  font-size: 3.2rem;
  font-family: 'Fredoka One', cursive;
  color: var(--primary);
  line-height: 1;
  margin: 10px 0 6px;
}
.final-score small { font-size: 1.5rem; color: var(--muted); }
.motivational {
  color: var(--muted);
  font-size: .98rem;
  margin-bottom: 28px;
  line-height: 1.5;
}
.restart-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #f7b731);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  transition: var(--transition);
}
.restart-btn:hover { opacity:.9; transform:translateY(-2px); box-shadow:0 8px 22px rgba(255,140,66,.4); }

/* Separador de stats */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 22px;
}
.stat-box {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 22px;
  text-align: center;
}
.stat-box strong { display:block; font-size:1.6rem; font-family:'Fredoka One',cursive; color:var(--text); }
.stat-box span { font-size:.78rem; color:var(--muted); font-weight:700; text-transform:uppercase; }

/* =============================================
   PANTALLA DE CARGA (SPLASH)
============================================= */
#splashScreen {
  position: fixed;
  inset: 0;
  background: #2b2d3a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 30px 20px 0;
  transition: opacity .7s ease, visibility .7s ease;
}
#splashScreen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: splashIn .8s cubic-bezier(.4,0,.2,1) both;
}
@keyframes splashIn {
  from { opacity:0; transform: translateY(30px); }
  to   { opacity:1; transform: translateY(0); }
}
.splash-logo {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.8rem, 8vw, 4.2rem);
  color: #ffffff;
  line-height: 1;
  text-align: center;
}
.splash-logo span { color: #ff8c42; }
.splash-tagline {
  font-size: .95rem;
  color: #9fa3c0;
  margin-top: -12px;
  font-weight: 600;
  letter-spacing: .4px;
  text-align: center;
}
.splash-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #5b9bf5, #ff8c42);
  border-radius: 99px;
}
.splash-card {
  background: linear-gradient(135deg, #4db8e8, #5b9bf5);
  border-radius: 16px;
  padding: 22px 40px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(77,184,232,.3);
  animation: splashPulse 2s ease-in-out infinite;
}
@keyframes splashPulse {
  0%,100% { box-shadow: 0 12px 40px rgba(77,184,232,.3); }
  50%      { box-shadow: 0 16px 50px rgba(77,184,232,.55); }
}
.splash-avatar { font-size: 2.6rem; margin-bottom: 8px; }
.splash-name { font-weight: 800; color: #ffffff; font-size: 1.05rem; line-height: 1.4; }
.splash-academic { text-align: center; line-height: 1.7; }
.splash-academic .univ { font-weight: 800; color: #ffffff; font-size: .9rem; }
.splash-academic .detail { font-size: .82rem; color: #9fa3c0; }
.splash-academic .course { font-weight: 800; color: #5b9bf5; font-size: .88rem; margin-top: 4px; }
.splash-meta { display:flex; flex-direction:column; align-items:center; gap:4px; }
.splash-meta .date { color: #d0d3e8; font-size: .88rem; font-weight: 600; }
.splash-meta .route { color: #9fa3c0; font-size: .8rem; display:flex; align-items:center; gap:5px; }
.splash-loader-wrap {
  width: min(320px, 80vw);
  background: #3d3f52;
  border-radius: 99px;
  height: 7px;
  overflow: hidden;
}
.splash-loader-bar {
  height: 100%;
  background: linear-gradient(90deg, #5b9bf5, #ff8c42);
  border-radius: 99px;
  width: 0%;
  animation: loadFill 2.8s cubic-bezier(.4,0,.6,1) forwards;
}
@keyframes loadFill {
  0%   { width: 0%; }
  60%  { width: 75%; }
  85%  { width: 90%; }
  100% { width: 100%; }
}
.splash-loading-txt {
  color: #9fa3c0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .5px;
  margin-top: 8px;
  text-align: center;
  animation: blinkTxt 1.2s ease infinite;
}
@keyframes blinkTxt { 0%,100%{opacity:1;} 50%{opacity:.4;} }
.splash-footer-line {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid #3d3f52;
  text-align: center;
  padding: 12px;
}
.splash-footer-line p { font-size: .82rem; color: #9fa3c0; }

/* =============================================
   RESPONSIVE
============================================= */
@media(max-width:480px){
  .card { padding:28px 20px; }
  .header h1 { font-size:2rem; }
}
