@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Poppins:wght@400;500;600;700;800&display=swap');

/* ============================================================
   BBGuess -- Retro Pop design system
   Bold pop-art: bright flat colors, thick ink outlines, offset
   "comic panel" shadows (no blur), chunky rounded display type,
   halftone dot textures, sticker-style badges.
   ============================================================ */

:root {
  --pink: #ff3d81;
  --orange: #ff7a00;
  --yellow: #ffd400;
  --teal: #00c2cb;
  --violet: #7b2ff7;
  --ink: #1a1a2e;
  --cream: #fff8ee;

  --bg: var(--ink);
  --bg-alt: #24243c;
  --card: #24243c;
  --card-border: var(--ink);
  --text: var(--cream);
  --text-dim: rgba(255, 248, 238, 0.7);

  --accent: var(--pink);
  --accent-2: var(--violet);
  --accent-gradient: linear-gradient(135deg, var(--pink), var(--violet));
  --success: #00e08a;
  --danger: #ff4949;

  --outline: 3px solid var(--ink);
  --outline-light: 3px solid var(--cream);
  /* Pure black rather than var(--ink) -- in dark mode --bg IS --ink, so an
     ink-colored offset shadow on an ink-colored page was nearly invisible,
     only the outline read at all. Black stays visibly darker than both
     --ink and --card in dark mode, and reads the same as before in light
     mode (ink is already near-black there). */
  --shadow-pop: 6px 6px 0 #000000;
  --shadow-pop-sm: 4px 4px 0 #000000;
  --shadow-pop-lg: 9px 9px 0 #000000;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --max-width: 1080px;

  --display: 'Baloo 2', system-ui, sans-serif;
  --sans: 'Poppins', system-ui, -apple-system, sans-serif;

  --dot-color: rgba(255, 248, 238, 0.09);
}

html.light {
  /* Not --cream (#fff8ee) -- that reads distinctly yellow as a full-page
     background. --cream itself is untouched (still used as button/badge
     foreground text etc.), this is just what the page background resolves
     to in light mode: a near-neutral off-white instead. */
  --bg: #f7f6f3;
  --bg-alt: #ffffff;
  --card: #ffffff;
  --card-border: var(--ink);
  --text: var(--ink);
  --text-dim: rgba(26, 26, 46, 0.68);
  --dot-color: rgba(26, 26, 46, 0.07);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

html { color-scheme: dark; }
html.light { color-scheme: light; }

body {
  position: relative;
  background:
    radial-gradient(var(--dot-color) 2.5px, transparent 2.5px) 0 0 / 26px 26px,
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

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

button {
  font-family: inherit;
}

h1, h2, h3,
.brand-text,
.display {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.01em;
}

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: var(--outline);
}

.site-header::after {
  content: '';
  display: block;
  height: 5px;
  background: repeating-linear-gradient(90deg, var(--pink) 0 40px, var(--yellow) 40px 80px, var(--teal) 80px 120px, var(--violet) 120px 160px);
}

.bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.08);
}

.brand-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  border: var(--outline);
  background: var(--teal);
  box-shadow: var(--shadow-pop-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
  background: var(--yellow);
  color: var(--ink);
}

.theme-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  border: var(--outline);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: var(--shadow-pop-sm);
  transition: transform 0.15s ease;
}

.theme-toggle:hover {
  transform: translate(-2px, -2px) rotate(-10deg);
}

.theme-icon-moon { display: none; }
html.light .theme-icon-sun { display: none; }
html.light .theme-icon-moon { display: inline; }

/* ---------- Sticker badges (reused for 18+, NEW, chips) ---------- */

.sticker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  transform: rotate(-3deg);
  box-shadow: 3px 3px 0 var(--ink);
  white-space: nowrap;
}

.sticker-pink { background: var(--pink); color: var(--cream); }
.sticker-teal { background: var(--teal); color: var(--ink); }
.sticker-adult { background: var(--danger); color: var(--cream); transform: rotate(4deg); }

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--display);
  border: var(--outline);
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: var(--shadow-pop);
  background: var(--card);
  color: var(--text);
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--ink);
}

.btn-primary {
  background: var(--pink);
  color: var(--cream);
}

.btn-block {
  width: 100%;
  text-align: center;
}

/* ---------- Panel card (generic "comic panel" surface) ---------- */

.panel-card {
  background: var(--card);
  border: var(--outline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop-lg);
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--text-dim);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 48px 0 32px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border: 3px solid var(--ink);
  border-radius: 50%;
  z-index: -1;
}

.hero::before {
  width: 34px;
  height: 34px;
  top: 6px;
  left: 6%;
  background: var(--yellow);
  transform: rotate(-8deg);
}

.hero::after {
  width: 24px;
  height: 24px;
  bottom: 30px;
  right: 8%;
  background: var(--teal);
  transform: rotate(12deg);
}

.hero .sticker {
  margin: 0 auto 20px;
}

.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 0.98;
  margin: 0 0 16px;
}

.hero h1 .hl {
  color: var(--pink);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0 var(--ink);
}

html.light .hero h1 .hl {
  -webkit-text-stroke: 2px var(--ink);
}

.hero p {
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1.55;
  max-width: 48ch;
  margin: 0 auto 26px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Reward/discount teaser -- styled like a little coupon tag rather than
   another top sticker, so it reads as a distinct payoff for finishing a
   game instead of competing with the trust badge above the headline.
   The icon sits in its own fixed-size circle instead of inline with the
   text: an inline emoji's own line-height runs taller than the Latin text
   around it, which previously made a text+emoji sticker visibly taller
   than a plain-text one -- boxing it fixes the height regardless of the
   emoji glyph's own metrics. */
/* .hero p (generic paragraph spacing below) beats a single .reward-tease
   class on specificity alone, which silently zeroed this margin -- scoped
   under .hero to outrank it. */
.hero .reward-tease {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 34px auto 0;
  padding: 7px 20px 7px 7px;
  background: var(--yellow);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.25;
  text-align: left;
  max-width: 440px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
}

.reward-tease-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--ink);
  font-size: 1.05rem;
}

/* ---------- Games grid (homepage) ---------- */

.section-head {
  text-align: center;
  margin: 44px 0 26px;
}

.section-head h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 6px;
}

.section-head p {
  color: var(--text-dim);
  margin: 0;
}

.game-grid {
  display: grid;
  /* Fixed 2 columns -- not auto-fit -- so games and themes (same shared
     .game-grid/.game-card, see public/cards.js) always lay out the same
     way, regardless of how many cards either page happens to have. */
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

@media (max-width: 640px) {
  .game-grid {
    grid-template-columns: 1fr;
  }
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: var(--outline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop-lg);
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}

.game-card:hover {
  transform: translate(-4px, -4px) rotate(-1deg);
  box-shadow: 13px 13px 0 var(--ink);
}

.game-card-art {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.2rem;
  border-bottom: var(--outline);
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), transparent 55%),
    linear-gradient(135deg, var(--pink), var(--violet));
  position: relative;
  overflow: hidden;
}

/* Card tops cycle through a few bright combos instead of one repeated
   gradient, on every .game-grid (homepage AND the in-game theme picker). */
.game-grid > .game-card:nth-child(3n+2) .game-card-art {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), transparent 55%),
    linear-gradient(135deg, var(--teal), var(--violet));
}

.game-grid > .game-card:nth-child(3n) .game-card-art {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), transparent 55%),
    linear-gradient(135deg, var(--orange), var(--pink));
}

.game-card-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* cover, not contain -- contain letterboxed any image whose aspect ratio
     didn't exactly match the 16:9 art box, leaving the gradient backdrop
     visible as bars down the sides. cover always fills the box edge to
     edge (cropping overflow instead) so no backdrop ever shows through. */
  object-fit: cover;
}

.game-card-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.game-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.game-card-body h3 {
  font-size: 1.35rem;
  margin: 0;
}

.game-card-body p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.45;
  margin: 0;
  flex: 1;
}

.game-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
}

.chip:nth-of-type(2) {
  background: var(--teal);
}

.play-cta {
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.play-cta::after {
  content: '→';
  transition: transform 0.15s ease;
}

.game-card:hover .play-cta::after {
  transform: translateX(5px);
}

.state-message {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0;
  grid-column: 1 / -1;
}

/* ---------- "How it works" strip ---------- */

.payoff {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 56px;
}

.payoff > div {
  position: relative;
  background: var(--card);
  border: var(--outline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop-sm);
  padding: 24px 20px 20px;
}

.payoff > div:nth-child(1) { border-top: 8px solid var(--pink); }
.payoff > div:nth-child(2) { border-top: 8px solid var(--teal); }
.payoff > div:nth-child(3) { border-top: 8px solid var(--yellow); }

.payoff > div::before {
  content: '';
  position: absolute;
  top: -18px;
  left: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--ink);
}

.payoff > div:nth-child(1)::before { background: var(--pink); }
.payoff > div:nth-child(2)::before { background: var(--teal); }
.payoff > div:nth-child(3)::before { background: var(--yellow); }

.payoff strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 8px 0 6px;
}

.payoff span {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: var(--outline);
  margin-top: 60px;
  padding: 24px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.site-footer a {
  text-decoration: underline;
}

/* ---------- Generic form bits (kept for pages still on disk) ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  background: var(--bg-alt);
  border: var(--outline);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--sans);
}

.form-error {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.2em;
  font-weight: 600;
}

.form-notice {
  color: var(--success);
  font-size: 0.9rem;
  min-height: 1.2em;
  font-weight: 600;
}

@media (max-width: 640px) {
  .bar { padding: 12px 16px; }
  .brand-text { font-size: 1.25rem; }
  .site-nav { gap: 6px; }
  .hero { padding: 32px 0 20px; }
}
