/* Aydin's Game Lab — sticker-book playful kids aesthetic */

:root {
  /* Palette — oklch, matched chroma for accent set */
  --bg: #FFF6E8;
  --bg-warm: #FFEDD1;
  --ink: #1B1840;
  --ink-soft: #4B4770;
  --paper: #FFFFFF;

  --c-sun:   oklch(0.85 0.17 85);   /* yellow */
  --c-coral: oklch(0.72 0.17 25);   /* coral */
  --c-sky:   oklch(0.75 0.13 230);  /* blue */
  --c-grass: oklch(0.75 0.15 145);  /* green */
  --c-grape: oklch(0.68 0.17 310);  /* purple */

  --border: 3px solid var(--ink);
  --border-thick: 4px solid var(--ink);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 6px 6px 0 0 var(--ink);
  --shadow-lg: 10px 10px 0 0 var(--ink);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
}
h1 { font-size: clamp(40px, 6vw, 76px); }
h2 { font-size: clamp(28px, 3.5vw, 44px); }
h3 { font-size: clamp(20px, 2vw, 26px); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ——— APP SHELL ——— */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: var(--border);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  cursor: pointer;
  user-select: none;
}
.nav-brand .logo-mark {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--c-sun);
  border: var(--border);
  display: grid; place-items: center;
  box-shadow: 3px 3px 0 var(--ink);
}
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  border: 2px solid transparent;
  background: transparent;
  color: var(--ink);
  transition: all .15s;
}
.nav-link:hover { background: var(--bg-warm); }
.nav-link.active {
  background: var(--ink);
  color: var(--bg);
}

/* ——— BUTTONS ——— */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border: var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  font-size: 17px;
  box-shadow: 4px 4px 0 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
  font-family: var(--font-body);
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 0 var(--ink); }
.btn-primary { background: var(--c-coral); color: var(--paper); }
.btn-yellow { background: var(--c-sun); }
.btn-green { background: var(--c-grass); }
.btn-sky { background: var(--c-sky); }
.btn-lg { padding: 18px 32px; font-size: 19px; }

/* ——— HERO ——— */
.hero {
  padding: 56px 28px 80px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}
.hero-title {
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.95;
}
.hero-title .accent { display: inline-block; }
.hero-title .pill {
  display: inline-block;
  padding: 0 .3em;
  border-radius: 999px;
  background: var(--c-sun);
  transform: rotate(-2deg);
}
.hero-sub {
  font-size: 20px;
  max-width: 560px;
  margin-top: 18px;
  color: var(--ink-soft);
}
.hero-ctas { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

/* Hero variant A — split with mascot */
.hero-a {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
}
.hero-a .mascot-wrap {
  aspect-ratio: 1;
  background: var(--c-sky);
  border: var(--border-thick);
  border-radius: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}
.hero-a .mascot-wrap::before,
.hero-a .mascot-wrap::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: var(--border);
}
.hero-a .mascot-wrap::before {
  width: 80px; height: 80px;
  background: var(--c-sun);
  top: 8%; left: 8%;
}
.hero-a .mascot-wrap::after {
  width: 54px; height: 54px;
  background: var(--c-grass);
  bottom: 10%; right: 12%;
}

/* Hero variant B — centered stacker */
.hero-b { text-align: center; padding-top: 40px; }
.hero-b .hero-sub { margin-left: auto; margin-right: auto; }
.hero-b .hero-ctas { justify-content: center; }
.hero-b .sticker-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 48px;
  flex-wrap: wrap;
}

/* Hero variant C — tile collage */
.hero-c-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 140px;
  gap: 14px;
  margin-top: 32px;
}
.hero-c-grid > * {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  align-items: flex-end;
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 20px;
}
.hero-c-grid .big { grid-column: span 2; grid-row: span 2; font-size: 28px; }

/* ——— STICKERS / MASCOT ——— */
.mascot {
  display: inline-block;
  position: relative;
}
.mascot-body {
  width: var(--size, 200px);
  height: var(--size, 200px);
  border-radius: 50%;
  background: var(--mascot-color, var(--c-coral));
  border: var(--border-thick);
  box-shadow: var(--shadow);
  position: relative;
}
.mascot-eye {
  position: absolute;
  width: 14%;
  aspect-ratio: 1;
  background: var(--ink);
  border-radius: 50%;
  top: 36%;
}
.mascot-eye.l { left: 28%; }
.mascot-eye.r { right: 28%; }
.mascot-eye::after {
  content: '';
  position: absolute;
  width: 35%; aspect-ratio: 1;
  background: white;
  border-radius: 50%;
  top: 15%; left: 15%;
}
.mascot-smile {
  position: absolute;
  left: 30%; right: 30%;
  top: 58%;
  height: 20%;
  border-bottom: 4px solid var(--ink);
  border-radius: 0 0 50% 50%;
}
.mascot-cheek {
  position: absolute;
  width: 14%; aspect-ratio: 1;
  background: oklch(0.82 0.14 20);
  border-radius: 50%;
  top: 54%;
  opacity: .7;
}
.mascot-cheek.l { left: 12%; }
.mascot-cheek.r { right: 12%; }

/* ——— SECTION ——— */
.section {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 48px 28px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
}

/* ——— GAME TILES ——— */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.tile {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  display: flex;
  flex-direction: column;
}
.tile:hover {
  transform: translate(-2px, -2px) rotate(-0.5deg);
  box-shadow: 9px 9px 0 var(--ink);
}
.tile-art {
  aspect-ratio: 4 / 3;
  position: relative;
  border-bottom: var(--border);
  display: grid; place-items: center;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 12px;
  color: var(--ink);
  overflow: hidden;
}
.tile-art::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 12px,
    rgba(27, 24, 64, 0.06) 12px 13px
  );
  pointer-events: none;
}
.tile-body {
  padding: 14px 16px 18px;
}
.tile-cat {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.tile-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}
.tile-meta {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  align-items: center;
}
.tile-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

/* Tile style: Rounded (default above). Other styles via data attr */
[data-tile-style="squircle"] .tile { border-radius: 32px; }
[data-tile-style="squircle"] .tile-art { border-radius: 28px 28px 0 0; }
[data-tile-style="flat"] .tile { box-shadow: none; border-width: 2px; }
[data-tile-style="flat"] .tile:hover { box-shadow: 0 0 0 3px var(--c-coral); transform: none; }
[data-tile-style="sticker"] .tile:nth-child(3n) { transform: rotate(-1.2deg); }
[data-tile-style="sticker"] .tile:nth-child(3n+1) { transform: rotate(0.8deg); }
[data-tile-style="sticker"] .tile:nth-child(3n+2) { transform: rotate(-0.4deg); }
[data-tile-style="sticker"] .tile:hover { transform: rotate(0) scale(1.02); }

/* ——— CHIPS ——— */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  padding: 8px 14px;
  border: var(--border);
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  background: var(--paper);
  cursor: pointer;
  transition: all .1s;
}
.chip:hover { background: var(--bg-warm); }
.chip.active { background: var(--ink); color: var(--bg); }

/* ——— CARDS / GENERIC ——— */
.card {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-yellow { background: var(--c-sun); }
.card-coral { background: var(--c-coral); color: var(--paper); }
.card-sky { background: var(--c-sky); }
.card-grass { background: var(--c-grass); }

/* ——— GAME PAGE ——— */
.game-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.game-stage {
  border: var(--border-thick);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  min-height: 520px;
  padding: 28px;
  position: relative;
}
.game-info-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pill-stat {
  padding: 10px 16px;
  border: var(--border);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 800;
  font-size: 14px;
}

/* ——— MEMORY GAME ——— */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}
.mem-card {
  aspect-ratio: 1;
  border: var(--border);
  border-radius: 16px;
  background: var(--c-sky);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s;
  user-select: none;
}
.mem-card.flipped { background: var(--paper); box-shadow: inset 0 0 0 3px var(--c-coral); }
.mem-card.matched { background: var(--c-grass); opacity: .55; cursor: default; }
.mem-card:not(.flipped):not(.matched) span { visibility: hidden; }
.mem-card:not(.flipped):not(.matched)::after {
  content: '?';
  color: var(--paper);
  font-size: clamp(28px, 5vw, 44px);
  font-family: var(--font-display);
  font-weight: 800;
}

/* ——— MATH CATCH GAME ——— */
.catch-stage {
  position: relative;
  width: 100%;
  height: 480px;
  background: linear-gradient(180deg, oklch(0.88 0.08 230) 0%, oklch(0.95 0.04 140) 100%);
  border: var(--border);
  border-radius: 20px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.catch-basket {
  position: absolute;
  bottom: 8px;
  width: 100px;
  height: 56px;
  background: var(--c-coral);
  border: var(--border);
  border-radius: 12px 12px 28px 28px;
  display: grid; place-items: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  transform: translateX(-50%);
  transition: transform .02s linear;
}
.catch-falling {
  position: absolute;
  width: 52px; height: 52px;
  background: var(--c-sun);
  border: var(--border);
  border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  transform: translateX(-50%);
}
.catch-falling.bad { background: var(--c-grape); color: white; }
.catch-target {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  background: var(--paper);
  border: var(--border);
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  box-shadow: 3px 3px 0 var(--ink);
}
.catch-overlay {
  position: absolute; inset: 0;
  background: rgba(27,24,64,0.55);
  display: grid; place-items: center;
  color: white;
  text-align: center;
  padding: 20px;
}

/* ——— FOOTER ——— */
.footer {
  border-top: var(--border);
  background: var(--paper);
  padding: 28px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: auto;
}

/* ——— TWEAKS PANEL ——— */
.tweaks {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 300px;
  background: var(--paper);
  border: var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  z-index: 100;
  font-size: 14px;
}
.tweaks h4 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.tweaks-row { margin-bottom: 12px; }
.tweaks-row > label {
  display: block;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.tweak-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tweak-chip {
  padding: 5px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.tweak-chip.active { background: var(--ink); color: var(--bg); }
.tweak-swatches { display: flex; gap: 6px; }
.tweak-swatch {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  cursor: pointer;
  display: flex;
  overflow: hidden;
}
.tweak-swatch span { flex: 1; }
.tweak-swatch.active { outline: 3px solid var(--c-coral); outline-offset: 2px; }

/* ——— ABOUT / PARENTS ——— */
.two-col {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
}
.feature-list { display: grid; gap: 16px; }
.feature-item {
  display: flex; gap: 14px;
  padding: 18px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper);
}
.feature-num {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--c-sun);
  border: var(--border);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
}

/* ——— ACHIEVEMENTS ——— */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.badge {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.badge.locked { background: var(--bg-warm); opacity: .6; }
.badge-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  margin: 0 auto 12px;
  border: var(--border);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
}

/* ——— RESPONSIVE ——— */
@media (max-width: 820px) {
  .hero-a { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .hero-c-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .nav-compact { display: flex !important; }
  h1 { font-size: 44px; }
  .tweaks { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
  .catch-stage { height: 420px; }
  .memory-grid { gap: 8px; }
}
.nav-compact { display: none; }

/* Font variants */
[data-font="bricolage-nunito"] { --font-display: 'Bricolage Grotesque', system-ui; --font-body: 'Nunito', system-ui; }
[data-font="rubik-quicksand"] { --font-display: 'Rubik', system-ui; --font-body: 'Quicksand', system-ui; }
[data-font="fredoka-poppins"] { --font-display: 'Fredoka', system-ui; --font-body: 'Poppins', system-ui; }

/* Palette variants (overrides root) */
[data-palette="candy"] {
  --bg: #FFF0F6;
  --bg-warm: #FFE0ED;
  --c-sun: oklch(0.88 0.15 92);
  --c-coral: oklch(0.72 0.18 10);
  --c-sky: oklch(0.78 0.13 290);
  --c-grass: oklch(0.78 0.14 155);
}
[data-palette="ocean"] {
  --bg: #EAF6FA;
  --bg-warm: #D6ECF2;
  --c-sun: oklch(0.88 0.14 100);
  --c-coral: oklch(0.7 0.16 35);
  --c-sky: oklch(0.72 0.14 225);
  --c-grass: oklch(0.78 0.13 175);
}
[data-palette="forest"] {
  --bg: #F3F6E8;
  --bg-warm: #E3ECCB;
  --c-sun: oklch(0.85 0.16 75);
  --c-coral: oklch(0.68 0.17 30);
  --c-sky: oklch(0.72 0.12 210);
  --c-grass: oklch(0.72 0.15 140);
}
