/* Khu Vườn Của Bơ — một màn hình toàn khung, nền sáng, mục tiêu to. */
/* Baloo 2 (SIL OFL 1.1, fonts/OFL.txt) — 3 tập ký tự đóng gói sẵn để chạy offline. */
@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo2-vietnamese.woff2") format("woff2"); font-weight: 400 800; font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo2-latin-ext.woff2") format("woff2"); font-weight: 400 800; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo2-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  color-scheme: light;
  --bg: #FFFDF5; --grass: #E8F5E9; --sky: #E3F2FD; --ink: #3B2A1E; --ink-2: #5C4A3D;
  --wood: #6B4423; --cta: #E8590C; --cta-dark: #B6440A;
  --up: #E5484D; --down: #1C7ED6; --left: #F5B400; --right: #2F9E44;
  --night: #1F2A5C;
  --f: "Baloo 2", ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --fp: system-ui, -apple-system, "Segoe UI", sans-serif;
  --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Ccircle cx='24' cy='24' r='18' fill='%23FFD36E' stroke='%236B4423' stroke-width='4'/%3E%3Ccircle cx='24' cy='24' r='5' fill='%236B4423'/%3E%3C/svg%3E") 24 24, pointer;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--ink); font-family: var(--f); user-select: none; -webkit-user-select: none; cursor: var(--cursor); touch-action: none; }
body[data-screen="parent"] { cursor: auto; user-select: text; touch-action: auto; }
button { font: inherit; color: inherit; cursor: var(--cursor); }
.art { display: block; width: 100%; height: 100%; pointer-events: none; }
.screen { position: fixed; inset: 0; display: grid; }
[hidden] { display: none !important; }

/* ---------- Gấu Bơ ---------- */
.bear { flex: none; }
.bear svg { overflow: visible; display: block; }
.bear .b-closed, .bear .b-cap { display: none; }
.bear.idle .b-body, .bear.idle .b-head { animation: breathe 3s ease-in-out infinite; transform-origin: 100px 190px; }
.bear.idle .b-eyes { animation: blink 4s infinite; transform-origin: 100px 74px; }
.bear.talk .b-mouth { animation: talk .28s ease-in-out infinite alternate; transform-origin: 100px 100px; }
.bear.cheer svg { animation: jump .5s ease-out 2; }
.bear.cheer .b-arm-l { transform: rotate(140deg); transform-origin: 46px 120px; }
.bear.cheer .b-arm-r { transform: rotate(-140deg); transform-origin: 154px 120px; }
.bear.point .b-arm-r { transform: rotate(-70deg); transform-origin: 154px 120px; transition: transform .3s; }
.bear.stretch svg { animation: sway 2s ease-in-out infinite; }
.bear.stretch .b-arm-l { transform: rotate(170deg); transform-origin: 46px 120px; }
.bear.stretch .b-arm-r { transform: rotate(-170deg); transform-origin: 154px 120px; }
.bear.sleep .b-eyes { display: none; } .bear.sleep .b-closed, .bear.sleep .b-cap { display: inline; }
.bear.sleep .b-body, .bear.sleep .b-head { animation: breathe 4s ease-in-out infinite; transform-origin: 100px 190px; }
@keyframes breathe { 50% { transform: scale(1.03); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes talk { to { transform: scaleY(1.9); } }
@keyframes jump { 50% { transform: translateY(-24px); } }
@keyframes sway { 50% { transform: rotate(-8deg); } }

/* ---------- Màn chào ---------- */
.splash { place-items: center; background: radial-gradient(circle at 50% 60%, #FFF6D6, var(--grass) 70%); text-align: center; }
.splash .title { font-size: clamp(40px, 7vw, 88px); font-weight: 800; color: var(--wood); margin: 0; line-height: 1; }
.splash .go { width: min(52vmin, 340px); aspect-ratio: 1; border-radius: 50%; border: 8px solid var(--wood); background: #FFF; display: grid; place-items: center; margin: 3vmin auto; box-shadow: 0 10px 0 var(--wood); animation: pulse 2.4s ease-in-out infinite; }
.splash .hint { font-size: clamp(20px, 3vw, 30px); color: var(--ink-2); margin: 0; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* ---------- Bản đồ ---------- */
.map { background: linear-gradient(#DFF1FB 0 14%, var(--grass) 14%); grid-template-rows: auto 1fr; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 2vmin 3vmin; gap: 2vmin; min-height: 96px; }
.map .islands { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3vmin; align-items: center; padding: 0 4vmin 8vmin; position: relative; }
.map svg.road { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.island { position: relative; border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 1vmin; }
.island .disk { width: min(22vmin, 190px); aspect-ratio: 1; border-radius: 50%; background: #FFF; border: 7px solid var(--wood); display: grid; place-items: center; box-shadow: 0 9px 0 var(--wood); transition: transform .2s; }
.island .disk .art { width: 64%; height: 64%; }
.island .name { font-size: clamp(20px, 2.6vw, 30px); font-weight: 700; color: var(--wood); background: #FFFFFFD9; border-radius: 999px; padding: 0 16px; }
.island:hover .disk, .island:focus-visible .disk { transform: translateY(-6px) scale(1.04); }
.island.locked .disk { filter: grayscale(1) opacity(.55); }
.island.locked::after { content: ""; position: absolute; top: -2%; left: 50%; width: min(26vmin, 220px); aspect-ratio: 2 / 1.15; transform: translateX(-50%); pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 115'%3E%3Cpath d='M40 105 a32 32 0 0 1 -4 -64 a40 40 0 0 1 72 -22 a34 34 0 0 1 56 26 a30 30 0 0 1 -4 60 z' fill='%23fff' stroke='%23B9C6D3' stroke-width='5'/%3E%3C/svg%3E") center / contain no-repeat; }
.island.suggest .disk { box-shadow: 0 9px 0 var(--wood), 0 0 0 14px #FFE27A88; animation: pulse 2s ease-in-out infinite; }
.map .guide { position: absolute; left: 3vmin; bottom: 2vmin; }

/* ---------- Khung màn chơi ---------- */
.game { grid-template-rows: auto 1fr auto; background: var(--grass); }
.game.sky { background: var(--sky); }
.iconbtn { width: 88px; height: 88px; border-radius: 28px; border: 5px solid var(--wood); background: #FFF; display: grid; place-items: center; padding: 12px; position: relative; box-shadow: 0 6px 0 var(--wood); }
.iconbtn.small { width: 72px; height: 72px; opacity: .55; }
.hold-ring { position: absolute; inset: -9px; border-radius: 34px; pointer-events: none; background: conic-gradient(var(--cta) calc(var(--p, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px)); mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px)); }
.stars { display: flex; gap: 1.2vmin; }
.star { width: clamp(36px, 5vmin, 54px); aspect-ratio: 1; opacity: .25; filter: grayscale(1); transition: all .4s; }
.star.on { opacity: 1; filter: none; transform: scale(1.15); }
.stage { position: relative; overflow: hidden; }
.bottombar { display: flex; align-items: flex-end; justify-content: space-between; gap: 3vmin; padding: 0 3vmin 2vmin; min-height: 120px; }
.wordcard { display: flex; align-items: center; gap: 2vmin; background: #FFF; border: 5px solid var(--wood); border-radius: 28px; padding: 1vmin 3vmin 1vmin 1.5vmin; min-height: 96px; opacity: 0; transform: translateY(20px); transition: all .35s; }
.wordcard.show { opacity: 1; transform: none; }
.wordcard .pic { width: 76px; height: 76px; }
.wordcard .w { font-size: clamp(36px, 5vw, 56px); font-weight: 700; line-height: 1; }

/* ---------- D-pad 4 màu ---------- */
.dpad { display: grid; grid-template-columns: repeat(3, var(--k)); grid-template-rows: repeat(2, var(--k)); gap: 8px; --k: clamp(64px, 9vmin, 96px); }
.dpad button { border: 0; border-radius: 22px; color: #fff; font-size: calc(var(--k) * .5); font-weight: 800; line-height: 1; box-shadow: 0 7px 0 rgba(0, 0, 0, .25); transition: transform .08s; }
.dpad .ArrowUp { grid-column: 2; background: var(--up); }
.dpad .ArrowLeft { grid-column: 1; grid-row: 2; background: var(--left); color: #4A3500; }
.dpad .ArrowDown { grid-column: 2; grid-row: 2; background: var(--down); }
.dpad .ArrowRight { grid-column: 3; grid-row: 2; background: var(--right); }
.dpad button.press { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.dpad button.glow { animation: glow 0.9s ease-in-out infinite; }
@keyframes glow { 50% { transform: scale(1.12); box-shadow: 0 0 0 10px #FFE27A; } }

/* ---------- Game 1: bong bóng ---------- */
.bubble { position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #FFFFFFEE 0 10%, transparent 11%), conic-gradient(from 20deg, #FF8A8A55, #FFD36E55, #8BE09B55, #7CC0FF55, #C9A2FF55, #FF8A8A55);
  border: 6px solid #FFFFFFCC; box-shadow: inset 0 0 40px #FFFFFF99, 0 10px 30px #7CC0FF55; display: grid; place-items: center; animation: float 3s ease-in-out infinite; }
.bubble .inside { width: 58%; height: 58%; opacity: .28; filter: blur(2px); transition: all .3s; }
.bubble.crack .inside { opacity: .7; filter: none; }
.bubble.crack { border-style: dashed; }
.bubble.wiggle { animation: wiggle .5s ease-in-out 3; }
.bubble.side { border-color: var(--c); }
@keyframes float { 50% { transform: translateY(-14px); } }
@keyframes wiggle { 25% { transform: rotate(-6deg) scale(1.12); } 75% { transform: rotate(6deg) scale(1.12); } }
.friend { position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); animation: popin .5s cubic-bezier(.2, 1.6, .5, 1) both; }
.friend.leave { transition: all 1s ease-in; }
.spark { position: absolute; width: 18px; height: 18px; border-radius: 50%; pointer-events: none; animation: spark .8s ease-out forwards; }
@keyframes popin { from { transform: scale(.2); opacity: 0; } }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

/* ---------- Game 2: vườn trái cây ---------- */
.tree { position: absolute; left: 50%; top: 4%; height: 88%; aspect-ratio: 1.35; max-width: 92vw; transform: translateX(-50%); }
.tree .crown { position: absolute; inset: 0 0 18% 0; border-radius: 48% 48% 42% 42%; background: radial-gradient(circle at 30% 30%, #8BD48F, #4FAE57 70%); border: 7px solid #2F7A38; }
.tree .trunk { position: absolute; left: 46%; width: 8%; bottom: 0; height: 22%; background: #8A5A34; border: 6px solid var(--wood); border-radius: 12px 12px 0 0; }
.fruit { position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); border: 0; background: none; padding: 0; transition: transform .2s; }
.fruit::before { content: ""; position: absolute; inset: -24px; border-radius: 50%; }
.fruit.hover { transform: scale(1.15); filter: drop-shadow(0 0 10px #FFF) drop-shadow(0 0 4px #FFF); }
.fruit.hint { animation: wiggle .6s ease-in-out infinite; filter: drop-shadow(0 0 14px #FFE27A) drop-shadow(0 0 6px #FFE27A); }
.fruit.nope { animation: wiggle .5s ease-in-out 2; }
.fruit.fly { transition: left .7s cubic-bezier(.3, -0.4, .7, 1), top .7s cubic-bezier(.5, 0, .9, .5), transform .7s; pointer-events: none; transform: scale(.6); }
.basket { position: absolute; bottom: 1%; left: 50%; width: 150px; height: 150px; transform: translateX(-50%); }

/* ---------- Game 3: kho báu ---------- */
.board { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; gap: 6px; padding: 10px; background: #B88B5A; border: 6px solid var(--wood); border-radius: 24px; }
.cell { width: var(--c); height: var(--c); border-radius: 14px; background: #A7DB98; display: grid; place-items: center; position: relative; transition: background .3s; }
.cell:nth-child(odd) { background: #B6E3A8; }
.cell.rock .art { width: 80%; height: 80%; }
.cell.goal .art { width: 78%; height: 78%; animation: breathe2 1.6s ease-in-out infinite; }
.cell.hint { background: var(--hc) !important; animation: glow 0.9s ease-in-out infinite; }
@keyframes breathe2 { 50% { transform: scale(1.08); } }
.walker { position: absolute; width: var(--c); height: var(--c); transition: transform .25s cubic-bezier(.3, 1.4, .6, 1); pointer-events: none; display: grid; place-items: center; }
.walker.bump { animation: bump .3s; }
@keyframes bump { 40% { translate: var(--bx) var(--by); } }

/* ---------- Game 4: rắn ---------- */
.snakecv { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Thưởng, nghỉ, tiếp tục ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: #FFFDF5F2; z-index: 20; text-align: center; animation: fade .4s; }
.overlay .box { display: grid; gap: 3vmin; justify-items: center; }
.overlay .msg { font-size: clamp(30px, 4.5vw, 54px); font-weight: 800; color: var(--wood); margin: 0; }
.sticker { width: min(26vmin, 220px); aspect-ratio: 1; border-radius: 50%; background: #FFF; border: 8px dashed var(--left); display: grid; place-items: center; animation: popin .6s cubic-bezier(.2, 1.6, .5, 1) both; }
.sticker .art { width: 70%; height: 70%; }
.row { display: flex; gap: 4vmin; justify-content: center; align-items: center; flex-wrap: wrap; }
.big { width: 140px; height: 140px; border-radius: 40px; border: 6px solid var(--wood); display: grid; place-items: center; box-shadow: 0 8px 0 var(--wood); padding: 22px; }
.big.go { background: var(--right); }
.big.home { background: #FFF; width: 112px; height: 112px; }
.big svg { width: 100%; height: 100%; }
.confetti { position: fixed; top: -20px; width: 14px; height: 20px; border-radius: 4px; animation: fall linear forwards; z-index: 21; pointer-events: none; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes fade { from { opacity: 0; } }
.rest { background: var(--grass); place-items: center; text-align: center; transition: background 2s; }
.rest.night { background: radial-gradient(circle at 50% 40%, #2C3A7A, var(--night) 70%); color: #F2F4FF; }
.rest .msg { font-size: clamp(30px, 4.6vw, 56px); font-weight: 800; margin: 0; max-width: 18ch; }
.rest .moves { font-size: clamp(22px, 3vw, 34px); }
.twinkle { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #FFF6C8; animation: tw 3s ease-in-out infinite; }
@keyframes tw { 50% { opacity: .2; } }
.resume { z-index: 30; }

/* ---------- Cổng phụ huynh & khu phụ huynh (chữ thường, cho người lớn) ---------- */
.gate { z-index: 40; background: #FFFFFFF5; font-family: var(--fp); }
.gate .q { font-size: 24px; font-weight: 600; color: #222; }
.gate .opts { display: flex; gap: 16px; }
.gate .opts button { font-size: 26px; width: 90px; height: 72px; border-radius: 16px; border: 2px solid #444; background: #FFF; cursor: pointer; }
.gate .cancel { font-size: 17px; background: none; border: 0; text-decoration: underline; color: #333; cursor: pointer; }
.parent { position: fixed; inset: 0; overflow: auto; background: #F7F8F6; font-family: var(--fp); color: #1D2320; z-index: 35; padding: 24px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }
.parent .in { max-width: 920px; margin: 0 auto; display: grid; gap: 20px; }
.parent h1 { font-size: 26px; margin: 0; }
.parent h2 { font-size: 18px; margin: 0 0 10px; }
.parent section { background: #FFF; border: 1px solid #A9B3AD; border-radius: 14px; padding: 18px 20px; }
.parent .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; }
.parent label { display: grid; gap: 6px; font-size: 15px; font-weight: 600; }
.parent select, .parent input[type=range] { font-size: 16px; padding: 6px; }
.parent .chk { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.parent .chk input { width: 20px; height: 20px; }
.parent .btns { display: flex; flex-wrap: wrap; gap: 10px; }
.parent .btn { font: 600 15px/1 var(--fp); padding: 12px 16px; border-radius: 10px; border: 1.5px solid #3D4A43; background: #FFF; color: #1D2320; cursor: pointer; }
.parent .btn.main { background: #1B5E2A; border-color: #1B5E2A; color: #FFF; }
.parent .btn.warn { border-color: #A3191E; color: #A3191E; }
.parent .muted { color: #4D5852; font-size: 14px; }
.parent .words { display: flex; flex-wrap: wrap; gap: 8px; }
.parent .wbtn { display: flex; align-items: center; gap: 8px; border: 1.5px solid #A9B3AD; border-radius: 999px; padding: 4px 14px 4px 6px; background: #FFF; font: 600 15px var(--fp); cursor: pointer; }
.parent .wbtn img { width: 30px; height: 30px; }
.parent ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.parent .stat { font-size: 28px; font-weight: 700; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (max-width: 700px) { .map .islands { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
