/* bai-hoc.css — phần riêng của màn bài học (khung câu hỏi + dải đáy nằm ở app.css). Nạp SAU app.css. */
.muc-kt { border: 2px solid var(--vien); border-radius: 16px; padding: 14px 16px; margin: 12px 0; }
.muc-kt h4 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.luu-y { background: var(--goi-y); border-radius: 16px; padding: 10px 14px 10px 32px; }
.bay-loi { border: 2px solid #ffd84d; background: var(--goi-y); border-radius: 16px; padding: 10px 14px; margin: 10px 0; }
.tu-vung { width: 100%; border-collapse: collapse; }
.tu-vung td { border-bottom: 2px solid var(--vien); padding: 7px 8px; vertical-align: top; }
.tu-vung td:first-child { width: 34%; font-weight: 800; }
.quai-twm { flex: none; line-height: 0; }
/* linh vật phản ứng: chỉ đổi cảm xúc (linhvat.js), bong bóng đổi màu */
.loi-nv.vui .bong-noi { border-color: #79d634; background: var(--dung-nhat); } .loi-nv.vui .bong-noi::before { border-right-color: #79d634; } .loi-nv.vui .bong-noi::after { border-right-color: var(--dung-nhat); }
.loi-nv.buon .bong-noi { border-color: #ff9ca3; background: var(--sai-nhat); } .loi-nv.buon .bong-noi::before { border-right-color: #ff9ca3; } .loi-nv.buon .bong-noi::after { border-right-color: var(--sai-nhat); }
@media (max-width: 600px) { .loi-nv > .lv, .loi-nv > img { width: 80px; } .quai-twm .qv { --co: 80px; } }

/* ---- Ôn tập (hoc.js /on): 2 thẻ chế độ + lưới chọn Unit; màn chơi có thanh tiến độ + chuỗi đúng */
.on-che-do { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.o-on { display: flex; flex-direction: column; gap: 4px; text-decoration: none !important; color: var(--chu); transition: transform .25s var(--spring), box-shadow .25s; }
.o-on:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(var(--glow), .6), 0 0 24px rgba(var(--glow), .18); }
.o-on .bieu { font-size: 1.8em; } .o-on b { font: 700 1.12em var(--tieu-de); } .o-on small { color: var(--chu2); }
.o-on.tat { opacity: .55; pointer-events: none; }
.chon-unit { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.o-unit { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; margin: 0; }
.o-unit input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--tg); flex: none; }
.o-unit > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.o-unit small { font: 700 .72em var(--tieu-de); letter-spacing: .1em; text-transform: uppercase; color: var(--tg); }
.o-unit b { font-family: var(--tieu-de); } .o-unit .mo { font-size: .85em; }
.o-unit:has(input:checked) { box-shadow: 0 0 0 2px var(--tg), 0 0 22px rgba(var(--glow), .2); }
.cap-do.can-on { background: rgba(255,110,110,.15); color: #ff8a8a; align-self: flex-start; }
.chan-chon { grid-column: 1 / -1; display: flex; justify-content: center; }
.on-tren { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.on-chuoi { font: 800 1em var(--tieu-de); color: var(--vang); white-space: nowrap; }
.on-thanh { height: 10px; margin: 0 0 14px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.on-thanh i { display: block; height: 100%; border-radius: inherit; background: var(--tg); box-shadow: 0 0 12px rgba(var(--glow), .6); transition: width .5s var(--spring); }
.on-tong { margin: 12px auto; max-width: 520px; text-align: left; }

/* ải trong bài học (bước Luyện độc lập, hoc.js TG.sanAi): 6 kiểu chơi — câu đúng = một bước của trò chơi */
.ai-san { margin: 6px 0 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.035); box-shadow: 0 0 0 1px var(--vien); }
.ai-dau-de { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 10px; font-size: .9em; }
.ai-hang { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.ai-giua { display: grid; gap: 6px; }
.ai-hp { height: 12px; }
.ai-quai .qv { transform: scaleX(-1); }
.ai-quai.trung { animation: ai-trung .45s cubic-bezier(.2, .8, .3, 1); }
@keyframes ai-trung { 20% { transform: translateX(14px) rotate(6deg); filter: brightness(2.2); } }
.nay { animation: ai-nay .4s var(--spring); }
@keyframes ai-nay { 40% { transform: translateY(-10px) scale(1.08); } }
/* kéo co = ĐẤU TRƯỜNG (hoc.js canhKeo): cảnh SVG theo thế giới phủ nền, khối kéo (em · dây · quái) trượt theo --d (−5…+5).
   Mỗi nấc = 5% khối kéo = 3% bề ngang sân; nút dây chạm vạch bên nào (±5 nấc) là bên đó thắng. */
.ai-san[data-kieu="keo"] { padding: 0; overflow: hidden; }
.ai-san[data-kieu="keo"] .ai-dau-de { margin: 0; padding: 12px 14px 10px; }
.kc-dt { position: relative; height: clamp(230px, 34vw, 320px); overflow: hidden; isolation: isolate; }
.kc-canh { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.kc-vach { position: absolute; bottom: 6%; width: 4px; height: 24%; margin-left: -2px; border-radius: 2px; background: rgb(var(--glow)); box-shadow: 0 0 10px rgb(var(--glow)); }
.kc-vach.t { left: 34%; } .kc-vach.p { left: 66%; background: #ff5a5f; box-shadow: 0 0 10px #ff5a5f; }
.kc-keo { position: absolute; left: 20%; width: 60%; bottom: 7%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end;
  transform: translateX(calc(var(--d) * -5%)); transition: transform .7s var(--spring); }
.kc-ta, .kc-quai { position: relative; z-index: 1; transition: transform .4s var(--spring); }
.kc-ta { transform: rotate(-12deg); transform-origin: 50% 100%; margin-right: -14px; }
.kc-quai { transform: rotate(12deg); transform-origin: 50% 100%; margin-left: -14px; }
.kc-ta .lv, .kc-quai .qv { --co: clamp(64px, 11vw, 104px) !important; }
.kc-day { height: 14px; width: 100%; align-self: center; margin-top: 18px; overflow: visible; }
.kc-no { position: absolute; left: 50%; bottom: calc(50% - 20px); width: 16px; height: 22px; margin-left: -8px; border-radius: 4px 4px 8px 8px;
  background: linear-gradient(#ff5a5f, #c81e1e); box-shadow: 0 0 0 2px #fff, 0 0 12px rgba(255,90,95,.7); }
.kc-bui { position: absolute; bottom: 0; left: 50%; width: 46px; height: 14px; margin-left: -23px; border-radius: 50%; background: rgba(120,90,60,.45); filter: blur(3px); opacity: 0; }
.kc-bang { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 4px 14px; border-radius: 99px;
  background: rgba(9,9,10,.72); font: 700 .85em var(--tieu-de); color: #fff; white-space: nowrap; }
.kc-bang b { min-width: 2.4em; text-align: center; font-size: 1.25em; color: var(--vang); }
/* khán đài nhún liên tục, phe vừa kéo được thì nhảy cao hơn; cờ dây đung đưa */
.kc-fan { animation: kc-nhun 1.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.14s); }
@keyframes kc-nhun { 50% { transform: translateY(-3px); } }
.kc-dt.giat[data-keo="ta"] .kc-khan.t .kc-fan, .kc-dt.giat[data-keo="quai"] .kc-khan.p .kc-fan { animation: kc-reo .5s ease-out 2; animation-delay: calc(var(--i) * -.05s); }
@keyframes kc-reo { 40% { transform: translateY(-12px); } }
.kc-co { animation: kc-co 3s ease-in-out infinite alternate; transform-origin: 50% 0; }
@keyframes kc-co { to { transform: translateY(3px) skewX(-4deg); } }
.kc-sao { animation: kc-lap 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.3s); } @keyframes kc-lap { 50% { opacity: .3; } }
.kc-may { animation: kc-troi 14s linear infinite alternate; } @keyframes kc-troi { to { transform: translateX(40px); } }
.kc-khoi { animation: kc-khoi 3s ease-in-out infinite; } @keyframes kc-khoi { 50% { transform: translateY(-8px); opacity: .3; } }
.kc-rong path { animation: kc-du 3s ease-in-out infinite alternate; transform-origin: 50% 100%; transform-box: fill-box; } @keyframes kc-du { to { transform: skewX(8deg); } }
/* giật dây: bên kéo được ngả sâu + bụi; bên bị kéo chúi về giữa */
.kc-dt.giat[data-keo="ta"] .kc-ta, .kc-dt.giat[data-keo="quai"] .kc-quai { animation: kc-gong .6s var(--spring); }
.kc-dt.giat[data-keo="ta"] .kc-ta .kc-bui, .kc-dt.giat[data-keo="quai"] .kc-quai .kc-bui { animation: kc-bui .7s ease-out; }
.kc-dt.giat[data-keo="ta"] .kc-quai { animation: kc-chui-p .6s var(--spring); } .kc-dt.giat[data-keo="quai"] .kc-ta { animation: kc-chui-t .6s var(--spring); }
@keyframes kc-gong { 40% { transform: rotate(var(--g, -22deg)) translateY(2px) scale(1.04); } }
.kc-quai { --g: 22deg; }
@keyframes kc-chui-t { 40% { transform: rotate(4deg) translateX(10px); } } @keyframes kc-chui-p { 40% { transform: rotate(-4deg) translateX(-10px); } }
@keyframes kc-bui { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(2.2) translateY(-8px); } }
.kc-dt.thang .kc-quai { transform: rotate(-80deg); opacity: .75; } .kc-dt.thua .kc-ta { transform: rotate(80deg); opacity: .75; }
body.giam .kc-dt * { animation: none !important; }
/* giải mã */
.ai-ma { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.ai-ruong { font-size: 2.6em; line-height: 1; }
.ai-chu { display: flex; gap: 5px; }
.ai-chu span { display: grid; place-items: center; width: 34px; height: 40px; border-radius: 8px; background: rgba(255,255,255,.06); box-shadow: 0 0 0 1px var(--vien2); font: 800 1.15em var(--tieu-de); color: var(--chu3); }
.ai-chu span.mo { background: var(--tg); color: var(--toi); animation: mt-lat .45s var(--spring); }
/* đua */
.ai-dua { position: relative; display: grid; gap: 6px; padding-right: 40px; }
.ai-dua .lan { position: relative; height: 64px; border-radius: 10px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 30px, transparent 30px 60px); }
.ai-dua .xe { position: absolute; left: 0; bottom: 0; transition: left .6s var(--spring); }
.ai-dua .xe .lv, .ai-dua .xe .qv { --co: 64px !important; }
.ai-dua #ai-ban .qv { transform: scaleX(-1); }
.ai-dua .dich { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 1.6em; }
/* xây cầu */
.ai-cau { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 6px; }
.ai-cau .bo { font-size: 2em; line-height: 1; } .ai-cau .bo .lv { --co: 64px !important; }
.ai-cau .song { display: flex; gap: 3px; align-items: end; height: 46px; padding: 0 4px 6px; border-radius: 10px; background: linear-gradient(180deg, transparent 50%, rgba(76,201,255,.35) 50%); }
.ai-cau .song i { flex: 1; height: 10px; border-radius: 3px; background: rgba(255,255,255,.08); }
.ai-cau .song i.dat { background: #C99A5B; animation: ai-van .35s var(--spring); } .ai-cau .song i.gay { background: transparent; box-shadow: inset 0 0 0 2px rgba(255,110,110,.6); }
@keyframes ai-van { from { transform: translateY(-24px); opacity: 0; } }
/* leo núi */
.ai-leo { display: grid; justify-items: center; }
/* Leo núi: VÁCH ĐÁ PHỦ KÍN MÀN HÌNH (lớp cố định sau nội dung, gắn thẳng vào <body>); bức vách cao ~2,6 màn hình,
   máy quay dịch cả bức vách theo nhân vật. Nội dung bài nổi phía trên, chừa "khung nhìn" .leo-cua để thấy nhân vật. */
.ai-san[data-kieu="leo"] { background: none; box-shadow: none; backdrop-filter: none; padding: 0; }
.ai-san[data-kieu="leo"] .ai-dau-de { display: inline-flex; flex-wrap: wrap; gap: 6px 10px; padding: 8px 14px; border-radius: 14px; background: rgba(9,9,10,.72); backdrop-filter: blur(4px); }
.ai-san[data-kieu="leo"] .leo-hud { display: inline-flex; margin: 8px 0 0; padding: 6px 14px; border-radius: 99px; background: rgba(9,9,10,.72); }
.ai-san[data-kieu="leo"] .ai-leo { justify-items: start; }
.leo-cua { height: clamp(240px, 46vh, 460px); }
body.leo-full .nen-hero, body.leo-full::after { opacity: 0 !important; }
body.leo-full #app, body.leo-full .dau, body.leo-full .chan-cau { position: relative; z-index: 2; }
body.leo-full .thanh-bai, body.leo-full .buoc, body.leo-full .tieu-bai, body.leo-full .ma-bai { text-shadow: 0 2px 6px rgba(0,0,0,.85), 0 0 2px #000; }
body.leo-full #vung-cau { background: rgba(14,16,22,.88); backdrop-filter: blur(6px); border-radius: 16px; }
.vach-khung { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #0b1633; }
.vach-khung:not(.full) { position: relative; height: 1px; opacity: 0; }
.vach-tuong { position: absolute; left: 0; right: 0; bottom: 0; height: max(260vh, 1500px); transition: transform 1.1s cubic-bezier(.33, .9, .3, 1); will-change: transform; }
.vach-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vk-may { animation: vk-troi 50s linear infinite alternate; } @keyframes vk-troi { to { transform: translateX(90px); } }
.vach-tuong .dinh { position: absolute; left: 50%; top: 5.5%; transform: translateX(-50%); font-size: 3em; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.vach-tuong .trai { position: absolute; left: 50%; margin-left: 70px; display: grid; justify-items: center; font-style: normal; opacity: .55; filter: grayscale(.8); transform: translateY(50%); }
.vach-tuong .trai b { font-size: 2.2em; line-height: 1; } .vach-tuong .trai small { font-size: .78em; font-weight: 800; padding: 2px 9px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; }
.vach-tuong .trai.qua { opacity: 1; filter: none; }
/* nhân vật: đi lên bằng transition của bottom (1,1 s, khớp máy quay), thân đu nhẹ trên dây */
.vach-tuong .leo-nv { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); transition: bottom 1.1s cubic-bezier(.33, .9, .3, 1); z-index: 2; filter: drop-shadow(0 8px 10px rgba(0,0,0,.5)); }
.vach-tuong .leo-nv .lv { --co: clamp(84px, 13vh, 130px) !important; display: block; transform-origin: 50% 0; animation: vk-du 2.8s ease-in-out infinite alternate; }
.vach-tuong .leo-day { position: absolute; left: 50%; bottom: 72%; width: 5px; height: 300vh; margin-left: -2.5px; background: repeating-linear-gradient(180deg, #ecd9ac 0 10px, #b89a62 10px 18px); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
@keyframes vk-du { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
/* ĐỘNG TÁC LEO (mỗi chặng lên): với tay trái → kéo người lên → với tay phải → đạp chân; nhân vật nhún theo nhịp */
/* tư thế treo mặc định: hai tay vươn lên nắm dây (thay vì buông thõng), chân hơi co */
.vach-tuong .leo-nv .lv-tay-t { transform: rotate(105deg); animation: none; } .vach-tuong .leo-nv .lv-tay-p { transform: rotate(-105deg); animation: none; }
.vach-tuong .leo-nv .nv-chan-t { transform: rotate(10deg); } .vach-tuong .leo-nv .nv-chan-p { transform: rotate(-6deg); }
.vach-tuong .leo-nv .lv-toan { animation: none; }
.leo-nv.dang-leo .lv { animation: vk-keo 1.1s ease-in-out; }
/* chân đạp so le: trái co lên đạp → phải co lên đạp */
.leo-nv.dang-leo .nv-chan-t { animation: vk-chan-t 1.1s ease-in-out; } .leo-nv.dang-leo .nv-chan-p { animation: vk-chan-p 1.1s ease-in-out; }
@keyframes vk-chan-t { 0%, 100% { transform: rotate(10deg); } 20% { transform: rotate(-38deg) translateY(-6px); } 45% { transform: rotate(18deg); } }
@keyframes vk-chan-p { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(38deg) translateY(-6px); } 75% { transform: rotate(-14deg); } }
@keyframes vk-keo { 0% { transform: rotate(0); } 20% { transform: translateY(6px) rotate(-6deg) scaleY(.94); } 45% { transform: translateY(-8px) rotate(5deg) scaleY(1.06); } 70% { transform: translateY(4px) rotate(-3deg); } 100% { transform: rotate(0); } }
.leo-nv.dang-leo .lv-tay-t { animation: vk-tay-t 1.1s ease-in-out; } .leo-nv.dang-leo .lv-tay-p { animation: vk-tay-p 1.1s ease-in-out; }
@keyframes vk-tay-t { 0%, 100% { transform: rotate(105deg); } 15%, 35% { transform: rotate(128deg) translateY(-6px); } 60% { transform: rotate(80deg); } }
@keyframes vk-tay-p { 0%, 100% { transform: rotate(-105deg); } 35% { transform: rotate(-80deg); } 55%, 80% { transform: rotate(-128deg) translateY(-6px); } }
.leo-nv.dang-leo .lv-toan { animation: vk-dap 1.1s ease-in-out; }
.leo-nv.truot .nv-chan { animation: vk-quo .2s linear 4 alternate; }
@keyframes vk-dap { 0%, 100% { transform: none; } 30% { transform: translateY(5px) scale(1.04, .95); } 60% { transform: translateY(-6px) scale(.96, 1.05); } }
/* trượt: rơi giật, xoay người, tay quơ; giữ dây: giật mạnh rồi đu */
.leo-nv.truot .lv { animation: vk-truot .9s cubic-bezier(.3, .1, .4, 1) !important; }
@keyframes vk-truot { 0% { transform: rotate(0); } 25% { transform: translateY(22px) rotate(-22deg); } 55% { transform: translateY(8px) rotate(16deg); } 80% { transform: rotate(-6deg); } 100% { transform: rotate(0); } }
.leo-nv.truot .lv-tay { animation: vk-quo .18s linear 5 alternate; } @keyframes vk-quo { from { transform: rotate(-60deg); } to { transform: rotate(80deg); } }
.leo-nv.giu .lv { animation: vk-giu .8s cubic-bezier(.2, 1.6, .4, 1) !important; } @keyframes vk-giu { 30% { transform: translateY(14px) scaleY(1.1); } 100% { transform: none; } }
.leo-bong { position: absolute; left: calc(100% + 4px); top: 0; padding: 4px 10px; border-radius: 12px; background: #fff; color: #222; font: 800 .95em var(--tieu-de); white-space: nowrap; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .3s var(--spring); }
.leo-bong.hien { opacity: 1; transform: none; }
.vach-khung.bao::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, transparent 0 14px, rgba(255,255,255,.18) 14px 16px); animation: vk-mua .35s linear infinite; }
.vach-khung.bao .vach-svg { filter: brightness(.5) saturate(.7); }
@keyframes vk-mua { to { background-position: 40px 80px; } }
.vach-khung.rung .vach-tuong { animation: vk-rung .35s; } @keyframes vk-rung { 20% { translate: -8px 4px; } 50% { translate: 6px -4px; } 80% { translate: -3px 2px; } }
body.giam :is(.vk-may, .vach-khung.bao::after, .leo-nv .lv, .leo-nv .lv-tay, .leo-nv .lv-toan, .leo-nv .nv-chan, .vach-khung.rung .vach-tuong) { animation: none !important; }
body.giam .vach-tuong, body.giam .vach-tuong .leo-nv { transition: none; }
@media (max-width: 600px) { .leo-cua { height: clamp(220px, 40vh, 360px); } .vach-tuong .trai { margin-left: 46px; } }
@media (max-width: 600px) { .ai-hang .lv, .ai-hang .qv { --co: 60px !important; } }
body.giam :is(.ai-quai.trung, .nay, .ai-chu span.mo, .ai-cau .song i.dat) { animation: none; }

/* luật ải (ai.js): combo, chọn lối, lượt thao tác */
.ai-combo { min-height: 1.2em; text-align: center; font: 800 .95em var(--tieu-de); color: var(--vang); }
.ai-quai.nga { transform: rotate(90deg) translateY(20px); opacity: .45; transition: transform .6s var(--spring), opacity .6s; }
.ai-tao { background: rgba(255,200,0,.12); color: var(--vang); }
.ai-chon { text-align: center; padding: 10px 0; }
.ai-chon p { font-weight: 700; margin: 0 0 12px; }
.ai-chon .hang { justify-content: center; gap: 12px; }
.ai-chon .nut.to { min-width: min(100%, 260px); white-space: normal; height: auto; min-height: 56px; }
.ai-tt { display: grid; gap: 10px; justify-items: center; }
.tt-de { font-size: 1.1em; text-align: center; } .k-to { color: var(--tg); font: 800 1.15em var(--tieu-de); }
.tt-meo { font-size: .85em; margin: 0; text-align: center; }
.tt-luoi { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; width: min(100%, calc(var(--n) * 48px)); }
.tt-o { aspect-ratio: 1; min-width: 32px; border: 0; border-radius: 6px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--vien); }
.tt-o.truc { background: rgba(255,200,0,.15); }
.tt-o:hover:not(:disabled) { background: rgba(var(--glow), .3); }
.tt-o.dung { background: var(--dung) !important; } .tt-o.sai { background: var(--sai) !important; }
.tt-o.to { background: #C99A5B; }
.tt-truc { position: relative; width: min(100%, 640px); height: 92px; margin: 6px 0; border-radius: 14px; background: rgba(255,255,255,.92); }
.tt-truc .duong { position: absolute; left: 3%; right: 3%; top: 40px; height: 3px; background: #333; }
.tt-truc .vach { position: absolute; top: 33px; width: 2px; height: 16px; margin-left: -1px; background: #333; } .tt-truc .vach.to { top: 27px; height: 28px; }
.tt-truc .nhan { position: absolute; top: 60px; transform: translateX(-50%); font-weight: 700; color: #123; font-size: .9em; }
.tt-truc .bam { position: absolute; inset: 0; border: 0; background: transparent; cursor: crosshair; }
.tt-truc .ban { position: absolute; top: 10px; transform: translateX(-50%); font-size: 1.4em; pointer-events: none; }
.tt-dx { position: relative; display: grid; grid-template-columns: repeat(var(--n), 52px); gap: 3px; }
.tt-dx .tt-o:disabled { opacity: .9; cursor: default; }
.tt-truc-dx { position: absolute; left: 50%; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; background: #e33; pointer-events: none; }
.tt-xep { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tt-the { min-width: 84px; padding: 12px 16px; border: 0; border-radius: 12px; font: 800 1.15em var(--tieu-de); background: rgba(255,255,255,.08); box-shadow: 0 0 0 1px var(--vien2); color: var(--chu); }
.tt-the:disabled { opacity: .3; }
.tt-day { display: flex; gap: 8px; } .tt-day span { min-width: 70px; padding: 8px 10px; text-align: center; border-radius: 10px; border: 2px dashed var(--vien2); font-weight: 800; }
.tt-day span.dung { border: 2px solid var(--dung); } .tt-day span.sai { border: 2px solid var(--sai); }

/* Đánh quái có giao tranh hai chiều: tim, quái lao đánh trả, thanh năng lượng chiêu */
.ai-chi { display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: .95em; }
#ai-tim .tat { opacity: .22; filter: grayscale(1); }
.ai-nang { letter-spacing: 2px; color: var(--chu3); font-weight: 800; } .ai-nang.day { color: var(--vang); animation: ai-day .8s ease-in-out infinite alternate; }
@keyframes ai-day { to { text-shadow: 0 0 12px rgba(255,200,0,.9); transform: scale(1.12); } }
.ai-quai.lao { animation: ai-lao .55s cubic-bezier(.3, .7, .4, 1); }
@keyframes ai-lao { 35% { transform: scaleX(-1) translateX(80px) scale(1.15); } 100% { transform: scaleX(-1); } }
body.giam :is(.ai-quai.lao, .ai-nang.day) { animation: none; }

/* Leo núi quản lý tài nguyên: thể lực, dây, trại, bão */
.leo-hud { display: flex; gap: 14px; align-items: center; justify-content: center; margin-bottom: 6px; font-size: 1.05em; flex-wrap: wrap; }
.leo-hud .tat { opacity: .2; filter: grayscale(1); } .leo-hud b { color: var(--sai); font-size: .9em; }

/* Leo núi tràn hết bề ngang trang → cắt tràn ngang ở mức trang để không sinh thanh cuộn ngang (100vw tính cả thanh cuộn dọc) */
body:has(.ai-san[data-kieu="leo"]) { overflow-x: clip; }
html:has(.ai-san[data-kieu="leo"]) { overflow-x: clip; }

/* ================= ĐỘNG TÁC THẬT (jun 15/11: "animation thực sự kiểu players thực sự kéo co và leo núi")
   Nhân vật học sinh (nhanvat.js) có sẵn hai bộ tay ẩn: .nv-leo (vươn qua đầu nắm dây) và .nv-keo (chìa ra nắm dây ngang hông).
   Tay thường .lv-tay ẩn đi khi đang leo / đang kéo. Linh vật (chưa chọn nhân vật) không có bộ tay này → xoay tay thường về phía dây. */
.nv-leo, .nv-keo { display: none; }
.leo-nv .nv-leo, .kc-ta .nv-keo { display: inline; }
.leo-nv .lv-hs .lv-tay, .kc-ta .lv-hs .lv-tay { display: none; }
.kc-ta .lv:not(.lv-hs) .lv-tay { transform: rotate(-78deg); animation: none; }
/* LEO: tay-trên-tay. Cánh tay co giãn dọc quanh vai (scaleY), bàn tay dịch đúng bằng phần cánh tay dài thêm (108 đơn vị × (k−1)).
   Tay nào đang nắm dây thì tụt xuống so với thân (vì thân đang được kéo lên), tay kia vươn lên bắt chỗ mới. */
.nv-leo-ht, .nv-leo-hp { transform-box: view-box; }
.leo-nv.dang-leo .nv-leo-at { animation: vk-at 1.1s ease-in-out; } .leo-nv.dang-leo .nv-leo-ht { animation: vk-ht 1.1s ease-in-out; }
.leo-nv.dang-leo .nv-leo-ap { animation: vk-ap 1.1s ease-in-out; } .leo-nv.dang-leo .nv-leo-hp { animation: vk-hp 1.1s ease-in-out; }
@keyframes vk-at { 0%, 100% { transform: scaleY(1); } 22% { transform: scaleY(1.28); } 50% { transform: scaleY(1); } 76% { transform: scaleY(.8); } }
@keyframes vk-ht { 0%, 100% { transform: translateY(0); } 22% { transform: translateY(-30px); } 50% { transform: translateY(0); } 76% { transform: translateY(22px); } }
@keyframes vk-ap { 0%, 100% { transform: scaleY(1); } 24% { transform: scaleY(.8); } 50% { transform: scaleY(1); } 74% { transform: scaleY(1.28); } }
@keyframes vk-hp { 0%, 100% { transform: translateY(0); } 24% { transform: translateY(22px); } 50% { transform: translateY(0); } 74% { transform: translateY(-30px); } }
/* trượt: hai tay tuột dọc dây (thân rơi, tay vẫn nắm phía trên) rồi bám lại; giữ dây: giật căng hai tay */
.leo-nv.truot .nv-leo-at, .leo-nv.truot .nv-leo-ap { animation: vk-tuot-a .9s cubic-bezier(.3, .1, .4, 1); }
.leo-nv.truot .nv-leo-ht, .leo-nv.truot .nv-leo-hp { animation: vk-tuot-h .9s cubic-bezier(.3, .1, .4, 1); }
@keyframes vk-tuot-a { 25% { transform: scaleY(1.3); } 60% { transform: scaleY(1.12); } }
@keyframes vk-tuot-h { 25% { transform: translateY(-32px); } 60% { transform: translateY(-13px); } }
.leo-nv.giu .nv-leo-at, .leo-nv.giu .nv-leo-ap { animation: vk-tuot-a .8s cubic-bezier(.2, 1.6, .4, 1); }
.leo-nv.giu .nv-leo-ht, .leo-nv.giu .nv-leo-hp { animation: vk-tuot-h .8s cubic-bezier(.2, 1.6, .4, 1); }
/* đang treo (không leo): bàn chân tìm chỗ đạp, nhịp chậm */
.vach-tuong .leo-nv:not(.dang-leo):not(.truot) .nv-chan-t { animation: vk-do-t 2.4s ease-in-out infinite; }
.vach-tuong .leo-nv:not(.dang-leo):not(.truot) .nv-chan-p { animation: vk-do-p 2.4s ease-in-out infinite; }
@keyframes vk-do-t { 0%, 100% { transform: rotate(10deg); } 50% { transform: rotate(-8deg); } }
@keyframes vk-do-p { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(12deg); } }

/* KÉO CO: hai bên GỒNG SỨC liên tục — ngả người ra sau theo nhịp ghì, chân trụ đạp đất so le.
   Phe vừa kéo được: bước lùi hai bước (chân đạp nhanh), phe bị kéo: chúi tới, chân lê. */
.kc-ta .lv-toan { animation: kc-ghi-t 1s ease-in-out infinite; }
.kc-quai .q-toan { animation: kc-ghi-p 1s ease-in-out -.5s infinite; }
@keyframes kc-ghi-t { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateX(3px); } }
@keyframes kc-ghi-p { 0%, 100% { transform: rotate(3deg); } 50% { transform: rotate(-3deg) translateX(-3px); } }
.kc-ta .nv-chan-t { animation: kc-dap 1s ease-in-out infinite; } .kc-ta .nv-chan-p { animation: kc-dap 1s ease-in-out -.5s infinite; }
@keyframes kc-dap { 0%, 100% { transform: rotate(14deg); } 50% { transform: rotate(-6deg); } }
.kc-dt.giat[data-keo="ta"] .kc-ta .nv-chan-t, .kc-dt.giat[data-keo="quai"] .kc-ta .nv-chan-t { animation: kc-buoc .3s ease-in-out 2; }
.kc-dt.giat[data-keo="ta"] .kc-ta .nv-chan-p, .kc-dt.giat[data-keo="quai"] .kc-ta .nv-chan-p { animation: kc-buoc .3s ease-in-out -.15s 2; }
@keyframes kc-buoc { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(-22deg) translateY(-4px); } }
.kc-dt.giat :is(.kc-quai) :is(.q-chan-a, .q-chan-b) { animation-duration: .15s; }
/* dây căng rung khi có phe giật */
.kc-dt.giat .kc-day { animation: kc-rung-day .5s ease-out; }
@keyframes kc-rung-day { 15% { transform: translateY(-3px) scaleY(1.6); } 35% { transform: translateY(2px) scaleY(.6); } 60% { transform: translateY(-1px); } }
body.giam :is(.leo-nv, .kc-dt) :is(.nv-leo-at, .nv-leo-ap, .nv-leo-ht, .nv-leo-hp, .nv-chan, .lv-toan, .q-toan) { animation: none !important; }
/* nhân vật đè lên dây (dây chỉ thấy phía trên bàn tay) */
.vach-tuong .leo-nv .lv { position: relative; }
