/* games-web/kids.css — the shared shell for the KIDS ZONE (solo practice games).
   Deliberately NOT the dark casino skin: bright, high-contrast, huge touch targets,
   no coins, no chat, no timers that punish. Shared by every kids game. */

:root {
  --sky: #eaf4ff;
  --sky-2: #d7ebff;
  --ink: #1b2a44;
  --ink-soft: #5b6f92;
  --card: #ffffff;
  --mint: #2fbf9b;
  --grape: #7b5cf0;
  --sun: #ffb327;
  --coral: #ff6b6b;
  /* The kids zone is deliberately a LIGHT theme and uses none of the app's chrome
     tokens — it has its own sky/ink/card set above. It does need its own border colour
     back, though: palette.css owns --line for the dark app, and inheriting a dark border
     here would draw brown outlines on white cards. */
  --line: #cfe0f5;
  --shadow: 0 10px 0 rgba(27, 42, 68, 0.08), 0 18px 40px rgba(27, 42, 68, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(180deg, var(--sky), var(--sky-2));
  color: var(--ink);
  font-family: "Baloo 2", "Nunito Sans", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  padding-bottom: env(safe-area-inset-bottom);
}

.kwrap { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }

/* ---------- top bar ---------- */
.ktop { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ktitle { font-weight: 800; font-size: 20px; letter-spacing: -0.3px; }
.kspacer { flex: 1; }
.kchip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--card);
  border: 2px solid var(--line); border-radius: var(--r-pill, 999px); padding: 8px 14px;
  font-weight: 700; font-size: 14px; color: var(--ink-soft); cursor: pointer;
}
.kchip.sun { color: #8a5a00; border-color: #ffd88a; background: #fff5e0; }

/* ---------- cards ---------- */
.kcard {
  background: var(--card); border: 3px solid var(--line); border-radius: 26px;
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.kcard h2 { margin: 0 0 6px; font-size: 22px; }
.khint { color: var(--ink-soft); font-size: 15px; line-height: 1.55; margin: 0; }
.kbig { font-size: 26px; font-weight: 800; text-align: center; margin: 6px 0 2px; }
.kcenter { text-align: center; }

/* ---------- buttons: never smaller than a small thumb ---------- */
.kbtn {
  appearance: none; border: none; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
  min-height: 64px; padding: 16px 22px; border-radius: var(--r-4, 22px);
  font-family: inherit; font-weight: 800; font-size: 19px; color: #fff;
  background: var(--grape); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.16);
  transition: transform 0.08s ease, filter 0.15s ease;
  text-decoration: none;
}
.kbtn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.16); }
.kbtn.mint { background: var(--mint); }
.kbtn.sun { background: var(--sun); color: #4a3200; }
.kbtn.ghost { background: #fff; color: var(--ink-soft); border: 3px solid var(--line); box-shadow: none; }
.kbtn[disabled] { opacity: 0.5; pointer-events: none; }
.kbtn.wrong { animation: kshake 0.4s; }
.kbtn.wide { width: 100%; }
.krow { display: flex; gap: 12px; flex-wrap: wrap; }
.krow > .kbtn { flex: 1; min-width: 140px; }

/* ---------- the memory pad ---------- */
.kpad { display: grid; gap: 14px; margin: 8px auto 4px; max-width: 420px; }
.kpad.g2 { grid-template-columns: repeat(2, 1fr); }
.kpad.g3 { grid-template-columns: repeat(3, 1fr); }
.ktile {
  aspect-ratio: 1; border: none; cursor: pointer; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(34px, 12vw, 54px); background: #fff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.12), inset 0 0 0 4px rgba(255, 255, 255, 0.6);
  transition: transform 0.12s ease, filter 0.12s ease;
  filter: saturate(0.55) brightness(0.99);
}
.ktile:active { transform: scale(0.96); }
.ktile.lit { filter: none; transform: scale(1.06); box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.9), 0 10px 26px rgba(0, 0, 0, 0.18); }
.ktile.wrong { animation: kshake 0.4s; }
.ktile.locked { pointer-events: none; }
@keyframes kshake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* ---------- pattern row (Pattern Quest) ---------- */
.prow { display: flex; gap: 8px; justify-content: center; flex-wrap: nowrap; overflow-x: auto; margin: 14px 0 4px; }
.ptile {
  flex: 0 0 auto; border-radius: var(--r-2, 12px); background: #fff; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.ptile.gap { border-style: dashed; border-color: var(--grape); color: var(--grape); font-weight: 800; background: #f6f3ff; }

/* ---------- grid + program (Code the Path) ---------- */
.pgrid { display: grid; gap: 6px; margin: 12px auto 6px; }
.pcell {
  aspect-ratio: 1; border-radius: var(--r-2, 12px); background: #eef4ff; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.pcell.wall {
  background: repeating-linear-gradient(45deg, #c8d3e6, #c8d3e6 5px, #bcc9de 5px, #bcc9de 10px);
  border-color: #a9b8d1;
}
.pcell.goal { background: #fff6df; border-color: var(--sun); }
.pprog {
  min-height: 44px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center;
  background: #f6f9ff; border: 2px dashed var(--line); border-radius: var(--r-2, 12px); padding: 8px; margin: 10px 0 4px;
}
.pprog span { font-size: 22px; }
.pprog em { font-style: normal; color: var(--ink-soft); font-size: 12px; }
.parrows { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- companion + sticker book ---------- */
.kpal {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  background: #fff; border: 2px solid var(--line); border-radius: var(--r-pill, 999px);
  padding: 8px 14px; font-size: 14px; color: var(--ink-soft); font-weight: 600;
}
.kpal > span { font-size: 24px; line-height: 1; }
.kpal em { font-style: normal; color: var(--mint); font-size: 12px; }
.kpals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.kpalpick {
  appearance: none; cursor: pointer; font-family: inherit; background: #fff;
  border: 3px solid var(--line); border-radius: var(--r-4, 22px); padding: 14px 6px; min-height: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.kpalpick:active { transform: scale(0.97); }
.kpalpick span { font-size: 34px; line-height: 1; }
.kpalpick b { font-size: 13px; color: var(--ink); }

.kshelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-top: 10px; }
.ksticker {
  text-align: center; border: 2px dashed var(--line); border-radius: var(--r-3, 16px); padding: 10px 6px;
  display: flex; flex-direction: column; gap: 4px; min-height: 84px; justify-content: center;
}
.ksticker span { font-size: 26px; line-height: 1; filter: grayscale(1); opacity: 0.35; }
.ksticker b { font-size: 11px; font-weight: 600; color: var(--ink-soft); line-height: 1.3; }
.ksticker.got { border-style: solid; border-color: var(--mint); background: #effbf7; }
.ksticker.got span { filter: none; opacity: 1; }
.ksticker.got b { color: var(--ink); font-weight: 800; }

.kdone {
  margin: 14px 0 0; padding: 12px; border-radius: var(--r-3, 16px); background: #eef4ff;
  border: 2px solid var(--line); color: var(--ink-soft); font-size: 14px; font-weight: 600;
}

/* ---------- difficulty picker ----------
   Three cards, never more: choice overload is real at this age, and a locked card
   shows what earns it rather than just refusing. */
.kmodes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.kmode {
  appearance: none; cursor: pointer; text-align: center; font-family: inherit;
  border: 3px solid var(--line); border-radius: var(--r-3, 16px); background: #fff; padding: 12px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 108px;
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
}
.kmode:active { transform: scale(0.97); }
.kmode .mi { font-size: 26px; line-height: 1.1; }
.kmode .mn { font-weight: 800; font-size: 14px; color: var(--ink); position: relative; }
.kmode .mb { font-size: 11px; color: var(--ink-soft); line-height: 1.35; }
.kmode.on { border-color: var(--mint); background: #effbf7; }
.kmode.locked { opacity: 0.72; background: #f6f8fc; cursor: default; }
.kmode .fit {
  display: block; font-style: normal; font-size: 11px; font-weight: 700; color: #1f7a5c;
  background: #d8f0e8; border-radius: var(--r-pill, 999px); padding: 1px 7px; margin-top: 3px;
}

/* ---------- memory cards (Match Up) ---------- */
.kmgrid { display: grid; gap: 10px; margin: 10px auto 4px; max-width: 460px; }
.kmc {
  aspect-ratio: 1; border: none; cursor: pointer; border-radius: var(--r-3, 16px); padding: 0;
  position: relative; background: transparent; perspective: 700px; min-height: 48px;
}
.kmc i {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-3, 16px); backface-visibility: hidden; font-style: normal;
  transition: transform 0.32s cubic-bezier(0.3, 0.9, 0.4, 1);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.12);
}
.kmc .back { background: linear-gradient(160deg, #7b5cf0, #5b3fd6); color: #fff; font-size: 60%; }
.kmc .face { background: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.1), inset 0 0 0 3px var(--line); transform: rotateY(180deg); }
.kmc.up .back, .kmc.done .back { transform: rotateY(180deg); }
.kmc.up .face, .kmc.done .face { transform: rotateY(360deg); }
.kmc.done { pointer-events: none; }
.kmc.done .face { background: #e7fbf4; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.06), inset 0 0 0 3px var(--mint); animation: kpop 0.35s both; }
.kmc.miss .face { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.1), inset 0 0 0 3px var(--coral); }
.kmc:active { transform: scale(0.97); }

/* ---------- sequence dots (how many are left to tap) ---------- */
.kdots { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; flex-wrap: wrap; }
.kdot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.kdot.on { background: var(--mint); }

/* ---------- stars + progress ---------- */
.kstars { font-size: 44px; letter-spacing: 4px; text-align: center; animation: kpop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
@keyframes kpop { from { transform: scale(0.3); opacity: 0; } }
.kbar { height: 18px; border-radius: var(--r-pill, 999px); background: var(--line); overflow: hidden; margin-top: 10px; }
.kbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--grape)); transition: width 0.4s ease; }
.kstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.kstat { background: #f4f9ff; border: 2px solid var(--line); border-radius: var(--r-3, 16px); padding: 12px 6px; text-align: center; }
.kstat b { display: block; font-size: 24px; }
.kstat span { color: var(--ink-soft); font-size: 12px; }

/* ---------- modal (parent gate) ---------- */
.kmodal {
  position: fixed; inset: 0; background: rgba(27, 42, 68, 0.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.kmodal .kcard { max-width: 380px; width: 100%; margin: 0; }
.kmodal input {
  width: 100%; font-family: inherit; font-size: 24px; font-weight: 800; text-align: center;
  padding: 14px; border-radius: var(--r-3, 16px); border: 3px solid var(--line); margin: 10px 0;
}

.ktoast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--r-3, 16px);
  font-weight: 700; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 60;
}
.ktoast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.koffline { color: var(--ink-soft); font-size: 13px; text-align: center; margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
