/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --gold: #FFD700;
  --gold-dark: #F0B90B;
  --purple: #8B5CF6;
  --purple-dim: #6D28D9;
  --cyan: #06B6D4;
  --text-primary: #f0f0f0;
  --text-muted: #888899;
  --glass-bg: rgba(18, 18, 26, 0.6);
  --glass-border: rgba(255, 215, 0, 0.08);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* === Particle Canvas === */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* === Header === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.3s ease;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* === Logo === */
.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--gold) 0%, #FFF1A8 40%, var(--gold-dark) 70%, var(--gold) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer-gold 4s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  cursor: default;
  user-select: none;
}

.logo-icon {
  font-size: 1.5rem;
  -webkit-text-fill-color: var(--gold);
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
  animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes shimmer-gold {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.4)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.8)); }
}

/* === Navigation === */
.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  position: relative;
  transition: color 0.3s ease, background 0.3s ease;
}

.nav-link:not([href]) {
  cursor: default;
  pointer-events: none;
}

.nav-link[href]:hover {
  color: var(--gold);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--purple));
  border-radius: 1px;
  transition: transform 0.3s ease;
}

.nav-link.active {
  color: var(--gold);
}

.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* === Hero Section === */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  animation: fadeInUp 1.2s ease-out;
}

.hero-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 1.5rem;
}

.hero-title-line {
  display: block;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.06);
}

.hero-title-line.accent {
  background: linear-gradient(90deg, var(--gold), var(--purple), var(--cyan));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-flow 5s linear infinite;
  filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.3));
}

@keyframes gradient-flow {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 580px;
  margin: 0 auto 2.5rem;
  animation: fadeInUp 1.2s ease-out 0.3s both;
}

/* === Decorative Chips === */
.hero-chips {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  animation: fadeInUp 1.2s ease-out 0.6s both;
}

.chip {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid;
  position: relative;
  animation: float 3s ease-in-out infinite;
}

.chip::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1.5px dashed;
  opacity: 0.5;
}

.chip:nth-child(1) {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.25), inset 0 0 10px rgba(255, 215, 0, 0.1);
  animation-delay: 0s;
}
.chip:nth-child(1)::before { border-color: var(--gold); }

.chip:nth-child(2) {
  border-color: var(--purple);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25), inset 0 0 10px rgba(139, 92, 246, 0.1);
  animation-delay: 0.5s;
}
.chip:nth-child(2)::before { border-color: var(--purple); }

.chip:nth-child(3) {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.25), inset 0 0 10px rgba(6, 182, 212, 0.1);
  animation-delay: 1s;
}
.chip:nth-child(3)::before { border-color: var(--cyan); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* === Hero Glow === */
.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, rgba(255, 215, 0, 0.05) 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* === Entrance Animations === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Page Section (Games & Demo pages) === */
.page-section {
  position: relative;
  z-index: 1;
  padding: 120px 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  text-align: center;
  margin-bottom: 3rem;
  background: linear-gradient(90deg, var(--gold), var(--purple), var(--cyan));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-flow 5s linear infinite;
}

/* === Games Grid === */
.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

/* === Game Card === */
.game-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.game-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 8px 40px rgba(255, 215, 0, 0.15), 0 0 20px rgba(139, 92, 246, 0.1);
  border-color: rgba(255, 215, 0, 0.25);
}

.game-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.game-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.game-card:hover .game-card-image img {
  transform: scale(1.08);
}

.game-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.game-card-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.btn-play-demo {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(135deg, var(--gold-dark), var(--purple));
  padding: 0.65rem 1.6rem;
  border-radius: 8px;
  text-decoration: none;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.btn-play-demo:hover {
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), 0 0 40px rgba(139, 92, 246, 0.2);
  transform: translateY(-2px);
}

/* === Empty Card Placeholder === */
.game-card-empty {
  border: 2px dashed rgba(255, 215, 0, 0.1);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}

.game-card-empty span {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--text-muted);
  opacity: 0.4;
}

/* === Demo Page === */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 1rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: color 0.3s ease, background 0.3s ease;
}

.back-btn:hover {
  color: var(--gold);
  background: rgba(255, 215, 0, 0.06);
}

.game-frame-container {
  border: 1px solid rgba(255, 215, 0, 0.12);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 1rem;
  position: relative;
}

.game-iframe {
  display: block;
  width: 100%;
  height: 80vh;
  border: none;
}

/* === Responsive === */
@media (max-width: 640px) {
  .header-inner {
    padding: 0 1.2rem;
    height: 60px;
  }

  .logo {
    font-size: 1rem;
  }

  .logo-icon {
    font-size: 1.2rem;
  }

  .nav-link {
    font-size: 0.82rem;
    padding: 0.4rem 0.7rem;
  }

  .hero {
    padding: 5rem 1.2rem 3rem;
  }

  .page-section {
    padding: 100px 1.2rem 3rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .game-card-empty {
    min-height: 160px;
  }

  /* Game page mobile: true fullscreen */
  .game-page,
  .game-page html {
    height: 100%;
    overflow: hidden;
  }

  .game-page .header,
  .game-page #particle-canvas {
    display: none;
  }

  .game-page main,
  .game-page .page-section {
    padding: 0;
    margin: 0;
    max-width: none;
    height: 100%;
  }

  .game-page .back-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    margin: 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
  }

  .game-page .game-frame-container {
    border: none;
    border-radius: 0;
    margin: 0;
    height: 100%;
  }

  .game-page .game-iframe {
    height: 100vh;
    height: 100dvh;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
