/* --- Variables --- */
:root {
  --bg-deep: #0a0b0f;
  --bg-card: #12141c;
  --bg-elevated: #1a1d28;
  --text-primary: #f0f2f8;
  --text-muted: #8b92a8;
  --accent: #6b8cff;
  --accent-hover: #8aa4ff;
  --accent-glow: rgba(107, 140, 255, 0.25);
  --error: #e85d6a;
  --error-bg: rgba(232, 93, 106, 0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.25);
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Reset & base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Animated background --- */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(107, 140, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(140, 100, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 90%, rgba(80, 180, 200, 0.05) 0%, transparent 50%);
  animation: bgShift 18s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% {
    opacity: 0.7;
    transform: scale(1) translate(0, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1.05) translate(-1%, -1%);
  }
}

/* --- Password gate --- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.5rem, env(safe-area-inset-top))
    max(1.5rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1.5rem, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity var(--transition), visibility var(--transition);
}

.gate.gate--exit {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-bg {
  position: absolute;
  inset: 0;
  background: var(--bg-deep);
  background-image:
    linear-gradient(160deg, rgba(107, 140, 255, 0.06) 0%, transparent 40%),
    linear-gradient(220deg, rgba(140, 100, 255, 0.04) 0%, transparent 45%);
}

.gate-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2rem;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
  animation: gateFadeIn 0.6s ease-out;
}

@keyframes gateFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gate-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.gate-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gate-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.gate-input.shake {
  animation: shake 0.45s ease;
  border-color: var(--error);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}

.gate-error {
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--error);
  opacity: 0;
  transition: opacity 0.25s;
}

.gate-error.visible {
  opacity: 1;
}

.gate-btn {
  margin-top: 0.25rem;
  min-height: 48px;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #5a7ae8);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.gate-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #6b8cff);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.gate-btn:active {
  transform: translateY(0);
}

/* --- Main layout --- */
.main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.main.hidden {
  display: none;
}

.main.main--visible {
  display: block;
  opacity: 1;
}

.main.main--fade-in {
  animation: mainReveal 0.9s ease forwards;
}

@keyframes mainReveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem max(1.5rem, env(safe-area-inset-right)) 1rem max(1.5rem, env(safe-area-inset-left));
  padding-top: max(1rem, env(safe-area-inset-top));
  background: rgba(10, 11, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem 0.25rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--accent);
}

/* --- Sections --- */
.section {
  padding: 4rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-inner {
  width: 100%;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

/* Fade-in on scroll */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Hero --- */
.hero {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.hero-content {
  max-width: 640px;
}

.hero-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  max-width: 32ch;
}

/* --- Games / cards --- */
.games {
  padding-bottom: 5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1.5rem;
}

/* VG1 game launcher card */
.games .card-game {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 340px;
  padding: 1.5rem 1.5rem 1.35rem;
  background:
    linear-gradient(168deg, rgba(22, 25, 36, 0.95) 0%, rgba(12, 14, 22, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.4s ease,
    box-shadow 0.4s ease;
}

.games .card-game:hover {
  transform: translateY(-5px) scale(1.01);
  border-color: rgba(107, 140, 255, 0.32);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(107, 140, 255, 0.15),
    0 12px 40px rgba(107, 140, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.games .card-game__title {
  margin: 0 0 0.3rem;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text-primary);
}

.games .card-game__subtitle {
  margin: 0 0 0.9rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.games .card-game__features {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  margin: 0 0 1.35rem;
}

.games .card-game__sep {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

.games .card-game__feature {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: rgba(232, 236, 248, 0.82);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 2px 8px rgba(0, 0, 0, 0.18);
  transition:
    color 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

.games .card-game__feature:hover {
  color: #fff;
  background: rgba(107, 140, 255, 0.14);
  border-color: rgba(107, 140, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 14px rgba(107, 140, 255, 0.2);
  transform: translateY(-1px);
}

.games a.card-game__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: #ffffff;
  background: linear-gradient(135deg, #6b8cff 0%, #5a7ae8 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow:
    0 2px 12px rgba(107, 140, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.games a.card-game__btn:link,
.games a.card-game__btn:visited {
  color: #ffffff;
  text-decoration: none;
}

.games a.card-game__btn:hover {
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(107, 140, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  filter: brightness(1.08);
}

.games a.card-game__btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* --- Footer --- */
.site-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .gate-card {
    padding: 2rem 1.5rem;
  }

  .gate-title {
    font-size: 1.5rem;
  }

  .site-header {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .nav {
    gap: 0.75rem;
  }

  .section {
    padding: 3rem max(1rem, env(safe-area-inset-left)) 3rem max(1rem, env(safe-area-inset-right));
  }

  .hero {
    min-height: auto;
    padding-top: 3rem;
  }

  .hero-subtitle {
    max-width: none;
  }

  .site-footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .games .card-game {
    max-width: none;
    padding: 1.35rem 1.25rem 1.2rem;
  }

  .games .card-game__features {
    gap: 0.35rem;
    margin-bottom: 1.2rem;
  }

  .games .card-game__feature {
    font-size: 0.65rem;
    padding: 0.28rem 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .bg-animation,
  .gate-card,
  .gate-input.shake,
  .main.main--fade-in {
    animation: none;
  }

  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
