@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Comic+Neue:wght@700&display=swap');

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

:root {
  --cream: #fffde7;
  --white: #ffffff;
  --ink: #111111;
  --red: #e53935;
  --blue: #1565c0;
  --green: #4caf50;
  --green-dark: #388e3c;
  --yellow: #fdd835;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --border: 4px solid var(--ink);
  --border-sm: 3px solid var(--ink);
  /* Card background per tag */
  --bg-action: #e3f2fd;
  --bg-space: #ede7f6;
  --bg-puzzle: #fff9c4;
  --bg-classic: #fce4ec;
  --bg-default: #f0f4f8;
  /* Greys & neutrals */
  --grey-light: #f5f5f5;
  --grey-mid: #ccc;
  --grey-text-dark: #333;
  --grey-text-mid: #555;
  --grey-text-light: #777;
  --grey-text-faint: #888;
  --yellow-soft: #fff9c4;
  --green-deep: #2e7d32;
  --border-lg: 5px solid var(--ink);
}

body {
  background: var(--cream);
  font-family: 'Comic Neue', 'Comic Sans MS', cursive;
  font-weight: 700;
  color: var(--ink);
  min-height: 100vh;
}

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

img { max-width: 100%; display: block; }

/* ─── Nav ───────────────────────────────────────────────────────── */
.nav {
  background: var(--white);
  border-bottom: var(--border-lg);
  padding: 12px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: 'Bangers', cursive;
  font-size: 30px;
  color: var(--red);
  letter-spacing: 3px;
  text-shadow: 3px 3px 0 var(--ink);
  -webkit-text-stroke: 1px var(--ink);
}
.nav-logo span { color: var(--blue); }

.nav-links { display: flex; gap: 10px; }

.nav-links a {
  font-family: 'Bangers', cursive;
  font-size: 18px;
  letter-spacing: 1px;
  padding: 6px 14px;
  border: var(--border-sm);
  border-radius: 6px;
  background: var(--yellow-soft);
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}
.nav-links a:hover {
  background: var(--green);
  color: var(--white);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

/* ─── Hero ──────────────────────────────────────────────────────── */
.hero {
  background: var(--white);
  border-bottom: var(--border-lg);
  padding: 40px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--bg-action) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.6;
  pointer-events: none;
}

.hero-left { position: relative; z-index: 1; flex: 1; }

.hero-badge {
  background: var(--yellow);
  border: var(--border);
  border-radius: 50%;
  width: 88px; height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Bangers', cursive;
  font-size: 14px;
  letter-spacing: 1px;
  line-height: 1.3;
  box-shadow: var(--shadow);
  transform: rotate(-10deg);
  margin-bottom: 14px;
}

.hero-title {
  font-family: 'Bangers', cursive;
  font-size: clamp(48px, 8vw, 80px);
  line-height: 0.95;
  letter-spacing: 4px;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
  margin-bottom: 16px;
}
.hero-title .blue { color: var(--blue); }
.hero-title .green { color: var(--green-deep); }

.hero-sub {
  display: inline-block;
  font-size: 17px;
  background: var(--yellow-soft);
  border: var(--border-sm);
  border-radius: 6px;
  padding: 8px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.hero-btn {
  display: inline-block;
  padding: 14px 34px;
  background: var(--green);
  border: var(--border-lg);
  border-radius: 8px;
  color: var(--white);
  font-family: 'Bangers', cursive;
  font-size: 30px;
  letter-spacing: 3px;
  box-shadow: 6px 6px 0 var(--ink);
  cursor: pointer;
  animation: wobble 2.5s ease-in-out infinite;
  transition: background 0.1s;
}
.hero-btn:hover {
  background: var(--green-dark);
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--ink);
  animation: none;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg) scale(1.03); }
}

.hero-right { position: relative; z-index: 1; flex-shrink: 0; text-align: center; }

.speech-bubble {
  background: var(--white);
  border: var(--border);
  border-radius: 16px;
  padding: 10px 18px;
  font-family: 'Bangers', cursive;
  font-size: 20px;
  color: var(--red);
  box-shadow: var(--shadow);
  position: relative;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -20px; left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: var(--ink);
}
.speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -13px; left: 50%;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top-color: var(--white);
  z-index: 1;
}

.hero-char {
  font-size: 80px;
  display: block;
  margin-top: 18px;
  animation: bounce 1.2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ─── Page Content Wrapper ──────────────────────────────────────── */
.content { padding: 0 32px 40px; max-width: 1100px; margin: 0 auto; }

/* ─── Ad Slot ───────────────────────────────────────────────────── */
.ad-slot {
  background: var(--white);
  border: 3px dashed var(--grey-mid);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--grey-mid);
  margin: 20px 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Search Bar ────────────────────────────────────────────────── */
.search-wrap {
  display: flex;
  gap: 10px;
  background: var(--white);
  border: var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow);
  margin: 20px 0 0;
}
.search-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Comic Neue', cursive;
  font-weight: 700;
  font-size: 17px;
  padding: 6px 12px;
  background: transparent;
}
.search-wrap button {
  background: var(--red);
  border: var(--border-sm);
  border-radius: 8px;
  padding: 8px 20px;
  font-family: 'Bangers', cursive;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--white);
  cursor: pointer;
  transition: background 0.1s;
}
.search-wrap button:hover { background: #c62828; }

/* ─── Tag Filter Pills ──────────────────────────────────────────── */
.tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 0;
}
.tag {
  padding: 7px 18px;
  background: var(--white);
  border: var(--border-sm);
  border-radius: 20px;
  font-family: 'Bangers', cursive;
  font-size: 17px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
  user-select: none;
}
.tag:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.tag.active { background: var(--blue); color: var(--white); }

/* ─── Section Header ────────────────────────────────────────────── */
.section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 16px;
}
.section-label h2 {
  font-family: 'Bangers', cursive;
  font-size: 34px;
  letter-spacing: 2px;
  white-space: nowrap;
  text-shadow: 2px 2px 0 var(--yellow);
}
.section-line {
  flex: 1;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0px, var(--ink) 8px,
    transparent 8px, transparent 14px
  );
}

/* ─── Game Grid ─────────────────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

/* ─── Game Card ─────────────────────────────────────────────────── */
.game-card {
  background: var(--white);
  border: var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  flex-direction: column;
}
.game-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.game-card.featured { border-color: var(--red); box-shadow: 5px 5px 0 var(--red); }
.game-card.featured:hover { box-shadow: 7px 7px 0 var(--red); }

.card-top {
  position: relative;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  border-bottom: var(--border);
  overflow: hidden;
}
.card-top img {
  width: 100%; height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.card-emoji { position: relative; z-index: 1; }

.card-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--yellow);
  border: var(--border-sm);
  border-radius: 20px;
  font-family: 'Bangers', cursive;
  font-size: 13px;
  padding: 2px 8px;
  letter-spacing: 1px;
  z-index: 2;
}

.card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }

.card-title {
  font-family: 'Bangers', cursive;
  font-size: 21px;
  letter-spacing: 1px;
  line-height: 1.2;
}

.card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.card-tag {
  font-size: 11px;
  padding: 2px 8px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--grey-light);
  text-transform: capitalize;
}

.card-desc { font-size: 13px; color: var(--grey-text-mid); line-height: 1.4; flex: 1; }

.card-play-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: var(--green);
  border: var(--border-sm);
  border-radius: 8px;
  font-family: 'Bangers', cursive;
  font-size: 19px;
  color: var(--white);
  text-align: center;
  letter-spacing: 2px;
  box-shadow: var(--shadow-sm);
  margin-top: 4px;
  transition: background 0.1s;
}
.card-play-btn:hover { background: var(--green-dark); }

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  font-family: 'Bangers', cursive;
  font-size: 24px;
  color: var(--grey-text-faint);
  padding: 40px;
}

/* ─── Game Viewer Page ──────────────────────────────────────────── */
.game-header {
  padding: 20px 32px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.game-header-left { display: flex; flex-direction: column; gap: 6px; }
.game-header-title {
  font-family: 'Bangers', cursive;
  font-size: 36px;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 var(--yellow);
}
.game-header-actions { display: flex; gap: 10px; }

.btn {
  font-family: 'Bangers', cursive;
  font-size: 18px;
  letter-spacing: 1px;
  padding: 8px 18px;
  border: var(--border-sm);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn-back { background: var(--yellow-soft); }
.btn-share { background: var(--blue); color: var(--white); }

.game-frame-wrap {
  margin: 0 32px;
  border: var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #000;
}
.game-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 600px;
  border: none;
}

/* ─── Static Pages (About, Legal) ───────────────────────────────── */
.static-page {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 32px 60px;
}
.static-page h1 {
  font-family: 'Bangers', cursive;
  font-size: 48px;
  letter-spacing: 3px;
  text-shadow: 3px 3px 0 var(--yellow);
  margin-bottom: 24px;
}
.static-page h2 {
  font-family: 'Bangers', cursive;
  font-size: 28px;
  letter-spacing: 2px;
  margin: 28px 0 10px;
  color: var(--blue);
}
.static-page p { font-size: 16px; line-height: 1.8; margin-bottom: 12px; color: var(--grey-text-dark); }
.static-page ul { padding-left: 24px; margin-bottom: 12px; }
.static-page li { font-size: 16px; line-height: 1.8; color: var(--grey-text-dark); }

.about-story-box {
  background: var(--white);
  border: var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin: 24px 0;
  text-align: center;
}
.about-story-box .chars { font-size: 56px; margin-bottom: 8px; }
.about-story-box p { font-size: 17px; }

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
  background: var(--white);
  border-top: var(--border-lg);
  padding: 24px 32px;
  text-align: center;
  margin-top: 40px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.footer-links a {
  font-family: 'Bangers', cursive;
  font-size: 19px;
  color: var(--blue);
  letter-spacing: 1px;
}
.footer-links a:hover { color: var(--red); }

.footer-copy { font-size: 13px; color: var(--grey-text-light); line-height: 2; }
.footer-heart { color: var(--red); }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav { padding: 10px 16px; }
  .nav-logo { font-size: 22px; }
  .nav-links a { font-size: 14px; padding: 4px 10px; }
  .hero { flex-direction: column; padding: 24px 16px; text-align: center; }
  .hero-right { display: none; }
  .hero-title { font-size: 52px; }
  .content { padding: 0 16px 32px; }
  .game-header { padding: 14px 16px 8px; }
  .game-frame-wrap { margin: 0 16px; }
  .game-frame-wrap iframe { height: 400px; }
  .static-page { padding: 0 16px 40px; }
  .footer { padding: 20px 16px; }
  .footer-links { gap: 14px; }
  .search-wrap { flex-wrap: wrap; }
  .search-wrap button { width: 100%; }
  .game-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Reduced Motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-btn { animation: none; }
  .hero-char { animation: none; }
}
