/* ==========================================================================
   La Sfida — estilo "Quaderno"
   Colores de XicoBach: el negro, el amarillo y el blanco de uxac.mx/xicobach.
   Para otra escuela, cambia estas variables, Client/Marca.cs y el logo de
   wwwroot/img. La insignia compartible (js/reto.js) lee estos colores de aquí;
   el favicon y el theme-color de Components/App.razor llevan copias.
   ========================================================================== */
:root {
  --tinta: #000000;         /* texto, bordes y botón principal */
  --papel: #FAFAFA;         /* fondo */
  --linea: #E4E4E4;         /* cuadrícula del cuaderno */
  --acento: #FDC101;        /* amarillo de la marca: respuesta correcta, insignia, resaltes */
  --acento-2: #FF7A59;      /* respuesta incorrecta */
  --blanco: #FFFFFF;
  --apagado: #5B5B63;       /* texto de las opciones descartadas */
  --apagado-borde: #A3A3AB; /* borde de las opciones descartadas */
  --fuente-titulos: Fredoka, "Trebuchet MS", Arial, sans-serif;
  --fuente-texto: Nunito, "Segoe UI", Arial, sans-serif;
}

/* ---------- Tipografías ----------
   Fredoka (títulos) y Nunito (texto), alojadas en wwwroot/fonts para no depender de
   Google. Son archivos variables (un solo woff2 cubre todos los pesos) con el
   subconjunto latino, que incluye todos los acentos del español y del italiano.
   Sus licencias (SIL OFL 1.1) están junto a los archivos. Si cambias el nombre o el
   peso de un archivo, actualiza también los <link rel="preload"> de Components/App.razor. */
@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--fuente-texto);
  font-weight: 700;
  color: var(--tinta);
  background-color: var(--papel);
  background-image:
    linear-gradient(var(--linea) 1px, transparent 1px),
    linear-gradient(90deg, var(--linea) 1px, transparent 1px);
  background-size: 26px 26px;
}

h1, p { margin: 0; }

a { color: var(--tinta); }

:focus-visible { outline: 3px solid var(--acento-2); outline-offset: 3px; }

/* ---------- Estructura ---------- */
.pantalla {
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pantalla--centro { align-items: center; text-align: center; padding-top: 56px; }
.pantalla--centro > .acciones { align-self: stretch; }
.empuje { flex-grow: 1; }

.marca { font-family: var(--fuente-titulos); font-size: 1rem; font-weight: 600; }

/* ---------- Botones ---------- */
.boton {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: 0 24px;
  border: 3px solid var(--tinta);
  border-radius: 32px;
  font-family: var(--fuente-titulos);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.boton--principal { background: var(--tinta); color: var(--blanco); box-shadow: 0 5px 0 var(--acento); }
.boton--principal:hover { color: var(--blanco); }
.boton--principal:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--acento); }
.boton--secundario { background: var(--blanco); color: var(--tinta); font-size: 1.125rem; }
.boton--secundario:active { transform: translateY(2px); }

.boton-texto {
  min-height: 44px;
  background: none;
  border: 0;
  color: var(--tinta);
  font-family: var(--fuente-texto);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Portada ---------- */
.calcomanias { position: relative; height: 290px; }
.calcomania {
  position: absolute;
  padding: 14px 22px;
  border: 3px solid var(--tinta);
  border-radius: 20px;
  box-shadow: 5px 5px 0 var(--tinta);
  font-family: var(--fuente-titulos);
  font-weight: 600;
  font-size: 2.125rem;
  line-height: 1;
  animation: pegar 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.calcomania--amarilla { left: 6px; top: 20px; padding: 18px 26px; background: var(--acento); font-size: 3.25rem; font-weight: 700; --giro: -7deg; }
.calcomania--blanca { right: 4px; top: 112px; background: var(--blanco); --giro: 6deg; animation-delay: 0.12s; }
.calcomania--negra { left: 34px; top: 196px; background: var(--tinta); color: var(--blanco); box-shadow: 5px 5px 0 var(--acento); --giro: -3deg; animation-delay: 0.24s; }

@keyframes pegar {
  from { opacity: 0; transform: rotate(0deg) scale(1.5); }
  to { opacity: 1; transform: rotate(var(--giro, 0deg)) scale(1); }
}

.portada__titulo { font-family: var(--fuente-titulos); font-weight: 700; font-size: 2.5rem; line-height: 1.08; text-wrap: balance; }
.portada__detalle { font-size: 1.125rem; line-height: 1.4; }
.portada__pie { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-size: 0.8125rem; line-height: 1.4; }

/* Logo de la escuela: el PNG tiene texto claro, así que va sobre una placa negra. */
.logo-escuela {
  display: inline-flex;
  padding: 10px 16px;
  background: var(--tinta);
  color: var(--blanco);
  border: 3px solid var(--tinta);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--acento);
}
.logo-escuela img { display: block; height: 42px; width: auto; }

/* ---------- Pregunta ---------- */
.progreso { display: flex; align-items: center; gap: 12px; }
.progreso__barra { flex-grow: 1; height: 14px; border: 3px solid var(--tinta); border-radius: 7px; background: var(--blanco); overflow: hidden; }
.progreso__relleno { height: 100%; background: var(--acento); transition: width 0.3s ease; }
.progreso__texto { font-family: var(--fuente-titulos); font-weight: 600; font-size: 1rem; white-space: nowrap; }

.tarjeta {
  background: var(--blanco);
  border: 3px solid var(--tinta);
  border-radius: 24px;
  box-shadow: 5px 5px 0 var(--tinta);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: entrar 0.3s ease both;
}
.tarjeta__pregunta { font-size: 1rem; }
.tarjeta__fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tarjeta__italiano { font-family: var(--fuente-titulos); font-weight: 700; font-size: 2.25rem; line-height: 1.05; overflow-wrap: anywhere; }

.boton-audio {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--tinta);
  background: var(--acento);
  color: var(--tinta);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.boton-audio:active { transform: scale(0.94); }

.opciones { display: flex; flex-direction: column; gap: 12px; animation: entrar 0.3s ease 0.05s both; }
.opcion {
  min-height: 60px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 3px solid var(--tinta);
  border-radius: 30px;
  background: var(--blanco);
  color: var(--tinta);
  font-family: var(--fuente-texto);
  font-size: 1.125rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.opcion:not(:disabled):active { transform: scale(0.98); }
.opcion:disabled { cursor: default; color: var(--tinta); opacity: 1; }
.opcion--correcta { background: var(--acento); font-weight: 800; box-shadow: 4px 4px 0 var(--tinta); animation: brinco 0.35s ease; }
.opcion--incorrecta { background: var(--acento-2); animation: sacudir 0.35s ease; }
.opcion--apagada { border-color: var(--apagado-borde); color: var(--apagado); }
.opcion--apagada:disabled { color: var(--apagado); }

.respuesta { min-height: 132px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.respuesta__texto { font-size: 1.0625rem; line-height: 1.4; animation: entrar 0.25s ease both; }
.respuesta__titulo { font-family: var(--fuente-titulos); font-weight: 700; margin-right: 4px; }

@keyframes entrar { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes brinco { 40% { transform: scale(1.04); } }
@keyframes sacudir { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- Resultado ---------- */
.insignia {
  width: 236px;
  height: 236px;
  border-radius: 50%;
  background: var(--acento);
  border: 4px solid var(--tinta);
  box-shadow: 7px 7px 0 var(--tinta);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  --giro: -6deg;
  animation: pegar 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.insignia__puntaje { font-family: var(--fuente-titulos); font-weight: 700; font-size: 4.75rem; line-height: 1; }
.insignia__etiqueta { font-size: 0.9375rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }

.resultado { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.resultado__antetitulo { font-size: 0.9375rem; font-weight: 800; }
.resultado__nivel { font-family: var(--fuente-titulos); font-weight: 700; font-size: 2.75rem; line-height: 1; }
.resultado__mensaje { font-size: 1.125rem; line-height: 1.4; text-wrap: balance; }

.acciones { display: flex; flex-direction: column; gap: 14px; }
.acciones__aviso { min-height: 1.4em; font-size: 0.9375rem; }

/* ---------- Varios ---------- */
#blazor-error-ui {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 14px 20px;
  background: var(--acento);
  border-top: 3px solid var(--tinta);
  z-index: 1000;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Blazor enfoca el <h1> al navegar (para lectores de pantalla); no necesita contorno visible. */
h1:focus { outline: none; }
