/* kids_shared.css — the few controls every Kids Corner page shares, so they
   look and sit the same everywhere:

     🏠  Kids Corner   — the round button at the top right of a game's home
                         screen (the hub is home, so it has only the gear)
     ⚙   Settings      — the same round button, to the right of 🏠
     ⬅️  Back          — the honey pill to the left of them, inside a game,
                         back to that game's own home screen

   Load it in <head> before the page's own <style>. Colours use the page's
   tokens (--line, --card, --ink-soft or --muted, --honey-soft, --ink) and
   fall back to Kids Corner's palette where a page lacks one. */
.hero-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--line, #d9dfd0); background: var(--card, #ffffff);
  color: var(--ink-soft, var(--muted, #7d887a));
  font-family: inherit; font-size: 22px; font-weight: 700; line-height: 1;
  display: grid; place-items: center; text-decoration: none; cursor: pointer; padding: 0;
  box-shadow: 0 3px 10px rgba(70, 60, 110, 0.10);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.back {
  width: 64px; border-radius: 24px;
  background: var(--honey-soft, #fbeec7); border-color: #ecd9a0; color: var(--ink, #3f4d3b);
}

/* ── Settings sheets ──
   Every app's Settings is the same set of tinted sections, one kind of thing
   each, in the same order, so a parent always knows where to look:
     .set-section.set-game      how this game plays — sound, names, options   (lavender)
     .set-section.set-family    grown-ups' rules — screen time, bedtime, PIN  (honey)
     .set-section.set-progress  stars, reports, backups and restores          (mint)
     .set-section.set-go        where to go next — modes, Kids Corner         (plain)
   A .set-title heads each section; the page's own rows (.row, .setting,
   .settings-row) and buttons (.btn) sit inside. .set-sub is a small
   sub-heading inside a section. */
.set-section {
  width: 100%; box-sizing: border-box; text-align: left; margin-top: 12px;
  padding: 10px 14px 12px; border-radius: 18px;
  border: 2px solid var(--line, #d9dfd0); background: var(--card, #ffffff);
}
.set-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 4px;
  font-weight: 800; font-size: 15px; color: var(--ink, #3f4d3b);
}
.set-title .set-icon { font-size: 20px; line-height: 1; }
.set-title small { margin-left: auto; font-weight: 700; font-size: 12px; color: var(--ink-soft, var(--muted, #7d887a)); }
.set-sub {
  margin: 14px 0 2px; font-weight: 800; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft, var(--muted, #7d887a));
}
.set-section.set-game { background: #f6f3fd; border-color: #d9d0f0; }
.set-section.set-family { background: var(--honey-soft, #fbeec7); border-color: #ecd9a0; }
.set-section.set-progress { background: #e8f6ec; border-color: #b9dcc3; }
.set-section.set-go { background: var(--card, #ffffff); }
.set-section .row, .set-section .setting, .set-section .settings-row { border-color: rgba(0, 0, 0, 0.07); }
.set-section .row:first-of-type, .set-section .setting:first-of-type { border-top: 0; }
.set-section > .note:first-of-type { margin-top: 2px; }
/* Buttons fill a section's width (a page's own narrower rows, like an inline Apply, win by loading later). */
.set-section .btn { display: block; width: 100%; box-sizing: border-box; text-align: center; }

/* The report card (KidsCorner.reportCard.render): the same strengths / weak
   spots / summary block at the top of every game's grown-ups' report and on
   the hub's report page. */
.rc { text-align: left; }
.rc-game { display: flex; align-items: center; gap: 8px; margin: 16px 0 6px; font-weight: 900; font-size: 17px; }
.rc-game .rc-mascot { font-size: 22px; }
.rc-game small { margin-left: auto; font-weight: 600; font-size: 12px; color: var(--ink-soft, var(--muted, #7d887a)); }
.rc-head { margin: 0 0 6px; font-weight: 800; font-size: 15px; line-height: 1.3; }
.rc-h { margin: 10px 0 2px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft, var(--muted, #7d887a)); }
.rc-list { list-style: none; margin: 0; padding: 0; }
.rc-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line, #d9dfd0); font-size: 14px; line-height: 1.3; }
.rc-list li::before { content: '✅'; flex: none; font-size: 15px; }
.rc-list.work li::before { content: '🔧'; }
.rc-list li b { display: block; }
.rc-list li span { display: block; font-weight: 600; font-size: 13px; color: var(--ink-soft, var(--muted, #7d887a)); }
.rc-none { padding: 6px 0; font-weight: 600; font-size: 13px; color: var(--ink-soft, var(--muted, #7d887a)); }
.rc-sum { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--honey-soft, #fbeec7); font-weight: 600; font-size: 14px; line-height: 1.4; }
.rc-sum b, .rc-next b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft, var(--muted, #7d887a)); }
.rc-next { margin-top: 8px; }

/* ── The home screen every game shares ──
   The shape of Chess's Puzzle Quest, so a child who knows one game knows
   them all, and a new game gets it by using these classes (see
   _template_kids.html):
     .home                 the column; everything inside sits 10px apart
     .home-side            wraps everything but the list: transparent in a
                           single column, the left pane on an iPad held sideways
     .stat-chips           ⭐ stars · 🔥 streak · ☀️ today — small round chips
     .activity-row         the game's ways to play: emoji-and-name doors,
                           2x2 on a phone, one row on an iPad (tint-* colours)
     .level-card           one row per land / place / level, with an emoji,
                           a name, a blurb and something on the right
                           (.continue-card = the one obvious next thing,
                           .done-card = finished, data-scene = a gradient)
     .level-group          a card holding rows of its own (piano's lands)
     .badge-summary        the slim rows for Badges and My Collection
   Chess defines the same names itself; its own rules win there. */
:root { --page-max: 720px; }   /* how wide a game's page gets; wider for the two panes below */
.home { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
.home-side { display: contents; }
.home > * + *, .home-side > * + * { margin-top: 10px; }
.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip {
  background: #fff6e0; border: 2px solid #f0d090; border-radius: 999px;
  padding: 4px 12px; font-size: 14px; font-weight: 800; color: #7a5a20;
}
.stat-chip.done { background: #e2f6e5; border-color: #8fce9a; color: #2f6b3a; }
.stat-chip.sleep { background: #e7ecf3; border-color: #c5cfdd; color: #4b5a70; }
.activity-row { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.activity-card {
  flex: 1 1 42%;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px;
  border: 2px solid var(--line, #d9dfd0); border-radius: 16px;
  background: var(--card, #ffffff); box-shadow: 0 3px 0 var(--line, #d9dfd0);
  font-family: inherit; font-weight: 800; font-size: 14px; color: var(--ink, #3f4d3b);
  text-align: center; cursor: pointer;
}
.activity-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line, #d9dfd0); }
.activity-card .act-emoji { font-size: 30px; line-height: 1; }
.activity-card .act-sub { font-size: 12px; font-weight: 600; color: var(--ink-soft, var(--muted, #8a7a5a)); line-height: 1.25; }
.activity-card.tint-mint  { background: linear-gradient(160deg, #eafaf0 30%, #b9e8c9); border-color: #8fce9a; box-shadow: 0 3px 0 #8fce9a; }
.activity-card.tint-honey { background: linear-gradient(160deg, #fdf1e0 30%, #f7d9a8); border-color: #e0b878; box-shadow: 0 3px 0 #e0b878; }
.activity-card.tint-lilac { background: linear-gradient(160deg, #f3eafd 30%, #d9c2f0); border-color: #b795dd; box-shadow: 0 3px 0 #b795dd; }
.activity-card.tint-sky   { background: linear-gradient(160deg, #e8f4fd 30%, #b5d9f2); border-color: #85b4dd; box-shadow: 0 3px 0 #85b4dd; }
.activity-card.tint-rose  { background: linear-gradient(160deg, #fdeaf1 30%, #f2c3d6); border-color: #dd95b3; box-shadow: 0 3px 0 #dd95b3; }
.activity-card.tint-peach { background: linear-gradient(160deg, #fff0e4 30%, #f7cdb0); border-color: #e0a684; box-shadow: 0 3px 0 #e0a684; }
.activity-card.tint-mint:active, .activity-card.tint-honey:active, .activity-card.tint-lilac:active,
.activity-card.tint-sky:active, .activity-card.tint-rose:active, .activity-card.tint-peach:active { box-shadow: none; }
@media (min-width: 700px) { .activity-card { flex: 1 1 auto; } }
.level-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.level-list > * { flex-shrink: 0; }
.level-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; width: 100%; box-sizing: border-box;
  background: var(--card, #ffffff); border: 2px solid var(--line, #d9dfd0); border-radius: 16px;
  box-shadow: 0 3px 0 var(--line, #d9dfd0);
  font-family: inherit; color: var(--ink, #3f4d3b); text-align: left; cursor: pointer;
  position: relative; overflow: hidden;
}
.level-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line, #d9dfd0); }
.level-card.locked { opacity: 0.55; filter: grayscale(0.65); }
.activity-card.locked { opacity: 0.55; }
.level-emoji { font-size: 34px; line-height: 1; flex: none; }
/* A row with a picture instead of an emoji (the chess friends): a round face. */
.level-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #fff; border: 2px solid rgba(0, 0, 0, 0.08); display: block; }
.level-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.level-name { font-weight: 800; font-size: 16px; }
.level-blurb { font-size: 14px; font-weight: 600; color: var(--ink-soft, var(--muted, #8a7a5a)); line-height: 1.3; }
.level-stars { font-size: 14px; font-weight: 800; color: #b08420; white-space: nowrap; flex: none; }
.level-tag {
  font-size: 11px; font-weight: 800; color: var(--deep, #b06a1a); white-space: nowrap;
  background: var(--honey-soft, #fbeec7); border: 1px solid #ecd9a0; border-radius: 10px; padding: 2px 7px;
}
.level-bar { height: 7px; border-radius: 99px; background: #f0ead8; overflow: hidden; margin-top: 5px; }
.level-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #f4c95d, #f9a76b); }
.level-card.continue-card { background: linear-gradient(105deg, #fff3d0 25%, #ffd79a); border-color: #e8a94e; box-shadow: 0 4px 0 #e8a94e; }
.level-card.continue-card .level-name { font-size: 17px; }
.level-card.continue-card .level-blurb { color: #7a5c22; font-weight: 700; }
.level-card.continue-card:active { box-shadow: 0 1px 0 #e8a94e; }
.level-card.done-card { background: linear-gradient(105deg, #eaf7e2 30%, #cdeccf); border-color: #8fce9a; box-shadow: 0 3px 0 #8fce9a; }
.level-card[data-scene="meadow"]   { background: linear-gradient(105deg, #fff6d8 30%, #d9f2c0); }
.level-card[data-scene="forest"]   { background: linear-gradient(105deg, #eaf7e2 30%, #a8d8b0); }
.level-card[data-scene="woods"]    { background: linear-gradient(105deg, #f2eafb 30%, #cdb9ea); }
.level-card[data-scene="river"]    { background: linear-gradient(105deg, #e8f7fd 30%, #a8dcf0); }
.level-card[data-scene="mountain"] { background: linear-gradient(105deg, #f4f6fd 30%, #ccd6ec); }
.level-card[data-scene="castle"]   { background: linear-gradient(105deg, #fff3d8 30%, #ffd9a0); }
/* A card holding rows of its own: the same skin, stacked. */
.level-group {
  display: flex; flex-direction: column; width: 100%; box-sizing: border-box;
  padding: 10px 14px 6px;
  background: var(--card, #ffffff); border: 2px solid var(--line, #d9dfd0); border-radius: 16px;
  box-shadow: 0 3px 0 var(--line, #d9dfd0); color: var(--ink, #3f4d3b);
}
.level-group[data-scene="meadow"]   { background: linear-gradient(105deg, #fff6d8 30%, #f4fbe9); }
.level-group[data-scene="forest"]   { background: linear-gradient(105deg, #eaf7e2 30%, #f3faf3); }
.level-group[data-scene="woods"]    { background: linear-gradient(105deg, #f2eafb 30%, #f9f6fd); }
.level-group[data-scene="river"]    { background: linear-gradient(105deg, #e8f7fd 30%, #f4fbfe); }
.level-group[data-scene="mountain"] { background: linear-gradient(105deg, #f4f6fd 30%, #fafbfe); }
.level-group[data-scene="castle"]   { background: linear-gradient(105deg, #fff3d8 30%, #fff9ee); }
.level-head { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; }
.level-head .level-emoji { font-size: 28px; }
.level-head .level-name { font-size: 17px; flex: 1; }
.badge-summary {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
  padding: 10px 14px;
  background: #fffaf0; border: 2px solid var(--line, #d9dfd0); border-radius: 14px;
  box-shadow: 0 3px 0 var(--line, #d9dfd0);
  font-family: inherit; font-weight: 800; font-size: 14px; color: var(--ink, #3f4d3b);
  text-align: left; cursor: pointer;
}
.badge-summary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line, #d9dfd0); }
.badge-count { color: #b08420; }
.badge-teaser { flex: 1; text-align: left; font-size: 15px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-caret { color: var(--ink-soft, var(--muted, #8a7a5a)); }
.badge-shelf { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.badge-shelf[hidden] { display: none; }
.collection-summary { background: #f3f7ff; }
.collection-summary.waiting { background: #fff4d6; border-color: #e8b45a; box-shadow: 0 3px 0 #e8b45a; }

/* On an iPad held sideways the home spreads out the way Chess's Puzzle Quest
   does (same breakpoint and shape as chess_kids.html's .quest-card): the side
   — chips, doors, the Badges / Collection rows — becomes the left pane, the
   lands or places with their stars the right, each scrolling on its own and
   both as tall as the space allows. Phones keep the single column: their
   landscape viewport is too short. */
@media (orientation: landscape) and (min-width: 900px) and (min-height: 560px) {
  :root { --page-max: 1000px; }
  .home { flex-direction: row; align-items: stretch; gap: 24px; max-height: calc(100dvh - 200px); }
  .home > * + * { margin-top: 0; }
  .home-side { display: flex; flex-direction: column; align-items: stretch; flex: 0 0 min(46%, 400px); min-width: 0; min-height: 0; overflow-y: auto; }
  .home-side > * { flex-shrink: 0; }   /* the pane scrolls; nothing in it gets squashed */
  .home > .level-list { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 4px; }
  .home .activity-card { flex: 1 1 42%; }   /* 2x2 doors in the left pane, as chess */
}

/* ── The picture collection's wall and assembling board
      (kids_collection_wall.js): the two scrims every game and the hub open. ── */
.kc-scrim { position: fixed; inset: 0; z-index: 350; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(30, 28, 18, 0.5); font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.kc-scrim.open { display: flex; }
.kc-card { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: #fffdf7; color: #4a3f2a; border-radius: 26px; padding: 18px 16px 16px; text-align: center; box-shadow: 0 18px 44px rgba(40, 50, 35, 0.28); }
.kc-build-card { width: min(420px, 100%); }
.kc-title { font-size: 22px; font-weight: 800; line-height: 1.2; }
.kc-sub { margin-top: 6px; font-weight: 600; font-size: 14px; line-height: 1.35; color: #8a7a5a; }
.kc-btn { display: inline-block; margin-top: 14px; padding: 12px 22px; font: inherit; font-size: 17px; font-weight: 700; background: #fff; color: #4a3f2a; border: 2px solid #e6dcc6; border-radius: 14px; box-shadow: 0 3px 0 #e6dcc6; cursor: pointer; min-height: 48px; }
.kc-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #e6dcc6; }
.kc-btn.kc-primary { background: #5fa86a; color: #fff; border-color: #4a8a55; box-shadow: 0 3px 0 #4a8a55; }
/* The way out stays in reach however long the shelf is: a card taller than
   the screen scrolls, and its last button rides along the bottom edge on a
   rim of the card's own colour. */
.kc-card > .kc-btn:last-child { position: sticky; bottom: 4px; z-index: 1; box-shadow: 0 3px 0 #4a8a55, 0 0 0 6px #fffdf7; }
/* The groups along the top (one per folder under kids/puzzles/), then the
   chosen group's pictures as small tiles: the whole picture once built, the
   pieces held so far with a count while filling, faded with "Build it!" when
   every piece is there. */
.kc-tabs { margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.kc-tabs[hidden] { display: none; }
.kc-tab { font: inherit; font-size: 14px; font-weight: 800; padding: 6px 12px; border-radius: 999px; border: 2px solid #e6dcc6; background: #fff; color: #6b5a33; cursor: pointer; min-height: 36px; }
.kc-tab.on { background: #5fa86a; border-color: #4a8a55; color: #fff; }
.kc-tab.ready:not(.on) { border-color: #e8b45a; background: #fff4d6; }
.kc-tab-emoji { margin-right: 5px; }
.kc-tab-count { margin-left: 6px; font-size: 12px; font-weight: 700; opacity: 0.8; }
.kc-gallery { margin-top: 10px; display: grid; gap: 8px; width: 100%; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.kc-item { position: relative; padding: 5px; border-radius: 12px; border: 2px solid #e6dcc6; background: #fff; }
.kc-item.built, .kc-item.ready { cursor: pointer; }
.kc-item.built { border-color: #e8b45a; box-shadow: 0 3px 0 #e8b45a; }
.kc-item.ready { border-style: dashed; border-color: #5fa86a; }
.kc-item.ready .kc-grid { opacity: 0.4; filter: saturate(0.55); }
.kc-item.empty .kc-grid { opacity: 0.6; }
.kc-badge { position: absolute; top: 1px; right: 1px; font-size: 11px; font-weight: 800; line-height: 1; padding: 3px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.94); color: #6b5a33; border: 1px solid #e6dcc6; }
.kc-item.built .kc-badge { background: #5fa86a; color: #fff; border-color: #4a8a55; }
.kc-cap, .kc-go { margin-top: 4px; height: 26px; display: flex; align-items: center; justify-content: center; }   /* the same height, so the rows stay even */
.kc-cap { font-weight: 800; font-size: 11px; line-height: 1.15; text-align: center; color: #6b5a33; }   /* a long name ("Pirate Mayor Humdinger") takes two lines rather than lose its ends */
.kc-cap, .kc-go { overflow: hidden; }
.kc-go { width: 100%; font-size: 12px; padding: 0 4px; min-height: 0; white-space: nowrap; }
.kc-grid { display: grid; aspect-ratio: 1; grid-auto-rows: 1fr; width: 100%; border-radius: 8px; overflow: hidden; border: 2px solid rgba(0, 0, 0, 0.14); background: #f4f1ea; }
.kc-grid > i { display: block; }
.kc-grid > i.gap { background: #efeadf; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.kc-win { margin-top: 12px; }
.kc-tile { width: 76px; aspect-ratio: 1; margin: 0 auto; border-radius: 14px; border: 3px solid #e8b45a; overflow: hidden; box-shadow: 0 4px 0 #e8b45a; animation: kc-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.kc-tile-cap { margin-top: 6px; font-weight: 800; font-size: 13px; color: #6b5a33; }
.kc-frame { margin: 12px auto 0; width: 100%; max-width: 300px; display: grid; aspect-ratio: 1; border-radius: 14px; overflow: hidden; border: 3px solid #cbb68a; background: #f4f1ea; }
.kc-slot { opacity: 0.3; cursor: pointer; padding: 0; border: 1px dashed rgba(0, 0, 0, 0.22); background: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
.kc-slot.down { opacity: 1; border-color: transparent; cursor: default; animation: kc-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.kc-slot.hover { opacity: 0.75; outline: 3px solid #5fa86a; outline-offset: -3px; }
.kc-tray { margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.kc-piece { width: 56px; aspect-ratio: 1; border-radius: 12px; border: 2px solid #e6dcc6; overflow: hidden; box-shadow: 0 3px 0 #e6dcc6; cursor: pointer; padding: 0; touch-action: none; }
.kc-piece:active { transform: translateY(2px); box-shadow: 0 1px 0 #e6dcc6; }
.kc-piece.picked { border-color: #5fa86a; box-shadow: 0 3px 0 #5fa86a; }
.kc-ghost { position: fixed; left: 0; top: 0; width: 64px; aspect-ratio: 1; pointer-events: none; z-index: 1000; border-radius: 12px; border: 2px solid #5fa86a; overflow: hidden; transform: translate(-50%, -50%) scale(1.08); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); }
.kc-extra { margin-top: 14px; }
.kc-nudge { animation: kc-nudge 0.4s ease; }
@keyframes kc-pop { from { transform: scale(0.3) rotate(-12deg); } to { transform: none; } }
@keyframes kc-nudge { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .kc-tile, .kc-slot.down, .kc-nudge { animation: none; } }
