:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --bg: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.9);
  --text: #0f172a;
  --text-light: #cbd5e1;
  --border: rgba(255, 255, 255, 0.2);
  --success: #10b981;
  --danger: #ef4444;
  --arkanoid-gold: #ffd54f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}

/* =========================
   ESTILOS GENERALES DEL PORTAL
========================= */
body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background-color: #0f172a;
  background-image:
    linear-gradient(to bottom, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.9)),
    url("https://estaticos-cdn.prensaiberica.es/clip/569edc76-19c8-4b58-bff5-fd7aec54d9fb_16-9-discover-aspect-ratio_default_0_x555y246.webp");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.6;

  /* --- CAMBIOS PARA EL FOOTER --- */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0; /* Quitamos el padding inferior del body para que el footer toque el borde */
}

.top-bar {
  background: rgba(37, 99, 235, 0.95);
  backdrop-filter: blur(10px);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-icon {
  width: 38px;
  height: 38px;
  background: white;
  color: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}
.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-subtitle {
  font-size: 0.8rem;
  opacity: 0.9;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-primary {
  background: white;
  color: var(--primary);
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.btn-icon {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.25);
}
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.85rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.2s;
}
.btn-google:hover {
  background: #f8fafc;
}
.btn-text {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  text-decoration: underline;
}

.main-nav {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.main-nav ul {
  list-style: none;
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0 1rem;
  scrollbar-width: none;
}
.main-nav ul::-webkit-scrollbar {
  display: none;
}
.nav-link {
  display: block;
  padding: 1rem 1.25rem;
  color: #475569;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}
.nav-link.active,
.nav-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  animation: fadeIn 0.5s ease;

  /* --- CAMBIO CLAVE --- */
  flex: 1; /* Esto empuja el footer hacia abajo automáticamente */
  width: 100%;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.hero p {
  color: #e2e8f0;
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.1rem;
}

.card-grid {
  display: grid;
  gap: 1.25rem;
}
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}
.card-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.tag {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.tag.success {
  background: #d1fae5;
  color: #065f46;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  padding: 2.5rem;
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease;
}
@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.close-modal {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.close-modal:hover {
  background: #f1f5f9;
  color: var(--danger);
}
.divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 1.5rem 0;
}
.small-text {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 0.75rem;
}
#dni-input {
  width: 100%;
  padding: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  text-align: center;
  letter-spacing: 2px;
  font-weight: 600;
  background: white;
}
#dni-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  text-align: center;
  font-weight: 600;
}
.hidden {
  display: none !important;
}

#mapa {
  height: 350px;
  border-radius: 16px;
  border: 1px solid var(--border);
  margin-top: 1rem;
}

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: #94a3b8;
  font-size: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  
  /* --- CAMBIO CLAVE --- */
  margin-top: auto; /* Refuerzo para asegurar que se quede al final */
  width: 100%;
}
}

/* =========================
   ESTILOS ESPECÍFICOS PARA ARKANOID
========================= */
/* El fondo de la página se mantiene oscuro para que el juego resalte */
body.pagina-arkanoid {
  background: linear-gradient(180deg, #090909 0%, #1a1a1a 100%);
  color: var(--arkanoid-gold);
  background-image: none;
  background-attachment: scroll;
}

/* PERO la cabecera y el menú fuerzan los colores del portal principal */
.pagina-arkanoid .top-bar {
  background: rgba(37, 99, 235, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pagina-arkanoid .main-nav {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pagina-arkanoid .nav-link {
  color: #475569;
}
.pagina-arkanoid .nav-link.active,
.pagina-arkanoid .nav-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.contenido-arkanoid {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px 70px;
}

.bloque-arkanoid {
  width: 100%;
  max-width: 950px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 213, 79, 0.35);
  border-radius: 30px;
  padding: 45px;
  text-align: center;
  box-shadow:
    0 0 30px rgba(255, 213, 79, 0.18),
    0 18px 45px rgba(0, 0, 0, 0.45);
}

.bloque-arkanoid h1 {
  font-size: 3rem;
  margin-bottom: 12px;
  text-shadow: 0 0 18px rgba(255, 213, 79, 0.55);
  color: var(--arkanoid-gold);
}

.bloque-arkanoid p {
  color: #f1f1f1;
  margin-bottom: 24px;
}

#canvasArkanoid {
  background:
    linear-gradient(rgba(255, 213, 79, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 213, 79, 0.05) 1px, transparent 1px),
    #050505;
  background-size: 28px 28px;
  border: 3px solid var(--arkanoid-gold);
  border-radius: 18px;
  display: block;
  margin: 0 auto 20px;
  max-width: 100%;
  box-shadow:
    0 0 22px rgba(255, 213, 79, 0.45),
    inset 0 0 30px rgba(255, 213, 79, 0.08);
}

.instrucciones-arkanoid {
  color: #dddddd;
  font-size: 1rem;
  margin-bottom: 20px;
}

.boton-reiniciar {
  padding: 14px 26px;
  border: none;
  border-radius: 14px;
  background: var(--arkanoid-gold);
  color: #111111;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: 0 8px 22px rgba(255, 213, 79, 0.25);
}
.boton-reiniciar:hover {
  background: white;
  transform: translateY(-3px);
}

/* Responsive */
@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #mapa {
    height: 450px;
  }
  .hero h1 {
    font-size: 2.5rem;
  }
}

/* Asegurar que el footer también se quede abajo en la página del juego */
body.pagina-arkanoid {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.pagina-arkanoid main.contenido-arkanoid {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}
