/* Kiểu dùng chung cho các game (tách từ Avalon). */

:root{
  --bg1:#2b1a52;--bg2:#120a26;--ink:#fff8ec;--muted:#cbbfe6;--panel:rgba(26,16,52,.86);--line:rgba(255,255,255,.14);
  --gold:#f6c544;--good:#3b82f6;--evil:#ef4444;--ok:#22c55e;--pink:#ff7eb6;--radius:16px;
  font-family:'Baloo 2',system-ui,sans-serif;color:var(--ink);
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:radial-gradient(120% 90% at 50% 20%,var(--bg1),var(--bg2));}
canvas#c{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none}
button{font:inherit;color:inherit;cursor:pointer}
svg.i{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
#layer{position:fixed;inset:0;pointer-events:none;overflow:hidden}
.tag{position:absolute;transform:translate(-50%,-100%);padding:2px 10px;border-radius:999px;background:rgba(20,10,40,.72);border:1.5px solid var(--line);
  font-weight:700;font-size:13px;white-space:nowrap;display:flex;gap:4px;align-items:center;pointer-events:auto;transition:border-color .2s,background .2s;user-select:none}
.tag.team{border-color:var(--gold);background:rgba(90,60,0,.8)}
.tag.sel{outline:2px dashed var(--gold);outline-offset:2px}
.tag.pickable{cursor:pointer;animation:pulse 1.2s infinite}
.tag .role{font-size:11px;font-weight:600;padding:0 6px;border-radius:999px;background:var(--good)}
.tag .role.evil{background:var(--evil)}
.tag .role.hint{background:#8b5cf6}
.tag svg.i{width:15px;height:15px}
.tag .crown{color:var(--gold)}
.vote{position:absolute;transform:translate(-50%,-100%);width:34px;height:34px;border-radius:50%;display:grid;place-items:center;animation:popin .35s cubic-bezier(.3,1.8,.5,1)}
.vote.yes{background:var(--ok)} .vote.no{background:var(--evil)}
.vote svg.i{width:20px;height:20px;stroke-width:3;color:#fff}
.bubble{position:absolute;transform:translate(-50%,-100%);width:max-content;max-width:min(270px,70vw);background:#fffdf6;color:#2a1b40;border-radius:18px;padding:8px 12px;
  font-size:15px;line-height:1.3;font-weight:600;box-shadow:0 6px 20px rgba(0,0,0,.35);animation:popin .3s cubic-bezier(.3,1.7,.5,1)}
.bubble b{display:block;font-size:12px;color:#7c3aed;font-weight:800}
.bubble::after{content:"";position:absolute;left:calc(50% + clamp(-100px, var(--tail, 0px), 100px));bottom:-9px;margin-left:-9px;border:9px solid transparent;border-bottom:0;border-top-color:#fffdf6}
.bubble.out{animation:popout .25s forwards}
@keyframes popin{from{transform:translate(-50%,-100%) scale(.2);opacity:0}}
@keyframes popout{to{transform:translate(-50%,-100%) scale(.5);opacity:0}}
@keyframes pulse{50%{border-color:var(--gold);box-shadow:0 0 12px var(--gold)}}
#top{position:fixed;top:0;left:0;right:0;display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between;padding:10px max(16px,env(safe-area-inset-left));pointer-events:none}
#top>*{pointer-events:auto}
.quests{display:flex;gap:6px}
.q{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;font-weight:800;background:rgba(255,255,255,.12);border:2px solid var(--line);font-size:15px}
.q.cur{border-color:var(--gold);box-shadow:0 0 10px var(--gold)}
.q.win{background:var(--good)} .q.lose{background:var(--evil)}
.q small{font-size:9px;display:block;line-height:1;margin-top:-4px}
.rej{display:flex;align-items:center;gap:4px;font-size:13px;color:var(--muted);background:var(--panel);padding:4px 10px;border-radius:999px}
.rej i{width:10px;height:10px;border-radius:50%;background:rgba(255,255,255,.2)} .rej i.on{background:var(--evil)}
.tools{display:flex;gap:6px}
.ib{width:38px;height:38px;border-radius:12px;border:1px solid var(--line);background:var(--panel);display:grid;place-items:center}
.ib[aria-pressed=true]{background:#5b3fa8;border-color:var(--gold)}
.ib.txt{width:auto;padding:0 10px;font-weight:700;font-size:14px}
#banner{display:none;position:fixed;top:64px;left:50%;transform:translateX(-50%);background:var(--panel);border:1px solid var(--line);padding:6px 16px;border-radius:999px;
  font-weight:700;font-size:15px;text-align:center;max-width:calc(100vw - 32px);pointer-events:none}
#caster{position:fixed;left:50%;bottom:max(20px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(620px,calc(100vw - 32px));display:none;gap:10px;align-items:flex-start;background:linear-gradient(135deg,rgba(124,58,237,.92),rgba(219,39,119,.88));
  border:1.5px solid rgba(255,255,255,.35);border-radius:18px;padding:10px 14px;box-shadow:0 10px 30px rgba(0,0,0,.35);pointer-events:none}
#caster.show{display:flex}
#caster b{font-size:12px;letter-spacing:.04em;text-transform:uppercase;opacity:.85}
#caster .txt{font-size:16px;font-weight:600;line-height:1.35}
#caster .mic{width:40px;height:40px;border-radius:50%;background:#fff;color:#7c3aed;display:grid;place-items:center;flex:none}
#caster.live .mic{animation:pulse2 1s infinite}
@keyframes pulse2{50%{box-shadow:0 0 0 8px rgba(255,255,255,.25)}}
.tag img.tav{width:22px;height:22px;border-radius:50%;margin-left:-6px;background:rgba(255,255,255,.15)}
.bubble b img{width:22px;height:22px;border-radius:50%;vertical-align:middle;margin-right:4px;background:#efe7ff}
#panel{position:fixed;z-index:3;left:50%;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(560px,calc(100vw - 32px));background:var(--panel);
  border:1px solid var(--line);border-radius:var(--radius);padding:12px;display:none;backdrop-filter:blur(8px)}
#panel.show{display:block;animation:up .3s}
@keyframes up{from{transform:translate(-50%,30px);opacity:0}}
#panel h3{margin:0 0 8px;font-size:16px}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
.chip{border:1.5px solid var(--line);background:rgba(255,255,255,.06);border-radius:999px;padding:4px 12px;font-weight:600;font-size:14px}
.chip[aria-pressed=true]{background:var(--gold);color:#2a1b00;border-color:var(--gold)}
.row{display:flex;gap:8px;flex-wrap:wrap}
.btn{flex:1;min-width:120px;border:0;border-radius:12px;padding:10px 14px;font-weight:800;font-size:16px;display:flex;align-items:center;justify-content:center;gap:6px;background:#5b3fa8}
.btn.ok{background:var(--ok);color:#06240f} .btn.no{background:var(--evil)} .btn.gold{background:var(--gold);color:#2a1b00}
.btn:disabled{opacity:.4;cursor:not-allowed}
#quick{position:fixed;left:max(16px,env(safe-area-inset-left));bottom:max(16px,env(safe-area-inset-bottom));display:none;flex-direction:column;gap:6px}
#quick.show{display:flex}
#quick button{border:1px solid var(--line);background:var(--panel);border-radius:999px;padding:4px 12px;font-weight:600;font-size:13px;text-align:left}
#rolecard{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));width:min(250px,calc(100vw - 32px));background:var(--panel);
  border:1px solid var(--line);border-radius:var(--radius);padding:10px 12px;font-size:13px;display:none}
#rolecard.show{display:block}
#rolecard img{width:64px;height:64px;border-radius:12px;float:left;margin:0 10px 4px 0;object-fit:cover}
.sheet img.cover{width:100%;aspect-ratio:3/2;object-fit:cover;border-radius:16px;margin-bottom:12px;display:block}
img.av{width:34px;height:34px;border-radius:8px;object-fit:cover;display:block}
.think{display:inline-flex;gap:4px;padding:4px 0}.think i{width:7px;height:7px;border-radius:50%;background:#7c3aed;animation:th 1s infinite}.think i:nth-child(2){animation-delay:.15s}.think i:nth-child(3){animation-delay:.3s}
@keyframes th{50%{transform:translateY(-4px);opacity:.4}}
#rolecard strong{font-size:17px;display:block}
#rolecard.evil strong{color:#ff8a8a} #rolecard.good strong{color:#8ab8ff}
#log{position:fixed;top:120px;right:max(16px,env(safe-area-inset-right));width:340px;height:min(560px,calc(100vh - 150px));display:none;flex-direction:column;
  background:#1a1033;border:1px solid var(--line);border-radius:18px;box-shadow:0 16px 40px rgba(0,0,0,.45);z-index:4;overflow:hidden}
#log.show{display:flex}
#log header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px 8px 16px;border-bottom:1px solid var(--line);font-size:15px}
#log header .ib{width:32px;height:32px}
#logList{flex:1;overflow-y:auto;padding:10px 12px 14px;display:flex;flex-direction:column;gap:8px;overscroll-behavior:contain}
#logList .msg{display:flex;gap:8px;align-items:flex-start}
#logList .msg img,#logList .msg>i{width:30px;height:30px;border-radius:50%;flex:none;background:#efe7ff}
#logList .msg>div{background:#2a1c50;border-radius:4px 14px 14px 14px;padding:6px 10px;max-width:calc(100% - 40px)}
#logList .msg b{display:block;font-size:12px;font-weight:800;margin-bottom:1px}
#logList .msg span{font-size:14px;line-height:1.35;color:var(--ink)}
#logList .msg.me{flex-direction:row-reverse}
#logList .msg.me>div{background:#5b3fa8;border-radius:14px 4px 14px 14px}
#logList .sys{align-self:center;max-width:90%;text-align:center}
#logList .sys span{display:inline-block;font-size:12px;color:var(--muted);background:rgba(255,255,255,.07);border-radius:999px;padding:2px 10px}
#logList .cast{background:linear-gradient(135deg,rgba(124,58,237,.35),rgba(219,39,119,.3));border:1px solid rgba(255,255,255,.18);border-radius:14px;padding:7px 11px;font-size:13.5px;line-height:1.35}
#logList .cast b{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#ffd1ea}
#stamp{position:fixed;inset:0;display:grid;place-items:center;pointer-events:none}
#stamp span{font-size:clamp(44px,11vw,120px);font-weight:800;color:#fff;-webkit-text-stroke:3px #2a1b40;text-shadow:6px 6px 0 #ff4fa3;animation:stamp 1.6s cubic-bezier(.2,1.6,.4,1) forwards}
@keyframes stamp{0%{transform:scale(3) rotate(-20deg);opacity:0}25%{transform:scale(1) rotate(-6deg);opacity:1}80%{transform:scale(1.05) rotate(-4deg);opacity:1}100%{transform:scale(.6) rotate(10deg);opacity:0}}
#flash{position:fixed;inset:0;background:#fff;opacity:0;pointer-events:none}
#flash.on{animation:flash .6s}
@keyframes flash{0%,30%{opacity:.9}15%,60%{opacity:.1}100%{opacity:0}}
#cards{position:fixed;inset:0;display:none;place-items:center;background:rgba(10,5,25,.55);pointer-events:none}
#cards.show{display:grid}
#cards .wrap{display:flex;gap:12px;flex-wrap:wrap;justify-content:center;padding:16px}
.card{width:84px;height:120px;perspective:600px}
.card .in{position:relative;width:100%;height:100%;transition:transform .6s cubic-bezier(.3,1.5,.5,1);transform-style:preserve-3d}
.card.flip .in{transform:rotateY(180deg)}
.card .f,.card .b{position:absolute;inset:0;border-radius:12px;backface-visibility:hidden;display:grid;place-items:center;border:3px solid #fff}
.card .f{background:repeating-linear-gradient(45deg,#5b3fa8 0 10px,#4a2f90 10px 20px)}
.card .b{transform:rotateY(180deg)} .card .b.s{background:var(--good)} .card .b.x{background:var(--evil)}
.card svg.i{width:50px;height:50px;color:#fff;stroke-width:2}
.modal{position:fixed;inset:0;display:none;place-items:center;background:rgba(10,5,25,.7);padding:16px;z-index:5}
.modal.show{display:grid}
.sheet{width:min(520px,100%);max-height:calc(100vh - 32px);overflow:auto;background:linear-gradient(160deg,#36226b,#1d1238);border:1px solid var(--line);border-radius:22px;padding:20px}
.sheet h1{margin:0;font-size:clamp(28px,7vw,40px);line-height:1;color:var(--gold);text-shadow:3px 3px 0 #7a2d8c}
.sheet h2{margin:16px 0 6px;font-size:15px;color:var(--muted);font-weight:600}
.sheet p{margin:6px 0;color:var(--muted)}
.seg{display:flex;gap:6px;flex-wrap:wrap}
.seg button{flex:1;min-width:44px;border:1.5px solid var(--line);background:rgba(255,255,255,.06);border-radius:12px;padding:8px;font-weight:700}
.seg button[aria-pressed=true]{background:var(--gold);color:#2a1b00;border-color:var(--gold)}
.sheet input{width:100%;border:1.5px solid var(--line);background:rgba(255,255,255,.08);border-radius:12px;padding:8px 12px;font:inherit;color:inherit}
.sheet .btn{margin-top:18px;width:100%;font-size:19px}
table.res{width:100%;border-collapse:collapse;margin-top:10px;font-size:14px}
table.res td{padding:4px 6px;border-bottom:1px solid var(--line)}
.pill{padding:0 8px;border-radius:999px;font-size:12px;font-weight:700} .pill.g{background:var(--good)} .pill.e{background:var(--evil)}
@media (max-width:700px){
  #caster{top:96px;padding:8px 10px}#caster .txt{font-size:13px}#caster .mic{width:30px;height:30px}
  .bubble{font-size:13px;max-width:200px}
  .tag{font-size:11px}
  #rolecard{bottom:auto;top:150px;width:200px}
}

.steps{margin:8px 0;padding-left:20px;color:var(--ink)} .steps li{margin:6px 0;line-height:1.35}
.roles{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px;margin:10px 0}
.roles div{display:flex;gap:8px;align-items:center;background:rgba(255,255,255,.06);border-radius:12px;padding:6px;font-size:12px;line-height:1.25}
.roles img{width:44px;height:44px;border-radius:10px;object-fit:cover;flex:none}
.roles b{display:block;font-size:13px}
.roles .e b{color:#ff8a8a} .roles .g b{color:#8ab8ff}
#quickWrap{position:fixed;left:max(16px,env(safe-area-inset-left));bottom:max(16px,env(safe-area-inset-bottom));display:none;align-items:flex-end;gap:8px}
#quickWrap.show{display:flex}
#quick{position:static;display:none}
#quickWrap.open #quick{display:flex}
#rolecard{cursor:pointer}
#bWatch[hidden]{display:none!important}
#rolecard.mini .side{display:none}
@media (max-width:700px){#ready .lg{display:none}#ready{padding-left:16px;padding-right:16px}}
#menu .vol{display:flex;flex-direction:column;gap:10px;padding:10px 12px 12px;border-bottom:1px solid var(--line);margin-bottom:4px}
#menu .vol label{display:grid;grid-template-columns:20px 1fr;align-items:center;gap:4px 8px;font-size:13px;font-weight:600}
#menu .vol svg{width:18px;height:18px}
#menu .vol input{grid-column:1/-1;width:100%;accent-color:var(--gold);height:24px}
.dcard{display:flex;gap:12px;align-items:flex-start;margin:6px 0 2px}
.dcard img{width:72px;height:72px;border-radius:14px;object-fit:cover;flex:none}
.dcard b{font-size:14px} .dcard b.e{color:#ff8a8a} .dcard b.g{color:#8ab8ff}
.dcard p{margin:4px 0 0;font-size:13.5px}
.dstk{display:flex;gap:6px;flex-wrap:wrap}
.dstk button{width:40px;height:40px;border-radius:12px;border:1px solid var(--line);background:rgba(255,255,255,.06);display:grid;place-items:center;padding:0}
.dsheet .hist small{display:block;color:var(--muted);font-size:12px}
.dsheet .e{color:#ff8a8a;font-weight:700} .dsheet .g{color:#8ab8ff;font-weight:700} .dsheet .m{color:var(--muted);font-weight:700}
#caster.show{animation:casterIn .35s cubic-bezier(.2,1.6,.4,1)}
@keyframes casterIn{from{transform:translateX(-50%) scale(.85) rotate(-1.5deg);opacity:0}}
#caster .mic{box-shadow:0 0 0 0 rgba(255,255,255,.5)}
#caster.live .mic{animation:pulse2 1s infinite,micBop .5s ease-in-out infinite alternate}
@keyframes micBop{to{transform:rotate(-12deg) scale(1.08)}}
#quickWrap{z-index:6}
#quickWrap.open #quick{position:fixed!important;left:max(12px,env(safe-area-inset-left))!important;right:max(12px,env(safe-area-inset-right))!important;
  bottom:calc(max(12px,env(safe-area-inset-bottom)) + 50px)!important;max-width:560px;display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:8px;
  background:#1d1238;border:1px solid var(--line);border-radius:18px;padding:10px;box-shadow:0 16px 40px rgba(0,0,0,.5);z-index:6}
#quick .chatrow{margin:0!important}
#quick .chatrow .ib{flex:none}
.qchips{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;padding-bottom:2px}
.qchips::-webkit-scrollbar{display:none}
.qchips button{flex:none;border:1px solid var(--line);background:rgba(255,255,255,.07);border-radius:999px;padding:7px 12px;font:600 13px/1.1 inherit;color:inherit;white-space:nowrap}
#qRec.rec{background:#dc2626;border-color:#fecaca;animation:recPulse 1s ease-in-out infinite}
@keyframes recPulse{50%{box-shadow:0 0 0 6px rgba(220,38,38,.25)}}
.replay{margin-left:6px;display:inline-flex;align-items:center;gap:4px;border:1px solid var(--line);background:rgba(255,255,255,.08);color:inherit;border-radius:999px;padding:2px 9px;font:600 12px/1.4 inherit;vertical-align:middle}
.replay svg{width:13px;height:13px}
.opt{font-size:12px;font-weight:600;color:var(--muted);margin-left:6px}
.pubstat{display:flex;flex-wrap:wrap;gap:6px 14px;margin:14px 0 2px;font-size:13px;color:var(--muted)}
.pubstat span{display:inline-flex;align-items:center;gap:5px}
.pubstat b{color:var(--ink)}
.pubstat svg,.publist small svg{width:15px;height:15px}
.publist{list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:6px;max-height:220px;overflow:auto}
.publist li{display:flex;align-items:center;gap:10px;background:rgba(255,255,255,.06);border-radius:12px;padding:8px 10px}
.publist li div{flex:1;min-width:0}
.publist li b{display:block;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.publist li small{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--muted)}
.publist .btn{margin:0!important;width:auto!important;padding:7px 12px;font-size:13px!important;display:inline-flex;align-items:center;gap:5px}
.publist .muted{color:var(--muted);font-size:13px}
#viewers{width:auto;padding:0 9px;gap:5px;display:inline-flex;align-items:center;font-size:13px}
#viewers[hidden]{display:none}
#viewers svg{width:16px;height:16px}
body.watch #bMic,body.watch #bInvite,body.watch #rolecard{display:none!important}
#lVis button,#lSpec button{display:inline-flex;align-items:center;justify-content:center;gap:6px}
#lVis svg,#lSpec svg{width:15px;height:15px}
.tag{cursor:pointer}
#tease{position:fixed;z-index:7;display:none;transform:translate(-50%,-100%);background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:8px 10px;box-shadow:0 12px 30px rgba(0,0,0,.45);text-align:center}
#tease.show{display:block;animation:tzIn .16s ease-out}
@keyframes tzIn{from{opacity:0;transform:translate(-50%,-90%) scale(.9)}}
#tease b{display:block;font-size:12.5px;color:var(--muted);margin-bottom:6px}
#tease div{display:grid;grid-template-columns:repeat(6,40px);gap:4px}
#tease button{width:40px;height:40px;border-radius:12px;border:1px solid transparent;background:rgba(255,255,255,.06);display:grid;place-items:center;padding:0}
#tease button:active{transform:scale(.9);border-color:var(--gold)}
.stk{position:fixed;z-index:9;pointer-events:none;filter:drop-shadow(0 6px 8px rgba(0,0,0,.4))}
.stk-hit{position:fixed;z-index:9;pointer-events:none;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;animation:stkHit 1.7s ease-out forwards}
.stk-hit b{margin-top:2px;padding:2px 9px;border-radius:999px;background:rgba(20,10,40,.85);font-size:13px;white-space:nowrap}
.stk-hit small{font-size:11px;color:var(--muted);margin-top:2px;text-shadow:0 1px 2px #000}
.stk-hit.tomato svg,.stk-hit.egg svg{animation:stkSplat .35s ease-out}
@keyframes stkSplat{0%{transform:scale(1.6,.5)}60%{transform:scale(.9,1.15)}100%{transform:scale(1)}}
@keyframes stkHit{0%{opacity:0;transform:translate(-50%,-50%) scale(.6)}12%{opacity:1;transform:translate(-50%,-50%) scale(1.1)}75%{opacity:1;transform:translate(-50%,-70%) scale(1)}100%{opacity:0;transform:translate(-50%,-95%) scale(.95)}}
#rolecard .duty{float:right;display:inline-flex;align-items:center;gap:5px;margin:0 0 0 8px;padding:5px 10px;border-radius:999px;border:1px solid var(--gold);background:rgba(246,197,68,.14);color:var(--gold);font:700 12.5px/1 inherit;letter-spacing:.02em}
#rolecard .duty svg{width:15px;height:15px}
#rolecard.mini .duty{float:none;vertical-align:middle;padding:4px 8px}
#duty{position:fixed;inset:0;z-index:8;display:none;align-items:flex-end;justify-content:center;background:rgba(6,4,14,.55);padding:0 12px max(12px,env(safe-area-inset-bottom))}
#duty.show{display:flex;animation:dIn .18s ease-out}
@keyframes dIn{from{opacity:0}}
.dsheet{width:min(520px,100%);max-height:78vh;overflow:auto;background:var(--panel);border:1px solid var(--line);border-top:3px solid var(--good);border-radius:18px;padding:14px 16px 16px;box-shadow:0 18px 50px rgba(0,0,0,.5)}
.dsheet.evil{border-top-color:var(--evil)}
.dsheet header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px}
.dsheet header b{display:flex;align-items:center;gap:8px;font-size:16px}
.dsheet header b svg{width:20px;height:20px;color:var(--gold)}
.dsheet .dk{margin:12px 0 4px;font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.dsheet p{margin:0;font-size:14px;line-height:1.45}
.dsheet ul{margin:0;padding-left:18px;font-size:14px;line-height:1.45}
.dsheet li+li{margin-top:5px}
.dsheet .dl{display:flex;flex-direction:column;gap:6px}
.dsheet .dl button{text-align:left;padding:9px 12px;border-radius:12px;border:1px solid var(--line);background:rgba(255,255,255,.06);color:inherit;font:inherit;font-size:13.5px;line-height:1.35}
.dsheet .dl button:active{background:rgba(246,197,68,.18)}
#rolecard .more{display:block}
#rolecard.mini .more{display:none}
#rolecard.mini{width:auto;padding:6px 10px 6px 6px}
#rolecard.mini img{width:34px;height:34px;margin:0 8px 0 0;border-radius:50%}
#rolecard.mini strong{font-size:14px;display:inline}
.hint{font-size:13px;color:var(--muted);margin:-4px 0 8px}
@media (max-width:700px){
  #top{padding:8px 12px;gap:6px}
  .q{width:30px;height:30px;font-size:13px}
  .tools{width:100%;overflow-x:auto;scrollbar-width:none;gap:5px}
  .tools::-webkit-scrollbar{display:none}
  .ib{width:34px;height:34px;flex:none;border-radius:10px}
  .ib svg.i{width:17px;height:17px}
  #caster{top:auto;bottom:calc(max(12px,env(safe-area-inset-bottom)) + 52px);width:calc(100vw - 24px)}
  #caster .txt{font-size:13.5px;line-height:1.3}
  #rolecard{top:auto;right:12px;bottom:max(12px,env(safe-area-inset-bottom));width:calc(100vw - 80px);max-width:300px}
  #rolecard.mini{width:auto}
  #quickWrap{left:12px;bottom:max(12px,env(safe-area-inset-bottom))}
  #quickWrap.open #quick{position:fixed;left:12px;right:12px;bottom:calc(max(12px,env(safe-area-inset-bottom)) + 48px);flex-direction:row;flex-wrap:wrap}
  #panel{bottom:max(12px,env(safe-area-inset-bottom));width:calc(100vw - 24px);z-index:3}
  #log{top:auto;left:0;right:0;bottom:0;width:auto;height:62vh;border-radius:20px 20px 0 0;padding-bottom:env(safe-area-inset-bottom)}
  .bubble{max-width:min(210px,62vw);font-size:12.5px;padding:6px 10px}
  .tag{font-size:10.5px;padding:1px 7px 1px 2px}
  .tag img.tav{width:18px;height:18px;margin-left:0}
}

#menu{position:absolute;top:calc(100% + 6px);right:0;display:none;flex-direction:column;min-width:220px;background:#1a1033;border:1px solid var(--line);border-radius:16px;padding:6px;box-shadow:0 16px 40px rgba(0,0,0,.45);z-index:6}
#menu.show{display:flex}
.tools{position:relative}
.mi{display:flex;align-items:center;gap:10px;border:0;background:none;padding:9px 10px;border-radius:10px;font-weight:600;font-size:14px;text-align:left}
.mi:hover{background:rgba(255,255,255,.07)}
.mi[aria-pressed]::after{content:"";margin-left:auto;width:30px;height:18px;border-radius:999px;background:rgba(255,255,255,.18);box-shadow:inset -12px 0 0 2px #1a1033}
.mi[aria-pressed=true]::after{background:var(--gold);box-shadow:inset 12px 0 0 2px #1a1033}
.mi svg.i{color:var(--muted)}
.sheet h1 span{display:block;font-size:.62em;color:#fff;text-shadow:none;margin-top:4px}
.sheet .lead{font-size:14px;line-height:1.4}
.seg.cards button{display:flex;flex-direction:column;align-items:flex-start;text-align:left;padding:10px 12px;gap:2px}
.seg.cards b{font-size:15px} .seg.cards small{font-weight:500;font-size:12px;opacity:.8}
.seg.pills{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -20px;padding:2px 20px;scroll-snap-type:x proximity}
.seg.pills::-webkit-scrollbar{display:none}
.seg.lvseg{display:grid;grid-template-columns:repeat(6,1fr);gap:6px}
.seg.lvseg button{grid-column:span 2;font-size:13.5px;padding:9px 2px;min-width:0;white-space:nowrap}
.seg.lvseg button:nth-child(-n+2){grid-column:span 3}
.seg.pills button{flex:none;min-width:0;border-radius:999px;padding:7px 14px;font-size:14px;white-space:nowrap;scroll-snap-align:start}
#sRoles{display:flex;flex-wrap:wrap;gap:6px}
#sRoles span{display:flex;align-items:center;gap:6px;padding:3px 10px 3px 3px;border-radius:999px;font-size:13px;font-weight:600;background:rgba(59,130,246,.2)}
#sRoles span.e{background:rgba(239,68,68,.22)}
#sRoles img{width:24px;height:24px;border-radius:50%;object-fit:cover}
.sheet .actions{position:sticky;bottom:-20px;display:flex;gap:8px;margin:16px -20px -20px;padding:12px 20px 20px;background:linear-gradient(to top,#1d1238 70%,rgba(29,18,56,0))}
.sheet .actions .btn{margin:0;width:auto}
.btn.ghost{flex:0 0 auto;min-width:0;background:rgba(255,255,255,.08);font-size:15px}
body.acting #caster{display:none}
@media (min-width:701px){#caster{width:min(560px,calc(100vw - 600px))}}
@media (max-width:700px){
  .sheet{padding:16px}
  #top{padding-right:8px}
  .rej{position:absolute;left:14px;top:46px;background:none;padding:0}
  .q{width:28px;height:28px}
  .tools{gap:4px}
  .sheet img.cover{aspect-ratio:auto;height:140px}
  .sheet h1{font-size:28px}
  .sheet h2{margin:12px 0 6px}
  .seg.pills{margin:0 -16px;padding:2px 16px}
  .sheet .actions{margin:12px -16px -16px;padding:12px 16px 16px;bottom:-16px}
  .seg button{padding:8px 4px}
  .tools{width:auto;overflow:visible}
  #top{flex-wrap:nowrap}
  .quests{gap:4px}
  #caster{padding:8px 10px;gap:8px;border-radius:14px}
  #caster .txt{font-size:13px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
  #caster b{font-size:10px}
  #caster .mic{width:28px;height:28px} #caster .mic svg.i{width:15px;height:15px}
  .rej{font-size:0;padding:3px 7px;gap:3px;position:absolute;left:12px;top:46px} .rej i{width:7px;height:7px}
  .q{width:28px;height:28px;font-size:12px;border-width:1.5px} .q small{font-size:8px}
  .ib{width:32px;height:32px} .tools{gap:4px}
}
@media (prefers-reduced-motion:reduce){*{animation-duration:.01s!important;transition:none!important}}

/* ---- online ---- */
body:not(.online) .onl{display:none!important}
body.online #bSpeed,body.online #bPause,body.online #bNew,body.online #bEye{display:none!important}
.seg.cards .wide{flex-basis:100%}
#sCode{text-transform:uppercase;letter-spacing:.25em;font-weight:700}
#bMic[aria-pressed=true]{background:var(--gold);color:#2a1b00;border-color:var(--gold)}
#ready{margin:0;padding:8px 14px;font-size:15px;box-shadow:0 6px 18px rgba(0,0,0,.35);animation:pulse 1.6s ease-in-out infinite}
#ready[hidden],body.acting #ready{display:none!important}
@keyframes pulse{50%{box-shadow:0 0 0 6px rgba(246,197,68,.25),0 6px 18px rgba(0,0,0,.35)}}
#status{position:fixed;left:50%;top:calc(env(safe-area-inset-top) + 64px);transform:translateX(-50%);display:none;align-items:center;gap:10px;background:#1a1033;border:1px solid var(--line);border-radius:999px;padding:5px 6px 5px 14px;font-size:13px;font-weight:600;z-index:2;box-shadow:0 8px 24px rgba(0,0,0,.35);max-width:calc(100vw - 24px);white-space:nowrap}
#status.show{display:flex}
#status span{overflow:hidden;text-overflow:ellipsis}
#status b{background:var(--gold);color:#2a1b00;border-radius:999px;padding:1px 9px;font-variant-numeric:tabular-nums}
.ptimer{float:right;font-size:13px;background:rgba(255,255,255,.12);border-radius:999px;padding:1px 9px;font-variant-numeric:tabular-nums;color:var(--gold)}
#toast{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom) + 90px);transform:translate(-50%,20px);opacity:0;pointer-events:none;background:#fff;color:#1a1033;font-weight:600;font-size:14px;border-radius:14px;padding:10px 16px;z-index:9;transition:.25s;max-width:calc(100vw - 32px);text-align:center;box-shadow:0 10px 30px rgba(0,0,0,.4)}
#toast.show{opacity:1;transform:translate(-50%,0)}
#netState{position:fixed;top:0;left:0;right:0;background:#b45309;color:#fff;text-align:center;font-size:13px;font-weight:600;padding:4px calc(env(safe-area-inset-top));z-index:9}
.tag.acted::after{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;background:#34d399;margin-left:5px;vertical-align:middle;box-shadow:0 0 0 2px rgba(52,211,153,.3)}
.tag.speaking{box-shadow:0 0 0 2px var(--gold),0 0 18px rgba(246,197,68,.7)}
.sheet h1 .code{display:inline;font-size:1em;color:#fff;letter-spacing:.12em;margin:0}
.share{display:flex;gap:8px;margin-top:10px}
.share input{flex:1;min-width:0;font-size:13px!important}
.share .btn{margin:0!important;width:auto!important;font-size:14px!important;padding:8px 12px;white-space:nowrap;display:flex;align-items:center;gap:6px}
.members{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.members li{display:flex;align-items:center;gap:10px;background:rgba(255,255,255,.06);border-radius:12px;padding:6px 10px;font-weight:600;transition:box-shadow .2s}
.members li.talk{box-shadow:0 0 0 2px var(--gold)}
.members li i{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--gold);color:#2a1b00;font-style:normal;font-weight:800;flex:none}
.members li span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.members li em{font-style:normal;font-size:11px;background:rgba(255,255,255,.12);border-radius:999px;padding:1px 8px;color:var(--muted)}
.members li svg.i{width:16px;height:16px;color:#34d399}
.lchat{max-height:110px;overflow:auto;font-size:13px;line-height:1.4;background:rgba(0,0,0,.18);border-radius:12px;padding:8px 10px}
.lchat b{color:var(--gold)} .lchat .muted{color:var(--muted)}
.chatrow{display:flex;gap:6px;margin-top:6px;width:100%}
.chatrow input{flex:1;min-width:0;border:1.5px solid var(--line);background:rgba(255,255,255,.08);border-radius:12px;padding:8px 12px;font:inherit;font-size:14px;color:inherit}
#quick .chatrow{margin:0 0 4px}
#lobby .actions .btn{flex:1;font-size:15px;display:flex;align-items:center;justify-content:center;gap:6px;padding:10px 8px}
#lobby .actions .btn.on{border-color:#34d399;color:#34d399}
@media (max-width:700px){
  #status{top:calc(env(safe-area-inset-top) + 88px);font-size:12px}
  #quickWrap.open #quick{flex-direction:column;align-items:stretch}
  #quickWrap.open #quick > button{align-self:flex-start}
  #lobby .actions{flex-wrap:wrap}
  #lobby .actions .btn.gold{flex-basis:100%;order:-1}
}

/* ---- bối cảnh: ô màu xem trước ---- */
.seg.pills{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin:0!important;padding:0!important;overflow:visible}
.seg.pills button{min-height:58px;border-radius:14px;padding:6px 4px;font-size:12.5px;font-weight:700;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.7);background:var(--g);border:1.5px solid rgba(255,255,255,.12);display:flex;align-items:flex-end;justify-content:center;white-space:nowrap;transition:transform .15s,box-shadow .15s}
.seg.pills button[aria-pressed=true]{background:var(--g);color:#fff;border-color:var(--gold);box-shadow:0 0 0 2px var(--gold),0 6px 16px rgba(0,0,0,.35);transform:translateY(-1px)}
.seg.pills [data-v=auto]{--g:radial-gradient(circle at 75% 28%,#fde68a 0 9%,transparent 10%),linear-gradient(135deg,#7a2d8c,#1b3a5c 55%,#7a1414)}
.seg.pills [data-v=noel]{--g:radial-gradient(circle at 20% 25%,#fff 0 3%,transparent 4%),radial-gradient(circle at 70% 40%,#fff 0 2.5%,transparent 3.5%),radial-gradient(circle at 45% 15%,#fff 0 2%,transparent 3%),linear-gradient(160deg,#2b5a8c,#07111f)}
.seg.pills [data-v=tet]{--g:radial-gradient(circle at 78% 30%,#f6c544 0 10%,transparent 11%),linear-gradient(160deg,#b91c1c,#2a0505)}
.seg.pills [data-v=halloween]{--g:radial-gradient(circle at 75% 30%,#ea580c 0 12%,transparent 13%),linear-gradient(160deg,#4c2584,#0a0414)}
.seg.pills [data-v=trungthu]{--g:radial-gradient(circle at 72% 30%,#fde047 0 13%,transparent 14%),linear-gradient(160deg,#1e3a7a,#050a1c)}
.seg.pills [data-v=beach]{--g:linear-gradient(180deg,#4fb3e8 0 55%,#f2d49b 56%)}
.seg.pills [data-v=castle]{--g:radial-gradient(circle at 50% 30%,#ffd27a 0 5%,transparent 6%),linear-gradient(160deg,#4a2f8a,#120a26)}

/* ---- mobile: khoá zoom, bảng vừa khung iPhone ---- */
html,body{touch-action:manipulation;-webkit-text-size-adjust:100%}
input,select,textarea{font-size:16px!important}
.sheet{max-height:calc(100dvh - 32px);overscroll-behavior:contain;-webkit-overflow-scrolling:touch;position:relative}
.modal{height:100dvh}
.xclose{position:absolute;top:12px;right:12px;z-index:2}
#help .actions .btn,#themes .btn{flex:1}
#themes .seg.pills{margin-top:12px!important}

/* mở phiếu */
#tally{position:fixed;left:50%;top:50%;z-index:40;width:min(92vw,560px);transform:translate(-50%,-50%) scale(.85);opacity:0;pointer-events:none;
  padding:18px 16px 16px;border-radius:22px;background:linear-gradient(160deg,rgba(40,24,80,.96),rgba(18,10,40,.96));border:1.5px solid rgba(246,197,68,.45);
  box-shadow:0 20px 60px rgba(0,0,0,.55),0 0 0 1px rgba(255,255,255,.05) inset;transition:opacity .25s,transform .35s cubic-bezier(.3,1.5,.5,1);text-align:center}
#tally.show{opacity:1;transform:translate(-50%,-50%) scale(1)}
.tl-h{font:800 13px/1 'Baloo 2',sans-serif;letter-spacing:.18em;text-transform:uppercase;color:var(--gold);margin-bottom:12px}
.tl-cards{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.tl-c{width:58px;perspective:500px;animation:tlIn .4s var(--d) both cubic-bezier(.3,1.6,.5,1)}
.tl-c span{display:block;margin-top:4px;font-size:11px;font-weight:700;color:#d9d0f5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tl-in{position:relative;height:74px;transform-style:preserve-3d;transition:transform .5s cubic-bezier(.4,1.6,.5,1)}
.tl-c.flip .tl-in{transform:rotateY(180deg)}
.tl-b,.tl-f{position:absolute;inset:0;border-radius:12px;display:grid;place-items:center;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.tl-b{background:repeating-linear-gradient(45deg,#6b4fa0 0 6px,#5a3f8c 6px 12px);border:2px solid var(--gold);color:var(--gold);font:800 28px 'Baloo 2',sans-serif}
.tl-f{transform:rotateY(180deg);border:2px solid rgba(255,255,255,.6)}
.tl-f.yes{background:radial-gradient(circle at 50% 35%,#4ade80,#15803d);box-shadow:0 0 18px rgba(74,222,128,.6)}
.tl-f.no{background:radial-gradient(circle at 50% 35%,#f87171,#991b1b);box-shadow:0 0 18px rgba(248,113,113,.6)}
.tl-f svg.i{width:30px;height:30px;stroke-width:3.2;color:#fff}
.tl-bar{display:flex;height:8px;border-radius:99px;background:rgba(255,255,255,.08);overflow:hidden;margin:14px 4px 8px}
.tl-bar i{display:block;height:100%;width:0;transition:width .25s}
.tl-bar .y{background:linear-gradient(90deg,#22c55e,#86efac)} .tl-bar .n{background:linear-gradient(90deg,#fca5a5,#ef4444);margin-left:auto}
.tl-num{display:flex;justify-content:center;align-items:baseline;gap:6px;font-weight:700;color:#cfc6ee}
.tl-num b{font:800 28px/1 'Baloo 2',sans-serif} .tl-num b.y{color:#4ade80} .tl-num b.n{color:#f87171}
.tl-stamp{position:absolute;left:50%;top:46%;transform:translate(-50%,-50%) rotate(-12deg) scale(2.6);opacity:0;padding:4px 22px;border:5px solid;border-radius:14px;
  font:900 44px/1.1 'Baloo 2',sans-serif;letter-spacing:.04em;text-transform:uppercase;pointer-events:none;background:rgba(10,6,24,.55);backdrop-filter:blur(2px)}
#tally.pass .tl-stamp{color:#4ade80;border-color:#4ade80;animation:tlStamp .45s cubic-bezier(.2,1.6,.4,1) forwards;text-shadow:0 0 22px rgba(74,222,128,.8)}
#tally.fail .tl-stamp{color:#f87171;border-color:#f87171;animation:tlStamp .45s cubic-bezier(.2,1.6,.4,1) forwards;text-shadow:0 0 22px rgba(248,113,113,.8)}
#tally.fail{animation:tlShake .45s}
@keyframes tlIn{from{opacity:0;transform:translateY(16px) scale(.6)}}
@keyframes tlStamp{to{opacity:1;transform:translate(-50%,-50%) rotate(-12deg) scale(1)}}
@keyframes tlShake{20%{margin-left:-10px}40%{margin-left:9px}60%{margin-left:-6px}80%{margin-left:4px}}
@media (max-width:480px){.tl-c{width:52px}.tl-in{height:66px}.tl-stamp{font-size:36px}}
/* bravo */
#bravo{position:fixed;inset:0;z-index:39;display:grid;place-items:center;pointer-events:none;opacity:0;overflow:hidden}
#bravo i{position:absolute;left:50%;top:50%;width:220vmax;height:220vmax;margin:-110vmax 0 0 -110vmax;border-radius:50%;
  background:repeating-conic-gradient(from 0deg,hsla(var(--hue,45deg),100%,70%,.28) 0 6deg,transparent 6deg 18deg);-webkit-mask:radial-gradient(circle,#000 8%,transparent 42%);mask:radial-gradient(circle,#000 8%,transparent 42%)}
#bravo b{position:relative;font:900 clamp(54px,15vw,128px)/1 'Baloo 2',sans-serif;color:#fff;letter-spacing:.02em;
  background:linear-gradient(180deg,#fff7c2,#f6c544 45%,#ff7a59);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;
  filter:drop-shadow(0 6px 0 #7a2d8c) drop-shadow(0 0 28px hsla(var(--hue,45deg),100%,65%,.9));text-align:center;padding:0 12px}
#bravo.show{animation:bravoFade 2.3s ease forwards}
#bravo.show i{animation:bravoSpin 2.3s linear}
#bravo.show b{animation:bravoPop 2.3s cubic-bezier(.2,1.6,.4,1)}
@keyframes bravoFade{0%{opacity:0}8%{opacity:1}75%{opacity:1}100%{opacity:0}}
@keyframes bravoSpin{from{transform:rotate(0) scale(.6)}to{transform:rotate(80deg) scale(1.1)}}
@keyframes bravoPop{0%{transform:scale(.1) rotate(-20deg)}18%{transform:scale(1.15) rotate(4deg)}28%{transform:scale(1) rotate(-2deg)}80%{transform:scale(1.04)}100%{transform:scale(1.3);opacity:.0}}
@media (prefers-reduced-motion:reduce){#bravo.show i,#bravo.show b,.tl-in{animation:none;transition:none}}
.members li .rd{margin-left:auto;display:inline-flex;align-items:center;gap:4px;font-size:12px;font-weight:700;color:#a99fcf;padding:3px 9px;border-radius:99px;background:rgba(255,255,255,.06)}
.members li.rdy .rd{color:#06210f;background:#4ade80}
.members li .rd svg.i{width:13px;height:13px;stroke-width:3}
.rdy-n{color:#4ade80;font-weight:700}

/* ---- bổ sung engine ---- */
#topL{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
a.ib{color:inherit;text-decoration:none}
.tag.dead{opacity:.55;text-decoration:line-through}
.tag.turn{border-color:var(--gold);box-shadow:0 0 12px var(--gold)}
/* ---- chat trong ván + ném đồ trêu (engine/social.js) ---- */
#bChat{position:relative}
#bChat .dot{position:absolute;top:-5px;right:-5px;min-width:17px;height:17px;padding:0 4px;border-radius:999px;background:#ef4444;color:#fff;font:800 10px/13px system-ui,sans-serif;font-style:normal;text-align:center;border:2px solid #1d1238;display:none}
#bChat.unread .dot{display:block}
#quickWrap.open #quick{bottom:var(--qs,62px)!important;max-height:var(--qh,70vh);overflow:auto;z-index:8}
#quickWrap.open #bChat{background:#5b3fa8;border-color:var(--gold)}
#quick .chead{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:-2px 0 -2px 2px}
#quick .chead b{font-size:14px;font-weight:800}
#quick .chead .ib{width:30px;height:30px;border-radius:10px;padding:0;flex:none}
#quick .chead .ib svg.i{width:16px;height:16px}
#quick .hint{margin:2px;font-size:13px;color:var(--muted)}
#chatList{display:flex;flex-direction:column;gap:4px;max-height:min(170px,26vh);overflow:auto;font-size:14px;line-height:1.3}
#chatList div{background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.06);border-radius:10px;padding:5px 9px;overflow-wrap:anywhere}
#chatList div.me{background:rgba(246,197,68,.1);border-color:rgba(246,197,68,.22)}
#chatList b{font-weight:800;margin-right:5px}
#chatList .muted{color:var(--muted);background:none;border:0;padding:2px}
#chatExtra:empty{display:none}
#quick .chatrow input{font-size:16px;padding:8px 12px}
#tease{max-width:calc(100vw - 16px)}
#tease div{grid-template-columns:repeat(6,40px)}
.prt{position:fixed;z-index:9;pointer-events:none;display:block;line-height:0;transform:translate(-50%,-50%)}
.prt.haha{line-height:1;font:800 20px/1 "Baloo 2",system-ui,sans-serif;color:#ffd43b;-webkit-text-stroke:1px #7a4b00;text-shadow:0 2px 0 #7a4b00}
.stk-hit{white-space:nowrap}.stk-hit b,.stk-hit small{white-space:nowrap}
.stk-hit .sv{position:relative;z-index:1;line-height:0}
.stk-hit .blob{position:absolute;z-index:0;left:50%;top:-16px;width:86px;height:86px;margin-left:-43px;opacity:.9;animation:blobIn .3s cubic-bezier(.2,1.6,.4,1) both}
.stk-hit .blob svg{width:100%;height:100%;animation:none!important}
.stk-hit.squish .sv svg{animation:squish .45s cubic-bezier(.2,1.4,.4,1) forwards!important}
.stk-hit.popped .sv{display:none}
.stk-hit.popped .blob{opacity:.7}
.stk-hit.heart .sv svg,.stk-hit.flower .sv svg{animation:beat .6s ease-out 2}
.stk-hit.shoe .sv svg{animation:bonk .5s ease-out}
.stk-hit b{position:relative;z-index:1}
@keyframes blobIn{from{transform:scale(.2) rotate(-30deg);opacity:0}}
@keyframes squish{0%{transform:scale(1.3,.7)}100%{transform:translateY(10px) scale(1.45,.5)}}
@keyframes beat{30%{transform:scale(1.25)}60%{transform:scale(.95)}}
@keyframes bonk{0%{transform:rotate(-40deg) scale(1.3)}50%{transform:rotate(18deg)}100%{transform:rotate(0)}}
.tag.tjolt{animation:tJolt .55s ease-out}
@keyframes tJolt{15%{transform:translate(calc(-50% - 6px),-100%) rotate(-7deg)}35%{transform:translate(calc(-50% + 6px),-104%) rotate(6deg)}55%{transform:translate(calc(-50% - 4px),-100%) rotate(-3deg)}75%{transform:translate(calc(-50% + 2px),-100%)}100%{transform:translate(-50%,-100%)}}
@media (max-width:700px){#quickWrap{left:max(10px,env(safe-area-inset-left))}}
#quickWrap.open #quick > *{min-width:0;max-width:100%}
#tease.below{transform:translate(-50%,0)}#tease.below.show{animation:none}

/* màn setup "pro": xem engine/setup.css (setup.js tự nạp) */

/* chống zoom trên điện thoại: chạm đúp không phóng to, ô nhập ≥16px để iOS không tự zoom khi gõ */
html{touch-action:manipulation;-webkit-text-size-adjust:100%;text-size-adjust:100%}
@media (pointer:coarse){input,select,textarea{font-size:max(16px,1em)!important}}
#setup .seg.sxNum{display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));gap:6px}
#setup .seg.sxNum button{min-width:0;padding-left:0;padding-right:0}
/* menu cài đặt mở: cả thanh trên nổi lên trên mọi thẻ/HUD/cụm mic (modal vẫn ở trên khi menu đóng) */
body:has(#menu.show) #top{z-index:70}
/* điện thoại: khung chat neo phía trên màn hình — bàn phím bật lên không che ô nhập, bảng thao tác ở đáy hiện/ẩn không làm khung nhảy.
   Game có thanh trên cao hơn đặt --chatTop. */
@media (max-width:700px){
  #quickWrap.open #quick{top:var(--chatTop,calc(env(safe-area-inset-top) + 128px))!important;bottom:auto!important;max-height:min(46vh,380px)!important}
}
/* Điện thoại: lời Quản Trò hiện ở đáy thì thẻ vai nhấc lên ngay trên nó, không đè chữ (engine.js đặt --casterLift). */
@media (max-width:700px){
  body:has(#caster.show) #rolecard{bottom:calc(var(--casterLift,0px) + 8px)}
}

/* Ngăn kéo gọn cho điện thoại: Về menu + Trò chuyện vào ☰, hàng trên chỉ còn nút cần bấm nhanh */
.m-only{display:none}
@media (max-width:560px){
  #top #bHome,#top #bLog{display:none}
  #menu .mi.m-only{display:flex}
  #bMenu svg.m-only{display:block}#bMenu svg:not(.m-only){display:none}
}
