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

:root {
  --bg: #0c0e16;
  --surface: #161926;
  --surface-hi: #1f2438;
  --border: #363e5c;
  --text: #f8fafc;
  --muted: #9aa6c4;
  --red: #d93829;
  --gold: #ffd166;
  --green: #52e069;
  --font-px: 'Press Start 2P', monospace;
  --font-ui: 'Silkscreen', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #1d2238 0%, #0c0e16 65%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.hidden { display: none !important; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(12, 14, 22, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--red);
  border: 2px solid #fff6e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 3px 3px 0 #07080d;
}

.logo-text {
  font-family: var(--font-px);
  font-size: 15px;
  letter-spacing: 0.6px;
}

.logo-text span { color: var(--gold); }

.parent-badge {
  font-size: 11px;
  color: #9aa6c4;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}
.parent-badge:hover { color: var(--gold); border-color: var(--gold); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-nav a {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
.header-nav a:hover { color: #fff; }

.nav-auth-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  background: var(--red);
  color: #fff6e5;
  border: 2px solid #fff6e5;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  box-shadow: 2px 2px 0 #07080d;
}
.nav-auth-btn:hover { filter: brightness(1.12); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  background: #1c3627;
  color: #7ee081;
  border: 2px solid #7ee081;
  border-radius: 8px;
  padding: 5px 10px;
}

.chip-logout {
  background: transparent;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-weight: 700;
}

/* Main */
.page-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* Hero Spotlight */
.hero-spotlight {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 28px;
  align-items: center;
  background: var(--surface);
  border: 3px solid #f4ecd8;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 8px 8px 0 #07080d;
  margin-bottom: 44px;
}

.eyebrow {
  font-family: var(--font-px);
  font-size: 9px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: 0.8px;
}

.hero-title {
  font-family: var(--font-px);
  font-size: clamp(22px, 3.6vw, 34px);
  line-height: 1.3;
  margin: 0 0 14px;
  color: #fff6e5;
  text-shadow: 3px 3px 0 var(--red);
}

.hero-desc {
  color: #d6deed;
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 18px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.hero-tags span {
  font-family: var(--font-ui);
  font-size: 11px;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 4px 9px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-primary, .btn-secondary {
  font-family: var(--font-px);
  font-size: 11px;
  text-decoration: none;
  padding: 13px 18px;
  border-radius: 9px;
  border: 3px solid #fff6e5;
  box-shadow: 4px 4px 0 #07080d;
  transition: transform 0.08s, filter 0.1s;
  display: inline-block;
  cursor: pointer;
}
.btn-primary.full { width: 100%; text-align: center; }

.btn-primary {
  background: var(--red);
  color: #fff6e5;
}

.btn-secondary {
  background: var(--surface-hi);
  color: #e2e8f0;
  border-color: var(--border);
}

.btn-primary:hover, .btn-secondary:hover { filter: brightness(1.12); }
.btn-primary:active, .btn-secondary:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #07080d; }

/* Animated Pixel Preview Box */
.hero-preview {
  position: relative;
  border: 3px solid #090a10;
  border-radius: 12px;
  overflow: hidden;
  background: #6ec6ff;
}

#previewCanvas {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.preview-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-px);
  font-size: 8px;
  background: rgba(12, 14, 22, 0.8);
  color: var(--gold);
  border: 1.5px solid rgba(255, 209, 102, 0.5);
  padding: 5px 8px;
  border-radius: 6px;
}

/* Sections */
.modes-section, .games-section, .leaderboard-section {
  margin-bottom: 44px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.section-head h2 {
  font-family: var(--font-px);
  font-size: 13px;
  margin: 0;
  color: var(--gold);
}

.game-count {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
}

/* 3 Game Modes / Tiers */
.tiers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.tier-card {
  background: var(--surface);
  border: 2.5px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 5px 5px 0 #07080d;
}

.tier-card.featured {
  border-color: var(--green);
  background: linear-gradient(180deg, #172721 0%, var(--surface) 45%);
}

.tier-card.premium {
  border-color: #7c5cff;
  background: linear-gradient(180deg, #1f1936 0%, var(--surface) 45%);
}

.tier-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tier-tag {
  font-family: var(--font-px);
  font-size: 7px;
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}
.tier-tag.reg { background: rgba(82, 224, 105, 0.18); color: var(--green); }
.tier-tag.prem { background: rgba(124, 92, 255, 0.22); color: #c4b5fd; }

.tier-price {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  color: var(--gold);
}

.tier-card h3 {
  font-family: var(--font-px);
  font-size: 12px;
  margin: 0 0 8px;
  color: #fff6e5;
}

.tier-card p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.tier-card ul {
  margin: 0 0 18px;
  padding-left: 18px;
  font-size: 13px;
  color: #d6deed;
  line-height: 1.6;
}

.tier-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  font-family: var(--font-px);
  font-size: 9px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface-hi);
  color: #fff6e5;
  cursor: pointer;
}
.tier-btn.primary { background: var(--red); border-color: #fff6e5; }
.tier-btn.disabled { opacity: 0.5; cursor: not-allowed; }

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--surface);
  border: 2.5px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 5px 5px 0 #07080d;
  transition: transform 0.1s, border-color 0.15s;
}
.game-card.live:hover { transform: translateY(-3px); border-color: var(--gold); }
.game-card.soon { opacity: 0.72; border-style: dashed; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-emoji { font-size: 28px; }
.status-pill {
  font-family: var(--font-px);
  font-size: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(82, 224, 105, 0.16);
  color: var(--green);
  border: 1px solid rgba(82, 224, 105, 0.45);
}
.status-pill.soon { background: rgba(255, 209, 102, 0.12); color: var(--gold); border-color: rgba(255, 209, 102, 0.35); }
.card-title { font-family: var(--font-px); font-size: 13px; margin: 0 0 6px; color: #fff6e5; }
.card-desc { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.card-url { font-family: var(--font-ui); font-size: 10px; color: #74c0fc; }
.card-play {
  font-family: var(--font-px); font-size: 9px; text-decoration: none;
  background: var(--red); color: #fff6e5; padding: 8px 12px;
  border-radius: 7px; border: 2px solid #fff6e5;
}
.card-play.disabled { background: #252a3d; color: var(--muted); border-color: var(--border); pointer-events: none; }

/* Leaderboard */
.lb-filters {
  display: flex;
  gap: 8px;
}
.lb-filters select {
  background: var(--surface);
  color: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-size: 11px;
}

.lb-card {
  background: var(--surface);
  border: 2.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.lb-table th, .lb-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.lb-table th {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.25);
}
.lb-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Auth Modal */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 10, 16, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 3px solid #f4ecd8;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 6px 6px 0 #07080d;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-px);
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 14px;
}

.auth-close {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 18px;
  cursor: pointer;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  padding: 9px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface-hi);
  color: var(--muted);
  cursor: pointer;
}
.auth-tab.active {
  border-color: var(--gold);
  color: #fff;
  background: #2b324d;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #cbd5e1;
}
.auth-form input {
  background: #0d101a;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  color: #fff;
  font-size: 14px;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--gold);
}
.auth-error {
  min-height: 16px;
  color: #ff6b6b;
  font-size: 12px;
}

/* Footer */
.site-footer {
  border-top: 2px solid rgba(255, 255, 255, 0.08);
  padding: 22px 20px;
  color: var(--muted);
  font-size: 13px;
}
.site-footer a { color: #cbd5e1; text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links { display: flex; gap: 18px; }

@media (max-width: 820px) {
  .hero-spotlight, .tiers-grid { grid-template-columns: 1fr; }
  .header-nav a { display: none; }
}
