/* ===== KÍCH THƯỚC GAME – CHỈNH TẠI ĐÂY, mọi game tự chơi/live dùng chung =====
   --gs-q-font     chữ câu hỏi          --gs-ans-font  chữ đáp án
   --gs-ans-min    chiều cao tối thiểu ô đáp án
   --gs-gap        khoảng cách giữa các ô đáp án
   --gs-qimg-max   chiều cao tối đa ảnh trong câu hỏi
   Mặc định = màn vừa; điện thoại (≤720px hoặc thấp ≤520px) và màn lớn (≥1100px) ghi đè bên dưới. */
:root{
  --gs-q-font:clamp(22px,2.2vw,28px);
  --gs-ans-font:clamp(16px,1.3vw,18px);
  --gs-ans-min:clamp(56px,7.5vh,72px);
  --gs-gap:14px;
  --gs-badge:clamp(34px,2.8vw,44px); /* huy hiệu chữ A/B/C/D */
  --gs-qimg-max:none;
  /* kiểu viên thuốc: viền mảnh, đổ bóng nông */
  --gs-radius:999px;--gs-border:3px;--gs-drop:4px;
}
@media (max-width:720px),(max-height:520px){
  :root{--gs-q-font:clamp(19px,5vw,24px);--gs-ans-min:clamp(56px,9vh,84px);--gs-gap:10px}
}
@media (min-width:1100px){
  :root{
    --gs-q-font:clamp(28px,2vw,40px);
    --gs-ans-font:clamp(22px,1.7vw,34px);
    --gs-ans-min:clamp(60px,8.5vh,88px);
    --gs-gap:clamp(12px,1vw,18px);
    --gs-badge:clamp(46px,3.4vw,66px);
    --gs-qimg-max:34vh;
  }
}
/* ===== Giao diện "sân chơi" cho mọi game chơi một mình / phòng live =====
   Luôn dùng nền tối rực rỡ như game thật (kể cả khi trang đang ở giao diện sáng), chữ to, nút bo tròn dễ bấm,
   mỗi game một tông màu (--sh). Chỉ áp dụng khi body có data-game. */
body[data-game]{
  color-scheme:dark;min-height:100vh;min-height:100dvh;
  --bg:#171538;--card:#26235a;--ink:var(--white);--mute:#b9b6ef;--panel:#38348a;--deep:#15133a;--deepa:#15133aee;--line:#4a46a0;--line2:var(--slate);--sel:#5b57b5;
  --acc:var(--gold);--accink:var(--gold);--ok:#2ecc71;--bad:#ff4d5e;--okbg:#17744a;--badbg:#8a2332;--shadow:0 14px 40px -18px #000a;
  --c0:#f43f5e;--c1:#3b82f6;--c2:var(--amber);--c3:#22c55e;
  --g:hsl(var(--sh,265) 85% 62%);--g2:hsl(calc(var(--sh,265) + 55) 85% 60%);
  background:
    radial-gradient(1000px 560px at 10% -10%,hsl(var(--sh,265) 85% 55%/.38),transparent 62%),
    radial-gradient(800px 560px at 100% 105%,hsl(calc(var(--sh,265) + 60) 85% 55%/.30),transparent 66%),
    linear-gradient(180deg,var(--deep-indigo),#110f2b) fixed;
  color:var(--ink);
}
/* lớp trang trí trôi chậm phía sau */
body[data-game]::after{content:"";position:fixed;inset:-10%;z-index:-1;pointer-events:none;opacity:.5;
  background:radial-gradient(circle,#fff9 0 2px,transparent 3px) 0 0/140px 140px,radial-gradient(circle,#fff6 0 1.5px,transparent 2.5px) 70px 70px/140px 140px,
    radial-gradient(circle at 20% 30%,hsl(var(--sh,265) 90% 70%/.10) 0 120px,transparent 121px),radial-gradient(circle at 80% 70%,hsl(calc(var(--sh,265) + 60) 90% 70%/.10) 0 160px,transparent 161px);
  animation:gdrift 60s linear infinite}
@keyframes gdrift{to{transform:translateY(140px)}}
body[data-game]::before{opacity:.25!important}

/* thanh trên cùng gọn, tối, dính đầu trang */
body[data-game] header{background:#110f2bd9;border-bottom:2px solid color-mix(in srgb,var(--g) 55%,transparent);box-shadow:0 4px 24px -8px #000;backdrop-filter:blur(10px)}
body[data-game] .logo{background:none;-webkit-text-fill-color:var(--white);color:var(--white)}
body[data-game] header nav a,body[data-game] .ib,body[data-game] .burger,body[data-game] .musicbtn,body[data-game] .themebtn{color:var(--white);background:#ffffff14;border:1px solid #ffffff22;box-shadow:none}
body[data-game] footer{display:none}
body[data-game] #exitbar button{background:#ffffff18;color:var(--white);border:1px solid #ffffff30;box-shadow:none;border-radius:var(--r-pill);padding:8px 16px}
body[data-game] #exitbar .mute{color:#fff8}

/* khung chơi: tấm bảng nổi, viền phát sáng theo tông game */
body[data-game] .card{background:linear-gradient(180deg,#2d2a66,#221f52);border:2px solid color-mix(in srgb,var(--g) 55%,#fff0);border-radius:var(--r-xl);padding:clamp(16px,2vw,24px);
  box-shadow:0 0 0 5px #0000002e,0 22px 50px -20px #000,0 0 40px -12px var(--g),inset 0 2px 0 #ffffff22}
body[data-game] h1,body[data-game] h2,body[data-game] h3{color:var(--white)}
body[data-game] .mute{color:var(--mute)}

/* câu hỏi: bảng tiêu đề lớn */
body[data-game] .qbox,body[data-game] .qtext{color:var(--white)}
body[data-game] .qtext{font-size:var(--gs-q-font);font-weight:800;line-height:1.3;text-shadow:0 2px 0 #0005;margin:14px 0 20px}
body[data-game] .qbox{background:linear-gradient(135deg,color-mix(in srgb,var(--g) 38%,#15133a),#15133a);border:2px solid color-mix(in srgb,var(--g) 60%,#0000);border-left-width:8px;border-radius:20px;padding:8px 22px}

/* HUD: huy hiệu thuốc nhộng */
body[data-game] .stats>span,body.playing[data-game] .stats>span{background:var(--night);color:var(--white);border:2px solid #ffffff1f;padding:6px 16px;border-radius:var(--r-pill);font-weight:800;font-size:clamp(14px,1.6vw,18px);box-shadow:inset 0 2px 0 #ffffff14,0 3px 0 #0005}
body[data-game] .stats{color:var(--white)}

/* đáp án: nút kẹo to, có huy hiệu chữ cái */
body[data-game] .answers{gap:var(--gs-gap)}
body[data-game] .answers>.mute{grid-column:1/-1;margin:0} /* dòng hướng dẫn Đúng/Sai nhiều ý không chiếm một ô của lưới */
body[data-game] .ans{min-height:var(--gs-ans-min);font-size:var(--gs-ans-font);font-weight:800;border-radius:20px;padding:10px 14px 10px 12px;display:flex;align-items:center;gap:10px;
  box-shadow:0 4px 0 #00000055,inset 0 3px 0 #ffffff55,inset 0 -4px 0 #00000026}
body[data-game] .ans .al{flex:none;display:grid;place-items:center;width:var(--gs-badge);height:var(--gs-badge);border-radius:50%;background:var(--white);color:var(--deep-indigo);font-weight:900;font-size:calc(var(--gs-badge)*.52);line-height:1;text-shadow:none;box-shadow:0 3px 0 #0004;position:relative;z-index:1}
body[data-game] .ans .at{position:relative;z-index:1;flex:1;min-width:0;overflow-wrap:anywhere}
body[data-game] .ans.right{box-shadow:0 0 0 5px var(--white),0 0 36px 10px #2ecc71aa,0 7px 0 #0005}
body[data-game] .ans.right::before{content:"✔";position:absolute;right:14px;top:50%;transform:translateY(-50%);font-size:34px;color:var(--white);z-index:2;text-shadow:0 2px 0 #0006}
body[data-game] .ans.wrong{opacity:.4;filter:grayscale(.6)}
body[data-game] .fb{font-size:clamp(18px,1.7vw,22px);font-weight:900;text-align:center;margin:14px 0 4px}
body[data-game] .fb.ok{color:#6dffa8}body[data-game] .fb.bad{color:#ff8a96}
body[data-game] .expl{background:var(--night);border-left:5px solid var(--acc);border-radius:var(--r-md);padding:10px 14px;color:var(--white)}

/* nút chung: nút "kẹo" có đáy */
body[data-game] #app :where(button,.btn):where(:not(.ans):not(.hmkey):not(.tfbtn):not(.bcell)){background:linear-gradient(180deg,var(--g),color-mix(in srgb,var(--g) 70%,#000));color:var(--white);border:0;border-radius:16px;padding:12px 24px;font-size:clamp(16px,1.8vw,20px);font-weight:800;
  box-shadow:0 5px 0 #0000005c,inset 0 2px 0 #ffffff44;text-shadow:0 1px 2px #0005;transition:transform .12s,box-shadow .12s,filter .15s}
body[data-game] #app :where(button,.btn):where(:not(.ans):not(.hmkey):not(.tfbtn):not(.bcell)):hover:not(:disabled){transform:translateY(-2px);filter:brightness(1.1)}
body[data-game] #app :where(button,.btn):where(:not(.ans):not(.hmkey):not(.tfbtn):not(.bcell)):active:not(:disabled){transform:translateY(4px);box-shadow:0 1px 0 #0000005c}
body[data-game] #app button.sec{background:#ffffff1c;box-shadow:0 4px 0 #0004}
body[data-game] #exitbar button{box-shadow:none;text-shadow:none;font-size:14px;font-weight:700}

/* thanh tiến trình / thời gian */
body[data-game] .bar{height:16px;background:var(--night);border:2px solid #ffffff1f;border-radius:var(--r-pill);box-shadow:inset 0 3px 6px #0008}
body[data-game] .bar>i{border-radius:var(--r-pill);background:linear-gradient(180deg,#ffe680,#ffb300);box-shadow:0 0 12px #ffcc33aa}
body[data-game] .ring::before{background:#26235a}body[data-game] .ring span{color:var(--white)}

/* ô Bingo, Ghép cặp, Lật thẻ, Millionaire... đọc được trên nền tối */
body[data-game] .bcell,body[data-game] .mcard,body[data-game] .exopt{color:var(--white)}
body[data-game] .mcard{background:linear-gradient(180deg,#34308a,#26235a);border:3px solid var(--slate);border-radius:16px;box-shadow:0 5px 0 #0005;color:var(--white)}
body[data-game] .mcard.sel{border-color:var(--acc);box-shadow:0 0 0 3px #ffd23f66,0 5px 0 #0005}
body[data-game] .mcard.q{border-color:#5aa0ff}body[data-game] .mcard.a{border-color:#ffb43a}
body[data-game] .hmch{background:var(--night);color:var(--white)}
body[data-game] .hmkey{background:linear-gradient(180deg,#4b46b4,#35318a);color:var(--white);border:0}
body[data-game] .flash .f{color:var(--white)}
body[data-game] .tfcard{background:linear-gradient(150deg,#15133a,#2a2570);color:var(--white)}
body[data-game] .mq{background:linear-gradient(180deg,#25226a,#15133a);color:var(--white);border:3px solid #6e6bd8;border-radius:20px}
body[data-game] .ans.mil{border-radius:var(--r-pill)}
body[data-game] .ladder,body[data-game] .ladder *{color:var(--white)}
body[data-game] .opt,body[data-game] label{color:var(--white)}
body[data-game] input,body[data-game] textarea{background:var(--night);color:var(--white);border:2px solid var(--slate);border-radius:14px;font-size:clamp(16px,1.8vw,20px)}
body[data-game] .lb td{color:var(--white);border-color:#ffffff1f}
body[data-game] .chip{background:#ffffff1c;color:var(--white);border:1px solid #ffffff30}
body[data-game] .code{text-shadow:0 4px 0 #0006,0 0 30px var(--g)}
body[data-game] .lane .lname{background:var(--night)}

/* khung game canvas / sân khấu */
body[data-game] canvas:not(.ink){border:3px solid color-mix(in srgb,var(--g) 70%,var(--white));border-radius:22px;box-shadow:0 0 0 5px #0003,0 18px 40px -14px #000,0 0 36px -8px var(--g)}
body[data-game] .arena,body[data-game] .bossarena{border:3px solid color-mix(in srgb,var(--g) 70%,var(--white));border-radius:22px;box-shadow:0 0 0 5px #0003,0 18px 40px -14px #000,0 0 36px -8px var(--g)}

/* màn kết quả */
body[data-game] .endcard{text-align:center;background:radial-gradient(500px 260px at 50% 0,color-mix(in srgb,var(--g) 40%,transparent),transparent 70%),linear-gradient(180deg,#2d2a66,#221f52)}
body[data-game] .endcard h1,body[data-game] .endcard h2{font-size:clamp(32px,5vw,52px);text-shadow:0 4px 0 #0005}
body[data-game] .endcard .big{filter:drop-shadow(0 8px 16px #0008)}
body[data-game] .stars{color:#4d4a96}body[data-game] .stars span.on{color:var(--gold)}

@media(max-width:600px){
  body[data-game] .card{border-radius:var(--r-lg);padding:14px}
  body[data-game] .ans{min-height:64px;border-radius:16px}
  body[data-game] main{padding:10px}
}
@media(prefers-reduced-motion:reduce){body[data-game]::after{animation:none}}
body[data-game=present]{--sh:250}
body[data-game] .sg-opt{border-radius:var(--r-lg)}
body[data-game=present] #app>*{color:var(--white)}
body[data-game=present] select{background:var(--night);color:var(--white);border:2px solid var(--slate);border-radius:var(--r-md);padding:8px}
body[data-game] .stagebar button{background:#0e0c28cc;color:var(--white);border:2px solid #ffffff40;border-radius:14px;box-shadow:0 4px 0 #0006}
body[data-game] .stagebar button:hover{background:var(--g)}

/* linh vật Cú Mèo + bong bóng lời khen ở màn kết quả */
.mascotrow{display:flex;align-items:center;justify-content:center;gap:14px;margin:4px 0 8px;flex-wrap:wrap}
.mascot{width:clamp(96px,16vw,150px);aspect-ratio:1;filter:drop-shadow(0 8px 14px #0007)}
.mascot.happy{animation:mhop 1s ease-in-out infinite}
.mascot.sad{animation:msway 2.2s ease-in-out infinite}
@keyframes mhop{0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-12px) rotate(3deg)}}
@keyframes msway{50%{transform:rotate(-4deg)}}
.bubble{position:relative;max-width:260px;padding:12px 16px;border-radius:20px;background:var(--white);color:var(--deep-indigo);font-weight:800;font-size:clamp(15px,1.8vw,19px);text-align:left;box-shadow:0 5px 0 #0004}
.bubble::before{content:"";position:absolute;left:-10px;top:50%;margin-top:-8px;border:8px solid transparent;border-right-color:var(--white);border-left:0}
@media(prefers-reduced-motion:reduce){.mascot{animation:none!important}}

/* hộp thoại (Thoát? / thông báo) trên nền game: nút phụ tối, nút chính dịu hơn, chữ luôn đọc được */
body[data-game] .notice{background:linear-gradient(180deg,#2d2a66,#1d1a4a);color:var(--white);border:2px solid var(--slate);border-radius:22px;box-shadow:0 20px 50px #000a}
body[data-game] .notice h3,body[data-game] .notice p{color:var(--white)}
body[data-game] .notice-btns button{border-radius:14px;padding:10px 22px;font-weight:800;border:2px solid #ffffff30;color:var(--white);text-shadow:none;box-shadow:0 4px 0 #0005}
body[data-game] .notice-btns button.sec,body[data-game] .notice-btns button:not([class]),body[data-game] .notice-btns button[class='']{background:#ffffff1c}
body[data-game] .notice-btns button:not(.sec):not(:only-child):last-child,body[data-game] .notice-btns button.danger{background:linear-gradient(180deg,#5b57b5,#3f3b95)}

/* hover: giữ nền tối (luật hover của giao diện sáng làm nền gần trắng, chữ trắng bị chìm) */
body[data-game] button.sec:hover:not(:disabled),body[data-game] .notice-btns button.sec:hover:not(:disabled),body[data-game] .mode:hover,body[data-game] .exopt:hover,body[data-game] .mcard:hover{background:#ffffff38;border-color:#ffffff66;color:var(--white);box-shadow:0 4px 0 #0005}
/* Luyện đề: đáp án đã chọn phải nổi rõ (nền sáng, viền trắng, dấu ✓) kể cả khi chuột vẫn đang rê lên, và có phản hồi khi nhấn.
   Lặp .exopt để thắng độ ưu tiên của quy tắc chung cho mọi nút trong game (nền xanh theo màu game, cùng cách với .tnpick). */
body[data-game] #app button.exopt{transition:transform .08s,filter .12s,box-shadow .12s}
body[data-game] #app button.exopt:active:not(:disabled){transform:translateY(3px) scale(.98);box-shadow:0 2px 0 #0005;filter:brightness(1.25)}
body[data-game] #app button.exopt.on,body[data-game] #app button.exopt.on:hover{background:var(--acc);color:#2a1a00;border:3px solid var(--white);box-shadow:0 0 0 3px var(--acc),0 6px 18px -4px var(--acc);font-weight:800}
body[data-game] #app button.exopt.on:not(.ordchip)::after{content:' ✓';font-weight:900}
body[data-game] .notice-btns button:not(.sec):hover:not(:disabled){background:linear-gradient(180deg,#6d69cf,#4c47a8);color:var(--white)}
body[data-game] #exitbar button:hover:not(:disabled){background:#ffffff38;color:var(--white);border-color:#ffffff66}
body[data-game] .ib:hover,body[data-game] .burger:hover,body[data-game] .musicbtn:hover,body[data-game] .themebtn:hover,body[data-game] header nav a:hover{background:#ffffff33;color:var(--white)}

/* đồng hồ trình chiếu: nút ▶/⏸ là hình tròn, biểu tượng căn giữa; ô giờ và chọn thời gian cùng chiều cao */
body[data-game] .tm{gap:10px}
body[data-game] #app .tm button{width:48px;height:48px;min-width:48px;padding:0!important;display:grid;place-items:center;border-radius:50%!important;font-size:20px!important;line-height:1}
body[data-game] .tm-show{background:var(--night);color:var(--acc);border-color:var(--acc);box-shadow:0 0 14px -4px var(--acc)}
body[data-game] .tm-show.low{background:var(--bad);color:var(--white)}
body[data-game] .tm select{height:48px}

/* thanh trên cùng: mọi nút (Đăng xuất, Nâng cấp...) dùng kính mờ tối, chữ trắng, cả khi hover */
body[data-game] header button,body[data-game] header nav .acct button.sec,body[data-game] header button.sec,body[data-game] header .btn,body[data-game] header nav a.upgrade{background:#ffffff1c;color:var(--white);border:1px solid #ffffff33;box-shadow:none;text-shadow:none}
body[data-game] header button:hover:not(:disabled),body[data-game] header .btn:hover,body[data-game] header nav a.upgrade:hover{background:#ffffff38;color:var(--white);border-color:#ffffff66;transform:none}
body[data-game] header nav a.on,body[data-game] header nav a.cta{background:#ffffff26;color:var(--white)}
body[data-game] header .whoname,body[data-game] header nav a.who{color:var(--white)}

/* gợn sóng khi bấm (trình chiếu): vòng sáng loang ra + chấm vàng, nhìn rõ từ cuối lớp */
.clickfx{position:fixed;z-index:99999;width:0;height:0;pointer-events:none}
.clickfx::before,.clickfx::after{content:"";position:absolute;border-radius:50%;transform:translate(-50%,-50%)}
.clickfx::before{width:30px;height:30px;border:5px solid var(--gold);box-shadow:0 0 18px var(--gold),inset 0 0 12px #ffd23f88;animation:clickring .7s ease-out forwards}
.clickfx::after{width:22px;height:22px;background:radial-gradient(var(--white),var(--gold) 60%,transparent 70%);animation:clickdot .45s ease-out forwards}
@keyframes clickring{to{width:130px;height:130px;opacity:0;border-width:2px}}
@keyframes clickdot{to{width:60px;height:60px;opacity:0}}
.stagebar button.off{opacity:.55}
@media(prefers-reduced-motion:reduce){.clickfx::before{animation-duration:.01s}}

/* bộ công cụ vẽ trên màn trình chiếu: bảng tối, biểu tượng trắng, nút đang chọn nổi màu vàng */
body[data-game] .inkbar{background:#15133af2;border:2px solid var(--slate);border-radius:20px;box-shadow:0 10px 30px #000c;color:var(--white)}
body[data-game] .inkbar .ib{background:#ffffff1c;color:var(--white);border:1px solid #ffffff2e;box-shadow:none;text-shadow:none;border-radius:var(--r-md)}
body[data-game] .inkbar .ib:hover:not(:disabled){background:#ffffff40;color:var(--white);transform:none}
body[data-game] .inkbar .ib.on{background:var(--acc);color:#2a1a00;border-color:#fff8;box-shadow:0 0 12px -2px var(--acc)}
body[data-game] .inkbar .ib:disabled{opacity:.3}
body[data-game] .inkbar .ib.wide{font-weight:700}
body[data-game] .inkbar .ik-sep{background:#ffffff40;border-color:#ffffff40}
body[data-game] .inkbar .sw{border:2px solid #ffffff55}body[data-game] .inkbar .sw.on{box-shadow:0 0 0 3px var(--acc)}
body[data-game] .ink-text{color:var(--white);background:#000a}
/* khi bảng vẽ đang mở ở đáy màn hình, đẩy các nút điều khiển lên để không bị che */
body.stage:has(.inkbar:not([hidden]):not(.top)) .sg{padding-bottom:150px}
body.stage:has(.inkbar:not([hidden]).top) .sg{padding-top:150px}

/* ===== Thẻ chọn game (trang chủ + trang chọn trò): mỗi game một màu, emoji trong huy hiệu tròn ===== */
[data-g=quiz]{--sh:265}[data-g=flash]{--sh:200}[data-g=runner]{--sh:230}[data-g=matching]{--sh:160}[data-g=truefalse]{--sh:40}[data-g=boss]{--sh:350}[data-g=race]{--sh:20}[data-g=millionaire]{--sh:250}[data-g=fishing]{--sh:195}[data-g=bingo]{--sh:320}[data-g=hangman]{--sh:140}[data-g=typing]{--sh:180}[data-g=snake]{--sh:110}[data-g=goldminer]{--sh:45}[data-g=tower]{--sh:15}[data-g=memory]{--sh:285}[data-g=balloon]{--sh:205}[data-g=shooter]{--sh:240}[data-g=maze]{--sh:275}[data-g=live]{--sh:300}[data-g=tinhnham]{--sh:30}[data-g=xepchu]{--sh:165}[data-g=luyende]{--sh:215}[data-g=wrongbook]{--sh:350}[data-g=chinhphuc]{--sh:255}
.lp-game[data-g],.mode[data-g]{--gh:hsl(var(--sh,250) 80% 58%);position:relative;border:2px solid color-mix(in srgb,var(--gh) 35%,transparent);border-radius:20px;overflow:hidden;
  background:linear-gradient(160deg,color-mix(in srgb,var(--gh) 14%,var(--card,var(--white))),var(--card,var(--white)) 70%);box-shadow:0 4px 0 color-mix(in srgb,var(--gh) 40%,transparent),0 12px 24px -16px #0006;
  transition:transform .18s cubic-bezier(.2,1.4,.4,1),box-shadow .18s,border-color .18s}
.lp-game[data-g]::before,.mode[data-g]::before{content:"";position:absolute;left:0;right:0;top:0;height:6px;background:linear-gradient(90deg,var(--gh),hsl(calc(var(--sh,250) + 50) 85% 62%))}
.lp-game[data-g]:hover,.mode[data-g]:hover{transform:translateY(-5px) rotate(-.4deg);border-color:var(--gh);box-shadow:0 8px 0 color-mix(in srgb,var(--gh) 45%,transparent),0 18px 30px -14px color-mix(in srgb,var(--gh) 60%,#000)}
.lp-game[data-g]:active,.mode[data-g]:active{transform:translateY(1px);box-shadow:0 2px 0 color-mix(in srgb,var(--gh) 40%,transparent)}
.lp-game[data-g] .lp-emo{display:grid;place-items:center;width:52px;height:52px;border-radius:16px;font-size:30px;background:linear-gradient(145deg,color-mix(in srgb,var(--gh) 30%,var(--white)),color-mix(in srgb,var(--gh) 18%,transparent));box-shadow:inset 0 2px 0 #fff8,0 3px 0 color-mix(in srgb,var(--gh) 35%,transparent);margin-bottom:6px}
.mode[data-g] b{font-size:19px}
@media(prefers-reduced-motion:reduce){.lp-game[data-g]:hover,.mode[data-g]:hover{transform:none}}
[data-g=slides]{--sh:250}[data-g=boxes]{--sh:30}[data-g=wheel]{--sh:330}[data-g=duel]{--sh:0}[data-g=bell]{--sh:45}[data-g=puzzle]{--sh:280}[data-g=crossword]{--sh:190}[data-g=nonkydieu]{--sh:20}[data-g=bomb]{--sh:10}[data-g=tug]{--sh:150}

/* ===== Học sinh vào phòng: giống màn nhập mã của game thật ===== */
body[data-game=live].student #app>.card{max-width:520px;margin:clamp(12px,5vh,56px) auto 0}
body[data-game=live] #app>.card h1,body[data-game=live] #app>.card h2{text-align:center;font-size:clamp(26px,5vw,38px)}
body[data-game=live] #app>.card input{text-align:center;font-size:clamp(20px,4.6vw,28px);font-weight:800;padding:14px 16px;margin:6px 0}
body[data-game=live] #app>.card input[inputmode=numeric]{letter-spacing:.35em;font-size:clamp(26px,6vw,38px)}
body[data-game=live] #app>.card input::placeholder{letter-spacing:0;font-weight:600;color:#fff7}
body[data-game=live] #app>.card>button,body[data-game=live] #app>.card .row button{width:100%;margin-top:8px;font-size:clamp(20px,4.4vw,26px)!important;padding:14px 24px!important}
body[data-game=live] .bad{color:#ff8a96;font-weight:800;text-align:center}
body[data-game=live] #app>.card.center{text-align:center}

/* nút ✕ mời người chơi ra khỏi phòng: nhỏ, tròn, không bị kiểu nút kẹo che tên */
body[data-game] #app .chip .x{background:#ffffff26!important;color:var(--white)!important;box-shadow:none!important;border-radius:50%!important;width:22px!important;height:22px!important;min-width:0!important;padding:0!important;margin-left:8px;font-size:12px!important;line-height:1;display:inline-grid;place-items:center;text-shadow:none!important}
body[data-game] #app .chip .x:hover:not(:disabled){background:var(--bad)!important;transform:none!important;filter:none!important}
body[data-game] .chip{display:inline-flex;align-items:center;font-weight:700}
/* màn của giáo viên khi chiếu phòng live: rộng hơn để chữ to, xa nhìn rõ */
body[data-game=live]:not(.student) #app>.card{max-width:min(860px,100%);margin-inline:auto}
/* thanh mã phòng của giáo viên khi đang chơi (live.js codeChip): nhỏ gọn ở góc dưới, to hơn khi chiếu */
body .roomchip{position:fixed;left:50%;bottom:10px;transform:translateX(-50%);z-index:var(--z-pop,40);max-width:calc(100vw - 24px);padding:6px 16px;border-radius:var(--r-pill,999px);background:var(--night);color:#fff;border:2px solid #ffffff33;box-shadow:0 4px 0 #0005;font-weight:700;font-size:15px;text-align:center}
body .roomchip[hidden]{display:none}
body .roomchip.inbar{position:static;transform:none;max-width:none;padding:4px 14px;font-size:14px;box-shadow:none;white-space:nowrap;margin:0 4px}
body .roomchip b{color:#ffd24a}.roomchip .rc{letter-spacing:.08em;font-size:1.25em}
/* máy chiếu / màn lớn: câu hỏi, đáp án, đồng hồ và bảng xếp hạng phải đọc được từ cuối lớp */
@media (min-width:1100px){
  body[data-game=live]:not(.student) #app>.card.big-q{max-width:min(1500px,96vw)}
  /* phòng chờ: QR và mã phòng là thứ cả lớp cần đọc ngay, nên chiếm phần lớn màn hình */
  body[data-game=live]:not(.student) #app>.card.lobby{max-width:min(1200px,94vw)}
  body[data-game=live]:not(.student) .lobby .lobbygrid{grid-template-columns:minmax(340px,38%) 1fr}
  body[data-game=live]:not(.student) .lobby .joinpanel{gap:8px;padding:16px}
  body[data-game=live]:not(.student) .lobby .joinpanel .qr{max-width:clamp(180px,min(20vw,32vh),340px)}
  body[data-game=live]:not(.student) .lobby .joinpanel .mute{font-size:clamp(14px,1.1vw,20px)}
  body[data-game=live]:not(.student) .lobby .joinpanel .code{font-size:clamp(48px,min(5.5vw,10vh),96px);letter-spacing:.08em;line-height:1}
  body[data-game=live]:not(.student) .lobby .playpanel .chip{font-size:clamp(16px,1.4vw,26px)}
  body[data-game=live]:not(.student) .big-q .stats{font-size:clamp(18px,1.4vw,27px);align-items:center}
  body[data-game=live]:not(.student) .big-q .mtime{font-size:clamp(27px,2.3vw,46px);padding:5px 21px}
  /* cỡ chuẩn khi chiếu (màn 1920px: câu hỏi ≈42px, đáp án ≈36px, lời giải ≈26px); --zq/--za/--ze là hệ số giáo viên chỉnh bằng nút Aa */
  body[data-game=live]:not(.student) .big-q .qtext{font-size:calc(clamp(28px,2.2vw,46px)*var(--zq,1));line-height:1.3;margin:14px 0 20px}
  body[data-game=live]:not(.student) .big-q .ans{font-size:calc(clamp(22px,1.85vw,38px)*var(--za,1));min-height:calc(clamp(76px,16vh,160px)*var(--za,1))}
  body[data-game=live]:not(.student) .big-q .expl,body[data-game=live]:not(.student) .big-q .help.ok{font-size:calc(clamp(19px,1.35vw,28px)*var(--ze,1));line-height:1.4}
  body[data-game=live]:not(.student) #app .lb td{font-size:clamp(20px,1.7vw,32px);padding:10px 14px}
  body[data-game=live]:not(.student) .distcol{font-size:clamp(20px,1.6vw,30px)}
  body[data-game=live]:not(.student) .lane .lname{width:clamp(110px,10vw,180px);font-size:clamp(16px,1.4vw,24px)}
  body[data-game=live]:not(.student) .bossrow small{font-size:clamp(16px,1.4vw,24px)}
  body[data-game=live]:not(.student) .big-q .qimg{max-height:34vh}
  body[data-game=live]:not(.student) .big-q .ans .qimg{max-height:14vh}
  body .roomchip{font-size:clamp(18px,1.4vw,28px);padding:8px 24px}
  body .roomchip.inbar{font-size:clamp(15px,1.1vw,22px);padding:4px 16px}
}
/* game tự chơi trên màn lớn (laptop nối máy chiếu): chữ câu hỏi và đáp án to hơn mặc định của điện thoại */
@media (min-width:1100px){
  body[data-game]:not([data-game=live]):not([data-game=present]) .qimg{max-height:var(--gs-qimg-max)}
}

/* thứ bậc nút: nút phụ dịu hơn nút chính (Bắt đầu) */
body[data-game] #app button.sec{background:#ffffff1f!important;border:2px solid #ffffff33!important;box-shadow:0 4px 0 #0004!important;font-weight:700!important;font-size:clamp(15px,1.6vw,18px)!important}
body[data-game] #app button.sec:hover:not(:disabled){background:#ffffff38!important}
body[data-game=live]:not(.student) #app .row button:first-child:not(.sec){font-size:clamp(22px,2.6vw,30px)!important;padding:16px 28px!important;background:linear-gradient(180deg,#ffe066,#ffb300)!important;color:#2a1a00!important;text-shadow:none!important;box-shadow:0 6px 0 #a86a00,0 0 24px -4px #ffcc33!important}
body[data-game=live]:not(.student) #app .row button:first-child:disabled{filter:grayscale(.7);opacity:.55}

/* chế độ nhẹ (máy yếu): tắt lớp nền chuyển động, bóng đổ và viền phát sáng nặng */
html[data-lite] body[data-game]::after,html[data-lite] body[data-game]::before{display:none}
html[data-lite] body[data-game]{background:linear-gradient(180deg,var(--deep-indigo),#110f2b) fixed}
/* skin hoạt hình ở chế độ nhẹ: giữ trời sáng (bỏ mây, đồi và fixed) thay vì nền tối, để màn chiếu không đổi màu khi máy tự bật chế độ nhẹ */
html[data-lite] body[data-skin=cartoon]{background:linear-gradient(var(--sky1,#8fd3f7),var(--sky2,#c4e9fb) 55%,var(--sky3,#eef8fd))}
html[data-lite] body[data-game] .card,html[data-lite] body[data-game] canvas:not(.ink),html[data-lite] body[data-game] .arena,html[data-lite] body[data-game] .bossarena{box-shadow:0 0 0 3px #0003}
html[data-lite] body[data-game] header,html[data-lite] body[data-game] .inkbar{backdrop-filter:none}
html[data-lite] .mascot,html[data-lite] .lp-game[data-g],html[data-lite] .mode[data-g]{animation:none;transition:none}

/* màn "Tạo phòng": thẻ chọn kiểu chơi, ô nhập và ô chọn đều theo nền tối */
body[data-game] .mode:not([data-g]),body[data-game] .mode.pick{background:linear-gradient(180deg,#34308a,#26235a);color:var(--white);border:2px solid var(--slate);box-shadow:0 5px 0 #0005}
body[data-game] .mode:not([data-g]) b,body[data-game] .mode.pick b{color:var(--white)}
body[data-game] .mode:not([data-g]) span,body[data-game] .mode.pick span{color:#d4d2ff}
body[data-game] .setup .mode.pick:hover{border-color:#fff8;background:linear-gradient(180deg,#3d39a0,#2b2866)}
body[data-game] .setup .mode.pick:has(input:checked){background:linear-gradient(180deg,#5b57d6,#3d39a8);border-color:var(--acc);box-shadow:0 0 0 3px #ffd23f55,0 5px 0 #0005,0 0 26px -6px var(--acc)}
body[data-game] .setup .mode.pick:has(input:checked) .tick{background:var(--acc);border-color:var(--acc);color:#2a1a00}
body[data-game] .setup .tick{border-color:#fff8}
body[data-game] select,body[data-game] .fld select,body[data-game] .fld input{background:var(--night);color:var(--white);border:2px solid var(--slate);border-radius:14px}
body[data-game] select option{background:#15133a;color:var(--white)}
body[data-game] .seclab{color:#c4c1ff}
body[data-game] .flab{color:var(--white)}
body[data-game] .fld small{color:#b9b6ef}
body[data-game] .qpill{color:var(--acc);background:#ffd23f22;border-color:#ffd23f66}
body[data-game] .unit span{color:#b9b6ef}
body[data-game] .setupfoot{border-top-color:#ffffff22}

/* độ tương phản: chữ trắng trên nút vàng/xanh lá phải đọc được ở mọi bộ màu */
body[data-game]{--c0:#e11d48;--c1:#2563eb;--c2:#b8570a;--c3:#15803d;--ans3:#7c3aed} /* chữ trắng trên 4 màu đáp án đạt tương phản ≥ 4,5:1; ô thứ 4 màu tím để không nhầm với xanh lá = đáp án đúng */
.avatar{background:linear-gradient(135deg,var(--brand,var(--indigo)),color-mix(in srgb,var(--brand,var(--indigo)) 65%,#000));text-shadow:0 1px 2px #0005}
/* Nút quyền trợ giúp (Triệu phú): quy tắc nút chung đặt padding 12px 24px làm chữ/biểu tượng lệch phải, nên đặt lại và căn giữa */
body[data-game] #app .life{padding:0!important;display:grid;place-items:center;line-height:1;font-size:clamp(20px,2.2vw,26px)}
body[data-game] #app .life:first-child{font-size:clamp(15px,1.6vw,19px)}
/* Nút + / − chỉnh điểm đội (Ô bí mật, Đối kháng…): quy tắc nút chung đặt padding 12px 24px và ép nút rộng 52px nên dấu + − tụt xuống mép dưới; đặt lại cỡ nhỏ và căn giữa */
body[data-game] #app .bx-adj button{width:34px;height:28px;min-height:0;padding:0!important;border-radius:10px;display:grid;place-items:center;line-height:1;font-size:18px;font-weight:700}

/* Điện thoại: nhường tối đa chỗ cho câu hỏi, đáp án và sân chơi.
   Thanh đầu trang chỉ còn một hàng mỏng (không menu ☰, không chữ logo), thanh thoát game gọn lại, bớt đệm của thẻ. */
@media (max-width:720px),(max-height:520px){
  body[data-game] .burger{display:none}
  body[data-game] header{padding:4px 10px;gap:6px;flex-wrap:nowrap;min-height:0}
  body[data-game] .logo{flex:1;min-width:0}
  body[data-game] .logotext{display:none}
  body[data-game] .logomark{width:28px;height:28px}
  body[data-game] .tools{gap:6px}
  body[data-game] .tools .musicbtn,body[data-game] .tools .themebtn,body[data-game] .tools .inkbtn{width:34px;height:34px;font-size:15px}
  body[data-game] #exitbar{margin-top:4px;padding:0 10px;gap:6px}
  body[data-game] #exitbar .mute{display:none}
  body[data-game] #exitbar button{padding:5px 12px;font-size:13px;min-height:34px}
  @media (pointer:coarse){ /* cảm ứng: nút nhạc/giao diện/thoát đạt 40px (đủ ngón tay, vẫn giữ thanh mỏng) */
    body[data-game] .tools .musicbtn,body[data-game] .tools .themebtn,body[data-game] .tools .inkbtn{width:40px;height:40px}
    body[data-game] #exitbar button{min-height:40px}
  }
  body[data-game] main{padding:6px 8px 10px}
  body[data-game] .card{padding:12px;border-radius:var(--r-lg);margin-bottom:8px}
  body[data-game] .qtext{margin:8px 0 12px}
  body[data-game] .ans{padding:8px 12px 8px 10px}
/* Điện thoại: sân chơi (canvas) thu theo chiều cao còn lại để thấy đủ câu hỏi, đáp án và nút điều khiển mà không phải cuộn */
  body[data-game]:not(.fs) canvas.sncanvas,body[data-game]:not(.fs) canvas.tdcanvas{width:auto!important;height:auto;max-width:100%!important;max-height:max(200px,calc(100vh - 400px));max-height:max(200px,calc(100dvh - 400px));margin-left:auto;margin-right:auto}
  /* ghép cặp: hai cột thay vì một cột dài */
  body[data-game] .mpair{grid-template-columns:1fr 1fr;gap:8px}
  body[data-game] .mpair .mcard{min-height:56px;padding:8px 9px;font-size:13.5px;gap:6px}
  /* triệu phú: bảng tiền thưởng chỉ giữ dòng hiện tại (tiền thưởng đã có ở thanh trên) */
  body[data-game] .ladder .rung:not(.now){display:none}
  body[data-game] .millwrap{gap:8px}
  /* lời hướng dẫn dài dưới sân chơi: ẩn bớt để nhường chỗ */
  body[data-game] .card>.mute:last-child{font-size:13px;margin:6px 0 0}
/* Điện thoại: bốn đáp án xếp 2x2, câu hỏi gọn hơn, bỏ dòng hướng dẫn dài dưới sân chơi (luật đã có ở màn hình bắt đầu) */
  body[data-game] .snlegend{grid-template-columns:1fr 1fr;gap:6px;margin:8px 0}
  body[data-game] .snopt{padding:6px 8px;font-size:14px;line-height:1.25}
  body[data-game] .qbox{padding:8px 12px;margin:6px 0}
  body[data-game] .qbox .qtext{margin:0;font-size:clamp(17px,4.6vw,22px)}
  body[data-game] .card>p.mute.center{display:none}
  body[data-game] .stats{gap:6px}
  body[data-game] .stats>span{padding:4px 12px;font-size:14px}
  body[data-game]:not(.fs) canvas.sncanvas,body[data-game]:not(.fs) canvas.tdcanvas{max-height:max(200px,calc(100vh - 360px));max-height:max(200px,calc(100dvh - 360px))}
/* Điện thoại: lưới thẻ ghép cặp nhỏ gọn để cả 12 thẻ vừa một màn hình */
  body[data-game] .mgrid:not(.mm){grid-template-columns:1fr 1fr;gap:6px;margin:6px 0}
  body[data-game] #app .mgrid:not(.mm) .mcard{min-height:48px;padding:5px 8px;font-size:12.5px;line-height:1.2;border-width:2px;border-radius:var(--r-md);box-shadow:0 3px 0 #0005}
  body[data-game] .mstats{gap:6px}
  body[data-game] .mstats>*{padding:4px 6px}
  /* boss: cảnh đánh boss thấp lại để đủ chỗ cho câu hỏi và đáp án */
  body[data-game] .bossarena{min-height:0;height:clamp(110px,22vh,170px)}
  body[data-game] #app .mpair .mcard{min-height:46px;padding:5px 8px;font-size:12.5px;line-height:1.2;border-width:2px;border-radius:var(--r-md);box-shadow:0 3px 0 #0005}
  body[data-game] #app .mpair .mcard .mtxt{font-size:12.5px;line-height:1.2}
  body[data-game] .mmhint{font-size:13px;line-height:1.3;margin:8px 0 0;min-height:0;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
  body[data-game] .mmpill{padding:4px 6px}
  body[data-game] .mmpill small{font-size:10px}
  body[data-game] .mmpill b{font-size:14px}
  body[data-game]:not(.fs) #app canvas:not(.ink):not(.wh-canvas){width:auto!important;height:auto;max-width:100%!important;max-height:max(220px,calc(100vh - 330px));max-height:max(220px,calc(100dvh - 330px));margin-left:auto;margin-right:auto}
  /* triệu phú: bỏ thẻ bảng tiền thưởng (tiền thưởng hiện ở thanh trên), nút khoá/dừng nằm cùng hàng, đáp án thấp hơn, quyền trợ giúp nhỏ lại */
  body[data-game] .millwrap>.card:nth-child(2){display:none}
  body[data-game] .ans.mil{min-height:44px;padding-top:6px;padding-bottom:6px}
  body[data-game] .mq{margin:4px 0 8px}
  body[data-game] #app .life{width:48px;height:48px;min-height:0}
  body[data-game] .millwrap .row{gap:8px;flex-wrap:nowrap;margin-top:8px!important}
  body[data-game] .millwrap .row button{flex:1;min-width:0;padding-left:8px;padding-right:8px}
  /* né & chạy: sàn chơi thấp lại theo màn hình */
  body[data-game]:not(.fs) .arena{height:max(300px,calc(100vh - 290px));height:max(300px,calc(100dvh - 290px))}
  /* câu cá: hồ thấp lại theo màn hình (cá xếp theo chiều cao thật của hồ) */
  body[data-game]:not(.fs) .pond{height:max(260px,calc(100vh - 380px));height:max(260px,calc(100dvh - 380px));margin:6px 0}
  /* nút điều khiển (mũi tên, BẮN) thấp hơn nhưng vẫn đủ lớn để chạm */
  body[data-game] .row.tfrow{gap:8px;margin-top:6px}
  body[data-game] #app .row.tfrow button{min-height:52px;padding-top:6px;padding-bottom:6px}
}

/* phòng chờ học sinh: chọn hình đại diện, xem các bạn đã vào */
.avpick{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:8px 0;max-width:420px;margin-inline:auto}
.avpick .avbtn{width:48px;height:48px;min-height:48px;padding:0;font-size:26px;line-height:1;border-radius:50%}
.avpick .avbtn.on{outline:4px solid var(--acc)}
.peers{margin:8px 0}.peerrow{display:flex;flex-wrap:wrap;gap:4px;justify-content:center;font-size:26px;margin-top:6px;max-height:112px;overflow:hidden}

/* iPhone có tai thỏ / thanh home: chừa vùng an toàn ở hai mép và đáy */
body{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
body.student #app{padding-bottom:env(safe-area-inset-bottom)}

/* bục top 3 ở màn kết thúc phòng live */
.podium{display:flex;align-items:flex-end;justify-content:center;gap:clamp(8px,2vw,28px);margin:18px 0}
.pod{display:flex;flex-direction:column;align-items:center;min-width:0;flex:1;max-width:clamp(120px,24vw,320px)}
.pname{font-weight:800;font-size:clamp(16px,2.2vw,40px);text-align:center;overflow-wrap:anywhere}.pscore{font-size:clamp(14px,1.6vw,28px);color:var(--accink);font-weight:700}
.pstep{width:100%;display:grid;place-items:center;border-radius:14px 14px 0 0;background:var(--panel);border:3px solid var(--line2);font-size:clamp(28px,4vw,64px)}
.p1 .pstep{height:clamp(110px,20vh,220px);border-color:var(--acc)}.p2 .pstep{height:clamp(80px,14vh,160px)}.p3 .pstep{height:clamp(56px,10vh,110px)}
@media (prefers-reduced-motion:no-preference){.pod{animation:podrise .7s both}.p1{animation-delay:.5s}.p2{animation-delay:.25s}}
@keyframes podrise{from{transform:translateY(30px);opacity:0}}

/* ---------- Game trình chiếu: chuyển động và độ nổi ---------- */
/* .sg đã cao 100vh: đệm của main trên điện thoại sẽ làm trang luôn tràn 16px, fitBody tưởng nội dung dài và cắt đáp án */
body[data-game=present] main{padding:0}
body[data-game=present] .sg-body.measure,body[data-game=present] .sg-body.measure *{animation:none!important}
/* Ô bí mật: khung .sg-main cha cũng đang xoay 3D (bxOpen) lúc đo, làm scrollHeight phình ra, fitBody co chữ về 70% và giới hạn khung đáp án ở 160px (đáp án bị cắt cụt, bên dưới trống) */
body[data-game=present] .bx-open>.sg-main:has(.sg-body.measure){animation:none!important}
@keyframes sgIn{from{opacity:0;transform:translateY(22px) scale(.97)}}
@keyframes sgPop{0%{transform:scale(1)}45%{transform:scale(1.07)}100%{transform:scale(1.02)}}
@keyframes bxIn{from{opacity:0;transform:scale(.4) rotate(-12deg)}}
@keyframes bxWig{0%,100%{rotate:0deg}25%{rotate:-6deg}75%{rotate:6deg}}
@keyframes bxOpen{from{opacity:0;transform:perspective(900px) rotateY(-80deg) scale(.7)}}
@keyframes whName{0%{opacity:0;transform:scale(.3) rotate(-8deg)}60%{transform:scale(1.15) rotate(2deg)}100%{opacity:1;transform:none}}
@keyframes dlHot{50%{box-shadow:0 0 0 10px #fff3,0 0 46px var(--acc)}}
body[data-game=present] .sg-body.in .sg-q{animation:sgIn .45s cubic-bezier(.2,.9,.3,1.1) backwards}
body[data-game=present] .sg-body.in .sg-opt{animation:sgIn .5s cubic-bezier(.2,.9,.3,1.1) backwards;animation-delay:calc(.12s + var(--i,0)*.09s)}
body[data-game=present] .sg-opt{border:3px solid #ffffff38;box-shadow:0 6px 0 #0004,inset 0 -4px 0 #0002}
body[data-game=present] .sg-opt.right{animation:sgPop .5s cubic-bezier(.3,1.6,.5,1) both;box-shadow:0 0 0 6px var(--white),0 0 44px 6px #fff8}
body[data-game=present] .sg-fill.show{animation:sgPop .5s cubic-bezier(.3,1.6,.5,1) both}
body[data-game=present] .sg-q{text-shadow:0 3px 0 #0004}
/* thanh công cụ và đồng hồ vừa phải, không lấn câu hỏi */
body[data-game=present] .stagebar button{width:38px;height:38px;font-size:16px;border-radius:12px;box-shadow:0 3px 0 #0006}
body[data-game=present] .stagebar{gap:5px}
body[data-game=present] .sg{padding-top:8px}
/* hàng đầu nằm cùng hàng với thanh công cụ (nhường chỗ bên phải); đồng hồ xuống hàng dưới, một dòng gọn */
body[data-game=present] .sg-top{--stb:272px;gap:6px 10px;padding-right:var(--stb);min-height:38px}
/* đệm phải chỉ chừa chỗ thanh công cụ cho hàng đầu; hàng đồng hồ nằm dưới thanh nên dùng hết chiều ngang (không thì đồng hồ, nút, chọn giờ và thanh bị xuống 3-4 dòng) */
body[data-game=present] .sg-top .tm{flex:0 0 calc(100% + var(--stb));justify-content:flex-start;gap:8px;flex-wrap:nowrap;margin-bottom:2px}
body[data-game=present] .tm-bar{flex:1 1 60px;flex-basis:60px;height:6px}
body[data-game=present] .sg-count{font-size:clamp(14px,1.4vw,20px);padding:3px 12px}
body[data-game=present] .tm-show{font-size:clamp(22px,2.6vw,40px);min-width:88px;border-width:2px;padding:0 12px}
body[data-game=present] #app .tm button{width:38px;height:38px;min-width:38px;font-size:16px!important}
body[data-game=present] .tm select{height:38px;font-size:15px;padding:0 8px}
body[data-game=present] .sg-count{background:var(--night);border:2px solid var(--acc);border-radius:999px}
body[data-game=present] .sg-prog{height:10px;border-radius:99px}
body[data-game=present] .sg-prog i{background:linear-gradient(90deg,var(--c1),var(--acc));border-radius:99px}
body[data-game=present] .sg-ctl button{border-radius:var(--r-lg);box-shadow:0 3px 0 #0005;transition:transform .12s,box-shadow .12s}
body[data-game=present] .sg-ctl button:active{transform:translateY(2px);box-shadow:0 1px 0 #0005}
/* Điện thoại: thu nhỏ chữ, đệm và nút để câu hỏi, đủ 4 đáp án và hàng nút cùng vừa một màn hình */
@media (max-width:600px){
  body[data-game=present] .sg{gap:8px;padding:6px 10px 10px;padding-top:6px}
  body[data-game=present] .sg-body{padding:12px 8px 10px;gap:10px}
  body[data-game=present] .sg-q{font-size:calc(clamp(17px,4.6vw,22px)*var(--fit,1)*var(--zq,1))}
  body[data-game=present] .sg-opts{gap:8px}
  body[data-game=present] .sg-opt{padding:calc(9px*var(--za,1)) calc(12px*var(--za,1));border-width:2px;font-size:calc(clamp(15px,4.2vw,19px)*var(--fit,1)*var(--za,1));box-shadow:0 4px 0 #0004,inset 0 -3px 0 #0002}
  body[data-game=present] .sg-fill{padding:calc(12px*var(--za,1));font-size:calc(clamp(16px,4.4vw,20px)*var(--fit,1)*var(--za,1))}
  body[data-game=present] .sg-expl{padding:calc(10px*var(--ze,1)) calc(12px*var(--ze,1));font-size:calc(clamp(15px,4vw,18px)*var(--fit,1)*var(--ze,1))}
  body[data-game=present] .sg-hint{display:none}
  body[data-game=present] .sg-ctl{gap:6px}
  body[data-game=present] .sg-ctl button{font-size:13px;padding:6px 12px;min-height:38px}
  body[data-game=present] .stagebar button{width:34px;height:34px;font-size:14px}
  body[data-game=present] .sg-top{--stb:236px}
  body[data-game=present] .tm-show{font-size:20px;min-width:72px}
  body[data-game=present] #app .tm button,body[data-game=present] .tm select{height:34px;min-width:34px}
}
/* ô bí mật */
body[data-game=present] .bx-box{position:relative;box-shadow:0 7px 0 #2e2a8a,0 12px 24px -8px #000a;animation:bxIn .45s cubic-bezier(.3,1.5,.5,1) backwards;animation-delay:calc(var(--i,0)*35ms)}
body[data-game=present] .bx-box:hover:not(:disabled){transform:translateY(-4px) scale(1.06)}
body[data-game=present] .bx-box:hover:not(:disabled) .bx-gift{animation:bxWig .5s infinite}
body[data-game=present] .bx-box:active:not(:disabled){transform:translateY(4px);box-shadow:0 2px 0 #2e2a8a}
body[data-game=present] .bx-gift{position:absolute;right:8px;top:4px;font-size:.42em;opacity:.9}
body[data-game=present] .bx-box.done{box-shadow:none;background:color-mix(in srgb,var(--tc,#444) 28%,var(--deep));color:var(--white)}
body[data-game=present] .bx-open>.sg-main{animation:bxOpen .5s cubic-bezier(.2,.9,.3,1.1)}
body[data-game=present] .bx-team{box-shadow:0 5px 0 #0004}
/* vòng quay và đối kháng */
body[data-game=present] .wh-name{animation:whName .6s cubic-bezier(.3,1.5,.5,1);text-shadow:0 4px 0 #0006,0 0 30px #ffcc3388}
/* vòng quay: số câu chỉ là nhãn nhỏ, nhường chỗ cho câu hỏi; các nút phụ gọn lại */
body[data-game=present] .wh-qno{align-self:flex-start;font-size:clamp(15px,1.2vw,20px);font-weight:800;padding:3px 14px;border-radius:999px;background:var(--acc);color:#1b1230;text-shadow:none;border:2px solid #0006}
body[data-game=present] .wh-panel{gap:8px}
body[data-game=present] .wh-panel>button{align-self:flex-start;padding:6px 16px}
body[data-game=present] .wh-q{gap:8px}
body[data-game=present] .wh-q>button{align-self:flex-start}
body[data-game=present] .wh-spin{border-radius:999px;box-shadow:0 6px 0 #0005,0 0 30px -6px var(--acc)}
body[data-game=present] .wh-canvas{box-shadow:0 14px 40px #000a,0 0 0 4px #14122b}
body[data-game=present] .dl-team{box-shadow:0 6px 0 #0004}
body[data-game=present] .dl-team.hot{animation:dlHot .8s infinite}
body[data-game=present] .dl-buzz{box-shadow:0 6px 0 #0006;transition:transform .1s,box-shadow .1s}
body[data-game=present] .dl-buzz:active:not(:disabled){transform:translateY(5px);box-shadow:0 1px 0 #0006}
/* bảng chỉnh cỡ chữ trình chiếu */
.stagebar{align-items:flex-start}
.zm-panel{position:absolute;top:44px;right:0;width:min(320px,calc(100vw - 16px));display:flex;flex-direction:column;gap:10px;background:#0e0c28f2;color:var(--white);border:2px solid #ffffff40;border-radius:var(--r-lg);padding:14px;box-shadow:0 10px 30px #000a}
.zm-panel[hidden]{display:none}
.zm-row{display:grid;grid-template-columns:1fr auto;gap:4px 10px;align-items:center}
.zm-row input{grid-column:1/-1;width:100%}
body[data-game] .stagebar .zm-panel button{width:auto;height:auto;align-self:flex-start;padding:8px 14px;font-size:15px;white-space:nowrap}
.sg-q,.sg-expl{position:relative;translate:var(--qx,0) var(--qy,0);width:var(--qw,auto)}
.sg-expl{translate:var(--ex,0) var(--ey,0);width:var(--ew,auto)}
/* sửa chữ, kéo, đổi cỡ ngay trên màn chiếu: nút mờ cho đỡ vướng, rõ khi rê chuột hoặc đang sửa */
.sg-tools{position:absolute;top:-16px;left:-10px;display:flex;gap:4px;z-index:2}
body[data-game=present] .sg-body .sg-eb{box-sizing:border-box;display:grid;place-items:center;width:30px!important;height:30px!important;min-width:0!important;min-height:0!important;padding:0!important;font-size:15px;line-height:1;border-radius:var(--r-sm,8px);box-shadow:0 2px 0 #0006;opacity:.3;transition:opacity .15s;touch-action:none}
body[data-game=present] .sg-body .sg-rs{position:absolute;right:-8px;bottom:-12px;cursor:nwse-resize;z-index:2}
body[data-game=present] .sg-body .sg-move{cursor:move}
/* có chuột: ẩn hẳn nút sửa/di chuyển/đổi cỡ cho tới khi rê vào câu hỏi, kẻo chiếu lên bảng thành vết xám; màn cảm ứng giữ mờ .3 để còn thấy mà bấm */
@media (hover:hover){body[data-game=present] .sg-body .sg-eb{opacity:0}}
.sg-q:hover .sg-eb,.sg-expl:hover .sg-eb,.sg-eb:focus-visible{opacity:1!important}
.sg-modal{position:fixed;inset:0;z-index:var(--z-modal);display:flex;align-items:flex-start;justify-content:center;padding:6vh 16px;overflow:auto;background:var(--scrim,#000a)}
/* hộp sửa chữ luôn sáng, không theo giao diện tối của sân chơi hay chế độ sáng/tối của trang */
.sg-modal-card{color-scheme:light;--bg:#fff;--card:#fff;--ink:#1c1b33;--mute:#6b6a85;--panel:#eceef7;--line:#cfd2e4;--line2:#b4b8d4;--sel:#dfe3f6;--acc:var(--gold);--brand:#6c3df4;--brand2:#6c3df4;width:min(860px,100%);display:flex;flex-direction:column;gap:12px;padding:18px;background:#fff;color:var(--ink);border:2px solid var(--line);font-size:16px}
.sg-modal-card h3{color:var(--ink)}
.sg-modal-card .rtb{background:#f6f7fc;border:1px solid var(--line);box-shadow:none}
.sg-modal-card .rtb-b,.sg-modal-card .rtb-sym{background:#fff;color:var(--ink);border:1px solid var(--line2);box-shadow:none}
.sg-modal-card .rtb-b.on{background:var(--brand);color:#fff;border-color:var(--brand)}
.sg-modal-card button.sec{background:#eceef7;color:var(--ink);border:1px solid var(--line2);box-shadow:none}
.sg-modal-card .rf{background:#fff;color:var(--ink)}
.sg-modal-card .rtb-pop{background:#fff;border-color:var(--line)}
.sg-modal-card h3{margin:0}
.sg-modal-card .rtb{position:relative;margin:0;flex-wrap:wrap;overflow-x:visible} /* hộp hẹp: thanh xuống hàng thay vì cuộn ngang */
.sg-modal-card .rf{font-size:20px;min-height:8em;max-height:46vh;overflow:auto}
.sg-modal-warn{color:var(--bad);font-weight:700}
/* khung cuộn của .sg-body (khi câu dài) cắt phần nhô ra: chừa lề để nút sửa/kéo/đổi cỡ nằm hẳn trong khung */
body[data-game=present] .sg-body{padding:20px 14px 16px}
/* bảng chấm điểm học sinh xung phong (trình chiếu câu hỏi): tên được xuống dòng để đọc đủ, nút gọn */
.sg-score{position:fixed;right:12px;top:70px;bottom:12px;width:min(360px,calc(100vw - 24px));z-index:900;display:flex;flex-direction:column;gap:8px;padding:12px;background:#0e0c28f2;color:var(--white);border:2px solid #ffffff40;border-radius:var(--r-lg);box-shadow:0 10px 30px #000a;overflow:hidden}
.sg-score[hidden]{display:none}
.sg-score .sc-head,.sg-score .sc-pts,.sg-score .sc-foot{display:flex;align-items:center;gap:8px;justify-content:space-between;flex-wrap:wrap}
.sg-score .sc-pts input{width:84px}
.sg-score textarea{flex:1;min-height:120px;resize:none}
.sg-score .sc-rows{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:6px;padding-right:2px}
.sg-score .sc-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;gap:6px;align-items:center}
body[data-game] .sg-score button{min-width:0!important;min-height:0!important;box-shadow:none!important;font-size:14px!important}
body[data-game] .sg-score .sc-n{height:auto!important;width:auto!important;text-align:left;justify-content:flex-start;background:#ffffff14!important;color:var(--white)!important;border-radius:var(--r-sm,8px);padding:6px 10px!important;font-size:16px!important;line-height:1.25;white-space:normal;overflow-wrap:anywhere}
.sg-score .sc-s{min-width:1.8em;text-align:center;font-size:18px;color:var(--acc)}
body[data-game] .sg-score button.tiny{height:34px!important;width:auto!important;padding:0 10px!important;white-space:nowrap}
body[data-game] .sg-score .sc-foot button{height:36px!important;width:auto!important;padding:0 12px!important}
/* ô lật mảnh ghép: liền nhau, không viền, không bo, không bóng; xen kẽ hai độ sáng để vẫn phân biệt các ô */
body[data-game] .pz-tiles .pz-tile{border:0!important;border-radius:0!important;box-shadow:none!important;margin:0}
body[data-game] .pz-tiles .pz-tile:nth-child(even){filter:brightness(.9)}
body[data-game] .pz-tiles .pz-tile:hover:not(:disabled){transform:none;filter:brightness(1.15)}

/* màn kết quả của giáo viên: gọn trong một màn hình, hai cột, nút "Câu tiếp" dính đáy */
body[data-game=live]:not(.student) #app .res .resgrid{display:grid;gap:var(--sp-4);align-items:start}
body[data-game=live]:not(.student) #app .res .help{padding:var(--sp-2) var(--sp-3);margin:var(--sp-2) 0}
body[data-game=live]:not(.student) #app .res h3{margin:var(--sp-2) 0}
body[data-game=live]:not(.student) #app .res .resfoot{position:sticky;bottom:0;z-index:var(--z-sticky,5);padding:var(--sp-3) 0 var(--sp-2);margin-top:var(--sp-2);background:linear-gradient(transparent,var(--bg) 35%);display:flex;align-items:stretch;gap:var(--sp-3)}
body[data-game=live]:not(.student) #app .res .resfoot button{width:auto;flex:1;margin:0}
@media (min-width:900px){
  body[data-game=live]:not(.student) #app .res .resgrid{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)}
  body[data-game=live]:not(.student) #app .res .lb td{font-size:clamp(16px,1.3vw,24px);padding:6px 12px}
  body[data-game=live]:not(.student) #app .res .distcol{font-size:clamp(16px,1.3vw,24px)}
  body[data-game=live]:not(.student) #app .res .stats{font-size:clamp(18px,1.4vw,26px)}
  body[data-game=live]:not(.student) #app .res .tower{height:200px}
}

/* màn kết quả sinh động: cột phân bố mọc lên lần lượt, bảng xếp hạng trượt vào, tim vỡ, tháp/dây chạy mượt */
@media (prefers-reduced-motion:no-preference){
  @keyframes growY{from{transform:scaleY(0)}}
  @keyframes rowIn{from{opacity:0;transform:translateX(36px)}}
  @keyframes rightPop{0%{transform:scale(1)}40%{transform:scale(1.18);filter:brightness(1.4)}100%{transform:scale(1)}}
  @keyframes heartLost{0%{transform:scale(1)}30%{transform:scale(1.9) rotate(-14deg);filter:drop-shadow(0 0 8px var(--red))}60%{transform:scale(.8) rotate(10deg)}100%{transform:scale(1)}}
  @keyframes chipHurt{25%{transform:translateX(-7px)}50%{transform:translateX(7px)}75%{transform:translateX(-4px)}}
  @keyframes fallIn{from{transform:translateY(-14px);opacity:0}}
  @keyframes feedIn{from{opacity:0;transform:translateX(-30px)}}
  @keyframes blockDrop{from{transform:translateY(-60px);opacity:0}}
  body[data-game=live] .res .distbar{transform-origin:bottom;animation:growY .6s cubic-bezier(.2,.9,.3,1.2) both}
  body[data-game=live] .res .distcol:nth-child(2) .distbar{animation-delay:.08s}
  body[data-game=live] .res .distcol:nth-child(3) .distbar{animation-delay:.16s}
  body[data-game=live] .res .distcol:nth-child(4) .distbar{animation-delay:.24s}
  body[data-game=live] .res .distbar.right{animation:growY .6s cubic-bezier(.2,.9,.3,1.2) both,rightPop .6s .65s both}
  body[data-game=live] .res .help.ok{animation:fallIn .35s both}
  body[data-game=live] .res .top5 tr{animation:rowIn .45s both}
  body[data-game=live] .res .top5 tr:nth-child(2){animation-delay:.12s}
  body[data-game=live] .res .top5 tr:nth-child(3){animation-delay:.24s}
  body[data-game=live] .res .top5 tr:nth-child(4){animation-delay:.36s}
  body[data-game=live] .res .top5 tr:nth-child(5){animation-delay:.48s}
  body[data-game=live] .res .chip.hurt{animation:chipHurt .5s}
  body[data-game=live] .res .hearts .lost{display:inline-block;animation:heartLost .9s both}
  body[data-game=live] .res .help.fallen{animation:fallIn .4s both,chipHurt .5s .3s}
  body[data-game=live] .res .stealist li{animation:feedIn .4s both}
  body[data-game=live] .res .stealist li:nth-child(2){animation-delay:.15s}
  body[data-game=live] .res .stealist li:nth-child(3){animation-delay:.3s}
  body[data-game=live] .res .tcol .fl.nb{transform-box:fill-box;animation:blockDrop .7s .15s cubic-bezier(.3,1.4,.5,1) both}
  body[data-game=live] .res .knot{filter:drop-shadow(0 0 10px #fbbf24)}
}

/* hình vẽ SVG của các chế độ phòng */
body[data-game=live] .hearts i{display:inline-block;width:1.15em;height:1.05em;vertical-align:-.2em;margin-right:2px}
body[data-game=live] .art{margin-inline:auto}
body[data-game=live] .big.art{width:112px;height:112px;font-size:0}
body[data-game=live] .stealbox .ninja{width:84px;height:84px}
body[data-game=live] .ico{display:inline-block;width:1.5em;height:1.5em;vertical-align:-.4em;margin-right:var(--sp-2)}
body[data-game=live] .stealbtn{display:flex;align-items:center;justify-content:center}
body[data-game=live] .fb .ico{width:1.3em;height:1.3em}
body[data-game=live] .tugrow{display:flex;align-items:center;gap:var(--sp-2);margin:var(--sp-2) 0}
body[data-game=live] .tugrow .rope{flex:1;margin:0}
body[data-game=live] .puller{width:clamp(64px,7vw,110px);aspect-ratio:100/110;flex:none}
body[data-game=live] .puller.flip{transform:scaleX(-1)}
body[data-game=live] .tcol .tw{flex:1;min-height:0;transition:none}
body[data-game=live] .tcol .tw svg{display:block}

/* cảnh nền và linh vật đồng hành (scene.js) */
.scene{position:fixed;left:0;right:0;bottom:0;height:min(26vh,200px);z-index:-1;pointer-events:none;opacity:.9}
.buddy{position:fixed;left:12px;bottom:12px;width:84px;z-index:40;pointer-events:none}
.buddy .mascot{width:84px;filter:drop-shadow(0 6px 10px #0008)}
.buddy .mascot.happy,.buddy .mascot.sad{animation:none}
.buddy .bbl{position:absolute;left:72px;bottom:62px;white-space:nowrap;padding:6px 12px;border-radius:var(--r-pill);background:#fff;color:var(--deep-indigo);font-weight:800;font-size:14px;box-shadow:0 4px 0 #0004;opacity:0;transform:scale(.6);transform-origin:left bottom;transition:opacity .2s,transform .25s cubic-bezier(.3,1.6,.5,1)}
.buddy.say .bbl{opacity:1;transform:none}
.buddy.cheer .mascot{animation:mhop .45s 3}
.buddy.oops .mascot{animation:msway .7s 2}
@media (max-width:1199px){.buddy{display:none}}
@media (max-width:760px){.scene{height:min(18vh,130px)}}
body[data-skin=cartoon] .scene{display:none}
@media (prefers-reduced-motion:reduce){.buddy .mascot{animation:none!important}}
html[data-lite] .scene{display:none}

/* hình trong từng game: Đoán chữ, Đúng/Sai, Lật thẻ, Bingo */
body[data-game] .hmstage{display:flex;align-items:center;gap:var(--sp-4)}
body[data-game] .hmstage .qbox{flex:1;min-width:0}
body[data-game] .gallows{width:clamp(72px,12vw,120px);aspect-ratio:120/130;flex:none}
body[data-game] .tfico{display:inline-block;width:1.4em;height:1.4em;vertical-align:-.3em;margin-right:var(--sp-2)}
body[data-game] .mmback{display:block;width:62%;max-width:64px;margin:auto;font-size:0}
body[data-game] .bcell{position:relative}
body[data-game] .bcell .stamp{position:absolute;right:4px;top:4px;width:30px;height:30px;pointer-events:none}
@media (prefers-reduced-motion:no-preference){
  @keyframes stampIn{from{transform:scale(2.4) rotate(-25deg);opacity:0}}
  body[data-game] .bcell .stamp{animation:stampIn .3s cubic-bezier(.3,1.4,.5,1) both}
}

/* hình trang trí các game gõ / xếp chữ / tính nhẩm / flashcard / ghép đôi */
body[data-game] .card:has(>.gicon){position:relative}
body[data-game] .gicon{position:absolute;right:14px;top:-26px;width:76px;aspect-ratio:80/60;pointer-events:none;filter:drop-shadow(0 4px 6px #0006);z-index:1}
body[data-game] .mcard .mkind{flex:none;display:inline-block;width:22px;height:22px;margin-right:6px;vertical-align:middle;opacity:.95}
body[data-game] .mpair .mcard.done .mkind{display:none}

/* hình trong game trình chiếu */
body[data-game=present] .bx-gift{display:block;width:62%;max-width:96px;margin:2px auto 0;font-size:0;filter:drop-shadow(0 4px 4px #0006)}
body[data-game=present] .bx-box:not(.done){display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
body[data-game=present] .bx-box .bx-num{position:absolute;left:8px;top:4px;font-size:.45em;opacity:.9}
body[data-game=present] .bm-bomb{width:clamp(110px,min(18vw,26vh),230px);aspect-ratio:120/130;font-size:0}
body[data-game=present] .bm-bomb .spark{transform-origin:center;transform-box:fill-box}
.pz-pic.art{display:block}.pz-pic.art svg{display:block}
.pz-prev svg{display:block;width:100%;height:100%}
body[data-game=present] .oly-no.art{width:clamp(90px,14vh,150px);aspect-ratio:1;border-radius:50%;background:#ffffff14;border:3px solid #ffffff44;padding:14px;margin-inline:auto;font-size:0}
body[data-game=present] .tg-field{position:relative}
/* dây kéo co: sợi dây thừng bện thật (hai sợi xoắn), nằm ngang tầm tay các em; các vạch nấc là cọc nhỏ phía dưới */
body[data-game=present] .tg-rope{background:none;box-shadow:none;border-radius:0;height:24px;margin-top:calc(38px + var(--pw) * .6 - 12px)}
body[data-game=present] .tg-rope::before{content:"";position:absolute;left:0;right:0;top:50%;height:clamp(14px,2.4vh,22px);transform:translateY(-50%);border-radius:12px;border:2px solid #4a3216;background:repeating-linear-gradient(112deg,#e6c98c 0 6px,#b5834a 6px 8px,#c99a5b 8px 14px,#8a5d2b 14px 16px);box-shadow:0 4px 0 #0003,inset 0 3px 0 #fff5,inset 0 -3px 0 #0003}
body[data-game=present] .tg-ticks{align-items:flex-end}
body[data-game=present] .tg-ticks i{width:4px;height:clamp(8px,1.6vh,14px);border-radius:2px;background:#6b4a22;margin-bottom:-6px}
body[data-game=present] .tg-ticks i.mid{width:6px;height:clamp(14px,3vh,26px);background:#fff;box-shadow:0 0 0 2px var(--ink-navy)}
body[data-game=present] .tg-flag{filter:drop-shadow(0 3px 0 #0003)}
body[data-game=present] .tg-field{--pw:clamp(84px,11vw,150px)}
body[data-game=present] .tg-end{position:absolute;top:0;font-size:clamp(14px,1.6vw,22px);padding:4px 14px}
body[data-game=present] .tg-end.l{left:0}body[data-game=present] .tg-end.r{right:0;float:none}
body[data-game=present] .tg-pull{position:absolute;top:38px;width:var(--pw);aspect-ratio:100/110;pointer-events:none;z-index:2}
body[data-game=present] .tg-pull.l{left:calc(2px + var(--sh,0%))}
body[data-game=present] .tg-pull.r{right:calc(2px + var(--sh,0%));transform:scaleX(-1)}
body[data-game=present] .tg-pull{transition:left .5s cubic-bezier(.3,1.4,.5,1),right .5s cubic-bezier(.3,1.4,.5,1)}
/* lời hò reo: bong bóng nhỏ bên trong nhân vật, luôn đọc được (không lật gương) */
body[data-game=present] .tg-say{position:absolute;top:36px;z-index:3;padding:3px 10px;border-radius:14px;background:#fff;color:#1e293b;border:2px solid var(--ink-navy);font-weight:800;font-size:clamp(12px,1.5vw,18px);white-space:nowrap;pointer-events:none;transition:left .5s,right .5s}
body[data-game=present] .tg-say.l{left:calc(clamp(84px,11vw,150px) + 2px + var(--sh,0%))}
body[data-game=present] .tg-say.r{right:calc(clamp(84px,11vw,150px) + 2px + var(--sh,0%))}
body[data-game=present] .tg-say::after{content:"";position:absolute;bottom:-7px;width:10px;height:10px;background:#fff;border:2px solid var(--ink-navy);border-top:0;border-left:0;transform:rotate(45deg)}
body[data-game=present] .tg-say.l::after{left:-4px;bottom:3px;transform:rotate(135deg)}
body[data-game=present] .tg-say.r::after{right:-4px;bottom:3px;transform:rotate(-45deg)}
@media (prefers-reduced-motion:no-preference){
  body[data-game=present] .tg-pull{animation:tgTug .55s ease-in-out infinite alternate;transform-origin:50% 100%}
  body[data-game=present] .tg-pull.r{animation-delay:-.27s}
  body[data-game=present] .tg-say{animation:tgSay 1.6s ease-in-out infinite}
  body[data-game=present] .tg-say.r{animation-delay:-.8s}
  @keyframes tgTug{from{rotate:-3deg;translate:-5px 0}to{rotate:4deg;translate:5px -3px}}
  @keyframes tgSay{0%,100%{scale:1}50%{scale:1.08}}
}
@media (prefers-reduced-motion:no-preference){
  @keyframes sparkle{50%{transform:scale(1.5) rotate(25deg);filter:brightness(1.5)}}
  body[data-game=present] .bm-bomb .spark{animation:sparkle .35s infinite}
}

/* biểu tượng lớn đầu màn cài đặt / kết thúc của game trình chiếu */
body[data-game=present] .sgtitle{display:flex;align-items:center;justify-content:center;gap:var(--sp-3)}
body[data-game=present] .sgico{display:inline-block;width:clamp(56px,9vh,96px);aspect-ratio:1;flex:none}
body[data-game=present] .big.art{width:clamp(96px,16vh,170px);aspect-ratio:1;margin-inline:auto;font-size:0}
@media (prefers-reduced-motion:no-preference){
  @keyframes ring{0%,100%{transform:rotate(0)}20%{transform:rotate(14deg)}40%{transform:rotate(-12deg)}60%{transform:rotate(8deg)}80%{transform:rotate(-5deg)}}
  body[data-game=present] .sgico,body[data-game=present] .big.art{transform-origin:50% 8%;animation:ring 2.4s ease-in-out infinite}
}

/* nút điều khiển bằng điện thoại ở màn giáo viên: nổi bật hơn nút phụ */
body[data-game=live] #exitbar .remotecta{margin-left:auto;background:linear-gradient(180deg,#34d399,#059669);color:#052e1f;border:0;font-weight:800;box-shadow:0 3px 0 #064e3b;padding:7px 16px}
body[data-game=live] #exitbar .remotecta:hover:not(:disabled){filter:brightness(1.08);transform:translateY(-1px)}
@media (max-width:700px){body[data-game=live] #exitbar .remotecta{font-size:0;padding:7px 12px}body[data-game=live] #exitbar .remotecta::first-letter{font-size:16px}}
body[data-game=live] #exitbar .remotecta.on{background:#fff;color:#065f46;box-shadow:0 3px 0 #94a3b8}

/* điều khiển phụ khi đang chiếu câu hỏi: nút nhỏ, gọn một hàng, không kéo dài hết chiều ngang */
body[data-game=live]:not(.student) #app>.card .row.qctl{display:flex;justify-content:flex-end;gap:var(--sp-2);margin:var(--sp-2) 0 0}
body[data-game=live]:not(.student) #app>.card .row.qctl button{width:auto!important;margin:0!important;padding:6px 14px!important;font-size:14px!important;opacity:.85}
body[data-game=live]:not(.student) #app>.card .row.qctl button:hover{opacity:1}

/* nút Aa ở hàng điều khiển của màn giáo viên: bảng chỉnh cỡ chữ nổi bên dưới nút */
#exitbar .fontwrap{position:relative;display:inline-block;margin-left:auto}
#exitbar .fontwrap .zm-panel{top:calc(100% + 8px);right:0;left:auto;z-index:920}
body[data-game=live] #exitbar .fontwrap+.remotecta{margin-left:0}
body[data-game=live]:not(.student) #app .res .dist{height:auto;min-height:120px;margin:var(--sp-2) 0} /* cột cao 90px + số + nhãn ≈ 154px: khung ép 120px làm số đếm tràn lên dòng trên */
body[data-game=live] #exitbar{flex-wrap:wrap;row-gap:4px}

/* nhân vật của game trình chiếu: bạn nhỏ cầm chuông (Đối kháng) và chú chuông vàng (Rung chuông vàng) */
body[data-game=present] .dl-team{position:relative}
body[data-game=present] .dl-fig{position:absolute;left:clamp(6px,1vw,20px);top:10%;height:56%;aspect-ratio:100/120;pointer-events:none} /* nằm bên trái thẻ: không làm thẻ cao thêm nên hàng đáp án vẫn vừa màn */
body[data-game=present] .bell-fig{width:clamp(34px,3.2vw,52px);aspect-ratio:126/120;flex:none}
@media (prefers-reduced-motion:no-preference){
  @keyframes figHop{0%,100%{transform:translateY(0)}50%{transform:translateY(-10px)}}
  @keyframes figShake{25%{transform:translateX(-4px) rotate(-3deg)}75%{transform:translateX(4px) rotate(3deg)}}
  @keyframes bellRock{0%,100%{transform:rotate(-7deg)}50%{transform:rotate(7deg)}}
  body[data-game=present] .dl-fig.mood-buzz,body[data-game=present] .dl-fig.mood-win{animation:figHop .5s ease-in-out infinite}
  body[data-game=present] .dl-fig.mood-sad{animation:figShake .5s 1}
  body[data-game=present] .bell-fig.mood-ring{transform-origin:50% 8%;animation:bellRock .7s ease-in-out infinite}
}
html[data-lite] body[data-game=present] .dl-fig,html[data-lite] body[data-game=present] .bell-fig{animation:none!important}

/* người dẫn chương trình của Ai là triệu phú (cột thang tiền) */
body[data-game] .mc{display:flex;align-items:center;gap:6px;margin-bottom:8px}
body[data-game] .mc-fig{width:clamp(34px,2.8vw,46px);aspect-ratio:100/120;flex:none}
body[data-game] .mc .bubble{flex:1;min-width:0;font-size:clamp(11px,.85vw,14px);font-weight:700;line-height:1.3;padding:6px 10px;max-width:none}
body[data-game] .mc .bubble::before{border-width:6px;margin-top:-6px;left:-6px}
@media (prefers-reduced-motion:no-preference){
  @keyframes mcHop{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
  body[data-game] .mc[data-mood=cheer] .mc-fig{animation:mcHop .5s ease-in-out infinite}
}
html[data-lite] body[data-game] .mc-fig{animation:none!important}

/* ngọn lửa chuỗi đúng của Quiz: lớn dần khi chuỗi dài, bập bùng nhẹ */
body[data-game] .flm{display:inline-flex;align-items:center;gap:2px;font-style:normal}
body[data-game] .flm-ic{display:inline-block;width:.95em;height:1.2em;transform-origin:50% 100%;transition:transform .25s}
body[data-game] .flm[data-lv="1"] .flm-ic{transform:scale(1.1)}
body[data-game] .flm[data-lv="2"] .flm-ic{transform:scale(1.35)}
body[data-game] .flm[data-lv="3"] .flm-ic{transform:scale(1.65);filter:drop-shadow(0 0 6px #60a5fa)}
@media (prefers-reduced-motion:no-preference){
  @keyframes flmDance{0%,100%{transform:scale(var(--fs,1)) rotate(-3deg)}50%{transform:scale(calc(var(--fs,1)*1.08)) rotate(3deg)}}
  body[data-game] .flm:not([data-lv="0"]) .flm-ic{animation:flmDance .45s ease-in-out infinite}
  body[data-game] .flm[data-lv="1"]{--fs:1.1}body[data-game] .flm[data-lv="2"]{--fs:1.35}body[data-game] .flm[data-lv="3"]{--fs:1.65}
}
html[data-lite] body[data-game] .flm-ic{animation:none!important}

/* người dẫn chương trình dùng chung của Ô bí mật và Lật mảnh ghép: góc dưới bên trái, ẩn trên màn hẹp để nhường chỗ nút điều khiển */
.emcee{position:fixed;left:clamp(8px,1.2vw,24px);bottom:clamp(36px,5vh,60px);z-index:20;display:flex;align-items:flex-end;gap:8px;max-width:min(36vw,380px);pointer-events:none}
.emcee[hidden]{display:none}
.emcee-fig{width:clamp(40px,3.4vw,60px);aspect-ratio:100/120;flex:none}
.emcee .bubble{font-size:clamp(12px,.95vw,16px);padding:6px 12px}
@media (max-width:760px){.emcee{display:none}}
@media (prefers-reduced-motion:no-preference){
  .emcee[data-mood=cheer] .emcee-fig{animation:mcHop .5s ease-in-out infinite}
}
html[data-lite] .emcee-fig{animation:none!important}

/* Rung chuông vàng với lớp đông: danh sách người chơi gọn lại (ô thấp, tên một dòng, cuộn nếu quá dài) để câu hỏi và đủ đáp án luôn hiện trọn vẹn */
body[data-game=present] .pl-grid.small{grid-template-columns:repeat(auto-fill,minmax(clamp(110px,11vw,170px),1fr));gap:6px}
body[data-game=present] .pl-grid.tiny{grid-template-columns:repeat(auto-fill,minmax(clamp(92px,9vw,140px),1fr));gap:5px;max-height:36vh;overflow-y:auto;padding:2px 2px 6px}
body[data-game=present] .pl-grid.tiny .pl{min-height:42px;padding:3px 6px!important;font-size:clamp(12px,1vw,15px)!important;border-width:3px;border-radius:12px;box-shadow:0 3px 0 var(--ol,#0005)}
body[data-game=present] .pl-grid.tiny .pl span{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:break-word;width:100%;text-align:center;line-height:1.15} /* tên hiện đủ trong hai dòng, không cắt thành "Nguyễn ..." */
body[data-game=present] .pl-grid.tiny .pl small{font-size:.8em}
/* khi danh sách đang hiện cùng lúc với đáp án (lớp đông): ép gọn các ô đáp án để cả bốn đáp án và danh sách cùng vừa một màn laptop */
body[data-game=present]:has(.pl-grid.tiny:not([style*="none"])) .sg-opt{min-height:0;padding-top:6px;padding-bottom:6px}
body[data-game=present]:has(.pl-grid.tiny:not([style*="none"])) .sg-q{padding-top:8px;padding-bottom:8px}
@media (max-height:820px){body[data-game=present] .pl-grid.tiny{max-height:30vh}}

/* màn vinh danh Chuông vàng: ánh sáng chiếu, chuông lắc, tên bật lên trên bảng vàng */
.champ{position:relative;display:flex;flex-direction:column;align-items:center;gap:10px;padding:clamp(8px,2vh,24px) 0;isolation:isolate}
.champ-rays{position:absolute;left:50%;top:38%;width:min(120vw,1100px);aspect-ratio:1;transform:translate(-50%,-50%);z-index:-1;pointer-events:none;border-radius:50%;
  background:repeating-conic-gradient(from 0deg,#fffa 0 7deg,#fff0 7deg 20deg);-webkit-mask:radial-gradient(circle,#000 8%,transparent 66%);mask:radial-gradient(circle,#000 8%,transparent 66%)}
.champ-bell{width:clamp(96px,11vw,150px);aspect-ratio:126/120;transform-origin:50% 8%}
.champ-label{font-weight:800;letter-spacing:.18em;font-size:clamp(12px,1.1vw,16px);color:#92400e}
.champ-name{margin:0;max-width:92vw;padding:6px clamp(20px,3vw,44px);font-size:clamp(26px,3.6vw,56px);line-height:1.15;color:var(--ink-navy);background:linear-gradient(#fff9dc,#ffe08a);border:5px solid var(--ink-navy);border-radius:20px;box-shadow:0 8px 0 var(--ink-navy),0 0 0 8px #fff8,0 0 40px 6px #ffd23f99;overflow-wrap:anywhere}
.champ-sub{margin:0;font-weight:700;font-size:clamp(13px,1.3vw,19px);color:#5b3a10}
.champ-runners{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.champ-run{background:#fff;color:var(--ink-navy);border:3px solid var(--ink-navy);border-radius:14px;padding:5px 14px;font-weight:800;font-size:clamp(13px,1.2vw,17px);box-shadow:0 4px 0 var(--ink-navy)}
.champ-run small{font-weight:600;opacity:.7}
@media (prefers-reduced-motion:no-preference){
  @keyframes champSpin{to{transform:translate(-50%,-50%) rotate(360deg)}}
  @keyframes champSwing{0%,100%{transform:rotate(-9deg)}50%{transform:rotate(9deg)}}
  @keyframes champPop{0%{transform:scale(.4);opacity:0}60%{transform:scale(1.12);opacity:1}100%{transform:scale(1)}}
  @keyframes champRise{from{transform:translateY(16px);opacity:0}}
  .champ-rays{animation:champSpin 40s linear infinite}
  .champ-bell{animation:champSwing .8s ease-in-out infinite}
  .champ-name{animation:champPop .7s .25s cubic-bezier(.3,1.5,.5,1) both}
  .champ-label,.champ-sub{animation:champRise .5s .5s both}
  .champ-run{animation:champRise .5s both}.champ-run:nth-child(1){animation-delay:.9s}.champ-run:nth-child(2){animation-delay:1.1s}
}
html[data-lite] .champ-rays,html[data-lite] .champ-bell{animation:none!important}

/* Đối kháng: đội 1 | câu hỏi + trạng thái | đội 2. Thẻ đội thành cột đứng hai bên, cột giữa lấy hết chiều cao nên đáp án không bị cắt */
body[data-game=present] .dl-score{grid-template-columns:clamp(140px,15vw,250px) minmax(0,1fr) clamp(140px,15vw,250px);align-items:stretch;flex:1;min-height:0}
body[data-game=present] .dl-score>.dl-team:first-child{grid-column:1}
body[data-game=present] .dl-score>.dl-mid{grid-column:2;grid-row:1;display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;min-height:0}
body[data-game=present] .dl-score>.dl-team:last-child{grid-column:3;grid-row:1}
body[data-game=present] .dl-mid>.sg-main{flex:1;min-height:0;overflow:auto}
body[data-game=present] .dl-mid .dl-status{font-size:clamp(16px,1.8vw,26px);padding:8px 12px;border-width:3px}
body[data-game=present] .dl-team{justify-content:space-between;padding:10px 12px}
body[data-game=present] .dl-team .dl-fig{position:static;height:clamp(80px,17vh,170px);width:auto;flex:none}
body[data-game=present] .dl-team .bx-pt{font-size:clamp(40px,5.5vw,84px);line-height:1}
body[data-game=present] .dl-team .dl-buzz{font-size:clamp(18px,2vw,28px);padding:10px}

/* phím hướng (Mê cung, Rắn săn mồi): xếp hình chữ thập như tay cầm, nhỏ gọn dưới ngón cái, thay cho 4 nút ngang kéo dài hết bề rộng */
.dpad{display:grid;grid-template-columns:repeat(3,clamp(56px,16vw,76px));grid-template-rows:repeat(2,clamp(52px,14vw,68px));gap:8px;justify-content:center;margin:10px auto 0;touch-action:manipulation}
body[data-game] #app .dpad button{width:100%;height:100%;min-height:0;padding:0;font-size:clamp(22px,6vw,30px);line-height:1;border-radius:var(--r-lg);user-select:none;-webkit-user-select:none}
.dpad .dp-ArrowUp{grid-area:1/2}.dpad .dp-ArrowLeft{grid-area:2/1}.dpad .dp-ArrowDown{grid-area:2/2}.dpad .dp-ArrowRight{grid-area:2/3}
body[data-game] #app .dpad button:active{transform:translateY(2px);background:var(--sel,#dfe3f6)}

/* Vỏ khi chơi (nâng cấp giao diện, giai đoạn 1): game tự chơi chỉ giữ logo và công cụ ở thanh đầu trang, lấy lại chiều cao cho câu hỏi.
   Phòng live phía giáo viên cũng dùng thanh gọn (bấm nhầm menu giữa buổi sẽ bỏ phòng); trình chiếu và trang học sinh có thanh riêng. Hoàn tác: xoá từ đây đến hết file. */
body[data-game]:not([data-game=present]):not(.student) header{padding-block:6px}
body[data-game]:not([data-game=present]):not(.student) header nav,
body[data-game]:not([data-game=present]):not(.student) header .burger,
body[data-game]:not([data-game=present]):not(.student) .logotext{display:none}
body[data-game]:not([data-game=present]):not(.student) header .tools{margin-left:auto}
/* Trình chiếu: dòng phím tắt nằm trên nền đậm để đọc được trên cỏ */
:root body[data-skin=cartoon][data-game=present] #app .sg-hint.mute{display:block;width:max-content;max-width:calc(100% - 24px);margin:4px auto 2px;padding:3px 16px;border-radius:var(--r-pill);background:var(--ol);color:var(--white);font-size:clamp(12px,1vw,16px);line-height:1.4}
/* Phòng chờ trên màn thấp (laptop 1366×768): QR nhỏ lại để mã phòng 6 số nằm trong màn đầu, không bị thanh dưới che */
@media (min-width:900px) and (max-height:820px){
  :root body[data-game=live]:not(.student) .lobby .joinpanel .qr{max-width:clamp(150px,24vh,200px)}
}

/* Màn laptop thấp (cỡ 1366×768): sân chơi thu theo chiều cao còn lại như trên điện thoại, để thấy đủ câu hỏi và nút điều khiển mà không phải cuộn.
   Canvas giữ tỉ lệ nhờ width:auto; toạ độ chuột/chạm của các game tính theo getBoundingClientRect nên không lệch. Hoàn tác: xoá từ đây đến hết file. */
@media (min-width:721px) and (min-height:521px) and (max-height:860px){
  body[data-game]:not(.fs) canvas.sncanvas,body[data-game]:not(.fs) canvas.tdcanvas{width:auto!important;height:auto;max-width:min(100%,560px)!important;max-height:max(220px,calc(100vh - 400px));max-height:max(220px,calc(100dvh - 400px));margin-left:auto;margin-right:auto}
  body[data-game]:not(.fs) .arena{height:max(300px,calc(100vh - 360px));height:max(300px,calc(100dvh - 360px))}
  /* ghép hình: bảng thu nhỏ theo chiều cao còn lại (--ar = rộng/cao, đặt ở solo-extra.js) */
  body[data-game]:not(.fs) .pz-board{max-width:min(340px,max(160px,calc((100vh - 520px)*var(--ar,1))))!important;max-width:min(340px,max(160px,calc((100dvh - 520px)*var(--ar,1))))!important}
}

/* Màn Tạo phòng (nâng cấp giao diện): công tắc đang tắt hiện rõ đường ray trên nền kem (trước đây trắng mờ trên kem nên chỉ còn một chấm), nhãn mục không viết hoa cỡ 12px.
   Hoàn tác: xoá từ đây đến hết file. */
:root body[data-skin=cartoon] .setup .hopt .tg{background:color-mix(in srgb,var(--ol) 22%,var(--white));box-shadow:inset 0 0 0 2px var(--ol)}
:root body[data-skin=cartoon] .setup .hopt input:checked~.tg{background:var(--mint)}
:root body[data-skin=cartoon] .setup .hopt .tg::after{box-shadow:0 0 0 2px var(--ol)}
body[data-game] .setup .seclab{text-transform:none;letter-spacing:.01em;font-size:15px}
body[data-game] .setup .hopt small{font-size:13px}
/* Thanh nút dính đáy (Tạo phòng, phòng chờ) có lề âm lớn hơn phần đệm của thẻ nên đè lên viền hai cạnh và viền dưới. Cắt phần nhô ra bằng overflow:clip
   (khác overflow:hidden, clip không tạo vùng cuộn nên thanh vẫn dính đáy màn hình). */
:root body[data-game] .card:has(.setupfoot){overflow:clip}

/* ===== Câu dài (public/longtext.mjs) =====
   Thẻ game mang data-len="l" hoặc "xl" khi câu hỏi và đáp án dài: co chữ và khoảng cách để cả câu lẫn 4 đáp án vừa màn 1366×768, không phải cuộn.
   Né & chạy chuyển đáp án dài sang bảng rời (.rnlegend); Ghép đôi dùng cột rộng và chia lượt ít cặp hơn.
   Hoàn tác: xoá khối này, bỏ lenAttr / wideOptions / packRounds trong các game. */
:root body[data-game] .card[data-len] .qtext{line-height:1.28}
:root body[data-game] .card[data-len=l] .qtext{font-size:clamp(22px,1.95vw,30px)}
:root body[data-game] .card[data-len=xl] .qtext{font-size:clamp(20px,1.65vw,27px)}
:root body[data-game] .card[data-len=l] .ans{min-height:0;font-size:clamp(17px,1.5vw,24px);line-height:1.3;padding:10px 14px 10px 12px}
:root body[data-game] .card[data-len=xl] .ans{min-height:0;font-size:clamp(15px,1.3vw,21px);line-height:1.28;padding:8px 12px 8px 10px}
:root body[data-game] .card[data-len] .answers{gap:10px}
:root body[data-game] .card[data-len] .bossarena{min-height:0;height:clamp(96px,17vh,150px)}
:root body[data-game=millionaire] .card[data-len=l] .ans{font-size:clamp(15px,1.25vw,19px);padding:6px 12px 6px 10px}
:root body[data-game=millionaire] .card[data-len=xl] .ans{font-size:clamp(14px,1.1vw,17px);padding:5px 10px}
:root body[data-game] .mpair[data-len]{grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr))}
:root body[data-game] #app .mpair[data-len] .mcard{min-height:0;padding:10px 14px}
:root body[data-game] #app .mpair[data-len=l] .mcard,:root body[data-game] #app .mpair[data-len=l] .mcard .mtxt{font-size:17px;line-height:1.3}
:root body[data-game] #app .mpair[data-len=xl] .mcard,:root body[data-game] #app .mpair[data-len=xl] .mcard .mtxt{font-size:16px;line-height:1.28}
.rnrow{display:flex;flex-wrap:wrap;gap:16px;align-items:flex-start;justify-content:center}
.rnrow .arena{margin:0;flex:0 1 520px;width:520px;max-width:100%}
.rnlegend{flex:1 1 320px;max-width:640px;display:grid;gap:8px}
.rnl{display:flex;gap:10px;align-items:center;padding:8px 12px;border-radius:var(--r-md);background:var(--panel);color:var(--ink);font-size:clamp(15px,1.2vw,19px);line-height:1.3}
.rnl b{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:50%;color:#fff;font-weight:900}
.rnl span{min-width:0;overflow-wrap:anywhere}
.block.wide{display:grid;place-items:center;font-size:34px;font-weight:900}
/* Cửa sổ câu hỏi dùng chung (qpopup.js: Câu cá, Đào vàng, Mê cung, Rắn): câu dài thì đáp án xếp một cột và co chữ để không phải cuộn trong thẻ. */
:root body #app .qpop .qpopcard[data-len]{padding:clamp(14px,1.8vw,24px)}
:root body #app .qpop .qpopcard[data-len] .qpophead{margin-bottom:6px}
:root body #app .qpop .qpopcard[data-len] .qtext{line-height:1.3;margin:10px 0 12px}
:root body #app .qpop .qpopcard[data-len=l] .qtext{font-size:clamp(21px,2.1vw,29px)}
:root body #app .qpop .qpopcard[data-len=xl] .qtext{font-size:clamp(18px,1.6vw,23px)}
:root body #app .qpop .qpopcard[data-len] .answers{grid-template-columns:1fr;gap:8px}
:root body #app .qpop .qpopcard[data-len=l] .ans{min-height:0;font-size:clamp(17px,1.65vw,23px);padding:9px 14px}
:root body #app .qpop .qpopcard[data-len=xl] .ans{min-height:0;font-size:clamp(15px,1.25vw,18px);padding:7px 12px}
/* Né & chạy: sàn chơi giữ chiều cao tính va chạm (560), nên câu dài chỉ được lấy chỗ của chữ câu hỏi và hàng chú thích. */
:root body[data-game=runner] .card[data-len] .qtext{font-size:clamp(18px,1.55vw,24px);margin:4px 0 8px}
:root body[data-game=runner] .card[data-len] .rnrow{gap:12px}
/* Lật thẻ với đề dài: 3 cột, thẻ cao hơn, chữ to vừa đọc (round() trong memory.js gắn data-len khi tổng chữ của lượt > 260). */
:root body[data-game] .mgrid.mm[data-len]{grid-template-columns:repeat(3,1fr);gap:12px}
:root body[data-game] .mgrid.mm[data-len] .mmcard{height:clamp(150px,24vh,200px)}
:root body[data-game] .mgrid.mm[data-len] .mmface{font-size:clamp(15px,1.25vw,18px);line-height:1.3;padding:24px 12px 10px}

/* ===== Laptop thấp (cỡ 1366×768): năm game còn cao hơn màn =====
   Bắn súng, Bóng bay, Rắn, Mê cung, Tính nhẩm: thu cụm nút điều khiển, thu dòng hướng dẫn còn một dòng nhỏ, thu sân chơi thêm một chút.
   Hoàn tác: xoá ba khối @media liền nhau từ đây đến hết khối Tính nhẩm, và khối "Nút điều khiển cảm ứng" ở cuối file. */
@media (min-width:721px) and (min-height:521px) and (max-height:860px){
  :root body:is([data-game=shooter],[data-game=balloon]):not(.fs) main>.card{margin-top:8px;padding-top:10px;padding-bottom:12px}
  :root body:is([data-game=shooter],[data-game=balloon]):not(.fs) .qbox{margin-top:22px;margin-bottom:6px;padding-top:6px;padding-bottom:6px}
  body:is([data-game=shooter],[data-game=balloon]):not(.fs) .card>p.mute.center{margin:8px 0 0;font-size:12px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} /* dòng hướng dẫn thu một dòng nhỏ, không ẩn hẳn */
  body:is([data-game=shooter],[data-game=balloon]):not(.fs) canvas.sncanvas{max-height:max(200px,calc(100vh - 478px));max-height:max(200px,calc(100dvh - 478px))}
  body[data-game=snake]:not(.fs) canvas.sncanvas,body[data-game=maze]:not(.fs) canvas.sncanvas{max-height:max(200px,calc(100vh - 470px));max-height:max(200px,calc(100dvh - 470px))}
  body[data-game=snake]:not(.fs) .card>p.mute.center,body[data-game=maze]:not(.fs) .card>p.mute.center{margin:6px 0 0}
}
@media (min-width:721px) and (min-height:521px) and (max-height:860px){
  :root body[data-game=shooter]:not(.fs) canvas.sncanvas{max-height:max(200px,calc(100vh - 520px));max-height:max(200px,calc(100dvh - 520px))}
}
@media (min-width:721px) and (min-height:521px) and (max-height:860px){
  /* màn cài đặt Tính nhẩm: bớt khoảng cách để nút Bắt đầu nằm trong màn */
  body[data-game=tinhnham]:not(.fs) .tnwrap .big{font-size:36px;line-height:1.1}
  body[data-game=tinhnham]:not(.fs) .tnwrap h1{margin:2px 0 4px;font-size:26px}
  body[data-game=tinhnham]:not(.fs) .tnwrap h3{margin:8px 0 4px}
  body[data-game=tinhnham]:not(.fs) .tnwrap p.mute{margin:4px 0}
  body[data-game=tinhnham]:not(.fs) .tnwrap .tnpick button{padding-top:8px;padding-bottom:8px}
}

/* ===== Đám đông học sinh trên màn giáo viên (phòng live) =====
   Lúc hỏi: mỗi em một hình đại diện, xám mờ, sáng lên khi em trả lời (không tên, không đáp án chọn). Lúc có kết quả: hàng hình các em trả lời đúng.
   Hoàn tác: xoá khối này (đến dòng html[data-lite] ... .herd), bỏ dòng herd trong live.js và trường crowd trong rooms.js. */
body[data-game=live] .herd{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 6px;margin:var(--sp-2) 0;max-height:clamp(64px,13vh,110px);overflow:hidden}
body[data-game=live] .herd[hidden]{display:none}
body[data-game=live] .herd i{font-style:normal;font-size:clamp(20px,1.9vw,30px);line-height:1.1;filter:grayscale(1) opacity(.3);transition:filter .25s}
body[data-game=live] .herd[data-n=mid] i{font-size:clamp(17px,1.5vw,24px)}
body[data-game=live] .herd[data-n=many] i{font-size:clamp(14px,1.2vw,19px)}
body[data-game=live] .herd i.on{filter:none}
body[data-game=live] .herd.right{max-height:none;flex-wrap:nowrap}
body[data-game=live] .herd.right b{font-size:clamp(13px,1vw,16px);margin-right:4px}
@media (prefers-reduced-motion:no-preference){
  body[data-game=live] .herd i.on{animation:herdPop .4s cubic-bezier(.2,.9,.3,1.4)}
}
@keyframes herdPop{0%{transform:scale(.6) translateY(6px)}60%{transform:scale(1.35) translateY(-4px)}100%{transform:none}}
html[data-lite] body[data-game=live] .herd i{animation:none!important}

/* Nút điều khiển cảm ứng (Bắn súng, mũi tên Rắn/Mê cung) chỉ thu khi dùng chuột: máy tính bảng nằm ngang cũng thấp hơn 860px nhưng cần nút to để chạm. */
@media (min-width:721px) and (min-height:521px) and (max-height:860px) and (hover:hover) and (pointer:fine){
  :root body[data-game=shooter]:not(.fs) #app .shpad{margin-top:6px}
  :root body[data-game=shooter]:not(.fs) #app .shpad button{min-height:0!important;height:40px;padding:0!important;font-size:18px}
  body[data-game=snake]:not(.fs) .dpad,body[data-game=maze]:not(.fs) .dpad{grid-template-columns:repeat(3,56px);grid-template-rows:repeat(2,44px);gap:6px;margin-top:6px}
}

/* ===== Đào vàng toàn màn hình (public/games/goldminer.js) =====
   Lớp .gm phủ kín cửa sổ (trên thanh đầu trang, dưới cửa sổ câu hỏi z 60; bạn nhỏ được nâng lên z 58 để vẫn thấy); canvas vẽ thế giới game, thanh trạng thái là HTML để chữ sắc nét.
   Hoàn tác: xoá từ đây đến hết file (và khôi phục goldminer.js cũ nếu cần). */
.gm{position:fixed;inset:0;z-index:55;overflow:hidden;background:#12162e;color:#fff;user-select:none;-webkit-user-select:none;touch-action:manipulation}
:root body[data-game] #app .gm canvas.gmcv:not(.ink):not(.wh-canvas){position:absolute;inset:0;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;min-height:0!important;margin:0!important;border:0!important;box-shadow:none!important;border-radius:0;display:block;cursor:pointer;background:none;object-fit:fill} /* đè quy tắc canvas chung (rộng tối đa 520px) và body.fs */
.gm-hud{position:absolute;left:0;right:0;top:0;display:flex;align-items:center;gap:10px;padding:10px 14px;pointer-events:none;font-weight:800;font-size:clamp(14px,1.3vw,19px);text-shadow:0 2px 0 #0007}
.gm-hud>*{pointer-events:auto}
.gm-pill{padding:5px 13px;border-radius:99px;background:#0009;border:2px solid #fff3;white-space:nowrap}
:root body #app .gm .gm-btn{width:40px;height:40px;min-height:0;padding:0;border-radius:12px;font-size:18px;line-height:1;background:#0009;color:#fff;border:2px solid #fff4;box-shadow:none}
:root body #app .gm .gm-btn:hover{background:#000c}
.gm-hearts{font-size:1.15em;letter-spacing:1px;white-space:nowrap}
.gm-timebox{flex:0 1 340px;margin-left:auto;min-width:90px;display:flex;align-items:center;gap:10px;justify-content:flex-end}
:root body #app .gm div,:root body #app .gm b,:root body #app .gm span,:root body #app .gm p{color:#fff!important} /* skin hoạt hình tô chữ b/span màu mực đậm: ở đây nền tối nên giữ chữ sáng */
.gm-card h2{color:#fde68a!important}
.gm-timebox>b{padding:5px 13px;border-radius:99px;background:#0009;border:2px solid #fff3;white-space:nowrap}
.gm-bar{flex:1;max-width:340px;height:12px;border-radius:99px;background:#0008;border:2px solid #fff3;overflow:hidden}
.gm-bar i{display:block;height:100%;width:100%;background:linear-gradient(90deg,#fbbf24,#f97316);transition:width .2s linear}
.gm[data-low="1"] .gm-bar i{background:#ef4444}
.gm[data-low="1"] .gm-timebox>b{border-color:#ef4444;color:#fecaca}
.gm-hint{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);max-width:min(92vw,820px);padding:7px 16px;border-radius:99px;background:#000a;font-size:clamp(12px,1.05vw,15px);font-weight:700;text-align:center;pointer-events:none}
.gm-hint[hidden]{display:none}
.gm-banner{position:absolute;inset:0;display:grid;place-items:center;background:rgba(5,6,20,.55);backdrop-filter:blur(2px);z-index:2}
.gm-banner[hidden]{display:none}
.gm-card{min-width:min(86vw,360px);max-width:min(92vw,480px);padding:clamp(18px,3vh,30px) clamp(20px,3vw,36px);border-radius:24px;background:linear-gradient(#2b2f63,#1a1d44);border:3px solid #fbbf24;box-shadow:0 18px 50px #000a;text-align:center;animation:gmIn .3s cubic-bezier(.2,.9,.3,1.3)}
.gm-card h2{margin:0 0 6px;font-size:clamp(26px,3.2vw,38px);color:#fde68a}
.gm-card p{margin:6px 0;font-size:clamp(15px,1.4vw,19px)}
.gm-card .gm-sub{font-size:clamp(13px,1.1vw,15px);opacity:.85}
.gm-stars{font-size:clamp(30px,4vw,44px);letter-spacing:4px}
.gm-tiers{display:flex;justify-content:center;align-items:flex-end;gap:clamp(12px,2vw,22px);margin:10px 0 6px}
.gm-tier{display:flex;flex-direction:column;align-items:center;gap:4px;font-weight:800}
.gm-tier i{display:block;border-radius:46% 54% 50% 50%;border:2px solid #78350f;box-shadow:0 0 10px #fbbf2488}
:root body #app .gm .gm-go{margin-top:14px;padding:10px 26px;font-size:clamp(16px,1.5vw,20px);font-weight:800;border-radius:16px;background:linear-gradient(135deg,#fbbf24,#f97316)!important;color:#3b1d02!important;border:0;min-height:0}
@keyframes gmIn{from{opacity:0;transform:scale(.85) translateY(10px)}}
@media (prefers-reduced-motion:reduce){.gm-card{animation:none}}
@media (max-width:640px){.gm-hud{flex-wrap:wrap;gap:6px;padding:8px}.gm-timebox{order:9;flex-basis:100%}}
body[data-game=goldminer] .buddy{z-index:58}

/* ===== Laptop thấp (cỡ 1366×768), đợt 2: Tháp, Hạ Boss, Bóng bay, Né & chạy, Câu cá, Chinh phục =====
   Đo ở 1366×768 với câu có nút 🎧 Nghe (trường hợp cao nhất): các game này vẫn vượt 768px (+8 đến +101).
   Thu: lề thẻ, hộp câu hỏi (nút Nghe và lề chữ), ô đáp án và sân Hạ Boss. KHÔNG thu .arena của Né & chạy (va chạm tính theo H=560 cố định).
   Hoàn tác: xoá khối này (đến hết file). */
@media (min-width:721px) and (min-height:521px) and (max-height:860px){
  :root body:is([data-game=tower],[data-game=boss],[data-game=balloon],[data-game=runner],[data-game=fishing],[data-game=chinhphuc]):not(.fs) main>.card{margin-top:8px;padding-top:10px;padding-bottom:12px}
  :root body:is([data-game=tower],[data-game=boss],[data-game=balloon],[data-game=runner]):not(.fs) .qbox .qtext,:root body[data-game=runner]:not(.fs) .qtext{margin-top:4px;margin-bottom:4px}
  :root body:is([data-game=tower],[data-game=boss],[data-game=balloon],[data-game=runner]):not(.fs) #app .speakbtn{float:left;margin:0 12px 2px 0;padding-top:2px;padding-bottom:2px} /* nút Nghe nằm cạnh câu hỏi, không chiếm hàng riêng */
  :root body:is([data-game=tower],[data-game=boss],[data-game=balloon],[data-game=runner],[data-game=xepchu]):not(.fs) .qtext>.speakbtn~br{display:none} /* câu có nghe được dựng thành nút + 2 thẻ <br> (mỗi cái 43px): bỏ để chữ không cách xa nút */
  :root body:is([data-game=tower],[data-game=boss],[data-game=balloon],[data-game=runner]):not(.fs) .qbox{display:flow-root} /* chứa nút Nghe nổi, hộp không co lại */
  :root body[data-game=boss]:not(.fs) .bossarena :is(.hero,.boss){height:100%;width:auto;max-width:none} /* ô nhân vật/boss cao đúng bằng sân (trước: 169–220px nên đầu bị cắt khi sân thấp) */
  :root body[data-game=boss]:not(.fs) .bossarena svg{width:100%;height:100%}
  :root body:is([data-game=tower],[data-game=runner]):not(.fs) p.mute{margin:4px 0 0;font-size:12px;line-height:1.3}
  :root body:is([data-game=tower],[data-game=runner]):not(.fs) .ans{min-height:44px}
  :root body[data-game=xepchu]:not(.fs) main>.card{margin-top:8px;padding-top:8px;padding-bottom:10px}
  :root body[data-game=xepchu]:not(.fs) .gicon{display:none}
  :root body[data-game=xepchu]:not(.fs) .qbox{margin-top:22px;margin-bottom:4px}
  :root body[data-game=xepchu]:not(.fs) .xcline{margin:8px 0;gap:6px}
  :root body[data-game=xepchu]:not(.fs) .xcslot{min-width:40px;height:46px;font-size:28px}
  :root body[data-game=xepchu]:not(.fs) .xctiles{margin:4px 0 8px;gap:8px}
  :root body[data-game=xepchu]:not(.fs) button.xctile{min-width:46px;height:50px;font-size:28px;padding:0 8px}
  :root body[data-game=xepchu]:not(.fs) .xcwrap[data-len]{max-width:min(960px,100%)} /* chữ dài: thẻ rộng ra để câu ít dòng hơn */
  :root body:is([data-game=xepchu],[data-game=hangman],[data-game=bingo],[data-game=tower]):not(.fs) .card[data-len] .qbox{padding-top:4px;padding-bottom:4px}
  :root body[data-game=tower]:not(.fs) .card[data-len] canvas.tdcanvas{max-height:140px}
  :root body[data-game=matching]:not(.fs) .mpair[data-len]{gap:8px}
  :root body[data-game=matching]:not(.fs) #app .mpair[data-len] .mcard{padding-top:7px;padding-bottom:7px}
  :root body[data-game=matching]:not(.fs) p.mmhint{margin:4px 0 0;font-size:13px;line-height:1.3}
  :root body[data-game=hangman]:not(.fs) .card[data-len] .hmkey{height:38px}
  :root body:is([data-game=tower],[data-game=boss],[data-game=hangman],[data-game=bingo],[data-game=xepchu]):not(.fs) .fb{margin:4px 0 0;font-size:16px;line-height:1.25} /* dòng phản hồi đúng/sai hiện sau mỗi câu: gọn lại để không đẩy nội dung xuống */
  :root body[data-game=tower]:not(.fs) .card[data-len] p.mute{display:none} /* chữ dài: bỏ dòng hướng dẫn ở đáy (đã đọc ở các ván đầu) */
  :root body[data-game=tower]:not(.fs) .card[data-len] canvas.tdcanvas{max-height:120px}
  :root body:is([data-game=tower],[data-game=boss]):not(.fs) .card[data-len] .ans{padding-top:5px;padding-bottom:5px;line-height:1.2}
  :root body[data-game=memory]:not(.fs) p.mmhint{margin:4px 0 0;font-size:13px;line-height:1.3}
  :root body[data-game=memory]:not(.fs) .mmprog{margin:6px 0}
  :root body[data-game=hangman]:not(.fs) .hmword{margin:8px 0 6px}
  :root body[data-game=hangman]:not(.fs) .hmkeys{gap:6px}
  :root body:is([data-game=tower],[data-game=boss]):not(.fs) .answers{gap:8px}
  :root body:is([data-game=tower],[data-game=boss]):not(.fs) .ans{min-height:50px;padding-top:6px;padding-bottom:6px}
  :root body[data-game=boss]:not(.fs) .bossarena{min-height:0;height:clamp(120px,19vh,150px);margin-bottom:6px} /* chừa chỗ cho nút Nghe và dòng phản hồi đúng/sai hiện sau khi trả lời */
  :root body[data-game=fishing]:not(.fs) .pond{height:max(260px,calc(100vh - 400px));height:max(260px,calc(100dvh - 400px))}
  :root body[data-game=chinhphuc]:not(.fs) .cpstages{margin:8px 0;gap:8px}
}

/* Đào vàng tranh giành (phòng nhiều người): mỏ vàng chung vẽ bằng canvas.minercv. Ba lớp .minercv để thắng quy tắc canvas chung của game (khung viền, max-width 520px, thu theo chiều cao ở màn hẹp ~dòng 345). Hoàn tác: xoá khối này. */
.minerfield{position:relative;width:100%;max-width:560px;margin:var(--sp-2) auto 0}
.minerlive{margin:0 0 var(--sp-2)}
.minerlive .minerfield{max-width:none}
:root body #app .minerfield canvas.minercv.minercv.minercv{display:block;width:100%!important;max-width:none!important;max-height:none!important;margin:0;border:3px solid #78350f!important;border-radius:var(--r-lg)!important;box-shadow:0 8px 24px -10px #000!important;background:#2a2013;touch-action:manipulation}
.minerfield.play canvas.minercv{cursor:pointer}
.minerstat{margin:var(--sp-2) 0;font-weight:700}
.minerstat b{color:var(--gold,#f59e0b)}
.minerclaim{margin:0 0 var(--sp-3);padding:8px 12px;border-radius:var(--r-md);background:color-mix(in srgb,#f59e0b 22%,transparent);border:2px solid #f59e0b;font-weight:700;text-align:center}
.minerclaim.low{background:color-mix(in srgb,#ef4444 24%,transparent);border-color:#ef4444}

/* ---- Mô phỏng màn chiếu (games/screen-sim.js) ---- */
.sim-ov{position:fixed;inset:0;z-index:var(--z-modal);background:#07061a;color:#fff;display:flex;flex-direction:column;gap:var(--sp-3);padding:var(--sp-4);font:inherit}
.sim-top{display:flex;align-items:center;gap:var(--sp-4)}.sim-top b{flex:1;font-size:18px}
.sim-safe-t{display:flex;align-items:center;gap:var(--sp-2);font-size:14px;cursor:pointer}
.sim-chips{display:flex;flex-wrap:wrap;gap:var(--sp-2)}
.sim-chip{display:flex;flex-direction:column;align-items:center;padding:6px 12px;font-size:14px;line-height:1.2;width:auto;height:auto}
.sim-chip small{opacity:.7;font-size:12px}.sim-chip.on{box-shadow:0 0 0 3px var(--green,#22c55e)}
.sim-hold{flex:1;min-height:0;display:flex;align-items:center;justify-content:center}
.sim-stage{position:relative;overflow:hidden;border:6px solid #1c1a3d;border-radius:var(--r-md);background:#000;box-sizing:content-box;box-shadow:0 10px 40px #000a}
.sim-frame{position:absolute;left:0;top:0;border:0;transform-origin:0 0;background:#000}
.sim-safe{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.sim-safe::after{content:"";position:absolute;inset:5%;border:2px dashed #f87171;box-shadow:0 0 0 999px #ef444430}
.sim-note{margin:0;text-align:center;font-size:14px;opacity:.8}
.sim-ov .sim-safe-t{color:#fff;opacity:1}
.sim-ov .sim-chip.on{background:#2f2b7a;color:#fff}.sim-ov .sim-chip.on small{color:#fff;opacity:.85}
.sim-frame.ro{pointer-events:none}

/* Phòng chơi của giáo viên: ẩn thanh menu, bút/âm lượng nằm trong hàng nút điều khiển (live.js).
   Một hàng: [Đóng phòng · Toàn màn hình] [mã phòng] ........ [Aa · điện thoại · 🖥 · bút/âm lượng] */
body.hostplay header,body.hostplay footer{display:none}
/* Tạo phòng, chưa có phòng: bỏ thanh menu và chân trang; hàng điều khiển chỉ còn nút quay lại và nút nhạc */
body.hostplay #exitbar .tools button[title="Góp ý hoặc báo lỗi"],body.hostplay #exitbar .tools button[title="Quản lý giao diện"]{display:none} /* đang chiếu cho lớp: góp ý và đổi giao diện để sau giờ dạy */
body.hostsetup header,body.hostsetup footer{display:none}
body.hostsetup #trialbar{display:none} /* lời mời nâng gói không chen vào lúc giáo viên chuẩn bị vào lớp */
body.hostsetup #exitbar{margin-top:10px}
body.hostsetup #exitbar>:not(:first-child):not(.music){display:none}
body.hostsetup #exitbar .music{margin-left:auto}
body.hostplay{display:flow-root} /* lề âm của #app (thu nhỏ vừa màn) không bị gộp vào body */
body.hostplay #exitbar{margin-top:6px;max-width:min(1800px,100%);gap:8px;flex-wrap:nowrap;row-gap:0}
body.hostplay #exitbar button[title]{margin-left:0}
body.hostplay #exitbar .mute{display:none}
body.hostplay #exitbar .fontwrap{margin-left:auto}
body.hostplay #exitbar button{white-space:nowrap;flex:none}
body.hostplay .roomchip.inbar{font-size:15px;padding:4px 14px;margin:0 0 0 4px;min-width:0;overflow:hidden;text-overflow:ellipsis}
body.hostplay #exitbar .tools{margin:0;gap:6px;flex:none}
body.hostplay #exitbar .tools button,body.hostplay #exitbar button[aria-label="Mô phỏng màn chiếu"]{width:36px;height:36px;min-height:0;padding:0;border-radius:50%;font-size:15px;line-height:1;display:inline-grid;place-items:center;background:#fff;color:var(--ol,#1e1b4b);border:2px solid var(--ol,#1e1b4b);box-shadow:0 2px 0 var(--ol,#1e1b4b)}
body.hostplay #exitbar .tools input[type=range]{width:56px}
@media(max-width:1180px){body.hostplay #exitbar{flex-wrap:wrap;row-gap:6px}body.hostplay #exitbar .remotecta{font-size:0;padding:7px 12px}body.hostplay #exitbar .remotecta::first-letter{font-size:16px}}

/* ===== Toàn màn hình: thẻ câu hỏi lấp đầy khung, ô đáp án chia đều phần cao còn lại ===== */
@media (min-width:900px){
  :root body.fs[data-game]{--gs-q-font:clamp(34px,3.2vw,72px);--gs-ans-font:clamp(30px,3vw,64px);--gs-gap:clamp(14px,1.4vw,26px)}
  body.fs[data-game]{--gs-badge:clamp(56px,4.2vw,84px)}
  body.fs[data-game] #app>.card:has(>.answers)>.answers{max-height:68vh}
  body.fs[data-game] #app>.card:has(>.answers){min-height:calc(100dvh - 70px);display:flex;flex-direction:column;justify-content:space-between}
  body.fs[data-game] #app>.card:has(>.answers)>.answers{flex:1;grid-auto-rows:1fr;margin-top:6px}
  body.fs[data-game] #app>.card:has(>.answers) .ans{min-height:0}
}

/* Quyền trợ giúp dưới ô đáp án (Quiz) */
.qhelps{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:12px}
.qhelps button{font-size:clamp(14px,1.1vw,18px)!important;padding:6px 14px!important}
.qhelps button.on{outline:3px solid var(--acc)}
.ans.gone{opacity:.15;filter:grayscale(1);pointer-events:none}
body.fs[data-game] #app>.card:has(>.answers){justify-content:flex-start}

/* Rung chuông vàng: tên bị loại rung rồi rơi */
@keyframes plKo{0%{transform:none}20%{transform:translateX(-8px) rotate(-3deg)}40%{transform:translateX(8px) rotate(3deg)}100%{transform:translateY(46px) scale(.7) rotate(8deg);opacity:0}}
body[data-game=present] .pl.ko{animation:plKo .85s ease-in forwards;background:#ffd0d6;border-color:var(--rose,#e11d48)}
@media(prefers-reduced-motion:reduce){body[data-game=present] .pl.ko{animation:none;opacity:.3}}

/* Không đổ bóng chữ trong mọi game (chữ phẳng, rõ hơn khi chiếu). Chữ số đếm 3-2-1 (.fxbig) giữ viền riêng. */
:root body[data-game] :not(.fxbig),:root body[data-game] :not(.fxbig)::before,:root body[data-game] :not(.fxbig)::after{text-shadow:none!important}

/* ===== Ô đáp án kiểu viên thuốc (--gs-*): viền + bóng đáy lấy tông đậm của chính màu ô, nền chuyển sáng nhẹ ===== */
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):nth-child(1){--pc:var(--c0)}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):nth-child(2){--pc:var(--c1)}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):nth-child(3){--pc:#c2570c}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):nth-child(4){--pc:var(--ans3,var(--c3))}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):nth-child(n+5){--pc:#6b46c1}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt){
  --bs:color-mix(in srgb,var(--pc,var(--c0)) 58%,#000);
  border:var(--gs-border) solid var(--bs);border-radius:var(--gs-radius);
  box-shadow:0 var(--gs-drop) 0 var(--bs);
}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):not(.right):not(.wrong):not(.picked):not(.wrongpick){
  background:linear-gradient(180deg,color-mix(in srgb,var(--pc,var(--c0)) 80%,#fff) 0,var(--pc,var(--c0)) 60%)!important;color:var(--white);
}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):hover:not(:disabled){transform:translateY(-2px);box-shadow:0 calc(var(--gs-drop) + 2px) 0 var(--bs)}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt):active:not(:disabled){transform:translateY(var(--gs-drop));box-shadow:0 0 0 var(--bs)}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt).right{box-shadow:0 var(--gs-drop) 0 #0d5a2a,0 0 0 4px rgba(255,255,255,.85);border-color:#0d5a2a}
:root body[data-skin=cartoon][data-game] .sg-opt.right{outline-width:4px}
:root body[data-skin=cartoon][data-game] :is(.ans,.sg-opt).wrong{box-shadow:0 var(--gs-drop) 0 #9a94b0;border-color:#9a94b0}
:root body[data-skin=cartoon][data-game] .ans::after,:root body[data-skin=cartoon][data-game] .sg-opt::after{display:none}
:root body[data-skin=cartoon][data-game] .card[data-len] .ans{border-radius:24px}
/* khung câu hỏi cùng kiểu, bóng đáy nông */
:root body[data-skin=cartoon][data-game] :is(.sg-q,.qbox){border-width:var(--gs-border);box-shadow:0 calc(var(--gs-drop) + 1px) 0 var(--ol)}

/* Các ô lựa chọn khác (Đúng/Sai, ô thêm, nút cướp điểm…) dùng đúng kiểu viên thuốc của ô đáp án */
:root body[data-skin=cartoon][data-game] #app :is(.tfbtn,.exopt,.snopt,.stealbtn){
  border:var(--gs-border) solid var(--ol)!important;border-radius:var(--gs-radius)!important;
  box-shadow:0 var(--gs-drop) 0 var(--ol)!important;
}
:root body[data-skin=cartoon][data-game] #app :is(.tfbtn,.exopt,.snopt,.stealbtn):active:not(:disabled){transform:translateY(var(--gs-drop));box-shadow:0 0 0 var(--ol)!important}

/* Trình chiếu: chữ cái A/B/C/D là huy hiệu tròn cỡ --gs-badge, cùng kiểu với ô đáp án tự chơi */
body[data-game=present] .sg-opt{gap:14px}
body[data-game=present] .sg-opt-l{flex:none;display:grid;place-items:center;width:var(--gs-badge);height:var(--gs-badge);border-radius:50%;background:var(--white);color:var(--deep-indigo,#1b1f3b);border:3px solid var(--ol,#2b2b4a);font-weight:900;font-size:calc(var(--gs-badge)*.52);line-height:1}

/* Bảng chấm điểm (Xung phong) trên skin hoạt hình: nền kem nên tên em phải chữ tối (trước đây chữ trắng chỉ đọc được nhờ bóng chữ) */
:root body[data-skin=cartoon][data-game] .sg-score .sc-n{color:var(--ol)!important;background:#fff!important;border:3px solid var(--ol)}
/* Vòng quay 3D (wheel3d.js): canvas trong suốt, không bo tròn/đổ bóng hộp như bản 2D; bóng đổ theo hình vòng quay */
body[data-game=present] .wh-canvas.wh-canvas3d{border-radius:0;box-shadow:none;filter:drop-shadow(0 16px 18px #000a)}
.wh-mode{font-size:.8rem;padding:4px 10px;opacity:.8}
/* Bục vinh danh 3D (podium3d.js): thắng quy tắc canvas chung (width:auto, max-height) bằng độ ưu tiên cao hơn */
body[data-game]:not(.fs) #app .bx-final.bx-has3d canvas.bx-podium3d,body[data-game] #app .bx-final.bx-has3d canvas.bx-podium3d.bx-podium3d{display:block;width:min(560px,100%)!important;height:auto!important;max-width:100%!important;max-height:none!important;margin:0 auto 6px;filter:drop-shadow(0 12px 16px #0009)}
/* Rương kho báu 3D (chest3d.js): lớp phủ giữa màn hình, không chặn chuột */
.chest3d{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:var(--z-panel);pointer-events:none;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 18px 14px;border-radius:24px;background:radial-gradient(closest-side,#14122bd9 55%,#14122b00)}
.chest3d .chest3d-cv{width:min(420px,78vw);height:auto;display:block;filter:drop-shadow(0 14px 16px #0009)}
.chest3d-cap{display:flex;flex-direction:column;align-items:center;text-align:center;text-shadow:0 2px 8px #000}
.chest3d-cap b{font-size:clamp(1.3rem,3.4vw,2rem)}.chest3d-cap span{color:#fff;font-size:clamp(1rem,2.4vw,1.4rem)}
