/* Plagomo — shared styles. No inline styles anywhere (strict CSP). */

:root {
  --bg: #f6f4ef;
  --bg-2: #ece8df;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --text: #1d1b22;
  --muted: #6b6775;
  --line: #ddd8cc;
  --accent: #5b4bdb;
  --accent-ink: #ffffff;
  --good: #1f9d63;
  --bad: #d64545;
  --shadow: 0 1px 2px rgba(20, 16, 40, .06), 0 6px 20px rgba(20, 16, 40, .08);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1080px;
  --tap: 44px;

  /* per-game accents */
  --g-memory: #e0567a;
  --g-2048: #e8913a;
  --g-snake: #22a06b;
  --g-ttt: #3f7be0;
  --g-cricket: #0e8fa3;
  --g-sudoku: #8a4fd8;
  --g-bear: #9a5b32;
  --g-tiles: #d9486b;
  --g-hoops: #e8702a;

  /* 2048 tiles */
  --t-empty: #e3ddd0;
  --t-board: #cfc6b4;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121118;
    --bg-2: #18171f;
    --surface: #1e1d27;
    --surface-2: #26252f;
    --text: #efedf5;
    --muted: #a3a0ad;
    --line: #33313d;
    --accent: #8c7dff;
    --accent-ink: #120f24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --t-empty: #2c2a35;
    --t-board: #222029;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121118;
  --bg-2: #18171f;
  --surface: #1e1d27;
  --surface-2: #26252f;
  --text: #efedf5;
  --muted: #a3a0ad;
  --line: #33313d;
  --accent: #8c7dff;
  --accent-ink: #120f24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --t-empty: #2c2a35;
  --t-board: #222029;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a { color: var(--accent); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ---------- Header / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; margin-right: auto;
}
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn {
  min-width: var(--tap); height: var(--tap); border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; padding: 0 10px;
  text-decoration: none; color: var(--text); font-weight: 600; font-size: .95rem;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

.site-footer {
  margin-top: auto; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem;
  padding: 24px 0 calc(24px + env(safe-area-inset-bottom));
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.site-footer a { color: var(--muted); }
.site-footer .copy { margin-right: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer;
  text-decoration: none; touch-action: manipulation; transition: transform .08s ease, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.nogap { gap: 0; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  border: 0; background: transparent; min-height: 38px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  font-weight: 600; color: var(--muted); touch-action: manipulation;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Hub ---------- */
.hero { padding-top: 40px; padding-bottom: 16px; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); font-weight: 850; }
.hero p { color: var(--muted); font-size: 1.08rem; max-width: 56ch; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 0; list-style: none; }
.pills li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .88rem; font-weight: 600; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); padding: 16px 0 8px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); }
.card:active { transform: scale(.985); }
.card .art { aspect-ratio: 16 / 10; display: grid; place-items: center; background: var(--c, var(--accent)); }
.card .art img { width: 46%; height: auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.card .body { padding: 14px 16px 16px; }
.card h2, .card h3 { font-size: 1.15rem; margin: 0 0 4px; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; }
.card .best { margin-top: 10px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.card.memory { --c: var(--g-memory); }
.card.g2048 { --c: var(--g-2048); }
.card.snake { --c: var(--g-snake); }
.card.ttt { --c: var(--g-ttt); }
.card.cricket { --c: var(--g-cricket); }
.card.sudoku { --c: var(--g-sudoku); }
.card.bear { --c: #6fae3e; }
.card.tiles { --c: #c2417a; }
.card.hoops { --c: #e8702a; }

.section { padding-top: 28px; padding-bottom: 28px; }
.section h2 { font-size: 1.4rem; }
.features { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.feature h3 { font-size: 1rem; margin-bottom: 4px; }
.feature p { margin: 0; color: var(--muted); font-size: .93rem; }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: var(--tap); }
.faq details p { color: var(--muted); }

.prose { max-width: 70ch; padding: 32px 0; }
.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.25rem; margin-top: 1.4em; }
.prose p, .prose li { color: var(--text); }
.prose .muted { color: var(--muted); }

/* ---------- Hub: bento tiles ---------- */
.hub-hero { padding-top: 22px; padding-bottom: 4px; }
.hub-hero h1 { font-size: clamp(1.7rem, 7vw, 2.4rem); margin: 0; }
.hub-hero p { margin: 4px 0 0; font-size: .95rem; }
.hub-hero .tagline { color: var(--accent); font-weight: 800; }
.bento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 118px; gap: 12px; padding: 14px 0 12px; grid-auto-flow: dense; }
.bt {
  --c: var(--accent);
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; isolation: isolate;
  padding: 14px; border-radius: 22px; color: #fff; text-decoration: none;
  background: linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 78%, #000));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--c) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .18s cubic-bezier(.2, 1.2, .4, 1), box-shadow .18s;
  animation: btin .45s cubic-bezier(.2, 1.2, .4, 1) backwards;
}
.bt::after { /* soft light blob */
  content: ""; position: absolute; z-index: -1; width: 70%; aspect-ratio: 1; right: -20%; top: -30%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%);
}
.bt:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 14px 28px color-mix(in srgb, var(--c) 38%, transparent); }
.bt:active { transform: scale(.97); }
.bt:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.bt img { position: absolute; right: 10px; top: 12px; width: 34%; height: auto; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .22)); transition: transform .3s ease; z-index: -1; }
.bt:hover img { transform: rotate(-6deg) scale(1.06); }
.bt h2 { position: relative; margin: 0; font-size: 1.08rem; line-height: 1.15; text-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.bt p { position: relative; margin: 3px 0 0; font-size: .8rem; font-weight: 600; opacity: .92; line-height: 1.3; }
.bt.small p { display: none; }
.bt-badge {
  position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 99px; font-size: .72rem; font-weight: 800;
  background: rgba(255, 255, 255, .24); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.bt.big { grid-column: span 2; grid-row: span 2; padding: 20px; }
.bt.big img { width: 40%; max-width: 230px; right: 16px; top: 14%; }
.bt.big h2, .bt.big p { max-width: 62%; }
.bt.big h2 { font-size: clamp(1.45rem, 6.2vw, 2.1rem); }
.bt.big p { font-size: .95rem; }
.bt-play {
  position: relative; align-self: flex-start; margin-top: 12px; padding: 9px 18px; border-radius: 99px;
  background: #fff; color: #14141a; font-weight: 800; font-size: .92rem; box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
}
.bt.wide { grid-column: span 2; }
.bt.wide img { width: 26%; max-width: 110px; right: 16px; top: 50%; transform: translateY(-50%); }
.bt.wide:hover img { transform: translateY(-50%) rotate(-6deg) scale(1.06); }
.bt.wide h2, .bt.wide p { max-width: 64%; }
.bt.tall { grid-row: span 2; }
.bt.tall img { width: 70%; right: 15%; top: 42px; }
.bt.c-cricket { --c: var(--g-cricket); }
.bt.c-sudoku { --c: var(--g-sudoku); }
.bt.c-hoops { --c: #e8702a; }
.bt.c-tiles { --c: #c2417a; }
.bt.c-bear { --c: #5f9f3a; }
.bt.c-g2048 { --c: #e0892f; }
.bt.c-snake { --c: var(--g-snake); }
.bt.c-memory { --c: var(--g-memory); }
.bt.c-ttt { --c: var(--g-ttt); }
.bento .bt:nth-child(1) { animation-delay: 0ms; } .bento .bt:nth-child(2) { animation-delay: 50ms; }
.bento .bt:nth-child(3) { animation-delay: 100ms; } .bento .bt:nth-child(4) { animation-delay: 150ms; }
.bento .bt:nth-child(5) { animation-delay: 200ms; } .bento .bt:nth-child(6) { animation-delay: 250ms; }
.bento .bt:nth-child(7) { animation-delay: 300ms; } .bento .bt:nth-child(8) { animation-delay: 350ms; }
.bento .bt:nth-child(9) { animation-delay: 400ms; }
@keyframes btin { from { opacity: 0; transform: translateY(18px) scale(.94); } }
@media (min-width: 720px) {
  .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 150px; gap: 16px; }
  .bt h2 { font-size: 1.2rem; }
}

/* ---------- Ad slots (hidden until ads are enabled) ---------- */
.ad-slot { display: none; }
html.ads-on .ad-slot {
  display: flex; align-items: center; justify-content: center; margin: 16px auto; width: 100%;
  min-height: 100px; max-width: 728px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font-size: .8rem;
}

/* ---------- Game page shell ---------- */
.game-main { flex: 1; display: flex; flex-direction: column; }
.game-shell { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 20px; }
.game-shell h1 { font-size: 1.35rem; margin: 0; }
.game-top { width: 100%; max-width: 520px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stats { display: flex; gap: 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; min-width: 70px; text-align: center;
}
.stat span { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.toolbar { width: 100%; max-width: 520px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.board-wrap { width: min(92vw, 520px, calc(100dvh - 260px)); min-width: 260px; }
.hint { color: var(--muted); font-size: .88rem; text-align: center; margin: 0; }

.game-info { border-top: 1px solid var(--line); padding: 8px 0 24px; }
.game-info .wrap { max-width: 760px; }
.game-info h2 { font-size: 1.2rem; margin-top: 1.2em; }
.game-info p, .game-info li { color: var(--muted); }
.more-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.more-games a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 700;
}
.more-games img { width: 28px; height: 28px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; padding: 16px; background: rgba(10, 8, 20, .55); }
.modal.open { display: grid; animation: fade .18s ease; }
.modal-card {
  width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px;
  text-align: center; box-shadow: var(--shadow); animation: pop .22s cubic-bezier(.2, 1.4, .4, 1);
}
.modal-card h2 { font-size: 1.5rem; margin-bottom: 4px; }
.modal-card p { color: var(--muted); }
.modal-card .big { font-size: 2.4rem; font-weight: 850; color: var(--text); margin: 4px 0; font-variant-numeric: tabular-nums; }
.modal-card .new-best { color: var(--good); font-weight: 800; }
.modal-actions { display: grid; gap: 8px; margin-top: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .95;
  animation: confetti-fall 2s cubic-bezier(.25, .6, .4, 1) forwards;
}
.confetti i.round { width: 10px; height: 10px; border-radius: 50%; }
@keyframes confetti-fall {
  to { transform: translate(var(--dx, 0), 105vh) rotate(var(--rot, 360deg)); opacity: .9; }
}

/* Memory: found-name banner */
.mm-found {
  min-height: 2.2em; margin: 0; text-align: center; font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mm-found .emo { font-size: 1.6rem; }
.mm-found .hi { color: var(--g-memory); }
.mm-found.pop { animation: pop .3s cubic-bezier(.2, 1.4, .4, 1); }

/* ================= Memory Match ================= */
.mm-board { display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); touch-action: manipulation; }
.mm-board.cols-5 { grid-template-columns: repeat(5, 1fr); }
.mm-board.cols-6 { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mm-card { aspect-ratio: 1; perspective: 700px; border: 0; padding: 0; background: none; cursor: pointer; }
.mm-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform .38s cubic-bezier(.3, .7, .3, 1); transform-style: preserve-3d; }
.mm-card.flipped .mm-inner, .mm-card.matched .mm-inner { transform: rotateY(180deg); }
.mm-face {
  position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; backface-visibility: hidden;
  -webkit-backface-visibility: hidden; font-size: clamp(1.4rem, 7vw, 2.4rem);
}
.mm-board.cols-6 .mm-face { font-size: clamp(1.1rem, 5.5vw, 1.9rem); border-radius: 10px; }
.mm-back {
  background: var(--g-memory);
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,.28) 0 12%, transparent 13%), radial-gradient(circle at 70% 70%, rgba(255,255,255,.18) 0 10%, transparent 11%);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.15);
}
.mm-front { background: var(--surface); border: 2px solid var(--line); transform: rotateY(180deg); }
.mm-card.matched .mm-front { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.mm-card.matched { animation: bump .35s ease .15s; }
.mm-card.wrong .mm-front { border-color: var(--bad); animation: shake .35s ease; }
@keyframes bump { 50% { transform: scale(1.08); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.mm-card.deal { animation: deal .35s cubic-bezier(.2, 1.2, .4, 1) backwards; }
@keyframes deal { from { opacity: 0; transform: translateY(-24px) scale(.6) rotate(-8deg); } }
.mm-back.mm-back-animals {
  background-color: #2f9e62;
  background-image: radial-gradient(ellipse at 30% 30%, rgba(255,255,255,.25) 0 14%, transparent 15%), radial-gradient(ellipse at 72% 68%, rgba(255,255,255,.16) 0 12%, transparent 13%);
}
.mm-back.mm-back-food {
  background-color: #e8813a;
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,.28) 0 12%, transparent 13%), radial-gradient(circle at 70% 70%, rgba(255,255,255,.18) 0 10%, transparent 11%);
}

/* ================= 2048 ================= */
.g-board {
  position: relative; aspect-ratio: 1; background: var(--t-board); border-radius: 14px; padding: 2.4%;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.g-grid, .g-tiles { position: absolute; inset: 2.4%; }
.g-cell, .g-tile { position: absolute; width: 22.6%; height: 22.6%; border-radius: 9px; }
.g-cell { background: var(--t-empty); }
.g-tile {
  display: grid; place-items: center; font-weight: 850; color: #3b3326; background: #eee4da;
  font-size: clamp(1.2rem, 8vw, 2.4rem); transition: left .11s ease, top .11s ease; font-variant-numeric: tabular-nums;
}
.g-tile.new { animation: appear .16s ease .08s backwards; }
.g-tile.merged { animation: merge .18s ease; z-index: 2; }
@keyframes appear { from { transform: scale(0); } }
@keyframes merge { 50% { transform: scale(1.14); } }
.g-tile.v4 { background: #ede0c8; }
.g-tile.v8 { background: #f2b179; color: #fff; }
.g-tile.v16 { background: #f59563; color: #fff; }
.g-tile.v32 { background: #f67c5f; color: #fff; }
.g-tile.v64 { background: #f65e3b; color: #fff; }
.g-tile.v128 { background: #edcf72; color: #fff; font-size: clamp(1rem, 6.6vw, 2rem); }
.g-tile.v256 { background: #edcc61; color: #fff; font-size: clamp(1rem, 6.6vw, 2rem); }
.g-tile.v512 { background: #edc850; color: #fff; font-size: clamp(1rem, 6.6vw, 2rem); }
.g-tile.v1024 { background: #edc53f; color: #fff; font-size: clamp(.85rem, 5.2vw, 1.6rem); }
.g-tile.v2048 { background: #edc22e; color: #fff; font-size: clamp(.85rem, 5.2vw, 1.6rem); box-shadow: 0 0 24px rgba(237, 194, 46, .6); }
.g-tile.vbig { background: #3c3a32; color: #fff; font-size: clamp(.75rem, 4.4vw, 1.35rem); }

.g-board.emoji .g-tile { flex-direction: column; }
.g-tile .g-emo { font-size: clamp(1.7rem, 10vw, 3rem); line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.g-tile small { position: absolute; right: 7%; bottom: 5%; font-size: clamp(.55rem, 2.6vw, .8rem); font-weight: 800; opacity: .75; }
.g-board.emoji .g-tile.merged .g-emo { animation: wiggle .35s ease; }
@keyframes wiggle { 30% { transform: rotate(-12deg) scale(1.2); } 60% { transform: rotate(10deg); } }

/* ================= Snake ================= */
.s-stage { position: relative; }
.s-canvas {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--line); touch-action: none;
}
.s-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.s-overlay[hidden] { display: none; }
.s-overlay p { font-weight: 700; margin: 8px 0 0; color: var(--muted); }
.dpad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 56px); gap: 6px; justify-content: center; }
.dpad button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px; cursor: pointer; font-size: 1.3rem;
  touch-action: manipulation; box-shadow: var(--shadow);
}
.dpad button:active { background: var(--surface-2); transform: scale(.96); }
.dpad .up { grid-column: 2; grid-row: 1; }
.dpad .left { grid-column: 1; grid-row: 2; }
.dpad .down { grid-column: 2; grid-row: 2; }
.dpad .right { grid-column: 3; grid-row: 2; }
.dpad.off { display: none; }

/* ================= Tic-tac-toe ================= */
.t-board {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 8px; aspect-ratio: 1; touch-action: manipulation;
}
.t-cell {
  border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  display: grid; place-items: center; padding: 14%; min-height: 0; overflow: hidden;
}
.t-cell:disabled { cursor: default; }
.t-cell svg { width: 100%; height: 100%; overflow: visible; }
.t-cell .mark { fill: none; stroke-width: 12; stroke-linecap: round; stroke-dasharray: 300; stroke-dashoffset: 300; animation: draw .3s ease forwards; }
.t-cell .x { stroke: var(--g-ttt); }
.t-cell .o { stroke: var(--g-memory); }
.t-cell.win { background: color-mix(in srgb, var(--good) 18%, var(--surface)); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.t-status { font-weight: 700; min-height: 1.6em; text-align: center; margin: 0; }
.t-tally { display: flex; gap: 8px; justify-content: center; }

/* ================= Book Cricket ================= */
.bc-wrap { width: min(94vw, 520px); display: flex; flex-direction: column; gap: 12px; }
.bc-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.bc-panel h2 { font-size: 1.15rem; margin: 0; }
.bc-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.bc-field select {
  font: inherit; font-weight: 600; min-height: var(--tap); padding: 0 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); max-width: 60%;
}
.bc-rules { color: var(--muted); font-size: .92rem; }
.bc-rules summary { cursor: pointer; font-weight: 700; color: var(--text); min-height: 32px; }
.bc-rules ul { margin: 8px 0 0; padding-left: 20px; }
.bc-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.bc-row .btn { flex: 1; }
#bc-toss { text-align: center; align-items: center; }
#bc-toss p { margin: 0; font-weight: 600; }
.bc-coin { font-size: 64px; line-height: 1; height: 72px; display: grid; place-items: center; }
.bc-coin.spin { animation: coin 1.1s cubic-bezier(.3, .6, .4, 1); }
@keyframes coin { 0% { transform: translateY(0) rotateY(0); } 50% { transform: translateY(-50px) rotateY(900deg); } 100% { transform: translateY(0) rotateY(1800deg); } }

.bc-score {
  background: #0f2e25; color: #f2f7f4; border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
  border-top: 4px solid #3ecf8e;
}
.bc-team-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.bc-team-line b { font-size: 1rem; letter-spacing: .04em; }
.bc-runs { font-size: 2rem; font-weight: 850; line-height: 1.1; }
.bc-overs { color: #a9c7bb; font-weight: 600; }
.bc-sub { margin: 2px 0 8px; color: #a9c7bb; font-size: .88rem; font-weight: 600; }
.bc-over { display: flex; gap: 6px; min-height: 30px; flex-wrap: wrap; }
.bc-ball {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800;
  background: #1f4a3c; color: #e6f2ec; animation: pop .2s ease;
}
.bc-ball.b4 { background: #3f7be0; color: #fff; }
.bc-ball.b6 { background: #8c5cf0; color: #fff; }
.bc-ball.bW { background: #d64545; color: #fff; }
.bc-ball.bNB { background: #e8a33a; color: #2a1a00; }
.bc-ball.bD { background: #2c5a4a; color: #9fc0b3; }

.bc-book-wrap { perspective: 1400px; padding: 6px 0; }
.bk {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 1.55; width: 100%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .18));
}
.bk-page {
  position: relative; background: #fffaf0; border: 1px solid #e6dcc6; overflow: hidden;
  background-image: repeating-linear-gradient(to bottom, transparent 0 13px, rgba(90, 80, 60, .09) 13px 15px);
  background-clip: content-box; padding: 14% 12% 22%;
}
.bk-left { border-radius: 14px 4px 4px 14px; box-shadow: inset -14px 0 18px -12px rgba(0, 0, 0, .25); }
.bk-right { border-radius: 4px 14px 14px 4px; box-shadow: inset 14px 0 18px -12px rgba(0, 0, 0, .25); }
.bk-page::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: 7%; height: 5px; border-radius: 3px; background: rgba(90, 80, 60, .22);
}
.bk-num {
  position: absolute; bottom: 5%; font: 700 clamp(1rem, 5vw, 1.35rem)/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #3d3528; font-variant-numeric: tabular-nums;
}
.bk-left .bk-num { left: 8%; }
.bk-right .bk-num { right: 8%; color: #9b917e; }
.bk-num b { color: var(--g-cricket); font-size: 1.45em; padding: 0 2px; border-bottom: 3px solid currentColor; }
.bk::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; background: #f7f0df; border-radius: 4px 14px 14px 4px;
  transform-origin: left center; opacity: 0; border: 1px solid #e6dcc6; backface-visibility: visible;
}
.bk.flip::after { animation: leaf .22s linear infinite; }
@keyframes leaf { 0% { opacity: 1; transform: rotateY(0); } 100% { opacity: 1; transform: rotateY(-180deg); } }
.bk-burst {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0;
  font-weight: 900; font-size: clamp(2rem, 11vw, 3.4rem); letter-spacing: -.02em; text-shadow: 0 3px 0 rgba(0, 0, 0, .15);
}
.bk-burst.show { animation: burst 1.1s ease forwards; }
.bk-burst.r6 { color: #8c5cf0; }
.bk-burst.r4 { color: #3f7be0; }
.bk-burst.r2 { color: #1f9d63; }
.bk-burst.out { color: #d64545; }
.bk-burst.nb { color: #d88a14; }
@keyframes burst { 0% { opacity: 0; transform: scale(.4); } 18% { opacity: 1; transform: scale(1.12); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

.bc-comm { min-height: 3em; margin: 0; text-align: center; font-weight: 600; }
.bc-actions { display: flex; gap: 10px; }
.bc-actions .btn { flex: 1; }
.bc-main { min-height: 56px; font-size: 1.1rem; }
.bc-card { margin: 0; text-align: center; color: var(--muted); font-size: .88rem; }
.bc-link { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline; min-height: 36px; }

/* ================= Sudoku ================= */
.sd-label { margin: -4px 0 0; color: var(--muted); font-weight: 700; font-size: .9rem; }
.sd-board {
  display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: repeat(9, minmax(0, 1fr));
  aspect-ratio: 1; border: 2px solid var(--text); border-radius: 10px; overflow: hidden; background: var(--surface);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.sd-cell {
  position: relative; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0;
  background: var(--surface); color: var(--g-sudoku); font-size: clamp(1.05rem, 5.6vw, 1.65rem); font-weight: 600;
  display: grid; place-items: center; cursor: pointer; min-width: 0; min-height: 0; font-variant-numeric: tabular-nums;
}
.sd-cell:nth-child(9n) { border-right: 0; }
.sd-cell:nth-child(n+73) { border-bottom: 0; }
.sd-cell.bR { border-right: 2px solid var(--text); }
.sd-cell.bB { border-bottom: 2px solid var(--text); }
.sd-cell.given { color: var(--text); font-weight: 800; }
.sd-cell.hinted { color: var(--good); font-weight: 800; }
.sd-cell.peer { background: var(--surface-2); }
.sd-cell.same { background: color-mix(in srgb, var(--g-sudoku) 18%, var(--surface)); }
.sd-cell.sel { background: color-mix(in srgb, var(--g-sudoku) 32%, var(--surface)); }
.sd-cell.err { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.sd-cell.err.sel { background: color-mix(in srgb, var(--bad) 26%, var(--surface)); }
.sd-cell:focus-visible { outline: 3px solid var(--g-sudoku); outline-offset: -3px; border-radius: 0; }
.sd-cell.flash { animation: sdflash .6s ease; }
@keyframes sdflash { 40% { background: color-mix(in srgb, var(--good) 35%, var(--surface)); } }
.sd-board.won { animation: bump .5s ease; }
.sd-notes {
  display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; padding: 1px 2px;
  font-size: clamp(.5rem, 2.3vw, .72rem); font-weight: 600; color: var(--muted); line-height: 1;
}
.sd-notes span { display: grid; place-items: center; }
.sd-notes span.on { color: #fff; background: var(--g-sudoku); border-radius: 3px; }

.sd-tools { width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sd-tools .btn { padding: 0 6px; }
.sd-tools .btn.on { background: var(--g-sudoku); color: #fff; border-color: transparent; }
.sd-pad { width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.sd-pad button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-height: 58px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; touch-action: manipulation;
  font-size: 1.5rem; font-weight: 700; color: var(--g-sudoku); box-shadow: var(--shadow); padding: 0;
}
.sd-pad button:active { transform: scale(.95); background: var(--surface-2); }
.sd-pad small { font-size: .66rem; color: var(--muted); font-weight: 700; min-height: 1em; }
.sd-pad button.done { opacity: .28; box-shadow: none; }
.sd-levels { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.sd-levels .seg button { padding: 0 10px; }

/* ================= Hit the Bear ================= */
.wb-stage { position: relative; }
.wb-board {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 3%;
  aspect-ratio: 1; padding: 4%; border-radius: 18px; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 20% 15%, #9ad66b 0 18%, transparent 19%), radial-gradient(circle at 85% 80%, #8acb5c 0 14%, transparent 15%),
    linear-gradient(180deg, #86c95a, #5f9f3a);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12), var(--shadow);
}
.wb-hole { position: relative; border: 0; padding: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wb-hole::before {
  content: ""; position: absolute; left: 6%; right: 6%; bottom: 14%; height: 20%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #2a1a10, #4a2e1a 70%);
}
.wb-mask { position: absolute; left: 10%; right: 10%; top: -12%; bottom: 22%; overflow: hidden; }
.wb-critter { position: absolute; inset: 0; transform: translateY(105%); transition: transform .15s ease-out; }
.wb-hole.up .wb-critter { transform: translateY(8%); }
.wb-hole.up.hit .wb-critter { transform: translateY(18%) scaleY(.86); transition: transform .08s ease-in; }
.wb-critter svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wb-lip {
  position: absolute; left: 2%; right: 2%; bottom: 6%; height: 20%; border-radius: 50%;
  background: linear-gradient(180deg, #a0703f, #6e4524); box-shadow: 0 4px 0 rgba(0, 0, 0, .15);
}
.wb-hole.whiff .wb-lip { animation: shake .25s ease; }
.wb-fur { fill: var(--fur, #9a5b32); }
.wb-ear { fill: #e2aa78; }
.wb-muzzle { fill: #f3d3ae; }
.wb-ink { fill: #2a1a10; }
.wb-line { fill: none; stroke: #2a1a10; stroke-width: 3.5; stroke-linecap: round; }
.wb-eyes-hit, .wb-crown, .wb-bee { display: none; }
.wb-crown { fill: #ffd23f; stroke: #c8930c; stroke-width: 1.5; }
.wb-hole.golden { --fur: #e7a91e; }
.wb-hole.golden .wb-crown { display: inline; }
.wb-hole.golden .wb-critter { filter: drop-shadow(0 0 8px rgba(255, 215, 64, .9)); }
.wb-hole.hit .wb-eyes { display: none; }
.wb-hole.hit .wb-eyes-hit { display: inline; }
.wb-hole.bee .wb-bear { display: none; }
.wb-hole.bee svg.wb-bee { display: block; }
.wb-hole.bee.up:not(.hit) .wb-critter svg { animation: buzz .18s linear infinite alternate; }
@keyframes buzz { from { transform: translateX(-2px) rotate(-3deg); } to { transform: translateX(2px) rotate(3deg); } }
.wb-pop {
  position: absolute; left: 50%; top: 4%; z-index: 3; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font-weight: 900; font-size: clamp(.95rem, 4.6vw, 1.35rem); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  animation: floatup .75s ease-out forwards;
}
.wb-pop.gold { color: #ffe066; }
.wb-pop.bad { color: #ff7070; }
.wb-pop.hot { color: #ffc27a; }
@keyframes floatup { from { opacity: 1; transform: translate(-50%, 0) scale(.9); } 30% { transform: translate(-50%, -18px) scale(1.15); } to { opacity: 0; transform: translate(-50%, -48px) scale(1); } }
.wb-overlay {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; text-align: center; border-radius: 18px; padding: 20px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.wb-overlay[hidden] { display: none; }
.wb-overlay p { color: var(--text); font-weight: 600; max-width: 30ch; margin: 6px auto 14px; }
.wb-combo { min-height: 1.5em; margin: 0; font-weight: 800; color: var(--muted); text-align: center; }
.wb-combo.hot { color: #e8712a; }

/* ================= Match the Tiles ================= */
.tt-board { position: relative; aspect-ratio: 7 / 8; width: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tt-tile {
  position: absolute; width: calc(100% / 7); height: calc(100% / 8); padding: 0; border: 0; cursor: pointer;
  background: none; display: grid; place-items: center;
}
.tt-tile::before {
  content: ""; position: absolute; inset: 3%; border-radius: 16%;
  background: linear-gradient(180deg, #fffdf6, #f3ead4); border: 1px solid #d9cba6;
  box-shadow: 0 5px 0 #c8b68b, 0 7px 10px rgba(0, 0, 0, .18); transition: filter .2s;
}
.tt-tile span { position: relative; font-size: clamp(1.1rem, 7vw, 2rem); line-height: 1; transform: translateY(-2px); transition: filter .2s, opacity .2s; }
.tt-tile.blocked { cursor: default; }
.tt-tile.blocked::before { filter: brightness(.62) saturate(.7); }
.tt-tile.blocked span { filter: grayscale(.6) brightness(.65); }
.tt-tile.deal { animation: tdeal .4s cubic-bezier(.2, 1.3, .4, 1) backwards; }
@keyframes tdeal { from { opacity: 0; transform: translateY(-30px) scale(.5); } }
.tt-tile.taken { visibility: hidden; }
.tt-tile.nope { animation: shake .3s ease; }
.tt-tile.back { animation: pop .3s ease; }
.tt-tile.spin { animation: tspin .45s ease; }
@keyframes tspin { 50% { transform: rotateY(90deg) scale(.9); } }
.tt-tile:not(.blocked):active::before { filter: brightness(1.06); }
.tt-fly {
  position: fixed; z-index: 80; display: grid; place-items: center; pointer-events: none; border-radius: 16%;
  background: linear-gradient(180deg, #fffdf6, #f3ead4); border: 1px solid #d9cba6; box-shadow: 0 8px 18px rgba(0, 0, 0, .25);
  font-size: clamp(1.1rem, 7vw, 2rem);
}
.tt-tray {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding: 7px; border-radius: 16px; width: 100%;
  background: linear-gradient(180deg, #8a5a33, #6b4224); box-shadow: inset 0 3px 6px rgba(0, 0, 0, .35), var(--shadow);
  transition: box-shadow .2s;
}
.tt-tray.danger { box-shadow: inset 0 3px 6px rgba(0, 0, 0, .35), 0 0 0 3px var(--bad); }
.tt-tray.shake { animation: shake .4s ease; }
.tt-slot { aspect-ratio: 1; border-radius: 10px; background: rgba(0, 0, 0, .22); display: grid; place-items: center; }
.tt-in {
  width: 100%; height: 100%; display: grid; place-items: center; border-radius: 10px; font-size: clamp(1rem, 6vw, 1.7rem);
  background: linear-gradient(180deg, #fffdf6, #f3ead4); box-shadow: 0 3px 0 #c8b68b; animation: pop .18s ease;
}
.tt-in.incoming { visibility: hidden; }
.tt-in.clear { animation: tclear .26s ease forwards; }
@keyframes tclear { 40% { transform: scale(1.25); } to { transform: scale(0); opacity: 0; } }
.tt-tools { width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ================= Basketball ================= */
.bb-stage { position: relative; }
.bb-canvas { display: block; width: 100%; aspect-ratio: 2 / 3; border-radius: 16px; touch-action: none; background: #1b2238; }
.bb-overlay {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; text-align: center; border-radius: 16px; padding: 20px;
  background: rgba(10, 12, 24, .55); color: #fff;
}
.bb-overlay[hidden] { display: none; }
.bb-overlay p { font-weight: 600; max-width: 30ch; margin: 6px auto 14px; color: #e8ebf5; }
.bb-board-wrap { width: min(92vw, 440px, calc((100dvh - 230px) * 2 / 3)); min-width: 250px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 420px) {
  .stat { min-width: 60px; padding: 4px 8px; }
  .game-shell h1 { font-size: 1.15rem; }
  /* four stats on a narrow phone: let the boxes shrink to their content */
  .stats:has(.stat:nth-child(4)) { gap: 5px; }
  .stats:has(.stat:nth-child(4)) .stat { min-width: 0; padding: 4px 7px; }
  .stats:has(.stat:nth-child(4)) .stat span { letter-spacing: .02em; }
}

/* ================= Ball Sort ================= */
:root { --g-ballsort: #2e9bb8; }
.bs-nav { display: flex; align-items: center; gap: 6px; }
.bs-nav .btn { min-width: 40px; padding: 0 10px; }
.bs-msg { min-height: 1.5em; margin: 0; font-weight: 700; color: var(--bad); text-align: center; }
.bs-board {
  --per-row: 5;
  width: 100%; display: grid; grid-template-columns: repeat(var(--per-row), minmax(0, 1fr));
  gap: 34px 6px; justify-items: center; padding: 26px 2px 6px; touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
.bs-tube {
  position: relative; width: min(100%, 64px); aspect-ratio: 1 / 3.4; padding: 6% 9% 9%; cursor: pointer;
  display: flex; flex-direction: column-reverse; justify-content: flex-start; align-items: center; gap: 4%;
  border: 3px solid color-mix(in srgb, var(--text) 30%, transparent); border-top: 0; border-radius: 0 0 999px 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  box-shadow: inset 6px 0 10px -6px rgba(255, 255, 255, .5), inset -4px -6px 12px -6px rgba(0, 0, 0, .18);
  transition: transform .15s ease, border-color .15s ease; -webkit-tap-highlight-color: transparent;
}
.bs-tube::before { /* rim */
  content: ""; position: absolute; top: -4px; left: -7px; right: -7px; height: 7px; border-radius: 6px;
  background: color-mix(in srgb, var(--text) 30%, transparent);
}
.bs-tube.sel { border-color: var(--g-ballsort); }
.bs-tube.sel::before { background: var(--g-ballsort); }
.bs-tube.done { border-color: var(--good); }
.bs-tube.done::before { background: var(--good); }
.bs-tube.done { animation: bump .4s ease; }
.bs-tube.deal { animation: deal .4s cubic-bezier(.2, 1.2, .4, 1) backwards; }
.bs-ball {
  position: relative; flex: none; width: 100%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .7) 0 10%, rgba(255, 255, 255, 0) 38%), var(--bc, #999);
  box-shadow: inset 0 -4px 6px rgba(0, 0, 0, .22), 0 2px 3px rgba(0, 0, 0, .18);
  transition: transform .16s cubic-bezier(.2, 1.3, .4, 1);
}
.bs-ball.up { transform: translateY(var(--lift, -260%)); }
.bs-ball.drop { animation: bsdrop .26s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes bsdrop { from { transform: translateY(-160%); } }
.bs-board.symbols .bs-ball::after {
  content: attr(data-sym); color: rgba(255, 255, 255, .95); font-size: clamp(.6rem, 3.4vw, 1rem); font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45); line-height: 1;
}
.bs-ball.c0 { --bc: #e5484d; } .bs-ball.c1 { --bc: #3e7bfa; } .bs-ball.c2 { --bc: #f5c518; } .bs-ball.c3 { --bc: #2fb36d; }
.bs-ball.c4 { --bc: #8e4ec6; } .bs-ball.c5 { --bc: #f7882f; } .bs-ball.c6 { --bc: #f065b4; } .bs-ball.c7 { --bc: #1fbad6; }
.bs-ball.c8 { --bc: #9a6233; } .bs-ball.c9 { --bc: #9ad13d; } .bs-ball.c10 { --bc: #2b3a8f; } .bs-ball.c11 { --bc: #8b8d98; }
.bs-tools { width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bs-tools .btn { padding: 0 6px; }
.bs-wrap { width: min(94vw, 520px); }
.bt.c-ballsort { --c: var(--g-ballsort); }

/* ================= Hub: all games, categories, search ================= */
.allgames { padding-top: 18px; padding-bottom: 8px; }
.allgames-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.allgames-head h2 { font-size: 1.35rem; margin: 0; }
.game-search {
  flex: 1 1 220px; max-width: 340px; min-height: var(--tap); padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
.cat-chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px;
  min-height: 38px; padding: 0 14px; font-weight: 700; font-size: .88rem; cursor: pointer; white-space: nowrap;
}
.cat-chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.cat-chip small { font-weight: 600; opacity: .65; margin-left: 4px; }
.game-list { list-style: none; margin: 0; padding: 10px 0 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.game-list a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; text-decoration: none; color: var(--text); min-width: 0;
}
.game-list a:hover { background: var(--surface-2); }
.game-list .gl-icon { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--c, var(--accent)); }
.game-list .gl-icon img { width: 34px; height: 34px; }
.game-list .gl-text { min-width: 0; }
.game-list b { display: block; font-size: .98rem; }
.game-list span.gl-cats { display: block; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-list .new { font-size: .68rem; font-weight: 800; color: var(--good); margin-left: 6px; letter-spacing: .04em; }
.game-list li.c-cricket { --c: var(--g-cricket); } .game-list li.c-sudoku { --c: var(--g-sudoku); } .game-list li.c-hoops { --c: #e8702a; }
.game-list li.c-tiles { --c: #c2417a; } .game-list li.c-bear { --c: #5f9f3a; } .game-list li.c-g2048 { --c: #e0892f; }
.game-list li.c-snake { --c: var(--g-snake); } .game-list li.c-memory { --c: var(--g-memory); } .game-list li.c-ttt { --c: var(--g-ttt); }
.game-list li.c-ballsort { --c: var(--g-ballsort); }
.no-results { color: var(--muted); padding: 16px 0; margin: 0; }

/* ================= Water Sort (sort engine, water mode) ================= */
:root { --g-watersort: #3a7fd5; --g-stack: #d9573b; --g-kite: #f08a24; }
.bs-board.mode-water { gap: 30px 8px; }
.mode-water .bs-tube {
  width: min(100%, 58px); aspect-ratio: 1 / 3; padding: 0 0 0; gap: 0; overflow: hidden;
  border-radius: 0 0 22px 22px; border-width: 3px;
  transition: transform .2s cubic-bezier(.2, 1.2, .4, 1), border-color .15s ease;
}
.mode-water .bs-tube::before { display: none; }
.mode-water .bs-tube::after { /* neck / rim, drawn inside so overflow can stay hidden */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: color-mix(in srgb, var(--text) 30%, transparent);
}
.mode-water .bs-tube.sel { transform: translateY(-16px) rotate(-5deg); }
.mode-water .bs-tube.sel::after, .mode-water .bs-tube.done::after { background: currentColor; }
.mode-water .bs-tube.sel { color: var(--g-watersort); }
.mode-water .bs-tube.done { color: var(--good); }
.ws-seg {
  position: relative; flex: none; width: 100%; height: 21.5%; background: var(--bc, #999);
  display: grid; place-items: center; transform-origin: bottom center;
  box-shadow: inset 6px 0 8px -4px rgba(255, 255, 255, .35);
}
.ws-seg.top { box-shadow: inset 6px 0 8px -4px rgba(255, 255, 255, .35), inset 0 3px 0 rgba(255, 255, 255, .28); }
.ws-seg.fill { animation: wsfill .32s ease-out; }
@keyframes wsfill { from { transform: scaleY(0); } }
.ws-seg.c0 { --bc: #e5484d; } .ws-seg.c1 { --bc: #3e7bfa; } .ws-seg.c2 { --bc: #f5c518; } .ws-seg.c3 { --bc: #2fb36d; }
.ws-seg.c4 { --bc: #8e4ec6; } .ws-seg.c5 { --bc: #f7882f; } .ws-seg.c6 { --bc: #f065b4; } .ws-seg.c7 { --bc: #1fbad6; }
.ws-seg.c8 { --bc: #9a6233; } .ws-seg.c9 { --bc: #9ad13d; } .ws-seg.c10 { --bc: #2b3a8f; } .ws-seg.c11 { --bc: #8b8d98; }
.bs-board.symbols .ws-seg::after {
  content: attr(data-sym); color: rgba(255, 255, 255, .95); font-size: clamp(.6rem, 3.4vw, 1rem); font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45); line-height: 1;
}

/* ================= Canvas games (Stack Tower, Kite Flyer, ...) ================= */
.cv-wrap { width: min(92vw, 440px, calc((100dvh - 210px) * 2 / 3)); min-width: 250px; }
.cv-stage { position: relative; }
.cv-canvas { display: block; width: 100%; aspect-ratio: 2 / 3; border-radius: 16px; touch-action: none; background: #1b2238; cursor: pointer; }
.cv-overlay {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; text-align: center; border-radius: 16px; padding: 20px;
  background: rgba(10, 12, 24, .5); color: #fff;
}
.cv-overlay[hidden] { display: none; }
.cv-overlay h2 { font-size: 1.6rem; }
.cv-overlay p { font-weight: 600; max-width: 30ch; margin: 6px auto 14px; color: #e8ebf5; }

.bt.c-watersort { --c: var(--g-watersort); } .bt.c-stack { --c: var(--g-stack); } .bt.c-kite { --c: var(--g-kite); }
.game-list li.c-watersort { --c: var(--g-watersort); } .game-list li.c-stack { --c: var(--g-stack); } .game-list li.c-kite { --c: var(--g-kite); }

/* ---------- First-time coach (tapping hand + tip) ---------- */
.coach { position: fixed; z-index: 45; pointer-events: none; transform: translate(-50%, 0); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.coach-hand { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); animation: coachtap 1.1s ease-in-out infinite; transform-origin: 50% 0; }
.coach-tip {
  background: var(--text); color: var(--bg); padding: 7px 12px; border-radius: 10px; font-weight: 700; font-size: .9rem;
  white-space: nowrap; box-shadow: var(--shadow);
}
@keyframes coachtap { 0%, 100% { transform: translateY(6px); } 45% { transform: translateY(-4px) scale(1.05); } 60% { transform: translateY(8px) scale(.92); } }
@media (prefers-reduced-motion: reduce) { .coach-hand { animation: none; } }
.bs-fly { position: fixed; z-index: 40; pointer-events: none; transition: none; margin: 0; }
.ws-stream { position: fixed; z-index: 4; width: 6px; border-radius: 3px; transform-origin: top center; pointer-events: none; box-shadow: inset 2px 0 0 rgba(255, 255, 255, .3); }
.mode-water .bs-tube { will-change: transform; }

/* ================= Block Puzzle ================= */
:root { --g-blocks: #6a4fd6; --g-mines: #4f6b7f; --g-dots: #e0567a; --g-c4: #2d6fd6; --g-hockey: #10a5a0;
  --k1: #ef5a5a; --k2: #f59f2c; --k3: #f2c935; --k4: #3dbb6b; --k5: #2fa7e0; --k6: #5b6cf0; --k7: #b55be0; }
.bp-wrap { width: min(94vw, 460px, calc(100dvh - 300px)); min-width: 270px; }
.bp-board {
  position: relative; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; aspect-ratio: 1; padding: 6px;
  background: color-mix(in srgb, var(--g-blocks) 22%, var(--surface-2)); border-radius: 14px; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .12);
}
.bp-cell { border-radius: 5px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.bp-cell.on, .bp-block, .bp-cell.ghost, .bp-cell.will {
  background: linear-gradient(160deg, color-mix(in srgb, var(--kc) 70%, #fff) 0 18%, var(--kc) 45%, color-mix(in srgb, var(--kc) 80%, #000));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.k1 { --kc: var(--k1); } .k2 { --kc: var(--k2); } .k3 { --kc: var(--k3); } .k4 { --kc: var(--k4); } .k5 { --kc: var(--k5); } .k6 { --kc: var(--k6); } .k7 { --kc: var(--k7); }
.bp-cell[data-k="1"] { --kc: var(--k1); } .bp-cell[data-k="2"] { --kc: var(--k2); } .bp-cell[data-k="3"] { --kc: var(--k3); } .bp-cell[data-k="4"] { --kc: var(--k4); }
.bp-cell[data-k="5"] { --kc: var(--k5); } .bp-cell[data-k="6"] { --kc: var(--k6); } .bp-cell[data-k="7"] { --kc: var(--k7); }
.bp-cell.ghost { opacity: .45; }
.bp-cell.will { opacity: 1; filter: brightness(1.15); animation: bpwill .6s ease-in-out infinite alternate; }
@keyframes bpwill { to { filter: brightness(1.35); } }
.bp-cell.clearing { animation: bpclear .4s ease-in forwards; }
@keyframes bpclear { 0% { transform: scale(1); filter: brightness(1.8); } 100% { transform: scale(0); opacity: 0; } }
.bp-cell.fade { animation: bpfade .5s ease forwards; }
@keyframes bpfade { to { filter: grayscale(.85); opacity: .55; } }
.bp-pop {
  position: absolute; transform: translate(-50%, 0); pointer-events: none; z-index: 3; white-space: nowrap;
  font-weight: 900; font-size: clamp(1rem, 4.6vw, 1.4rem); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 12px rgba(0, 0, 0, .25);
  animation: floatup 1s ease-out forwards;
}
.bp-tray { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-height: 110px; }
.bp-slot {
  border: 0; background: transparent; display: grid; place-items: center; min-height: 110px; border-radius: 14px; cursor: grab; touch-action: none; padding: 6px;
}
.bp-slot.sel { background: color-mix(in srgb, var(--g-blocks) 16%, transparent); outline: 2px solid var(--g-blocks); }
.bp-slot.lifted .bp-piece { opacity: .25; }
.bp-slot.nofit .bp-piece { filter: grayscale(.9) opacity(.45); }
.bp-piece { display: grid; grid-template-columns: repeat(var(--pw), 18px); grid-template-rows: repeat(var(--ph), 18px); gap: 2px; pointer-events: none; }
.bp-piece .bp-block { border-radius: 4px; }
.bp-fly {
  position: fixed; left: 0; top: 0; z-index: 60; gap: 3px; pointer-events: none;
  grid-template-columns: repeat(var(--pw), 1fr); grid-template-rows: repeat(var(--ph), 1fr); filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .3));
}
.bp-fly .bp-block { border-radius: 5px; }
.bt.c-blocks { --c: var(--g-blocks); } .game-list li.c-blocks { --c: var(--g-blocks); }

/* ================= Minesweeper ================= */
.ms-wrap { width: min(94vw, 480px); }
.ms-bar { width: 100%; max-width: 520px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ms-face { font-size: 1.6rem; width: 48px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.ms-mode { min-width: 140px; }
.ms-mode.on { background: #d64545; color: #fff; border-color: transparent; }
.ms-board {
  --cols: 9; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; padding: 6px; border-radius: 14px;
  background: color-mix(in srgb, var(--g-mines) 30%, var(--surface-2)); touch-action: manipulation; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ms-board.dense { gap: 2px; padding: 5px; }
.ms-cell {
  aspect-ratio: 1; border: 0; padding: 0; border-radius: 6px; cursor: pointer; min-width: 0;
  display: grid; place-items: center; font-weight: 900; font-size: clamp(.8rem, 4.4vw, 1.25rem); line-height: 1;
  background: linear-gradient(160deg, #8fa7ba, #6c8698); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2), inset 0 2px 0 rgba(255, 255, 255, .3);
  -webkit-tap-highlight-color: transparent;
}
.ms-board.dense .ms-cell { border-radius: 4px; font-size: clamp(.7rem, 3.6vw, 1.05rem); }
.ms-cell:active:not(.open) { filter: brightness(.92); }
.ms-cell.open { background: var(--surface); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); cursor: default; }
.ms-cell.ripple { animation: msopen .22s ease-out backwards; }
@keyframes msopen { from { transform: scale(.7); background: #8fa7ba; } }
.ms-cell.flag { font-size: clamp(.75rem, 4vw, 1.1rem); }
.ms-cell.mine { background: color-mix(in srgb, var(--bad) 25%, var(--surface)); font-size: clamp(.75rem, 4vw, 1.1rem); }
.ms-cell.mine.pop { animation: pop .25s ease; }
.ms-cell.boom { background: var(--bad) !important; animation: msboom .5s ease; }
@keyframes msboom { 30% { transform: scale(1.4); } }
.ms-cell.wrong { position: relative; }
.ms-cell.wrong::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--bad); font-size: 1.3em; font-weight: 900; }
.ms-cell.n1 { color: #2f6fd6; } .ms-cell.n2 { color: #1f9d55; } .ms-cell.n3 { color: #d64545; } .ms-cell.n4 { color: #5b3fc4; }
.ms-cell.n5 { color: #b5462a; } .ms-cell.n6 { color: #138c8c; } .ms-cell.n7 { color: var(--text); } .ms-cell.n8 { color: var(--muted); }
:root[data-theme="dark"] .ms-cell.n1 { color: #7fa8ff; } :root[data-theme="dark"] .ms-cell.n4 { color: #a993ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ms-cell.n1 { color: #7fa8ff; } :root:not([data-theme="light"]) .ms-cell.n4 { color: #a993ff; } }
.bt.c-mines { --c: var(--g-mines); } .game-list li.c-mines { --c: var(--g-mines); }

/* ================= Connect the Dots ================= */
.cd-wrap { width: min(94vw, 480px, calc(100dvh - 300px)); min-width: 270px; }
.cd-board { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #15161f; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: var(--shadow); }
.cd-svg { display: block; width: 100%; height: 100%; }
.cd-grid line { stroke: rgba(255, 255, 255, .1); stroke-width: .02; }
.cd-line { fill: none; stroke-width: .34; stroke-linecap: round; stroke-linejoin: round; }
.cd-line.done { stroke-width: .38; }
.cd-dot { transform-box: fill-box; transform-origin: center; }
.cd-dot.intro { animation: cddot .4s cubic-bezier(.2, 1.4, .4, 1) backwards; }
.cd-dot.done { animation: cddone .35s ease; }
@keyframes cddot { from { transform: scale(0); } }
@keyframes cddone { 50% { transform: scale(1.25); } }
.cd-msg { min-height: 1.5em; margin: 0; font-weight: 700; color: var(--good); text-align: center; }
.bt.c-dots { --c: var(--g-dots); } .game-list li.c-dots { --c: var(--g-dots); }

/* ================= Connect Four ================= */
.c4-wrap { width: min(94vw, 480px, calc((100dvh - 300px) * 7 / 6)); min-width: 270px; }
.c4-board {
  position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2%; padding: 3%; border-radius: 18px;
  background: linear-gradient(180deg, #3a7be6, #2556b8); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .2), 0 10px 24px rgba(37, 86, 184, .35);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.c4-cell { position: relative; aspect-ratio: 1; border-radius: 50%; background: var(--bg); box-shadow: inset 0 4px 6px rgba(0, 0, 0, .35); overflow: hidden; }
.c4-cell.hover { background: color-mix(in srgb, var(--bg) 85%, #fff); }
.c4-disc { position: absolute; inset: 6%; border-radius: 50%; z-index: 1; }
.c4-disc.p1, .c4-dot.p1 { background: radial-gradient(circle at 35% 30%, #ff8a8a, #e5484d 55%, #b3262b); }
.c4-disc.p2, .c4-dot.p2 { background: radial-gradient(circle at 35% 30%, #fff1a6, #f5c518 55%, #c99a00); }
.c4-disc::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .12); }
.c4-disc.win { animation: c4win .6s ease-in-out infinite alternate; }
@keyframes c4win { to { transform: scale(.86); box-shadow: 0 0 0 4px #fff, 0 0 18px rgba(255, 255, 255, .8); } }
.c4-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 3%; z-index: 2; }
.c4-col { border: 0; background: transparent; cursor: pointer; padding: 0; border-radius: 10px; }
.c4-col:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.c4-status { min-height: 1.7em; margin: 0; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 4px; }
.c4-dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; }
.bt.c-c4 { --c: var(--g-c4); } .game-list li.c-c4 { --c: var(--g-c4); }
.bt.c-hockey { --c: var(--g-hockey); } .game-list li.c-hockey { --c: var(--g-hockey); }

/* ================= Word grid (Daily Word, Shabd) ================= */
:root { --g-word: #3f9a5c; --g-shabd: #e07b24; --g-wsearch: #2f8f9d; --g-emoji: #f0a020; --g-crunch: #5a62d6;
  --wg-correct: #3f9a5c; --wg-present: #c9a227; --wg-partial: #e07b24; --wg-absent: #7a7c86; }
.wg-head { width: 100%; max-width: 520px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.wg-num { font-weight: 800; color: var(--muted); }
.wg-board { --len: 5; display: grid; gap: 6px; width: min(86vw, calc(var(--len) * 62px), calc((100dvh - 430px) * var(--len) / 6)); min-width: 220px; }
.wg-row { display: grid; grid-template-columns: repeat(var(--len), minmax(0, 1fr)); gap: 6px; }
.wg-tile {
  aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 8px; background: var(--surface);
  font-weight: 850; font-size: clamp(1.3rem, 7vw, 2rem); line-height: 1; text-transform: uppercase; color: var(--text); user-select: none;
}
.wg-board[data-lang="hi"] .wg-tile { font-size: clamp(1.5rem, 9vw, 2.4rem); font-weight: 700; text-transform: none; }
.wg-tile.filled { border-color: color-mix(in srgb, var(--text) 45%, var(--line)); }
.wg-tile.correct, .wg-tile.present, .wg-tile.partial, .wg-tile.absent { color: #fff; border-color: transparent; }
.wg-tile.correct { background: var(--wg-correct); } .wg-tile.present { background: var(--wg-present); }
.wg-tile.partial { background: var(--wg-partial); } .wg-tile.absent { background: var(--wg-absent); }
.wg-msg { min-height: 1.5em; margin: 0; font-weight: 800; text-align: center; }
.wg-kb { width: 100%; max-width: 520px; display: grid; gap: 6px; user-select: none; -webkit-user-select: none; }
.wg-krow { display: flex; gap: 5px; justify-content: center; }
.wg-key {
  flex: 1 1 0; min-width: 0; min-height: 50px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--text) 12%, var(--surface));
  font-weight: 800; font-size: 1rem; cursor: pointer; touch-action: manipulation; color: var(--text); padding: 0;
}
.wg-kb[data-lang="hi"] .wg-key { min-height: 42px; font-size: 1.12rem; font-weight: 600; }
.wg-key.wide { flex: 1.6 1 0; font-size: .82rem; }
.wg-key.matra { background: color-mix(in srgb, var(--g-shabd) 18%, var(--surface)); }
.wg-key:active { filter: brightness(.9); }
.wg-key.correct { background: var(--wg-correct); color: #fff; } .wg-key.present { background: var(--wg-present); color: #fff; } .wg-key.absent { background: var(--wg-absent); color: #fff; opacity: .7; }
.wg-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .8rem; color: var(--muted); margin: 0; }
.wg-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.wg-legend .l1 { background: var(--wg-correct); } .wg-legend .l2 { background: var(--wg-present); } .wg-legend .l3 { background: var(--wg-partial); } .wg-legend .l4 { background: var(--wg-absent); }
.bt.c-word { --c: var(--g-word); } .game-list li.c-word { --c: var(--g-word); }
.bt.c-shabd { --c: var(--g-shabd); } .game-list li.c-shabd { --c: var(--g-shabd); }

/* ================= Word Search ================= */
.wsr-wrap { width: min(94vw, 480px, calc(100dvh - 330px)); min-width: 260px; }
.wsr-theme { font-weight: 800; color: var(--g-wsearch); }
.wsr-grid {
  --n: 10; position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); aspect-ratio: 1;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; touch-action: none; user-select: none; -webkit-user-select: none;
}
.wsr-svg { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); pointer-events: none; z-index: 0; }
.wsr-svg line { stroke-width: .74; stroke-linecap: round; }
.wsr-svg .wsr-found { stroke-opacity: .32; }
.wsr-svg .wsr-sel { stroke-opacity: 1; }
.wsr-cell { position: relative; z-index: 1; display: grid; place-items: center; font-weight: 800; font-size: clamp(.95rem, 4.8vw, 1.4rem); color: var(--text); }
.wsr-cell.hint { color: #fff; animation: wsrhint .5s ease-in-out 5 alternate; }
@keyframes wsrhint { from { background: transparent; border-radius: 50%; } to { background: var(--g-wsearch); border-radius: 50%; } }
.wsr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 520px; }
.wsr-list li { padding: 5px 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; font-size: .85rem; letter-spacing: .04em; }
.wsr-list li.done { text-decoration: line-through; color: var(--muted); background: color-mix(in srgb, var(--good) 14%, var(--surface)); border-color: transparent; }
.bt.c-wsearch { --c: var(--g-wsearch); } .game-list li.c-wsearch { --c: var(--g-wsearch); }

/* ================= Emoji Movie Guess ================= */
.em-bar { width: 100%; max-width: 520px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; --p: 0%; }
.em-bar i { display: block; height: 100%; width: var(--p); background: var(--g-emoji); transition: width .3s ease; }
.em-card {
  width: 100%; max-width: 520px; min-height: 150px; display: grid; place-items: center; border-radius: 22px; padding: 18px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--g-emoji) 22%, var(--surface)), var(--surface)); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.em-clue { font-size: clamp(2.6rem, 13vw, 4rem); line-height: 1.15; text-align: center; letter-spacing: .06em; }
.em-msg { min-height: 1.5em; margin: 0; font-weight: 800; text-align: center; }
.em-opts { width: 100%; max-width: 520px; display: grid; gap: 8px; }
.em-opt {
  min-height: 54px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 750; font-size: 1rem; cursor: pointer; text-align: left; transition: transform .1s ease, border-color .15s;
}
.em-opt:hover:not(:disabled) { border-color: var(--g-emoji); }
.em-opt:active:not(:disabled) { transform: scale(.98); }
.em-opt.right { background: color-mix(in srgb, var(--good) 22%, var(--surface)); border-color: var(--good); }
.em-opt.wrong { background: color-mix(in srgb, var(--bad) 18%, var(--surface)); border-color: var(--bad); animation: shake .35s ease; }
.em-opt.gone { opacity: .25; text-decoration: line-through; }
.em-opt:disabled { cursor: default; }
.em-tools { justify-content: center; }
.bt.c-emoji { --c: var(--g-emoji); } .game-list li.c-emoji { --c: var(--g-emoji); }

/* ================= Number Crunch ================= */
.nc-wrap { width: min(94vw, 480px); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.nc-target {
  width: 100%; display: flex; align-items: baseline; justify-content: center; gap: 12px; padding: 14px; border-radius: 18px;
  background: linear-gradient(150deg, var(--g-crunch), color-mix(in srgb, var(--g-crunch) 70%, #000)); color: #fff; box-shadow: var(--shadow);
}
.nc-target span { font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; }
.nc-target b { font-size: clamp(2.6rem, 13vw, 3.6rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.nc-tiles { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-height: 140px; }
.nc-tile {
  min-height: 64px; border-radius: 16px; border: 0; cursor: pointer; font-size: clamp(1.4rem, 7vw, 2rem); font-weight: 900; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--text); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12), var(--shadow); transition: transform .1s ease;
}
.nc-tile.long { font-size: clamp(1.1rem, 5.6vw, 1.6rem); }
.nc-tile:active { transform: scale(.96); }
.nc-tile.sel { background: color-mix(in srgb, var(--g-crunch) 22%, var(--surface)); outline: 3px solid var(--g-crunch); }
.nc-tile.hit { background: var(--good); color: #fff; }
.nc-ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.nc-op {
  min-height: 56px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 1.7rem; font-weight: 900; cursor: pointer;
}
.nc-op[aria-pressed="true"] { background: var(--g-crunch); color: #fff; border-color: transparent; }
.nc-op:disabled { opacity: .45; cursor: default; }
.nc-msg { min-height: 1.5em; margin: 0; font-weight: 700; text-align: center; color: var(--muted); }
.nc-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.bt.c-crunch { --c: var(--g-crunch); } .game-list li.c-crunch { --c: var(--g-crunch); }
/* Shabd: six 3-akshara rows laid out as two columns of three so board + keyboard fit one phone screen */
.wg-board[data-lang="hi"] {
  width: min(94vw, 460px); grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, auto); grid-auto-flow: column; column-gap: 18px;
}
.wg-board[data-lang="hi"] .wg-tile { font-size: clamp(1.2rem, 6.4vw, 1.9rem); }

/* ================= Solitaire ================= */
:root { --g-sol: #1f8a5b; --g-brick: #e0533f; --g-penalty: #2e9e4f; --g-snakes: #d9822b; }
.sol-wrap { width: min(96vw, 620px); }
.sol-board {
  position: relative; width: 100%; min-height: 320px; border-radius: 16px; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse at 50% 0%, #2a9a69, #17714a 70%); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .25);
  transition: height .2s ease;
}
.sol-card, .sol-slot { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .1); }
.sol-slot { border: 2px dashed rgba(255, 255, 255, .3); display: grid; place-items: center; color: rgba(255, 255, 255, .45); font-weight: 900; font-size: calc(var(--cw) * .4); }
.sol-card {
  background: #fff; color: #1d1b22; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); cursor: pointer;
  transition: transform .2s cubic-bezier(.3, .7, .3, 1); will-change: transform; overflow: hidden;
}
.sol-board.instant .sol-card, .sol-board.dragging .sol-card.lift { transition: none; }
.sol-card.red { color: #d32f2f; }
.sol-corner { position: absolute; left: 6%; top: 3%; font-weight: 800; font-size: calc(var(--cw) * .3); line-height: 1; letter-spacing: -.04em; white-space: nowrap; }
.sol-corner.br { left: auto; top: auto; right: 6%; bottom: 3%; transform: rotate(180deg); display: none; }
.sol-mid { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); font-size: calc(var(--cw) * .55); line-height: 1; }
.sol-card.down { background: repeating-linear-gradient(45deg, #3b4fd6 0 6px, #3346c4 6px 12px); border: 3px solid #fff; cursor: default; }
.sol-card.down > span { visibility: hidden; }
.sol-card.lift { box-shadow: 0 12px 22px rgba(0, 0, 0, .35); }
.sol-card.hint { outline: 3px solid #ffd23f; outline-offset: 1px; animation: solhint .4s ease-in-out 3 alternate; }
@keyframes solhint { to { outline-color: #fff; } }
@media (min-width: 560px) { .sol-corner.br { display: block; } }
.sol-msg { margin: 0; color: var(--muted); font-weight: 700; font-size: .85rem; text-align: center; min-height: 1.3em; }
.sol-tools { width: 100%; max-width: 620px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sol-auto { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; box-shadow: var(--shadow); }
.bt.c-sol { --c: var(--g-sol); } .game-list li.c-sol { --c: var(--g-sol); }

/* ================= Snakes & Ladders ================= */
.sl-wrap { width: min(94vw, 500px, calc(100dvh - 300px)); min-width: 270px; }
.sl-board {
  position: relative; display: grid; grid-template-columns: repeat(10, 1fr); aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  border: 3px solid #8a5a33; box-shadow: var(--shadow); user-select: none; -webkit-user-select: none;
}
.sl-cell { display: flex; align-items: flex-start; justify-content: flex-start; padding: 2px 3px; font-size: clamp(.5rem, 2.2vw, .72rem); font-weight: 800; color: rgba(60, 40, 20, .55); background: #fbecc8; }
.sl-cell.alt { background: #f4d9a6; }
.sl-cell.goal { background: #ffd23f; color: #5a3a00; }
.sl-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sl-ladder line { stroke: #8a5a33; stroke-width: .07; stroke-linecap: round; }
.sl-snake { fill: none; stroke-width: .28; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.sl-belly { fill: none; stroke-width: .1; stroke-linecap: round; stroke-dasharray: .08 .14; opacity: .9; }
.sl-token {
  position: absolute; width: 6.2%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); z-index: 3;
  border: 2px solid #fff; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); transition: left .16s ease, top .16s ease, opacity .2s;
}
.sl-token.slide { transition: left .8s cubic-bezier(.5, 0, .5, 1), top .8s cubic-bezier(.5, 0, .5, 1); }
.sl-token.active { animation: sltok .7s ease-in-out infinite alternate; }
@keyframes sltok { to { box-shadow: 0 0 0 4px rgba(255, 255, 255, .8), 0 3px 6px rgba(0, 0, 0, .35); } }
.sl-bar { width: 100%; max-width: 500px; display: flex; align-items: center; gap: 12px; }
.sl-dice { font-size: 3.2rem; line-height: 1; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; box-shadow: var(--shadow); }
.sl-roll { flex: 1; min-height: 56px; font-size: 1.1rem; }
.sl-status { margin: 0; min-height: 1.5em; font-weight: 700; text-align: center; }
.sl-players { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; font-size: .88rem; color: var(--muted); }
.sl-players li { display: flex; align-items: center; gap: 6px; }
.sl-players li.on { color: var(--text); font-weight: 800; }
.sl-players i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.bt.c-snakes { --c: var(--g-snakes); } .game-list li.c-snakes { --c: var(--g-snakes); }
.bt.c-brick { --c: var(--g-brick); } .game-list li.c-brick { --c: var(--g-brick); }
.bt.c-penalty { --c: var(--g-penalty); } .game-list li.c-penalty { --c: var(--g-penalty); }
.sol-board { isolation: isolate; z-index: 0; }
.sol-tools { grid-template-columns: repeat(3, 1fr); }

/* ================= Ludo ================= */
:root { --g-ludo: #d6452f; --g-bubble: #7a4fd6; --g-fruit: #e2463c; --g-nono: #3d6fb6;
  --ld0: #e5484d; --ld1: #2fb36d; --ld2: #e6b800; --ld3: #3e7bfa; }
.ld-wrap { width: min(94vw, 500px, calc(100dvh - 300px)); min-width: 280px; }
.ld-board {
  position: relative; display: grid; grid-template-columns: repeat(15, 1fr); grid-template-rows: repeat(15, 1fr); aspect-ratio: 1;
  background: #fff; border: 3px solid #2b2f3a; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); user-select: none; -webkit-user-select: none;
}
.ld-cell { border: .5px solid rgba(0, 0, 0, .18); display: grid; place-items: center; font-size: clamp(.55rem, 2.6vw, .9rem); color: #9aa0ad; background: #fff; }
.ld-cell.s0 { background: var(--ld0); } .ld-cell.s1 { background: var(--ld1); } .ld-cell.s2 { background: var(--ld2); } .ld-cell.s3 { background: var(--ld3); }
.ld-base { position: relative; padding: 9%; }
.ld-base.s0 { background: var(--ld0); } .ld-base.s1 { background: var(--ld1); } .ld-base.s2 { background: var(--ld2); } .ld-base.s3 { background: var(--ld3); }
.ld-base-in { width: 100%; height: 100%; background: #fff; border-radius: 14%; display: grid; grid-template-columns: 1fr 1fr; place-items: center; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .15); }
.ld-base-in span { width: 46%; aspect-ratio: 1; border-radius: 50%; background: rgba(0, 0, 0, .08); }
.ld-centre { background: conic-gradient(from 45deg, var(--ld1) 0 25%, var(--ld2) 0 50%, var(--ld3) 0 75%, var(--ld0) 0 100%); }
.ld-token {
  position: absolute; width: 5.4%; aspect-ratio: 1; transform: translate(-50%, -50%); z-index: 3; border-radius: 50%; padding: 0; cursor: default;
  border: 2px solid #fff; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tc) 55%, #fff), var(--tc) 60%, color-mix(in srgb, var(--tc) 70%, #000));
  box-shadow: 0 3px 5px rgba(0, 0, 0, .4); transition: left .14s ease, top .14s ease, width .2s;
}
.ld-token.small { width: 3.6%; }
.ld-token.done { width: 3.2%; }
.ld-token.moving { z-index: 6; }
.ld-token.pick { cursor: pointer; z-index: 5; animation: ldpick .5s ease-in-out infinite alternate; }
@keyframes ldpick { to { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--tc), 0 3px 5px rgba(0, 0, 0, .4); transform: translate(-50%, -62%); } }
.ld-bar { width: 100%; max-width: 500px; display: flex; align-items: center; gap: 12px; }
.ld-bar .sl-dice { border: 3px solid var(--tc, var(--line)); }
.ld-bar .sl-roll { background: var(--tc, var(--accent)); color: #fff; }
.bt.c-ludo { --c: var(--g-ludo); } .game-list li.c-ludo { --c: var(--g-ludo); }

/* ================= Nonogram ================= */
.ng-wrap { width: min(96vw, 520px); }
.ng-grid {
  --n: 5; --rc: 2; --cc: 2; --pc: #3d6fb6;
  display: grid; grid-template-columns: calc(var(--rc) * 1.25em + 8px) repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: calc(var(--cc) * 1.15em + 8px) repeat(var(--n), auto);
  font-size: clamp(.68rem, 3.2vw, .95rem); touch-action: none; user-select: none; -webkit-user-select: none;
  background: var(--surface); border-radius: 12px; padding: 6px; border: 1px solid var(--line);
}
.ng-grid:not(.big) { font-size: clamp(.9rem, 4.6vw, 1.3rem); }
.ng-cc { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 1px; padding-bottom: 4px; font-weight: 800; color: var(--text); line-height: 1.1; }
.ng-rc { display: flex; justify-content: flex-end; align-items: center; gap: .35em; padding-right: 6px; font-weight: 800; color: var(--text); }
.ng-cc.ok, .ng-rc.ok { color: var(--muted); opacity: .45; }
.ng-cell {
  aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--text) 18%, transparent); margin: -.5px; background: var(--surface);
  display: grid; place-items: center; cursor: pointer; position: relative;
}
.ng-cell.br5 { border-right: 2px solid color-mix(in srgb, var(--text) 55%, transparent); }
.ng-cell.bb5 { border-bottom: 2px solid color-mix(in srgb, var(--text) 55%, transparent); }
.ng-cell.on { background: var(--text); }
.ng-grid.solved .ng-cell.on { background: var(--pc); transition: background .4s ease; }
.ng-grid.solved .ng-cell.x::after { content: none; }
.ng-cell.x::after { content: "✕"; color: var(--muted); font-size: .9em; font-weight: 700; }
.ng-cell.hint { outline: 3px solid #ffd23f; outline-offset: -2px; z-index: 1; }
.ng-tool.on { background: #d64545; color: #fff; border-color: transparent; }
.ng-msg { min-height: 1.5em; margin: 0; font-weight: 800; text-align: center; color: var(--good); }
.bt.c-nono { --c: var(--g-nono); } .game-list li.c-nono { --c: var(--g-nono); }

/* ================= Bubble Shooter / Fruit Merge tiles ================= */
.bt.c-bubble { --c: var(--g-bubble); } .game-list li.c-bubble { --c: var(--g-bubble); }
.bt.c-fruit { --c: var(--g-fruit); } .game-list li.c-fruit { --c: var(--g-fruit); }
.fm-next { font-size: 1.4rem; line-height: 1; }

/* ================= Streak Cricket / Exam Escape / Desi Word ================= */
:root { --g-streak: #1f8a4c; --g-exam: #6a3fd1; --g-desi: #d9534f; }
.bt.c-streak { --c: var(--g-streak); } .game-list li.c-streak { --c: var(--g-streak); }
.bt.c-exam { --c: var(--g-exam); } .game-list li.c-exam { --c: var(--g-exam); }
.bt.c-desi { --c: var(--g-desi); } .game-list li.c-desi { --c: var(--g-desi); }
.stat.low b { color: var(--bad, #e5484d); }
.ee-hearts { color: #e5484d; letter-spacing: 1px; }
.ee-track { width: 100%; max-width: 420px; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.ee-bar { flex: 1; height: 10px; border-radius: 99px; background: color-mix(in srgb, var(--text) 12%, var(--surface)); overflow: hidden; }
.ee-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--g-exam), #ffb02e); transition: width .2s linear; }
.dd-clue { width: 100%; max-width: 520px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dd-theme { font-weight: 700; color: var(--muted); padding: 6px 12px; border-radius: 99px; border: 1px dashed color-mix(in srgb, var(--g-desi) 60%, var(--line)); }
.dd-theme b { color: var(--g-desi); }
.dd-clue .btn[hidden] { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dd-theme b { color: #ff8a80; } }
:root[data-theme="dark"] .dd-theme b { color: #ff8a80; }
.sc-wk { font-size: .8em; letter-spacing: -1px; }

/* ================= Kids corner: shared kit ================= */
:root { --g-pattern: #2b8fd6; --g-odd: #d6457a; --g-psudoku: #7a55d6; --g-maze: #3f9142; --g-shapefit: #e0812a; --g-kids: #c9732c; }
.bt.c-pattern, .game-list li.c-pattern, .kid-card.c-pattern { --c: var(--g-pattern); }
.bt.c-odd, .game-list li.c-odd, .kid-card.c-odd { --c: var(--g-odd); }
.bt.c-psudoku, .game-list li.c-psudoku, .kid-card.c-psudoku { --c: var(--g-psudoku); }
.bt.c-maze, .game-list li.c-maze, .kid-card.c-maze { --c: var(--g-maze); }
.bt.c-shapefit, .game-list li.c-shapefit, .kid-card.c-shapefit { --c: var(--g-shapefit); }
.bt.c-kids { --c: var(--g-kids); background: linear-gradient(135deg, #f3a43b, #c9732c 60%, #9b4f1f); }

.hdr-kids { text-decoration: none; font-weight: 800; font-size: .9rem; color: var(--text); padding: 7px 11px; border-radius: 999px; background: color-mix(in srgb, var(--g-kids) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--g-kids) 35%, var(--line)); white-space: nowrap; }
.hdr-kids:hover { background: color-mix(in srgb, var(--g-kids) 26%, var(--surface)); }
@media (max-width: 370px) { .hdr-kids { padding: 6px 8px; font-size: .82rem; } .site-header .wrap { gap: 8px; } }

.kk-bar { width: 100%; max-width: 520px; display: flex; align-items: center; gap: 8px; }
.kk-btn { flex: none; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.kk-btn:disabled { opacity: .35; cursor: default; }
.kk-btn[hidden] { display: none; }
.kk-prompt { flex: 1; min-width: 0; margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1.05rem; line-height: 1.25; padding: 8px 12px; border-radius: 14px; background: color-mix(in srgb, var(--g-kids) 12%, var(--surface)); }
.kk-prompt span { font-size: 1.5rem; }
.kk-msg { min-height: 2.6em; margin: 0; max-width: 520px; text-align: center; font-weight: 800; font-size: 1.02rem; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.kk-msg.good { color: var(--good); }
.kk-tools { justify-content: center; }
.kk-hint { font-size: 1.05rem; min-height: 48px; padding: 0 22px; }
.kk-hint.pulse { animation: kkpulse 1s ease-in-out infinite alternate; }
@keyframes kkpulse { to { box-shadow: 0 0 0 6px color-mix(in srgb, #ffd23f 55%, transparent); } }
.kk-svg { width: 100%; height: 100%; display: block; }

/* ---------- Pattern Train ---------- */
.pt-train { --per: 7; width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(var(--per), minmax(0, 62px)); justify-content: center; align-items: end; gap: 14px 5px; padding: 10px 4px 14px; }
.pt-engine { font-size: clamp(2rem, 10vw, 3rem); line-height: 1; transform: scaleX(-1); text-align: center; margin-bottom: 8px; }
.pt-car { position: relative; width: 100%; aspect-ratio: 1; border-radius: 12px; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; padding: 6px; margin-bottom: 8px; }
.pt-car::before, .pt-car::after { content: ""; position: absolute; bottom: -9px; width: 12px; height: 12px; border-radius: 50%; background: color-mix(in srgb, var(--text) 70%, transparent); }
.pt-car::before { left: 18%; } .pt-car::after { right: 18%; }
.pt-car.ask { border: 3px dashed #f5b800; font-size: 1.8rem; font-weight: 900; color: #c98a00; animation: ptask 1.1s ease-in-out infinite alternate; }
@keyframes ptask { to { transform: translateY(-4px); } }
.pt-car.grp0 { border-color: #3e7bfa; background: color-mix(in srgb, #3e7bfa 12%, var(--surface)); }
.pt-car.grp1 { border-color: #f76b15; background: color-mix(in srgb, #f76b15 12%, var(--surface)); }
.pt-item { width: 100%; height: 100%; display: grid; place-items: center; }
.pt-item.num { font-size: clamp(1.2rem, 6vw, 1.7rem); font-weight: 900; }
.pt-item.grow { font-size: .8rem; line-height: 1; word-break: break-all; text-align: center; align-content: center; }
.pt-item.grow.g1 { font-size: 1.6rem; } .pt-item.grow.g2 { font-size: 1.2rem; } .pt-item.grow.g3, .pt-item.grow.g4 { font-size: .95rem; }
.pt-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: 100%; max-width: 520px; }
.pt-opt { width: clamp(72px, 21vw, 92px); aspect-ratio: 1; padding: 10px; border-radius: 20px; border: 3px solid var(--line); background: var(--surface); cursor: pointer; box-shadow: var(--shadow); touch-action: manipulation; color: var(--text); }
.pt-opt:active { transform: scale(.95); }
.pt-opt .pt-item.num { font-size: 1.9rem; }
.pt-opt .pt-item.grow { font-size: 1rem; }
.pt-opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 15%, var(--surface)); }
.pt-opt.glow { border-color: #f5b800; box-shadow: 0 0 0 5px color-mix(in srgb, #f5b800 45%, transparent); }

/* ---------- Odd One Out ---------- */
.oo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: min(88vw, 400px, calc(100dvh - 380px)); min-width: 240px; }
.oo-grid.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(92vw, 460px); }
.oo-card { aspect-ratio: 1; border-radius: 22px; border: 3px solid var(--line); background: var(--surface); cursor: pointer; padding: 12%; box-shadow: var(--shadow); touch-action: manipulation; color: var(--text); transition: opacity .3s, transform .15s; }
.oo-card:active { transform: scale(.96); }
.oo-in { width: 100%; height: 100%; display: grid; place-items: center; }
.oo-in.emo { font-size: clamp(2.6rem, 14vw, 4rem); line-height: 1; }
.oo-grid.n6 .oo-in.emo { font-size: clamp(2rem, 10vw, 3rem); }
.oo-in.cnt { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 2px; font-size: clamp(1.1rem, 6vw, 1.7rem); line-height: 1.1; }
.oo-grid.n6 .oo-in.cnt { font-size: clamp(.9rem, 4.4vw, 1.3rem); }
.oo-card.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.oo-card.dim, .oo-grid.solved .oo-card:not(.right) { opacity: .35; }

/* ---------- Picture Sudoku ---------- */
.ps-grid { --n: 4; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); width: min(88vw, 380px, calc(100dvh - 450px)); min-width: 220px; border: 3px solid var(--text); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ps-grid.n6 { --n: 6; width: min(94vw, 440px, calc(100dvh - 455px)); min-width: 250px; }
.ps-cell { aspect-ratio: 1; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); font-size: clamp(1.4rem, 9vw, 2.6rem); line-height: 1; padding: 0; cursor: pointer; color: var(--text); touch-action: manipulation; font-family: inherit; }
.ps-grid.n6 .ps-cell { font-size: clamp(1.05rem, 6.2vw, 1.9rem); }
.ps-cell.num { font-weight: 900; }
.ps-cell.br { border-right: 3px solid var(--text); }
.ps-cell.bb { border-bottom: 3px solid var(--text); }
.ps-cell.given { background: color-mix(in srgb, var(--text) 7%, var(--surface)); cursor: default; }
.ps-cell.peer { background: color-mix(in srgb, #3e7bfa 10%, var(--surface)); }
.ps-cell.peer.given { background: color-mix(in srgb, #3e7bfa 16%, var(--surface)); }
.ps-cell.sel { background: color-mix(in srgb, #f5b800 35%, var(--surface)); box-shadow: inset 0 0 0 3px #f5b800; }
.ps-cell.clash { background: color-mix(in srgb, var(--bad) 30%, var(--surface)) !important; }
.ps-cell.hint { box-shadow: inset 0 0 0 4px var(--good); }
.ps-grid.done .ps-cell { background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.ps-pad { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; width: 100%; max-width: 440px; }
.ps-pick { width: clamp(56px, 19vw, 76px); aspect-ratio: 1; border-radius: 18px; border: 3px solid var(--line); background: var(--surface); font-size: clamp(1.8rem, 9vw, 2.4rem); line-height: 1; cursor: pointer; box-shadow: var(--shadow); color: var(--text); font-weight: 900; padding: 0; touch-action: manipulation; }
.ps-pad.n6 { gap: 6px; flex-wrap: nowrap; }
.ps-pad.n6 .ps-pick { width: min(60px, calc((100vw - 64px) / 6)); border-radius: 14px; font-size: clamp(1.3rem, 6.4vw, 2rem); }
.ps-pick:active { transform: scale(.94); }

/* ---------- Mouse Maze ---------- */
.mz-wrap { width: 100%; max-width: 520px; display: flex; justify-content: center; }
.mz-canvas { display: block; border-radius: 14px; touch-action: none; box-shadow: var(--shadow); border: 4px solid #2f6b2a; box-sizing: content-box; }

/* ---------- Shape Fit ---------- */
.sf-board { --cols: 4; --rows: 4; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 3px; width: min(84vw, calc(var(--cols) * 60px), calc((100dvh - 565px) * var(--cols) / var(--rows))); min-width: 170px; touch-action: none; }
.sf-cell { aspect-ratio: 1; border-radius: 6px; }
.sf-cell.in { background: color-mix(in srgb, var(--text) 16%, var(--surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 22%, transparent); }
.sf-cell.full { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .35); cursor: pointer; }
.sf-cell.ghost { outline-offset: -4px; }
.sf-board.done .sf-cell.full { animation: sfdone .5s ease; }
@keyframes sfdone { 50% { transform: scale(1.08); } }
.sf-tray { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 18px; width: 100%; max-width: 520px; min-height: 80px; padding: 10px; border-radius: 18px; border: 2px dashed var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
.sf-tray.empty { border-color: transparent; min-height: 20px; }
.sf-piece { position: relative; cursor: grab; flex: none; }
.sf-piece i { position: absolute; border-radius: 5px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .35); outline: 1.5px solid rgba(255, 255, 255, .55); outline-offset: -1.5px; }
.sf-piece.turn::after { content: "↻"; position: absolute; right: -14px; top: -14px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font-size: .85rem; display: grid; place-items: center; color: var(--muted); }
.sf-piece.lifted { opacity: .25; }
.sf-float { position: fixed; z-index: 60; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .25)); }

/* ---------- labels on game pages ---------- */
.kid-note { margin: 0 0 4px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--g-kids) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--g-kids) 30%, var(--line)); font-size: .95rem; }
.kid-note span { font-weight: 800; margin-right: 4px; }

/* ================= Kids corner page ================= */
.kids-hero { padding-top: 18px; }
.kids-hero h1 { margin: 0 0 6px; font-size: clamp(1.7rem, 7vw, 2.4rem); }
.kids-hero .lead { margin: 0 0 12px; font-size: 1.05rem; }
.kids-promise { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.kids-promise li { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: .9rem; }
.kid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 8px; }
.kid-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s; }
.kid-card:hover { transform: translateY(-2px); }
.kid-card[hidden], .game-list li[hidden] { display: none; }
.kc-icon { flex: none; width: 76px; height: 76px; border-radius: 20px; background: var(--c, var(--accent)); display: grid; place-items: center; }
.kc-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kc-text b { font-size: 1.12rem; }
.kc-text > span { color: var(--muted); font-size: .92rem; }
.kc-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.kc-meta i { font-style: normal; font-size: .76rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--text)); }
.muted { color: var(--muted); }
.grownups { padding-top: 10px; }
.gu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.gu-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; min-width: 0; }
.gu-card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.gu-table-wrap { overflow-x: auto; }
.gu-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.gu-table th, .gu-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.gu-table thead th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.gu-skills { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; font-size: .93rem; }

@media (max-width: 400px) { .site-header .wrap.has-back .brand-name { display: none; } }

/* ================= Footer credit + Contact page ================= */
.site-footer .ideated b { color: var(--text); font-weight: 700; }
.contact-wrap { padding-top: 18px; padding-bottom: 28px; }
.contact-wrap h1 { margin: 0 0 6px; font-size: clamp(1.7rem, 7vw, 2.3rem); }
.contact-wrap .lead { margin: 0 0 18px; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-form, .contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.contact-form h2, .contact-card h2 { margin: 0 0 12px; font-size: 1.15rem; }
.contact-form label { display: block; font-weight: 700; font-size: .92rem; margin: 12px 0 6px; }
.contact-form input, .contact-form select, .contact-form textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; min-height: 46px;
}
.contact-form textarea { resize: vertical; min-height: 130px; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.contact-form [aria-invalid="true"] { border-color: var(--bad); }
.cf-send { width: 100%; margin-top: 16px; min-height: 50px; font-size: 1.02rem; }
.cf-error { margin: 12px 0 0; color: var(--bad); font-weight: 700; }
.cf-note { font-size: .85rem; margin: 10px 0 0; }
.cf-done { margin: 10px 0 0; font-weight: 700; color: var(--good); }
.contact-card dl { margin: 0 0 12px; display: grid; gap: 4px; }
.contact-card dt { font-weight: 800; margin-top: 8px; }
.contact-card dd { margin: 0; }

/* ================= SEO additions: breadcrumbs, category pages ================= */
.crumbs { font-size: .88rem; color: var(--muted); margin: 0 0 10px; }
.crumbs a { color: var(--muted); }
.crumbs span { color: var(--text); font-weight: 700; }
.cat-hero { padding-top: 18px; }
.cat-hero h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 6.5vw, 2.3rem); }
.cat-hero .lead { margin: 0 0 6px; max-width: 70ch; line-height: 1.55; }
.cat-links { flex-wrap: wrap; }
.cat-links a.cat-chip { text-decoration: none; color: var(--text); }
