/* Variables de color basadas en la identidad de MKS Games */
:root {
  --mks-orange: #FF6600;
  --mks-dark: #121212;
  --mks-card: #1e1e1e;
  --mks-text: #f0f0f0;
  --mks-gray: #888888;
}

/* Estilos base */
body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--mks-dark);
  color: var(--mks-text);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Scrollbar estilo iOS en la pagina principal (sin flechas, barra redondeada) */
html {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

html::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

html::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  min-height: 2.5rem;
  border: 1px solid transparent;
  background-clip: padding-box;
}

html::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.36);
}

html::-webkit-scrollbar-thumb:active {
  background-color: rgba(255, 255, 255, 0.46);
}

html::-webkit-scrollbar-button,
html::-webkit-scrollbar-button:single-button,
html::-webkit-scrollbar-button:vertical:start:decrement,
html::-webkit-scrollbar-button:vertical:end:increment,
html::-webkit-scrollbar-button:horizontal:start:decrement,
html::-webkit-scrollbar-button:horizontal:end:increment {
  display: none;
  width: 0;
  height: 0;
}

html::-webkit-scrollbar-corner {
  background: transparent;
}

/* Encabezado y Navegación */
header {
  background-color: var(--mks-card);
  padding: 20px 50px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--mks-orange);
}

.logo-container img {
  height: 40px;
}

/* Contenedor Principal */
main {
  flex: 1;
  padding: 50px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

h1 {
  text-align: center;
  color: var(--mks-orange);
  font-size: 2.5rem;
  margin-bottom: 40px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-style: italic;
}

/* Cuadrícula de Juegos */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
}

/* Tarjeta de cada Juego */
.game-card {
  background-color: var(--mks-card);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #333;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(255, 102, 0, 0.2);
  border-color: var(--mks-orange);
}

.game-card.coming-soon {
  opacity: 0.7;
}

.game-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
  border-color: #333;
}

/* Sección de Imagen del Juego */
.game-image {
  height: 200px;
  background-color: #2a2a2a;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.game-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-icon {
  font-size: 48px;
  color: var(--mks-gray);
}

/* Etiquetas de Estado (Disponible / Próximamente) */
.status-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
}

.status-available {
  background-color: var(--mks-orange);
  color: #fff;
}

.status-soon {
  background-color: var(--mks-gray);
  color: #fff;
}

/* Información y Botones del Juego */
.game-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-info h2 {
  margin: 0 0 10px 0;
  font-size: 1.5rem;
}

.game-info p {
  color: var(--mks-gray);
  flex: 1;
  margin-bottom: 20px;
  line-height: 1.5;
}

.play-btn {
  background-color: var(--mks-orange);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.3s;
}

.play-btn:hover {
  background-color: #e65c00;
}

.play-btn.disabled {
  background-color: #444;
  color: #888;
  cursor: not-allowed;
}

/* Pie de página */
footer {
  background-color: var(--mks-card);
  text-align: center;
  padding: 30px;
  border-top: 1px solid #333;
  margin-top: auto;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.footer-logo {
  height: 30px;
  opacity: 0.8;
}

.footer-content p {
  margin: 0;
  color: var(--mks-gray);
  font-size: 0.9rem;
}

/* Efecto de brillo sutil para tarjetas */
.game-card:hover .glow {
  opacity: 1;
}

.glow {
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle at center, rgba(255, 102, 0, 0.15) 0%, transparent 70%);
}

/* Efecto de resplandor diagonal animado para el logo */
.logo-shine {
  position: relative;
  display: inline-block;
  overflow: hidden;
}

.logo-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.4) 45%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.4) 55%,
    transparent 70%
  );
  transform: skewX(-20deg);
  animation: logo-saber-shine 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes logo-saber-shine {
  0%, 75% {
    left: -60%;
    opacity: 0;
  }
  80% {
    opacity: 1;
  }
  100% {
    left: 150%;
    opacity: 0;
  }
}

/* Fondo grid cibernético: perspectiva por canvas (horizonte al 50%) */
.cyber-grid-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background-color: var(--mks-dark);
}

.cyber-grid-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.cyber-grid-canvas--lines {
  z-index: 0;
}

.cyber-grid-canvas--ship {
  z-index: 1;
}

.cyber-grid-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(to top, #0a0a0a 0%, rgba(10, 10, 10, 0.7) 10%, transparent 38%),
    radial-gradient(ellipse 120% 85% at 50% 50%, transparent 0%, rgba(18, 18, 18, 0.25) 42%, #121212 90%);
  pointer-events: none;
}

.page-front {
  position: relative;
  z-index: 10;
}

.cyber-grid-bg {
  position: relative;
}

/* Enlace sutil de Aportaciones en fichas de juego */
.aportaciones-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.15rem 0;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.aportaciones-trigger:hover,
.aportaciones-trigger:focus-visible {
  color: var(--mks-orange);
  outline: none;
}

.aportaciones-trigger svg {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.75;
}

.game-card .aportaciones-wrap {
  border-top: 1px solid rgba(55, 65, 81, 0.5);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.game-card .p-6.text-center .aportaciones-wrap {
  display: flex;
  justify-content: center;
}

body.aportaciones-modal-open {
  overflow: hidden;
}

#aportaciones-modal.hidden {
  display: none;
}

#aportaciones-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.aportaciones-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.aportaciones-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 28rem;
  max-height: min(85vh, 32rem);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.32) transparent;
  background: #1e1e1e;
  border: 1px solid #374151;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 0 30px rgba(255, 102, 0, 0.15);
}

/* Scrollbar estilo iOS (delgado, redondeado, semitransparente) */
.aportaciones-panel::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.aportaciones-panel::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.5rem 0;
}

.aportaciones-panel::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  min-height: 2.5rem;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.aportaciones-panel::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.38);
}

.aportaciones-panel::-webkit-scrollbar-thumb:active {
  background-color: rgba(255, 255, 255, 0.48);
}

.aportaciones-panel::-webkit-scrollbar-corner {
  background: transparent;
}

.aportaciones-panel h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  color: #fff;
  margin: 0 2rem 0.5rem 0;
}

.aportaciones-intro {
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.aportaciones-cerrar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: color 0.2s;
}

.aportaciones-cerrar:hover,
.aportaciones-cerrar:focus-visible {
  color: var(--mks-orange);
  outline: none;
}

#aportaciones-modal-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.aportaciones-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 102, 0, 0.06);
  border-left: 2px solid var(--mks-orange);
  border-radius: 0 0.5rem 0.5rem 0;
}

.aportaciones-nombre {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f3f4f6;
}

.aportaciones-texto {
  font-size: 0.8rem;
  color: #9ca3af;
}

#aportaciones-modal-vacio {
  font-size: 0.85rem;
  color: #6b7280;
  font-style: italic;
  margin: 0;
}

/* Botón activar/desactivar sonido (estilo menú de videojuego) */
.sound-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid #374151;
  background: rgba(30, 30, 30, 0.85);
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  color: var(--mks-orange);
  border-color: rgba(255, 102, 0, 0.55);
  box-shadow: 0 0 12px rgba(255, 102, 0, 0.2);
  outline: none;
}

.sound-toggle--on {
  color: var(--mks-orange);
  border-color: rgba(255, 102, 0, 0.65);
  background: rgba(255, 102, 0, 0.08);
}

.sound-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sound-toggle-icon--on {
  opacity: 0;
  transform: scale(0.85);
}

.sound-toggle-icon--off {
  opacity: 1;
  transform: scale(1);
}

.sound-toggle--on .sound-toggle-icon--on {
  opacity: 1;
  transform: scale(1);
}

.sound-toggle--on .sound-toggle-icon--off {
  opacity: 0;
  transform: scale(0.85);
}

/* Pantalla LOADING estilo videojuego */
body.game-loader-active {
  overflow: hidden;
}

.game-loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, rgba(255, 102, 0, 0.12) 0%, transparent 55%),
    rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(6px);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.game-loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.game-loader-panel {
  width: min(92vw, 26rem);
  padding: 2rem 1.75rem;
  border: 1px solid rgba(255, 102, 0, 0.35);
  border-radius: 1rem;
  background: rgba(18, 18, 18, 0.92);
  box-shadow: 0 0 40px rgba(255, 102, 0, 0.18);
  text-align: center;
}

.game-loader-logo {
  height: 3rem;
  margin: 0 auto 1.25rem;
  opacity: 0.95;
}

.game-loader-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  color: #fff;
  margin: 0 0 1rem;
  text-transform: uppercase;
}

.game-loader-dots {
  display: inline-block;
  width: 1.5rem;
  text-align: left;
  animation: game-loader-dots 1.2s steps(4, end) infinite;
}

@keyframes game-loader-dots {
  0% { opacity: 0.35; }
  50% { opacity: 0.65; }
  100% { opacity: 1; }
}

.game-loader-bar {
  width: 100%;
  height: 0.55rem;
  border-radius: 999px;
  background: #2a2a2a;
  overflow: hidden;
  margin-bottom: 0.85rem;
  border: 1px solid #3a3a3a;
}

.game-loader-bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #cc5200, var(--mks-orange));
  box-shadow: 0 0 12px rgba(255, 102, 0, 0.55);
  transition: width 0.25s ease;
}

.game-loader-status {
  margin: 0;
  font-size: 0.82rem;
  color: #9ca3af;
  letter-spacing: 0.03em;
}

.game-loader-start {
  margin-top: 1.25rem;
  padding: 0.75rem 2rem;
  border: 1px solid rgba(255, 102, 0, 0.7);
  border-radius: 999px;
  background: rgba(255, 102, 0, 0.15);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  animation: game-loader-pulse 1.4s ease-in-out infinite;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.game-loader-start:hover,
.game-loader-start:focus-visible {
  background: var(--mks-orange);
  transform: scale(1.04);
  box-shadow: 0 0 18px rgba(255, 102, 0, 0.45);
  outline: none;
}

@keyframes game-loader-pulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 102, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 102, 0, 0.35);
  }
}

.game-loader-start.hidden {
  display: none;
}

/* Diseño Adaptativo (Smartphones y Tablets) */
@media (max-width: 768px) {
  header {
    justify-content: center;
    padding: 15px;
  }
  main {
    padding: 30px 15px;
  }
}