/* ─── Google Fonts ───────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  /* Light mode (default) */
  --bg:            #f0fdf4;
  --bg-secondary:  #dcfce7;
  --card:          #ffffff;
  --card-hover:    #f8fffa;
  --border:        #d1fae5;
  --border-muted:  #e2e8f0;
  --primary:       #16a34a;
  --primary-light: #dcfce7;
  --primary-hover: #15803d;
  --secondary:     #2563eb;
  --secondary-lt:  #dbeafe;
  --accent:        #ca8a04;
  --accent-light:  #fef9c3;
  --danger:        #ef4444;
  --danger-light:  #fee2e2;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-faint:    #94a3b8;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.06);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.14);
  --glow-primary:  rgba(22,163,74,.18);
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --transition:    0.22s ease;
}

[data-theme="dark"] {
  --bg:            #0d1117;
  --bg-secondary:  #161b22;
  --card:          #161b22;
  --card-hover:    #1c2330;
  --border:        rgba(255,255,255,.08);
  --border-muted:  rgba(255,255,255,.05);
  --primary:       #22c55e;
  --primary-light: rgba(34,197,94,.15);
  --primary-hover: #16a34a;
  --secondary:     #60a5fa;
  --secondary-lt:  rgba(96,165,250,.15);
  --accent:        #facc15;
  --accent-light:  rgba(250,204,21,.15);
  --danger:        #f87171;
  --danger-light:  rgba(248,113,113,.15);
  --text:          #f1f5f9;
  --text-muted:    #94a3b8;
  --text-faint:    #64748b;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.3);
  --shadow-md:     0 4px 16px rgba(0,0,0,.45);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.6);
  --glow-primary:  rgba(34,197,94,.25);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* ─── Theme Toggle Button ────────────────────────────────────────────────── */
#themeToggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border-muted);
  background: var(--card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  outline: none;
}
#themeToggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.08) rotate(12deg);
  box-shadow: 0 0 0 4px var(--glow-primary);
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.home {
  max-width: 1040px;
  margin: 0 auto;
  padding: 30px 16px 60px;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  animation: fadeSlideIn .5s ease both;
}

/* Decorative blob top-right */
.hero::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: var(--primary-light);
  opacity: .7;
  transition: background var(--transition);
}

/* Decorative blob bottom-left */
.hero::after {
  content: '';
  position: absolute;
  left: -40px; bottom: -50px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: var(--accent-light);
  opacity: .5;
  transition: background var(--transition);
}

.welcome-hero { /* extra decoration only on home */ }

.kicker {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .14em;
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.hero h1 {
  position: relative;
  z-index: 1;
  font-family: 'Montserrat', sans-serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.06;
  margin-top: 14px;
  letter-spacing: -.025em;
  color: var(--text);
  transition: color var(--transition);
}

.hero p {
  position: relative;
  z-index: 1;
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.6;
  max-width: 600px;
  transition: color var(--transition);
}

/* ─── Animated ball + card (hero decoration) ─────────────────────────────── */
.cartoon-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.cartoon-ball {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0, #fff 15%, #1e293b 17%, #1e293b 28%, #fff 30%);
  border: 2.5px solid #1e293b;
  box-shadow: 0 6px 0 rgba(15,23,42,.15);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  animation: ballFloat 3s ease-in-out infinite;
  user-select: none;
}
.cartoon-ball:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 9px 0 rgba(15,23,42,.12);
}
.cartoon-ball:active { transform: scale(.94) translateY(2px); }

.cartoon-card {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--accent);
  color: #78350f;
  font-weight: 800;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(161,98,7,.25);
  box-shadow: 0 4px 0 rgba(161,98,7,.2);
  animation: ballFloat 3s ease-in-out infinite .4s;
  transition: background var(--transition);
}

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

/* ─── Hero Actions ───────────────────────────────────────────────────────── */
.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  transition: all .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--glow-primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--glow-primary);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border-muted);
}
.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* ─── Games Section ──────────────────────────────────────────────────────── */
.games {
  margin-top: 28px;
  animation: fadeSlideIn .5s ease .1s both;
}

.games h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  transition: color var(--transition);
}

.games-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
  transition: color var(--transition);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

/* Game card */
.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all .22s ease;
  position: relative;
  overflow: hidden;
}
.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  border-radius: inherit;
  transition: opacity .22s ease;
  background: linear-gradient(135deg, var(--primary-light), transparent 70%);
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.game-card:hover::before { opacity: 1; }
.game-card:active { transform: translateY(-1px); }

/* Stagger animation */
.game-card:nth-child(1) { animation: fadeSlideIn .4s ease .05s both; }
.game-card:nth-child(2) { animation: fadeSlideIn .4s ease .12s both; }
.game-card:nth-child(3) { animation: fadeSlideIn .4s ease .19s both; }
.game-card:nth-child(4) { animation: fadeSlideIn .4s ease .26s both; }
.game-card:nth-child(5) { animation: fadeSlideIn .4s ease .33s both; }

.game-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 14px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.12));
  transition: transform .2s ease;
}
.game-card:hover .game-icon { transform: scale(1.12) rotate(-4deg); }

.game-badge {
  font-size: 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  background: var(--primary-light);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  transition: all var(--transition);
}

.game-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  transition: color var(--transition);
}

.game-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 16px;
  transition: color var(--transition);
}

.game-card .btn {
  align-self: flex-start;
  font-size: 13px;
  padding: 9px 16px;
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  transition: opacity .3s, transform .3s;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Easter Egg Modal ───────────────────────────────────────────────────── */
.egg-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
  padding: 16px;
}
.egg-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.egg-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(.88) translateY(24px);
  transition: transform .35s cubic-bezier(.175,.885,.32,1.275);
  position: relative;
  overflow: hidden;
}
.egg-overlay.visible .egg-modal {
  transform: scale(1) translateY(0);
}
.egg-emoji { font-size: 56px; line-height: 1; display: block; margin-bottom: 16px; animation: eggBounce .7s ease; }
.egg-modal h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}
.egg-modal p { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 24px; }
.egg-confetti {
  position: absolute; inset: 0; pointer-events: none;
  overflow: hidden; border-radius: inherit;
}
.egg-dot {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  animation: eggDotFall 1.2s ease forwards;
}
@keyframes eggDotFall {
  from { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  to   { transform: translateY(120%) rotate(360deg); opacity: 0; }
}
@keyframes eggBounce {
  0%   { transform: scale(0) rotate(-20deg); }
  60%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ─── Floating particles (hero bg) ──────────────────────────────────────── */
.particles {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
  border-radius: inherit;
  z-index: 0;
}
.particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: .18;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0%   { transform: translateY(110%) scale(.8); opacity: 0; }
  10%  { opacity: .18; }
  90%  { opacity: .18; }
  100% { transform: translateY(-20%) scale(1.1); opacity: 0; }
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: 34px; }
}
@media (max-width: 620px) {
  .game-grid { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 28px; }
  .home { padding: 20px 12px 50px; }
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.app-footer {
  margin-top: 60px;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--card);
  transition: background var(--transition), border-color var(--transition);
}

.footer-content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-copyright {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-link:hover {
  color: var(--primary);
}

.footer-separator {
  color: var(--border);
  font-size: 10px;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-social span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.social-link {
  color: var(--text-muted);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-link:hover {
  color: var(--primary);
  transform: translateY(-3px);
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .footer-links {
    justify-content: center;
  }
}