/* Variables y reset mínimo */
:root {
  --bg: #0a1b3f; /* azul medio oscuro */
  --panel: #111827; /* gray-900 */
  --text: #e5e7eb; /* gray-200 */
  --muted: #94a3b8; /* slate-400 */
  --brand: #22d3ee; /* cyan-400 */
  --brand-700: #0e7490;
  --accent: #facc15; /* amarillo */
  --accent-700: #ca8a04;
  --border: #1f2937; /* gray-800 */
  --radius: 12px;
  --shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  --qa-h: 36vh; /* altura de la barra de preguntas */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(1200px 1200px at 50% -10%, rgba(255,255,255,0.06), transparent), var(--bg);
}

/* Fondo de juego con imagen difuminada */
.game { position: relative; min-height: 100dvh; overflow: hidden; }
.game::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: var(--qa-h);
  background: radial-gradient(1200px 1200px at 50% -10%, rgba(255,255,255,0.06), transparent), var(--bg);
  z-index: -1;
}

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; }
input, textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.9rem; }
label { display: block; margin-bottom: 0.4rem; color: var(--muted); }

.container { width: min(1100px, 92%); margin-inline: auto; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(17, 24, 39, 0.7); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; }
.brand { font-weight: 700; letter-spacing: 0.2px; color: white; }
.brand-logo { height: 28px; width: auto; display: block; }

.menu-toggle { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; border-radius: 10px; border: 1px solid var(--border); }
.menu-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.menu-icon { width: 20px; height: 2px; background: currentColor; position: relative; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: currentColor; transition: transform .2s ease; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

/* Navegación */
.nav { display: none; }
.nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.2rem; }
.nav a { display: block; padding: 0.6rem 0.7rem; border-radius: 10px; color: var(--muted); }
.nav a:hover, .nav a:focus-visible { color: white; background: rgba(255,255,255,0.06); }
.nav--open { display: block; position: absolute; left: 0; right: 0; top: 56px; background: rgba(17, 24, 39, 0.95); padding: 0.5rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }

/* >= 768px: nav horizontal y botón oculto */
@media (min-width: 768px) {
  .menu-toggle { display: none; }
  .nav { display: block; position: static; }
  .nav ul { display: flex; gap: 0.3rem; }
}

/* Portada centrada en eje X y más arriba en Y */
.landing { min-height: calc(100dvh - 56px); display: grid; align-content: start; justify-items: center; padding: 7rem 0 1.5rem; }
.landing-inner { display: grid; justify-items: center; gap: 1.2rem; }
.logo { width: min(80vw, 420px); height: auto; filter: drop-shadow(0 10px 20px rgba(0,0,0,.35)); }

.btn { display: inline-block; padding: 0.7rem 1rem; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); }
.btn:hover { background: rgba(255,255,255,0.1); }
.btn-cta { background: var(--accent); color: #1f2937; border: 0; font-weight: 700; letter-spacing: .2px; box-shadow: var(--shadow); }
.btn-cta:hover { background: color-mix(in srgb, var(--accent), black 10%); }
.btn-cta:active { transform: translateY(1px); }

/* Botón principal más grande en la portada */
.landing .btn-cta { padding: 1rem 1.6rem; font-size: 1.125rem; }
@media (min-width: 640px) { .landing .btn-cta { padding: 1.15rem 2rem; font-size: 1.25rem; } }

/* Cards */
.features { padding: 2.2rem 0; }
.features h2 { margin: 0 0 1.2rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
.card { background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 0.4rem; }
.card p { margin: 0; color: var(--muted); }

/* Formulario */
.contact { padding: 2.2rem 0 3rem; }
.form { display: grid; gap: 0.9rem; max-width: 600px; }
.field { display: grid; gap: 0.4rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 1rem 0; color: var(--muted); }

/* Accesibilidad */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* --- Juego: barra inferior de pregunta y respuestas --- */
.corner-logo { position: fixed; top: 10px; right: 12px; z-index: 60; display: inline-block; }
.corner-logo img { height: 40px; width: auto; display: block; filter: drop-shadow(0 6px 12px rgba(0,0,0,.35)); }

/* Cronómetro rectangular con puntas redondeadas */
.timer { position: fixed; top: 50%; left: 50%; transform: translate(-50%, calc(-50% - 18vh)); z-index: 40; }
.timer-inner { 
  width: 200px; height: 70px; 
  border-radius: 0; /* rectángulo */
  background: linear-gradient(180deg, #ffcc00 0%, #ff9900 50%, #ff6600 100%);
  border: 5px solid #333;
  box-shadow: 
    inset 0 -3px 0 rgba(0,0,0,0.4),
    inset 0 3px 0 rgba(255,255,255,0.5),
    0 8px 20px rgba(0,0,0,0.5),
    0 0 0 2px #000;
  display: grid; place-items: center;
  position: relative;
  z-index: 1;
}
/* logo detrás del cronómetro */
.timer::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: min(90vw, 800px);
  height: min(90vw, 800px);
  transform: translate(-50%, -50%);
  background: center/contain no-repeat url("../assets/img/ahora%20caigo.png");
  opacity: 0.32;
  z-index: 0;
  pointer-events: none;
}
.timer-inner::before {
  content: "";
  position: absolute;
  left: -45px; top: 50%; transform: translateY(-50%);
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffcc00 0%, #ff9900 50%, #ff6600 100%);
  border: 5px solid #333;
  box-shadow: 
    inset 0 -3px 0 rgba(0,0,0,0.4),
    inset 0 3px 0 rgba(255,255,255,0.5),
    0 0 0 2px #000;
  clip-path: polygon(0% 0%, 48% 0%, 48% 100%, 0% 100%); /* semicírculo izquierdo cortado antes del borde */
  z-index: 2;
}
.timer-inner::after {
  content: "";
  position: absolute;
  right: -45px; top: 50%; transform: translateY(-50%);
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffcc00 0%, #ff9900 50%, #ff6600 100%);
  border: 5px solid #333;
  box-shadow: 
    inset 0 -3px 0 rgba(0,0,0,0.4),
    inset 0 3px 0 rgba(255,255,255,0.5),
    0 0 0 2px #000;
  clip-path: polygon(52% 0%, 100% 0%, 100% 100%, 52% 100%); /* semicírculo derecho cortado antes del borde */
  z-index: 2;
}
.timer-value { 
  font-size: 2.5rem; font-weight: 700; font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #111;
  letter-spacing: 2px;
  text-shadow: 
    1px 1px 0 rgba(255,255,255,0.5),
    -1px -1px 0 rgba(0,0,0,0.3);
  z-index: 1;
}

/* Círculos con pies interiores */
.timer-circle-left, .timer-circle-right {
  position: absolute;
  width: 80px; height: 80px;
  background: #222;
  border-radius: 50%;
  top: 50%; transform: translateY(-50%);
  z-index: 3;
  display: flex; align-items: center;
  overflow: hidden;
}
.timer-circle-left {
  left: -40px;
  clip-path: polygon(0% 0%, 50% 0%, 50% 100%, 0% 100%);
  justify-content: flex-start;
  padding-left: 8px;
}
.timer-circle-right {
  right: -40px;
  clip-path: polygon(50% 0%, 100% 0%, 100% 100%, 50% 100%);
  justify-content: flex-end;
  padding-right: 8px;
}
.timer-foot {
  width: 28px; height: auto;
  filter: brightness(0) saturate(100%) invert(55%) sepia(100%) saturate(3000%) hue-rotate(360deg) brightness(105%) contrast(105%);
}
.qa { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: var(--qa-h); }
.qa-inner { width: 100%; margin-inline: 0; 
  background: linear-gradient(180deg, #1e46d8 0%, #0b2fa3 100%);
  padding: 1.25rem 1rem 2rem; height: 100%; display: grid; align-content: start; gap: 1rem; border-top: 2px solid rgba(255,255,255,0.08); box-shadow: 0 -8px 20px rgba(0,0,0,0.35); border-radius: 16px 16px 0 0; }
.qa-question { margin: 0; text-align: center; font-weight: 700; font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-size: clamp(1.2rem, 3.6vw, 2.2rem); 
  -webkit-text-stroke: 1px #000; text-stroke: 1px #000;
  text-shadow:
    1px 0 0 #000,
    -1px 0 0 #000,
    0 1px 0 #000,
    0 -1px 0 #000,
    1px 1px 0 #000,
    -1px 1px 0 #000,
    1px -1px 0 #000,
    -1px -1px 0 #000,
    0 2px 6px rgba(0,0,0,.4);
}
.qa-answers { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: nowrap; margin-top: 2rem; }

.answer { cursor: pointer; justify-self: center; min-width: 220px; max-width: 320px; padding: 0.5rem 1rem; border-radius: 0; border: 0; color: #eef6ff; font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-weight: 700; letter-spacing: 0.5px; font-size: clamp(1.05rem, 2.8vw, 1.35rem);
  -webkit-text-stroke: 1px #000; text-stroke: 1px #000; /* contorno sólido */
  text-shadow:
    1px 0 0 #000,
    -1px 0 0 #000,
    0 1px 0 #000,
    0 -1px 0 #000,
    1px 1px 0 #000,
    -1px 1px 0 #000,
    1px -1px 0 #000,
    -1px -1px 0 #000,
    0 0 6px rgba(0,0,0,.35);
  background: linear-gradient(180deg,
    #1d62f0 0%,
    #2a73f6 45%,
    #66b6ff 75%,
    #a5d6ff 100%
  );
  border: 2px solid #d1d5db; /* plateado */
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.55),
    inset 0 -2px 0 rgba(0,0,0,0.35),
    0 6px 14px rgba(0,0,0,0.35);
}
.answer:hover { filter: brightness(1.06); }
.answer:active { transform: translateY(1px); }

/* Estado correcto (verde) */
.answer.is-correct { 
  background: linear-gradient(180deg,
    #16a34a 0%,     /* verde oscuro */
    #22c55e 45%,    /* verde medio */
    #86efac 75%,    /* verde claro */
    #bbf7d0 100%    /* verde muy claro */
  );
  color: #ffffff !important;
  border-color: #86efac;
  animation: correctPulse 0.5s ease;
}

/* Estado incorrecto (rojo) */
.answer.is-incorrect { 
  background: linear-gradient(180deg,
    #dc2626 0%,     /* rojo oscuro */
    #ef4444 45%,    /* rojo medio */
    #f87171 75%,    /* rojo claro */
    #fca5a5 100%    /* rojo muy claro */
  );
  color: #ffffff !important;
  border-color: #f87171;
  animation: incorrectShake 0.5s ease;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 480px) {
  :root { --qa-h: 44vh; }
  .qa-inner { padding: 1rem 0.8rem 1.2rem; }
  .qa-question { font-size: clamp(1.1rem, 5vw, 1.6rem); }
  .qa-answers { flex-direction: column; align-items: center; gap: 10px; margin-top: 1.2rem; }
  .answer { width: 92%; min-width: 0; max-width: none; padding: 0.7rem 1rem; font-size: clamp(1.1rem, 5.2vw, 1.4rem); }
}

/* Modal de video/formulario */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(8px); animation: overlayFadeIn 220ms ease both; }
.modal-dialog { position: relative; z-index: 81; width: min(92vw, 860px); max-height: 90vh; overflow: auto; border-radius: 16px; background: rgba(17,24,39,0.6); border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 30px 60px rgba(0,0,0,0.6); padding: 1rem; animation: modalIn 300ms ease-out both; transform-origin: top center; }
.modal-logo { height: 48px; width: auto; display: block; margin: 0 auto 0.75rem; filter: drop-shadow(0 6px 12px rgba(0,0,0,.35)); }
.modal-close { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 9999px; border: 1px solid rgba(255,255,255,0.2); background: rgba(15,23,42,0.6); color: #ffffff; display: grid; place-items: center; cursor: pointer; transition: transform 120ms ease, background 120ms ease; }
.modal-close:hover { transform: scale(1.06); background: rgba(15,23,42,0.8); }

/* Overlay de carga al pasar de index -> juego */
.loading-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.loading-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); animation: overlayFadeIn 180ms ease forwards; }
.loading-content { position: relative; z-index: 101; display: grid; place-items: center; padding: 1rem; }
.loading-logo { height: 120px; width: auto; max-width: 70vw; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.5)); animation: loadingPulse 1200ms ease-in-out infinite; }
/* estado de salida del overlay */
.loading-overlay.exit { animation: overlayFadeOut 420ms ease forwards; }
.loading-overlay.exit .loading-logo { animation: loadingOut 420ms ease forwards; }

@keyframes loadingPulse {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  0% { opacity: 0; transform: translateY(10px) scale(0.98); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes overlayFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes loadingOut {
  0% { transform: scale(1); filter: drop-shadow(0 8px 24px rgba(0,0,0,0.5)); opacity: 1; }
  100% { transform: scale(0.98); filter: blur(2px); opacity: 0; }
}

/* Ocultar contenido mientras carga */
body.is-loading .timer,
body.is-loading .qa { visibility: hidden; }

/* Animación de entrada del layout del juego */
@keyframes fadeInSoft {
  from { opacity: 0; filter: blur(4px); }
  to { opacity: 1; filter: blur(0); }
}
body.is-entering .timer { animation: fadeInSoft 520ms ease-out both; }
body.is-entering .qa { animation: fadeInSoft 620ms ease-out 80ms both; }

