@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:        #0a0a0f;
  --surface:   #13131a;
  --surface2:  #1c1c28;
  --border:    #2a2a3d;
  --accent:    #f0c040;
  --accent2:   #e05a2b;
  --accent3:   #5b8fff;
  --text:      #e8e8f0;
  --muted:     #6b6b8a;
  --radius:    8px;
  --font-game: 'Press Start 2P', monospace;
  --font-body: 'DM Sans', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Scanline overlay ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.07) 2px,
    rgba(0,0,0,0.07) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

a { color: inherit; text-decoration: none; }

/* ---- NAV ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-game);
  font-size: 0.6rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  line-height: 1.6;
}

.nav-logo span { color: var(--accent2); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.nav-links a:hover { color: var(--text); transition: color 0.15s; }

/* ---- HERO ---- */
.hero {
  text-align: center;
  padding: 5rem 2rem 3rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.hero-eyebrow {
  font-family: var(--font-game);
  font-size: 0.5rem;
  color: var(--accent2);
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--font-game);
  font-size: clamp(1rem, 3vw, 1.6rem);
  line-height: 1.8;
  color: var(--accent);
  margin-bottom: 1rem;
  text-shadow: 0 0 40px rgba(240,192,64,0.3);
}

.hero-title span { color: var(--text); }

.hero-sub {
  color: var(--muted);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto 2.5rem;
}

/* ---- PIXEL DECORATION ---- */
.pixel-bar {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 1.5rem auto;
}
.pixel-bar span {
  display: block;
  width: 10px; height: 10px;
  background: var(--accent);
  animation: pixelpulse 1.4s infinite;
}
.pixel-bar span:nth-child(2) { background: var(--accent2); animation-delay: 0.2s; }
.pixel-bar span:nth-child(3) { background: var(--accent3); animation-delay: 0.4s; }
.pixel-bar span:nth-child(4) { background: var(--accent2); animation-delay: 0.6s; }
.pixel-bar span:nth-child(5) { background: var(--accent); animation-delay: 0.8s; }
@keyframes pixelpulse {
  0%,100% { opacity: 1; transform: scaleY(1); }
  50%      { opacity: 0.3; transform: scaleY(0.4); }
}

/* ---- SECTION ---- */
.section { padding: 4rem 2rem; max-width: 1100px; margin: 0 auto; }
.section-title {
  font-family: var(--font-game);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- GAME CARDS ---- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.game-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-game);
  font-size: 0.5rem;
  color: var(--muted);
  position: relative;
  overflow: hidden;
}

.game-card-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-thumb .coming-soon {
  font-family: var(--font-game);
  font-size: 0.45rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.game-card-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--font-game);
  font-size: 0.38rem;
  padding: 4px 8px;
  background: var(--accent);
  color: #000;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.game-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-card-title {
  font-family: var(--font-game);
  font-size: 0.55rem;
  color: var(--text);
  line-height: 1.8;
}

.game-card-desc {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
}

.game-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.game-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
}

.btn {
  font-family: var(--font-game);
  font-size: 0.45rem;
  padding: 8px 16px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.15s, transform 0.1s;
  display: inline-block;
}
.btn:hover { background: #f8d060; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

/* ---- LEADERBOARD ---- */
.leaderboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 48px 1fr 100px 100px;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface2);
  font-family: var(--font-game);
  font-size: 0.42rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 48px 1fr 100px 100px;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.15s;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--surface2); }

.lb-rank {
  font-family: var(--font-game);
  font-size: 0.55rem;
  color: var(--muted);
}
.lb-rank.gold   { color: var(--accent); }
.lb-rank.silver { color: #b0b0c0; }
.lb-rank.bronze { color: #c87040; }

.lb-name { font-weight: 500; font-size: 0.95rem; }
.lb-score {
  font-family: var(--font-game);
  font-size: 0.55rem;
  color: var(--accent);
  text-align: right;
}
.lb-diff {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
  text-transform: capitalize;
}

.lb-empty {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.lb-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.lb-tab {
  font-family: var(--font-game);
  font-size: 0.42rem;
  padding: 0.75rem 1.25rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.08em;
  transition: all 0.15s;
}
.lb-tab:hover { color: var(--text); }
.lb-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- ABOUT ---- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 640px) { .about-grid { grid-template-columns: 1fr; } }

.about-text h2 {
  font-family: var(--font-game);
  font-size: 0.6rem;
  color: var(--accent);
  margin-bottom: 1rem;
  line-height: 2;
}
.about-text p { color: var(--muted); font-size: 0.95rem; margin-bottom: 1rem; }
.about-text p strong { color: var(--text); font-weight: 500; }

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-num {
  font-family: var(--font-game);
  font-size: 1rem;
  color: var(--accent);
  display: block;
  margin-bottom: 0.4rem;
}
.stat-label { font-size: 0.8rem; color: var(--muted); }

/* ---- FOOTER ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}
footer .footer-logo {
  font-family: var(--font-game);
  font-size: 0.5rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ---- GAME PAGE ---- */
.game-page { max-width: 600px; margin: 0 auto; padding: 2rem 1rem; }
.game-page-header { margin-bottom: 1.5rem; }
.game-page-header .back {
  font-family: var(--font-game);
  font-size: 0.42rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  transition: color 0.15s;
}
.game-page-header .back:hover { color: var(--accent); }
.game-page-title {
  font-family: var(--font-game);
  font-size: 0.75rem;
  color: var(--accent);
  line-height: 2;
  margin-bottom: 0.25rem;
}
.game-page-meta { font-size: 0.85rem; color: var(--muted); }

.game-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.game-lb-section { margin-top: 2rem; }
.game-lb-title {
  font-family: var(--font-game);
  font-size: 0.52rem;
  color: var(--accent);
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
}

/* ---- MOBILE ---- */
@media (max-width: 600px) {
  .nav { padding: 1rem; }
  .nav-links { gap: 1rem; font-size: 0.8rem; }
  .hero { padding: 3rem 1rem 2rem; }
  .section { padding: 2.5rem 1rem; }
  .leaderboard-header,
  .leaderboard-row { grid-template-columns: 36px 1fr 80px; }
  .leaderboard-header > *:last-child,
  .leaderboard-row > *:last-child { display: none; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadein {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fadein { animation: fadein 0.5s ease both; }
.fadein-2 { animation: fadein 0.5s ease 0.15s both; }
.fadein-3 { animation: fadein 0.5s ease 0.3s both; }
