/* ============================================================
   KIDS MODE — Puzzle Trainer (kids-mode.js / data/kids-puzzles.json)

   Visual target: the Kids Mode mockups (desktop + mobile) — a bright,
   playful, nature-themed experience that is clearly its OWN thing, not
   Adult Mode with kid colours. Everything is scoped under
   .tcw-puzzle-trainer (the app root) and, for the active experience,
   under .tcw-puzzle-trainer.pt-kids-mode, so nothing leaks into Adult
   Mode or the host page (PGN Viewer regression rule). The adult
   <style> block in index.html is untouched by design.

   Contents:
     · header: king glyph + friendly "Kids Mode" ON/OFF switch
     · nature scenery (sky + meadow + clouds + daisies), wooden "You can do it!" sign,
       hidden by default, shown only under .pt-kids-mode
     · level CARDS (Frog … T-Rex): current / completed / locked
     · main layout: board left + friendly control panel right (desktop);
       panel → board → buttons (mobile, per the mockup)
     · big friendly Hint / Next buttons
     · footer + level-complete celebration overlay
   ============================================================ */

/* ============================================================
   KIDS MODE SCENERY — playful nature background (sky + meadow +
   clouds + daisies). Purely decorative: pointer-events
   none, aria-hidden, sits BEHIND all content. Hidden by default (Adult)
   and shown only under .pt-kids-mode.
   ============================================================ */
.tcw-puzzle-trainer .pt-kids-scenery{display:none}
.tcw-puzzle-trainer.pt-kids-mode{position:relative}
.tcw-puzzle-trainer.pt-kids-mode .pt-kids-scenery{
  display:block;position:absolute;inset:0;z-index:0;
  pointer-events:none;overflow:hidden;border-radius:24px;
}
.tcw-puzzle-trainer .pt-kids-sky{
  position:absolute;left:0;right:0;top:0;height:80%;
  background:linear-gradient(180deg,#bfe4fb 0%,#d8effc 46%,#eef8ff 80%,#f6fbff 100%);
}
.tcw-puzzle-trainer .pt-kids-meadow{
  position:absolute;left:-12%;right:-12%;bottom:-2px;height:42%;
  background:
    radial-gradient(82% 120% at 12% 110%, #8bce73 0 46%, rgba(139,206,115,0) 47%),
    radial-gradient(104% 135% at 88% 114%, #6fbd5b 0 52%, rgba(111,189,91,0) 53%),
    linear-gradient(180deg,#bce4a1 0%,#8bce73 55%,#78c05f 100%);
  border-radius:50% 50% 0 0 / 30px 30px 0 0;
}
.tcw-puzzle-trainer .pt-kids-cloud{
  position:absolute;height:26px;width:70px;background:#fff;border-radius:20px;opacity:.92;
}
.tcw-puzzle-trainer .pt-kids-cloud::before,
.tcw-puzzle-trainer .pt-kids-cloud::after{content:'';position:absolute;background:#fff;border-radius:50%}
.tcw-puzzle-trainer .pt-kids-cloud::before{width:36px;height:36px;top:-15px;left:10px}
.tcw-puzzle-trainer .pt-kids-cloud::after{width:28px;height:28px;top:-10px;left:36px}
.tcw-puzzle-trainer .pt-kids-cloud-1{top:24px;left:5%}
.tcw-puzzle-trainer .pt-kids-cloud-2{top:58px;right:9%;transform:scale(.8)}
.tcw-puzzle-trainer .pt-kids-cloud-3{top:120px;left:42%;transform:scale(.62);opacity:.75}
.tcw-puzzle-trainer .pt-kids-daisy{position:absolute;width:34px;height:34px}
.tcw-puzzle-trainer .pt-kids-daisy-1{left:3%;bottom:6%}
.tcw-puzzle-trainer .pt-kids-daisy-2{left:10%;bottom:3%;transform:scale(.8)}
.tcw-puzzle-trainer .pt-kids-daisy-3{right:6%;bottom:8%;transform:scale(.85)}
/* Hidden by default (Adult Mode); shown under .pt-kids-mode. Desktop:
   bottom-right corner of the card (the spot it held inside the scenery).
   bottom:26px keeps the full wooden post inside the card. */
.tcw-puzzle-trainer .pt-kids-sign{display:none}
.tcw-puzzle-trainer.pt-kids-mode .pt-kids-sign{
  display:block;
  position:absolute;right:22px;bottom:26px;width:150px;pointer-events:none;
  padding:12px 12px 13px;text-align:center;transform:rotate(-2.5deg);
  color:#fff;font-weight:900;font-size:15px;line-height:1.12;letter-spacing:.3px;
  text-shadow:0 1px 1px rgba(0,0,0,.3);
  border:3px solid #8f5a2a;border-radius:9px;
  background:
    repeating-linear-gradient(0deg,rgba(0,0,0,.05) 0 2px,transparent 2px 12px),
    linear-gradient(180deg,#c98a4e 0%,#b97a3f 45%,#a86c34 100%);
  box-shadow:0 8px 18px rgba(60,35,10,.28),inset 0 0 0 2px rgba(255,255,255,.1);
}
.tcw-puzzle-trainer .pt-kids-sign::after{
  content:'';position:absolute;left:50%;bottom:-24px;transform:translateX(-50%);
  width:15px;height:26px;border-radius:0 0 4px 4px;
  background:linear-gradient(90deg,#9a6330,#7e4e24);
}

/* ============================================================
   Header — title + Kids Mode switch
   ============================================================ */
.tcw-puzzle-trainer .pt-head{
  display:flex;align-items:flex-end;justify-content:space-between;
  gap:14px;flex-wrap:wrap;position:relative;
}
.tcw-puzzle-trainer .pt-head .pt-sub{margin-bottom:0}
/* Desktop (see the <=760px block at the end of this file for mobile):
   the switch is pinned to the header's TOP-RIGHT corner. Out of flow
   (absolute) so it holds the EXACT same screen position in Adult and
   Kids Mode — the header text height differs between modes, so an
   in-flow switch would jump when switching — and so the title / subtitle
   block is never reflowed or re-wrapped. The 0 right padding puts the
   switch's right edge flush with the content edge shared by .pt-main
   (both are full-width children of the same padded container). */
.tcw-puzzle-trainer .pt-kids-toggle{
  position:absolute;top:0;right:0;
}



/* Kids Mode switch: friendly "Kids Mode" label + iOS-style pill toggle.
   JS toggles aria-checked (true/false) and sets #ptKidsToggleState text
   ("On"/"Off") — restyled here, logic unchanged. */
.tcw-puzzle-trainer .pt-kids-toggle{
  display:inline-flex;align-items:center;gap:10px;
  background:transparent;border:none;padding:6px 0 6px 4px;margin:0;
  cursor:pointer;font-family:inherit;
}
.tcw-puzzle-trainer .pt-kids-toggle-label{
  font-size:15px;font-weight:800;color:var(--ink);white-space:nowrap;
}
.tcw-puzzle-trainer .pt-kids-toggle-switch{
  position:relative;display:inline-block;
  width:62px;height:30px;border-radius:999px;background:#c7d1db;
  transition:background .18s ease;
  box-shadow:inset 0 1px 2px rgba(16,24,40,.14);
}
.tcw-puzzle-trainer .pt-kids-toggle-knob{
  position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;
  background:#fff;box-shadow:0 1px 3px rgba(16,24,40,.32);
  transition:transform .18s ease;
}
.tcw-puzzle-trainer .pt-kids-toggle-state{
  position:absolute;top:50%;transform:translateY(-50%);
  font-size:10.5px;font-weight:900;letter-spacing:.4px;line-height:1;
}
/* OFF (Adult): gray track, knob left, state text hidden (clean). */
.tcw-puzzle-trainer .pt-kids-toggle[aria-checked="false"] .pt-kids-toggle-state{opacity:0}
/* ON (Kids): green track, knob right, "On" text shown on the left. */
.tcw-puzzle-trainer .pt-kids-toggle[aria-checked="true"] .pt-kids-toggle-switch{background:var(--green)}
.tcw-puzzle-trainer .pt-kids-toggle[aria-checked="true"] .pt-kids-toggle-knob{transform:translateX(32px)}
.tcw-puzzle-trainer .pt-kids-toggle[aria-checked="true"] .pt-kids-toggle-state{left:9px;color:#fff;opacity:1}

/* ============================================================
   Active Kids Mode: section visible, Adult solving UI hidden.
   Content floats above the scenery.
   ============================================================ */
.tcw-puzzle-trainer .pt-kids{display:none}
.tcw-puzzle-trainer.pt-kids-mode .pt-kids{display:block}
.tcw-puzzle-trainer.pt-kids-mode .pt-main,
.tcw-puzzle-trainer.pt-kids-mode .pt-selftest{display:none}
.tcw-puzzle-trainer.pt-kids-mode .pt-head,
.tcw-puzzle-trainer.pt-kids-mode .pt-kids{position:relative;z-index:1}

/* ============================================================
   Level cards (Frog … T-Rex): the progression path
   ============================================================ */
.tcw-puzzle-trainer .pt-kids-levels{display:flex;gap:12px;flex-wrap:wrap;margin:18px 0 20px}

.tcw-puzzle-trainer .klevel{
  position:relative;
  display:flex;flex-direction:column;align-items:center;gap:7px;
  min-width:66px;padding:12px 12px 11px;
  border-radius:18px;border:2px solid var(--line);background:var(--panel);
  cursor:pointer;font-family:inherit;
  transition:border-color .15s ease,background .15s ease,box-shadow .15s ease;
}
.tcw-puzzle-trainer .klevel:hover{background:#eef4ff}
.tcw-puzzle-trainer .kface{
  width:50px;height:50px;border-radius:50%;overflow:hidden;line-height:0;
  background:#eef3f8;box-shadow:inset 0 0 0 1px rgba(16,24,40,.06);
}
.tcw-puzzle-trainer .kface img{width:100%;height:100%;object-fit:cover;display:block}
.tcw-puzzle-trainer .kname{font-size:13px;font-weight:800;color:var(--ink-2);line-height:1}
.tcw-puzzle-trainer .klock{position:absolute;top:6px;right:8px;width:14px;height:14px;opacity:.85;background:url('assets/icons/lock.svg') center/contain no-repeat}
.tcw-puzzle-trainer .kcheck{position:absolute;top:5px;right:8px;width:15px;height:15px;background:url('assets/icons/check.svg') center/contain no-repeat}
.tcw-puzzle-trainer .klevel.current{
  border-color:var(--green);background:var(--green-soft);
  box-shadow:0 0 0 3px rgba(31,157,85,.18),0 10px 20px rgba(31,157,85,.18);
}
.tcw-puzzle-trainer .klevel.current .kface{box-shadow:inset 0 0 0 2px #fff,0 0 0 2px var(--green),0 4px 10px rgba(31,157,85,.35)}
.tcw-puzzle-trainer .klevel.current .kname{color:var(--green-dark)}
.tcw-puzzle-trainer .klevel.done{border-color:var(--green)}
.tcw-puzzle-trainer .klevel.done .kname{color:var(--green-dark)}
.tcw-puzzle-trainer .klevel.locked{opacity:.72;background:#f2f6f8;border-color:var(--line-2);cursor:not-allowed}
.tcw-puzzle-trainer .klevel.locked:hover{transform:none}
.tcw-puzzle-trainer .klevel.locked .kface{filter:grayscale(.22) opacity(.96)}
.tcw-puzzle-trainer .klevel.locked .kname{color:var(--ink-3)}
.tcw-puzzle-trainer .klevel:disabled{cursor:not-allowed}

/* ============================================================
   Main layout — board left / control panel right (desktop);
   panel → board → buttons (mobile, per the mockup)
   ============================================================ */
/* NOTE (board-shift fix): the side column + column-gap here MUST stay equal
   to `.pt-main` in puzzle-trainer.css (340px side, 22px column gap). The
   600px board is centred inside the board column with `margin:0 auto`, so a
   different side-width/gap between Adult and Kids grids moves the board's
   centred X position by half the difference when the mode is toggled. */
.tcw-puzzle-trainer .pt-kids-main{
  display:grid;gap:18px 22px;align-items:start;
  grid-template-columns:minmax(0,1fr) 340px;
  grid-template-areas:"board side" "board actions";
}
.tcw-puzzle-trainer .pt-kids-boardcard{
  grid-area:board;
  border:1px solid var(--line);border-radius:20px;
  background:var(--panel);box-shadow:var(--shadow);padding:16px;
}
.tcw-puzzle-trainer .pt-kids-boardwrap{width:100%;max-width:min(100%,600px);margin:0 auto}

/* Fallback for browsers without aspect-ratio (mirrors the adult board). */
@supports not (aspect-ratio: 1 / 1) {
  .tcw-puzzle-trainer .pt-kids-boardwrap{position:relative}
  .tcw-puzzle-trainer .pt-kids-boardwrap::before{content:'';display:block;padding-top:100%}
  .tcw-puzzle-trainer .pt-kids-boardwrap .board{position:absolute;inset:0;width:100%;height:100%}
}

/* ============================================================
   KID BOARD REFRESH — cheerful board palette + softer frame.
    (Coordinate color, slogan color, and the wooden sign rules are further
    down - search '#5f8359', '#1f4fb8', '.pt-kids-sign'.)
   Scoped to Kids Mode only: the shared #board is re-parented into
   #kidsBoardWrap by kids-mode.js, and CSS custom properties set
   HERE (nearest-ancestor wins) override the Adult defaults on the
   .tcw-puzzle-trainer root for the board's subtree — including the
   a–h / 1–8 coordinate labels, which reuse the same vars and so
   follow automatically. Adult Mode (board in #boardWrap) keeps
   the classic palette untouched. Pieces are the #pk- sticker set
   (see the sprite in index.html + pieceSVG()).
   ============================================================ */
.tcw-puzzle-trainer .pt-kids-boardwrap{
  --sq-light:#fdf3dc;   /* soft cream */
  --sq-dark:#a6d8a3;    /* fresh mint green */
}
/* a-h / 1-8 coordinate labels: a darker muted green than the base
   --sq-dark/--sq-light-derived colors, for stronger contrast on BOTH
   the cream and the mint squares (base rule is overridden here). */
.tcw-puzzle-trainer .pt-kids-boardwrap .sq[data-file]::before,
.tcw-puzzle-trainer .pt-kids-boardwrap .sq[data-rank]::after{
  color:#5f8359;filter:none;
}
.tcw-puzzle-trainer .pt-kids-boardcard{
  background:linear-gradient(180deg,#f7fcf7 0%,#edf6ef 100%);
  box-shadow:0 14px 30px rgba(47,120,80,.16),var(--shadow);
}
.tcw-puzzle-trainer .pt-kids-boardwrap .board{
  border-radius:16px;              /* softer, friendlier corners */
  box-shadow:0 4px 14px rgba(47,120,80,.18);
}

/* ---------- friendly control panel ---------- */
.tcw-puzzle-trainer .pt-kids-panel{
  position:relative;
  grid-area:side;
  border:1px solid var(--line);border-radius:22px;
  background:var(--panel);box-shadow:0 10px 26px rgba(28,64,44,.12);
  padding:20px 16px 16px;
}
/* Designed top accent (a thin friendly band) — purely decorative. */
.tcw-puzzle-trainer .pt-kids-panel::before{
  content:'';position:absolute;left:16px;right:16px;top:0;height:5px;
  border-radius:0 0 6px 6px;background:linear-gradient(90deg,var(--green),#9bd8a6);
}
/* hero: big mascot + speech bubble. Reserved min-height so a message
   change (Find it! / Nice! / Try again! / Solved!) NEVER shifts the
   panel — the mascot + reserved bubble keep a stable footprint, and
   shorter lines are vertically centred. */
.tcw-puzzle-trainer .pt-kids-hero{display:flex;align-items:center;gap:12px;min-height:106px}
.tcw-puzzle-trainer .pt-kids-mascot{width:106px;height:106px;flex:none;display:block;filter:drop-shadow(0 4px 9px rgba(28,64,44,.18))}
.tcw-puzzle-trainer .pt-kids-bubble{
  position:relative;flex:1 1 auto;min-width:0;min-height:58px;
  display:flex;align-items:center;
  background:var(--green-soft);border-radius:16px;padding:12px 15px;
}
.tcw-puzzle-trainer .pt-kids-bubble::before{
  content:'';position:absolute;left:-7px;top:50%;transform:translateY(-50%) rotate(45deg);
  width:14px;height:14px;background:var(--green-soft);
}
.tcw-puzzle-trainer .pt-kids-instruction{
  display:block;font-size:18px;font-weight:800;color:var(--ink);line-height:1.28;
}
/* side-to-move row — text + side square. ALWAYS in flow with a reserved
   height (min-height, no [hidden]) so swapping White/Black, or any message
   state, never shifts the panel. Short text is vertically centred. */
.tcw-puzzle-trainer .pt-kids-turn{
  display:flex;align-items:center;justify-content:center;gap:12px;
  margin-top:12px;min-height:38px;padding:4px 20px;
  background:var(--blue-soft);border-radius:999px;
  font-size:16px;font-weight:800;color:var(--ink);line-height:1;
  box-shadow:inset 0 0 0 1px rgba(30,58,102,.07);
}
/* Side square — a clean modern rounded tile instead of a piece icon:
   .sq-w = white side (white fill, slate-blue edge), .sq-b = black side
   (indigo fill, deep-navy edge). Matches the kid sticker piece palette. */
.tcw-puzzle-trainer .pt-kids-turn-sq{
  width:22px;height:22px;border-radius:7px;flex:none;
}
.tcw-puzzle-trainer .pt-kids-turn-sq.sq-w{
  background:#fff;
  box-shadow:inset 0 0 0 2px #3e4c78,0 2px 4px rgba(16,24,40,.18);
}
.tcw-puzzle-trainer .pt-kids-turn-sq.sq-b{
  background:#40509b;
  box-shadow:inset 0 0 0 2px #222b55,0 2px 4px rgba(16,24,40,.18);
}
.tcw-puzzle-trainer .pt-kids-turn-text{white-space:nowrap;letter-spacing:.2px}
/* progress box — reserved height, larger number, big "bubble" dots */
.tcw-puzzle-trainer .pt-kids-progbox{
  margin-top:14px;min-height:80px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  background:var(--blue-soft);border-radius:16px;
  padding:12px 14px;text-align:center;
}
.tcw-puzzle-trainer .pt-kids-prognum{
  display:block;font-size:31px;font-weight:900;color:var(--ink);line-height:1;letter-spacing:.3px;
}
.tcw-puzzle-trainer .pt-kids-dots{display:flex;align-items:center;justify-content:center;gap:4px;margin-top:11px;flex-wrap:nowrap}
.tcw-puzzle-trainer .pt-kids-dots .kdot{
  width:11px;height:11px;border-radius:50%;background:#cdd9e6;flex:none;
  box-shadow:inset 0 1px 1px rgba(16,24,40,.16);
  transition:background .15s ease,transform .15s ease,box-shadow .15s ease;
}
.tcw-puzzle-trainer .pt-kids-dots .kdot.on{background:var(--green);box-shadow:inset 0 -1px 1px rgba(0,0,0,.14),0 1px 2px rgba(31,157,85,.5)}
.tcw-puzzle-trainer .pt-kids-dots .kdot.cur{background:#fff;border:2px solid var(--amber);box-shadow:0 0 0 2px rgba(245,179,1,.28)}
/* level badge + encouragement (reserved height) */
.tcw-puzzle-trainer .pt-kids-midrow{
  display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:14px;min-height:44px;
}
.tcw-puzzle-trainer .pt-kids-levelbadge{display:flex;align-items:center;gap:9px;min-width:0}
.tcw-puzzle-trainer .pt-kids-levelavatar{
  width:34px;height:34px;border-radius:50%;overflow:hidden;line-height:0;
  background:#eef3f8;flex:none;box-shadow:inset 0 0 0 1px rgba(16,24,40,.05);
}
.tcw-puzzle-trainer .pt-kids-levelavatar img{width:100%;height:100%;object-fit:cover;display:block}
.tcw-puzzle-trainer .pt-kids-levelname{font-size:14px;font-weight:800;color:var(--ink-2);line-height:1.15}
.tcw-puzzle-trainer .pt-kids-encourage{
  font-size:12.5px;font-weight:700;color:var(--green-dark);
  background:var(--green-soft);border-radius:10px;padding:8px 10px;line-height:1.25;
  max-width:46%;
}
/* stars — ALWAYS reserves height (empty or filled) so revealing them on a
   solve NEVER pushes the buttons below it. Local SVG star (replaces the
   ★ glyph): unearned = faded gray copy, earned = full gold. */
.tcw-puzzle-trainer .pt-kids-stars{
  margin-top:10px;min-height:26px;
  display:flex;align-items:center;justify-content:center;
  letter-spacing:8px;line-height:1;
}
.tcw-puzzle-trainer .pt-kids-stars span{display:inline-block;width:24px;height:24px;background:url('assets/icons/star.svg') center/contain no-repeat;opacity:.28;filter:grayscale(1)}
.tcw-puzzle-trainer .pt-kids-stars .on{opacity:1;filter:none}

/* ============================================================
   Big friendly Hint / Next buttons
   ============================================================ */
.tcw-puzzle-trainer .pt-kids-actions{grid-area:actions;display:flex;gap:12px}
.tcw-puzzle-trainer .pt-kids-btn{
  flex:1 1 0;display:inline-flex;align-items:center;justify-content:center;gap:9px;
  padding:16px 14px;border-radius:16px;border:1px solid transparent;
  font-family:inherit;font-size:17px;font-weight:800;line-height:1;
  cursor:pointer;white-space:nowrap;
  transition:filter .15s ease;
}
.tcw-puzzle-trainer .pt-kids-btn .btn-ico{width:20px;height:20px}
.tcw-puzzle-trainer .pt-kids-btn:hover{filter:brightness(.97)}
.tcw-puzzle-trainer .pt-kids-btn:active{filter:brightness(.94)}
.tcw-puzzle-trainer .pt-kids-hint{background:#ffe08a;border-color:#f2cf72;color:#5e4400;box-shadow:0 2px 0 #e8c25e}
.tcw-puzzle-trainer .pt-kids-next{background:var(--green);border-color:var(--green-dark);color:#fff;box-shadow:0 2px 0 var(--green-dark)}

/* ---------- footer ---------- */
.tcw-puzzle-trainer .pt-kids-footer{
  margin-top:20px;text-align:center;
  font-size:15px;font-weight:800;color:#1f4fb8;
  text-decoration:underline wavy;text-decoration-color:#8ab6f2;text-underline-offset:6px;
}

/* ============================================================
   Level-complete celebration
   ============================================================ */
.tcw-puzzle-trainer .pt-kids-overlay{
  position:fixed;inset:0;z-index:40;
  display:none;align-items:center;justify-content:center;
  background:rgba(255,255,255,.9);padding:20px;
}
/* The overlay is shown/hidden via the `hidden` attribute (JS toggles it).
   An author `display:flex` would OVERRIDE the UA `[hidden]{display:none}`,
   making the card cover the board at all times and leaving "Continue"
   unable to dismiss it. So keep the base hidden and only flex when the
   `hidden` attribute is actually removed. */
.tcw-puzzle-trainer .pt-kids-overlay:not([hidden]){display:flex}
.tcw-puzzle-trainer .pt-kids-celebrate{
  width:100%;max-width:380px;text-align:center;
  background:var(--panel);border:1px solid var(--line);border-radius:22px;
  box-shadow:0 12px 40px rgba(16,24,40,.18);
  padding:28px 26px 26px;
}
.tcw-puzzle-trainer .pt-kids-celebrate-img{width:120px;height:120px;display:block;margin:0 auto 8px}
.tcw-puzzle-trainer .pt-kids-celebrate-title{font-size:25px;line-height:1.2;margin:0 0 6px;color:var(--ink)}
.tcw-puzzle-trainer .pt-kids-celebrate-unlock{font-size:16px;font-weight:700;color:var(--green-dark);margin-bottom:12px}
.tcw-puzzle-trainer .pt-kids-celebrate-stars{letter-spacing:6px;line-height:1;margin-bottom:20px;display:flex;justify-content:center}
.tcw-puzzle-trainer .pt-kids-celebrate-stars span{display:inline-block;width:28px;height:28px;background:url('assets/icons/star.svg') center/contain no-repeat}
.tcw-puzzle-trainer .pt-kids-continue{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:15px 36px;border-radius:16px;border:1px solid var(--green-dark);
  background:var(--green);color:#fff;
  font-family:inherit;font-size:16px;font-weight:800;line-height:1;cursor:pointer;
  transition:filter .15s ease;
}
.tcw-puzzle-trainer .pt-kids-continue:hover{filter:brightness(.96)}

/* ============================================================
   "Start over" reset — subtle, secondary, panel-bottom
   ============================================================ */
.tcw-puzzle-trainer .pt-kids-reset{
  display:block;width:100%;margin-top:16px;padding:6px 4px;
  background:none;border:0;cursor:pointer;
  font-family:inherit;font-size:13.5px;font-weight:700;line-height:1;
  color:#9aa6b2;
  transition:color .15s ease;
}
.tcw-puzzle-trainer .pt-kids-reset:hover,.tcw-puzzle-trainer .pt-kids-reset:focus-visible{
  color:#c0392b;outline:none;
}
.tcw-puzzle-trainer .pt-kids-reset:focus-visible{
  outline:2px solid var(--green-dark);outline-offset:2px;border-radius:8px;
}

/* Reset confirmation dialog (reuses the .pt-kids-overlay wrapper) */
.tcw-puzzle-trainer .pt-kids-confirm{
  width:100%;max-width:340px;text-align:center;
  background:var(--panel);border:1px solid var(--line);border-radius:20px;
  box-shadow:0 12px 40px rgba(16,24,40,.18);
  padding:24px 22px 20px;
}
.tcw-puzzle-trainer .pt-kids-confirm-title{font-size:21px;line-height:1.2;margin:0 0 6px;color:var(--ink)}
.tcw-puzzle-trainer .pt-kids-confirm-desc{font-size:14.5px;line-height:1.35;margin:0 0 18px;color:var(--ink-2)}
.tcw-puzzle-trainer .pt-kids-confirm-actions{display:flex;gap:10px}
.tcw-puzzle-trainer .pt-kids-confirm-cancel,
.tcw-puzzle-trainer .pt-kids-confirm-go{
  flex:1 1 0;padding:13px 12px;border-radius:14px;cursor:pointer;
  font-family:inherit;font-size:15px;font-weight:800;line-height:1;
  transition:filter .15s ease;
}
.tcw-puzzle-trainer .pt-kids-confirm-cancel{
  background:transparent;border:1px solid var(--line);color:var(--ink-2);
}
.tcw-puzzle-trainer .pt-kids-confirm-cancel:hover{filter:brightness(.97)}
.tcw-puzzle-trainer .pt-kids-confirm-go{
  background:#c0392b;border:1px solid #a93226;color:#fff;
}
.tcw-puzzle-trainer .pt-kids-confirm-go:hover{filter:brightness(.95)}
.tcw-puzzle-trainer .pt-kids-confirm-cancel:focus-visible,
.tcw-puzzle-trainer .pt-kids-confirm-go:focus-visible{outline:2px solid var(--green-dark);outline-offset:2px}

/* ============================================================
   Responsive (mobile mockup: panel → board → buttons)
   ============================================================ */
@media (max-width:960px){
  /* --- Compact mobile pass: compress the chrome ABOVE the board (title,
     level selector, info card) so the board starts sooner. The board size
     is unchanged. Every rule below is Kids-Mode-scoped. --- */
  .tcw-puzzle-trainer.pt-kids-mode .pt-title{font-size:clamp(20px,6vw,26px);margin-bottom:2px}
  .tcw-puzzle-trainer.pt-kids-mode .pt-sub{margin-bottom:8px}

  /* All 5 animal levels in ONE row; horizontal scroll only if they don't
     fit (narrow phones). Icons stay 40px for recognition. */
  .tcw-puzzle-trainer .pt-kids-levels{
    flex-wrap:nowrap;gap:8px;margin:10px 0 12px;
    overflow-x:auto;-webkit-overflow-scrolling:touch;
    padding:4px 2px 10px;scroll-snap-type:x proximity;
  }
  .tcw-puzzle-trainer .klevel{flex:0 0 auto;min-width:52px;padding:8px 8px 9px;gap:6px;scroll-snap-align:start}
  .tcw-puzzle-trainer .kface{width:40px;height:40px}
  .tcw-puzzle-trainer .kname{font-size:12px}

  .tcw-puzzle-trainer .pt-kids-main{
    grid-template-columns:minmax(0,1fr);
    grid-template-areas:"side" "board" "actions";
    gap:12px;
  }
  .tcw-puzzle-trainer .pt-kids-boardcard{padding:8px 0}
  /* NOTE: the old `padding:0 3px` on .pt-kids-boardwrap was REMOVED here.
     Adult `.board-wrap` has no horizontal padding in the 761-960px band
     (it only gets `padding:0 3px` at <=760px, matched below); the Kids-only
     3px inset shifted the centred board 3px when toggling modes in that
     band. Keep boardwrap insets identical to .board-wrap per breakpoint. */
  /* Info card: condensed, not cramped - reserved heights shrink, text
     steps down one notch, touch targets unchanged. */
  .tcw-puzzle-trainer .pt-kids-panel{padding:14px 12px 12px}
  .tcw-puzzle-trainer .pt-kids-hero{min-height:88px}
  .tcw-puzzle-trainer .pt-kids-mascot{width:74px;height:74px}
  .tcw-puzzle-trainer .pt-kids-instruction{font-size:16px}
  .tcw-puzzle-trainer .pt-kids-turn{margin-top:10px;min-height:34px;padding:3px 16px;font-size:14.5px}
  .tcw-puzzle-trainer .pt-kids-progbox{margin-top:10px;min-height:64px;padding:9px 12px}
  .tcw-puzzle-trainer .pt-kids-prognum{font-size:26px}
  .tcw-puzzle-trainer .pt-kids-dots{margin-top:9px}
  .tcw-puzzle-trainer .pt-kids-midrow{margin-top:10px;min-height:40px}
  .tcw-puzzle-trainer .pt-kids-levelavatar{width:30px;height:30px}
  .tcw-puzzle-trainer .pt-kids-stars{margin-top:8px;min-height:24px}
  .tcw-puzzle-trainer .pt-kids-encourage{max-width:52%}
  .tcw-puzzle-trainer .pt-kids-actions{gap:10px}
  .tcw-puzzle-trainer .pt-kids-btn{padding:15px 12px;font-size:16px}
  /* The wooden sign moves into NORMAL FLOW below the slogan on mobile:
     its own space, never floating over the Hint / Next buttons (the sign
     is a direct child of the app root, right after the .pt-kids block).
     margin-bottom reserves room for the wooden post. */
  .tcw-puzzle-trainer .pt-kids-footer{margin-top:14px}
  .tcw-puzzle-trainer.pt-kids-mode .pt-kids-sign{
    position:static;width:120px;font-size:13px;margin:10px auto 14px;
  }
  .tcw-puzzle-trainer .pt-kids-daisy{width:26px;height:26px}
}

/* ============================================================
   NARROW PHONES (<=480px — 390 / 430): extra compact pass.
   ONLY Kids-Mode vertical chrome is tightened: gaps around the
   title / subtitle / animal row / info card, padding inside the
   info + progress card, and a few oversized text sizes. The board
   keeps its full width, Hint / Next stay side-by-side, and the
   slogan + wooden sign stay in normal flow below the controls.
   Tablet (768px) and desktop are untouched: this block only adds
   rules below 480px, on top of the 960px block above.
   ============================================================ */
@media (max-width:480px){
  /* App-root padding: the 760px block in the index.html inline style sets
     .tcw-puzzle-trainer{padding:10px 10px 14px}; that style comes AFTER
     this stylesheet, so it needs the two-class selector to win on
     specificity. Top chrome starts higher on narrow phones. */
  .tcw-puzzle-trainer.pt-kids-mode{padding:6px 10px 12px}
  .tcw-puzzle-trainer.pt-kids-mode .pt-title{font-size:19px;margin-bottom:1px}
  .tcw-puzzle-trainer.pt-kids-mode .pt-sub{font-size:12px;margin-bottom:4px}

  /* Decorative sky clouds sit over the Kids Mode toggle and the T-Rex
     card at narrow widths (pointer-events:none, but visually noisy) —
     hide all of them here; 768px tablet and desktop keep them. */
  .tcw-puzzle-trainer .pt-kids-cloud{display:none}

  /* Animal row: still ONE row (nowrap + horizontal-scroll fallback
     from the 960px block); cards get slightly smaller icons/labels and
     less padding so the whole row is shorter yet still tappable. */
  .tcw-puzzle-trainer .pt-kids-levels{margin:6px 0 7px;padding-bottom:6px;gap:6px}
  .tcw-puzzle-trainer .klevel{padding:6px 6px 7px;gap:5px}
  .tcw-puzzle-trainer .kface{width:36px;height:36px}
  .tcw-puzzle-trainer .kname{font-size:11px}

  .tcw-puzzle-trainer .pt-kids-main{gap:9px}

  /* Info card: MOBILE-ONLY REORDER via CSS grid (DOM order, desktop +
     tablet block layout, and the solved-state no-shift guarantee are all
     untouched). New mobile order:
       1. "Frog · Level 1" + "Start over" on one top row
       2. mascot + message bubble (dynamic text, incl. hint/solved lines)
       3. progress number + dots
       4. White to move / Black to move
       5. stars — height always reserved, content appears on solve
     "Grow your chess skills!" is hidden on mobile (tablet/desktop keep it). */
  .tcw-puzzle-trainer .pt-kids-panel{
    display:grid;
    grid-template-columns:1fr auto;
    grid-template-areas:
      "midrow  reset"
      "hero    hero"
      "progbox progbox"
      "turn    turn"
      "stars   stars";
    align-items:center;
    gap:7px 8px;
    padding:9px 10px 8px;
  }
  .tcw-puzzle-trainer .pt-kids-midrow{grid-area:midrow;margin-top:0;min-height:30px;justify-content:flex-start}
  .tcw-puzzle-trainer .pt-kids-reset{grid-area:reset;width:auto;margin-top:0;padding:8px 8px;font-size:13px;align-self:center;justify-self:end}
  .tcw-puzzle-trainer .pt-kids-hero{grid-area:hero;min-height:66px;gap:9px}
  .tcw-puzzle-trainer .pt-kids-mascot{width:56px;height:56px}
  .tcw-puzzle-trainer .pt-kids-bubble{min-height:44px;padding:8px 12px}
  .tcw-puzzle-trainer .pt-kids-instruction{font-size:15px}
  .tcw-puzzle-trainer .pt-kids-progbox{grid-area:progbox;margin-top:0;min-height:52px;padding:7px 10px}
  .tcw-puzzle-trainer .pt-kids-prognum{font-size:22px}
  .tcw-puzzle-trainer .pt-kids-dots{margin-top:6px}
  .tcw-puzzle-trainer .pt-kids-dots .kdot{width:10px;height:10px}
  .tcw-puzzle-trainer .pt-kids-turn{grid-area:turn;margin-top:0;min-height:30px;padding:2px 14px;font-size:14px;gap:9px}
  .tcw-puzzle-trainer .pt-kids-turn-sq{width:18px;height:18px}
  .tcw-puzzle-trainer .pt-kids-levelavatar{width:28px;height:28px}
  .tcw-puzzle-trainer .pt-kids-levelname{font-size:13px}
  .tcw-puzzle-trainer .pt-kids-encourage{display:none}
  /* min-height must cover the 24px star icons: earning the first star must
     NOT grow the row (it would push the board below — layout-shift bug). */
  .tcw-puzzle-trainer .pt-kids-stars{grid-area:stars;margin-top:0;min-height:24px;font-size:20px;letter-spacing:6px}

  /* Controls: Hint / Next stay side-by-side; tap targets stay ~41px. */
  .tcw-puzzle-trainer .pt-kids-actions{gap:8px}
  .tcw-puzzle-trainer .pt-kids-btn{padding:13px 10px;font-size:15px}
  .tcw-puzzle-trainer .pt-kids-btn .btn-ico{width:18px;height:18px}

  /* Slogan + wooden sign: still normal flow below the controls,
     slightly tighter, no overlap. */
  .tcw-puzzle-trainer .pt-kids-footer{margin-top:10px;font-size:14px;text-underline-offset:5px}
  .tcw-puzzle-trainer.pt-kids-mode .pt-kids-sign{width:112px;font-size:12px;margin:8px auto 12px;padding:10px 10px 11px}
}

/* ============================================================
   MOBILE (<=760px): the Kids Mode switch sits BELOW the subtitle,
   right-aligned (desktop uses the top-right corner, see the header
   section above):
   - flex:0 1 100% forces the text block onto its own full-width line,
     so the switch always wraps to the line below it. (In Adult mode
     the long subtitle already pushed it there; in Kids mode the short
     subtitle pulled it up beside the title.)
   - margin-left:auto right-aligns it with the content edge (the same
     right edge as .pt-main in Adult mode).
   - The min-height reservation equals the ADULT text-block height, so
     the switch's vertical position is IDENTICAL in Adult and Kids
     Mode (the Kids subtitle is one line, the Adult subtitle wraps to
     two or four). This intentionally reserves space under the shorter
     Kids subtitle so the switch never jumps when the mode changes.
   Measured text-block heights (adult): 89-91px for 411-760px,
   104-108px for <=410px (the subtitle gains a 4th line below 411px).
   ============================================================ */
@media (max-width:760px){
  .tcw-puzzle-trainer .pt-head > div{flex:0 1 100%;min-height:91px}
  .tcw-puzzle-trainer .pt-kids-toggle{position:static;margin-left:auto}
  /* Match Adult `.board-wrap{padding:0 3px}` (puzzle-trainer.css 760px block)
     so the centred board never shifts when switching modes at phone widths. */
  .tcw-puzzle-trainer .pt-kids-boardwrap{padding:0 3px}
}

@media (max-width:410px){
  .tcw-puzzle-trainer .pt-head > div{min-height:108px}
}

/* At <=480px Kids Mode's app-root top padding is 4px smaller than Adult
   Mode's (6px vs 10px, see the <=480px block above), so the header text
   block starts 4px higher; add those 4px to the Kids-only reservation
   (91 + 4) so the switch's screen position stays identical in both modes.
   At <=410px the Adult text block is taller (108px), so the Kids
   compensation becomes 108 + 4 (higher-specificity rule below). */
@media (max-width:480px){
  .tcw-puzzle-trainer.pt-kids-mode .pt-head > div{min-height:95px}
}

@media (max-width:410px){
  .tcw-puzzle-trainer.pt-kids-mode .pt-head > div{min-height:112px}
}
