/* ============================================
   OnlineGamePlayz — Main Stylesheet
   Aesthetic: Sharp modern arcade / editorial
   Fonts: Syne (display) + DM Sans (body)
   ============================================ */

:root {
  --bg: #0d0d14;
  --bg2: #13131f;
  --bg3: #1a1a2e;
  --surface: #1e1e30;
  --surface2: #252540;
  --border: rgba(255,255,255,0.07);
  --text: #f0f0f8;
  --text2: #9090b8;
  --text3: #5a5a80;
  --accent: #7c3aed;
  --accent2: #a78bfa;
  --green: #4ade80;
  --blue: #60a5fa;
  --pink: #f472b6;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 20px;
  --radius-sm: 12px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f5f5fa;
  --bg2: #eeeef8;
  --bg3: #e5e5f5;
  --surface: #ffffff;
  --surface2: #f0f0f8;
  --border: rgba(0,0,0,0.07);
  --text: #0d0d20;
  --text2: #4a4a70;
  --text3: #8a8aaa;
  --shadow: 0 8px 32px rgba(0,0,0,0.1);
}

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

html { scroll-behavior: smooth; }

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

/* ── HEADER ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(13,13,20,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

[data-theme="light"] .site-header {
  background: rgba(245,245,250,0.85);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}

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

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

.header-nav a {
  color: var(--text2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color var(--transition);
}

.header-nav a:hover { color: var(--text); }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px; height: 38px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--surface2);
  transform: rotate(20deg);
}

/* ── HERO ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 64px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: float 8s ease-in-out infinite;
}

.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #7c3aed, transparent);
  top: -100px; left: -150px;
  animation-delay: 0s;
}

.orb2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #2563eb, transparent);
  top: 30%; right: -100px;
  animation-delay: -3s;
}

.orb3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, #ec4899, transparent);
  bottom: 10%; left: 30%;
  animation-delay: -6s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.hero-content {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 24px;
  animation: fadeUp 0.6s ease both;
}

.hero-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  animation: fadeUp 0.6s 0.1s ease both;
}

.accent {
  background: linear-gradient(135deg, #7c3aed, #ec4899, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text2);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 36px;
  animation: fadeUp 0.6s 0.2s ease both;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  text-decoration: none;
  padding: 14px 32px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition);
  box-shadow: 0 0 40px rgba(124,58,237,0.4);
  animation: fadeUp 0.6s 0.3s ease both;
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 60px rgba(124,58,237,0.6);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SECTIONS ── */
.games-section,
.leaderboard-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px;
}

.section-header {
  margin-bottom: 48px;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text2);
  font-size: 1rem;
}

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

.game-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 15%, transparent);
}

.card-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
  pointer-events: none;
  transition: opacity var(--transition);
}

.card-emoji {
  font-size: 2.5rem;
  line-height: 1;
}

.card-body { flex: 1; }

.card-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
  color: color-mix(in srgb, var(--accent) 90%, var(--text2));
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.card-desc {
  color: var(--text2);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 16px;
}

.card-meta {
  display: flex;
  gap: 12px;
}

.card-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text3);
  background: var(--bg2);
  padding: 4px 10px;
  border-radius: 100px;
}

.card-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
  margin-top: auto;
}

.card-play-btn:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* ── LEADERBOARD ── */
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.lb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
}

.lb-card h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.lb-row:last-child { border-bottom: none; }
.lb-row-label { color: var(--text2); }
.lb-row-val { font-weight: 600; color: var(--text); }

.lb-empty {
  text-align: center;
  color: var(--text3);
  padding: 40px;
  font-size: 0.9rem;
  grid-column: 1/-1;
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text3);
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .header-nav a { display: none; }
  .games-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.8rem; }
  .footer-inner { justify-content: center; text-align: center; }
}

/* ── GAME PAGE SHARED STYLES ── */
.game-page-body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

.game-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition);
}

.back-btn:hover { color: var(--text); }

.game-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
}

.game-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover { background: var(--surface2); }

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.next-game-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}

.next-game-bar p {
  color: var(--text2);
  font-size: 0.875rem;
}

.next-game-bar a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition);
}

.next-game-bar a:hover {
  background: var(--surface2);
  border-color: var(--accent2);
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
