/* Shared by the kids' site and Baloney Detector (html[data-games]): colour tokens, type, and the case engine
   (assets/games/case.js). Bright and rounded: chunky buttons with a "pressable" edge. */
html[data-games]{
  --k-bg:#FFF8EE; --k-card:#FFFFFF; --k-ink:#1E2A3B; --k-ink-2:#4A5568; --k-line:rgba(30,42,59,.10);
  --k-orange:#FF7A2F; --k-orange-d:#D85E17; --k-orange-t:#FFE9D9;
  --k-blue:#2F86FF;   --k-blue-d:#1B66D1;   --k-blue-t:#DDEBFF;
  --k-green:#1FB57A;  --k-green-d:#148B5C;  --k-green-t:#D6F5E8;
  --k-purple:#8B5CF6; --k-purple-d:#6D3FD8; --k-purple-t:#EBE3FF;
  --k-pink:#FF4F8B;   --k-pink-d:#D93570;   --k-pink-t:#FFE0EC;
  --k-yellow:#FFC92E; --k-yellow-d:#E0A800; --k-yellow-t:#FFF3C7;
  --k-q:var(--k-orange); --k-q-d:var(--k-orange-d); --k-q-t:var(--k-orange-t);
  --k-display:'Fredoka','Atkinson Hyperlegible',system-ui,sans-serif;
  --k-font:'Atkinson Hyperlegible',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --k-r:22px;
  --bg:var(--k-bg); --surface:var(--k-card); --ink:var(--k-ink); --accent:var(--k-orange-d);
}
html[data-games][lang="fa"]{--k-display:'Vazirmatn',Tahoma,sans-serif;--k-font:'Vazirmatn',Tahoma,sans-serif}
html[data-games][data-theme="dark"]{
  --k-bg:#131A2A; --k-card:#1C2538; --k-ink:#F2F5FA; --k-ink-2:#B8C2D3; --k-line:rgba(255,255,255,.10);
  --k-orange-t:#3A2A22; --k-blue-t:#1D2C49; --k-green-t:#173A31; --k-purple-t:#2B2450; --k-pink-t:#3D2032; --k-yellow-t:#3A321A;
  --accent:#FFA060;
}
.kbar .kbrand svg{width:38px;height:38px;flex:none}
.kbar .kbrand b{font-family:var(--k-display);font-weight:600;font-size:1.25rem;color:var(--k-ink)}
.kbar .kbrand small{font-family:var(--k-font);letter-spacing:0;text-transform:none;font-size:.74rem;color:var(--k-ink-2)}
.kbar #theme .ico{display:inline-block;width:18px;height:18px;border-radius:50%;background:linear-gradient(90deg,currentColor 50%,transparent 50%);border:1.6px solid currentColor}
.kspacer{flex:1}

/* the guide's pages borrow the same pieces (scene decks): map the tokens onto the guide's own colours */
html:not([data-games]) .deck{--k-ink:var(--ink);--k-ink-2:var(--dim);--k-card:var(--surface);--k-line:var(--rule);--k-bg:var(--bg);
  --k-blue:#12788F;--k-blue-d:#0B6075;--k-green:#12788F;--k-green-d:#0B4E60;--k-orange:#B8651B;--k-orange-d:#8A4F00;--k-yellow:#F2B84B;--k-yellow-d:#C98B1F;
  --k-pink:#C2415F;--k-pink-d:#9D2F4A;--k-purple:#6D55C9;--k-purple-d:#4F3BA6;
  --k-yellow-t:var(--accent-wash);--k-green-t:var(--teal-wash);--k-orange-t:var(--accent-wash);--k-blue-t:var(--teal-wash);--k-pink-t:rgba(194,65,95,.1);--k-purple-t:rgba(109,85,201,.1);
  --k-display:var(--display);--k-font:var(--sans);--k-q:var(--accent)}
html[data-theme="dark"]:not([data-games]) .deck{--k-pink-t:rgba(255,145,135,.12);--k-green:#1B8CA6;--k-green-d:#0F5F73;--k-blue:#1B8CA6;--k-orange:#E0A04A}
/* ------------------------------------------------------------------ game cards (Baloney Detector home, kids' arcade) */
.c-pink{--c:var(--k-pink);--c-d:var(--k-pink-d);--c-t:var(--k-pink-t)}
.c-blue{--c:var(--k-blue);--c-d:var(--k-blue-d);--c-t:var(--k-blue-t)}
.c-yellow{--c:var(--k-yellow);--c-d:var(--k-yellow-d);--c-t:var(--k-yellow-t)}
.c-green{--c:var(--k-green);--c-d:var(--k-green-d);--c-t:var(--k-green-t)}
.c-purple{--c:var(--k-purple);--c-d:var(--k-purple-d);--c-t:var(--k-purple-t)}
.c-orange{--c:var(--k-orange);--c-d:var(--k-orange-d);--c-t:var(--k-orange-t)}

.ggrid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr));gap:20px}
.gcard > a,.gcard > div{position:relative;display:flex;flex-direction:column;gap:6px;height:100%;padding:18px 20px 22px;border-radius:26px;
  background:var(--c);color:#1E2A3B !important;text-decoration:none;box-shadow:0 7px 0 var(--c-d);transition:transform .15s ease,box-shadow .15s ease}
.gcard > a:hover{transform:translateY(-4px) rotate(-.6deg);box-shadow:0 11px 0 var(--c-d)}
.gcard > a:active{transform:translateY(3px);box-shadow:0 3px 0 var(--c-d)}
.gcard > a:focus-visible{outline:4px solid var(--k-ink);outline-offset:4px}
.gcard-art{display:block;background:rgba(255,255,255,.28);border-radius:18px;padding:10px;margin-bottom:6px}
.gcard-art svg{display:block;width:100%;height:auto;max-height:150px}
.gcard b{font-family:var(--k-display);font-weight:600;font-size:1.45rem;line-height:1.15}
html[lang="fa"] .gcard b{font-weight:800}
.gcard span{font-size:1rem;line-height:1.4}
.gcard small{font-size:.85rem;font-weight:700;opacity:.8}
.pgo{align-self:flex-start;margin-top:8px;font-style:normal;font-family:var(--k-display);font-weight:600;background:#1E2A3B;color:#fff;padding:6px 18px;border-radius:999px}
.pgo::after{content:" →"}
html[dir="rtl"] .pgo::after{content:" ←"}
.gcard.soon > div{background:var(--c-t);box-shadow:0 7px 0 var(--k-line);color:var(--k-ink) !important}
.gcard.soon .gcard-art{background:var(--k-card);opacity:.75}
.psoon{align-self:flex-start;margin-top:8px;font-style:normal;font-family:var(--k-display);font-weight:600;font-size:.85rem;border:2px dashed var(--k-ink-2);color:var(--k-ink-2);padding:3px 14px;border-radius:999px}
@media (prefers-reduced-motion:no-preference){
  .ggrid .gcard{animation:pin .45s cubic-bezier(.2,1.3,.4,1) both}
  .ggrid .gcard:nth-child(2){animation-delay:.05s}.ggrid .gcard:nth-child(3){animation-delay:.1s}
  .ggrid .gcard:nth-child(4){animation-delay:.15s}.ggrid .gcard:nth-child(5){animation-delay:.2s}.ggrid .gcard:nth-child(6){animation-delay:.25s}
}
@media (prefers-reduced-motion:reduce){.gcard > a:hover{transform:none}}
@keyframes pin{from{opacity:0;transform:translateY(18px) scale(.97)}to{opacity:1;transform:none}}

@media (max-width:600px){.gcard.soon .gcard-art svg{max-height:96px}}

/* ------------------------------------------------------------------ the case engine (assets/games/case.js) */
.cs{display:flex;flex-direction:column;gap:16px}
.cs-top{display:flex;gap:8px;flex-wrap:wrap;align-items:center;font-family:var(--k-display);font-weight:600;font-size:.88rem}
.cs-count{color:var(--k-ink-2)}
.cs-label{background:var(--k-yellow-t);color:var(--k-ink);padding:3px 12px;border-radius:999px}
.cs-headline{margin:0;padding:20px 22px;border-radius:20px;background:var(--k-card);border:3px solid var(--k-ink);box-shadow:6px 6px 0 var(--k-ink);
  font-family:var(--k-display);font-weight:600;font-size:clamp(1.3rem,4.4vw,1.85rem);line-height:1.22;color:var(--k-ink)}
html[lang="fa"] .cs-headline{font-weight:800;line-height:1.5}
.cs-ask{display:grid;gap:10px}
.cs-q{margin:0;font-family:var(--k-display);font-weight:600;font-size:1.1rem}
.cs-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:10px}
.cs-choice{font:inherit;text-align:start;cursor:pointer;padding:13px 16px;border-radius:16px;background:var(--k-card);color:var(--k-ink);border:3px solid var(--k-line);
  box-shadow:0 5px 0 var(--k-line);font-weight:600;font-size:1rem;line-height:1.3;display:flex;flex-direction:column;gap:4px;
  transition:transform .08s ease,box-shadow .08s ease,border-color .15s}
.cs-choice:hover:not(:disabled){border-color:var(--k-blue)}
.cs-choice:active:not(:disabled){transform:translateY(3px);box-shadow:0 2px 0 var(--k-line)}
.cs-choice:focus-visible,.cs-go:focus-visible,.sim-tog:focus-visible,.sim-run:focus-visible{outline:4px solid var(--k-yellow);outline-offset:3px}
.cs-choice.current{border-color:var(--k-blue);border-style:dashed}
.cs-tag{font-size:.75rem;font-weight:700;color:var(--k-blue-d)}
html[data-theme="dark"] .cs-tag{color:#8DBBFF}
.cs-choice:disabled{cursor:default}
.cs-ask.answered .cs-q{color:var(--k-ink-2);font-size:.95rem}
.cs-ask.answered .cs-choice:not(.picked){display:none}
.cs-choice.picked{background:var(--k-blue);border-color:var(--k-blue-d);box-shadow:0 5px 0 var(--k-blue-d);color:#fff;border-style:solid}
.cs-choice.picked .cs-tag{display:none}
.cs-clue{padding:18px 20px;border-radius:22px;background:var(--k-yellow-t)}
.cs-clue:focus,.cs-surprise:focus,.cs-end > :focus,.cs:focus{outline:none}
.cs-clue-k{margin:0 0 4px;font-family:var(--k-display);font-weight:600;font-size:.85rem;color:var(--k-orange-d);letter-spacing:.03em}
html[data-theme="dark"] .cs-clue-k{color:#FFA060}
.cs-clue h3{margin:0 0 6px;font-size:1.25rem}
.cs-clue p{margin:0 0 10px}
.cs-chart-cap{font-size:.85rem;color:var(--k-ink-2);margin:4px 0 6px !important}
.cs-bars{display:grid;gap:8px;margin-top:6px}
.cs-bar{display:grid;grid-template-columns:minmax(96px,38%) 1fr auto;gap:10px;align-items:center;font-size:.92rem;line-height:1.25}
.cs-bar-t{height:16px;border-radius:999px;background:var(--k-line);overflow:hidden}
.cs-bar-t i{display:block;height:100%;border-radius:999px;background:var(--k-ink-2)}
.cs-bar.hi .cs-bar-t i{background:var(--k-pink)}
.cs-bar.hi .cs-bar-l{font-weight:700}
.cs-bar-v{font-family:var(--k-display);font-weight:600;min-width:3ch;text-align:end}
.cs-strip{display:block;width:100%;height:auto;direction:ltr}
.cs-strip .axis{stroke:var(--k-ink-2);stroke-width:2}
.cs-strip .zero{stroke:var(--k-ink-2);stroke-width:2;stroke-dasharray:3 4}
.cs-strip .dot{fill:var(--k-ink-2);opacity:.45}
.cs-strip .hi{fill:var(--k-pink);stroke:var(--k-card);stroke-width:2}
.cs-strip .lab{font:600 15px var(--k-display);fill:var(--k-pink-d)}
.cs-strip .tick{font:13px var(--k-font);fill:var(--k-ink-2)}
.cs-end{display:flex;flex-direction:column;gap:16px}
.cs-surprise{padding:18px 20px;border-radius:22px;background:var(--k-purple-t)}
.cs-surprise .cs-clue-k{color:var(--k-purple-d)}
html[data-theme="dark"] .cs-surprise .cs-clue-k{color:#B9A2FF}
.cs-surprise > p{margin:0 0 8px}
.cs-after{font-weight:700;margin-top:12px !important}
.cs-ideas{display:grid;gap:12px;padding:18px 20px;border-radius:22px;background:var(--k-card);border:2px solid var(--k-line)}
.cs-ideas .cs-clue-k{color:var(--k-green-d);margin:0}
.cs-idea{display:grid;gap:2px;padding-inline-start:14px;border-inline-start:5px solid var(--k-green)}
.cs-idea b{font-family:var(--k-display);font-weight:600;font-size:1.08rem}
.cs-verdict{padding:18px 20px;border-radius:22px}
.cs-verdict.good{background:var(--k-green-t)}
.cs-verdict.catch{background:var(--k-orange-t)}
.cs-verdict > b{display:block;font-family:var(--k-display);font-weight:600;font-size:1.3rem}
.cs-verdict.good > b{color:var(--k-green-d)}
.cs-verdict.catch > b{color:var(--k-orange-d)}
html[data-theme="dark"] .cs-verdict.good > b{color:#6FE0AE}
html[data-theme="dark"] .cs-verdict.catch > b{color:#FFA060}
.cs-verdict p{margin:4px 0}
.cs-best{font-weight:700}
.cs-path{list-style:none;padding:0;margin:12px 0 0;display:flex;flex-wrap:wrap;gap:8px}
.cs-path li{display:flex;flex-direction:column;padding:8px 12px;border-radius:14px;background:var(--k-card);font-size:.9rem;line-height:1.25;font-weight:600}
.cs-path li small{color:var(--k-ink-2);font-size:.74rem;font-weight:700}
.cs-path li.moved{box-shadow:inset 0 0 0 3px var(--k-blue)}
.cs-sandbox{padding:18px 20px;border-radius:22px;background:var(--k-blue-t)}
.cs-sandbox .cs-clue-k{color:var(--k-blue-d)}
html[data-theme="dark"] .cs-sandbox .cs-clue-k{color:#8DBBFF}
.cs-sandbox > p{margin:0 0 6px}
.cs-nav{display:flex;justify-content:center}
.cs-go{display:inline-block;font:inherit;font-family:var(--k-display);font-weight:600;font-size:1.1rem;cursor:pointer;border:0;border-radius:999px;padding:12px 26px;
  background:var(--k-green);color:#fff !important;box-shadow:0 5px 0 var(--k-green-d);text-decoration:none;transition:transform .08s ease,box-shadow .08s ease}
.cs-go:active{transform:translateY(3px);box-shadow:0 2px 0 var(--k-green-d)}
.cs-go.alt{background:var(--k-blue);box-shadow:0 5px 0 var(--k-blue-d)}
.cs-done{width:100%;text-align:center;padding:22px;border-radius:24px;background:linear-gradient(135deg,var(--k-yellow-t),var(--k-green-t))}
.cs-done .kg-star{display:block;font-size:3.4rem;line-height:1;color:var(--k-yellow);text-shadow:0 4px 0 var(--k-yellow-d);margin-bottom:6px}
.cs-done p{font-family:var(--k-display);font-weight:500;font-size:1.15rem;margin:.3em 0}
.cs-done .cs-moral{font-weight:700}
.cs-row{display:flex;gap:12px;justify-content:center;flex-wrap:wrap;margin-top:14px}
@keyframes csin{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@keyframes cspop{0%{transform:scale(.6) rotate(-40deg);opacity:0}100%{transform:none;opacity:1}}
@media (prefers-reduced-motion:no-preference){
  .cs-clue,.cs-end > *,.cs-ask,.cs-headline{animation:csin .35s ease-out both}
  .cs-done .kg-star{animation:cspop .5s cubic-bezier(.2,1.5,.4,1) both}
}

/* ------------------------------------------------------------------ the sandbox (assets/games/sims/confounder.js) */
.sim{display:grid;gap:10px;margin-top:10px;padding:14px;border-radius:18px;background:var(--k-card)}
.sim-headline{margin:0;font-family:var(--k-display);font-weight:600;font-size:clamp(1.12rem,4vw,1.45rem);line-height:1.25;padding:10px 14px;border-radius:12px;
  border:3px solid var(--k-ink);box-shadow:4px 4px 0 var(--k-ink);background:var(--k-card)}
html[lang="fa"] .sim-headline{font-weight:800}
.sim-headline.same{border-color:var(--k-green-d);box-shadow:4px 4px 0 var(--k-green-d)}
.sim-sub{margin:0;font-size:.9rem;color:var(--k-ink-2)}
.sim-svg{display:block;width:100%;height:auto;direction:ltr}
.sim-svg .lane{fill:var(--k-bg)}
.sim-svg .lane-t{font:600 14px var(--k-display);fill:var(--k-ink)}
.sim-svg .pp{opacity:.85;transition:cx .9s cubic-bezier(.4,0,.2,1),cy .9s cubic-bezier(.4,0,.2,1),opacity .5s,fill .5s}
@media (prefers-reduced-motion:reduce){.sim-svg .pp{transition:none}}
.sim-svg .mean,.sim-svg .mean-t{transition:opacity .3s}
.sim-svg .g0,.sim-legend i.g0{fill:#8B5A2B;background:#8B5A2B}
.sim-svg .g1,.sim-legend i.g1{fill:var(--k-blue);background:var(--k-blue)}
.sim-svg .h0,.sim-legend i.h0{fill:#E25C5C;background:#E25C5C}
.sim-svg .h1,.sim-legend i.h1{fill:#F2B84B;background:#F2B84B}
.sim-svg .h2,.sim-legend i.h2{fill:var(--k-green);background:var(--k-green)}
html[data-theme="dark"] .sim-svg .g0,html[data-theme="dark"] .sim-legend i.g0{fill:#C8925A;background:#C8925A}
.sim-svg .mean{stroke:var(--k-ink);stroke-width:3}
.sim-svg .mean-t{font:700 13px var(--k-font);fill:var(--k-ink)}
.sim-svg .tick{font:13px var(--k-font);fill:var(--k-ink-2)}
.sim-legend{display:flex;flex-wrap:wrap;gap:6px 14px;margin:0;font-size:.88rem;align-items:center}
.sim-legend span{display:inline-flex;gap:6px;align-items:center}
.sim-legend i{width:12px;height:12px;border-radius:50%;display:inline-block}
.sim-ctls{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:10px;align-items:stretch}
.sim-tog{position:relative;font:inherit;font-weight:600;font-size:.95rem;line-height:1.3;text-align:start;cursor:pointer;min-height:52px;
  padding:10px 14px;padding-inline-start:46px;border-radius:14px;border:2px solid var(--k-line);background:var(--k-bg);color:var(--k-ink)}
.sim-tog::before{content:"";position:absolute;inset-inline-start:12px;top:50%;width:24px;height:24px;margin-top:-12px;border-radius:8px;
  border:2px solid var(--k-ink-2);background:var(--k-card);display:grid;place-items:center;color:#fff;font-size:15px;font-weight:800;line-height:1}
.sim-tog[aria-pressed="true"]{border-color:var(--k-green);background:var(--k-green-t)}
.sim-tog[aria-pressed="true"]::before{content:"✓";background:var(--k-green);border-color:var(--k-green-d)}
.sim-ctl{display:grid;grid-template-columns:1fr auto;gap:2px 10px;padding:8px 12px;border-radius:14px;background:var(--k-bg);font-size:.92rem;font-weight:600;line-height:1.3}
.sim-ctl input{grid-column:1/-1;width:100%;accent-color:var(--k-blue);margin:6px 0 2px}
.sim-ctl output{font-family:var(--k-display);color:var(--k-blue-d)}
html[data-theme="dark"] .sim-ctl output{color:#8DBBFF}
.sim-ctl.off{opacity:.45}
.sim-run{font:inherit;font-family:var(--k-display);font-weight:600;cursor:pointer;border:0;border-radius:999px;padding:10px 20px;background:var(--k-orange);color:#fff;
  box-shadow:0 4px 0 var(--k-orange-d);justify-self:start;align-self:center}
.sim-run:active{transform:translateY(3px);box-shadow:0 1px 0 var(--k-orange-d)}
@media print{.kgame{display:none !important}}

/* ------------------------------------------------------------------ the headline as a newspaper clipping, with its picture */
.cs-clip{position:relative;padding:14px 14px 4px;border-radius:6px 20px 8px 18px;background:#FFFDF6;color:#1E2A3B;
  box-shadow:0 2px 0 rgba(0,0,0,.06),6px 8px 0 var(--k-ink);border:2px solid var(--k-ink);transform:rotate(-.6deg)}
html[dir="rtl"] .cs-clip{transform:rotate(.6deg)}
html[data-theme="dark"] .cs-clip{background:#F4EEDD;box-shadow:6px 8px 0 #000}
.cs-mast{margin:0 0 10px;padding-bottom:6px;border-bottom:3px double #1E2A3B;font-family:'Cormorant Garamond',Georgia,serif;font-weight:700;
  font-size:1.15rem;letter-spacing:.04em;text-align:center;color:#1E2A3B}
html[lang="fa"] .cs-mast{font-family:'Vazirmatn',serif;letter-spacing:0;font-weight:800}
.cs-pic{margin:0 0 8px;border-radius:6px;overflow:hidden;border:2px solid #1E2A3B}
.cs-pic img{display:block;width:100%;height:auto;aspect-ratio:3/2;object-fit:cover}
@media (max-width:600px){.cs-pic img{aspect-ratio:2/1}.cs-clip{padding:10px 10px 2px}.cs-mast{margin-bottom:6px;font-size:1rem}}
.cs-clip .cs-headline{padding:6px 6px 12px;border:0;box-shadow:none;background:none;border-radius:0;color:#1E2A3B}
/* the guide reacts in the verdict */
.cs-verdict{position:relative}
.cs-mascot{float:inline-end;width:96px;height:96px;margin:-30px 0 6px 12px;border-radius:50%;object-fit:cover;border:4px solid #fff;
  box-shadow:0 5px 0 rgba(0,0,0,.12);background:#FFF3DF}
html[dir="rtl"] .cs-mascot{margin:-30px 12px 6px 0}
@media (prefers-reduced-motion:no-preference){.cs-mascot{animation:cspop .5s cubic-bezier(.2,1.5,.4,1) both}}
/* confetti at the end */
.cs-done{position:relative;overflow:hidden}
.cs-confetti{position:absolute;inset:0;pointer-events:none}
.cs-confetti i{position:absolute;top:-12px;width:9px;height:14px;border-radius:2px;animation:csfall linear forwards}
@keyframes csfall{to{transform:translate(var(--x),340px) rotate(var(--r));opacity:0}}
.gcard-art.pic img{transition:transform .5s ease}
@media (prefers-reduced-motion:no-preference){.gcard > a:hover .gcard-art.pic img{transform:scale(1.06) rotate(-.6deg)}}

/* paged cases: one step at a time, with a drawn stage that follows the story */
.cs.paged .past{display:none}
.cs-clip.compact .cs-pic,.cs-clip.compact .cs-mast{display:none}
.cs-clip.compact{transform:none;box-shadow:3px 4px 0 var(--k-ink)}
.cs-clip.compact .cs-headline{font-size:1.05rem;padding-bottom:6px}
.cs-stage{aspect-ratio:16/8 !important}
@media (max-width:640px){.cs-stage{aspect-ratio:16/10 !important}}
.cs.paged .cs-end .cs-nav{margin-top:6px}
