/* cards-hh.css — Quán Trà Huyền Học: token giấy dó + kiểu 9 loại thẻ (cards-hh.js), dải lịch, khối bài học/hướng dẫn, dòng mời,
   bảng/ticker/mục tiêu theo sự kiện (theme.js). Đi cùng /sdk/cards.css: thẻ + đố vui + bảng ở ô giữa đổi sang giấy sáng, toast giữ nền tối.
   Renderer CHỈ dùng class ở đây (không hardcode màu). L1 (owner 10/11): chữ khối chính ≥ 40 px, chữ trong thẻ ≥ 30 px, miễn trừ 30 px.
   Khung 1080×1920, vùng an toàn Kit.safe. */
:root {
  /* bảng màu quán trà (mockup/quan-tra.html — owner duyệt) */
  --qt-paper: #F6EEDC;
  --qt-paper-2: #EFE3C8;
  --qt-paper-3: #EADCC0;
  --qt-ink: #2B2118;
  --qt-ink-2: #5A4A3A;
  --qt-ink-3: #8A7764;
  --qt-jade: #2F7D6D;
  --qt-jade-2: #CFE5DD;
  --qt-amber: #E3B23C;
  --qt-amber-ink: #9A6A0B;
  --qt-red: #B23A2E;
  --qt-red-2: #F3D9D4;
  /* [Q8-6e] tone "cần lưu ý / chưa hợp" = nâu đất ấm (huy hiệu Lưu ý, chip/dấu chưa khớp) — KHÔNG đỏ gắt */
  --qt-earth: #8B5E3C;
  --qt-earth-ink: #6B4528;
  --qt-earth-2: rgba(139, 94, 60, .16);
  --qt-shade: rgba(20, 12, 4, .55);
  --qt-cream: #FFF6E2;
  --qt-font-serif: 'Lora', Georgia, serif;
  /* vị trí riêng của theme (số px trong khung 1080×1920) — vùng theo mockup/quan-tra.html (owner duyệt), dưới dải TikTok y 240.
     L1 gọn màn: lúc VẮNG thẻ chỉ 3 khối chữ (dải lịch · khối nội dung · dòng mời); CÓ thẻ chỉ thẻ; bảng / "Cảm ơn" / "Tim" theo sự kiện.
       y 250–370  DẢI LỊCH 1 khối: số ngày + "Thứ ba, 11/11 · Âm 2/10" + câu đời thường (doiThuong ⇄ gioDep xoay 8 s)
       y 400–520  LÀN THÔNG BÁO: mỗi lúc CHỈ MỘT thứ — toast người xem (≤ 2, gộp) > băng rôn kit (danh hiệu/mục tiêu/lời mời)
                  > thẻ cảm ơn quà của kit (thu gọn) > câu nhắc định kỳ (theme.js gắn class qt-lane-* lên #stage)
       y ≤ 1200   Ô GIỮA mọc lên từ đáy: đố + thẻ (đáy 1200; thẻ người xem > đố: cả hai cùng hiện thì đố thu gọn) — hoặc, khi không có
                  thẻ, KHỐI NỘI DUNG (bài học / hướng dẫn, đáy 1180) → bảng xếp hạng / "Cảm ơn" 6 s theo sự kiện thế chỗ khối nội dung.
                  Cột cao quá y 528 → làn thông báo ẩn (qt-tall-1); quá y 396 → ẩn luôn dải lịch (qt-tall-2).
       y 1188     DÒNG MỜI TO (1 lệnh xoay 5 s), ẩn khi có thẻ · y ~1690 "Tim cho quán" (kit-goal) chỉ hiện 6 s khi có tim */
  /* L1b (owner 11/11, "dùng hẳn trần nhà, lộ cảnh quán"): BẢNG GỖ TREO TRẦN y 100–~335 giữa-trên (UI TikTok chỉ đè 2 góc y 0–90) gom
     dải lịch (2 dòng) + dòng mời TO xoay 5 s + miễn trừ 30 px; dây treo = trang trí trong vùng y 0–100. Giữa màn y 340–1500 lúc rảnh KHÔNG có chữ.
     Làn thông báo (toast/băng rôn/thẻ cảm ơn quà, thoáng qua) y 350–~470 ngay dưới bảng gỗ. */
  --qt-ceiling-top: 100px;
  --qt-lane-top: 350px;
  --kit-guide-top: 360px;    /* bảng "Gõ gì được gì?" theo nhu cầu (Kit.guide) trượt xuống ngay dưới bảng gỗ, 12 s rồi ẩn */
  --qt-wood: #5A3A22;        /* bảng gỗ treo trần (token, không hardcode ngoài :root) */
  --qt-wood-2: #7A5233;
  --qt-wood-edge: #C9955A;
  /* L1c (owner 11/11, "thẻ che hết bàn + thầy"): đáy thẻ / bài học / bảng sự kiện = y 980 (bottom 940) → bàn thầy y ~1000–1250, thầy và
     người hỏi (ghế trước bàn, scene.json life.desk) luôn lộ dưới thẻ. Thẻ dài chia trang tự lật (cards-hh.js .hh-pager) để đỉnh thẻ ≥ ~y 360. */
  --qt-corner-bottom: 940px;   /* đáy bài học / bảng sự kiện / "Cảm ơn" = y 980 */
  /* ô thẻ của cards.js: đáy y 980, toast trong làn thông báo */
  --cards-slot-bottom: 940px;
  --cards-toast-top: var(--qt-lane-top);
}

/* ---------- ô giữa: thẻ + đố vui (+ bảng xếp hạng theo sự kiện) trên giấy dó ---------- */
.cards-slot .cards-panel, .cards-board, .kit-guide {
  --cards-s1: var(--qt-paper-2);
  --cards-s2: var(--qt-paper);
  --cards-s3: var(--qt-paper-3);
  --cards-t1: var(--qt-ink);
  --cards-t2: var(--qt-ink-2);
  --cards-t3: var(--qt-ink-3);
  --cards-accent: var(--qt-jade);
  --cards-on-accent: var(--qt-cream);
  --cards-line: rgba(47, 125, 109, .45);
  --cards-row-alt: rgba(43, 33, 24, .06); /* hàng bảng xen màu nền nhạt (ab 11/11) trên giấy dó */
  border-width: 3px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55), inset 0 0 0 10px rgba(227, 178, 60, .10);
}
.cards-slot .cards-panel::before, .cards-slot .cards-panel::after, .cards-board::before, .cards-board::after { content: "❀"; position: absolute; top: 8px; font-size: 30px; color: var(--qt-amber-ink); opacity: .55; }
.cards-slot .cards-panel::before, .cards-board::before { left: 14px; }
.cards-slot .cards-panel::after, .cards-board::after { right: 14px; }
.cards-slot .cards-panel { position: relative; }
.cards-slot .cards-who-title { color: var(--qt-amber-ink); background: rgba(227, 178, 60, .18); }
.cards-slot .cards-av { border-color: var(--qt-amber); background: var(--qt-jade); color: var(--qt-cream); }
.cards-slot .cards-timer i { background: var(--qt-amber); }
.cards-slot .cards-disc { text-align: center; flex: 1; font-size: 30px; } /* miễn trừ chân thẻ 30 px (L1) */
/* đáp án huyền học là định nghĩa dài (≤ 80 ký tự) → 1 cột, mỗi đáp án tối đa 2 dòng (32 px: 80 ký tự vừa 2 dòng × 760 px, không "…") */
.cards-slot .cards-opts { grid-template-columns: 1fr; gap: 8px; }
.cards-slot .cards-opt { background: rgba(255, 255, 255, .6); border: 2px solid var(--qt-paper-3); min-width: 0; align-items: flex-start; padding: 6px 14px; font-size: 32px; }
.cards-slot .cards-opt span { white-space: normal; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.cards-slot .cards-top li:first-child .cards-rank, .cards-slot .cards-tag, .cards-board li:first-child .cards-rank { color: var(--qt-cream); background: var(--qt-jade); }
.cards-slot .cards-quiz[data-phase="closed"] .cards-tag, .cards-slot .cards-quiz[data-phase="revealed"] .cards-tag { color: var(--qt-jade); background: var(--qt-jade-2); }
.cards-slot .cards-answer { background: var(--qt-jade-2); border-left-color: var(--qt-jade); }
.cards-slot .cards-explain { -webkit-line-clamp: 3; } /* L1c: giải thích đáp án huyền học dài ("Tử Vi đẩu số là môn lập lá số gồm 12 cung…") đủ 3 dòng, không "…" */
/* toast làn thông báo: 40 px, rộng theo làn (880) — không cắt đuôi câu "Lan Anh · đang xếp hàng thứ 2" */
.cards-toast { max-width: 100%; font-size: 40px; padding: 8px 26px; }

/* ---------- khối dùng chung trong thẻ (L1: chữ đọc 36 px, nhãn/chip 30–34 px — thẻ ngắn lại ở L3 thì nâng tiếp) ---------- */
.hh-body { display: flex; flex-direction: column; gap: 10px; color: var(--cards-t1); }
.hh-big { margin: 0; font: 700 64px/1.05 var(--qt-font-serif); color: var(--qt-jade); letter-spacing: .5px; }
.hh-big.sm { font-size: 52px; }
/* [Q8-6] dòng phụ (mệnh · tuổi mụ, nghĩa quẻ, tên lá, môn) là CÂU cho người xem → tối đa 2 dòng, KHÔNG "…" (trước: nowrap + ellipsis) */
.hh-sub { margin: 0; font: 600 30px/1.3 var(--qt-font-serif); color: var(--cards-t2); white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.hh-head { display: flex; align-items: center; gap: 22px; }
.hh-head > div { min-width: 0; flex: 1; }
.hh-icon { width: 112px; height: 112px; flex: none; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .25)); }
.hh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.hh-grid.c3 { grid-template-columns: 1fr 1fr 1fr; gap: 10px 12px; }
.hh-big small { font: 600 32px var(--cards-font); color: var(--cards-t2); }
.hh-note.c1 { -webkit-line-clamp: 1; }
.hh-kv { background: rgba(255, 255, 255, .55); border-radius: 14px; padding: 8px 14px; min-width: 0; }
/* nhãn ô ≤ 16 ký tự ("Cung nhà", "Sao năm nay") và giá trị (tên sao / hạn) — xuống 2 dòng nếu chật, không "…" (ab 11/11 mục 1) */
.hh-kv i { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font: 500 30px/1.2 var(--cards-font); font-style: normal; color: var(--cards-t3); white-space: normal; overflow: hidden; }
.hh-kv b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font: 700 34px/1.3 var(--cards-font); color: var(--cards-t1); overflow: hidden; white-space: normal; }
.hh-chips { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.hh-chip { display: inline-flex; align-items: center; gap: 8px; font: 600 32px/1.2 var(--cards-font); background: var(--qt-paper-3); color: var(--cards-t2); border-radius: 999px; padding: 4px 16px; white-space: nowrap; }
.hh-chip img { width: 36px; height: 36px; object-fit: contain; }
.hh-chip.good { background: var(--qt-jade-2); color: var(--qt-jade); }
.hh-chip.bad { background: var(--qt-earth-2); color: var(--qt-earth-ink); } /* Q8-6e: chưa hợp = nâu đất, không đỏ */
.hh-chip.calm { background: rgba(255, 255, 255, .6); color: var(--cards-t2); }
.hh-quote { margin: 0; font: 500 italic 36px/1.35 var(--qt-font-serif); color: var(--cards-t1); border-left: 5px solid var(--qt-amber); padding-left: 16px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.hh-quote.c2 { -webkit-line-clamp: 2; }
.hh-quote.c4 { -webkit-line-clamp: 4; }
.hh-quote.hh-flow { display: block; -webkit-line-clamp: unset; overflow: visible; } /* bài học: không kẹp dòng (a8) */
.hh-2l { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.hh-note { margin: 0; font: 500 34px/1.35 var(--cards-font); color: var(--cards-t2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.hh-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.hh-list li { display: flex; align-items: flex-start; gap: 12px; font: 600 32px/1.3 var(--cards-font); color: var(--cards-t1); min-width: 0; }
/* L1c: tiêu chí dài ("Mệnh nạp âm: Sơn Đầu Hoả (Hoả) sinh Lộ Bàng Thổ (Thổ)…") xuống 2 dòng, không "…" */
.hh-list li span { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-width: 0; }
.hh-list li .hh-mark { margin-top: 2px; }
.hh-mark { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 800 30px/1 var(--cards-font); color: var(--qt-cream); background: var(--qt-jade); }
.hh-mark.bad { background: var(--qt-earth); }
.hh-tag { display: inline-block; font: 700 32px/1.2 var(--cards-font); color: var(--qt-jade); background: var(--qt-jade-2); border-radius: 999px; padding: 4px 16px; white-space: nowrap; }
.hh-tag.bad { color: var(--qt-earth-ink); background: var(--qt-earth-2); }
.hh-tag.calm { color: var(--cards-t2); background: rgba(255, 255, 255, .6); } /* L3: "Ngày thường" trung tính (không đỏ như "Hắc đạo" cũ) */
.hh-tranh { color: var(--qt-earth-ink); } /* L3 + Q8-6e: dòng ngày nên tránh — nâu đất ấm, không chip đỏ */
.hh-tag.amber { color: var(--qt-amber-ink); background: rgba(227, 178, 60, .22); }
.hh-quote.c5 { -webkit-line-clamp: 5; }
.hh-reveal { opacity: 0; animation: hhFade .5s ease-out forwards; }
@keyframes hhFade { to { opacity: 1; } }
/* lời bình đầy đủ (a4): khối chữ chính trên giấy sáng hơn, viền hổ phách, tối đa 6 dòng (≈ 260 ký tự ở 36 px; dài hơn → L3 viết ngắn lại) */
.hh-binh { margin: 0; font: 500 36px/1.35 var(--qt-font-serif); color: var(--cards-t1); background: rgba(255, 255, 255, .45);
  border-left: 5px solid var(--qt-amber); border-radius: 0 14px 14px 0; padding: 8px 16px 0 18px;
  border-bottom: 8px solid transparent; /* thay padding dưới: overflow cắt ở mép padding nên dòng bị kẹp từng ló nửa chữ ở đáy */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; }
.hh-binh.c3 { -webkit-line-clamp: 3; }
/* [Q8 gác UI mục 6 — owner 11/11 "☕ Lưu ý Cần lưu ý năm Bính Ngọ…" lem 4 dòng] câu lưu ý trong lời bình = KHỐI RIÊNG, KHÔNG tô nền cả đoạn:
   huy hiệu "Lưu ý" (chén trà + chữ, nâu đất ấm) đứng dòng riêng, câu lưu ý chữ nâu đất; cụm then chốt `key` ≤ 6 chữ mới được tô (hh-key). */
.hh-luuy { display: block; background: none; color: var(--qt-earth-ink); border-radius: 0; padding: 0; margin: 6px 0 0; }
.hh-luuy-lb { display: flex; align-items: center; gap: 6px; width: max-content; max-width: 100%; margin: 0 0 4px; font: 700 30px/1.2 var(--cards-font); font-style: normal; letter-spacing: .2px;
  color: var(--qt-cream); background: var(--qt-earth); border-radius: 999px; padding: 3px 16px 3px 8px; }
.hh-luuy-ic { width: 32px; height: 32px; object-fit: contain; flex: none; }
/* cụm then chốt (server `key`, ≤ 6 chữ): tô hổ phách mờ, clone qua dòng khi lỡ rơi 2 dòng — chỉ cụm này được tô nền */
.hh-key { background: rgba(227, 178, 60, .28); color: inherit; border-radius: 6px; padding: 1px 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
/* lời kêu gọi (server `cta` / câu cuối "…!"): DÒNG RIÊNG dưới thân, nhỏ hơn thân (32 px), màu ngọc, không tô nền */
.hh-cta { margin: 0; font: 600 32px/1.35 var(--cards-font); color: var(--qt-jade); padding-left: 23px; }
.hh-cta::before { content: '» '; color: var(--qt-amber-ink); }
/* [Q13] dòng mời theo mức (`moiThem`): dòng riêng cuối trang 1, dịu hơn CTA (mực nhạt, 30 px), tự xuống dòng — không "…" */
.hh-cta.hh-moi { font: 500 30px/1.35 var(--cards-font); color: var(--cards-t2); }

/* ---------- [Q13] thẻ tuổi 4 mức: tiêu đề xưng tên (M2+) + trang Bát tự (M3 3 trụ / M4 4 trụ) — chỉ chữ suy ra, không số ngày/năm sinh ---------- */
/* "Sơn · tuổi Tân Dậu": tên gọi đậm ngọc, phần sau cùng cỡ nhưng nhạt hơn; ≤ 2 dòng (hh-2l) */
.hh-title .hh-ten-goi { font-weight: 700; color: var(--qt-jade); }
.hh-title .hh-title-rest { font-weight: 600; color: var(--qt-ink-2); }
.hh-battu { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* lưới trụ 3–4 cột: nhãn trụ nhỏ trên, can chi chữ TO serif 1 dòng; ô chật ("Canh Thân" ở 4 cột ≈ 185 px) thì can / chi xuống 2 dòng, không "…" */
.hh-tru { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hh-tru.c4 { grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hh-tru-it { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; background: rgba(255, 255, 255, .55); border-radius: 14px; padding: 6px 6px 10px; }
.hh-tru-it i { font: 600 30px/1.2 var(--cards-font); font-style: normal; color: var(--cards-t3); }
.hh-tru-it b { display: flex; flex-wrap: wrap; justify-content: center; column-gap: .25em; font: 700 44px/1.1 var(--qt-font-serif); color: var(--qt-jade); text-align: center; }
.hh-tru.c4 .hh-tru-it b { font-size: 38px; }
/* trụ Ngày = can ngày (nhật chủ): viền ngọc để mắt nối với ô "Can ngày (nhật chủ)" bên dưới */
.hh-tru-it.nhat { background: var(--qt-jade-2); box-shadow: inset 0 0 0 3px var(--qt-jade); }
.hh-tru-it.nhat i { color: var(--qt-jade); }
/* hợp tuổi: điểm thật + chip mức; thang màu nhẹ (cao ngọc · vừa hổ phách · thấp mực nhạt), tiêu chí chưa khớp dấu "–" ấm nhạt */
.hh-score-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hh-score { display: flex; align-items: baseline; gap: 6px; font: 800 60px/1 var(--cards-font-num); color: var(--qt-jade); font-variant-numeric: tabular-nums; }
.hh-score small { font: 600 32px var(--cards-font); color: var(--cards-t3); }
.hh-score[data-tone="vua"] { color: var(--qt-amber-ink); }
.hh-score[data-tone="thap"] { color: var(--qt-ink-2); }
.hh-muc { font: 700 32px/1.2 var(--cards-font); color: var(--qt-jade); background: var(--qt-jade-2); border-radius: 999px; padding: 2px 14px; white-space: nowrap; }
.hh-muc.vua { color: var(--qt-amber-ink); background: rgba(227, 178, 60, .24); }
.hh-muc.thap { color: var(--qt-ink-2); background: var(--qt-paper-3); }
.hh-mark.soft { color: var(--qt-amber-ink); background: rgba(227, 178, 60, .35); }
.hh-mark.hoa { color: var(--qt-jade); background: var(--qt-jade-2); } /* mặt "hoà": dấu ≈ ngọc nhạt */

/* ---------- duyên đôi theo tên (hh-plus H1): 2 ô tên + dây tơ hồng + điểm /100 + mức; 3 mặt dạng chip ---------- */
/* cột điểm cố định 300 px → hai ô tên luôn ~247 px (chip mức dài như "Khác biệt, cần vun đắp" xuống 2 dòng, không bóp ô tên) */
.hh-duyen { grid-template-columns: 1fr 300px 1fr; gap: 0 10px; align-items: stretch; }
.hh-ten { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px 14px; min-height: 100px; box-sizing: border-box; border: 2px solid rgba(227, 178, 60, .35); }
.hh-duyen .hh-ten b { font-size: 44px; line-height: 1.1; text-align: center; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.hh-ten-ic { position: absolute; left: 8px; top: 6px; width: 32px; height: 32px; object-fit: contain; opacity: .85; }
.hh-to-hong { position: relative; justify-content: center; padding: 6px 0 0; gap: 4px; }
/* dây tơ hồng: sợi chỉ hồng đào chạy ngang sau điểm số, hai đầu "buộc" vào ô tên (nút tròn) */
.hh-thread { position: absolute; left: -10px; right: -10px; top: 44px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--qt-amber), #D8707A 30%, #D8707A 70%, var(--qt-amber)); opacity: .85; }
.hh-thread::before, .hh-thread::after { content: ""; position: absolute; top: -5px; width: 13px; height: 13px; border-radius: 50%; background: #D8707A; box-shadow: 0 0 0 3px var(--qt-paper); }
.hh-thread::before { left: 0; }
.hh-thread::after { right: 0; }
.hh-to-hong .hh-score { position: relative; z-index: 1; background: var(--qt-paper); padding: 0 14px; border-radius: 999px; }
.hh-to-hong .hh-score[data-tone="cao"] { color: var(--qt-jade); }
.hh-to-hong .hh-muc { white-space: normal; text-wrap: balance; text-align: center; line-height: 1.15; max-width: 280px; padding: 3px 14px; } /* "Khác biệt, cần vun đắp" → 2 dòng cân */
/* 3 mặt: ô như Cung phi/Sao chiếu mệnh — tên mặt trên, dưới là dấu + "4 · 1" + chữ hợp/hoà/nhường */
/* L1c: ô 264 px không đủ cho "– 11 · 9 nhường" một hàng → hàng 1 dấu + chữ hợp/hoà/nhường, hàng 2 số hai tên (không "nhườ…") */
.hh-mat .hh-mat-it b { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; white-space: normal; overflow: hidden; }
.hh-mat .hh-mat-so { order: 3; flex-basis: 100%; }
.hh-mat .hh-mark { width: 36px; height: 36px; font-size: 30px; }
.hh-mat-so { font: 700 32px/1 var(--cards-font-num); color: var(--cards-t1); font-variant-numeric: tabular-nums; }
.hh-mat-w { font: 600 30px/1 var(--cards-font); color: var(--cards-t2); } /* chữ "hợp / hoà / nhường" ngắn — không cắt */

/* ---------- chân thẻ có link (hh-plus H1, chỉ khi server gửi `link`; duyen-link 12/11 trước khi bật linkOnCards): thẻ lật y như không link,
   chân thẻ = MỘT hàng [cuộn giấy + link 34 px, 1 DÒNG] [thanh trang n/N] cao đúng bằng hàng thanh trang của thẻ không link (32 px; viên link 38 px
   lấn đều 3 px vào khoảng trống trên/dưới) → có/không link đỉnh thẻ như nhau. QR (fe/qr-180, lead 0e 12/11): KHÔNG còn ở góc phải chân thẻ
   (124 px khó quét; ≥ 180 ở đó lại chiếm cột làm thẻ cao thêm) → TRANG RIÊNG cuối chuỗi lật (.hh-qr-page bên dưới) → có/không QR đỉnh thẻ như nhau. ---------- */
.hh-foot { display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 32px; }
.hh-pager + .hh-foot { margin-top: -2px; } /* như .hh-pager + .hh-pages */
.hh-foot > .hh-pages { flex: 1 1 0; min-width: min-content; } /* link giữ đủ bề ngang (1 dòng), thanh trang lấy phần còn lại; số "2/3" luôn đủ chỗ */
.hh-foot.tight > .hh-pages .bar { display: none; } /* link dài chiếm gần hết hàng (ô ngang 700 px) → còn số trang "2/4" (cards-hh.js đo: thanh < 150 px) */
.hh-foot.nopages > .hh-pages { display: none; } /* 28 px vẫn tràn (duyên 2 tên ghép ở ô ngang) → bỏ cả số trang, link trọn hàng 1 dòng (fitLink) */
.hh-link { flex: 0 1 auto; display: flex; align-items: center; gap: 10px; min-width: 0; box-sizing: border-box; background: var(--qt-jade-2); border-radius: 999px; padding: 2px 20px 2px 8px; margin: -3px 0; }
/* link người xem phải gõ lại → không "…", MỘT DÒNG: cards-hh.js fitLink co 34 → 30 → 28 px khi không vừa (gạch nối U+2011 giữ); 28 px vẫn không vừa
   (duyên 2 tên ghép ở ô ngang) → .wrap: chỉ xuống dòng sau "/" (<wbr>), không gãy giữa chữ */
.hh-link b { min-width: 0; font: 700 34px/34px var(--cards-font); color: var(--qt-ink); letter-spacing: .2px; white-space: nowrap; }
.hh-link b:not(.wrap) wbr { display: none; } /* <wbr> vẫn cho ngắt dòng dù nowrap → tắt khi chưa .wrap (đo 12/11: link duyên dài gãy sau "d/" ở 34 px mà scrollWidth = clientWidth) */
.hh-link b.wrap { white-space: normal; overflow-wrap: anywhere; }
.hh-link-ic { width: 34px; height: 34px; flex: none; object-fit: contain; } /* ≤ cao chữ link: viên link đúng 38 px */
/* trang QR (fe/qr-180): [QR][“Quét để đọc bản đầy đủ” 44 px + “Hoặc gõ link bên dưới” 30 px] — trang CUỐI chuỗi lật, cao ĐÚNG BẰNG QR. Cạnh QR
   = --hh-qr-page: 180 px mặc định; cards-hh.js nâng tới chiều cao trang cao nhất còn lại (kẹp 180–300) sau khi đo → to nhất có thể mà trang QR
   không cao hơn trang khác (thẻ không cao thêm; đo 12/11: tuổi 300, duyên ~240). Nền trắng (#fff) cố định để máy quét đọc được. */
.cards-slot .cards-panel { --hh-qr-page: 180px; }
.hh-qr-page { display: flex; align-items: center; gap: 24px; min-width: 0; height: var(--hh-qr-page); }
.hh-qr { flex: none; width: var(--hh-qr-page); height: var(--hh-qr-page); background: #fff; border-radius: 16px; padding: 8px; box-sizing: border-box; border: 2px solid var(--qt-paper-3); box-shadow: 0 4px 10px rgba(0, 0, 0, .16); }
.hh-qr img { width: 100%; height: 100%; display: block; }
.hh-qr-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.hh-qr-col .hh-big.sm { font-size: 44px; text-wrap: balance; } /* ≤ 2 dòng cân nhau ("Quét để đọc / bản đầy đủ"), cột 376 px ở ngang khi QR 300 */
.hh-qr-hint { margin: 0; font: 500 30px/1.3 var(--cards-font); color: var(--cards-t2); }

/* ---------- toast riêng tư (ev privacyHint, cards.js .cards-toast.privacy): giấy sáng + viền hổ phách, 2 dòng, thân thiện ---------- */
.cards-toast.privacy { color: var(--qt-ink); background: linear-gradient(180deg, var(--qt-paper), var(--qt-paper-2)); border: 2px solid rgba(154, 106, 11, .5); border-left-width: 8px; border-left-color: var(--qt-amber); }
.cards-toast.privacy .cards-toast-who { color: var(--qt-jade); }
/* [MỚI W4] toast chào lại người quen (ev welcome, cards.js .cards-toast.welcome): giấy sáng + vệt ngọc bên trái, số hổ phách mực */
.cards-toast.welcome { color: var(--qt-ink); background: linear-gradient(180deg, var(--qt-paper), var(--qt-paper-2)); border: 2px solid rgba(47, 125, 109, .5); border-left-width: 8px; border-left-color: var(--qt-jade); }
.cards-toast.welcome .cards-toast-who { color: var(--qt-jade); }
.cards-toast.welcome .cards-num { color: var(--qt-amber-ink); }
.cards-toast.welcome .cards-toast-more { color: var(--qt-ink-2); }

/* ---------- quẻ: ống + 3 xu + 6 hào ---------- */
.hh-que { display: flex; gap: 26px; align-items: stretch; }
.hh-cast { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; width: 300px; }
.hh-coins { display: flex; align-items: center; gap: 10px; height: 86px; }
.hh-tube { height: 90px; width: auto; transform-origin: 50% 90%; }
.hh-tube.shake { animation: hhShake .55s ease-in-out infinite; }
@keyframes hhShake { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
.hh-coin { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); opacity: .35; transition: opacity .2s; }
.hh-coin.flip { opacity: 1; animation: hhFlip .5s ease-out both; }
.hh-coin.flip:nth-child(3) { animation-delay: .06s; }
.hh-coin.flip:nth-child(4) { animation-delay: .12s; }
@keyframes hhFlip { 0% { transform: translateY(-40px) rotateY(0); } 50% { transform: translateY(-10px) rotateY(180deg); } 100% { transform: none; } }
.hh-throw { font: 700 32px/1 var(--cards-font-num); color: var(--cards-t3); font-variant-numeric: tabular-nums; }
.hh-hex { display: flex; flex-direction: column-reverse; gap: 8px; width: 230px; margin: 2px 0; }
.hh-hao { height: 20px; display: flex; gap: 26px; opacity: 0; transform: scaleX(.3); transition: opacity .35s, transform .35s; }
.hh-hao.on { opacity: 1; transform: none; }
.hh-hao s { flex: 1; text-decoration: none; background: var(--qt-ink); border-radius: 4px; }
.hh-hao.dong s { background: var(--qt-red); box-shadow: 0 0 14px rgba(178, 58, 46, .7); animation: hhPulse 1.4s ease-in-out infinite; }
@keyframes hhPulse { 50% { opacity: .55; box-shadow: 0 0 4px rgba(178, 58, 46, .3); } }
.hh-que-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.hh-hao-dong { margin: 0; font: 500 34px/1.3 var(--cards-font); color: var(--cards-t2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
/* L1c: nghĩa quẻ (≤ 90 ký tự) trong cột phải 490 px → 2 dòng, không "…" */

/* ---------- tarot: úp → lật (CSS 3D), lá ngược xoay 180° ---------- */
.hh-tarot { display: flex; gap: 28px; align-items: center; }
.hh-tflip { width: 155px; height: 270px; flex: none; perspective: 1200px; } /* 270 cao (a4: nhường ~60 px cho khối lời bình 6 dòng, đỉnh thẻ ≥ y 528) */
.hh-tflip .in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3, .9, .3, 1); }
.hh-tflip.open .in { transform: rotateY(180deg); }
.hh-tflip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; border: 6px solid var(--qt-paper); box-shadow: 0 10px 24px rgba(0, 0, 0, .35); background: var(--qt-paper); backface-visibility: hidden; }
.hh-tflip .face { transform: rotateY(180deg); }
.hh-tflip.nguoc .face { transform: rotateY(180deg) rotate(180deg); }
.hh-tarot-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

/* ---------- hợp tuổi ---------- */
.hh-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.hh-person { background: rgba(255, 255, 255, .55); border-radius: 16px; padding: 6px 14px; min-width: 0; }
/* can chi ("Canh Ngọ") + "1990 · nam" / mệnh đời thường: xuống 2 dòng nếu chật, không "…" */
.hh-person b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font: 700 40px/1.1 var(--qt-font-serif); color: var(--qt-jade); white-space: normal; overflow: hidden; }
.hh-person span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font: 500 32px/1.3 var(--cards-font); color: var(--cards-t2); white-space: normal; overflow: hidden; }
/* ---------- chọn ngày ---------- */
.hh-days { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hh-days li { display: flex; gap: 16px; align-items: center; background: rgba(255, 255, 255, .55); border-radius: 14px; padding: 6px 14px; }
.hh-days li > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hh-days .d { flex: none; min-width: 130px; white-space: nowrap; font: 700 44px/1 var(--qt-font-serif); color: var(--qt-red); font-variant-numeric: tabular-nums; }
.hh-days .am { font: 600 32px/1.2 var(--cards-font); color: var(--cards-t2); white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.hh-days .ly { font: 500 32px/1.35 var(--cards-font); color: var(--cards-t1); white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } /* L3: lý do đời thường dài hơn ("Hợp làm việc lớn, nhập học — hợp việc này") → 2 dòng, không "…" */

/* ---------- lịch (thẻ) ---------- */
.hh-lich-head { display: flex; align-items: center; gap: 22px; }
.hh-lich-d { font: 700 96px/1 var(--qt-font-serif); color: var(--qt-red); font-variant-numeric: tabular-nums; flex: none; }
.hh-lich-head > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.hh-lich-head > div b { font: 700 34px/1.2 var(--qt-font-serif); color: var(--cards-t1); }
.hh-lich-head > div span { font: 600 32px/1.3 var(--cards-font); color: var(--cards-t2); white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } /* L1c: "Âm lịch 3/10 Bính Ngọ · ngày Kỷ Sửu · tháng Kỷ Hợi" 2 dòng, không "…" */
.hh-kv.wrap b { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; } /* Nên/Kỵ có trang riêng (L1c) → 4 dòng, đủ 3 việc dài, không "…" */

/* ---------- fact (bạn có biết) ---------- */
.hh-fact-mon { display: flex; align-items: center; gap: 12px; }
.hh-fact-mon .hh-sub { min-width: 0; } /* tên bài / môn: 2 dòng theo .hh-sub, không "…" */

/* ---------- tiến trình bài học (góc bài học theme.js + thẻ `lesson` dự phòng): mỗi trang 1 đoạn, trang hiện tại chảy đầy ---------- */
/* trong --qt-slide-ms (= lesson.ms server gửi) bằng 1 hoạt cảnh transform trên compositor, không setInterval; sang trang = phần tử
   mới → hoạt cảnh tự chạy lại. Chữ trang mới trượt nhẹ từ phải vào (.hh-page) để người xem thấy bài đang chạy, không "đơ". */
.hh-pages { display: flex; align-items: center; gap: 16px; }
.hh-pages .bar { flex: 1; display: flex; gap: 6px; }
.hh-pages .bar i { flex: 1; height: 8px; border-radius: 4px; background: var(--qt-paper-3); overflow: hidden; }
.hh-pages .bar i.done { background: var(--qt-amber); }
.hh-pages .bar i.cur s { display: block; height: 100%; text-decoration: none; background: var(--qt-amber); transform-origin: left; transform: scaleX(0);
  animation: hhSlide linear forwards; animation-duration: var(--qt-slide-ms, 18s); }
@keyframes hhSlide { to { transform: scaleX(1); } }
.hh-pages b { flex: none; font: 700 32px/1 var(--cards-font-num); color: var(--qt-ink-3); font-variant-numeric: tabular-nums; }
.hh-page { animation: hhPage .45s ease-out both; }
@keyframes hhPage { from { opacity: 0; transform: translateX(18px); } }

/* ---------- [L1c] thẻ chia trang tự lật (cards-hh.js paged): trang 1 = chi tiết (điểm / ô số / lá bài / quẻ), trang sau = lời bình ≤ 4 dòng/trang,
   4–6,5 s/trang theo thời gian thẻ; các trang xếp chồng cùng ô lưới → chiều cao thẻ = trang cao nhất, không nhảy khi lật; thanh trang như bài học ---------- */
.hh-pager { display: grid; min-width: 0; position: relative; }
.hh-pg { grid-area: 1 / 1; min-width: 0; visibility: hidden; opacity: 0; display: flex; flex-direction: column; gap: 10px; }
.hh-pg.on { visibility: visible; opacity: 1; animation: hhPage .45s ease-out both; }
.hh-pg .hh-binh, .hh-pg .hh-quote { -webkit-line-clamp: 6; } /* đã tách 4–6 dòng/trang theo đo thật; 6 = lưới an toàn khi font tải muộn */
.hh-measure { position: absolute; left: 0; right: 0; top: 0; visibility: hidden; pointer-events: none; display: block; -webkit-line-clamp: unset; overflow: visible; }
.hh-pager + .hh-pages { margin-top: -2px; }

/* ---------- dải lịch trên cùng (theme.js) — 1 khối, 2 dòng 40 px: ngày · câu đời thường (doiThuong ⇄ gioDep xoay 8 s) ---------- */
/* ---------- BẢNG GỖ TREO TRẦN (L1b): 1 tấm gỗ sẫm giữa-trên y 100–~335, 2 dây treo lên trần; chữ kem có bóng mờ cho hợp cảnh ---------- */
.qt-ceiling { position: absolute; left: var(--cards-side); right: var(--cards-side); top: var(--qt-ceiling-top); z-index: 28; display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-sizing: border-box; padding: 12px 32px 10px; font-family: var(--cards-font); color: var(--qt-cream); pointer-events: none;
  background: linear-gradient(180deg, var(--qt-wood-2), var(--qt-wood)); border: 3px solid var(--qt-wood-edge); border-radius: 18px;
  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); text-shadow: 0 2px 4px rgba(0, 0, 0, .55); }
.qt-ceiling::before, .qt-ceiling::after { content: ''; position: absolute; top: calc(-1 * var(--qt-ceiling-top) - 3px); width: 6px; height: var(--qt-ceiling-top); background: var(--qt-wood-edge); box-shadow: 0 0 6px rgba(0, 0, 0, .4); }
.qt-ceiling::before { left: 110px; }
.qt-ceiling::after { right: 110px; }
.qt-tall-2 .qt-ceiling { visibility: hidden; } /* thẻ/đố cao quá y 345 → cả bảng nhường */
.qt-ceil-disc { font: 500 30px/1.3 var(--cards-font); color: var(--qt-cream); opacity: .78; white-space: nowrap; }
/* dải lịch: hàng đầu trên bảng gỗ (số ngày to + 2 dòng 40 px) */
.qt-lich { display: none; align-items: center; gap: 22px; box-sizing: border-box; width: 100%; color: var(--qt-cream); font-family: var(--cards-font); pointer-events: none; }
.qt-lich.show { display: flex; }
.qt-lich .d { font: 700 84px/1 var(--qt-font-serif); color: var(--cards-accent); font-variant-numeric: tabular-nums; flex: none; }
.qt-lich .m { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.qt-lich .m b { font: 700 40px/1.2 var(--qt-font-serif); white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } /* "Thứ ba, 11/11 · Âm 2/10": 2 dòng nếu chật, không "…" */
/* dòng 2 KHÔNG "…" (L1c): theme.js đo thật — co 40 → 36 px rồi rút vế cuối; overflow hidden chỉ là lưới an toàn khi không đo được */
.qt-lich .m span { font: 600 40px/1.2 var(--cards-font); color: var(--qt-cream); opacity: .9; white-space: nowrap; overflow: hidden; }
.qt-lich .m span.swap { animation: qtHint .45s ease-out both; }

/* ---------- khối nội dung (ô giữa, khi không có thẻ): bài học hoặc bảng hướng dẫn thoáng qua — chữ ≥ 40 px, miễn trừ 30 px ---------- */
.qt-corner { position: absolute; left: var(--cards-side); right: var(--cards-side); bottom: var(--qt-corner-bottom); z-index: 27; display: none; flex-direction: column; gap: 8px; box-sizing: border-box;
  background: linear-gradient(180deg, var(--qt-paper), var(--qt-paper-2)); color: var(--qt-ink); border: 3px solid rgba(47, 125, 109, .45); border-radius: 22px; padding: 16px 32px 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55); font-family: var(--cards-font); pointer-events: none; } /* L1c: đệm gọn (22/16 → 16/12), khe 12 → 8: trang bài 7 dòng + tiêu đề 2 dòng vẫn dưới y 260 */
.qt-corner.show { display: flex; animation: cardsIn .4s cubic-bezier(.2, 1.2, .4, 1) both; }
.qt-busy .qt-corner { display: none; }
/* bảng xếp hạng / "Cảm ơn" theo sự kiện đang hiện cùng ô → khối nội dung nhường 6 s (visibility: giữ layout để đo lại cỡ chữ) */
.cards-board-on .qt-corner, .qt-ev-thanks .qt-corner { visibility: hidden; }
.qt-corner h3 { margin: 0; font: 700 40px/1.2 var(--qt-font-serif); color: var(--qt-jade); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
/* tiêu đề bài tối đa 2 dòng (a8) — không cắt giữa chừng thành "…" sau 1 dòng */
.qt-corner h3 span { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.qt-corner h3 small { flex: none; font: 600 32px var(--cards-font); color: var(--qt-ink-3); white-space: nowrap; }
.qt-corner .img { width: 100%; height: 150px; object-fit: cover; border-radius: 14px; border: 4px solid var(--qt-paper); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.qt-corner.noimg .img { display: none; } /* L1c: trang bài dài → bỏ tranh để cả khối ≤ 660 px (theme.js fitLesson) */
.qt-corner h4 { margin: 0; font: 700 40px/1.25 var(--cards-font); color: var(--qt-ink); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
/* chữ bài học không kẹp dòng (a8): theme.js thu cỡ 44 → 40 px khi quá 7 dòng (không nhỏ hơn 40); nắp 7 dòng (L1c, ≈ 320 ký tự ở 40 px) là lưới an toàn
   để đỉnh khối không vọt lên vùng TikTok y < 240 khi đáy ở y 980 */
.qt-corner p { margin: 0; font: 500 44px/1.35 var(--qt-font-serif); color: var(--qt-ink); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; overflow: hidden; }
.qt-corner .disc { font: 500 30px/1.3 var(--cards-font); color: var(--qt-ink-3); text-align: center; border-top: 1px dashed rgba(90, 74, 58, .35); padding-top: 10px; }
/* ---------- dòng mời TO trên bảng gỗ (L1b): "Gõ [1990 nữ] xem tuổi năm nay" thẻ giấy kem, xoay 5 s; có thẻ/đố → ẩn ---------- */
.qt-strip { display: flex; justify-content: center; align-items: center; width: 100%; font-family: var(--cards-font); pointer-events: none; text-shadow: none; }
.qt-hint { display: none; align-items: center; gap: 14px; max-width: 100%; min-width: 0; box-sizing: border-box; color: var(--qt-ink); white-space: nowrap;
  background: linear-gradient(180deg, rgba(246, 238, 220, .97), rgba(239, 227, 200, .97)); border: 2px solid rgba(154, 106, 11, .5); border-radius: 999px; padding: 5px 28px 5px 22px; box-shadow: 0 6px 16px var(--qt-shade); }
.qt-hint.show { display: inline-flex; }
.qt-busy .qt-hint { display: none; }
.qt-hint .lb { flex: none; font: 600 40px/1.2 var(--cards-font); color: var(--qt-ink-3); }
.qt-hint b { flex: none; font: 800 44px/1.2 var(--cards-font); color: var(--qt-jade); background: var(--qt-jade-2); border-radius: 14px; padding: 1px 18px; }
.qt-hint > span:not(.lb) { min-width: 0; overflow: hidden; font: 600 40px/1.2 var(--cards-font); color: var(--qt-ink-2); } /* L1c: không "…" — theme.js co 40 → 36 px rồi bỏ giải thích */
.qt-hint.swap { animation: qtHint .45s ease-out both; }
@keyframes qtHint { from { opacity: 0; transform: translateY(6px); } }

/* ---------- theo sự kiện (L1): bảng xếp hạng (cards.js board.mode event) + "Cảm ơn" (ticker kit) ở Ô GIỮA (đáy y 1180, rộng 880),
   "Tim cho quán" (kit-goal) ở đáy — chỉ hiện ~6 s khi có điểm / quà / tim rồi ẩn; có thẻ/đố thì không hiện ---------- */
/* dùng filter + visibility (không bị keyframe cardsIn `both` ghi đè như opacity); ẩn xong visibility:hidden để không vẽ lớp vô hình */
.cards-board { top: auto; bottom: var(--qt-corner-bottom); left: var(--cards-side); right: var(--cards-side); width: auto; z-index: 32; padding: 18px 30px 14px; gap: 10px; }
.cards-board, .kit-ticker, .kit-goal { transition: filter .4s, visibility 0s 0s; }
.qt-busy .cards-board, .qt-ev-thanks .cards-board { filter: opacity(0); visibility: hidden; transition: filter .4s, visibility 0s .4s; }
.cards-board-title { color: var(--qt-jade); }
.cards-board .cards-rank { background: var(--qt-paper-3); color: var(--qt-ink); }
.cards-board .cards-pts { color: var(--qt-amber-ink); }
.cards-board li { border-bottom-color: rgba(90, 74, 58, .25); }
/* bảng "Gõ gì được gì?" theo nhu cầu: giấy dó, tiêu đề serif ngọc, lệnh = viên ngọc nhạt như dòng mời */
.kit-guide { border: 3px solid rgba(47, 125, 109, .45); border-radius: 22px; }
/* L1c (owner: tiêu đề help nằm đè trên thẻ): thẻ/đố đang mở → bảng help KHÔNG vẽ (guide.js hoãn tới khi thẻ ẩn; đang hiện mà thẻ tới → ẩn ngay);
   bảng help đang mở → góc bài học nhường (hai khối không chồng) */
.qt-busy .kit-guide { visibility: hidden; }
.qt-help-on .qt-corner { visibility: hidden; }
/* bảng help cao y 360–~940 (7 lệnh): bảng xếp hạng / "Cảm ơn" (đáy y 980) và làn toast (y 350) từng đè lên → bảng/Cảm ơn nhường 12 s,
   toast người xem dời xuống ngay dưới bảng help (y 950, trên bàn thầy) để vẫn thấy "+điểm / đang xếp hàng" */
.qt-help-on .cards-board, .qt-help-on .kit-ticker, .qt-help-on .kit-toast, .qt-help-on .kit-card, .qt-help-on .kit-periodic { visibility: hidden; }
.qt-help-on .cards-toasts { top: 950px; }
.kit-guide h3 { font: 700 40px/1.2 var(--qt-font-serif); color: var(--qt-jade); }
.kit-guide h3 small { font: 600 32px/1.2 var(--cards-font); }
.kit-guide li b { color: var(--qt-jade); background: var(--qt-jade-2); }
.kit-guide .disc { color: var(--qt-ink-3); border-top-color: rgba(90, 74, 58, .35); }
/* "Cảm ơn": cùng ô với bảng (ưu tiên hơn bảng), 3 dòng 40 px, chỉ hiện khi .qt-ev-thanks và không có thẻ */
.kit-ticker { top: auto !important; bottom: var(--qt-corner-bottom); left: var(--cards-side) !important; right: var(--cards-side) !important; width: auto !important; box-sizing: border-box;
  padding: 18px 30px 14px !important; border-radius: 22px !important; z-index: 33; filter: opacity(0); visibility: hidden; transition: filter .4s, visibility 0s .4s; }
.qt-ev-thanks:not(.qt-busy) .kit-ticker { filter: none; visibility: visible; transition: filter .4s, visibility 0s 0s; }
/* bảng "Gõ gì được gì?" đang mở (qt-help-on, y 360–~940) ưu tiên: "Cảm ơn" (đáy 980) nhường dù đang trong 6 s quà — luật trên (3 lớp) không được thắng luật help-on (2 lớp) */
.qt-help-on.qt-ev-thanks .kit-ticker { filter: opacity(0); visibility: hidden; transition: filter .4s, visibility 0s .4s; }
.kit-ticker h3 { text-align: left !important; font-size: 40px !important; margin: 0 0 10px !important; }
.kit-ticker li { font-size: 40px !important; gap: 14px !important; }
.kit-ticker li:nth-child(n+4) { display: none !important; }
/* "Tim cho quán": thanh mục tiêu kit ở đáy (y ~1690–1750, trong vùng an toàn hai bên 100), chỉ hiện khi có tim / đạt mục tiêu */
.kit-goal { left: var(--cards-side) !important; right: var(--cards-side) !important; bottom: 100px !important; /* dưới nhãn "và n bạn khác" (y ~1712) khi ghế tắt — không đè (soát 11/11) */ filter: opacity(0); visibility: hidden; transition: filter .4s, visibility 0s .4s; }
.qt-ev-like .kit-goal { filter: none; visibility: visible; transition: filter .4s, visibility 0s 0s; }
.kit-goal .lb { font-size: 40px !important; margin-bottom: 8px !important; }
.kit-goal .bar { height: 18px !important; }

/* ---------- làn thông báo y 400–520: thẻ cảm ơn quà của kit thu gọn, băng rôn kit vào làn; ưu tiên 1 thứ / lúc — chữ ≥ 40 px ---------- */
#stage .kit-card { padding: 10px 26px; }
#stage .kit-card .who { font-size: 44px; }
#stage .kit-card .what { font-size: 40px; margin-top: 2px; }
#stage .kit-card .quote { display: none; }
#stage .kit-periodic h4 { font-size: 40px; }
#stage .kit-periodic p { font-size: 40px; line-height: 1.35; }
/* L1b: làn chuyển xuống ngay dưới dòng mời (--qt-lane-top 680) — kit đặt top inline theo theme.json nên ghi đè !important */
#stage .kit-card, #stage .kit-periodic { top: var(--qt-lane-top) !important; }
.kit-toast { top: calc(var(--qt-lane-top) + 10px) !important; }
.qt-lane-toast .kit-toast, .qt-lane-toast .kit-card, .qt-lane-toast .kit-periodic,
.qt-lane-banner .kit-card, .qt-lane-banner .kit-periodic,
.qt-lane-gift .kit-periodic { visibility: hidden; }
/* cột giữa cao → làn thông báo nhường (qt-tall-1, cột quá y 480); cao nữa → bảng gỗ treo trần nhường (qt-tall-2, quá y 345) — thẻ người xem là ưu tiên cao nhất */
.qt-tall-1 .cards-toasts, .qt-tall-1 .kit-toast, .qt-tall-1 .kit-card, .qt-tall-1 .kit-periodic { visibility: hidden; }
/* (qt-tall-2 → cả bảng gỗ treo trần ẩn — luật ở mục .qt-ceiling) */

/* ---------- đố + thẻ cùng hiện (qt-both): thẻ người xem > đố → đố chỉ còn nhãn + câu hỏi 1 dòng + đồng hồ / đáp án ---------- */
/* (thu gọn của cards.css chỉ biết .cards-lines của renderer generic; thẻ huyền học không dùng nên cột từng vọt quá y 0) */
.qt-both .cards-quiz .cards-opts, .qt-both .cards-quiz .cards-hint, .qt-both .cards-quiz .cards-sub, .qt-both .cards-quiz .cards-top,
.qt-both .cards-quiz .cards-explain, .qt-both .cards-quiz .cards-foot { display: none; }
.qt-both .cards-quiz .cards-q { -webkit-line-clamp: 1; font-size: 36px; }
.qt-both .cards-quiz { gap: 8px; padding-top: 14px; padding-bottom: 14px; }
/* L1c: thẻ cũng gọn lại khi đố cùng hiện: chỉ còn đầu thẻ + TRANG LỜI BÌNH CUỐI (.hh-last do cards-hh.js đánh dấu — không phải trang QR đuôi),
   không lật, bỏ thanh trang, hàng tên thấp → đố thu gọn phía trên không trèo lên vùng TikTok y < 240 (đo 11/11: đủ trang → đố ở y 200) */
.qt-both .cards-card .hh-pages { display: none; }
.qt-both .cards-card .hh-pg { display: none; }
.qt-both .cards-card .hh-pg.hh-last { display: flex; visibility: visible; opacity: 1; animation: none; }
.qt-both .cards-card .cards-who { min-height: 44px; }
.qt-both .cards-card .cards-av { width: 44px; height: 44px; }

/* ---------- giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  .hh-tube.shake, .hh-coin.flip, .hh-hao.dong s, .qt-corner.show, .hh-page, .hh-pg.on, .qt-hint.swap, .qt-lich .m span.swap { animation: none; }
  .hh-hao, .hh-tflip .in, .cards-board, .kit-ticker, .kit-goal { transition: none; }
  .hh-reveal { animation: none; opacity: 1; }
  .hh-pages .bar i.cur s { animation: none; transform: none; opacity: .45; } /* trang hiện tại = đoạn mờ, không chảy */
}

/* ---------- [G1] Khung Tiết (seats.css): tổ Mai · Lan · Cúc · Trúc, bảng xếp hạng trên bảng gỗ trần, dải tiết thay dòng mời khi đang học.
   Màu tổ lấy từ token sẵn có của quán (không hex mới): Mai vàng mai · Lan hồng (màu dây tơ hồng) · Cúc trắng kem · Trúc xanh ngọc. ---------- */
:root {
  --team1: var(--qt-amber);
  --team2: #D8707A;
  --team3: var(--qt-cream);
  --team4: var(--qt-jade);
  --seats-panel-bg: linear-gradient(180deg, var(--qt-wood-2), var(--qt-wood));
  --seats-panel-line: var(--qt-wood-edge);
  --seats-panel-text: var(--qt-cream);
  --seats-panel-sub: rgba(255, 246, 226, .78);
  --seats-accent: var(--qt-amber);
  --seats-on-accent: var(--qt-ink);
  --seats-chip-bg: rgba(0, 0, 0, .3);
  --seats-win-bg: rgba(227, 178, 60, .22);
  --seats-tag-bg: rgba(25, 14, 10, .86);
  --seats-bubble-bg: rgba(30, 22, 20, .9);
  --seats-stool: var(--qt-wood);
  --seats-stool-edge: var(--qt-wood-edge);
  --seats-robe: var(--qt-ink-3);
  --seats-hair: var(--qt-ink);
  --seats-boards-top: var(--qt-ceiling-top);
}
.kit-class-on .qt-strip { display: none; }          /* đang học: dải tiết đứng chỗ dòng mời trên bảng gỗ */
.qt-ceiling .kit-plan { width: 100%; }
.kit-boards-on:not(.seats-on) .qt-ceiling { visibility: hidden; }  /* bảng tiết / buổi / tổ hiện 6 s trên bảng gỗ; ghế bật: seats.css ẩn bảng → bảng gỗ giữ (soát 11/11: trần trống) */
.kit-boards-on:not(.seats-on) .qt-ceiling::before, .kit-boards-on:not(.seats-on) .qt-ceiling::after { visibility: visible; } /* 2 dây treo vẫn còn */
.qt-busy .kit-boards { visibility: hidden; }
.kit-boards .cards-av.sm { border-color: var(--qt-amber); }
/* ---------- [G2] Lớp đố 20 câu đang chạy (class.js gắn #stage.class-on): bảng đen thay bảng gỗ treo trần (y 110 →), làn thông báo /
   bảng help / bảng xếp hạng sự kiện / toast điểm nhường (điểm đã có trên bảng Nhanh nhất); thẻ huyền học giữa tiết vẫn lên, bảng tự thu gọn ---------- */
:root { --class-top: var(--qt-ceiling-top); }
.class-on .qt-ceiling, .class-on .kit-guide, .class-on .cards-toasts, .class-on .kit-toast, .class-on .kit-card, .class-on .kit-periodic, .class-on .cards-board, .class-on .kit-ticker { visibility: hidden; }
.class-on .qt-corner { display: none; }
/* ---------- [G4] bộ trò Quán Trà đang hiện (qt-games.js gắn #stage.qtg-on): bảng gỗ trần / làn thông báo / bảng help / bảng sự kiện nhường như lớp đố ---------- */
.qtg-on .qt-ceiling, .qtg-on .kit-guide, .qtg-on .cards-toasts, .qtg-on .kit-toast, .qtg-on .kit-card, .qtg-on .kit-periodic, .qtg-on .cards-board, .qtg-on .kit-ticker,
.cl-on .qt-ceiling, .cl-on .kit-guide, .cl-on .cards-toasts, .cl-on .kit-toast, .cl-on .kit-card, .cl-on .kit-periodic, .cl-on .cards-board, .cl-on .kit-ticker, .cl-on .kit-boards { visibility: hidden; } /* [G6] .cl-on = hợp tác / Dò số Tết (coop-loto.js) */
.qtg-on .qt-corner, .cl-on .qt-corner { display: none; }
.class-root .class-board { font-family: var(--cards-font); }
.class-root .class-no, .class-root .class-results h3, .class-root .class-intro .big { font-family: var(--qt-font-serif); }
/* ---------- [L2-T3] câu mời TO (Kit.invite, /sdk/invite.css) trong BẢNG GỖ TREO TRẦN: lúc mời bảng chỉ còn câu mời 56 px chữ kem + viên
   "gõ: 1990 nữ" giấy kem/ngọc + dòng miễn trừ; dải lịch + dòng mời nhỏ nhường chỗ, viền bảng sáng hổ phách. Hết mời / có thẻ → bảng như cũ.
   Làn thông báo dời xuống ngay dưới bảng (--inv-bottom do invite.js đo). ---------- */
.qt-invite {
  --inv-ink: var(--qt-cream);
  --inv-hook: var(--qt-amber);
  --inv-lb: var(--qt-ink-3);
  --inv-chip-shell: linear-gradient(180deg, rgba(246, 238, 220, .97), rgba(239, 227, 200, .97));
  --inv-chip-line: rgba(154, 106, 11, .5);
  --inv-chip-bg: var(--qt-jade-2);
  --inv-chip-fg: var(--qt-jade);
  --inv-chip-glow: rgba(227, 178, 60, .45);
  padding: 2px 0 4px;
}
.qt-invite .kit-invite-text { text-shadow: 0 2px 4px rgba(0, 0, 0, .55); }
.inv-on .qt-lich, .inv-on .qt-strip { display: none; }
.inv-on .kit-periodic { visibility: hidden; } /* câu nhắc định kỳ trùng ý câu mời → nhường (owner 10/11: bớt chữ khắp màn) */
.inv-on .kit-toast { visibility: hidden; } /* [12/11 soát fe] câu nhắc `prompt` ("Gõ năm sinh kèm nam/nữ…") cùng ý bảng mời TO → nhường (không lặp nhãn), cả dọc lẫn ngang */
.qt-ceiling { transition: border-color .5s, box-shadow .5s; }
.inv-on .qt-ceiling { border-color: var(--qt-amber); box-shadow: 0 16px 34px rgba(0, 0, 0, .5), 0 0 0 3px rgba(227, 178, 60, .22), 0 0 44px rgba(227, 178, 60, .38),
  inset 0 2px 0 rgba(255, 255, 255, .12), inset 0 -3px 0 rgba(0, 0, 0, .25); }
#stage.inv-on { --qt-lane-top: calc(var(--inv-bottom, 380px) + 14px); --cards-toast-top: calc(var(--inv-bottom, 380px) + 14px); }
/* [L2-T3] thẻ "xem mẫu": tem hổ phách chữ mực (nổi trên giấy dó), bông ❀ góc phải nhường chỗ cho tem */
.cards-slot .cards-card.cards-sample { --cards-sample-bg: var(--qt-amber); --cards-sample-fg: var(--qt-ink); border-color: var(--qt-amber-ink); }
.cards-slot .cards-card.cards-sample::after { content: none; }

/* [H1-T4 arena] Đang có trò mới (arena.js gắn #stage.kit-arena-on): ẩn băng mời invite.js — nó nằm cùng dải y với dải luật 3 động từ + đếm ngược
   của khung arena (ảnh soát mockup/shots/arena-hook/qt-faction.jpg). Trò xong → kit-arena-on gỡ → băng mời hiện lại bình thường. */
#stage.kit-arena-on .kit-invite { display: none !important; }
/* ---------- [11/11 tách Lớp học] bảng trò đang mở (show / ra chơi / bộ trò / hợp tác) → thẻ phòng, Đố vui, "Cảm ơn", toast NHƯỜNG (soát ghế bật, mục 4):
   ẩn tới khi bảng trò đóng (server giữ thẻ thêm — -27 av.rs); miễn trừ của bảng trò không bao giờ bị che ---------- */
#stage.show-on .cards-slot, #stage.recess-on .cards-slot, #stage.qtg-on .cards-slot, #stage.cl-on .cards-slot,
#stage.show-on .kit-card, #stage.recess-on .kit-card, #stage.show-on .kit-ticker, #stage.recess-on .kit-ticker,
#stage.show-on .cards-toasts, #stage.recess-on .cards-toasts, #stage.show-on .kit-toast, #stage.recess-on .kit-toast, #stage.show-on .cards-board, #stage.recess-on .cards-board { visibility: hidden !important; }

/* ---------- [Q2/Q6] lớp sinh động theo cảnh (.qt-amb do theme.js gắn; scene-mode.js đặt #stage[data-scene=day|dusk|night] + [data-mode]) ----------
   • tia nắng chéo từ cửa sổ tròn (ngày vàng nhạt, chiều tà cam) trôi chậm · vầng sáng 2 đèn lồng (x 87 / 987, y 400) đung đưa + thở lúc chiều tối
   • đom đóm đêm bay lên từ sàn · mọi thứ là ánh sáng screen, không che chữ; prefers-reduced-motion → đứng yên */
.qt-amb { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.qt-amb i { position: absolute; display: block; opacity: 0; transition: opacity 1.5s ease; mix-blend-mode: screen; }
.qt-amb .sun { left: 430px; top: -260px; width: 360px; height: 1500px; transform: rotate(26deg); transform-origin: 50% 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 232, 180, .20) 42%, rgba(255, 232, 180, .28) 50%, rgba(255, 232, 180, .18) 58%, transparent 100%); filter: blur(16px); animation: qtSun 16s ease-in-out infinite alternate; }
#stage[data-scene="day"] .qt-amb .sun { opacity: 1; }
#stage[data-scene="dusk"] .qt-amb .sun { opacity: 1; background: linear-gradient(90deg, transparent 0%, rgba(255, 170, 90, .22) 42%, rgba(255, 150, 70, .3) 50%, rgba(255, 170, 90, .2) 58%, transparent 100%); transform: rotate(34deg); }
#stage[data-mode="ao-ca"] .qt-amb .sun, #stage[data-mode="pho"] .qt-amb .sun, #stage[data-mode="tra-da"] .qt-amb .sun { left: 620px; transform: rotate(18deg); } /* ngoài trời: nắng từ góc phải trên */
@keyframes qtSun { 0% { transform: rotate(26deg) translateX(-30px); opacity: .7; } 100% { transform: rotate(26deg) translateX(30px); opacity: 1; } }
.qt-amb .lamp { width: 300px; height: 300px; border-radius: 50%; top: 250px; background: radial-gradient(circle, rgba(255, 176, 80, .55) 0%, rgba(255, 140, 50, .22) 38%, transparent 68%); filter: blur(2px); animation: qtLamp 4.2s ease-in-out infinite alternate; }
.qt-amb .lamp.l { left: -63px; } .qt-amb .lamp.r { left: 837px; animation-delay: -2.1s; }
#stage[data-scene="dusk"] .qt-amb .lamp { opacity: .7; } #stage[data-scene="night"] .qt-amb .lamp, #stage.qt-night .qt-amb .lamp { opacity: 1; }
#stage[data-mode="ao-ca"] .qt-amb .lamp, #stage[data-mode="pho"] .qt-amb .lamp, #stage[data-mode="tra-da"] .qt-amb .lamp { opacity: 0; } /* cảnh ngoài trời không có đèn lồng ở đó */
@keyframes qtLamp { 0% { transform: translateX(-7px) rotate(-2deg) scale(.96); } 100% { transform: translateX(7px) rotate(2deg) scale(1.04); } }
.qt-amb .fly { left: 0; top: 0; width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 224, 140, .95); filter: blur(.4px);
  box-shadow: 140px 1180px 0 0 rgba(255, 224, 140, .9), 420px 1290px 0 -1px rgba(255, 224, 140, .75), 690px 1150px 0 0 rgba(255, 224, 140, .85), 930px 1260px 0 -1px rgba(255, 224, 140, .7),
    260px 1420px 0 -2px rgba(255, 224, 140, .6), 820px 1480px 0 -1px rgba(255, 224, 140, .7), 560px 1360px 0 -2px rgba(255, 224, 140, .55);
  animation: qtFly 11s ease-in-out infinite; }
#stage[data-scene="night"] .qt-amb .fly, #stage.qt-night .qt-amb .fly { opacity: .9; }
@keyframes qtFly { 0% { transform: translate(0, 0); } 25% { transform: translate(14px, -40px); } 50% { transform: translate(-10px, -90px); } 75% { transform: translate(18px, -140px); } 100% { transform: translate(0, -200px); opacity: 0; } }
/* [Q6] bố cục theo hoạt động: ao cá / phố / trà đá = ngoài trời → bảng gỗ trần sáng màu hơn một chút, màu nhấn nhẹ theo cảnh (chữ, luật giữ nguyên) */
#stage[data-mode="pho"] .qt-ceiling, #stage[data-mode="tra-da"] .qt-ceiling { border-color: rgba(240, 138, 75, .55); }
@media (prefers-reduced-motion: reduce) { .qt-amb i { animation: none !important; transition: none; } }
/* ---------- [Q8 gác UI] HUD arena (dải luật / bảng ván / xếp hạng / toast — /sdk/arena.css) ở Quán Trà theo token quán: giấy dó, mực nâu, viền gỗ sơn
   (arena.css mặc định mượn --seats-* màu tối của ghế). Chỉ đổi token, không đổi bố cục. ---------- */
.kit-arena { --arena-panel: linear-gradient(180deg, var(--qt-paper), var(--qt-paper-3)); --arena-chip: var(--qt-paper-2); --arena-text: var(--qt-ink); --arena-sub: var(--qt-ink-2); --arena-muted: var(--qt-ink-3);
  --arena-line: var(--qt-wood-edge); --arena-accent: var(--qt-amber); --arena-on-accent: var(--qt-ink); --arena-glow: rgba(227, 178, 60, .45); --arena-shade: var(--qt-shade); --arena-win: var(--qt-jade); --arena-warn: var(--qt-red); }
.kit-arena .ka-chip, .kit-arena .ka-board, .kit-arena .ka-toast { border: 3px solid var(--qt-wood-2); box-shadow: 0 0 0 2px var(--qt-wood-edge), 0 10px 26px rgba(0, 0, 0, .35); }
.kit-arena .ka-board-h, .kit-arena .ka-phase { color: var(--qt-amber-ink); }
/* [12/11 soát fe] thẻ huyền học mở khi ghế bật: ô "+N đang chờ" (cột phải) nằm dưới mép phải thẻ → nhường thẻ, hiện lại khi thẻ đóng */
.qt-busy .sb-wait.on { visibility: hidden; }
