
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #080b18;
  --panel: #11162a;
  --panel2: #171e36;
  --text: #f4f6ff;
  --muted: #a5aecb;
  --blue: #24a0ff;
  --purple: #9b5cff;
  --border: #283353;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Poppins', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .3s, color .3s;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 7%;
  background: rgba(8,11,24,.94);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.logo { font-size: 25px; font-weight: 800; }
.logo::first-letter { color: var(--blue); }

nav { display: flex; gap: 25px; }
nav a { color: var(--muted); transition: color .2s; }
nav a:hover { color: var(--blue); }

.icon-btn {
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  background: var(--panel);
  color: var(--text);
}

.hero {
  min-height: 410px;
  padding: 65px 8%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 25px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 30%, #252568 0, transparent 45%),
    linear-gradient(130deg, #0c1024, #13102e);
}

.tag {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--blue);
}

.hero h1 {
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.12;
  margin: 15px 0;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p { color: var(--muted); max-width: 480px; line-height: 1.8; }

.btn, .play-btn {
  display: inline-block;
  border: 0;
  color: white;
  background: linear-gradient(100deg, #0789ff, #7554ff);
  border-radius: 9px;
  padding: 12px 22px;
  font-weight: 600;
  transition: transform .2s, box-shadow .2s;
}

.btn { margin-top: 14px; }
.btn:hover, .play-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px #168dff55;
}

.hero-art {
  min-height: 260px;
  position: relative;
  display: grid;
  place-items: center;
}

.controller {
  font-size: clamp(100px, 16vw, 180px);
  filter: drop-shadow(0 0 30px #795cff99);
  animation: float 3s ease-in-out infinite;
  z-index: 1;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  animation: pulse 4s ease-in-out infinite alternate;
}

.orb-one {
  width: 200px; height: 200px;
  background: #6b35ff22;
  border: 1px solid #825aff66;
}

.orb-two {
  width: 120px; height: 120px;
  background: #0ba5ff22;
  border: 1px solid #0ba5ff66;
  transform: translate(100px, -60px);
}

.hero-caption {
  position: absolute;
  bottom: 4px;
  letter-spacing: 5px;
  color: #b6b0ff;
  font-size: 11px;
}

.games-section { padding: 65px 7%; }

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.section-heading h2 { font-size: 30px; margin: 7px 0 25px; }
.count { color: var(--muted); font-size: 13px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 25px;
}

#searchInput {
  min-width: 230px;
  max-width: 350px;
  width: 100%;
  padding: 12px 15px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
}

#searchInput:focus { border-color: var(--blue); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.filter {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  color: var(--muted);
}

.filter:hover, .filter.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.game-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  overflow: hidden;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  animation: appear .5s ease both;
}

.game-card:hover {
  transform: translateY(-7px);
  border-color: var(--blue);
  box-shadow: 0 12px 35px #0005;
}

.game-picture {
  height: 155px;
  display: grid;
  place-items: center;
  font-size: 65px;
  overflow: hidden;
}

.snake-picture { background: linear-gradient(135deg, #075e49, #17ae83); }
.rps-picture { background: linear-gradient(135deg, #7d2bba, #ef619b); }
.number-picture { background: linear-gradient(135deg, #173db0, #31b5ff); }
.memory-picture { background: linear-gradient(135deg, #a83c18, #ffb23d); }
.click-picture { background: linear-gradient(135deg, #8d1f71, #f04d67); }
.math-picture { background: linear-gradient(135deg, #075a9d, #3bcecb); }

.game-info { padding: 18px; }
.category { color: var(--blue); font-size: 10px; letter-spacing: 1.5px; font-weight: 700; }
.game-info h3 { margin: 8px 0; font-size: 19px; }
.game-info p { color: var(--muted); font-size: 13px; min-height: 42px; line-height: 1.6; }
.play-btn { width: 100%; margin-top: 8px; padding: 10px; }

#noResults { color: var(--muted); text-align: center; padding: 40px; }

.features {
  padding: 45px 7%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

.features div { padding: 10px; }
.features span { font-size: 32px; }
.features h3 { margin-bottom: 5px; }
.features p { color: var(--muted); font-size: 13px; line-height: 1.7; }

footer {
  text-align: center;
  padding: 35px 15px;
  border-top: 1px solid var(--border);
}

footer p, footer small { color: var(--muted); font-size: 13px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #000b;
  backdrop-filter: blur(8px);
}

.modal[hidden] { display: none; }

.modal-box {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  animation: appear .25s ease;
}

.close-btn {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}

#gameContent { padding-top: 10px; text-align: center; }
#gameContent h2 { margin-top: 10px; }
#gameContent p { color: var(--muted); line-height: 1.7; }

.game-action {
  padding: 11px 16px;
  margin: 5px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.game-action:hover { border-color: var(--blue); }
.game-input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

#snakeCanvas {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 15px auto;
  background: #071e1a;
  border: 1px solid #1e8b68;
  border-radius: 8px;
  image-rendering: pixelated;
}

body.light {
  --bg: #f3f6ff;
  --panel: #ffffff;
  --panel2: #e9edfb;
  --text: #171b32;
  --muted: #606b87;
  --border: #d8deef;
}

body.light .navbar { background: #ffffffed; }
body.light .hero {
  background: linear-gradient(120deg, #e8f1ff, #eee8ff);
}
body.light .hero p { color: #606b87; }
body.light .modal { background: #18203b88; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}
@keyframes pulse {
  from { opacity: .4; transform: scale(.9); }
  to { opacity: 1; transform: scale(1.08); }
}
@keyframes appear {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding: 45px 7%; }
  .hero-art { min-height: 200px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .features { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 520px) {
  .navbar { padding: 14px 5%; gap: 10px; }
  .logo { font-size: 20px; }
  nav { gap: 12px; font-size: 12px; }
  .icon-btn { width: 36px; height: 36px; flex-shrink: 0; }
  .game-grid { grid-template-columns: 1fr; }
  .games-section { padding: 40px 5%; }
  .section-heading h2 { font-size: 25px; }
  .toolbar { align-items: stretch; }
  #searchInput { max-width: none; }
  .filters { gap: 6px; }
  .filter { padding: 8px 12px; }
  .modal-box { padding: 25px 18px; }
}
