/* so.css — giao diện prototype "Hidodo · Số 0–20". Nạp SAU style.css (dùng biến --c-*, --ink, --bg của game-artist).
   Claude (Opus) viết lại 2026-10-13. Nút cho bé ≥72px; không màu đỏ cho "sai"; tôn trọng prefers-reduced-motion. */
html { color-scheme: light; }
:root { --card: #FFFDF6; --line: #E8D5B5; --muted: #7A6A5C; --radius: 20px; --lv: var(--c-green); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
svg { display: block; width: 100%; height: 100%; }
#app { max-width: 760px; margin: 0 auto; min-height: 100dvh; }
[hidden] { display: none !important; }
.muted, .note { color: var(--muted); font-size: 14px; }
.sbtn { background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 10px 16px; font-weight: 700; min-height: 48px; }
.sbtn.small { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.sbtn.warn { border-color: var(--c-orange); color: #8a4a10; }
.link { color: var(--c-blue); font-weight: 700; padding: 8px 4px; min-height: 44px; }
.icon { width: 52px; height: 52px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); font-size: 24px; }

/* ---------- giữ để bấm (về nhà / cổng phụ huynh) ---------- */
.hold { position: relative; overflow: hidden; }
.hold::after { content: ""; position: absolute; left: 0; bottom: 0; height: 6px; width: 0; background: var(--pad-ring); }
.hold.holding::after { width: 100%; transition: width var(--hold, 1500ms) linear; }

/* ---------- Nhà ---------- */
.home { padding: 12px 16px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
.logo { font-size: 28px; font-weight: 900; letter-spacing: .3px; }
.logo span { color: var(--c-orange); }
.logo.small { font-size: 20px; }
.pbtn { background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; min-height: 44px; }
.hero { display: flex; justify-content: center; gap: 8px; }
.hero .ch { width: 120px; height: 140px; }
.namebox { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 8px 0 12px; }
.namebox input, .row input:not([type=checkbox]), select { flex: 1; font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; min-height: 48px; max-width: 320px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.mode { min-height: 88px; border-radius: var(--radius); background: var(--card); border: 3px solid var(--line); font-weight: 800; font-size: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.mode span { font-size: 30px; }
.mode.on { border-color: var(--ink); background: var(--pad-glow); box-shadow: 0 4px 0 var(--ink); }
.nfcpanel { background: var(--card); border: 2px dashed var(--line); border-radius: 16px; padding: 10px 12px; margin: 8px 0 4px; }
.nfcpanel .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.rstat { font-size: 13px; color: var(--muted); }
h2.lv { margin: 22px 0 8px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
h2.lv::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--lv); border: 2px solid var(--ink); }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.ep { text-align: left; min-height: 96px; padding: 12px; border-radius: var(--radius); background: var(--card); border: 3px solid var(--lv); display: flex; flex-direction: column; gap: 4px; box-shadow: 0 3px 0 var(--lv); }
.ep b { font-size: 17px; }
.ep small { color: var(--muted); }
.ep.soon { opacity: .5; border-style: dashed; border-color: var(--line); box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px; background: var(--lv); color: #fff; font-weight: 900; border: 2px solid var(--ink); font-size: 14px; }
.chip.ghost { background: var(--card); color: var(--ink); }
.mdots { display: flex; flex-wrap: wrap; gap: 3px; }
.mdots i, .legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid var(--ink); }
.m-new { background: #D9D2C5; } .m-learning { background: var(--c-yellow); } .m-known { background: var(--c-green); }
.note { margin-top: 24px; }

/* ---------- Chơi ---------- */
.play { display: flex; flex-direction: column; min-height: 100dvh; padding: 8px 12px 12px; gap: 8px; }
.pbar { display: flex; align-items: center; gap: 8px; }
.pbar .hold { width: 56px; height: 56px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); font-size: 26px; }
.pdots { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.pdots i { width: 10px; height: 10px; border-radius: 50%; background: #E3D8C6; }
.pdots i.done { background: var(--c-green); } .pdots i.now { background: var(--pad-ring); transform: scale(1.3); }
.stage { display: flex; align-items: center; gap: 10px; }
.char { width: 96px; height: 112px; flex: none; }
.bubble { flex: 1; background: var(--card); border: 3px solid var(--ink); border-radius: 22px; padding: 10px 14px; position: relative; min-height: 64px; display: flex; flex-direction: column; justify-content: center; }
.bubble::before { content: ""; position: absolute; left: -12px; top: 26px; border: 10px solid transparent; border-right-color: var(--ink); border-left: 0; }
.subtitle { font-size: 24px; font-weight: 800; line-height: 1.2; }
.vi { font-size: 14px; color: var(--muted); margin-top: 4px; }
.scene { position: relative; flex: 1; min-height: 210px; background: #EAF6FB; border: 3px solid var(--line); border-radius: 26px; display: grid; place-items: center; padding: 12px; overflow: hidden; }
.objs.line { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.objs.dice { display: grid; grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(3, 72px); gap: 8px; }
.objs.scatter { display: grid; grid-template-columns: repeat(4, 90px); grid-template-rows: repeat(3, 90px); gap: 6px; }
.obj { width: 84px; height: 84px; border-radius: 16px; transition: transform .2s, opacity .3s, filter .3s; }
.objs.dice .obj { width: 72px; height: 72px; }
.obj.lit { background: var(--pad-glow); box-shadow: 0 0 0 4px var(--pad-ring); }
.obj.pop { animation: pop .45s ease-out; }
.obj.gone { opacity: 0; transform: scale(.4) translateY(-30px); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.28) translateY(-8px); } 100% { transform: scale(1); } }
.numcard { width: 76px; height: 96px; background: var(--card); border: 3px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 34px; font-weight: 900; gap: 4px; }
.numcard.q { background: var(--pad-glow); }
.frames { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.frame10 { display: grid; grid-template-columns: repeat(5, 54px); grid-template-rows: repeat(2, 54px); border: 4px solid var(--ink); border-radius: 10px; background: #fff; }
.fcell { border: 2px solid var(--line); display: grid; place-items: center; }
.fcell .obj { width: 44px; height: 44px; border-radius: 50%; }
.empty-plate { font-size: 120px; line-height: 1; filter: grayscale(.2); }
.cover { position: absolute; inset: 0; display: grid; place-items: center; font-size: 140px; background: #CFEAD0; border-radius: 22px; animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; } }
.input { min-height: 110px; display: flex; justify-content: center; align-items: center; }
.choices { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.choice { width: 112px; min-height: 112px; border-radius: 24px; background: var(--card); border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.choice b { font-size: 46px; line-height: 1; }
.choice:active, .ynb:active, .done:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.picked { background: var(--pad-glow) !important; }
.yn { display: flex; gap: 18px; }
.ynb { width: 136px; min-height: 136px; border-radius: 28px; border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px; }
.ynb svg { width: 72px; height: 84px; }
.ynb b { font-size: 26px; letter-spacing: 1px; }
.ynb.yes { background: #CDEFD2; } .ynb.no { background: #FFE0BF; }
.ynb.yes svg { animation: nod 1.6s ease-in-out infinite; } .ynb.no svg { animation: shake 1.6s ease-in-out infinite; }
@keyframes nod { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.give { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.gpool { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 76px; }
.gobj { width: 66px; height: 66px; background: transparent; }
.basket { min-width: 240px; min-height: 96px; border: 4px dashed var(--c-brown); border-radius: 0 0 40px 40px; background: #FFF1DC; position: relative; display: flex; align-items: flex-end; justify-content: center; padding: 6px; }
.bitems { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; position: relative; z-index: 1; }
.bitems .gobj { width: 52px; height: 52px; }
.bimg { position: absolute; right: 6px; top: 4px; font-size: 26px; opacity: .5; }
.done { width: 96px; height: 96px; border-radius: 50%; background: var(--c-green); color: #fff; font-size: 48px; font-weight: 900; border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink); }
.hint { font-size: 48px; animation: nod 1.4s infinite; }
.tpr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.tpr .verb { font-size: 54px; }
.beat { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--ink); display: grid; place-items: center; font-size: 30px; font-weight: 900; background: var(--card); transition: transform .2s, background .2s; }
.beat.on { background: var(--c-yellow); transform: scale(1.15); }
.track { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.trow { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.tcell { position: relative; aspect-ratio: 1 / 1.25; background: #fff; border: 3px solid var(--ink); border-radius: 10px; display: flex; align-items: flex-end; justify-content: center; font-weight: 900; font-size: clamp(14px, 3.6vw, 22px); padding-bottom: 2px; }
.tcell.past { background: #DFF3E2; } .tcell.here { background: var(--pad-glow); }
.token { position: absolute; left: 50%; bottom: 40%; width: 150%; height: 150%; transform: translateX(-50%); pointer-events: none; transition: all .25s; }
.tapcard { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; background: var(--card); border: 3px dashed var(--ink); border-radius: 22px; padding: 14px 18px; animation: pulse 1.6s infinite; }
.cardicon { font-size: 36px; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.hintcard { width: 110px; margin-left: 12px; }
.nfcbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tray { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 8px; }
.trayhead { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.traycards { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.vcard { min-height: 96px; }
.cardface { border: 3px solid var(--ink); border-radius: 14px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; height: 100%; box-shadow: inset 0 -6px 0 var(--lv); }
.cardface b { font-size: 30px; line-height: 1; }
.cardface small { font-size: 12px; color: var(--muted); }
.cardface svg { width: 44px; height: 52px; }
.cardface.yes { background: #CDEFD2; box-shadow: none; } .cardface.no { background: #FFE0BF; box-shadow: none; }
.sparkle { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.sparkle i { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--c-yellow); border: 2px solid var(--ink); animation: fly .8s ease-out forwards; }
@keyframes fly { from { transform: rotate(var(--a)) translateX(0); opacity: 1; } to { transform: rotate(var(--a)) translateX(120px); opacity: 0; } }

/* chấm nhỏ: xúc xắc 3×3, khung 10 (2×5) */
.mini { display: inline-grid; gap: 2px; }
.mini.dice { grid-template-columns: repeat(3, 8px); grid-template-rows: repeat(3, 8px); }
.mini.frame { grid-template-columns: repeat(5, 7px); grid-template-rows: repeat(2, 7px); border: 1.5px solid var(--ink); padding: 1px; border-radius: 3px; }
.mini i { border-radius: 50%; }
.mini.frame i { background: #EEE6D8; }
.mini i.on { background: var(--c-red); box-shadow: inset 0 0 0 1px var(--ink); }
.minis { display: inline-flex; gap: 3px; }

/* ---------- Kết ---------- */
.end { text-align: center; padding: 20px 16px 40px; }
.endchars { display: flex; justify-content: center; height: 150px; }
.endchars svg { width: 130px; height: 150px; }
.endnums { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 12px 0; }
.endnum { width: 84px; padding: 8px; border-radius: 16px; background: var(--card); border: 3px solid var(--ink); display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .2s; }
.endnum b { font-size: 36px; }
.endnum.lit { background: var(--pad-glow); transform: scale(1.12); }
.big { min-height: 72px; padding: 0 28px; border-radius: 24px; background: var(--c-green); color: #fff; font-size: 24px; font-weight: 900; border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink); }
.forparent { margin: 24px auto 0; max-width: 520px; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; }

/* ---------- cổng + phụ huynh ---------- */
.gate { padding: 40px 16px; text-align: center; }
.gatebtn { min-height: 88px; padding: 0 28px; border-radius: 24px; background: var(--card); border: 3px solid var(--ink); font-size: 22px; font-weight: 800; margin: 16px 0; }
.parent { padding: 8px 16px 48px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.tab { white-space: nowrap; padding: 10px 14px; border-radius: 999px; background: var(--card); border: 2px solid var(--line); font-weight: 700; min-height: 44px; }
.tab.on { border-color: var(--ink); background: var(--pad-glow); }
.pbody { font-size: 16px; }
.pbody h2 { font-size: 22px; margin: 18px 0 8px; } .pbody h3 { font-size: 18px; margin: 18px 0 6px; } .pbody h4, .pbody h5 { margin: 14px 0 6px; }
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mcell { border-radius: 12px; border: 2px solid var(--ink); min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.mcell b { font-size: 20px; } .mcell small { font-size: 11px; }
.tablewrap { overflow-x: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: #F6EEDF; position: sticky; top: 0; }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 4px solid var(--c-blue); background: #EEF5FB; border-radius: 0 10px 10px 0; }
.md pre, pre { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 13px; overflow-x: auto; }
code { background: #F3EBDD; padding: 1px 4px; border-radius: 4px; font-size: 90%; }
.toc { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 8px 0 12px; }
.toc a { color: var(--c-blue); }
.ncards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ncard { background: var(--card); border: 3px solid var(--lv); border-radius: 18px; padding: 12px; }
.nhead { display: flex; align-items: center; gap: 10px; }
.nhead .big { font-size: 44px; background: none; border: 0; box-shadow: none; color: var(--ink); padding: 0; min-height: 0; }
.nhead > div { flex: 1; }
dl { margin: 8px 0 0; } dt { font-weight: 800; font-size: 13px; color: var(--muted); margin-top: 6px; } dd { margin: 0; }
.epd { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; margin: 8px 0; }
.epd summary { cursor: pointer; padding: 6px 0; }
.learn { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 12px; margin: 8px 0; }
.learn .cardface { width: 110px; height: 130px; margin: 8px 0; }
.row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; font-weight: 700; }
.legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.printpage { padding: 12px; }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, 5.5cm); gap: 4mm; margin-top: 12px; }
.pcard { width: 5.5cm; height: 5.5cm; }
.pcard .cardface b { font-size: 64px; }
.pcard .cardface svg { width: 2.6cm; height: 3cm; }
.pcard .mini.dice { grid-template-columns: repeat(3, 14px); grid-template-rows: repeat(3, 14px); }
.pcard .mini.frame { grid-template-columns: repeat(5, 12px); grid-template-rows: repeat(2, 12px); }
@media print {
  .noprint { display: none; }
  body { background: #fff; }
  .pcard { break-inside: avoid; }
  .cardface { box-shadow: inset 0 -10px 0 var(--lv); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- trạng thái chờ / gợi ý ---------- */
.card-glow { animation: glow 2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 8px var(--pad-ring), 0 0 24px var(--pad-ring); } }

/* ---------- điện thoại nhỏ ---------- */
@media (max-width: 420px) {
  .objs.dice { grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(3, 60px); }
  .objs.scatter { grid-template-columns: repeat(4, 66px); grid-template-rows: repeat(3, 66px); }
  .obj, .objs.dice .obj { width: 58px; height: 58px; }
  .frame10 { grid-template-columns: repeat(5, 40px); grid-template-rows: repeat(2, 40px); }
  .fcell .obj { width: 32px; height: 32px; }
  .choice { width: 96px; min-height: 100px; } .choice b { font-size: 40px; }
  .ynb { width: 120px; min-height: 124px; }
  .subtitle { font-size: 20px; }
  .char { width: 76px; height: 90px; }
  .mgrid { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
