@font-face {
  font-family: "04b30";
  src: url("fonts/04b30.ttf") format("truetype");
  font-display: block;
}

:root {
  --bg: #fff7ea;
  --dot: #f1e3c8;
  --ink: #1d1a2f;
  --muted: #5d5873;
  --card: #ffffff;
  --pink: #ff6fa8;
  --yellow: #ffd23f;
  --mint: #3ee0b0;
  --blue: #5b8cff;
  --shadow: 5px 5px 0 var(--ink);
  --radius: 14px;
  --pixel: "04b30", "Courier New", monospace;
  --body: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17142a;
    --dot: #26213f;
    --ink: #fdf3e1;
    --muted: #b9b2d6;
    --card: #221e3a;
    --shadow: 5px 5px 0 #000;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 2px, transparent 2px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; }

/* ───────── hero ───────── */

.hero {
  min-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 16px;
  gap: 18px;
}

.press-start {
  font-family: var(--pixel);
  font-size: 12px;
  letter-spacing: 3px;
  margin: 0;
  color: var(--muted);
  animation: blink 1.1s steps(1) infinite;
}

.logo {
  font-family: var(--pixel);
  font-weight: normal;
  font-size: clamp(44px, 13vw, 150px);
  line-height: 1;
  margin: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.logo .letter {
  display: inline-block;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0 var(--ink), 6px 6px 0 var(--ink);
  transition: transform 0.15s ease;
  animation: float 3s ease-in-out infinite;
}
.logo .letter:hover { transform: translateY(-14px) rotate(-6deg) scale(1.08); }
.logo .letter.jump { animation: jump 0.5s ease; }

.tagline {
  margin: 0;
  font-size: clamp(16px, 3.5vw, 22px);
  font-weight: 700;
  color: var(--muted);
}

.btn {
  display: inline-block;
  margin-top: 10px;
  padding: 12px 22px;
  background: var(--yellow);
  color: #1d1a2f;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { transform: translate(-2px, -2px) rotate(-2deg); box-shadow: 7px 7px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }

/* ───────── games ───────── */

main { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.section-title {
  font-family: var(--pixel);
  font-weight: normal;
  font-size: clamp(22px, 5vw, 34px);
  text-align: center;
  margin: 0 0 6px;
}
.section-title span {
  background: var(--mint);
  color: #1d1a2f;
  padding: 6px 14px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: inline-block;
  transform: rotate(-2deg);
}

.section-sub { text-align: center; color: var(--muted); margin: 22px auto 34px; max-width: 560px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 300px));
  justify-content: center;
  gap: 28px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:nth-child(odd):hover  { transform: translate(-3px, -4px) rotate(-1.5deg); box-shadow: 9px 9px 0 var(--ink); }
.card:nth-child(even):hover { transform: translate(-3px, -4px) rotate(1.5deg);  box-shadow: 9px 9px 0 var(--ink); }

.thumb {
  aspect-ratio: 1 / 1;
  border-bottom: 3px solid var(--ink);
  background: var(--accent, var(--yellow));
  display: grid;
  place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .placeholder {
  font-family: var(--pixel);
  font-size: 72px;
  color: #fff;
  -webkit-text-stroke: 3px #1d1a2f;
  text-shadow: 5px 5px 0 #1d1a2f;
  animation: float 2.4s ease-in-out infinite;
}

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 21px; line-height: 1.25; }
.card p { margin: 0; color: var(--muted); font-size: 16px; flex: 1; }
.play {
  margin-top: 10px;
  align-self: flex-start;
  font-family: var(--pixel);
  font-size: 12px;
  letter-spacing: 1px;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--accent, var(--yellow));
  color: #1d1a2f;
}

.play .arrow { font-family: var(--body); font-size: 14px; }

.card.soon { cursor: default; }
.card.soon .play { background: transparent; color: var(--muted); border-style: dashed; }

.sticker {
  position: absolute;
  top: 12px;
  right: -6px;
  background: var(--pink);
  color: #fff;
  font-family: var(--pixel);
  font-size: 12px;
  padding: 6px 14px 6px 10px;
  border: 3px solid var(--ink);
  transform: rotate(8deg);
  animation: wiggle 1.6s ease-in-out infinite;
}

.accent-pink   { --accent: var(--pink); }
.accent-yellow { --accent: var(--yellow); }
.accent-mint   { --accent: var(--mint); }
.accent-blue   { --accent: var(--blue); }

/* ───────── about ───────── */

.about { margin: 90px 0 40px; display: flex; justify-content: center; }
.about-card {
  max-width: 620px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  transform: rotate(1deg);
}
.about-card h2 { font-family: var(--pixel); font-weight: normal; font-size: 20px; margin: 0 0 8px; }
.about-card p { margin: 10px 0; }

/* ───────── footer ───────── */

.footer {
  text-align: center;
  padding: 40px 16px 110px;
  color: var(--muted);
  font-size: 15px;
}
.footer nav { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; font-weight: 700; }
.footer p { margin: 8px 0; }
.secret-hint { font-size: 12px; font-weight: 700; opacity: 0.4; letter-spacing: 2px; }

/* ───────── quizzy the mascot ───────── */

.quizzy {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 64px;
  height: 64px;
  padding: 0;
  background: var(--yellow);
  border: 3px solid #1d1a2f;
  border-radius: 10px;
  box-shadow: inset -5px -5px 0 #e0a800, 4px 4px 0 #1d1a2f;
  cursor: pointer;
  animation: bob 2.2s ease-in-out infinite;
  z-index: 20;
}
.quizzy:hover { animation-duration: 0.6s; }
.quizzy.bonk { animation: bonk 0.35s ease; }
.quizzy-face { position: relative; display: block; width: 100%; height: 100%; }
.quizzy .eye {
  position: absolute;
  top: 16px;
  width: 7px;
  height: 9px;
  background: #1d1a2f;
  border-radius: 2px;
  animation: eyeblink 4s infinite;
  transition: transform 0.1s;
  transform: translate(var(--lx, 0), var(--ly, 0));
}
.quizzy .eye:first-child { left: 17px; }
.quizzy .eye:nth-child(2) { right: 17px; }
.quizzy .mark {
  position: absolute;
  left: 0; right: 0; bottom: 6px;
  font-family: var(--pixel);
  font-size: 18px;
  color: #1d1a2f;
  line-height: 1;
}

.bubble {
  position: fixed;
  right: 18px;
  bottom: 96px;
  max-width: min(280px, calc(100vw - 36px));
  background: var(--card);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  z-index: 20;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.bubble.show { opacity: 1; transform: none; }
.bubble::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -11px;
  width: 16px;
  height: 16px;
  background: var(--card);
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(45deg);
}
.bubble .answer { display: block; margin-top: 6px; color: var(--pink); }

/* ───────── confetti + party mode ───────── */

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 50;
  border: 2px solid #1d1a2f;
}

body.party { animation: rainbow 2s linear infinite; }
body.party .card { animation: dance 0.5s ease-in-out infinite alternate; }

/* ───────── legal pages ───────── */

.legal-header { text-align: center; padding: 40px 16px 10px; }
.legal-header .logo { font-size: clamp(32px, 9vw, 64px); }
.legal-header a { text-decoration: none; }

.legal {
  max-width: 760px;
  margin: 24px auto 40px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 28px 28px;
  font-size: 16px;
}
.legal h1 { font-family: var(--pixel); font-weight: normal; font-size: clamp(20px, 5vw, 28px); line-height: 1.3; margin: 28px 0 4px; }
.legal h2 { font-size: 20px; margin: 30px 0 6px; }
.legal h3 { font-size: 17px; margin: 18px 0 4px; }
.legal .updated { color: var(--muted); margin-top: 0; }
.legal .tldr {
  background: var(--yellow);
  color: #1d1a2f;
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 20px 0;
}
.legal .tldr strong { font-family: var(--pixel); font-weight: normal; font-size: 12px; letter-spacing: 1px; }
.legal li { margin: 4px 0; }

/* ───────── 404 ───────── */

.gameover {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 16px;
}
.gameover .logo { font-size: clamp(40px, 12vw, 110px); cursor: default; }
.gameover .countdown { font-family: var(--pixel); font-size: 40px; }

/* ───────── keyframes ───────── */

@keyframes blink { 50% { opacity: 0; } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes jump {
  0% { transform: none; }
  40% { transform: translateY(-40px) rotate(12deg) scale(1.15); }
  100% { transform: none; }
}
@keyframes wiggle { 0%, 100% { transform: rotate(8deg); } 50% { transform: rotate(-4deg) scale(1.08); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bonk { 0% { transform: scale(1); } 30% { transform: scale(0.85, 1.15) translateY(-10px); } 100% { transform: scale(1); } }
@keyframes eyeblink { 0%, 92%, 100% { height: 9px; } 95% { height: 1px; } }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }
@keyframes dance { from { rotate: -3deg; } to { rotate: 3deg; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 520px) {
  body { font-size: 17px; }
  .logo .letter { -webkit-text-stroke-width: 1px; text-shadow: 3px 3px 0 var(--ink); }
  .legal { padding: 4px 18px 22px; }
  .quizzy { width: 54px; height: 54px; }
  .quizzy .eye { top: 12px; }
  .quizzy .eye:first-child { left: 13px; }
  .quizzy .eye:nth-child(2) { right: 13px; }
  .bubble { bottom: 84px; }
}
