/* pgd-games.css — bộ trò Phòng Giao Dịch (Game Pack G5): Boss Gấu · Đua ngựa VN30 · Đoán số đóng cửa · Ai là triệu phú CK · toast huy hiệu.
   Đi với /sdk/pgd-games.js. Khung 1080×1920: bảng trò chiếm CỘT GIỮA y 184 → ≤ 1040 (dưới dải phiên, trên MC sàn + bò/gấu), hai bên chừa
   vùng an toàn --cards-side. Dải nhỏ (Đoán số chạy nền / Boss Gấu khi Lớp đố đang chạy) ở y 958–1034. Chữ chính ≥ 40 px, nhãn phụ ≥ 30 px,
   số = mono tabular. Màu CHỈ qua token: --cards-* (cards.css) + màu giá iBoard --px-* (cards-market.css; đứng giá = VÀNG, không xám).
   Thuật ngữ sàn giữ nguyên (VN-Index, VN30, %, Trần/TC/Sàn) — owner 17/11. Mọi bảng có dòng miễn trừ (D-7). */
:root {
  --pg-top: 184px;
  --pg-bottom: 880px;                 /* = 1920 − 1040: đáy tối đa của bảng */
  --pg-strip-bottom: 886px;           /* = 1920 − 1034: dải nhỏ y 958–1034 */
  --pg-strip-h: 76px;
  --pg-s1: var(--cards-s1);
  --pg-s2: var(--cards-s2);
  --pg-s3: var(--cards-s3);
  --pg-t1: var(--cards-t1);
  --pg-t2: var(--cards-t2);
  --pg-t3: var(--cards-t3);
  --pg-accent: var(--cards-accent);
  --pg-on-accent: var(--cards-on-accent);
  --pg-line: var(--cards-line);
  --pg-glow: var(--cards-glow);
  --pg-up: var(--px-up, var(--cards-px-up));
  --pg-down: var(--px-down, var(--cards-px-down));
  --pg-ref: var(--px-ref, var(--cards-px-ref));
  --pg-ceil: var(--px-ceil, var(--cards-px-ceil));
  --pg-floor: var(--px-floor, var(--cards-px-floor));
  --pg-none: var(--px-none, var(--cards-px-none));
  --pg-up-soft: var(--px-up-soft, rgba(11, 223, 57, .16));
  --pg-down-soft: var(--px-down-soft, rgba(255, 0, 23, .20));
  --pg-ref-soft: var(--px-ref-soft, rgba(253, 255, 18, .14));
  --pg-font: var(--cards-font, 'Be Vietnam Pro', system-ui, sans-serif);
  --pg-font-num: var(--cards-font-num, 'JetBrains Mono', ui-monospace, monospace);
  --pg-radius: var(--cards-radius, 22px);
  --pg-shadow: var(--cards-shadow, 0 20px 50px rgba(0, 0, 0, .6));
}

/* ---------- gốc ---------- */
.pg-root { position: absolute; left: var(--cards-side, 100px); right: var(--cards-side, 100px); top: var(--pg-top); bottom: var(--pg-bottom); z-index: 29;
  pointer-events: none; font-family: var(--pg-font); color: var(--pg-t1); display: none; }
.pg-root.show { display: block; }
.pg-root .num { font-family: var(--pg-font-num); font-variant-numeric: tabular-nums; }
.pg-root b.num { font-weight: 800; }

/* màu giá iBoard theo data-state (up | down | ref | ceiling | floor | none) */
.pg-root .px[data-state="up"] { color: var(--pg-up); }
.pg-root .px[data-state="down"] { color: var(--pg-down); }
.pg-root .px[data-state="ref"] { color: var(--pg-ref); }
.pg-root .px[data-state="ceiling"] { color: var(--pg-ceil); }
.pg-root .px[data-state="floor"] { color: var(--pg-floor); }
.pg-root .px[data-state="none"], .pg-root .px:not([data-state]) { color: var(--pg-none); }

/* ---------- bảng chung ---------- */
.pg-board { position: absolute; left: 0; right: 0; top: 0; max-height: 100%; box-sizing: border-box; display: none; flex-direction: column; gap: 12px;
  padding: 14px 26px 16px; border-radius: var(--pg-radius); overflow: hidden;
  background: linear-gradient(180deg, var(--pg-s2), var(--pg-s1)), var(--cards-bg, #0B0E14);
  border: 2px solid var(--pg-accent); box-shadow: var(--pg-shadow), 0 0 40px var(--pg-glow); animation: pgIn .45s cubic-bezier(.2, 1.1, .4, 1) both; }
.pg-board.show { display: flex; }
.pg-body { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; position: relative; z-index: 1; }
.pg-body > * { flex: none; }
.pg-board::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .06;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, .5) 3px 4px); }
@keyframes pgIn { from { opacity: 0; transform: translateY(-26px); } to { opacity: 1; transform: none; } }
.pg-board.out { animation: pgOut .3s ease-in both; }
@keyframes pgOut { to { opacity: 0; transform: translateY(-14px); } }

.pg-head { display: flex; align-items: center; gap: 14px; min-height: 60px; flex-wrap: wrap; }
.pg-head.wrap .pg-sub { flex: 1 1 100%; order: 9; }
.pg-title { font-size: 44px; font-weight: 800; letter-spacing: .5px; white-space: nowrap; }
.pg-title small { font-size: 30px; font-weight: 600; color: var(--pg-t3); margin-left: 8px; letter-spacing: 0; }
.pg-sub { flex: 1; min-width: 0; font-size: 32px; font-weight: 600; color: var(--pg-t2); white-space: nowrap; overflow: hidden; }
.pg-sub:empty { display: none; }
.pg-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; font-size: 32px; font-weight: 800; color: var(--pg-on-accent); background: var(--pg-accent);
  border-radius: 999px; padding: 4px 18px; white-space: nowrap; box-shadow: 0 0 16px var(--pg-glow); }
.pg-chip small { font-size: 30px; font-weight: 600; opacity: .8; }
.pg-chip:empty { display: none; }
.pg-clock { flex: none; min-width: 120px; text-align: center; font-size: 48px; font-weight: 800; line-height: 1; padding: 6px 12px; border-radius: 16px;
  background: rgba(0, 0, 0, .3); border: 2px solid var(--pg-line); }
.pg-clock.low { color: var(--pg-down); border-color: var(--pg-down); animation: pgPulse .6s ease-in-out infinite; }
.pg-clock:empty { display: none; }
@keyframes pgPulse { 50% { transform: scale(1.06); } }

.pg-foot { margin: 0; font-size: 30px; font-weight: 500; color: var(--pg-t3); text-align: center; line-height: 1.25; }
.pg-foot b { color: var(--pg-accent); font-weight: 800; }
.pg-disc { margin: 0; font-size: 30px; font-weight: 500; color: var(--pg-t3); text-align: center; border-top: 1px dashed var(--pg-line); padding-top: 8px; }
.pg-timer { position: absolute; left: 24px; right: 24px; bottom: 6px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.pg-timer i { display: block; height: 100%; width: 100%; background: var(--pg-accent); transition: width linear; }
.pg-msg { position: absolute; left: 50%; top: 86px; transform: translateX(-50%); max-width: 92%; box-sizing: border-box; padding: 6px 22px; border-radius: 999px;
  font-size: 32px; font-weight: 700; line-height: 1.2; color: var(--pg-t1); background: var(--pg-s3); border: 2px solid var(--pg-line); white-space: normal; text-align: center; border-radius: 22px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; /* lời nhắc = câu cho người xem → 2 dòng, không cắt (Q8-6) */
  animation: pgMsg 3.2s ease-out both; z-index: 3; }
.pg-msg b { color: var(--pg-accent); }
@keyframes pgMsg { 0% { opacity: 0; transform: translate(-50%, -12px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* hàng người (top sát thương / 3 gần nhất) */
.pg-rows { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.pg-row { display: flex; align-items: center; gap: 12px; min-height: 50px; font-size: 36px; border-bottom: 1px dashed var(--pg-line); padding: 1px 8px; margin: 0 -8px; border-radius: 10px; }
.pg-row:nth-child(even) { background: rgba(255, 255, 255, .05); } /* hàng xen màu nền nhạt (ab 11/11) */
.pg-row:last-child { border-bottom: 0; }
.pg-row .rank { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .1); font-size: 30px; font-weight: 800; }
.pg-row:first-child .rank, .pg-row.gold .rank { color: var(--pg-on-accent); background: var(--pg-accent); }
.pg-row .cards-av, .pg-row .pg-av { flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 2px solid var(--pg-accent); background: rgba(255, 255, 255, .12);
  display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.pg-row .cards-av img, .pg-row .pg-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-row .cards-av.cards-av-art, .pg-row .pg-av.art { border-color: transparent; background: transparent; }
/* tên: cột có chỗ tối thiểu, pgd-games.js rút gọn "tên gọi + chữ cái đầu" (uname) nên không tới mép; ellipsis = lưới an toàn cho nick 1 từ (chỉ cắt TÊN) */
.pg-row .name { flex: 1; min-width: 6ch; overflow: hidden; white-space: nowrap; font-weight: 600; }
.pg-row .val { flex: none; min-width: 150px; text-align: right; font-size: 34px; color: var(--pg-t2); }
/* điểm: chữ chính; CHỈ hạng 1 / hàng vàng màu nhấn (ab 11/11) */
.pg-row .pts { flex: none; min-width: 110px; text-align: right; font-size: 36px; font-weight: 800; color: var(--pg-t1); }
.pg-row:first-child .pts, .pg-row.gold .pts { color: var(--pg-accent); }
.pg-row.empty { color: var(--pg-t3); font-size: 32px; }
.pg-row.new { animation: pgRow .45s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes pgRow { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

/* ---------- dải nhỏ y 958–1034: Đoán số chạy nền / Boss Gấu thu gọn khi Lớp đố chạy ---------- */
.pg-strip { position: absolute; left: var(--cards-side, 100px); right: var(--cards-side, 100px); bottom: calc(var(--pg-strip-bottom) - 4px); height: var(--pg-strip-h); z-index: 27;
  box-sizing: border-box; display: none; align-items: center; gap: 16px; padding: 0 22px; border-radius: 999px; pointer-events: none; font-family: var(--pg-font); color: var(--pg-t1);
  background: linear-gradient(180deg, var(--pg-s2), var(--pg-s1)); border: 2px solid var(--pg-line); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: pgIn .4s ease-out both; }
.pg-strip.show { display: flex; }
.pg-strip .ic { flex: none; font-size: 40px; line-height: 1; }
.pg-strip .lb { flex: none; font-size: 32px; font-weight: 800; color: var(--pg-accent); white-space: nowrap; }
.pg-strip .tx { flex: 1; min-width: 0; font-size: 32px; font-weight: 600; color: var(--pg-t2); white-space: nowrap; overflow: hidden; }
.pg-strip .tx b { color: var(--pg-t1); font-weight: 800; }
.pg-strip .tx .cmd { display: inline-block; font-size: 30px; font-weight: 800; color: var(--pg-on-accent); background: var(--pg-accent); border-radius: 8px; padding: 0 10px; margin: 0 4px; }
.pg-strip .hp { flex: 1; height: 22px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.pg-strip .hp i { display: block; height: 100%; width: 100%; background: var(--pg-down); transition: width .4s; }
.pg-strip .n { flex: none; font-size: 32px; font-weight: 800; color: var(--pg-t1); }
.pg-strip .num.low { color: var(--pg-down); }
/* thứ tự ưu tiên 1 dải: gấu > đoán số; bảng to đang mở → giấu dải (bảng tự lo) */
.game-on .pg-strip { display: none; }
.pg-strip.gau.show ~ .pg-strip.closing.show { display: none; }

/* ---------- Boss Gấu ---------- */
.pg-raid .pg-arena { position: relative; display: flex; align-items: center; gap: 22px; min-height: 230px; }
.pg-bear { position: relative; flex: none; width: 190px; height: 230px; display: flex; align-items: flex-end; justify-content: center; }
.pg-bear .sprite { width: 186px; height: 200px; background-repeat: no-repeat; transform-origin: 50% 100%; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .55)); }
.pg-bear .sprite::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 150px; height: 30px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .5), transparent 75%); z-index: -1; }
.pg-raid[data-phase="appear"] .pg-bear .sprite, .pg-raid[data-phase="fight"] .pg-bear .sprite { animation: pgStomp .5s ease-in-out infinite; }
.pg-raid.hurt .pg-bear .sprite { animation: pgHurt .35s ease-out both; }
.pg-raid[data-phase="win"] .pg-bear .sprite { animation: pgDazed 1.2s ease-in-out infinite; }
.pg-raid[data-phase="lose"] .pg-bear { animation: pgRunOff 2.4s ease-in .4s both; }
@keyframes pgStomp { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes pgHurt { 0% { transform: translateX(0); filter: brightness(2.2) drop-shadow(0 0 16px var(--pg-down)); } 30% { transform: translateX(-12px); } 60% { transform: translateX(10px); } 100% { transform: none; } }
@keyframes pgDazed { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes pgRunOff { to { transform: translateX(760px) scaleX(-1) translateX(0); opacity: 0; } }
.pg-bear .stars { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); font-size: 44px; line-height: 1; white-space: nowrap; display: none; }
.pg-raid[data-phase="win"] .pg-bear .stars { display: block; animation: pgStars 1.2s ease-in-out infinite; }
@keyframes pgStars { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px) scale(1.08); } }
/* thắng / thua: bỏ chú giải sát thương + chân bảng để bảng + Top 5 vừa cột (đáy ≤ 1040) */
.pg-raid[data-phase="win"] .pg-hits, .pg-raid[data-phase="lose"] .pg-hits, .pg-raid[data-phase="win"] .pg-foot, .pg-raid[data-phase="lose"] .pg-foot { display: none; }
.pg-raid[data-phase="win"] .pg-arena, .pg-raid[data-phase="lose"] .pg-arena { min-height: 176px; }
.pg-raid[data-phase="win"] .pg-bear, .pg-raid[data-phase="lose"] .pg-bear { height: 176px; }
.pg-raid[data-phase="win"] .pg-bear .sprite, .pg-raid[data-phase="lose"] .pg-bear .sprite { transform-origin: 50% 100%; scale: .86; }
.pg-raid[data-phase="win"] .pg-bear .stars { top: 0; }

.pg-hpbox { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.pg-hplab { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 32px; font-weight: 700; color: var(--pg-t2); }
.pg-hplab b { font-size: 48px; font-weight: 800; color: var(--pg-t1); }
.pg-hplab b small { font-size: 32px; font-weight: 600; color: var(--pg-t3); }
.pg-hp { position: relative; height: 40px; border-radius: 99px; background: rgba(0, 0, 0, .4); border: 2px solid var(--pg-line); overflow: hidden; }
.pg-hp i { display: block; height: 100%; width: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--pg-down), #FF7A5C); transition: width .45s cubic-bezier(.2, .8, .3, 1);
  box-shadow: 0 0 18px var(--pg-down-soft); }
.pg-hp i::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 28px, rgba(255, 255, 255, .14) 28px 30px); }
.pg-raid.half .pg-hp i { background: linear-gradient(90deg, var(--pg-accent), #FFD75E); }
.pg-raid[data-phase="win"] .pg-hp i { background: var(--pg-up); width: 0 !important; }
.pg-hits { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 30px; font-weight: 600; color: var(--pg-t2); }
.pg-hits span { white-space: nowrap; }
.pg-hits b { color: var(--pg-t1); font-weight: 800; }
.pg-cheer { display: inline-block; font-size: 30px; font-weight: 700; line-height: 1.3; color: var(--pg-on-accent); background: var(--pg-accent); border-radius: 999px; padding: 2px 16px; white-space: nowrap; max-width: 100%; overflow: hidden;
  vertical-align: middle; animation: pgCheer .45s cubic-bezier(.2, 1.3, .4, 1) both; }
.pg-cheer b { font-weight: 800; }
@keyframes pgCheer { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 100% { opacity: 1; transform: none; } }
.pg-raid h4 { margin: 0; font-size: 36px; font-weight: 800; color: var(--pg-accent); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pg-raid h4 small { font-size: 30px; font-weight: 600; color: var(--pg-t3); }
.pg-raid .pg-rows { min-height: 160px; }
.pg-result { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 16px; border-radius: 16px; font-size: 44px; font-weight: 800; text-align: center; line-height: 1.2; }
.pg-result.win { color: var(--pg-up); background: var(--pg-up-soft); border: 2px solid var(--pg-up); animation: pgFlip .5s ease-out both; }
.pg-result.lose { color: var(--pg-t2); background: rgba(255, 255, 255, .06); border: 2px dashed var(--pg-line); }
.pg-result small { display: block; font-size: 32px; font-weight: 600; color: var(--pg-t2); line-height: 1.2; }
@keyframes pgFlip { 0% { transform: rotateX(90deg); opacity: 0; } 60% { transform: rotateX(-12deg); opacity: 1; } 100% { transform: none; } }

/* ---------- Đua ngựa VN30 ---------- */
.pg-race .pg-lanes { display: flex; flex-direction: column; gap: 8px; }
.pg-lane { position: relative; display: grid; grid-template-columns: 140px 1fr 236px; align-items: center; gap: 12px; min-height: 92px; padding: 3px 10px 3px 6px; border-radius: 16px;
  background: rgba(255, 255, 255, .05); border: 2px solid transparent; }
.pg-lane .tag { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pg-lane .no { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; font-size: 30px; font-weight: 800; color: var(--pg-on-accent); background: var(--pg-accent); }
.pg-lane .sym { font-size: 40px; font-weight: 800; white-space: nowrap; }
.pg-lane .track { position: relative; height: 82px; border-radius: 12px; overflow: hidden;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 60px, rgba(255, 255, 255, .02) 60px 120px); border-bottom: 3px dashed var(--pg-line); }
.pg-lane .track::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--pg-ref); opacity: .55; }
.pg-lane .track::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 14px; background: repeating-linear-gradient(0deg, var(--pg-t1) 0 10px, var(--cards-bg, #000) 10px 20px); opacity: .7; }
.pg-horse { position: absolute; left: calc(var(--pos, 50) * 1%); bottom: 0; width: 108px; height: 78px; margin-left: -54px; transition: left 1.4s cubic-bezier(.3, .7, .4, 1); }
.pg-horse img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .55)); }
.pg-race[data-phase="run"] .pg-horse img { animation: pgGallop .42s ease-in-out infinite; }
.pg-lane:nth-child(2n) .pg-horse img { animation-delay: .14s; }
.pg-lane:nth-child(3n) .pg-horse img { animation-delay: .27s; }
@keyframes pgGallop { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-9px) rotate(3deg); } }
.pg-lane .dust { position: absolute; left: calc(var(--pos, 50) * 1% - 80px); bottom: 4px; width: 50px; height: 18px; border-radius: 50%; background: rgba(255, 255, 255, .18); filter: blur(4px); opacity: 0;
  transition: left 1.4s cubic-bezier(.3, .7, .4, 1); }
.pg-race[data-phase="run"] .pg-lane .dust { animation: pgDust .9s ease-out infinite; }
@keyframes pgDust { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: .8; } 100% { opacity: 0; transform: scale(1.6) translateX(-30px); } }
.pg-lane .pct { text-align: right; font-size: 40px; font-weight: 800; line-height: 1.1; }
.pg-lane .pct small { display: block; font-size: 30px; font-weight: 600; color: var(--pg-t3); white-space: nowrap; }
.pg-lane.stale .pct small { color: var(--pg-accent); }
.pg-lane.out { opacity: .45; }
.pg-lane.out .pg-horse { opacity: .35; }
.pg-lane.lead { border-color: var(--pg-accent); background: rgba(227, 178, 60, .08); }
.pg-lane.win { border-color: var(--pg-up); background: var(--pg-up-soft); animation: pgFlip .5s ease-out both; }
.pg-lane.win .no { background: var(--pg-up); }
.pg-race .pg-replay { flex: none; font-size: 30px; font-weight: 700; color: var(--pg-on-accent); background: var(--pg-ref); border-radius: 8px; padding: 2px 12px; white-space: nowrap; display: none; }
.pg-race[data-replay="1"] .pg-replay { display: inline-block; }
.pg-race[data-phase="finish"] .pg-chip { display: none; }
.pg-race .pg-flag { font-size: 44px; font-weight: 800; color: var(--pg-up); text-align: center; line-height: 1.15; }
.pg-race .pg-flag small { display: block; font-size: 32px; font-weight: 600; color: var(--pg-t2); }

/* ---------- Đoán số đóng cửa / mở cửa mai ---------- */
.pg-closing .pg-ref { display: flex; align-items: baseline; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 6px 0; }
.pg-closing .pg-ref span { font-size: 32px; font-weight: 600; color: var(--pg-t2); }
.pg-closing .pg-ref b { font-size: 84px; font-weight: 800; line-height: 1; }
.pg-closing .pg-how { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 34px; font-weight: 600; color: var(--pg-t2); text-align: center; white-space: nowrap; }
.pg-closing .pg-how .cmd { font-size: 36px; font-weight: 800; color: var(--pg-on-accent); background: var(--pg-accent); border-radius: 10px; padding: 2px 16px; white-space: nowrap; }
.pg-closing .pg-win { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; font-size: 30px; font-weight: 600; color: var(--pg-t3); white-space: nowrap; }
.pg-closing .pg-win b { color: var(--pg-t1); font-weight: 800; }
.pg-closing h4 { margin: 0; font-size: 36px; font-weight: 800; color: var(--pg-accent); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pg-closing h4 small { font-size: 30px; font-weight: 600; color: var(--pg-t3); }
.pg-closing .pg-actual { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }
.pg-closing .pg-actual span { font-size: 32px; font-weight: 600; color: var(--pg-t2); }
.pg-closing .pg-actual b { font-size: 92px; font-weight: 800; line-height: 1; animation: pgFlip .6s ease-out both; }
.pg-closing .pg-row .val { min-width: 150px; }
.pg-closing .pg-row .diff { flex: none; min-width: 150px; text-align: right; font-size: 30px; color: var(--pg-t3); }
.pg-closing .pg-row.gold .diff { color: var(--pg-t2); }

/* ---------- Ai là triệu phú CK ---------- */
.pg-ladder { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; }
.pg-step { position: relative; height: 50px; display: grid; place-items: center; border-radius: 10px; font-size: 30px; font-weight: 800; color: var(--pg-t3); background: rgba(255, 255, 255, .06); border: 2px solid transparent; }
.pg-step.safe { border-color: var(--pg-line); color: var(--pg-t2); }
.pg-step.safe::after { content: '🔒'; position: absolute; right: -6px; top: -16px; font-size: 28px; line-height: 1; }
.pg-step.passed { color: var(--pg-on-accent); background: var(--pg-accent); border-color: var(--pg-accent); }
.pg-step.cur { color: var(--pg-t1); background: var(--pg-s3); border-color: var(--pg-accent); box-shadow: 0 0 18px var(--pg-glow); animation: pgPulse 1.2s ease-in-out infinite; }
.pg-step.lost { color: var(--pg-down); border-color: var(--pg-down); background: var(--pg-down-soft); }
.pg-million .pg-q { margin: 0; font-size: 40px; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.pg-million .pg-body { gap: 10px; }
.pg-million .pg-q .lvl { display: inline-block; font-size: 30px; font-weight: 700; color: var(--pg-on-accent); background: var(--pg-accent); border-radius: 8px; padding: 1px 10px; margin-right: 10px; vertical-align: 6px; }
.pg-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pg-opts.long { grid-template-columns: 1fr; gap: 8px; } /* đáp án dài: 4 hàng, không cắt chữ */
.pg-opts.long .pg-opt { min-height: 62px; font-size: 32px; padding: 4px 14px; }
.pg-opts.long .pg-opt .tx { -webkit-line-clamp: 2; }
.pg-opt { position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 74px; box-sizing: border-box; padding: 6px 16px; border-radius: 14px;
  background: rgba(255, 255, 255, .07); border: 2px solid var(--pg-line); font-size: 36px; font-weight: 600; overflow: hidden; }
.pg-opt b.tag { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; font-size: 30px; font-weight: 800; color: var(--pg-on-accent); background: var(--pg-accent); }
.pg-opt .tx { flex: 1; min-width: 0; line-height: 1.22; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.pg-opt .n { flex: none; font-size: 32px; font-weight: 800; color: var(--pg-t2); }
.pg-opt .n:empty { display: none; }
.pg-opt .aud { position: absolute; left: 0; bottom: 0; height: 8px; width: calc(var(--p, 0) * 1%); background: var(--pg-accent); transition: width .6s ease-out; }
.pg-opt.hidden { opacity: .28; }
.pg-opt.hidden .tx { text-decoration: line-through; }
.pg-opt.room { border-color: var(--pg-accent); box-shadow: 0 0 16px var(--pg-glow); }
.pg-opt.call { border-color: var(--pg-ref); }
.pg-opt.call b.tag { box-shadow: 0 0 0 4px var(--pg-ref); }
.pg-opt.hit { background: var(--pg-up-soft); border-color: var(--pg-up); color: var(--pg-up); animation: pgFlip .5s ease-out both; }
.pg-opt.hit b.tag { background: var(--pg-up); }
.pg-opt.miss { background: var(--pg-down-soft); border-color: var(--pg-down); color: var(--pg-down); }
.pg-opt.miss b.tag { background: var(--pg-down); }
.pg-opt.dim { opacity: .45; }
.pg-helps { display: flex; gap: 10px; flex-wrap: wrap; }
.pg-help { flex: 1 1 auto; min-width: max-content; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 4px 14px; border-radius: 999px; font-size: 30px; font-weight: 700;
  color: var(--pg-t2); background: rgba(255, 255, 255, .06); border: 2px solid var(--pg-line); white-space: nowrap; }
.pg-help .ic { flex: none; font-size: 34px; line-height: 1; }
.pg-help .v { font-family: var(--pg-font-num); font-variant-numeric: tabular-nums; color: var(--pg-t1); }
.pg-help.used { opacity: .4; text-decoration: line-through; }
.pg-help.used .v { display: none; }
.pg-help.near { border-color: var(--pg-accent); color: var(--pg-t1); }
.pg-million .pg-callbox { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 4px 16px; min-height: 50px; border-radius: 14px; background: var(--pg-ref-soft); border: 2px dashed var(--pg-ref); font-size: 32px; font-weight: 700; white-space: nowrap; }
.pg-million .pg-callbox b { font-size: 40px; color: var(--pg-ref); }
.pg-million .pg-callbox small { font-size: 30px; font-weight: 600; color: var(--pg-t2); }
.pg-million .pg-seat { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 32px; font-weight: 600; color: var(--pg-t2); min-height: 46px; line-height: 1.25; }
.pg-million .pg-seat .pg-av, .pg-million .pg-seat .cards-av { flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 2px solid var(--pg-accent); background: rgba(255, 255, 255, .12); display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.pg-million .pg-seat img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-million .pg-seat b { color: var(--pg-t1); }
.pg-million .pg-intro { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; text-align: center; }
.pg-million .pg-intro .big { font-size: 96px; font-weight: 800; line-height: 1; letter-spacing: 1px; text-shadow: 0 0 24px rgba(255, 255, 255, .18); }
.pg-million .pg-intro .rules { font-size: 34px; font-weight: 600; color: var(--pg-t2); line-height: 1.35; }
.pg-ear { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 600; color: var(--pg-t2); }
.pg-ear .ic { font-size: 44px; line-height: 1; }
.pg-ear .bars { display: inline-flex; align-items: flex-end; gap: 5px; height: 40px; }
.pg-ear .bars i { width: 8px; border-radius: 4px; background: var(--pg-accent); height: 40%; animation: pgBar .9s ease-in-out infinite; }
.pg-ear .bars i:nth-child(2) { animation-delay: .15s; } .pg-ear .bars i:nth-child(3) { animation-delay: .3s; } .pg-ear .bars i:nth-child(4) { animation-delay: .45s; }
@keyframes pgBar { 0%, 100% { height: 30%; } 50% { height: 100%; } }
.pg-million .pg-result { flex-direction: column; gap: 6px; }
.pg-million .pg-result.win { color: var(--pg-accent); background: rgba(227, 178, 60, .12); border-color: var(--pg-accent); font-size: 56px; }
.pg-million .pg-result.safe { color: var(--pg-t1); background: rgba(255, 255, 255, .06); border: 2px solid var(--pg-line); }

/* ---------- toast huy hiệu (ev badge) ---------- */
.pg-badge { position: absolute; left: 50%; top: calc(var(--pg-top) + 24px); transform: translateX(-50%); z-index: 31; width: 760px; max-width: calc(100% - 2 * var(--cards-side, 100px)); box-sizing: border-box;
  display: none; align-items: center; gap: 18px; padding: 14px 24px; border-radius: 24px; pointer-events: none; font-family: var(--pg-font); color: var(--pg-t1);
  background: linear-gradient(135deg, var(--pg-s3), var(--pg-s1)); border: 3px solid var(--pg-accent); box-shadow: var(--pg-shadow), 0 0 50px var(--pg-glow); }
.pg-badge.show { display: flex; animation: pgBadgeIn .6s cubic-bezier(.2, 1.3, .4, 1) both; }
.pg-badge.over { top: auto; bottom: calc(var(--pg-bottom) + 20px); }
.pg-badge.out { animation: pgOut .3s ease-in both; }
@keyframes pgBadgeIn { 0% { opacity: 0; transform: translateX(-50%) scale(.6); } 100% { opacity: 1; transform: translateX(-50%) scale(1); } }
.pg-badge .pic { flex: none; width: 150px; height: 150px; display: grid; place-items: center; }
.pg-badge .pic img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 0 18px var(--pg-glow)); animation: pgSway 2.4s ease-in-out infinite; }
@keyframes pgSway { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.06); } }
.pg-badge .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pg-badge .ttl { font-size: 32px; font-weight: 700; color: var(--pg-t2); }
.pg-badge .lbl { font-size: 48px; font-weight: 800; color: var(--pg-accent); line-height: 1.1; white-space: nowrap; overflow: hidden; }
.pg-badge .who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 32px; font-weight: 600; min-width: 0; }
.pg-badge .who .pg-av, .pg-badge .who .cards-av { flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; border: 2px solid var(--pg-accent); background: rgba(255, 255, 255, .12); display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.pg-badge .who img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-badge .who .cards-av.cards-av-art, .pg-badge .who .pg-av.art { border-color: transparent; background: transparent; }
.pg-badge .who span { white-space: nowrap; max-width: 300px; overflow: hidden; }
.pg-badge .who small { font-size: 30px; color: var(--pg-t3); }
.pg-badge .disc { font-size: 30px; color: var(--pg-t3); }

@media (prefers-reduced-motion: reduce) {
  .pg-board, .pg-strip, .pg-badge.show, .pg-badge .pic img, .pg-bear .sprite, .pg-bear, .pg-horse img, .pg-lane .dust, .pg-row.new, .pg-msg, .pg-cheer, .pg-step.cur, .pg-clock.low,
  .pg-result.win, .pg-lane.win, .pg-opt.hit, .pg-closing .pg-actual b, .pg-ear .bars i, .pg-bear .stars { animation: none !important; }
  .pg-horse, .pg-lane .dust, .pg-hp i, .pg-opt .aud { transition: none; }
}
