/* =========================================================
   Página de actividad — quiz tipo Kahoot
   (usa los componentes de styles.css)
   ========================================================= */

.page-act {
  --verde: #2E9E6B;
  --rojo: #D9534F;
  /* Tonos más oscuros solo para texto sobre fondo claro (contraste AA) */
  --verde-texto: #1F7A50;
  --rojo-texto: #B23A36;
  background: var(--azul-900);
  color: var(--blanco);
}

.page-act.is-cuenta {
  overflow: hidden;
}

.act {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(var(--nav-alto) + var(--nav-top) + 2rem);
  padding-bottom: 3rem;
}

/* Onda a la derecha, igual que el hero del index */
.act__shape {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 46%;
}

.act__shape svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--azul-500);
}

@media (min-width: 900px) {
  .act {
    padding-top: calc(var(--nav-alto) + var(--nav-top) + 3rem);
    padding-bottom: 4rem;
  }

  .act__shape {
    width: 50%;
  }
}

.act__screen {
  position: relative;
  z-index: 1;
}

.act [hidden] {
  display: none !important;
}

/* =========================================================
   1. INICIO
   ========================================================= */
.act-inicio {
  display: flex;
  align-items: center;
  min-height: calc(100svh - var(--nav-alto) - var(--nav-top) - 5rem);
}

.act-inicio__grid {
  display: grid;
  grid-template-columns: 58fr 42fr;
  align-items: center;
  gap: 0.75rem;
}

.act-inicio__title {
  margin-bottom: 1rem;
  font-size: clamp(1.6rem, 7vw, 4rem);
}

.act-inicio__temas {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

.act-inicio__temas li {
  position: relative;
  padding-left: 1rem;
}

.act-inicio__temas li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--acento);
}

.act-inicio__reglas {
  display: inline-block;
  margin: 0 0 1.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radio);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: clamp(0.75rem, 1.4vw, 0.9rem);
  font-weight: 600;
  line-height: 1.4;
}

.btn--xl {
  min-height: 3.75rem;
  padding: 1rem 2.75rem;
  font-size: 1rem;
}

.act-inicio__media {
  display: flex;
  justify-content: center;
}

.act-inicio__cat {
  width: 100%;
  max-width: 24rem;
  max-height: 32rem;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.4));
  animation: hero-float 5s ease-in-out infinite;
}

@media (min-width: 900px) {
  .act-inicio__grid {
    grid-template-columns: 1.3fr 0.7fr;
    gap: 2rem;
  }
}

/* =========================================================
   2. CUENTA REGRESIVA
   ========================================================= */
.act-cuenta {
  position: fixed;
  z-index: 200; /* encima de la navbar */
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, var(--azul-500) 0, var(--azul-900) 65%);
}

.act-cuenta[hidden] {
  display: none;
}

.act-cuenta__num {
  font-family: var(--font-titulo);
  font-weight: 900;
  font-size: clamp(8rem, 40vw, 18rem);
  line-height: 1;
  color: var(--acento);
  text-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.act-cuenta__num.is-pop {
  animation: cuenta-pop 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cuenta-pop {
  0%   { opacity: 0; transform: scale(1.8); }
  35%  { opacity: 1; transform: scale(1); }
  80%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.85); }
}

/* =========================================================
   3. PREGUNTA
   ========================================================= */
.act-q__wrap {
  max-width: 62rem;
}

/* Progreso: 6 segmentos que se llenan conforme avanzas */
.act-prog {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0;
}

.act-prog__seg {
  position: relative;
  height: 0.4rem;
  overflow: hidden;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.15);
}

.act-prog__seg::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--seg-color, transparent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.act-prog__seg.is-actual {
  --seg-color: rgba(255, 255, 255, 0.55);
}

.act-prog__seg.is-correcto {
  --seg-color: var(--verde);
}

.act-prog__seg.is-incorrecto {
  --seg-color: var(--rojo);
}

.act-prog__seg.is-actual::before {
  transform: scaleX(0.35);
}

.act-prog__seg.is-correcto::before,
.act-prog__seg.is-incorrecto::before {
  transform: scaleX(1);
}

.act-q__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin-bottom: 1rem;
}

.act-q__tema {
  margin: 0;
  flex: 1 1 16rem;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--acento);
}

.act-q__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.act-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-height: 2.25rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.12);
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.act-chip--score {
  background: var(--acento);
  color: var(--azul-900);
}

.act-chip--score.is-bump {
  animation: chip-bump 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes chip-bump {
  40% { transform: scale(1.22); }
}

/* "+N puntos" que vuela hacia el marcador */
.act-float {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  padding: 0.45rem 0.9rem;
  border-radius: var(--pill);
  background: var(--verde);
  color: var(--blanco);
  font-family: var(--font-titulo);
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 22px -8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  will-change: transform, opacity;
}

/* ---------- Barra de tiempo ---------- */
.act-timer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.act-timer__bar {
  flex: 1;
  height: 0.85rem;
  overflow: hidden;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.15);
}

.act-timer__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--acento);
  transform-origin: left center;
  transition: background-color 0.3s ease;
}

.act-timer__num {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--blanco);
  color: var(--azul-900);
  font-family: var(--font-titulo);
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--sombra-suave);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Últimos 5 segundos */
.act-timer.is-aviso .act-timer__fill {
  background: var(--rojo);
}

.act-timer.is-aviso .act-timer__num {
  background: var(--rojo);
  color: var(--blanco);
  animation: timer-latido 1s ease-in-out infinite;
}

.act-timer.is-fin .act-timer__num {
  animation: none;
}

@keyframes timer-latido {
  50% { transform: scale(1.1); }
}

/* ---------- Tarjeta de la pregunta ---------- */
.act-q__card {
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border-radius: var(--radio-lg);
  background: var(--blanco);
  color: var(--azul-900);
  box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.55);
}

.act-q__titulo {
  margin-bottom: 0.75rem;
  font-size: clamp(0.95rem, 2.4vw, 1.35rem);
  line-height: 1.2;
  color: var(--azul-500);
}

.act-q__pregunta {
  margin: 0 0 1.5rem;
  font-size: clamp(0.98rem, 1.8vw, 1.15rem);
  font-weight: 600;
  line-height: 1.55;
}

/* ---------- Botones de respuesta (estilo Kahoot) ---------- */
.act-opts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.act-opt {
  --opt-bg: var(--azul-900);
  --opt-fg: var(--blanco);
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "shape texto"
    "letra texto";
  align-items: start;
  column-gap: 0.85rem;
  row-gap: 0.15rem;
  min-height: 4.5rem;
  padding: 0.9rem 2.6rem 1.05rem 0.9rem;
  border: 0;
  border-radius: var(--radio);
  background: var(--opt-bg);
  color: var(--opt-fg);
  text-align: left;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), 0 10px 20px -12px rgba(12, 43, 78, 0.6);
  transition: transform var(--transicion), opacity var(--transicion),
    background-color var(--transicion), box-shadow var(--transicion);
}

.act-opt--b {
  --opt-bg: var(--azul-500);
}

.act-opt--c {
  --opt-bg: var(--acento);
  --opt-fg: var(--azul-900);
}

.act-opt:not(:disabled):hover {
  transform: translateY(-3px);
  filter: brightness(1.08);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), 0 16px 24px -12px rgba(12, 43, 78, 0.7);
}

/* Al presionar se "hunde" como una tecla */
.act-opt:not(:disabled):active {
  transform: translateY(3px);
  filter: brightness(0.95);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.22);
  transition-duration: 0.06s;
}

.act-opt:focus-visible {
  outline: 3px solid var(--azul-900);
  outline-offset: 3px;
}

.act-opt:disabled {
  cursor: default;
}

.act-opt__shape {
  grid-area: shape;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radio-sm);
  background: rgba(255, 255, 255, 0.16);
}

.act-opt--c .act-opt__shape {
  background: rgba(12, 43, 78, 0.12);
}

.act-opt__shape svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: currentColor;
}

.act-opt__letra {
  grid-area: letra;
  justify-self: center;
  font-family: var(--font-titulo);
  font-weight: 900;
  font-size: 0.85rem;
}

.act-opt__texto {
  grid-area: texto;
  align-self: center;
}

/* Marca de correcta / incorrecta */
.act-opt::after {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--blanco);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
}

.act-opt.is-correcta {
  --opt-bg: var(--verde);
  --opt-fg: var(--blanco);
}

.act-opt.is-acierto {
  animation: opt-rebote 0.6s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.act-opt.is-correcta::after {
  content: "\2713";
  color: var(--verde);
}

.act-opt.is-incorrecta {
  --opt-bg: var(--rojo);
  --opt-fg: var(--blanco);
  animation: opt-mal 0.4s ease;
}

.act-opt.is-incorrecta::after {
  content: "\2715";
  color: var(--rojo);
}

.act-opt.is-correcta .act-opt__texto,
.act-opt.is-incorrecta .act-opt__texto {
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.act-opt.is-correcta .act-opt__shape,
.act-opt.is-incorrecta .act-opt__shape {
  background: rgba(255, 255, 255, 0.2);
}

/* Las opciones que no importan se apagan */
.act-opt:disabled:not(.is-correcta):not(.is-incorrecta) {
  opacity: 0.35;
}

@keyframes opt-rebote {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.06) translateY(-6px); }
  55%  { transform: scale(0.97) translateY(0); }
  75%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Entrada escalonada al aparecer cada pregunta */
.act-opts.is-entrando .act-opt {
  animation: opt-entrar 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.act-opts.is-entrando .act-opt:nth-child(2) {
  animation-delay: 0.1s;
}

.act-opts.is-entrando .act-opt:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes opt-entrar {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
}

@keyframes opt-mal {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@media (min-width: 900px) {
  .act-opts {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .act-opt {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "shape letra"
      "texto texto";
    align-items: center;
    align-content: start;
    row-gap: 0.85rem;
    min-height: 13rem;
    padding: 1.1rem 1.1rem 1.4rem;
  }

  .act-opt__letra {
    justify-self: start;
    font-size: 1.1rem;
  }

  .act-opt__texto {
    align-self: start;
  }
}

/* ---------- Botones de la página: hover, active y foco ---------- */
.page-act .btn--primary:hover {
  filter: brightness(1.05);
}

.page-act .btn:active {
  transform: translateY(1px) scale(0.97);
  transition-duration: 0.06s;
}

.page-act .btn:focus-visible {
  outline: 3px solid var(--acento);
  outline-offset: 3px;
}

/* =========================================================
   4. RETROALIMENTACIÓN
   ========================================================= */
.act-fb {
  --fb-color: var(--azul-500);
  margin-top: 1.25rem;
  padding: 1.25rem 1.25rem 1.25rem 1.4rem;
  border-radius: var(--radio);
  border-left: 6px solid var(--fb-color);
  background: var(--fondo);
  animation: fb-entrar 0.4s ease both;
}

.act-fb[data-tipo="correcto"] {
  --fb-color: var(--verde);
  --fb-texto: var(--verde-texto);
}

.act-fb[data-tipo="incorrecto"],
.act-fb[data-tipo="tiempo"] {
  --fb-color: var(--rojo);
  --fb-texto: var(--rojo-texto);
}

.act-fb__msg {
  margin: 0 0 0.6rem;
  font-family: var(--font-titulo);
  font-weight: 800;
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  line-height: 1.2;
  color: var(--fb-texto, var(--fb-color));
}

.act-fb__porque {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--azul-700);
}

.act-fb__porque strong {
  color: var(--azul-900);
}

.act-fb .btn {
  box-shadow: none;
}

.page-act .act-fb .btn:focus-visible {
  outline: 3px solid var(--azul-900);
  outline-offset: 3px;
}

@keyframes fb-entrar {
  from { opacity: 0; transform: translateY(10px); }
}

/* =========================================================
   5. RESULTADO
   ========================================================= */
.act-res {
  display: flex;
  align-items: center;
  min-height: calc(100svh - var(--nav-alto) - var(--nav-top) - 5rem);
}

/* Gato a la izquierda señalando el puntaje */
.act-res__grid {
  display: grid;
  grid-template-columns: 38% 1fr;
  align-items: center;
  gap: 0.5rem;
}

.act-res__cat {
  width: 100%;
  max-width: 22rem;
  max-height: 30rem;
  margin-left: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.4));
  animation: res-entrar 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes res-entrar {
  from { opacity: 0; transform: translateX(-30px) rotate(-4deg); }
}

/* Globo con el puntaje */
.act-res__score {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
  padding: 1rem 1.4rem 1.2rem;
  border-radius: var(--radio-lg);
  background: var(--blanco);
  color: var(--azul-900);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.55);
  animation: res-score 0.6s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Pico del globo hacia el gato */
.act-res__score::before {
  content: "";
  position: absolute;
  left: -0.7rem;
  top: 50%;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.25rem;
  background: inherit;
  transform: translateY(-50%) rotate(45deg);
}

@keyframes res-score {
  from { opacity: 0; transform: scale(0.85); }
}

.act-res__label {
  position: relative;
  font-family: var(--font-titulo);
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--azul-500);
}

.act-res__num {
  position: relative;
  font-family: var(--font-titulo);
  font-weight: 900;
  font-size: clamp(2.2rem, 9vw, 5rem);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.act-res__aciertos {
  margin: 1rem 0 0.25rem;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-weight: 600;
}

.act-res__aciertos span {
  font-family: var(--font-titulo);
  font-weight: 800;
  color: var(--acento);
}

.act-res__msg {
  margin: 0 0 1.25rem;
  font-family: var(--font-titulo);
  font-weight: 800;
  font-size: clamp(1rem, 3vw, 1.75rem);
  line-height: 1.15;
  text-transform: uppercase;
}

.act-res__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

@media (max-width: 599px) {
  .act-res__actions .btn {
    flex: 1 1 100%;
    padding: 0.7rem 0.75rem;
    font-size: 0.62rem;
    letter-spacing: 0.02em;
    line-height: 1.25;
    white-space: normal;
    text-align: center;
  }
}

@media (min-width: 900px) {
  .act-res__grid {
    grid-template-columns: 0.8fr 1.2fr;
    gap: 2.5rem;
  }

  .act-res__score {
    padding: 1.4rem 2.25rem 1.6rem;
  }

  .act-res__score::before {
    left: -0.9rem;
    width: 2rem;
    height: 2rem;
  }
}

/* Lienzo del confeti: encima de todo y sin bloquear clics */
.act-confeti {
  position: fixed;
  z-index: 150;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* =========================================================
   Movimiento reducido
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .act-inicio__cat,
  .act-cuenta__num.is-pop,
  .act-timer.is-aviso .act-timer__num,
  .act-opt.is-acierto,
  .act-opt.is-incorrecta,
  .act-opts.is-entrando .act-opt,
  .act-chip--score.is-bump,
  .act-fb,
  .act-res__cat,
  .act-res__score {
    animation: none;
  }

  .act-opt:not(:disabled):hover,
  .act-opt:not(:disabled):active,
  .page-act .btn:active {
    transform: none;
  }

  .act-prog__seg::before {
    transition: none;
  }
}
