/* kg-mascot */
kg-mascot { position: relative; display: inline-block; --mascot-h: 120px; }
kg-mascot .mascot-art { height: var(--mascot-h); width: auto; display: block; }
kg-mascot .mascot-art svg { height: 100%; width: auto; overflow: visible; }
kg-mascot[data-pose="idle"] .mascot-art { animation: idle-bob 2.8s ease-in-out infinite; }
kg-mascot[data-pose="cheer"] .mascot-art { animation: jump .7s var(--ease-spring) 2; }
kg-mascot[data-pose="wave"] .mascot-art, kg-mascot[data-pose="talk"] .mascot-art { animation: idle-sway 1s ease-in-out infinite; }
kg-mascot[data-pose="point-left"] .mascot-art { transform: rotate(-10deg) translateX(-6px); transition: transform var(--t-base); }
kg-mascot[data-pose="point-right"] .mascot-art { transform: rotate(10deg) translateX(6px); transition: transform var(--t-base); }
.mascot-bubble { position: absolute; left: calc(100% + 10px); top: 4px; width: max-content; max-width: min(58vw, 340px); padding: 10px 14px; border-radius: 18px 18px 18px 4px; background: #fff; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.2; box-shadow: var(--shadow-2); opacity: 0; transform: translateY(6px); transition: opacity var(--t-fast), transform var(--t-fast); pointer-events: none; white-space: normal; }
.mascot-bubble.is-on { opacity: 1; transform: none; }
:root[data-captions="off"] .mascot-bubble { display: none; }

/* kg-tile */
kg-tile { display: block; }
.tile-btn { width: 100%; height: 100%; min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); border: 4px solid transparent; transition: transform var(--t-press) var(--ease-out), border-color var(--t-fast), box-shadow var(--t-fast); }
.tile-btn:active { transform: scale(.95); }
kg-tile[data-armed] .tile-btn { border-color: var(--focus); box-shadow: var(--shadow-3); animation: pop .4s var(--ease-spring); }
.tile-art { width: 84px; height: 84px; display: grid; place-items: center; } .tile-art svg { width: 100%; height: 100%; overflow: visible; }
.tile-label { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: var(--ink); text-align: center; line-height: 1.1; }

/* kg-round-dots */
kg-round-dots { display: inline-flex; gap: 8px; align-items: center; }
kg-round-dots i { width: 14px; height: 14px; border-radius: 50%; background: rgb(255 255 255 / .6); box-shadow: inset 0 0 0 2px rgb(0 0 0 / .12); transition: transform var(--t-fast), background var(--t-fast); }
kg-round-dots i.is-done { background: var(--accent); box-shadow: none; } kg-round-dots i.is-now { transform: scale(1.35); background: #fff; box-shadow: 0 0 0 3px var(--accent); }

/* kg-sheet (grown-up) */
kg-sheet { position: fixed; inset: 0; z-index: 50; display: block; font-family: var(--font-ui); }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(40 30 20 / .45); backdrop-filter: blur(3px); animation: fade var(--t-base); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 90dvh; overflow: auto; background: var(--surface); color: var(--ink); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: var(--s-2) var(--gutter) max(var(--s-5), env(safe-area-inset-bottom)); box-shadow: var(--shadow-3); animation: sheet-up var(--t-slow) var(--ease-out); }
kg-sheet[closing] .sheet-panel { animation: sheet-down var(--t-base) var(--ease-in) forwards; } kg-sheet[closing] .sheet-backdrop { opacity: 0; transition: opacity var(--t-base); }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } } @keyframes sheet-down { to { transform: translateY(100%); } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-3); } .sheet-title { font-size: 1.5rem; }
.sheet-body { display: flex; flex-direction: column; gap: var(--s-3); }
@media (min-width: 640px) { .sheet-panel { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); max-height: 88dvh; border-radius: var(--r-lg); animation: sheet-in var(--t-base) var(--ease-out); } .sheet-handle { display: none; } kg-sheet[closing] .sheet-panel { animation: sheet-out var(--t-base) var(--ease-in) forwards; } @keyframes sheet-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%); } } @keyframes sheet-out { to { opacity: 0; transform: translate(-50%, -48%) scale(.97); } } }

/* parent gate */
.gate-q { font-size: 1.2rem; font-weight: 700; text-align: center; }
.gate-answer { font-family: var(--font-display); font-size: 2rem; text-align: center; min-height: 2.6rem; letter-spacing: .1em; }
.gate-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 0 auto; }
.gate-key { min-height: 52px; font-size: 1.3rem; }
.gate-note { color: var(--ink-2); font-size: .9rem; text-align: center; }

/* settings */
.set-group { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); } .set-group h3 { font-size: 1.1rem; margin-top: 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 44px; flex-wrap: wrap; }
.set-note { color: var(--ink-2); font-size: .9rem; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; flex-wrap: wrap; }
.seg [role="radio"] { height: 36px; padding: 0 14px; border-radius: var(--r-pill); font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.seg [aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
input[role="switch"] { appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; cursor: pointer; transition: background var(--t-base); margin: 0; }
input[role="switch"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform var(--t-base) var(--ease-out); box-shadow: var(--shadow-1); }
input[role="switch"]:checked { background: var(--accent); } input[role="switch"]:checked::after { transform: translateX(20px); }
.set-range { width: 150px; height: 32px; accent-color: var(--accent); } /* touch target >= 28 px (BROWSER_COMPATIBILITY.md) */
.set-danger { color: var(--c-red); }
.tabs { display: flex; gap: 6px; } .tab { flex: 1; height: 40px; border-radius: var(--r-pill); background: var(--surface-2); font-weight: 800; font-family: var(--font-display); } .tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

/* progress grid */
.prog-sum { font-weight: 800; font-family: var(--font-display); font-size: 1.2rem; }
.prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.prog-item { display: grid; place-items: center; height: 44px; border-radius: var(--r-sm); font-family: var(--font-learn); font-weight: 700; font-size: 1.2rem; background: var(--surface-2); color: var(--ink-2); }
.prog-item[data-state="practising"] { background: #ffe9a8; color: #6b4b00; } .prog-item[data-state="mastered"] { background: var(--ok); color: #fff; }
.prog-legend { display: flex; gap: 12px; font-size: .85rem; color: var(--ink-2); } .prog-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; background: var(--surface-2); vertical-align: -1px; }
.prog-legend [data-state="practising"]::before { background: #ffe9a8; } .prog-legend [data-state="mastered"]::before { background: var(--ok); }
.prog-sessions { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--ink-2); }

/* sticker shelf */
kg-sticker-shelf { display: block; }
.shelf-board { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-lg); background: rgb(255 255 255 / .55); box-shadow: inset 0 2px 6px rgb(0 0 0 / .06); }
.sticker { width: 56px; height: 56px; display: grid; place-items: center; filter: grayscale(1) opacity(.35); transition: filter var(--t-slow), transform var(--t-slow); } .sticker svg { width: 100%; height: 100%; overflow: visible; }
.sticker.is-earned { filter: none; } .sticker.is-new { animation: pop .8s var(--ease-spring); }

/* toast (grown-up) */
.toast-host { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md); font-weight: 700; box-shadow: var(--shadow-2); animation: rise-fade var(--t-base) var(--ease-out); max-width: 92vw; text-align: center; }
.toast[leaving] { opacity: 0; transition: opacity var(--t-base); }

/* generic child-facing item states */
.is-press { animation: press .3s var(--ease-out); }
.is-correct { animation: jump .8s var(--ease-spring); }
.is-wobble { animation: wobble .4s ease-in-out; }
.is-reveal { animation: glow-pulse 1.2s ease-in-out infinite; }
.is-hint { animation: glow-pulse 1.6s ease-in-out infinite; }
.is-dim { opacity: .5; transition: opacity var(--t-base); }
.is-lifted { filter: drop-shadow(0 12px 14px rgb(0 0 0 / .25)); }
[data-drop].is-hover { transform: scale(1.06); filter: drop-shadow(0 0 14px rgb(255 183 3 / .8)); transition: transform var(--t-fast), filter var(--t-fast); }

/* kg-scene-bar (grown-up bar, toddlers pack) */
kg-scene-bar { position: fixed; inset: 0; z-index: 60; display: block; font-family: var(--font-ui); }
.bar-backdrop { position: absolute; inset: 0; background: rgb(20 30 40 / .5); backdrop-filter: blur(4px); animation: fade var(--t-base); }
.bar-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 94vw); max-height: 92dvh; overflow: auto; background: #fff; color: var(--ink); border-radius: var(--r-lg); padding: 14px 18px 18px; box-shadow: var(--shadow-3); display: flex; flex-direction: column; gap: 10px; animation: rise-fade var(--t-base) var(--ease-out); }
.bar-head { display: flex; align-items: center; justify-content: space-between; } .bar-head h2 { font-size: 1.4rem; }
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; flex-wrap: wrap; } .bar-actions { justify-content: flex-start; } .bar-actions a { text-decoration: none; }
.bar-words span { font-weight: 700; } .bar-words ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; } .bar-words li { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.bar-note { color: var(--ink-2); font-size: .9rem; line-height: 1.45; }
