* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f0f12;
  color: #e8e8f0;
  font-family: "Segoe UI", system-ui, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pantalla {
  display: none;
  width: 100%;
  height: 100%;
}

.pantalla--activa {
  display: flex;
  align-items: center;
  justify-content: center;
}

#juego.pantalla--activa {
  flex-direction: column;
}

#menu {
  position: relative;
}

#menu.pantalla--activa {
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
}

/* —— Menú —— */

.menu-fondo {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #0a0a14 0%, #12122a 40%, #1a1035 100%);
  overflow: hidden;
}

.menu-fondo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 60% at 50% 0%,
    rgba(92, 107, 192, 0.25),
    transparent 70%
  );
  animation: fondo-pulso 6s ease-in-out infinite alternate;
}

.menu-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: orb-flotar 12s ease-in-out infinite;
}

.menu-orb--1 {
  width: 280px;
  height: 280px;
  background: #5c6bc0;
  top: -8%;
  left: -6%;
  animation-duration: 14s;
}

.menu-orb--2 {
  width: 220px;
  height: 220px;
  background: #c77dff;
  bottom: 10%;
  right: -4%;
  animation-delay: -4s;
  animation-duration: 11s;
}

.menu-orb--3 {
  width: 180px;
  height: 180px;
  background: #20c997;
  bottom: 35%;
  left: 15%;
  animation-delay: -7s;
  animation-duration: 16s;
}

.menu-flecha-decor {
  position: absolute;
  width: 48px;
  height: 48px;
  opacity: 0.12;
  background: #e8e8f0;
  clip-path: polygon(
    0% 35%,
    55% 35%,
    55% 10%,
    100% 50%,
    55% 90%,
    55% 65%,
    0% 65%
  );
  animation: flecha-flotar 8s ease-in-out infinite;
}

.menu-flecha-decor--1 {
  --rot: 25deg;
  top: 12%;
  right: 18%;
  animation-duration: 9s;
}

.menu-flecha-decor--2 {
  --rot: -40deg;
  bottom: 28%;
  left: 8%;
  animation-delay: -2s;
  width: 36px;
  height: 36px;
}

.menu-flecha-decor--3 {
  --rot: 90deg;
  top: 38%;
  left: 22%;
  animation-delay: -5s;
  width: 40px;
  height: 40px;
}

.menu-flecha-decor--4 {
  --rot: 180deg;
  bottom: 12%;
  right: 28%;
  animation-delay: -3s;
  width: 32px;
  height: 32px;
}

.menu-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.5rem 0.75rem;
  gap: 0.4rem;
  overflow: hidden;
}

.menu-panel {
  width: min(400px, 94vw);
  flex-shrink: 0;
  padding: 1rem 1.1rem 0.85rem;
  background: rgba(22, 22, 32, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  animation: panel-entrada 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-titulo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
  text-align: center;
  background: linear-gradient(
    90deg,
    #e8e8f0 0%,
    #a8b4f0 35%,
    #c77dff 65%,
    #e8e8f0 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titulo-brillo 5s linear infinite;
}

.menu-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.menu-fila {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.menu-grupo {
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.menu-grupo legend {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9898a8;
}

.menu-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.menu-estilos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

.menu-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(36, 36, 46, 0.6);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.menu-chip:hover {
  background: rgba(36, 36, 46, 0.95);
}

.menu-chip:has(input:checked) {
  background: rgba(37, 37, 53, 0.95);
  border-color: #7b8ee0;
  box-shadow: 0 0 12px rgba(92, 107, 192, 0.2);
}

.menu-chip input {
  accent-color: #5c6bc0;
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.menu-chip span {
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

.menu-select {
  width: 100%;
  min-width: 5.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #2e2e3a;
  background: #24242e;
  color: #e8e8f0;
  font-size: 0.8rem;
  cursor: pointer;
}

.menu-select:focus {
  outline: 2px solid #5c6bc0;
  outline-offset: 1px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn--primario {
  background: linear-gradient(135deg, #5c6bc0 0%, #7b5cd0 100%);
  color: #fff;
  margin-top: 0.15rem;
  box-shadow: 0 4px 16px rgba(92, 107, 192, 0.35);
}

.btn--primario:hover {
  background: linear-gradient(135deg, #6d7bd0 0%, #8d6de0 100%);
  box-shadow: 0 6px 28px rgba(92, 107, 192, 0.5);
}

.btn--primario:active {
  transform: scale(0.98);
}

.menu-pie {
  flex-shrink: 0;
  width: 100%;
  max-width: 480px;
  text-align: center;
  padding: 0 0.25rem;
  line-height: 1.35;
}

.menu-credito {
  font-size: 0.72rem;
  color: #b0b0c0;
  margin-bottom: 0.2rem;
}

.menu-credito strong {
  color: #e8e8f0;
  font-weight: 600;
}

.menu-pie-linea {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.35rem;
  margin-bottom: 0.15rem;
}

.menu-redes-titulo {
  font-size: 0.68rem;
  font-weight: 600;
  color: #787888;
}

.menu-redes {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.4rem;
}

.menu-redes a {
  font-size: 0.68rem;
  color: #a8b4f0;
  text-decoration: none;
  transition: color 0.15s;
}

.menu-redes a:hover {
  color: #fff;
}

.menu-web {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #c77dff;
  text-decoration: none;
  transition: color 0.15s;
}

.menu-web:hover {
  color: #e0b0ff;
}

@keyframes fondo-pulso {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

@keyframes orb-flotar {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -20px) scale(1.08);
  }
  66% {
    transform: translate(-20px, 25px) scale(0.95);
  }
}

@keyframes flecha-flotar {
  0%,
  100% {
    transform: translateY(0) rotate(var(--rot, 0deg));
    opacity: 0.1;
  }
  50% {
    transform: translateY(-18px) rotate(calc(var(--rot, 0deg) + 12deg));
    opacity: 0.18;
  }
}

@keyframes panel-entrada {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes titulo-brillo {
  to {
    background-position: 200% center;
  }
}

@media (max-height: 640px) {
  .menu-panel {
    padding: 0.75rem 0.9rem 0.65rem;
  }

  .menu-titulo {
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
  }

  .menu-form {
    gap: 0.4rem;
  }

  .menu-chip {
    padding: 0.32rem 0.45rem;
  }

  .menu-chip span {
    font-size: 0.75rem;
  }

  .menu-pie {
    padding: 0;
  }

  .menu-credito,
  .menu-redes a,
  .menu-web,
  .menu-redes-titulo {
    font-size: 0.62rem;
  }
}

/* —— Juego —— */

#juego {
  position: relative;
}

.cuenta-atras {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 18, 0.92);
  z-index: 20;
}

.cuenta-atras-numero {
  font-size: min(32vmin, 220px);
  font-weight: 800;
  color: #e8e8f0;
  line-height: 1;
}

.cuenta-atras-numero--pulso {
  animation: cuenta-pulso 0.85s ease;
}

@keyframes cuenta-pulso {
  0% {
    transform: scale(0.5);
    opacity: 0.2;
  }
  45% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.cuenta-atras[hidden] {
  display: none;
}

.juego-hud {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.juego-rondas {
  font-size: 0.95rem;
  font-weight: 600;
  color: #9898a8;
  letter-spacing: 0.02em;
}

.flecha {
  position: relative;
  width: min(70vmin, 500px);
  height: min(70vmin, 500px);
  opacity: 1;
  transition: opacity 0.4s ease;
  --flecha-color: #e8e8f0;
}

.flecha.oculta {
  opacity: 0;
}

.flecha.derecha {
  transform: rotate(0deg);
}

.flecha.izquierda {
  transform: rotate(180deg);
}

.flecha.arriba {
  transform: rotate(-90deg);
}

.flecha.abajo {
  transform: rotate(90deg);
}

.flecha::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--flecha-color);
  clip-path: polygon(
    0% 35%,
    55% 35%,
    55% 10%,
    100% 50%,
    55% 90%,
    55% 65%,
    0% 65%
  );
}

.flecha-contenido {
  position: absolute;
  left: 58%;
  right: 4%;
  top: 22%;
  bottom: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(14vmin, 96px);
  font-weight: 800;
  color: #0f0f12;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.flecha.derecha .flecha-contenido {
  transform: rotate(0deg);
}

.flecha.izquierda .flecha-contenido {
  transform: rotate(180deg);
}

.flecha.arriba .flecha-contenido {
  transform: rotate(90deg);
}

.flecha.abajo .flecha-contenido {
  transform: rotate(-90deg);
}

.flecha-contenido[hidden] {
  display: none;
}

/* —— Fin de partida —— */

.fin-panel {
  text-align: center;
  padding: 2rem;
}

.fin-panel h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.fin-mensaje {
  color: #9898a8;
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}
