/* qt-games.css — bộ trò Quán Trà (G4-T6): Nối từ (bảng gỗ chuỗi chữ chạy), Xin xăm (ống lắc + que rơi + lá xăm), Đôi bạn hợp tuổi
   (2 avatar + điểm + nhãn mềm), Rương trà (rương mở + quà trang trí), Tiệc sinh nhật (bánh kem + nến + bong bóng chúc + vai + dzô).
   Đi với /sdk/qt-games.js. Khung 1080×1920: khối dùng VÙNG TRẦN (y 100 →) + cột thẻ, đáy ≤ y 980 — bàn thầy / cô chủ quán luôn lộ.
   Chữ chính ≥ 40 px, nhãn phụ ≥ 30 px; màu CHỈ qua token (theme đổi ở :root). Thẻ phòng đang mở (.qt-busy) → thu gọn thành dải;
   lớp đố đang chạy (.class-on) → khối xuống đáy cột thẻ dạng dải; cả hai → ẩn. Mọi chữ server vào DOM bằng textContent (JS). */
:root {
  --qtg-top: var(--qt-ceiling-top, 100px);
  --qtg-bottom: var(--qt-corner-bottom, 940px);
  --qtg-side: var(--cards-side, 100px);
  --qtg-wood: var(--qt-wood, #5A3A22);
  --qtg-wood-2: var(--qt-wood-2, #7A5233);
  --qtg-wood-edge: var(--qt-wood-edge, #C9955A);
  --qtg-paper: var(--qt-paper, #F6EEDC);
  --qtg-paper-2: var(--qt-paper-2, #EFE3C8);
  --qtg-paper-3: var(--qt-paper-3, #EADCC0);
  --qtg-ink: var(--qt-ink, #2B2118);
  --qtg-ink-2: var(--qt-ink-2, #5A4A3A);
  --qtg-ink-3: var(--qt-ink-3, #8A7764);
  --qtg-cream: var(--qt-cream, #FFF6E2);
  --qtg-cream-2: rgba(255, 246, 226, .78);
  --qtg-cream-3: rgba(255, 246, 226, .55);
  --qtg-jade: var(--qt-jade, #2F7D6D);
  --qtg-jade-2: var(--qt-jade-2, #CFE5DD);
  --qtg-amber: var(--qt-amber, #E3B23C);
  --qtg-amber-ink: var(--qt-amber-ink, #9A6A0B);
  --qtg-amber-soft: rgba(227, 178, 60, .24);
  --qtg-rose: #D8707A;                 /* hồng đào (dây tơ của thẻ duyên) — chỉ trang trí nhẹ */
  --qtg-low: #FF6B6B;                  /* ≤ 5 s */
  --qtg-flame: #FFD75E;
  --qtg-shade: rgba(20, 12, 4, .55);
  --qtg-font: var(--cards-font, 'Be Vietnam Pro', system-ui, sans-serif);
  --qtg-font-serif: var(--qt-font-serif, 'Lora', Georgia, serif);
  --qtg-font-num: var(--cards-font-num, 'JetBrains Mono', ui-monospace, monospace);
  --qtg-radius: 22px;
}

/* ---------- gốc: cột giữa trong vùng an toàn, trần y 100 → đáy ≤ y 980 ---------- */
.qtg-root { position: absolute; left: var(--qtg-side); right: var(--qtg-side); top: var(--qtg-top); z-index: 29; display: none; flex-direction: column; gap: 14px;
  font-family: var(--qtg-font); color: var(--qtg-ink); pointer-events: none; }
.qtg-root.show { display: flex; }
.qtg-root .num { font-family: var(--qtg-font-num); font-variant-numeric: tabular-nums; }
.qtg-root section { display: none; }
.qtg-root section.show { display: flex; }

/* ---------- khung chung: bảng gỗ (Nối từ) & giấy dó (khoảnh khắc) ---------- */
.qtg-wood { position: relative; box-sizing: border-box; padding: 14px 28px 14px; border-radius: var(--qtg-radius); flex-direction: column; gap: 10px;
  color: var(--qtg-cream); text-shadow: 0 2px 4px rgba(0, 0, 0, .55);
  background: linear-gradient(180deg, var(--qtg-wood-2), var(--qtg-wood)); border: 3px solid var(--qtg-wood-edge);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 255, 255, .12), inset 0 -3px 0 rgba(0, 0, 0, .25);
  animation: qtgIn .5s cubic-bezier(.2, 1.1, .4, 1) both; }
/* dây treo lên trần như bảng gỗ của theme (vùng y 0–100, UI TikTok chỉ đè 2 góc) */
.qtg-wood::before, .qtg-wood::after { content: ''; position: absolute; top: calc(-1 * var(--qtg-top) - 3px); width: 6px; height: var(--qtg-top); background: var(--qtg-wood-edge); box-shadow: 0 0 6px rgba(0, 0, 0, .4); }
.qtg-wood::before { left: 110px; }
.qtg-wood::after { right: 110px; }
.qtg-paper { position: relative; box-sizing: border-box; padding: 16px 30px 12px; border-radius: var(--qtg-radius); flex-direction: column; gap: 10px;
  color: var(--qtg-ink); background: linear-gradient(180deg, var(--qtg-paper), var(--qtg-paper-2)); border: 3px solid rgba(47, 125, 109, .45);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55), inset 0 0 0 10px var(--qtg-amber-soft); animation: qtgIn .45s cubic-bezier(.2, 1.2, .4, 1) both; }
.qtg-paper::before, .qtg-paper::after { content: '❀'; position: absolute; top: 8px; font-size: 30px; color: var(--qtg-amber-ink); opacity: .55; }
.qtg-paper::before { left: 14px; }
.qtg-paper::after { right: 14px; }
@keyframes qtgIn { from { opacity: 0; transform: translateY(-24px); } to { opacity: 1; transform: none; } }

.qtg-head { display: flex; align-items: center; gap: 14px; min-height: 56px; }
.qtg-title { flex: 1; min-width: 0; font: 700 44px/1.15 var(--qtg-font-serif); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } /* tên trò: 2 dòng nếu chật, không "…" */
.qtg-paper .qtg-title { color: var(--qtg-jade); }
.qtg-title small { font: 600 30px/1 var(--qtg-font); margin-left: 10px; opacity: .8; }
.qtg-pill { flex: none; display: inline-flex; align-items: baseline; gap: 8px; font: 800 40px/1 var(--qtg-font-num); font-variant-numeric: tabular-nums; padding: 6px 16px; border-radius: 999px;
  background: rgba(0, 0, 0, .28); border: 2px solid var(--qtg-cream-3); white-space: nowrap; }
.qtg-pill small { font: 600 30px/1 var(--qtg-font); opacity: .85; }
.qtg-pill.amber { color: var(--qtg-ink); background: var(--qtg-amber); border-color: var(--qtg-amber); text-shadow: none; }
.qtg-paper .qtg-pill { color: var(--qtg-ink); background: rgba(255, 255, 255, .6); border-color: var(--qtg-paper-3); text-shadow: none; }
.qtg-clock { flex: none; min-width: 108px; text-align: center; font: 800 48px/1 var(--qtg-font-num); font-variant-numeric: tabular-nums; padding: 6px 10px; border-radius: 16px; background: rgba(0, 0, 0, .28); border: 2px solid var(--qtg-cream-3); }
.qtg-paper .qtg-clock { color: var(--qtg-jade); background: rgba(255, 255, 255, .6); border-color: var(--qtg-paper-3); }
.qtg-clock.low { color: var(--qtg-low); border-color: var(--qtg-low); animation: qtgPulse .6s ease-in-out infinite; }
.qtg-clock:empty { display: none; }
@keyframes qtgPulse { 50% { transform: scale(1.06); } }
.qtg-foot { margin: 0; font: 500 30px/1.3 var(--qtg-font); text-align: center; color: var(--qtg-cream-2); }
.qtg-paper .qtg-foot { color: var(--qtg-ink-3); border-top: 1px dashed rgba(90, 74, 58, .35); padding-top: 8px; }
.qtg-hint { margin: 0; font: 600 34px/1.3 var(--qtg-font); color: var(--qtg-cream-2); text-align: center; }
.qtg-hint b { color: var(--qtg-ink); background: var(--qtg-amber); border-radius: 12px; padding: 1px 14px; text-shadow: none; font-weight: 800; }
.qtg-paper .qtg-hint { color: var(--qtg-ink-2); }
.qtg-paper .qtg-hint b { color: var(--qtg-jade); background: var(--qtg-jade-2); }
.qtg-msg { margin: 0; font: 600 34px/1.25 var(--qtg-font); color: var(--qtg-cream); text-align: center; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qtg-msg:empty { display: none; }
.qtg-msg.on { animation: qtgRow .4s ease-out both; }
.qtg-msg b { color: var(--qtg-amber); }
.qtg-paper .qtg-msg b { color: var(--qtg-jade); }
@keyframes qtgRow { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
/* avatar: ảnh vẽ sẵn của theme / ảnh TikTok qua proxy (Cards.helpers.avatar) hoặc chữ cái đầu */
.qtg-root .cards-av, .qtg-root .av { flex: none; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; border: 3px solid var(--qtg-amber); background: var(--qtg-jade); color: var(--qtg-cream); display: grid; place-items: center; font: 800 30px/1 var(--qtg-font); text-shadow: none; }
.qtg-root .cards-av img, .qtg-root .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qtg-root .cards-av.cards-av-art { border-color: transparent; background: transparent; }
.qtg-who { display: flex; align-items: center; gap: 12px; min-width: 0; font: 600 36px/1.2 var(--qtg-font); }
.qtg-who .nm { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } /* "Tên · vừa nối …" có câu → 2 dòng, không "…" */
.qtg-who .nm b { color: var(--qtg-amber); }
.qtg-paper .qtg-who .nm b { color: var(--qtg-jade); }

/* ---------- NỐI TỪ: bảng gỗ — đầu bảng (tên trò · chuỗi · bí · đồng hồ), dải chữ chạy, từ hiện tại + tiếng nối tiếp, ai vừa nối, ghi công ---------- */
.qtg-noitu .qtg-title::before { content: '🔗 '; }
.qtg-bi { flex: none; font: 700 30px/1 var(--qtg-font); color: var(--qtg-cream); border: 2px dashed var(--qtg-amber); border-radius: 999px; padding: 6px 14px; white-space: nowrap; }
.qtg-bi:empty { display: none; }
/* dải chữ chạy: các từ đã nối xếp ngang, mới nhất bên phải, cũ trôi dần khỏi mép trái (overflow) */
.qtg-ribbon { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 64px; overflow: hidden; padding: 4px 0; mask-image: linear-gradient(90deg, transparent, rgba(0, 0, 0, 1) 90px); -webkit-mask-image: linear-gradient(90deg, transparent, rgba(0, 0, 0, 1) 90px); }
.qtg-chip { flex: none; display: inline-block; font: 700 36px/1.15 var(--qtg-font); color: var(--qtg-cream-2); background: rgba(0, 0, 0, .25); border-radius: 14px; padding: 6px 16px; white-space: nowrap; text-shadow: none; }
.qtg-chip .tl { color: var(--qtg-amber); }
.qtg-chip.brk { color: var(--qtg-cream-3); border: 2px dashed var(--qtg-cream-3); background: none; font-weight: 600; font-size: 30px; padding: 4px 12px; }
.qtg-chip.new { animation: qtgChip .5s cubic-bezier(.2, 1.2, .4, 1) both; }
.qtg-arrow { flex: none; font: 700 30px/1 var(--qtg-font); color: var(--qtg-cream-3); }
@keyframes qtgChip { from { opacity: 0; transform: translateX(40px) scale(.8); } to { opacity: 1; transform: none; } }
/* từ hiện tại TO + tiếng phải nối tiếp (ô hổ phách) */
.qtg-now { display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap; min-height: 96px; }
.qtg-word { font: 800 64px/1.1 var(--qtg-font-serif); color: var(--qtg-cream); letter-spacing: .5px; white-space: nowrap; }
.qtg-word .tl { color: var(--qtg-amber); text-decoration: underline; text-decoration-thickness: 5px; text-underline-offset: 8px; }
.qtg-next { display: inline-flex; align-items: center; gap: 12px; font: 600 34px/1.1 var(--qtg-font); color: var(--qtg-cream-2); white-space: nowrap; }
.qtg-next b { font: 800 60px/1.05 var(--qtg-font-serif); color: var(--qtg-ink); background: var(--qtg-amber); border-radius: 16px; padding: 2px 22px; text-shadow: none; box-shadow: 0 6px 0 rgba(0, 0, 0, .3); animation: qtgGlow 1.6s ease-in-out infinite; }
@keyframes qtgGlow { 0%, 100% { box-shadow: 0 6px 0 rgba(0, 0, 0, .3), 0 0 0 rgba(227, 178, 60, 0); } 50% { box-shadow: 0 6px 0 rgba(0, 0, 0, .3), 0 0 36px rgba(227, 178, 60, .55); } }
.qtg-last { justify-content: center; min-height: 56px; }
.qtg-last .co { color: var(--qtg-amber); font-weight: 700; }
.qtg-credit { margin: 0; font: 500 30px/1.3 var(--qtg-font); color: var(--qtg-cream-2); text-align: center; }
/* kết thúc: chuỗi dài nhất + Top 5 người nối nhiều nhất */
.qtg-end { display: flex; flex-direction: column; gap: 8px; }
.qtg-best { display: flex; align-items: baseline; justify-content: center; gap: 14px; font: 600 36px/1.2 var(--qtg-font); color: var(--qtg-cream-2); }
.qtg-best b { font: 800 72px/1 var(--qtg-font-num); color: var(--qtg-amber); font-variant-numeric: tabular-nums; text-shadow: 0 2px 4px rgba(0, 0, 0, .55); }
.qtg-top { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.qtg-row { display: flex; align-items: center; gap: 12px; min-height: 52px; font: 600 36px/1.2 var(--qtg-font); border-bottom: 1px dashed var(--qtg-cream-3); padding: 2px 8px; margin: 0 -8px; border-radius: 10px; animation: qtgRow .45s cubic-bezier(.2, 1.2, .4, 1) both; }
.qtg-row:nth-child(even) { background: rgba(0, 0, 0, .14); } /* hàng xen màu nền nhạt (ab 11/11) */
.qtg-row:last-child { border-bottom: 0; }
.qtg-row .rank { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .12); font: 800 30px/1 var(--qtg-font-num); }
.qtg-row:first-child .rank { color: var(--qtg-ink); background: var(--qtg-amber); text-shadow: none; }
/* tên: cột có chỗ tối thiểu, JS rút gọn "tên gọi + chữ cái đầu" (name(u, 16)) nên không tới "…" (ellipsis = lưới an toàn cho nick 1 từ) */
.qtg-row .nm { flex: 1; min-width: 6ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* số: chữ kem, CHỈ hạng 1 hổ phách (ab 11/11: màu nhấn không tô cả cột) */
.qtg-row .val { flex: none; font: 800 36px/1 var(--qtg-font-num); color: var(--qtg-cream); font-variant-numeric: tabular-nums; }
.qtg-row:first-child .val { color: var(--qtg-amber); }
.qtg-row.empty { color: var(--qtg-cream-3); font-size: 34px; justify-content: center; }
.qtg-paper .qtg-row { border-bottom-color: rgba(90, 74, 58, .25); }
.qtg-paper .qtg-row:nth-child(even) { background: rgba(43, 33, 24, .06); }
.qtg-paper .qtg-row .rank { background: var(--qtg-paper-3); color: var(--qtg-ink); }
.qtg-paper .qtg-row:first-child .rank { background: var(--qtg-jade); color: var(--qtg-cream); }
.qtg-paper .qtg-row .val { color: var(--qtg-ink); }
.qtg-paper .qtg-row:first-child .val { color: var(--qtg-amber-ink); }

/* ---------- khoảnh khắc (giấy dó): xăm · đôi bạn hợp tuổi · rương · tiệc — bố cục 2 cột: đạo cụ trái, chữ phải ---------- */
.qtg-two { display: flex; align-items: center; gap: 26px; }
.qtg-prop { flex: none; width: 250px; height: 250px; display: grid; place-items: center; position: relative; }
.qtg-prop img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .35)); }
.qtg-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.qtg-line { margin: 0; font: 600 36px/1.3 var(--qtg-font); color: var(--qtg-ink-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qtg-line b { color: var(--qtg-jade); }
.qtg-root .qtg-line.num { font-family: var(--qtg-font); } /* chỉ con số mono, chữ thường giữ font chữ */
.qtg-line.num b { font-family: var(--qtg-font-num); font-variant-numeric: tabular-nums; }

/* xin xăm: ống lắc (transform-origin đáy), que rơi ra khi có người rút; danh sách 3 lá vừa rút kiểu kêu số */
.qtg-xam .qtg-title::before { content: '🎋 '; }
.qtg-tube { transform-origin: 50% 92%; width: 180px; height: 230px; }
.qtg-xam.open .qtg-tube { animation: qtgShake .9s ease-in-out infinite; }
@keyframes qtgShake { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
.qtg-stick { position: absolute; left: 62%; top: 10px; width: 70px; height: 170px; opacity: 0; transform-origin: 50% 0; }
.qtg-stick.drop { animation: qtgDrop 1s cubic-bezier(.3, .8, .3, 1) both; }
@keyframes qtgDrop { 0% { opacity: 0; transform: translateY(-40px) rotate(-8deg); } 20% { opacity: 1; } 100% { opacity: 1; transform: translate(70px, 120px) rotate(28deg); } }
.qtg-recent { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; min-height: 44px; }
.qtg-recent li { display: flex; align-items: center; gap: 10px; min-width: 0; font: 600 32px/1.2 var(--qtg-font); color: var(--qtg-ink-2); animation: qtgRow .4s ease-out both; }
.qtg-recent li .cards-av, .qtg-recent li .av { width: 40px; height: 40px; font-size: 30px; border-width: 2px; }
.qtg-recent li .nm { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--qtg-ink); } /* "Tên · tên lá xăm" → 2 dòng, không "…" */
.qtg-recent li .so { flex: none; font: 800 32px/1 var(--qtg-font-num); color: var(--qtg-amber-ink); font-variant-numeric: tabular-nums; }
/* lá xăm (đóng ống): số lá + bậc mềm (Thượng ngọc · Trung hổ phách · Hạ trung tính, KHÔNG đỏ) + tên lá + 2 câu + lời nhắn nhẹ + ai rút */
.qtg-la { display: flex; flex-direction: column; gap: 10px; }
.qtg-la-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.qtg-la-so { font: 800 48px/1 var(--qtg-font-num); color: var(--qtg-ink); font-variant-numeric: tabular-nums; }
.qtg-la-so small { font: 600 32px/1 var(--qtg-font); color: var(--qtg-ink-3); margin-right: 8px; }
.qtg-bac { display: inline-block; font: 700 32px/1.2 var(--qtg-font); border-radius: 999px; padding: 3px 16px; white-space: nowrap; color: var(--qtg-ink-2); background: var(--qtg-paper-3); }
.qtg-bac.thuong { color: var(--qtg-jade); background: var(--qtg-jade-2); }
.qtg-bac.trung { color: var(--qtg-amber-ink); background: var(--qtg-amber-soft); }
.qtg-la-ten { margin: 0; font: 700 52px/1.1 var(--qtg-font-serif); color: var(--qtg-jade); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qtg-loi { margin: 0; font: 500 italic 38px/1.35 var(--qtg-font-serif); color: var(--qtg-ink); border-left: 5px solid var(--qtg-amber); padding-left: 16px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qtg-khuyen { margin: 0; font: 500 34px/1.3 var(--qtg-font); color: var(--qtg-ink); background: rgba(255, 255, 255, .5); border-radius: 14px; padding: 8px 16px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qtg-khuyen i { font: 700 30px/1 var(--qtg-font); font-style: normal; color: var(--qtg-amber-ink); margin-right: 10px; }
.qtg-also { margin: 0; font: 600 32px/1.3 var(--qtg-font); color: var(--qtg-ink-3); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qtg-also b { color: var(--qtg-ink-2); }

/* đôi bạn hợp tuổi: cặp đầu to (2 avatar 120 + điểm 72), cặp sau 1 hàng; dây nối hoa ❀ (không trái tim) */
.qtg-couple .qtg-title::before { content: '🍵 '; }
.qtg-pairs { display: flex; flex-direction: column; gap: 10px; }
.qtg-pair { display: grid; grid-template-columns: 1fr 260px 1fr; align-items: center; gap: 0 10px; min-width: 0; animation: qtgRow .45s cubic-bezier(.2, 1.2, .4, 1) both; }
.qtg-pair .p { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.qtg-pair .p .nm { max-width: 100%; font: 700 36px/1.15 var(--qtg-font); color: var(--qtg-ink); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qtg-pair.lead .cards-av, .qtg-pair.lead .av { width: 120px; height: 120px; font-size: 56px; border-width: 4px; }
.qtg-pair .mid { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding-top: 6px; }
.qtg-pair .thread { position: absolute; left: -14px; right: -14px; top: 50px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--qtg-amber), var(--qtg-jade) 50%, var(--qtg-amber)); opacity: .8; }
.qtg-pair .thread::before, .qtg-pair .thread::after { content: '❀'; position: absolute; top: -22px; font-size: 30px; color: var(--qtg-amber-ink); }
.qtg-pair .thread::before { left: 0; }
.qtg-pair .thread::after { right: 0; }
.qtg-score { position: relative; z-index: 1; display: inline-flex; align-items: baseline; gap: 4px; font: 800 72px/1 var(--qtg-font-num); color: var(--qtg-jade); font-variant-numeric: tabular-nums; background: var(--qtg-paper); padding: 0 14px; border-radius: 999px; }
.qtg-score small { font: 600 32px/1 var(--qtg-font); color: var(--qtg-ink-3); }
.qtg-score.vua { color: var(--qtg-amber-ink); }
.qtg-score.thap { color: var(--qtg-ink-2); }
.qtg-label { font: 700 32px/1.15 var(--qtg-font); color: var(--qtg-jade); background: var(--qtg-jade-2); border-radius: 999px; padding: 3px 16px; white-space: normal; text-align: center; text-wrap: balance; max-width: 250px; }
.qtg-label.vua { color: var(--qtg-amber-ink); background: var(--qtg-amber-soft); }
.qtg-label.thap { color: var(--qtg-ink-2); background: var(--qtg-paper-3); }
/* cặp 2–3: một hàng — [ảnh A tên A] · điểm + nhãn (giữa, không co) · [tên B ảnh B]; tên dài xuống 2 dòng, không cắt */
.qtg-pair:not(.lead) { display: flex; align-items: center; gap: 12px; }
.qtg-pair:not(.lead) .p { flex: 1; flex-direction: row; justify-content: flex-start; gap: 10px; }
.qtg-pair:not(.lead) .p:last-child { flex-direction: row-reverse; }
.qtg-pair:not(.lead) .p .nm { font-size: 32px; white-space: normal; text-align: left; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qtg-pair:not(.lead) .p:last-child .nm { text-align: right; }
.qtg-pair:not(.lead) .qtg-score { font-size: 44px; padding: 0 6px; }
.qtg-pair:not(.lead) .thread { display: none; }
.qtg-pair:not(.lead) .mid { flex: none; flex-direction: row; gap: 8px; padding-top: 0; }
.qtg-pair:not(.lead) .qtg-label { font-size: 30px; max-width: none; white-space: nowrap; }

/* rương trà: rương mở (nhún + quầng sáng), phần thưởng trang trí to, ai nhận */
.qtg-chest .qtg-title::before { content: '🧰 '; }
.qtg-box { transform-origin: 50% 90%; }
.qtg-chest.open .qtg-box { animation: qtgBox 1.1s cubic-bezier(.2, 1.2, .4, 1) both; }
.qtg-chest.open .qtg-prop::before { content: ''; position: absolute; inset: 10%; border-radius: 50%; background: radial-gradient(closest-side, var(--qtg-flame), transparent 72%); opacity: 0; animation: qtgGlowUp 1.4s ease-out .3s both; z-index: -1; }
@keyframes qtgBox { 0% { transform: scale(.7) rotate(-6deg); } 50% { transform: scale(1.08) rotate(3deg); } 100% { transform: none; } }
@keyframes qtgGlowUp { 0% { opacity: 0; transform: scale(.4); } 40% { opacity: .85; } 100% { opacity: .5; transform: scale(1.1); } }
.qtg-reward { margin: 0; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.qtg-reward b { font: 800 56px/1.1 var(--qtg-font-serif); color: var(--qtg-jade); }
.qtg-reward small { font: 700 30px/1.2 var(--qtg-font); color: var(--qtg-amber-ink); background: var(--qtg-amber-soft); border-radius: 999px; padding: 3px 14px; white-space: nowrap; }
.qtg-names { margin: 0; font: 600 34px/1.3 var(--qtg-font); color: var(--qtg-ink-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.qtg-names b { color: var(--qtg-ink); }

/* tiệc sinh nhật: bánh kem + 3 ngọn nến lung linh (CSS), vai tình nguyện, bong bóng chúc, dzô cả bàn */
.qtg-party .qtg-title::before { content: '🎂 '; }
.qtg-cake { position: relative; }
.qtg-cake .flame { position: absolute; top: 12%; width: 18px; height: 30px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 1) 0 20%, var(--qtg-flame) 45%, var(--qtg-amber) 70%, transparent 72%); filter: drop-shadow(0 0 10px var(--qtg-flame)); transform-origin: 50% 100%; animation: qtgFlame .7s ease-in-out infinite alternate; }
.qtg-cake .flame:nth-child(2) { left: 36%; } .qtg-cake .flame:nth-child(3) { left: 47%; animation-delay: .2s; top: 8%; } .qtg-cake .flame:nth-child(4) { left: 58%; animation-delay: .4s; }
@keyframes qtgFlame { from { transform: scaleY(.85) rotate(-4deg); opacity: .85; } to { transform: scaleY(1.1) rotate(4deg); opacity: 1; } }
.qtg-party .qtg-prop { width: 220px; height: 220px; }
/* 4 vai tình nguyện một hàng, mỗi ô 2 dòng: vai · người nhận (hoặc lệnh để nhận) — không cắt chữ */
.qtg-roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qtg-role { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 84px; box-sizing: border-box; padding: 6px 8px; border-radius: 14px; background: rgba(255, 255, 255, .55); border: 2px solid var(--qtg-paper-3); color: var(--qtg-ink-3); text-align: center; }
.qtg-role i { font-style: normal; font-size: 30px; margin-right: 6px; }
.qtg-role .rl { font: 700 30px/1.2 var(--qtg-font); color: var(--qtg-ink-2); white-space: nowrap; }
.qtg-role .rv { max-width: 100%; font: 600 30px/1.2 var(--qtg-font); white-space: nowrap; overflow: hidden; }
.qtg-role.on { border-color: var(--qtg-jade); background: var(--qtg-jade-2); }
.qtg-role.on .rl { color: var(--qtg-jade); }
.qtg-role.on b { color: var(--qtg-ink); font-weight: 800; }
/* bong bóng chúc: 1 cột, tên + lời cùng dòng (≤ 60 ký tự → ≤ 2 dòng ở 32 px trên 820 px), tối đa 3 bong bóng */
.qtg-wishes { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.qtg-wishes:empty { display: none; }
.qtg-wish { position: relative; box-sizing: border-box; padding: 6px 18px; border-radius: 18px 18px 18px 4px; background: rgba(255, 255, 255, .78); border: 2px solid rgba(47, 125, 109, .35); font: 500 32px/1.3 var(--qtg-font); color: var(--qtg-ink); min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; animation: qtgWish .5s cubic-bezier(.2, 1.2, .4, 1) both; }
.qtg-wish b { font: 700 32px/1.3 var(--qtg-font); color: var(--qtg-jade); }
.qtg-wish.out { animation: qtgWishOut .4s ease-in forwards; }
@keyframes qtgWish { from { opacity: 0; transform: translateY(18px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes qtgWishOut { to { opacity: 0; transform: translateY(-18px); } }
/* dzô cả bàn: băng rôn hổ phách thoáng 4,5 s dưới khối (hoặc đứng một mình) */
.qtg-dzo { display: none; align-self: center; align-items: center; gap: 14px; font: 800 44px/1.1 var(--qtg-font); color: var(--qtg-ink); background: var(--qtg-amber); border-radius: 999px; padding: 8px 30px; box-shadow: 0 10px 24px var(--qtg-shade); white-space: nowrap; }
.qtg-dzo.show { display: inline-flex; animation: qtgDzo .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.qtg-dzo small { font: 600 32px/1 var(--qtg-font); color: var(--qtg-ink-2); }
@keyframes qtgDzo { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
/* cả bàn nâng ly: ghế (seats.js) nhún lên theo đợt — gắn class lên .kit-seats, không sửa seats.js */
.kit-seats.qtg-cheer .guest:not(.zzz):not(.out) .sp { animation: qtgRaise .9s ease-out both; }
.kit-seats.qtg-cheer .guest:nth-child(odd) .sp { animation-delay: .12s; }
.kit-seats.qtg-cheer .guest:nth-child(3n) .sp { animation-delay: .24s; }
@keyframes qtgRaise { 0% { transform: none; } 35% { transform: translateY(-14px) rotate(-5deg); } 70% { transform: translateY(-6px) rotate(4deg); } 100% { transform: none; } }

/* Nối từ + khoảnh khắc (xăm / rương…) cùng hiện: bảng Nối từ bỏ hàng "ai vừa nối" + dòng mời để cả cột ≤ y 980 */
.qtg-root.has-moment .qtg-last, .qtg-root.has-moment .qtg-hint, .qtg-root.has-moment .qtg-msg { display: none; }
.qtg-root.has-moment .qtg-wood { gap: 8px; }
/* ---------- thẻ / đố của phòng đang mở (.qt-busy): khối thu gọn thành dải trên trần — chỉ đầu bảng + từ hiện tại / dòng chính + ghi công ---------- */
.qt-busy .qtg-ribbon, .qt-busy .qtg-last, .qt-busy .qtg-hint, .qt-busy .qtg-msg, .qt-busy .qtg-prop, .qt-busy .qtg-recent, .qt-busy .qtg-loi, .qt-busy .qtg-khuyen, .qt-busy .qtg-also,
.qt-busy .qtg-roles, .qt-busy .qtg-wishes, .qt-busy .qtg-pair:not(.lead) .p .nm, .qt-busy .qtg-top, .qt-busy .qtg-names, .qt-busy .qtg-foot { display: none; }
.qt-busy .qtg-wood, .qt-busy .qtg-paper { gap: 6px; padding-top: 10px; padding-bottom: 10px; }
.qt-busy .qtg-now { min-height: 64px; gap: 16px; }
.qt-busy .qtg-word { font-size: 44px; }
.qt-busy .qtg-next b { font-size: 44px; animation: none; }
.qt-busy .qtg-pair.lead { grid-template-columns: 1fr 200px 1fr; }
.qt-busy .qtg-pair.lead .cards-av, .qt-busy .qtg-pair.lead .av { width: 56px; height: 56px; font-size: 30px; }
.qt-busy .qtg-pair.lead .qtg-score { font-size: 44px; }
.qt-busy .qtg-pair:not(.lead) { display: none; }
.qt-busy .qtg-la-ten { font-size: 40px; -webkit-line-clamp: 1; }
.qt-busy .qtg-best b { font-size: 48px; }
/* lớp đố đang chạy (.class-on: bảng đen chiếm trần y 110–~790) → khối xuống đáy cột thẻ (đáy y 980) dạng dải; thẻ cũng mở → nhường hẳn */
.class-on .qtg-root { top: auto; bottom: var(--qtg-bottom); }
.class-on .qtg-wood::before, .class-on .qtg-wood::after { display: none; }
.class-on .qtg-ribbon, .class-on .qtg-last, .class-on .qtg-hint, .class-on .qtg-prop, .class-on .qtg-recent, .class-on .qtg-loi, .class-on .qtg-khuyen, .class-on .qtg-also,
.class-on .qtg-roles, .class-on .qtg-wishes, .class-on .qtg-top, .class-on .qtg-names, .class-on .qtg-foot, .class-on .qtg-pair:not(.lead) { display: none; }
.class-on .qtg-wood, .class-on .qtg-paper { gap: 6px; padding-top: 10px; padding-bottom: 10px; }
.class-on .qtg-now { min-height: 64px; gap: 16px; }
.class-on .qtg-word { font-size: 44px; }
.class-on .qtg-next b { font-size: 44px; animation: none; }
.class-on .qtg-msg { display: none; }
.class-on.qt-busy .qtg-root { display: none; }

@media (prefers-reduced-motion: reduce) {
  .qtg-wood, .qtg-paper, .qtg-chip.new, .qtg-row, .qtg-pair, .qtg-msg, .qtg-recent li, .qtg-wish, .qtg-dzo.show, .qtg-clock.low, .qtg-next b,
  .qtg-xam.open .qtg-tube, .qtg-stick.drop, .qtg-chest.open .qtg-box, .qtg-chest.open .qtg-prop::before, .qtg-cake .flame, .kit-seats.qtg-cheer .guest .sp { animation: none !important; }
  .qtg-stick.drop { opacity: 1; transform: translate(70px, 120px) rotate(28deg); }
  .qtg-chest.open .qtg-prop::before { opacity: .5; }
}
