:root {
  --bg: #fff8ec;
  --card: #ffffff;
  --ink: #2b2540;
  --muted: #6b6480;
  --line: #eadfc9;
  --brand: #ff8a3d;
  --brand-ink: #ffffff;
  --good: #2e9e5b;
  --soft: #ffe9d2;
  --warn: #fff1b8;
  --radius: 22px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
.banner { background: var(--warn); color: #5b4600; padding: 8px 16px; font-size: 13px; text-align: center; }
main {
  max-width: 560px; margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 16px;
}
h1 { font-size: 26px; line-height: 1.2; margin: 0; text-wrap: balance; }
h2 { font-size: 19px; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.muted { color: var(--muted); font-size: 15px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 0; min-width: 0; }

button, input { font: inherit; color: inherit; }
button {
  border: 0; border-radius: 16px; padding: 14px 20px; min-height: 52px; cursor: pointer;
  background: var(--soft); color: var(--ink); font-weight: 600;
}
button:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
button.primary { background: var(--brand); color: var(--brand-ink); }
button.danger { background: #fde4e4; color: #9b1c1c; }
button[disabled] { opacity: .45; cursor: not-allowed; }
input[type="text"], input[type="number"] {
  width: 100%; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; min-height: 52px;
}
label.check { display: flex; gap: 12px; align-items: flex-start; }
label.check input { width: 26px; height: 26px; margin-top: 2px; flex: none; }
.choices { display: flex; gap: 10px; flex-wrap: wrap; }
.choices label { cursor: pointer; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 56px; min-height: 56px; padding: 8px 14px;
  border-radius: 16px; border: 3px solid var(--line); background: #fff; font-size: 26px;
}
.choices span.txt { font-size: 17px; font-weight: 600; }
.choices input:checked + span { border-color: var(--brand); background: var(--soft); }
.choices input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

.child-card { display: flex; align-items: center; gap: 14px; }
.avatar { font-size: 40px; line-height: 1; }
.stars { letter-spacing: 2px; }

/* Chế độ bé */
.kid { display: flex; flex-direction: column; gap: 18px; }
.kid-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.kid-bar .lock { min-height: 44px; padding: 8px 14px; background: transparent; border: 2px solid var(--line); }
.kid h1 { text-align: center; }
.lesson-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lesson-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 10px; background: var(--card); border: 3px solid var(--line); border-radius: 26px; min-height: 160px; }
.lesson-btn .big { font-size: 56px; line-height: 1; }
.lesson-btn .name { font-size: 20px; }
.stage { background: var(--card); border: 3px solid var(--line); border-radius: 30px; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.picture { font-size: 96px; line-height: 1; }
.swatch { width: 96px; height: 96px; border-radius: 50%; border: 4px solid rgba(0,0,0,.08); }
.word { font-size: 44px; font-weight: 800; letter-spacing: .5px; }
.hint { font-size: 18px; color: var(--muted); }
.big-btn { min-width: 200px; min-height: 64px; font-size: 20px; border-radius: 20px; }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.option { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 120px; padding: 10px 4px; background: #fff; border: 3px solid var(--line); border-radius: 22px; }
.option .picture { font-size: 52px; }
.option .swatch { width: 52px; height: 52px; }
.option.shake { animation: shake .35s; border-color: #e0a3a3; }
.option.blink { animation: blink .6s 3; border-color: var(--good); }
.option.right { border-color: var(--good); background: #e6f6ec; }
.dots { display: flex; gap: 8px; justify-content: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--brand); }
.praise { font-size: 24px; font-weight: 800; min-height: 34px; }
.sticker { font-size: 120px; line-height: 1; animation: pop .6s; }
.overlay { position: fixed; inset: 0; background: rgba(43, 37, 64, .6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.overlay .card { width: 100%; max-width: 420px; }
.rest { text-align: center; padding-top: 60px; }
.rest .picture { font-size: 110px; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes blink { 50% { background: #c9f0d8; } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

.picture.many { font-size: 44px; letter-spacing: 2px; }
.option .picture.many { font-size: 20px; letter-spacing: 0; }
.setting { display: flex; flex-direction: column; gap: 6px; }
.setting select, .setting textarea { width: 100%; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: inherit; min-height: 48px; }
.setting textarea { min-height: 84px; resize: vertical; }
.saved { color: var(--good); font-size: 14px; min-height: 20px; }
.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.album .sticker-card { background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.album .sticker-card .big { font-size: 48px; line-height: 1; }
.album .sticker-card.empty { opacity: .35; }
.kid-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.picture { display: flex; align-items: center; justify-content: center; gap: 2px; }
.picture .pimg { width: 96px; height: 96px; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.picture.many .pimg { width: 52px; height: 52px; }
.option .picture .pimg { width: 60px; height: 60px; }
.option .picture.many .pimg { width: 20px; height: 20px; }

.lesson-btn.locked { opacity: .55; }
.lesson-btn.locked .stars { font-size: 13px; letter-spacing: 0; color: var(--muted); }
.memo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.memo { position: relative; min-height: 104px; padding: 6px; background: #fff; border: 3px solid var(--line); border-radius: 20px; display: flex; align-items: center; justify-content: center; }
.memo .face { display: none; }
.memo .back { font-size: 36px; }
.memo.up .face, .memo.done .face { display: flex; align-items: center; justify-content: center; }
.memo.up .back, .memo.done .back { display: none; }
.memo.done { border-color: var(--good); background: #e6f6ec; }
.memo .picture { font-size: 44px; }
.memo .picture .pimg { width: 56px; height: 56px; }
.memo .picture.many .pimg { width: 22px; height: 22px; }
.memo .swatch { width: 52px; height: 52px; }
.memo .word.small { font-size: 22px; }

.baskets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.basket { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 6px; min-height: 120px; background: #fff; border: 3px solid var(--line); border-radius: 24px; }
.basket .big { font-size: 48px; line-height: 1; }
.basket .name { font-size: 18px; font-weight: 700; }
.basket.shake { animation: shake .35s; border-color: #e0a3a3; }
.basket.blink { animation: blink .6s 3; border-color: var(--good); }
.basket.right { border-color: var(--good); background: #e6f6ec; }

.reward-preview { font-size: 14px; color: var(--muted); }
.reward-preview.got { color: var(--good); font-weight: 700; }
.garden { position: relative; width: 100%; height: 280px; border-radius: 24px; overflow: hidden; border: 3px solid var(--line); background: linear-gradient(#cfeaff 0 48%, #bfe6b0 48% 100%); }
.garden .slot { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; display: flex; align-items: center; justify-content: center; font-size: 44px; border-radius: 50%; border: 3px dashed rgba(0,0,0,.14); }
.garden .slot.has { border: 0; background: rgba(255,255,255,.55); font-size: 48px; animation: pop .5s; }

.companion { background: #fff; border: 3px solid var(--line); border-radius: 22px; padding: 12px 14px; font-size: 17px; margin-bottom: 12px; }
.island { margin-bottom: 18px; }
.island h2 { font-size: 20px; margin: 6px 4px 10px; }
.island.far .lesson-grid { opacity: .9; }
.island-review { width: 100%; margin-top: 10px; background: #fff3d6; border: 3px solid #f2b84b; border-radius: 22px; }
.island-review.locked, .island-review:disabled { opacity: .5; background: #f3efe7; border-color: var(--line); }
.story-line { font-size: 22px; line-height: 1.4; max-width: 320px; }

.today { background: #fff8e6; border: 2px solid #f2d9a0; border-radius: 16px; padding: 10px 14px; margin: 10px 0; }
.today h3 { margin: 4px 0 6px; font-size: 16px; }
.today ul { margin: 4px 0; padding-left: 20px; }
.today li { margin: 4px 0; }

.word.command { font-size: 34px; }

.dress { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 8px; }
.dress-stage { width: 100%; border-radius: 28px; padding: 18px 0 8px; display: flex; justify-content: center; background: linear-gradient(#ffe9d2, #fff4e6); }
.dress-stage.bg-bg-garden { background: radial-gradient(40px 20px at 20% 85%, #ff9ec0 90%, transparent 92%), radial-gradient(34px 18px at 78% 88%, #ffd23d 90%, transparent 92%), linear-gradient(#cfeaff 0 55%, #9fdc9b 55%); }
.dress-stage.bg-bg-sky { background: radial-gradient(60px 28px at 25% 25%, #fff 70%, transparent 72%), radial-gradient(70px 30px at 75% 40%, #fff 70%, transparent 72%), linear-gradient(#7fc4ff, #d6efff); }
.dress-stage.bg-bg-beach { background: linear-gradient(#bfe8ff 0 40%, #5fb8e8 40% 58%, #f4dd9b 58%); }
.stars-line { font-size: 20px; font-weight: 800; color: var(--ink-2); }
.wardrobe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.wear { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; padding: 6px 2px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-1); }
.wear .wear-icon { font-size: 30px; line-height: 1; }
.wear .wear-name { font-size: 11px; line-height: 1.15; }
.wear.locked { opacity: .5; background: #f0eef6; box-shadow: none; }
.wear.on { box-shadow: 0 0 0 4px #3fbf8f, var(--shadow-1); background: #e9fbef; }
.new-item { font-size: 20px; font-weight: 800; color: #b05a00; background: #fff3d6; border-radius: 16px; padding: 8px 14px; }
/* Số lớn (11-20): nhiều hình nhỏ để vừa khung */
.picture.lots .pimg { width: 30px; height: 30px; }
.option .picture.lots .pimg, .song-pic .picture.lots .pimg { width: 11px; height: 11px; }
.memo .picture.lots .pimg { width: 12px; height: 12px; }
.slot .picture.lots .pimg { width: 12px; height: 12px; }
.picture.lots { flex-wrap: wrap; justify-content: center; max-width: 100%; }

.dress-stage.bg-bg-night { background: radial-gradient(3px 3px at 20% 25%, #fff 90%, transparent), radial-gradient(2px 2px at 70% 18%, #fff 90%, transparent), radial-gradient(3px 3px at 82% 48%, #ffe9a6 90%, transparent), radial-gradient(2px 2px at 35% 60%, #fff 90%, transparent), radial-gradient(22px 22px at 78% 20%, #fff3c4 90%, transparent 92%), linear-gradient(#1c2447, #44508f); }
.dress-stage.bg-bg-farm { background: radial-gradient(70px 36px at 15% 70%, #e0463a 94%, transparent 96%), radial-gradient(90px 40px at 80% 80%, #8cd17d 94%, transparent 96%), linear-gradient(#cfeaff 0 50%, #b6e08a 50%); }
.dress-stage.bg-bg-space { background: radial-gradient(18px 18px at 78% 24%, #ff9ec0 90%, transparent 92%), radial-gradient(3px 3px at 25% 30%, #fff 90%, transparent), radial-gradient(2px 2px at 55% 70%, #fff 90%, transparent), radial-gradient(2px 2px at 88% 66%, #fff 90%, transparent), linear-gradient(#2a1b5e, #5b3fa8); }
