/* Naki Kids Arcade — a bright, calm, uncluttered skin.
   Rules this stylesheet keeps to, from the research in the grown-ups section:
   - every tap target is at least 64px, most are much bigger
   - body text is 18px or larger, and lines stay short
   - one job on screen at a time, generous space between choices
   - nothing flashes, nothing counts down, nothing nags */

:root{
  --paper:#fdf6e9;
  --ink:#182b36;
  --ink-soft:#4a6272;
  --line:#e2d3bb;
  --card:#ffffff;
  --navy:#0b2a40;
  --orange:#e07b1a;
  --teal:#0d8f92;
  --berry:#c3255a;
  --sun:#f7c132;
  --leaf:#3f9a54;
  --shadow:0 4px 0 #0000001a;
}

*{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;background:var(--paper);color:var(--ink);
  font:19px/1.5 system-ui,-apple-system,"Segoe UI",Arial,sans-serif;
  min-height:100dvh;overscroll-behavior-y:none;
  -webkit-tap-highlight-color:transparent;
}
body.playing{-webkit-user-select:none;user-select:none}

.wrap{
  max-width:560px;margin:0 auto;
  padding:calc(14px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- header ---------- */
.kids-exit{display:flex;align-items:center;min-height:48px;margin:0 0 14px;padding:10px 16px;border:2px solid var(--navy);border-radius:14px;background:var(--navy);color:#fff;font-weight:800;text-decoration:none}
.kids-exit:focus-visible{outline:4px solid var(--teal);outline-offset:3px}
.kid-head{display:flex;align-items:center;gap:12px;margin-bottom:18px}
.kid-head img{width:48px;height:48px;border-radius:26%;flex:0 0 auto}
.kid-head h1{margin:0;font-size:1.4rem;line-height:1.1;letter-spacing:-.01em}
.kid-head .eyebrow{
  display:block;font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;
  color:var(--orange);font-weight:800;margin-bottom:2px;
}
.kid-head .spacer{flex:1}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border:0;border-radius:16px;cursor:pointer;font-family:inherit;font-weight:800;
  font-size:1.05rem;padding:16px 22px;min-height:64px;
  background:var(--orange);color:#fff;box-shadow:var(--shadow);
  text-decoration:none;text-align:center;
}
.btn:active{transform:translateY(2px);box-shadow:0 2px 0 #0000001a}
.btn.teal{background:var(--teal)}
.btn.navy{background:var(--navy)}
.btn.ghost{background:transparent;color:var(--ink-soft);border:2px solid var(--line);box-shadow:none}
.btn.wide+.btn.wide{margin-top:12px}
.btn.wide{width:100%}
.btn:focus-visible{outline:4px solid #0d8f92;outline-offset:3px}
.btn[disabled]{opacity:.5;cursor:default}

.backbtn{
  width:56px;height:56px;border-radius:50%;border:2px solid var(--line);
  background:var(--card);color:var(--ink);font-size:1.5rem;cursor:pointer;
  display:grid;place-items:center;flex:0 0 auto;
}

/* ---------- home tiles ---------- */
.tiles{display:grid;gap:16px;margin:0 0 26px}
.tile{
  display:grid;grid-template-columns:78px minmax(0,1fr);gap:16px;align-items:center;
  width:100%;text-align:left;border:3px solid var(--line);border-radius:22px;
  background:var(--card);padding:16px;cursor:pointer;font-family:inherit;color:inherit;
  box-shadow:0 5px 0 #0000000f;
}
.tile:active{transform:translateY(2px);box-shadow:0 3px 0 #0000000f}
.tile:focus-visible{outline:4px solid var(--teal);outline-offset:3px}
.tile .badge{
  width:78px;height:78px;border-radius:20px;display:grid;place-items:center;
  font-size:2.4rem;background:var(--sun);
}
.tile.t2 .badge{background:#ffd9a0}
.tile.t3 .badge{background:#bfe8d3}
.tile.t4 .badge{background:#d5edb8}
.tile.t5 .badge{background:#e6d6f7}
.tile b{display:block;font-size:1.2rem;line-height:1.2;margin-bottom:3px}
.tile .learns{
  display:block;font-size:.78rem;letter-spacing:.09em;text-transform:uppercase;
  font-weight:800;color:var(--teal);margin-bottom:5px;
}
.tile span.desc{display:block;font-size:.96rem;color:var(--ink-soft);line-height:1.4}

.hello{
  background:var(--navy);color:#fff8e9;border-radius:22px;padding:20px;margin-bottom:22px;
}
.hello h2{margin:0 0 8px;font-size:1.25rem;line-height:1.2}
.hello p{margin:0;font-size:1rem;color:#c8dbe4;line-height:1.45}

/* ---------- screens ---------- */
.screen[hidden]{display:none!important}

.stage{
  background:var(--card);border:3px solid var(--line);border-radius:24px;
  padding:20px;margin-bottom:18px;
}
.stage h2{margin:0 0 10px;font-size:1.25rem;line-height:1.25}
.scene-text{font-size:1.15rem;line-height:1.5;margin:0 0 6px}
.ask{
  font-weight:800;font-size:1.05rem;margin:20px 0 12px;color:var(--navy);
}

.choices{display:grid;gap:12px}
.choice{
  width:100%;min-height:68px;padding:16px 18px;border-radius:18px;
  border:3px solid var(--line);background:var(--card);color:var(--ink);
  font:inherit;font-weight:700;font-size:1.05rem;text-align:left;cursor:pointer;
  line-height:1.35;
}
.choice:active{transform:translateY(2px)}
.choice:focus-visible{outline:4px solid var(--teal);outline-offset:2px}
.choice.picked-good{border-color:var(--leaf);background:#eaf7ee}
.choice.picked-close{border-color:var(--sun);background:#fff8e0}
.choice.picked-off{border-color:#c9b9a3;background:#f4ede1}
.choice.dim{opacity:.45}

.feedback{
  margin-top:16px;border-radius:18px;padding:16px 18px;font-size:1.02rem;line-height:1.5;
  background:#eef6f6;border-left:8px solid var(--teal);
}
.feedback.good{background:#eaf7ee;border-left-color:var(--leaf)}
.feedback.close{background:#fff8e0;border-left-color:var(--sun)}
.feedback b{display:block;margin-bottom:4px}

.progress{
  display:flex;gap:7px;align-items:center;justify-content:center;
  margin:0 0 16px;
}
.progress i{
  width:14px;height:14px;border-radius:50%;background:var(--line);display:block;
}
.progress i.done{background:var(--teal)}
.progress i.now{background:var(--orange);transform:scale(1.35)}

/* ---------- the washing machine ---------- */
.machine{
  width:100%;max-width:300px;margin:0 auto 18px;display:block;
}
.machine .drum{transform-origin:150px 150px}
.wobble-0 .machine-body{transform:none}
@media (prefers-reduced-motion:no-preference){
  .wobble-1 .machine-body{animation:wob .55s ease-in-out infinite}
  .wobble-2 .machine-body{animation:wob .34s ease-in-out infinite}
  .wobble-3 .machine-body{animation:wob .18s ease-in-out infinite}
  @keyframes wob{25%{transform:translateX(-3px) rotate(-.7deg)}75%{transform:translateX(3px) rotate(.7deg)}}
  .machine .drum{animation:spin 2.4s linear infinite}
  .wobble-3 .machine .drum{animation-duration:.7s}
  .wobble-2 .machine .drum{animation-duration:1.2s}
  .settled .machine .drum{animation-duration:9s}
  @keyframes spin{to{transform:rotate(360deg)}}
}

/* ---------- breathing ---------- */
.breathe-wrap{text-align:center;padding:6px 0 4px}
.breathe-word{
  font-size:1.5rem;font-weight:800;margin:0 0 4px;color:var(--navy);min-height:1.8rem;
}
.breathe-sub{margin:0 0 16px;color:var(--ink-soft);font-size:1rem}
.bubble{
  width:170px;height:170px;margin:0 auto 16px;border-radius:50%;
  background:radial-gradient(circle at 35% 32%,#9fe4e3,#0d8f92);
  display:grid;place-items:center;color:#fff;font-weight:800;font-size:1.6rem;
  transition:transform 1s linear;transform:scale(.55);
}
.bubble.big{transform:scale(1)}
@media (prefers-reduced-motion:reduce){.bubble{transition:none}}
.breath-dots{display:flex;gap:10px;justify-content:center;margin-bottom:4px}
.breath-dots i{width:16px;height:16px;border-radius:50%;background:var(--line)}
.breath-dots i.done{background:var(--teal)}

/* ---------- the round ---------- */
.person{
  width:100%;max-width:230px;margin:0 auto 14px;display:block;
}
.who{
  font-weight:800;font-size:1.1rem;color:var(--orange);
  text-transform:uppercase;letter-spacing:.06em;font-size:.85rem;margin:0 0 6px;
}
.truckbar{
  display:flex;align-items:center;gap:10px;margin-bottom:16px;
  background:var(--card);border:3px solid var(--line);border-radius:18px;padding:10px 14px;
}
.truckbar .load{flex:1;height:16px;border-radius:8px;background:var(--line);overflow:hidden}
.truckbar .load i{display:block;height:100%;background:var(--teal);width:0;transition:width .4s}
.truckbar small{font-weight:800;color:var(--ink-soft);font-size:.85rem}

/* ---------- the sorter ---------- */
.rulecard{
  background:var(--navy);color:#fff8e9;border-radius:20px;padding:14px 18px;
  text-align:center;margin-bottom:14px;
}
.rulecard .now{
  display:block;font-size:.72rem;letter-spacing:.16em;text-transform:uppercase;
  color:var(--sun);font-weight:800;margin-bottom:4px;
}
.rulecard b{font-size:1.25rem;line-height:1.2;display:block}
.rulecard.flash{animation:ruleflash .8s ease-out}
@keyframes ruleflash{0%{background:var(--berry)}100%{background:var(--navy)}}
@media (prefers-reduced-motion:reduce){.rulecard.flash{animation:none}}

#belt{
  width:100%;display:block;border-radius:20px;border:3px solid var(--line);
  background:#eef2f4;touch-action:manipulation;
}
.beltbar{display:flex;gap:12px;align-items:center;margin:12px 0 0}
.beltbar .pill{
  background:var(--card);border:3px solid var(--line);border-radius:14px;
  padding:8px 14px;font-weight:800;font-size:.95rem;
}
.beltbar .pill b{color:var(--teal)}
.beltbar .grow{flex:1}
.toast{
  margin-top:12px;border-radius:16px;padding:13px 16px;font-size:1rem;line-height:1.45;
  background:#eaf7ee;border-left:8px solid var(--leaf);min-height:52px;
}
.toast.warn{background:#fdeceb;border-left-color:var(--berry)}
.toast.info{background:#eef6f6;border-left-color:var(--teal)}

/* ---------- results ---------- */
.level-label{display:block}
select{width:100%;min-height:64px;padding:12px;border:3px solid var(--line);border-radius:14px;background:white;color:var(--ink);font:inherit}
.learn-progress{font-size:1rem;color:var(--ink-soft);margin:0}
.garden{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin:22px 0 12px}
.garden-cell{aspect-ratio:1;display:grid;place-items:center;background:#eff4e6;border:2px dashed #a7bb89;border-radius:12px;font-size:clamp(1.3rem,6vw,2.1rem);color:#55733a}
.garden-cell.planted{background:#e4f0cf;border-style:solid}
.garden-count{text-align:center;font-weight:800;margin:10px 0}
.garden-buttons{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
.garden-buttons .btn{padding:12px 6px;font-size:1rem}
.pattern-strip{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:24px 0}
.pattern-token{display:inline-grid;place-items:center;min-width:44px;min-height:54px;font-size:1.9rem;font-weight:800;border:2px solid var(--line);border-radius:12px;background:#fdf6e9;padding:4px}
.pattern-token.missing{border-style:dashed;color:var(--ink-soft)}
.pattern-choice{display:flex;align-items:center;gap:14px;text-transform:capitalize}
.pattern-choice .pattern-token{border:0;background:transparent;min-height:32px}
#sortPause{margin-top:14px}

.result{text-align:center}
.result .big{font-size:2.6rem;font-weight:800;margin:6px 0 0;color:var(--teal)}
.result h2{font-size:1.5rem;margin:0 0 6px}
.wordbank{
  display:flex;flex-wrap:wrap;gap:9px;justify-content:center;margin:16px 0 4px;
}
.wordbank span{
  background:var(--sun);border-radius:999px;padding:9px 16px;font-weight:800;font-size:1rem;
  color:#3b2c07;
}
.takeaway{
  background:var(--navy);color:#fff8e9;border-radius:20px;padding:18px;margin:18px 0;
  text-align:left;line-height:1.5;
}
.takeaway b{display:block;color:var(--sun);font-size:.75rem;letter-spacing:.14em;
  text-transform:uppercase;margin-bottom:6px}

/* ---------- grown-ups ---------- */
.grownups{
  border:3px dashed var(--line);border-radius:22px;padding:4px 18px;background:#fffdf7;
  margin-bottom:20px;
}
.grownups summary{
  cursor:pointer;font-weight:800;font-size:1.05rem;padding:16px 0;list-style:none;
  display:flex;align-items:center;gap:10px;min-height:56px;
}
.grownups summary::-webkit-details-marker{display:none}
.grownups summary::after{content:'▾';margin-left:auto;color:var(--ink-soft)}
.grownups[open] summary::after{content:'▴'}
.grownups h3{font-size:1.02rem;margin:18px 0 6px}
.grownups p,.grownups li{font-size:.96rem;line-height:1.5;color:var(--ink-soft)}
.grownups ul{padding-left:20px;margin:6px 0}

.footnote{
  text-align:center;color:var(--ink-soft);font-size:.88rem;line-height:1.5;margin:24px 0 0;
}
.footnote a{color:var(--teal)}

@media (max-width:360px){
  body{font-size:18px}
  .tile{grid-template-columns:62px minmax(0,1fr);gap:12px}
  .tile .badge{width:62px;height:62px;font-size:1.9rem}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
}

/* Learning collection: a roomy hub and compact, touch-friendly play surfaces. */
body:not(.playing) .wrap{max-width:960px}
.age-picker{display:flex;gap:8px;flex-wrap:wrap}
.age-picker button{min-height:48px;padding:8px 14px;border:2px solid var(--line);border-radius:999px;background:white;color:var(--ink);font:700 .95rem system-ui;cursor:pointer}
.age-picker button[aria-pressed=true]{background:var(--navy);border-color:var(--navy);color:white}
.age-note{font-size:.9rem;line-height:1.5;color:var(--ink-soft);margin:12px 0 20px}
.age-badge{display:inline-block;font-size:.8rem;font-weight:750;color:#655135;margin-top:10px;background:#f7efdf;padding:4px 9px;border-radius:8px}
.age-picker button:focus-visible,.parcel-choice:focus-visible,.beam-choice:focus-visible,.work-cell:focus-visible,.garden-cell:focus-visible,.backbtn:focus-visible{outline:3px solid var(--teal);outline-offset:3px}
.btn{background:#a94d0a}.btn.teal{background:#087477}
.garden-cell{padding:0;cursor:pointer;min-width:0;font-family:inherit}
.garden-cell:disabled{opacity:1;cursor:default}
.garden-cell.counted{background:#b9d89a;box-shadow:inset 0 0 0 3px #417635}
#discoverHelp{margin-top:16px}
#discoverChoices{grid-template-columns:repeat(2,minmax(0,1fr))}
.pattern-choice{padding:12px;gap:6px;justify-content:center;font-size:.95rem;flex-wrap:wrap}
.pattern-strip{gap:5px}.pattern-token{min-width:34px;min-height:44px;font-size:1.5rem}
.work-guide{font-size:1rem;color:var(--ink-soft)}
.work-status{text-align:center;font-size:.93rem;font-weight:750;color:var(--ink-soft);margin:12px 0}
.picnic-basket{display:flex;flex-wrap:wrap;justify-content:center;gap:5px;padding:14px;background:#e3efce;border:3px solid #aec983;border-radius:16px;min-height:76px;margin-top:18px;font-size:1.5rem}
.picnic-plates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.picnic-portion{display:grid;gap:8px;min-width:0}
.picnic-plate{display:flex;flex-direction:column;align-items:center;gap:8px;min-height:126px;padding:12px 8px;border:3px solid #9fcacb;border-radius:22px;background:#fffdf7;color:var(--ink);font:inherit;cursor:pointer}
.picnic-plate b{font-size:.95rem}.plate-fruit{display:flex;flex-wrap:wrap;justify-content:center;gap:3px;font-size:1.3rem;min-height:30px}.portion-count{font-size:.9rem;font-weight:800}
.picnic-portion .btn{padding:8px 4px;min-height:48px;font-size:.82rem}.picnic-plate:focus-visible{outline:4px solid var(--teal);outline-offset:2px}
.picnic-plate:disabled{cursor:default}.counting-choice{display:flex;gap:12px;align-items:center;min-height:56px;font-size:1rem;font-weight:700}.counting-choice input{width:24px;height:24px;flex-shrink:0}
#workControls{display:grid;gap:12px}
.work-tools{display:flex;gap:10px;margin-top:16px}.work-tools .btn{flex:1;padding:12px 8px;font-size:.95rem}
.work-grid{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:4px;max-width:340px;margin:18px auto 10px;padding:5px;border:3px solid #a8bcc1;border-radius:14px;background:#d8e5e5}
.work-cell{aspect-ratio:1;min-width:0;padding:0;border:1px solid #afc4c6;border-radius:7px;background:#fffaf0;color:#3c626c;font:800 1.35rem system-ui;display:grid;place-items:center}
button.work-cell{cursor:pointer}.work-cell.filled{color:white;border-color:transparent}.work-cell.wall{background:#213c4c;color:#9aadb6}.work-cell.robot{background:#ffe198;font-size:1.65rem}
.work-cell.hint-cell{outline:3px dashed #161d2b;outline-offset:-5px;background:#ffe198;color:#172d3c}
.parcel-choices{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.parcel-choice{display:flex;align-items:center;justify-content:center;gap:6px;min-height:72px;min-width:72px;border:3px solid var(--line);border-radius:12px;background:white;font:700 1rem system-ui;cursor:pointer;padding:8px}
.parcel-icon{width:44px;height:44px;overflow:visible}
.parcel-choice[aria-pressed=true]{border:3px dashed var(--navy);background:#fff0c9}.parcel-choice:disabled{opacity:.4}
.parcel-choices{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
.parcel-choice{min-width:0;min-height:68px;flex-direction:column;gap:2px;padding:5px;font-size:.8rem}
.parcel-icon{width:36px;height:36px}
body.playing .kids-exit{min-height:44px;margin-bottom:10px;padding:7px 14px}
body.playing .kid-head{margin-bottom:12px}
body.playing .kid-head img{width:40px;height:40px}
body.playing .backbtn{width:48px;height:48px}
#workGame .stage{padding:16px}
#workGame .ask{margin:12px 0 8px}
#workGame .work-grid{max-width:280px;margin-top:12px}
#workGame .work-guide{font-size:.94rem;line-height:1.4}
#workGame .work-tools .btn,#workControls>.btn.ghost{min-height:48px}
.beam-choices{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}
.beam-choice{width:58px;min-height:58px;border:3px solid var(--line);border-radius:12px;background:#fff;font:800 1.25rem system-ui;color:var(--ink);cursor:pointer}
.beam-choice[aria-pressed=true]{background:var(--navy);border-color:var(--navy);color:white}
.bridge-scene{position:relative;min-height:156px;margin:18px 0;background:linear-gradient(90deg,#a9ce8c 0 8%,#b2e3ed 8% 92%,#a9ce8c 92%);border-radius:16px;overflow:hidden}
.bridge-span{display:flex;position:absolute;left:8%;right:8%;top:75px;gap:3px;min-height:30px;border-bottom:4px dashed #41727f}
.bridge-beam{min-width:0;min-height:44px;background:#9a4617;color:white;border:2px solid #763710;border-radius:5px;font:800 1.1rem system-ui;cursor:pointer;padding:2px}
.bridge-truck{position:absolute;top:28px;left:2%;font-size:2rem;transition:left 1.1s ease-in-out;transform:scaleX(-1)}
.crossed .bridge-truck{left:82%}.river-label{position:absolute;bottom:7px;left:40%;font:800 .7rem system-ui;letter-spacing:.12em;color:#326575}
.command-plan{display:flex;flex-wrap:wrap;gap:4px;padding:12px;border:2px dashed var(--line);border-radius:14px;min-height:58px;font-size:.9rem}
.command-token{min-width:27px;padding:3px 5px;text-align:center;border-radius:6px;background:#e3eeee;font-weight:800}.command-token.active{background:#f7c132;color:#172d3c}
.direction-buttons{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.direction-buttons .btn{padding:8px;font-size:1.4rem}
#sortStep{padding:20px;background:white;border:3px solid var(--line);border-radius:18px;margin-bottom:16px;text-align:center}
#sortStepItem img{display:block;width:88px;height:88px;object-fit:contain;margin:auto}
.sort-tags{font-size:.88rem;font-weight:650}
@media(min-width:720px){body:not(.playing) .tiles{grid-template-columns:repeat(2,minmax(0,1fr))}.tile{align-items:start}.hello{padding:28px}.hello h2{font-size:1.65rem}}
@media(max-width:360px){.stage{padding:14px}.work-grid{gap:3px;padding:4px}.parcel-choice{min-width:0;padding:4px}.tile{padding:12px}.pattern-choice{padding:10px 7px}}

/* ---- Owner-only play counts, top of the page ----
   Deliberately plain and grown-up next to the games: this is a report, not a
   toy, and nothing here should invite a child to tap it. Hidden entirely
   unless an owner session is signed in on this device. */
.owner-box{
  background:var(--card);border:1px solid var(--line);border-radius:14px;
  padding:14px 16px;margin:0 0 18px;font-size:15px;color:var(--ink);
  box-shadow:var(--shadow);
}
.owner-box>summary{font-weight:800;cursor:pointer;min-height:44px;align-content:center}
.owner-box h2{margin:0 0 6px;font-size:1.05rem}
.owner-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:10px 0}
.owner-row input,.owner-row select{
  flex:1 1 140px;min-width:0;min-height:44px;padding:8px 10px;font:inherit;
  border:1px solid var(--line);border-radius:9px;background:#fff;color:var(--ink);
}
.owner-row label{flex:0 0 auto;color:var(--ink-soft)}
.owner-btn{
  flex:0 0 auto;min-height:44px;padding:8px 14px;font:inherit;font-weight:700;
  border:0;border-radius:9px;background:var(--teal);color:#fff;cursor:pointer;
}
.owner-btn.ghost{background:transparent;color:var(--ink-soft);border:1px solid var(--line)}
.owner-btn[disabled]{opacity:.6}
.owner-note{margin:8px 0 0;font-size:13px;line-height:1.45;color:var(--ink-soft)}
.owner-body{margin-top:10px}
/* A narrow phone must scroll the table, never the whole page sideways. */
.owner-scroll{overflow-x:auto}
.owner-table{width:100%;border-collapse:collapse;margin:12px 0}
.owner-table caption{text-align:left;font-weight:700;padding:6px 0}
.owner-table th,.owner-table td{text-align:right;padding:9px 4px;border-bottom:1px solid var(--line)}
.owner-table th:first-child{text-align:left;font-weight:600}
