:root {
  --hong: #f06292;
  --hong-dam: #d81b60;
  --hong-nhat: #fff0f5;
  --hong-vua: #fcd5e3;
  --chu: #5a2a3c;
  --chu-nhat: #9a6b7c;
  --xanh: #43a047;
  --vang: #ffc107;
  --bong: 0 6px 18px rgba(216, 27, 96, .18);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--hong-nhat);
  color: var(--chu);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button { font: inherit; color: inherit; border: 0; cursor: pointer; touch-action: manipulation; }
img { -webkit-user-drag: none; }

/* Thanh trên */
#thanh { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; min-height: 48px; }
#thanh.an { visibility: hidden; }
#tien-do { display: flex; gap: 6px; }
#tien-do span { width: 14px; height: 14px; border-radius: 50%; background: var(--hong-vua); }
#tien-do span.xong { background: var(--hong); }
#tien-do span.dang { background: var(--hong-dam); transform: scale(1.3); }
#nut-ph { display: flex; gap: 8px; }
.nho { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--chu-nhat); font-size: 16px; opacity: .75; box-shadow: 0 2px 6px rgba(0,0,0,.08); }

/* Sân khấu */
#san { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px 20px; min-height: 0; overflow: hidden; }
.the { background: #fff; border-radius: 32px; box-shadow: var(--bong); overflow: hidden; }
.hinh-to { width: min(78vw, 46dvh, 420px); aspect-ratio: 1; display: block; }
.hinh-to img, .hinh-doi img, .o-chon img, .the > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hinh-doi { display: flex; gap: 12px; }
.hinh-doi .the { width: min(42vw, 36dvh, 220px); aspect-ratio: 1; }
.tu-en { font-size: clamp(44px, 13vw, 72px); font-weight: 800; color: var(--hong-dam); line-height: 1; text-align: center; }
.ipa { font-size: 18px; color: var(--chu-nhat); margin-top: -4px; }
.tu-vi { font-size: 20px; color: var(--chu-nhat); }
.cau-en { font-size: clamp(26px, 7.5vw, 40px); font-weight: 800; color: var(--hong-dam); text-align: center; line-height: 1.15; }
.cau-vi { font-size: 18px; color: var(--chu-nhat); text-align: center; }

/* Nút */
.nut-to { width: 150px; height: 150px; border-radius: 50%; background: var(--hong); color: #fff; font-size: 64px; box-shadow: 0 10px 0 var(--hong-dam), var(--bong); }
.nut-to:active { transform: translateY(6px); box-shadow: 0 4px 0 var(--hong-dam); }
.nut-sao { min-width: 240px; padding: 18px 28px; border-radius: 40px; background: var(--vang); color: #5a3b00; font-size: 26px; font-weight: 800; box-shadow: 0 8px 0 #e0a000; }
.nut-sao:active { transform: translateY(5px); box-shadow: 0 3px 0 #e0a000; }
.nut-chu { padding: 12px 22px; border-radius: 24px; background: #fff; color: var(--chu); font-size: 18px; font-weight: 700; box-shadow: var(--bong); }
.nut-chu.chinh { background: var(--hong); color: #fff; }
.nut-loa { width: 64px; height: 64px; border-radius: 50%; background: #fff; font-size: 30px; box-shadow: var(--bong); }

/* Màn mở đầu */
.logo { width: min(64vw, 38dvh, 300px); }
.ten-app { font-size: 30px; font-weight: 800; color: var(--hong-dam); text-align: center; }
.chu-nho { font-size: 15px; color: var(--chu-nhat); text-align: center; }

/* Nghe chọn ảnh */
.luoi-chon { display: grid; gap: 14px; width: 100%; max-width: 460px; justify-items: center; }
.luoi-chon.c2 { grid-template-columns: 1fr 1fr; }
.luoi-chon.c3 { grid-template-columns: 1fr 1fr; }
.luoi-chon.c3 > :last-child { grid-column: 1 / -1; }
.o-chon { width: 100%; max-width: min(42vw, 28dvh, 210px); aspect-ratio: 1; padding: 0; border: 6px solid transparent; transition: transform .15s; }
.o-chon:active { transform: scale(.96); }
.o-chon.dung { border-color: var(--xanh); animation: nay .5s; }
.o-chon.sai { animation: lac .4s; opacity: .45; }

/* Vận động */
.dem-nguoc { font-size: 120px; font-weight: 900; color: var(--hong-dam); line-height: 1; animation: phong .9s; }
.cham-dem { display: flex; gap: 10px; }
.cham-dem span { width: 44px; height: 44px; border-radius: 50%; background: var(--hong-vua); display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff; }
.cham-dem span.sang { background: var(--hong); animation: nay .35s; }
.vo-tay { font-size: 72px; animation: nay .5s infinite alternate; }
.thanh-cho { width: min(70vw, 300px); height: 10px; border-radius: 5px; background: var(--hong-vua); overflow: hidden; }
.thanh-cho i { display: block; height: 100%; width: 0; background: var(--hong); }
.nhun { animation: nhun 1s ease-in-out infinite; }
.nhac-ph { background: #fff; border-radius: 24px; padding: 18px 20px; box-shadow: var(--bong); max-width: 420px; text-align: center; font-size: 19px; line-height: 1.4; }

/* Sticker */
.sticker { width: min(60vw, 36dvh, 280px); aspect-ratio: 1; border-radius: 50%; border: 10px solid #fff; box-shadow: 0 0 0 6px var(--vang), var(--bong); overflow: hidden; animation: xoay-vao .9s cubic-bezier(.2, 1.4, .4, 1); }
.sticker img { width: 100%; height: 100%; object-fit: cover; }
.sao-bay { position: fixed; font-size: 40px; pointer-events: none; animation: bay 1.1s ease-out forwards; }

/* Phụ huynh */
#san.cuon { justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.ph { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 14px; padding-bottom: 24px; }
.ph h2 { margin: 4px 0; font-size: 24px; color: var(--hong-dam); text-align: center; }
.ph .tom-tat { background: #fff; border-radius: 18px; padding: 12px 16px; box-shadow: var(--bong); font-size: 16px; line-height: 1.5; }
.ph fieldset { border: 0; margin: 0; padding: 12px 14px; background: #fff; border-radius: 18px; box-shadow: var(--bong); }
.ph legend { float: left; width: 100%; font-weight: 700; margin-bottom: 8px; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; clear: both; }
.chips button { padding: 9px 14px; border-radius: 20px; background: var(--hong-nhat); font-size: 15px; border: 2px solid var(--hong-vua); }
.chips button.chon { background: var(--hong); color: #fff; border-color: var(--hong); }
.ph textarea { width: 100%; min-height: 70px; border-radius: 12px; border: 2px solid var(--hong-vua); padding: 8px; font: inherit; font-size: 15px; }
.ph .hang-nut { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ph .bao { text-align: center; color: var(--xanh); font-weight: 700; min-height: 1.4em; }

/* Lớp phủ tạm dừng */
.lop { position: fixed; inset: 0; background: rgba(90, 42, 60, .55); display: grid; place-items: center; z-index: 10; }
.lop[hidden] { display: none; }
.hop-thoai { background: var(--hong-nhat); border-radius: 28px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 260px; }
.tieu-de-nho { margin: 0; font-size: 20px; font-weight: 700; }

/* Hiệu ứng */
.vao { animation: vao .35s ease-out; }
@keyframes vao { from { opacity: 0; transform: scale(.92); } }
@keyframes nay { 50% { transform: scale(1.08); } }
@keyframes lac { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
@keyframes phong { from { transform: scale(.3); opacity: 0; } }
@keyframes nhun { 50% { transform: translateY(-10px) scale(1.02); } }
@keyframes xoay-vao { from { transform: scale(0) rotate(-200deg); } }
@keyframes bay { to { transform: translateY(-160px) scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* Gợi ý tiếng Việt cho phụ huynh + đếm */
.goi-y { font-size: 14px; color: var(--chu-nhat); text-align: center; max-width: 340px; line-height: 1.35; opacity: .9; }
.cham-dem { flex-wrap: wrap; justify-content: center; max-width: 250px; }
.cham-dem span { width: 40px; height: 40px; font-size: 19px; }
.so-dem { font-size: 34px; font-weight: 800; color: var(--hong-dam); min-height: 1.2em; }

/* ===== Màn vận động: đọc được từ xa 2–3 m ===== */
:root { --chu-dam: #2a0b18; --en-dam: #8a0c3c; }
.man-vd { width: calc(100% + 16px); margin: 0 -8px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6dvh; }
.mau-vd { display: flex; gap: 12px; justify-content: center; }
.mau-vd .the { width: min(66vw, 30dvh); aspect-ratio: 1; }
.mau-vd.doi .the { width: min(42vw, 24dvh); }
.vd-vi, .vd-en { width: 100%; text-align: center; font-style: normal; overflow-wrap: break-word; opacity: 1; }
.vd-vi { color: var(--chu-dam); font-weight: 900; letter-spacing: -.015em; }
.vd-en { color: var(--en-dam); font-weight: 800; }
.dem-nguoc { font-size: min(42dvh, 72vw); font-weight: 900; color: var(--chu-dam); line-height: 1; }
.dem-vo { font-size: min(36dvh, 64vw); color: var(--en-dam); }
.man-vd .nut-sao { font-size: 26px; margin-top: 4px; }

/* ===== Màn chọn bài ===== */
.chon-bai { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.chon-bai h2 { margin: 0; color: var(--hong-dam); font-size: 30px; }
.luoi-bai { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.o-bai { position: relative; padding: 10px 10px 8px; border-radius: 26px; background: #fff; box-shadow: var(--bong); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.o-bai .anh { width: 100%; aspect-ratio: 1; border-radius: 18px; overflow: hidden; position: relative; }
.o-bai .anh img { width: 100%; height: 100%; object-fit: contain; display: block; }
.o-bai .ten { font-size: 22px; font-weight: 800; color: var(--chu-dam); }
.o-bai.mo { border: 4px solid var(--hong); }
.o-bai.khoa .anh img { filter: blur(2.5px) brightness(.72) saturate(.7); opacity: .8; }
.o-bai.khoa .o-khoa { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; }
.o-bai.khoa .ten { color: var(--chu-nhat); }
.o-bai.rung { animation: rung .35s; }
@keyframes rung { 20% { transform: translateX(-6px) rotate(-1deg); } 40% { transform: translateX(6px) rotate(1deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* ===== Cài đặt ===== */
.cai-dat { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.cai-dat h2 { margin: 0; text-align: center; color: var(--hong-dam); }
.cai-dat .muc { background: #fff; border-radius: 18px; padding: 14px 16px; box-shadow: var(--bong); }
.cai-dat .muc b { display: block; margin-bottom: 10px; font-size: 18px; }
.cai-dat .xem-thu { margin-top: 12px; color: var(--chu-dam); font-weight: 900; text-align: center; line-height: 1.12; }
.hang-goc { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.man-vd.vao, .dem-nguoc.vao { animation: none; }

/* Nghe chọn – chọn đúng: từ tiếng Anh chữ thường rất to + IPA */
.tu-dung { width: 100%; text-align: center; font-weight: 900; color: var(--chu-dam); line-height: 1.1; }
.ipa-dung { font-size: clamp(26px, 4.5dvh, 40px); color: var(--en-dam); font-weight: 600; }

/* Menu chính */
.menu { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 380px; }
.menu .logo { width: min(52vw, 30dvh, 240px); }
.nut-menu { position: relative; overflow: hidden; width: 100%; min-height: 72px; border-radius: 36px; background: #fff; color: var(--chu-dam); font-size: 28px; font-weight: 800; box-shadow: 0 6px 0 var(--hong-vua), var(--bong); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
.nut-menu:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--hong-vua); }
.nut-menu.chinh { background: var(--hong); color: #fff; box-shadow: 0 8px 0 var(--hong-dam), var(--bong); min-height: 88px; font-size: 32px; }
.nut-menu .chu { position: relative; }
.vach-giu { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--hong-vua); }
#goi-y-giu { margin-top: -8px; }
#goi-y-giu.rung { animation: rung .35s; color: var(--hong-dam); font-weight: 700; }

/* Cài đặt – thanh kéo */
.cai-dat input[type=range] { width: 100%; height: 36px; accent-color: var(--hong); }
.cai-dat .muc b span { color: var(--hong-dam); }
