/* App học vui — giao diện hoạt hình. Được dùng hiệu ứng (ngoại lệ Ben chốt cho app này). */
:root {
  --sky1: #8fd3ff; --sky2: #c9f0ff; --grass: #7ed957; --grass2: #4fb83a;
  --ink: #2b2140; --ink2: #5a4e75; --white: #fff;
  --pri: #ff7a59; --pri2: #ff5a36; --sun: #ffd23f; --mint: #3ccf9e; --grape: #8a5cf6; --berry: #ff4f8b;
  --ok: #2fbf71; --bad: #ff6b6b;
  --r: 22px; --shadow: 0 6px 0 rgba(43, 33, 64, .18), 0 12px 24px rgba(43, 33, 64, .12);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--font); color: var(--ink); background: linear-gradient(180deg, var(--sky1), var(--sky2) 60%, #e9fbff);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  overflow: hidden;
}
input, textarea, select { -webkit-user-select: text; user-select: text; font-family: inherit; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
#app { position: fixed; inset: 0; overflow: hidden; }
.screen {
  position: absolute; inset: 0; z-index: 1; /* eng-1.1 9c: cả màn luôn nằm TRÊN lớp mây (mây không đè thẻ linh vật) */ display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + 14px);
  animation: screenIn .32s cubic-bezier(.2, .9, .3, 1.2) both;
}
.screen.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
@keyframes screenIn { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }

/* Mây trôi nền */
.clouds { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud { position: absolute; width: 140px; height: 46px; background: #fff; border-radius: 40px; opacity: .85; animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 60px; height: 60px; left: 20px; top: -28px; }
.cloud::after { width: 46px; height: 46px; left: 70px; top: -18px; }
@keyframes drift { from { transform: translateX(-180px); } to { transform: translateX(110vw); } }
.screen > * { position: relative; z-index: 1; }

/* Chữ */
h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: .2px; }
.title { font-size: clamp(26px, 7vw, 40px); text-align: center; color: var(--ink); text-shadow: 0 3px 0 rgba(255, 255, 255, .7); }
.sub { text-align: center; color: var(--ink2); font-size: 17px; font-weight: 700; }
.muted { color: var(--ink2); font-size: 14px; }

/* Nút kiểu game: nổi 3D, ấn xuống */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; font-size: 19px; font-weight: 900;
  background: linear-gradient(180deg, #ff9a7a, var(--pri)); color: #fff; box-shadow: 0 6px 0 #d9472a, 0 10px 20px rgba(217, 71, 42, .3);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #d9472a, 0 4px 8px rgba(217, 71, 42, .25); }
.btn.green { background: linear-gradient(180deg, #5fe0a8, var(--mint)); box-shadow: 0 6px 0 #1f9d72, 0 10px 20px rgba(31, 157, 114, .3); }
.btn.green:active { box-shadow: 0 1px 0 #1f9d72; }
.btn.purple { background: linear-gradient(180deg, #a98bff, var(--grape)); box-shadow: 0 6px 0 #5b36c4, 0 10px 20px rgba(91, 54, 196, .3); }
.btn.purple:active { box-shadow: 0 1px 0 #5b36c4; }
.btn.white { background: #fff; color: var(--ink); box-shadow: 0 6px 0 #c9d6e3, 0 10px 18px rgba(43, 33, 64, .12); }
.btn.white:active { box-shadow: 0 1px 0 #c9d6e3; }
.btn.small { min-height: 44px; font-size: 16px; padding: 0 16px; }
.btn.danger { background: linear-gradient(180deg, #ff8f8f, var(--bad)); box-shadow: 0 6px 0 #c94545; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 50px; height: 50px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: 0 5px 0 #c9d6e3, 0 8px 16px rgba(43, 33, 64, .12); flex: none;
}
.icon-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c9d6e3; }

/* Thanh trên */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 54px; }
.topbar .grow { flex: 1; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 900; box-shadow: 0 4px 0 #c9d6e3; white-space: nowrap; }
.timebar { height: 12px; border-radius: 8px; background: rgba(255, 255, 255, .7); overflow: hidden; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .08); }
.timebar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--sun)); border-radius: 8px; transition: width .6s; }

/* Linh vật */
.mascot { position: relative; display: inline-block; }
.mascot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.mascot .m-body { transform-origin: 50% 95%; transform-box: view-box; }
.mascot .eyes-happy, .mascot .eyes-closed { display: none; }
.mascot.st-happy .eyes-open, .mascot.st-cheer .eyes-open { display: none; }
.mascot.st-happy .eyes-happy, .mascot.st-cheer .eyes-happy { display: inline; }
.mascot.st-rest .eyes-open, .mascot.st-sleep .eyes-open { display: none; }
.mascot.st-rest .eyes-closed, .mascot.st-sleep .eyes-closed { display: inline; }
.mascot .m-shadow { transform-origin: 50% 50%; transform-box: fill-box; }
.mascot.st-idle .m-body { animation: breathe 2.6s ease-in-out infinite; }
.mascot.st-hello .m-body { animation: bob 1s ease-in-out infinite; }
.mascot.st-hello .m-wave { animation: wave .5s ease-in-out infinite alternate; transform-origin: var(--wave-origin, 50% 50%); transform-box: view-box; }
.mascot.st-happy .m-body { animation: jump .55s cubic-bezier(.3, .6, .4, 1) infinite; }
.mascot.st-happy .m-shadow { animation: shadowJump .55s cubic-bezier(.3, .6, .4, 1) infinite; }
.mascot.st-cheer .m-body { animation: nod .7s ease-in-out infinite; }
.mascot.st-rest .m-body { animation: sway 3s ease-in-out infinite; }
.mascot.st-sleep .m-body { animation: breathe 3.6s ease-in-out infinite; }
.mascot .zzz { display: none; }
.mascot.st-sleep .zzz { display: inline; }
.mascot .zzz text { animation: zzz 2.4s ease-in infinite; font-weight: 900; fill: #5a4e75; }
.mascot .zzz text:nth-child(2) { animation-delay: .8s; }
.mascot .zzz text:nth-child(3) { animation-delay: 1.6s; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.02, .975); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes wave { from { transform: rotate(-18deg); } to { transform: rotate(14deg); } }
@keyframes jump { 0%, 100% { transform: translateY(0) scale(1.04, .94); } 40% { transform: translateY(-34px) scale(.96, 1.05); } 60% { transform: translateY(-30px) rotate(4deg); } }
@keyframes shadowJump { 0%, 100% { transform: scale(1); opacity: .25; } 45% { transform: scale(.6); opacity: .12; } }
@keyframes nod { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 60% { transform: rotate(5deg); } }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(18px, -40px) scale(1.2); } }

.bubble {
  position: relative; background: #fff; border-radius: 22px; padding: 12px 16px; font-weight: 800; font-size: 18px; line-height: 1.3;
  box-shadow: 0 5px 0 #c9d6e3, 0 10px 20px rgba(43, 33, 64, .1); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}
.bubble::after { content: ""; position: absolute; left: 30px; bottom: -14px; border: 9px solid transparent; border-top: 12px solid #fff; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* Chọn bé: sân khấu 3D */
.stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: clamp(10px, 5vw, 60px); perspective: 900px; }
.kid-card {
  position: relative; width: min(42vw, 300px); padding: 12px 10px 16px; border-radius: 30px; background: rgba(255, 255, 255, .88); /* eng-1.1 9c: thẻ đục hơn → mây phía sau không lộ qua thẻ */
  box-shadow: var(--shadow); transform-style: preserve-3d; transform: rotateX(8deg); transition: transform .2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px; animation: float 3.4s ease-in-out infinite;
}
.kid-card:nth-child(2) { animation-delay: -1.7s; }
.kid-card:active { transform: rotateX(0) scale(.96); }
.kid-card .mascot { width: 100%; aspect-ratio: 200 / 220; }
.kid-card .name { font-size: clamp(18px, 5vw, 26px); font-weight: 900; text-align: center; overflow-wrap: anywhere; }
.kid-card .who { font-size: 14px; font-weight: 800; color: var(--ink2); }
.pedestal { width: 80%; height: 22px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(43, 33, 64, .25), transparent 70%); margin-top: -8px; }
@keyframes float { 0%, 100% { transform: rotateX(8deg) translateY(0); } 50% { transform: rotateX(8deg) translateY(-8px); } }
.ground { position: fixed; left: -10%; right: -10%; bottom: -60px; height: 34vh; background: radial-gradient(ellipse at 50% 0, var(--grass), var(--grass2)); border-radius: 50% 50% 0 0; z-index: 0; }

/* Ô môn học */
.subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 10px 0; perspective: 800px; }
.subject {
  position: relative; min-height: 150px; border-radius: 28px; padding: 16px; color: #fff; font-weight: 900; font-size: 24px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; box-shadow: var(--shadow); text-align: left;
  transform: rotateX(6deg); transform-style: preserve-3d; overflow: hidden;
}
.subject .emoji { position: absolute; right: 10px; top: 4px; font-size: 64px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .15)); animation: float2 3s ease-in-out infinite; }
@keyframes float2 { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.subject.en { background: linear-gradient(135deg, #ff9a7a, #ff5a8a); }
.subject.math { background: linear-gradient(135deg, #7ad7ff, #5b7cff); }
.subject.new { background: linear-gradient(135deg, #c3b5ff, #8a5cf6); }
.subject.locked { filter: grayscale(.55); opacity: .8; }
.subject .lock { font-size: 15px; background: rgba(0, 0, 0, .25); border-radius: 999px; padding: 4px 10px; align-self: flex-start; }
.subject:active:not(.locked) { transform: rotateX(0) scale(.97); }

/* Bản đồ phiêu lưu */
.map { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 2px 40px; perspective: 1000px; }
.island {
  position: relative; margin: 18px auto 34px; max-width: 640px; border-radius: 40px; padding: 18px 14px 22px;
  background: linear-gradient(180deg, #a6ec7c, #6fcf4b); box-shadow: 0 14px 0 #4f9e34, 0 26px 40px rgba(43, 33, 64, .18);
  transform: rotateX(14deg); transform-style: preserve-3d;
}
.island::before { content: ""; position: absolute; inset: 10px; border-radius: 32px; border: 3px dashed rgba(255, 255, 255, .5); pointer-events: none; }
.island h3 { color: #fff; font-size: 22px; text-shadow: 0 3px 0 rgba(0, 0, 0, .18); text-align: center; overflow-wrap: anywhere; }
.island .topic { text-align: center; color: #1e5f12; font-weight: 800; font-size: 14px; }
.island.ai { background: linear-gradient(180deg, #ffd88a, #ffb347); box-shadow: 0 14px 0 #d98b1c, 0 26px 40px rgba(43, 33, 64, .18); }
.island.ai .topic { color: #7a4a00; }
.nodes { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 10px; margin-top: 12px; }
.node { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.node .dot {
  width: 66px; height: 66px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px;
  box-shadow: 0 6px 0 #c9d6e3, 0 10px 18px rgba(43, 33, 64, .18); transform: translateZ(20px);
}
.node:nth-child(odd) .dot { animation: float2 3.2s ease-in-out infinite; }
.node:nth-child(even) .dot { animation: float2 3.2s ease-in-out -1.6s infinite; }
.node.done .dot { background: linear-gradient(180deg, #fff6c9, #ffe27a); }
.node:active .dot { transform: translateY(4px); box-shadow: 0 2px 0 #c9d6e3; }
.node .lbl { /* eng-1.1 9d: ≥ 13 px, đậm, chữ tối trên nhãn trắng — đọc rõ trên nền xanh ở khung 375 */
  font-size: 14px; font-weight: 900; color: #2b2140; background: rgba(255, 255, 255, .94); padding: 2px 7px; border-radius: 10px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .12); text-align: center; line-height: 1.15; max-width: 96px; }
.stars { display: inline-flex; gap: 1px; font-size: 14px; letter-spacing: -1px; }
.stars .off { filter: grayscale(1); opacity: .35; }

/* Khung game */
.game { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.game-area { position: relative; flex: 1; min-height: 0; border-radius: 28px; background: rgba(255, 255, 255, .45); box-shadow: inset 0 3px 10px rgba(43, 33, 64, .08); overflow: hidden; }
.prompt-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 10px; min-height: 60px; }
.prompt-word { font-size: 28px; font-weight: 900; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .7); }
.dots i.on { background: var(--mint); }
.corner-mascot { width: 58px; height: 64px; flex: none; pointer-events: none; margin-top: -6px; }

/* Bắt từ rơi */
.faller {
  position: absolute; top: 0; left: 0; width: 112px; min-height: 112px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #fff, #e3f6ff 60%, #b9e6ff); box-shadow: 0 6px 16px rgba(43, 33, 64, .18), inset 0 -6px 0 rgba(91, 124, 255, .15);
  will-change: transform; font-weight: 900; font-size: 18px;
}
.faller .ic { font-size: 44px; line-height: 1; }
.faller.pop { animation: popOut .35s ease-out forwards; }
.faller.shake { animation: shake .4s; }
@keyframes popOut { to { transform: var(--t) scale(1.6); opacity: 0; } }
@keyframes shake { 0%, 100% { margin-left: 0; } 25% { margin-left: -10px; } 75% { margin-left: 10px; } }

/* Lật thẻ 3D */
.cards { display: grid; gap: 10px; padding: 10px; height: 100%; align-content: center; perspective: 900px; }
.card3d { position: relative; cursor: pointer; aspect-ratio: 3 / 4; max-height: 100%; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3, 1.3, .5, 1); }
.card3d.flip { transform: rotateY(180deg); }
/* chốt chặn: kể cả máy không ẩn được mặt sau, mặt trước chỉ hiện khi thẻ đã lật quá nửa */
.card3d .front { visibility: hidden; transition: visibility 0s .2s; }
.card3d.flip .front { visibility: visible; }
.card3d.flip .back { visibility: hidden; transition: visibility 0s .2s; }
.card3d .face {
  position: absolute; inset: 0; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 900; box-shadow: 0 5px 0 rgba(43, 33, 64, .15);
}
.card3d .back { background: repeating-linear-gradient(45deg, #8a5cf6, #8a5cf6 10px, #9d77f8 10px, #9d77f8 20px); color: #fff; font-size: 34px; border: 4px solid #fff; }
.card3d .front { background: #fff; transform: rotateY(180deg); font-size: clamp(16px, 4.6vw, 26px); padding: 4px; overflow-wrap: anywhere; }
.card3d .front .ic { font-size: clamp(36px, 11vw, 60px); }
.card3d.matched .front { background: linear-gradient(180deg, #e8fff3, #bff3d8); }
.card3d.matched { animation: matched .5s; }
@keyframes matched { 50% { transform: rotateY(180deg) scale(1.08); } }

/* Nghe chọn hình */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 14px; height: 100%; align-content: center; }
.choice {
  border-radius: 26px; background: #fff; box-shadow: 0 7px 0 #c9d6e3, 0 12px 20px rgba(43, 33, 64, .1); min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 64px;
}
.choice .w { font-size: 18px; font-weight: 900; visibility: hidden; }
.choice.right { background: linear-gradient(180deg, #e8fff3, #a9f0cb); animation: pop .4s; }
.choice.right .w { visibility: visible; }
.choice.wrong { animation: shake .4s; background: #ffe9e9; }
.choice:active { transform: translateY(5px); box-shadow: 0 2px 0 #c9d6e3; }

/* Quái vật ăn chữ */
.monster-wrap { display: flex; justify-content: center; align-items: flex-end; height: 42%; min-height: 150px; }
.monster { height: 100%; aspect-ratio: 1; }
.monster .mouth-open { display: none; }
.monster.hungry .mouth-open { display: inline; }
.monster.hungry .mouth-closed { display: none; }
.monster.chomp .m-body { animation: chomp .5s ease-in-out 2; transform-origin: 50% 90%; transform-box: view-box; }
.monster.happy .m-body { animation: jump .6s ease-in-out 2; transform-box: view-box; transform-origin: 50% 90%; }
@keyframes chomp { 50% { transform: scale(1.1, .9); } }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px; min-height: 64px; }
.slot { min-width: 64px; height: 50px; border-radius: 14px; border: 3px dashed rgba(43, 33, 64, .25); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; padding: 0 10px; }
.slot.filled { border: 0; background: var(--sun); box-shadow: 0 4px 0 #d9a514; animation: pop .3s; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 10px; }
.tile {
  min-width: 70px; height: 56px; padding: 0 14px; border-radius: 16px; background: #fff; font-size: 22px; font-weight: 900;
  box-shadow: 0 6px 0 #c9d6e3, 0 10px 16px rgba(43, 33, 64, .12); touch-action: none; display: flex; align-items: center; justify-content: center;
}
.tile.drag { position: fixed; z-index: 50; transform: scale(1.12) rotate(-3deg); box-shadow: 0 14px 24px rgba(43, 33, 64, .3); pointer-events: none; }
.tile.ghost { opacity: .25; }
.tile.used { visibility: hidden; }
.tile.bounce { animation: shake .4s; }

/* Truyện */
.story { background: #fffdf5; border-radius: 26px; padding: 18px; box-shadow: var(--shadow); font-size: clamp(20px, 5vw, 28px); line-height: 1.6; font-weight: 700; }
.story .tw { border-radius: 8px; padding: 0 2px; }
.story .tw:active, .story .tw.hl { background: var(--sun); }
.story .vi { margin-top: 12px; font-size: 17px; color: var(--ink2); font-weight: 700; }

/* Kết quả */
.overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(43, 33, 64, .35); }
.overlay.solid { background: linear-gradient(180deg, #2b2f6b, #5a4e9c); color: #fff; }
.overlay.rest { background: linear-gradient(180deg, #ffe2b8, #ffc6d9); }
.panel { width: min(520px, 100%); background: #fff; border-radius: 34px; padding: 22px 18px; text-align: center; box-shadow: var(--shadow); animation: pop .4s cubic-bezier(.2, 1.4, .4, 1) both; display: flex; flex-direction: column; align-items: center; gap: 12px; max-height: 100%; overflow-y: auto; }
.big-stars { font-size: 64px; display: flex; gap: 6px; justify-content: center; }
.big-stars span { animation: starIn .5s cubic-bezier(.2, 1.6, .4, 1) both; display: inline-block; }
.big-stars span:nth-child(2) { animation-delay: .25s; }
.big-stars span:nth-child(3) { animation-delay: .5s; }
.big-stars .off { filter: grayscale(1); opacity: .3; }
@keyframes starIn { from { transform: scale(0) rotate(-180deg); } to { transform: none; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 1.8s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.countdown { font-size: 56px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* PIN */
.pinpad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.pinpad button { height: 66px; border-radius: 22px; background: #fff; font-size: 28px; font-weight: 900; box-shadow: 0 5px 0 #c9d6e3; }
.pinpad button:active { transform: translateY(4px); box-shadow: 0 1px 0 #c9d6e3; }
.pindots { display: flex; gap: 12px; justify-content: center; margin: 8px 0; }
.pindots i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink2); }
.pindots i.on { background: var(--ink); border-color: var(--ink); }
.err { color: #c62828; font-weight: 800; min-height: 22px; text-align: center; }

/* Khu phụ huynh: gọn, dễ đọc */
.parent { background: #f4f6fb; color: #1f2333; }
.screen.parent, .parent .screen { animation: none; } /* khu phụ huynh hiện ngay */
.ptabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.ptabs::-webkit-scrollbar { display: none; }
.ptab { flex: none; padding: 10px 14px; border-radius: 999px; background: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); min-height: 44px; }
.ptab.on { background: #1f2333; color: #fff; }
.pbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 30px; }
.pcard { background: #fff; border-radius: 18px; padding: 14px; margin: 10px 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.pcard h3 { font-size: 18px; margin-bottom: 8px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #eef0f5; flex-wrap: wrap; }
.prow:first-of-type { border-top: 0; }
.prow .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-weight: 700; font-size: 14px; }
.field input, .field textarea, .inp { font-size: 17px; padding: 10px 12px; border-radius: 12px; border: 2px solid #d9deea; background: #fff; min-height: 44px; width: 100%; color: #1f2333; }
.field textarea { min-height: 90px; resize: vertical; }
.warn { background: #fff4d6; border: 2px solid #ffcf5c; border-radius: 14px; padding: 10px 12px; font-weight: 800; }
.danger-box { background: #ffe9e9; border: 2px solid #ff9a9a; border-radius: 14px; padding: 10px 12px; font-weight: 800; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 76px; height: 100px; object-fit: cover; border-radius: 10px; border: 2px solid #d9deea; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 900; }
.tag.pending { background: #fff1c2; color: #8a5a00; }
.tag.approved { background: #d4f5e2; color: #146c3c; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log td, table.log th { padding: 6px 4px; border-top: 1px solid #eef0f5; text-align: left; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.wordrow { display: grid; grid-template-columns: 54px 1fr 1fr 44px; gap: 6px; align-items: center; padding: 6px 0; border-top: 1px solid #eef0f5; }
.wordrow .inp { min-height: 40px; padding: 6px 8px; font-size: 15px; }
.wordrow .del { width: 40px; height: 40px; border-radius: 12px; background: #ffe9e9; font-size: 18px; }
.bar7 { display: flex; align-items: flex-end; gap: 6px; height: 70px; }
.bar7 div { flex: 1; background: #8a5cf6; border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.bar7 span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: #666; }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); z-index: 200; pointer-events: none; }
#toast div { background: #1f2333; color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 800; box-shadow: 0 8px 20px rgba(0, 0, 0, .25); animation: pop .3s; max-width: 86vw; text-align: center; }

.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; }
.sticker { aspect-ratio: 1; border-radius: 24px; background: #fff; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; padding: 10px; }
.sticker svg { width: 100%; height: 100%; }
.sticker.locked { background: rgba(255, 255, 255, .5); box-shadow: none; }
.sticker.locked svg { filter: grayscale(1) brightness(1.6); opacity: .35; }
.sticker.got { animation: float2 3s ease-in-out infinite; }

.center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 10px 16px; min-height: 46px; border-radius: 999px; background: #fff; font-weight: 900; font-size: 18px; box-shadow: 0 4px 0 #c9d6e3; }
.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 #c9d6e3; }
.hide { display: none !important; }

@media (min-width: 700px) {
  .faller { width: 140px; min-height: 140px; font-size: 22px; }
  .faller .ic { font-size: 58px; }
  .choice { min-height: 170px; font-size: 90px; }
  .corner-mascot { width: 74px; height: 81px; }
}
@media (prefers-reduced-motion: reduce) {
  .cloud { animation: none; }
}
