/* ==========================================================================
 * TÚI ĐỒ — khung, ô vật phẩm theo độ hiếm, popup thông tin, mở lì xì/rương, vé số cào,
 * khung avatar (fr-*) & bong bóng chat (bb-*) dùng chung với Chat.
 * ========================================================================== */
.modal.bag-modal { position: relative; width: min(760px, calc(100vw - 24px)); height: min(86vh, 860px); max-height: 86vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff8ea; border: 5px solid #3a2420; border-radius: 26px; box-shadow: 0 9px 0 #1f1215, 0 24px 70px #0008; color: #2e211d; }
.bg-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: linear-gradient(135deg, #ff7a45, #e2423a 70%); border-bottom: 5px solid #3a2420; color: #fff6df; }
.bg-head small { font: 700 13px 'VT323', monospace; letter-spacing: 2px; color: #ffe0a8; }
.bg-head h2 { margin: 0; font: 800 clamp(26px, 4vw, 36px)/1.05 'Baloo 2', sans-serif; text-shadow: 0 3px 0 #9c2420; }
.bg-tabs { flex: none; display: flex; gap: 6px; padding: 10px 12px 8px; border-bottom: 3px solid #ecd2a8; overflow-x: auto; scrollbar-width: none; }
.bg-tabs::-webkit-scrollbar { display: none; }
.bg-tabs button { position: relative; flex: 1; min-width: max-content; padding: 8px 12px; background: #fff3d7; border: 2.5px solid #3a2420; border-radius: 13px; font: 800 14px 'Baloo 2', sans-serif; color: #3a2420; cursor: pointer; }
.bg-tabs button.on { background: #ffcf40; box-shadow: 0 3px 0 #9c651d; }
.bg-tabs button i { position: absolute; top: -8px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #e2423a; color: #fff; font: 800 12px/20px 'Be Vietnam Pro', sans-serif; font-style: normal; border: 2px solid #fff; }
.bg-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 18px; }
.bg-sub { font-weight: 700; color: #8a6f52; font-size: 13px; margin: 0 2px 8px; }

/* Bulk sale keeps its total and action visible while the parts grid scrolls. */
.bg-part-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.bg-part-heading h4 { min-width:0; margin:0; flex-wrap:wrap; }
.bg-part-heading .btn { flex:none; min-height:44px; padding:6px 10px; font-size:13px; }
.bg-part-tools { margin-bottom:12px; padding:10px; border:2px solid #e2c895; border-radius:12px; background:#fff3dd; }
.bg-part-tools p { margin:0 0 8px; font-size:12px; font-weight:600; line-height:1.45; color:#5a3a24; }
.bg-part-tools > div { display:flex; gap:8px; flex-wrap:wrap; }
.bg-part-tools .btn { flex:1; min-width:0; min-height:44px; padding:7px; font-size:13px; line-height:1.2; white-space:normal; }
.bg-cell.bg-part-selected { border-color:#25734a; background:#e3f5df; box-shadow:0 3px 0 #174e32, inset 0 0 0 2px #25734a; }
.bg-part-pick:disabled { opacity:.5; cursor:default; }
.bg-part-price { font:700 11px/1.35 'Be Vietnam Pro',sans-serif; color:#5a3a24; overflow-wrap:anywhere; }
.bg-part-check { display:flex; align-items:center; justify-content:center; gap:5px; font:800 11px/1.2 'Be Vietnam Pro',sans-serif; margin-top:auto; padding-top:4px; }
.bg-part-check i { display:grid; place-items:center; width:20px; height:20px; border:2px solid #6b5747; border-radius:5px; background:#fffdf6; font-style:normal; }
.bg-part-selected .bg-part-check i { border-color:#25734a; background:#25734a; color:#fff; }
.bg-part-bulk-footer { flex:none; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px calc(12px + env(safe-area-inset-bottom)); background:#fff3dd; border-top:3px solid #e2c895; }
.bg-part-bulk-footer > div { min-width:0; }
.bg-part-bulk-footer b, .bg-part-bulk-footer small { display:block; overflow-wrap:anywhere; }
.bg-part-bulk-footer b { font:800 15px/1.3 'Baloo 2',sans-serif; }
.bg-part-bulk-footer small { font-size:12px; font-weight:700; color:#25734a; margin-top:3px; }
.bg-part-bulk-footer .btn { min-height:44px; min-width:0; padding:8px 12px; font-size:13px; line-height:1.25; white-space:normal; }
.bag-modal [data-part-bulk]:focus-visible, .bag-modal [data-part-pick]:focus-visible { outline:3px solid #2f7cd6; outline-offset:3px; }
@media (max-width:600px) {
  .bg-part-heading h4 { font-size:14px; gap:5px; }
  .bg-part-heading .btn { padding-inline:8px; font-size:12px; }
  .bg-part-bulk-footer { display:grid; grid-template-columns:minmax(0,1fr); gap:7px; padding:8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .bg-part-bulk-footer > div { display:flex; align-items:baseline; justify-content:space-between; gap:8px; flex-wrap:wrap; }
  .bg-part-bulk-footer b { font-size:13px; }
  .bg-part-bulk-footer small { font-size:11px; margin:0; }
  .bg-part-bulk-footer .btn { width:100%; }
}

/* Băng lì xì + vé đang dùng */
.bg-banner { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; margin-bottom: 12px; border-radius: 16px; background: linear-gradient(120deg, #ffe7c2, #ffd08a); border: 2.5px solid #c9711c; box-shadow: 0 3px 0 #c9711c; }
.bg-banner img { width: 52px; height: 52px; image-rendering: pixelated; animation: bgWiggle 1.8s ease-in-out infinite; }
.bg-banner b { display: block; font: 800 17px 'Baloo 2', sans-serif; }
.bg-banner small { font-size: 12px; font-weight: 600; color: #7a4f1c; }
.bg-live { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.bg-live span { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #dff5e3; border: 1.5px solid #5bb56c; color: #1f5c2c; }

/* Nhóm + ô vật phẩm */
.bg-sec { margin-bottom: 14px; }
.bg-sec h4 { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; font: 800 16px 'Baloo 2', sans-serif; color: #5a3a24; }
.bg-sec h4 span { font: 700 16px 'VT323', monospace; color: #fff; background: #8a6f52; border-radius: 6px; padding: 0 6px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; }
.bg-cell { --rc: #8f7a5e; --rb: #fff6e6; position: relative; min-width: 0; padding: 7px 5px 6px; border: 2.5px solid var(--rc); border-radius: 15px; background: var(--rb); box-shadow: 0 3px 0 color-mix(in srgb, var(--rc) 70%, #000); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; color: #2e211d; transition: transform .12s; }
.bg-cell:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--rc) 70%, #000); }
.bg-cell.none { opacity: .45; filter: grayscale(.7); }
.bg-art { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #fff 0, transparent 70%); }
.bg-art img { width: 60px; height: 60px; image-rendering: pixelated; object-fit: contain; }
.bg-nm { font: 700 11.5px/1.2 'Be Vietnam Pro', sans-serif; text-align: center; min-height: 28px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bg-qty { position: absolute; top: 5px; right: 6px; font: 800 16px/1 'VT323', monospace; color: #fff; background: #2e211d; border-radius: 6px; padding: 2px 5px; }
.bg-new { position: absolute; top: -8px; left: -6px; font: 800 10px/1 'Be Vietnam Pro', sans-serif; font-style: normal; color: #fff; background: #e2423a; border: 2px solid #fff; border-radius: 8px; padding: 3px 5px; animation: bgPop .5s ease-out; }
.bg-eq { position: absolute; top: -8px; left: -6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #3fae55; color: #fff; font-style: normal; font-weight: 900; border: 2px solid #fff; }
.bg-cond { position: absolute; top: 5px; left: 6px; font: 800 14px/1 'VT323', monospace; font-style: normal; color: #1f5c2c; background: #dff5e3; border-radius: 5px; padding: 2px 4px; }
.bg-cond.low { color: #9c2420; background: #ffe0dc; }
.r-rare { --rc: #2f7cd6; --rb: #e8f2ff; }
.r-epic { --rc: #8b48d6; --rb: #f3e8ff; }
.r-epic .bg-art { background: radial-gradient(circle at 50% 40%, #fff 0, #e3ccff 45%, transparent 72%); }
.r-legend { --rc: #d98a0b; --rb: linear-gradient(135deg, #fff6c9, #ffd97a 55%, #ffb86b); }
.bg-cell.r-legend { background: var(--rb); }
.bg-cell.r-legend::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(110deg, transparent 40%, #ffffffaa 50%, transparent 60%) no-repeat; background-size: 250% 100%; background-position: 150% 0; animation: bgShine2 2.8s ease-in-out infinite; }
.bg-empty { text-align: center; padding: 30px 16px; color: #6b5747; }
.bg-empty img { width: 84px; height: 84px; image-rendering: pixelated; opacity: .6; }
.bg-empty b { display: block; font: 800 20px 'Baloo 2', sans-serif; margin: 6px 0; color: #3a2420; }
.bg-empty p { max-width: 36ch; margin: 0 auto 12px; font-size: 13.5px; }
.bg-log { margin-top: 6px; background: #fff3dd; border: 2px solid #e2c895; border-radius: 14px; padding: 8px 10px; }
.bg-log summary { font: 800 14px 'Baloo 2', sans-serif; cursor: pointer; }
.bg-log div { display: grid; grid-template-columns: 30px 1fr; gap: 2px 8px; align-items: center; padding: 6px 0; border-top: 1px dashed #e2c895; font-size: 12px; }
.bg-log img { grid-row: span 2; width: 30px; height: 30px; image-rendering: pixelated; }
.bg-log em { font-style: normal; color: #7a4f1c; font-weight: 600; }

/* Popup thông tin (bottom sheet) */
.bg-sheet-wrap { position: absolute; inset: 0; z-index: 30; background: #1b131799; display: flex; align-items: flex-end; justify-content: center; animation: bgFade .15s; }
.bg-sheet { --rc: #8f7a5e; position: relative; width: min(460px, 100%); max-height: 92%; overflow: auto; background: #fff8ea; border: 4px solid #3a2420; border-bottom: 0; border-radius: 24px 24px 0 0; padding: 16px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; animation: bgUp .24s cubic-bezier(.2, 1.2, .4, 1); box-shadow: 0 -10px 30px #0005; }
.bg-sheet::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 88px; background: radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--rc) 35%, transparent), transparent 70%); pointer-events: none; }
.bg-sheet .x-btn { position: absolute; top: 8px; right: 8px; z-index: 2; }
.bg-sheet-art { position: relative; width: 112px; height: 112px; display: grid; place-items: center; border-radius: 24px; background: #fff; border: 3px solid var(--rc); box-shadow: 0 0 0 5px color-mix(in srgb, var(--rc) 20%, transparent), 0 4px 0 color-mix(in srgb, var(--rc) 70%, #000); }
.bg-sheet-art img { width: 96px; height: 96px; image-rendering: pixelated; object-fit: contain; }
.bg-sheet.r-legend .bg-sheet-art { background: linear-gradient(135deg, #fff6c9, #ffd97a); animation: bgGlow 2s ease-in-out infinite; }
.bg-sheet.r-epic .bg-sheet-art { background: radial-gradient(circle, #fff, #ecdcff); }
.bg-sheet h3 { margin: 2px 0 0; font: 800 22px/1.15 'Baloo 2', sans-serif; }
.bg-pills { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.pill { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #f1e3c8; color: #5a3a24; }
.pill.r-common { background: #efe3cf; color: #6b5641; } .pill.r-rare { background: #2f7cd6; color: #fff; } .pill.r-epic { background: #8b48d6; color: #fff; } .pill.r-legend { background: linear-gradient(90deg, #f0a31a, #ffd23a); color: #5a3000; }
.pill.own { background: #2e211d; color: #fff; } .pill.warn { background: #ffe0dc; color: #9c2420; }
.bg-desc { margin: 2px 0; font-size: 14px; line-height: 1.45; color: #4a3528; max-width: 38ch; }
.bg-block { width: 100%; text-align: left; background: #fffdf6; border: 2px solid #ecd2a8; border-radius: 14px; padding: 9px 11px; }
.bg-block.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bg-block h5 { margin: 0 0 6px; font: 800 14px 'Baloo 2', sans-serif; color: #5a3a24; }
.bg-block p { margin: 4px 0; font-size: 13px; }
.bg-note { font-size: 12px !important; color: #7a6450; font-weight: 600; }
.bg-on { color: #1f7a38; font-weight: 800; }
.bg-eff { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-eff b, .bg-eff span { font-size: 12.5px; font-weight: 700; padding: 4px 9px; border-radius: 9px; background: #fff0c7; border: 1.5px solid #e1b35a; }
.bg-eff b { background: #dff5e3; border-color: #5bb56c; color: #1f5c2c; }
.bg-odds { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bg-odds td { padding: 4px 2px; border-bottom: 1px dashed #ecd2a8; }
.bg-odds td:last-child { text-align: right; font: 800 15px 'VT323', monospace; color: #7a4f1c; white-space: nowrap; }
.bg-odds tr.hot td { color: #b3261e; font-weight: 800; }
.bg-src { margin: 2px 0 0; font-size: 12px; color: #7a6450; font-weight: 600; }
.bg-actions { width: 100%; display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.bg-actions.row { flex-direction: row; justify-content: center; flex-wrap: wrap; }
.bg-actions .btn { width: 100%; }
.bg-actions.row .btn { width: auto; min-width: 130px; }
.bg-pcs { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; }
.bg-pcs .btn { padding: 5px 10px; font-size: 12px; }
.btn-purple { background: linear-gradient(#9a66e0, #7038b8); color: #fff; --edge: #54258f; --lip: #3f1a6e; }

/* Chip thưởng vật phẩm ở bảng nhiệm vụ */
.rw-items { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; margin-left: 6px; }
.rw-items i { --rc: #8f7a5e; display: inline-flex; align-items: center; gap: 1px; padding: 1px 5px 1px 1px; border-radius: 8px; background: #fff; border: 1.5px solid var(--rc); font: 800 12px 'VT323', monospace; font-style: normal; color: #3a2420; }
.rw-items img { width: 22px; height: 22px; image-rendering: pixelated; }

/* Màn mở lì xì / rương */
.bg-reveal { position: relative; isolation: isolate; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 18px 8px; border-radius: 20px; background: radial-gradient(circle at 50% 35%, #8a2a22 0, #4a1418 60%, #2a0c10 100%); color: #fff3d8; text-align: center; overflow: hidden; }
.bg-reveal.chest { background: radial-gradient(circle at 50% 35%, #6a4a2a 0, #3a2418 60%, #1f140c 100%); }
.bg-rays { position: absolute; inset: -40%; z-index: -1; background: repeating-conic-gradient(from 0deg, #ffd23a22 0 10deg, transparent 10deg 20deg); animation: kiSpin 12s linear infinite; }
.bg-reveal.jackpot .bg-rays { background: repeating-conic-gradient(from 0deg, #ffe07a55 0 8deg, #ff5ad833 8deg 12deg, transparent 12deg 20deg); animation-duration: 5s; }
.bg-shake { width: 150px; height: 150px; image-rendering: pixelated; animation: bgShake .9s ease-in-out both; filter: drop-shadow(0 0 18px #ffcf6aaa); }
.bg-reveal > b { font: 800 20px 'Baloo 2', sans-serif; letter-spacing: .04em; }
.bg-reveal h3 { margin: 0; font: 800 24px 'Baloo 2', sans-serif; color: #ffe3a3; }
.bg-jp { font: 800 clamp(34px, 9vw, 60px)/1 'Baloo 2', sans-serif; color: #fff2a8; text-shadow: 0 0 18px #ffd23a, 0 4px 0 #b3261e; animation: bgJackpot 1s cubic-bezier(.2, 1.6, .4, 1) both, bgGlowText 1.2s ease-in-out .9s infinite alternate; }
.bg-jp.small { font-size: clamp(26px, 6vw, 38px); }
.bg-rewards { display: grid; gap: 8px; width: min(420px, 100%); }
.bg-rw { --rc: #8f7a5e; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: #fff8ea; color: #2e211d; border: 2.5px solid var(--rc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 30%, transparent); text-align: left; animation: bgRw .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.bg-rw:nth-child(2) { animation-delay: .08s; } .bg-rw:nth-child(3) { animation-delay: .16s; } .bg-rw:nth-child(4) { animation-delay: .24s; } .bg-rw:nth-child(n+5) { animation-delay: .3s; }
.bg-rw img { width: 44px; height: 44px; image-rendering: pixelated; }
.bg-rw b { font: 800 15px 'Baloo 2', sans-serif; }
.bg-rw em { font: 800 18px 'VT323', monospace; font-style: normal; color: #7a4f1c; }
.bg-rw.money { grid-template-columns: 44px 1fr; }
.bg-rw.money b { font-size: 26px; color: #b36b00; }
.bg-rw.r-legend { background: linear-gradient(135deg, #fff6c9, #ffd97a); }
.bg-coin { font-size: 30px; text-align: center; }
.bg-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bg-confetti i { position: absolute; top: -12px; left: calc(var(--i) * 4.2%); width: 8px; height: 12px; background: hsl(calc(var(--i) * 37deg), 90%, 60%); animation: bgConfetti calc(1.6s + var(--i) * .05s) linear calc(var(--i) * .06s) infinite; }

/* Vé số cào */
.sc-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; text-align: center; }
.sc-wrap h3 { margin: 0; font: 800 22px 'Baloo 2', sans-serif; }
.sc-card { --rc: #48b35c; position: relative; width: min(340px, 100%); padding: 12px; border-radius: 18px; background: #fff6de; border: 4px solid var(--rc); box-shadow: 0 5px 0 color-mix(in srgb, var(--rc) 70%, #000); touch-action: none; }
.sc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sc-cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; background: #fffdf5; border: 2px dashed #d8c39a; }
.sc-cell b { font-size: 34px; line-height: 1; }
.sc-cell small { font: 800 18px 'VT323', monospace; color: #7a4f1c; }
.sc-cell.win { border: 3px solid #e39a12; background: #fff1b8; animation: bgPulse .8s ease-in-out infinite alternate; }
.sc-foil { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); border-radius: 12px; cursor: crosshair; touch-action: none; }
.sc-result { font: 800 18px 'Baloo 2', sans-serif; color: #6b5747; }
.sc-result.win { color: #1f7a38; } .sc-result.win b { font-size: 24px; color: #b36b00; }
.sc-result.jackpot { color: #b3261e; animation: bgJackpot .8s both; }

/* Xem trước trang phục */
.bg-preview { display: flex; align-items: center; gap: 14px; padding: 12px; margin-bottom: 14px; border-radius: 16px; background: #2e2438; }
.bg-say b { color: #ffe3a3; font: 800 14px 'Baloo 2', sans-serif; }
.bg-av { --fr: #d9c7a6; position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%; background: #f4e3c4; border: 4px solid var(--fr); display: grid; place-items: center; overflow: visible; }
.bg-av img { width: 52px; height: 52px; image-rendering: pixelated; border-radius: 50%; }
.bg-av.big { width: 96px; height: 96px; } .bg-av.big img { width: 80px; height: 80px; }
.bg-bubble { display: inline-block; margin: 4px 0 0; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: #fff; color: #2e211d; font-size: 13.5px; font-weight: 600; border: 2px solid #e6d3b3; }

/* ---- Khung avatar (dùng chung Chat) ---- */
.fr-wood { --fr: #9a6a36; border-color: #9a6a36 !important; box-shadow: 0 0 0 2px #5a3616; }
.fr-sakura { --fr: #ff8fbf; border-color: #ff8fbf !important; box-shadow: 0 0 0 2px #c24d83, 0 0 10px #ffc2dc; }
.fr-gold { --fr: #f2b51d; border-color: #f2b51d !important; box-shadow: 0 0 0 2px #8f6200, 0 0 12px #ffd25a; }
.fr-neon { --fr: #ff3fd0; border-color: #ff3fd0 !important; box-shadow: 0 0 0 2px #7a1570, 0 0 14px #ff3fd0, inset 0 0 8px #ff8ff0; animation: frNeon 1.4s ease-in-out infinite alternate; }
.fr-rgb { border-color: transparent !important; background: linear-gradient(#f4e3c4, #f4e3c4) padding-box, conic-gradient(#ff3b3b, #ffb23b, #fff23b, #3bff6a, #3bd5ff, #7a3bff, #ff3bd5, #ff3b3b) border-box !important; animation: frSpin 3s linear infinite; }
.fr-rgb > img { animation: frSpin 3s linear infinite reverse; }
.fr-dragon { --fr: #ff5a1f; border-color: #ff5a1f !important; box-shadow: 0 0 0 2px #7a1a0a, 0 0 16px #ff7a2a, 0 0 28px #ffd23a88; animation: frFire 1s ease-in-out infinite alternate; }
/* ---- Bong bóng chat (dùng chung Chat) ---- */
.bb-mint { background: #d6f7ea !important; border-color: #3a9c7a !important; color: #1f4f3e !important; }
.bb-gold { background: linear-gradient(135deg, #fff4c2, #ffe08a) !important; border-color: #c9951a !important; color: #5a3a00 !important; box-shadow: 0 0 8px #ffd25a88; }
.bb-neon { background: #15142a !important; border-color: #39f0ff !important; color: #bff9ff !important; text-shadow: 0 0 6px #39f0ff; box-shadow: 0 0 10px #39f0ff66; }
.bb-galaxy { background: radial-gradient(circle at 20% 30%, #ffffff55 0 1px, transparent 2px), radial-gradient(circle at 70% 60%, #ffffff66 0 1px, transparent 2px), linear-gradient(135deg, #2b1b5c, #4a2a8c 60%, #1b2a6c) !important; border-color: #b99cff !important; color: #fff !important; }
.bb-matrix { background: repeating-linear-gradient(90deg, #0b1f0b 0 10px, #0e2a0e 10px 12px) !important; border-color: #38e05a !important; color: #7dff96 !important; font-family: 'VT323', monospace !important; font-size: 16px !important; text-shadow: 0 0 6px #38e05a; }
.bb-lucky { background: linear-gradient(135deg, #e02a2a, #b3161a) !important; border-color: #ffd23a !important; color: #ffe9a0 !important; box-shadow: 0 0 0 2px #7a0e10, 0 0 12px #ffd23a88; }

/* Nút túi, lì xì bay, huy hiệu */
.side-action .badge.gold { background: linear-gradient(#ffcf40, #e39a12); color: #5a3000; }
.side-action.bump { animation: bgBump .5s cubic-bezier(.2, 1.8, .4, 1); }
.bag-fly { position: fixed; z-index: 150; width: 40px; height: 40px; image-rendering: pixelated; pointer-events: none; filter: drop-shadow(0 0 8px #ffd23a); }

@keyframes bgWiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-10deg); } 85% { transform: rotate(8deg); } 92% { transform: rotate(-4deg); } }
@keyframes bgShine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes bgPop { from { transform: scale(0); } }
@keyframes bgFade { from { opacity: 0; } }
@keyframes bgUp { from { transform: translateY(60px); opacity: 0; } }
@keyframes bgGlow { 50% { box-shadow: 0 0 0 5px #ffd23a55, 0 0 22px #ffd23a, 0 4px 0 #a86a00; } }
@keyframes bgShake { 0% { transform: scale(.6) rotate(0); opacity: 0; } 20% { transform: scale(1.05) rotate(-8deg); opacity: 1; } 35% { transform: rotate(8deg); } 50% { transform: rotate(-10deg); } 65% { transform: rotate(10deg) scale(1.1); } 85% { transform: rotate(-4deg) scale(1.25); filter: brightness(1.6) drop-shadow(0 0 30px #fff3a0); } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes bgJackpot { from { transform: scale(.2) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes bgGlowText { to { text-shadow: 0 0 34px #ffd23a, 0 4px 0 #b3261e; transform: scale(1.06); } }
@keyframes bgRw { from { transform: translateY(18px) scale(.9); opacity: 0; } }
@keyframes bgConfetti { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes bgPulse { to { transform: scale(1.06); box-shadow: 0 0 14px #ffd23a; } }
@keyframes bgBump { 40% { transform: scale(1.3); } }
@keyframes frSpin { to { transform: rotate(360deg); } }
@keyframes frNeon { to { box-shadow: 0 0 0 2px #7a1570, 0 0 22px #ff3fd0, inset 0 0 12px #ffb3f1; } }
@keyframes frFire { to { box-shadow: 0 0 0 2px #7a1a0a, 0 0 22px #ffb02a, 0 0 36px #ff5a1f; } }

@media (max-width: 600px) {
  .modal.bag-modal { width: calc(100vw - 12px); height: calc(100dvh - 18px); max-height: calc(100dvh - 18px); border-width: 4px; border-radius: 20px; }
  .bg-head { padding: 10px 12px; }
  .bg-body { padding: 10px 9px 16px; }
  .bg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .bg-art { width: 54px; height: 54px; } .bg-art img { width: 50px; height: 50px; }
  .bg-banner { grid-template-columns: 44px 1fr; } .bg-banner img { width: 44px; height: 44px; } .bg-banner .btn { grid-column: 1 / -1; }
  .bg-sheet { max-height: 94%; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-banner img, .bg-cell.r-legend::after, .bg-rays, .bg-shake, .bg-jp, .bg-rw, .bg-confetti i, .sc-cell.win, .fr-neon, .fr-rgb, .fr-rgb > img, .fr-dragon, .bg-sheet, .bg-sheet-wrap, .bg-sheet-art { animation: none !important; }
}
.bg-rev-icons { display: flex; gap: 6px; justify-content: center; }
.bg-rev-icons img { width: 64px; height: 64px; image-rendering: pixelated; filter: drop-shadow(0 0 10px #ffcf6a88); animation: bgPop .4s cubic-bezier(.2, 1.6, .4, 1); }
@media (max-width: 600px) { .bg-tabs { gap: 4px; padding: 8px 8px 6px; } .bg-tabs button { padding: 7px 3px; font-size: 12px; min-width: 0; white-space: nowrap; } }

/* ---------- Cửa hàng ---------- */
#btn-store { position: fixed; z-index: 19; padding: 0; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(#fff3c2, #ffcf5a); border: 1.5px solid #c9951a; border-radius: 12px; box-shadow: 0 3px 0 #a86a00, inset 0 1px 0 #fff; cursor: pointer; }
#btn-store span { display: none; }
#btn-store .pxi { height: 20px; }
#btn-store:active { transform: translateY(2px); box-shadow: 0 1px 0 #a86a00; }
#btn-store[hidden] { display: none; }
body.shop-visit-on #btn-store { display: none; }
.modal.store-modal { position: relative; width: min(720px, calc(100vw - 24px)); height: min(84vh, 820px); max-height: 84vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff8ea; border: 5px solid #3a2420; border-radius: 26px; box-shadow: 0 9px 0 #1f1215, 0 24px 70px #0008; color: #2e211d; }
.st-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: linear-gradient(135deg, #ffd24a, #ff9f2e 75%); border-bottom: 5px solid #3a2420; }
.st-head > div:first-child { flex: 1; }
.st-head small { font: 700 13px 'VT323', monospace; letter-spacing: 2px; color: #7a3f00; }
.st-head h2 { margin: 0; font: 800 clamp(26px, 4vw, 36px)/1.05 'Baloo 2', sans-serif; color: #3a2420; }
.st-money { display: flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; background: #fff8ea; border: 2px solid #3a2420; font: 800 14px 'Be Vietnam Pro', sans-serif; white-space: nowrap; }
.st-body { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px 18px; }
.st-hint { margin: 0 2px 10px; font-size: 12.5px; font-weight: 600; color: #7a6450; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.st-card { --rc: #8f7a5e; --rb: #fff6e6; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border-radius: 16px; background: var(--rb); border: 2.5px solid var(--rc); box-shadow: 0 3px 0 color-mix(in srgb, var(--rc) 70%, #000); text-align: center; }
.st-card.r-legend { background: linear-gradient(135deg, #fff6c9, #ffd97a); }
.st-look { width: 100%; min-height: 84px; display: grid; place-items: center; background: none; border: 0; cursor: pointer; padding: 0; }
.st-look > img { width: 72px; height: 72px; image-rendering: pixelated; }
.st-look .bg-bubble { font-size: 12px; }
.st-name { min-height: 2.4em; display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere; font: 800 14px/1.2 'Baloo 2', sans-serif; }
.st-tag { font-size: 11px; font-weight: 700; color: #7a6450; }
.st-tag.own { color: #1f7a38; }
.st-card-actions { width: 100%; margin-top: auto; padding-top: 2px; display: flex; flex-direction: column; gap: 6px; }
.st-buy, .st-quick { width: 100%; padding: 7px 6px !important; font-size: 13px !important; }
.st-card.off .st-look { opacity: .75; }
.st-bag { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 14px; }
@media (max-width: 600px) {
  .modal.store-modal { width: calc(100vw - 12px); height: calc(100dvh - 18px); max-height: calc(100dvh - 18px); border-width: 4px; border-radius: 20px; }
  .st-head { padding: 10px 12px; } .st-money { font-size: 12px; padding: 4px 8px; }
  .st-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .st-tabs button { font-size: 11.5px; padding: 7px 2px; }
}

/* ---------- Thanh XÂY DỰNG: danh mục, chỉ số, món sắp mở ---------- */
.bbar-cats { display: flex; align-items: center; gap: 6px; margin: 6px 0 4px; overflow-x: auto; scrollbar-width: none; }
.bbar-filters { display: flex; gap: 5px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.bbar-filters button { flex: none; border: 1px solid #ad9170; border-radius: 999px; background: #fff; color: #5d4132; padding: 3px 9px; font: 700 11px 'Baloo 2', sans-serif; cursor: pointer; }
.bbar-filters button.on { background: #533652; color: #fff; border-color: #533652; }
.bbar-cats button { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; border: 2px solid #3a2420; background: #fff3d7; font: 800 13px 'Baloo 2', sans-serif; color: #3a2420; cursor: pointer; }
.bbar-cats button.on { background: #ffcf40; box-shadow: 0 2px 0 #9c651d; }
.bbar-cats button i { font: 800 14px 'VT323', monospace; font-style: normal; background: #3a2420; color: #fff; border-radius: 6px; padding: 0 5px; }
.bbar-gift { font-size: 12px; font-weight: 800; color: #1f7a38; background: #dff5e3; border-radius: 999px; padding: 4px 10px; }
.bitem small { display: block; font-size: 10px; font-weight: 700; color: #6b5747; white-space: nowrap; }
.bitem.locked { opacity: .6; filter: grayscale(.8); cursor: not-allowed; }
.bitem.locked b { font-size: 10.5px; color: #9c2420; }
.bbar-stats { margin-top: 4px; padding: 5px 10px; border-radius: 10px; background: #fff3dd; border: 1.5px solid #e2c895; font-size: 12px; font-weight: 600; color: #4a3528; }
.st-bag { flex-direction: row !important; }
@media (max-width: 600px) { .st-head small { display: none; } }

/* ---------- Danh hiệu: 5 bậc Thường → Thần thoại ---------- */
.ttl { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; padding: 2px 8px 2px 5px; margin: 0 4px; border-radius: 999px; font: 800 11.5px/1.3 'Be Vietnam Pro', sans-serif; white-space: nowrap; border: 1.5px solid transparent; }
.ttl i { font-style: normal; font-size: 12px; }
.ttl.sm { font-size: 10.5px; padding: 1px 6px 1px 4px; }
.ttl.t1 { background: #efe3cf; color: #6b5641; border-color: #d5c2a2; }
.ttl.t2 { background: linear-gradient(90deg, #dcecff, #b9d8ff, #dcecff); background-size: 200% 100%; color: #17508f; border-color: #6aa6e8; animation: ttlSlide 3s linear infinite; }
.ttl.t3 { background: linear-gradient(135deg, #7a3fd0, #b476ff); color: #fff; border-color: #d9b8ff; box-shadow: 0 0 8px #b476ffaa; }
.ttl.t4 { background: linear-gradient(90deg, #f0a31a, #ffe27a, #f0a31a); background-size: 200% 100%; color: #5a3000; border-color: #fff1b0; box-shadow: 0 0 10px #ffc94a; animation: ttlSlide 2s linear infinite; position: relative; }
.ttl.t4::after { content: '✦'; position: absolute; top: -6px; right: -3px; font-size: 9px; color: #fff6c2; text-shadow: 0 0 4px #ffd23a; animation: ttlTwinkle 1.4s ease-in-out infinite; }
.ttl.t5 { background: linear-gradient(90deg, #ff3b6b, #ffb23b, #3bff9a, #3bc8ff, #b43bff, #ff3b6b); background-size: 300% 100%; color: #fff; text-shadow: 0 1px 2px #0008; border-color: #fff; box-shadow: 0 0 12px #ff6bd5aa, 0 0 22px #6bd5ff66; animation: ttlSlide 2.4s linear infinite; position: relative; }
.ttl.t5::before, .ttl.t5::after { content: '✦'; position: absolute; font-size: 9px; color: #fff; text-shadow: 0 0 6px #fff; animation: ttlTwinkle 1.2s ease-in-out infinite; }
.ttl.t5::before { top: -6px; left: 2px; } .ttl.t5::after { bottom: -6px; right: 4px; animation-delay: .6s; }
@keyframes ttlSlide { to { background-position: 200% 0; } }
@keyframes ttlTwinkle { 50% { opacity: .2; transform: scale(.6); } }
.bg-titles { display: grid; gap: 6px; }
.bg-title { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 12px; background: #fffdf6; border: 2px solid #ecd2a8; }
.bg-title small { font-size: 11.5px; font-weight: 600; color: #7a6450; }
.bg-title.locked { opacity: .65; } .bg-title.locked .ttl { filter: grayscale(1); }
.bg-title .btn.small { padding: 5px 10px; font-size: 12px; }
.bg-rank-title { grid-template-columns: minmax(0, 1fr) auto; }
.bg-rank-title .ttl { justify-self: start; margin-left: 0; }
.bg-rank-title small { grid-column: 1 / -1; grid-row: 2; overflow-wrap: anywhere; }
.bg-rank-title .btn { grid-column: 2; grid-row: 1; }
.bg-preview .rank-title-grace, .bg-rank-title .rank-title-grace { display: inline-grid; grid-template-columns: 17px minmax(0, 1fr) auto; gap: 3px 4px; }
.bg-preview .rank-title-grace { width: 100%; }
.bg-preview .rank-title-grace .rank-title-countdown, .bg-rank-title .rank-title-grace .rank-title-countdown { grid-column: 2 / -1; justify-self: end; border-left: 0; border-top: 1px solid #ffffff33; padding: 2px 0 0; font-size: 11px; }
.bg-rank-title.grace { border-color: #dfa25e; background: #fff5df; }
.bg-rank-title.grace > small { color: #824517; }
.bg-rank-countdown { display: inline-block; border: 1px solid #bf8240; border-radius: 5px; background: #3a241b; color: #ffe7aa; padding: 1px 5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bg-rank-grace-note { display: block; margin-top: 3px; color: #735235; font-size: 10.5px; }
.sc-fr { display: inline-flex; border-radius: 50%; border: 3px solid transparent; }
.sc-fr:not([class*="fr-"]) { border: 0; }
@media (prefers-reduced-motion: reduce) { .ttl, .ttl::before, .ttl::after { animation: none !important; } }
.ach-rw { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; margin-top: 4px; }
.ach-rw em { font-style: normal; font: 800 14px 'VT323', monospace; color: #b36b00; background: #fff3c2; border-radius: 6px; padding: 0 5px; }
.ach-rw .rw-items { margin-left: 0; }
.ach:not(.got) .ach-rw { opacity: .85; }
/* Bong bóng chat trang phục: chữ, giờ, tên đổi màu theo nền */
.sc-bubble[class*="bb-"] .sc-text { color: inherit !important; }
.sc-bubble[class*="bb-"] time, .sc-bubble[class*="bb-"] .sc-st, .sc-bubble[class*="bb-"] .sc-more { color: inherit !important; opacity: .75; }
.sc-bubble.bb-neon .sc-name, .sc-bubble.bb-galaxy .sc-name, .sc-bubble.bb-matrix .sc-name, .sc-bubble.bb-lucky .sc-name { color: #ffe3a3 !important; }
.sc-bubble.bb-mint .sc-name { color: #1f6b52 !important; } .sc-bubble.bb-gold .sc-name { color: #8f5a00 !important; }

/* ---------- KIẾM THÊM ---------- */
.gig-sum { margin-bottom: 10px; padding: 8px 12px; border-radius: 12px; background: #e5f7e7; border: 2px solid #7cc38a; font-size: 13px; font-weight: 600; }
.gig { margin-bottom: 10px; padding: 10px 12px; border-radius: 14px; background: #fffaf0; border: 2px solid #e2c895; }
.gig.locked { opacity: .6; }
.gig-head { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.gig-head b { font: 800 15px 'Baloo 2', sans-serif; }
.gig-head small { display: block; font-size: 12px; color: #6b5747; font-weight: 600; line-height: 1.35; }
.gig-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 13px; }
.gig-row small { color: #8a6f52; font-weight: 600; }
.gig-jobs { display: grid; gap: 6px; margin-top: 8px; }
.gig-job { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: 10px; background: #fff; border: 1.5px solid #ecd2a8; }
.gig-job b { display: block; font-size: 13px; } .gig-job small { font-size: 12px; color: #b36b00; font-weight: 700; }
.gig-job.done { opacity: .6; } .gig-job em { font-style: normal; font-weight: 800; color: #1f7a38; font-size: 12px; }
.rep-market.gigs { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.rep-night { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; padding: 9px 12px; border-radius: 14px; background: linear-gradient(135deg, #2a2450, #3e3170); color: #eae4ff; }
.rep-night span { font-size: 13px; } .rep-night b { color: #ffe07a; } .rep-night small { display: block; font-size: 11px; color: #bdb3e8; }
/* Cài Win */
.mg-area.win { position: relative; height: 220px; border-radius: 12px; background: linear-gradient(#0a6ad1, #064b98); overflow: hidden; }
.win-btn { position: absolute; padding: 6px 12px !important; font-size: 13px !important; }
.win-btn.shake { animation: kiShake .3s; }
/* Livestream */
.ls-stage { position: relative; height: 260px; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 20%, #5a2a8c, #1b1033 75%); }
.ls-lanes { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.ls-lane { position: relative; border-right: 1px dashed #ffffff22; }
.ls-note { position: absolute; left: 50%; top: 0; width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 12px currentColor; }
.ls-note.l0 { background: #ff5c57; color: #ff5c57; } .ls-note.l1 { background: #ffcf40; color: #ffcf40; } .ls-note.l2 { background: #3fa0ff; color: #3fa0ff; }
.ls-note.hit { transform: scale(1.6); opacity: 0; transition: .2s; } .ls-note.miss { opacity: .2; }
.ls-line { position: absolute; left: 0; right: 0; top: 88%; height: 4px; background: #fff; box-shadow: 0 0 14px #fff; }
.ls-hud { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; justify-content: space-between; color: #fff; font: 800 16px 'Baloo 2', sans-serif; }
.ls-combo { color: #ffe07a; }
.ls-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.ls-btn { font-size: 26px !important; padding: 12px 0 !important; touch-action: manipulation; }
/* Dòng tiền thưởng: icon + số tiền căn giữa khung */
.bg-rw.money { display: flex; justify-content: center; align-items: center; gap: 12px; text-align: center; padding: 12px 16px; }
.bg-rw.money .bg-coin { font-size: 34px; line-height: 1; }
.bg-rw.money b { font-size: 30px; line-height: 1; }

/* ---------- Trang phục: tab con + xem trước ---------- */
.bg-subtabs { display: flex; gap: 6px; margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; }
.bg-subtabs::-webkit-scrollbar { display: none; }
.bg-subtabs button { flex: 1; min-width: max-content; padding: 7px 10px; border-radius: 999px; border: 2px solid #3a2420; background: #fff3d7; font: 800 13px 'Baloo 2', sans-serif; color: #3a2420; cursor: pointer; white-space: nowrap; }
.bg-subtabs button.on { background: #ffcf40; box-shadow: 0 2px 0 #9c651d; }
.bg-subtabs button i { font: 800 13px 'VT323', monospace; font-style: normal; opacity: .75; }
.bg-av.sm { width: 50px; height: 50px; border-width: 3px; }
.bg-av.sm img { width: 40px; height: 40px; }
.bg-cell.cos .bg-art { width: 64px; height: 60px; }
.bg-bubble.mini { margin: 0; padding: 5px 9px; font-size: 11px; border-radius: 10px 10px 10px 3px; }
.st-own { margin: -4px 2px 8px; font-size: 12px; font-weight: 700; color: #1f7a38; }
.st-tiers { display: flex; gap: 5px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.st-tiers::-webkit-scrollbar { display: none; }
.st-tiers button { flex: none; padding: 5px 11px; border-radius: 999px; border: 2px solid #3a2420; background: #fff3d7; font: 800 12.5px 'Baloo 2', sans-serif; color: #3a2420; cursor: pointer; }
.st-tiers button.on { background: #ffcf40; box-shadow: 0 2px 0 #9c651d; }
@media (max-width: 600px) { .bg-subtabs button { padding: 6px 8px; font-size: 12px; } }
.st-head h2 { white-space: nowrap; }
@media (max-width: 600px) { .st-head h2 { font-size: 24px; } .st-money { font-size: 11.5px; } }

@keyframes bgShine2 { 0%, 55% { background-position: 150% 0; } 85%, 100% { background-position: -50% 0; } }
/* Dấu ✓ / MỚI nằm trên cùng, không bị ô bên cạnh che */
.bg-eq, .bg-new { z-index: 2; }
.bg-tabs button i.gold { background: linear-gradient(#ffcf40, #e39a12); color: #5a3000; }
.bg-subtabs button { position: relative; }
.bg-dot { position: absolute; top: -8px; right: -4px; padding: 1px 6px; border-radius: 999px; background: #e2423a; color: #fff; border: 2px solid #fff; font: 800 10px/1.4 'Be Vietnam Pro', sans-serif; }
.bg-subtabs { padding-top: 8px; }

/* ---------- Nhân viên: đào tạo, kỹ năng, mảnh, sa thải ---------- */
.hr-stats .over b { color: #b36b00; } .hr-stats .over meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, #ffcf40, #ff8a3d); }
.hr-subtitle small { font-size: 11px; color: #7a6450; font-weight: 600; margin-left: 4px; }
.hr-away { margin: 8px 0; padding: 7px 10px; border-radius: 10px; background: #e6f1ff; border: 1.5px solid #6aa6e8; font-size: 12.5px; font-weight: 700; color: #17508f; }
.hr-courses { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hr-course { text-align: left; padding: 7px 9px; border-radius: 12px; border: 2px solid #d9b98a; background: #fffaf0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; color: #2e211d; }
.hr-course b { font: 800 13px 'Baloo 2', sans-serif; } .hr-course small { font-size: 11px; color: #6b5747; line-height: 1.3; } .hr-course em { font-style: normal; font-weight: 800; font-size: 11.5px; color: #1f7a38; }
.hr-course i { font-style: normal; font-size: 10.5px; color: #b3261e; font-weight: 700; }
.hr-course.off { opacity: .6; }
.hr-skills { display: grid; gap: 6px; }
.hr-skill { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 12px; background: #f3e8ff; border: 2px solid #b98fe6; }
.hr-skill.lv2 { background: #fff1c2; border-color: #e0a020; } .hr-skill.lv3 { background: linear-gradient(135deg, #ffe3f1, #e3f4ff); border-color: #ff6bd5; box-shadow: 0 0 8px #ff6bd566; }
.hr-skill-ic { font-size: 22px; text-align: center; } .hr-skill b { font: 800 13px 'Baloo 2', sans-serif; display: block; } .hr-skill small { font-size: 11px; color: #5a4a3a; }
.hr-skill-act { display: flex; flex-direction: column; gap: 4px; } .hr-skill-act em { font-style: normal; font-weight: 800; font-size: 11px; color: #8b48d6; text-align: center; }
.hr-shards { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; padding: 7px 10px; border-radius: 12px; background: #fff3dd; border: 1.5px dashed #d9b98a; font-size: 12.5px; }
.hr-shards small { color: #7a6450; font-size: 10.5px; }
.hr-note { font-size: 12px; color: #7a6450; margin: 4px 0; }
.hr-detail-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ===== XÂY DỰNG: popup mua & kho ===== */
.bitem { position: relative; }
.bitem .bstock, .bitem .bqty { position: absolute; top: 3px; right: 3px; font: 800 12px/1 'Baloo 2', sans-serif; font-style: normal; color: #fff; background: #2f7fd0; border-radius: 999px; padding: 3px 6px; box-shadow: 0 1px 0 #1b4f86; z-index: 1; }
.bitem .bqty { background: #3a2420; box-shadow: none; font: 800 15px/1 'VT323', monospace; padding: 2px 6px; }
.bitem.owned { background: #eef7ff; border-color: #8fb8e0; box-shadow: 0 2px 0 #6d9cc9; }
.bitem.owned.gift { background: #effbef; border-color: #8ccc97; box-shadow: 0 2px 0 #5fae6c; }
.bitem.owned b.own { color: #2f7fd0; font-size: 12px; letter-spacing: .5px; }
.bitem.owned.gift b.own { color: #1f7a38; }
.bbar-cats button.stash.has { background: #dcecff; }
.bbar-cats button.stash.has.on { background: #ffcf40; }
.bbar-cats button.stash.has i { background: #2f7fd0; }
.bbar-empty { margin: 8px 6px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #6b5747; white-space: normal; }
.modal.bb-buy { position: relative; width: min(380px, 94vw); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 18px 16px 16px; }
.modal.bb-buy .x-btn { position: absolute; top: 8px; right: 8px; }
.modal.bb-buy h2 { margin: 2px 0 0; font: 800 22px/1.15 'Baloo 2', sans-serif; padding: 0 36px; }
.bb-art { width: 112px; height: 112px; display: grid; place-items: center; border-radius: 22px; background: radial-gradient(circle, #fff, #fff0cf); border: 3px solid #d4ba88; box-shadow: 0 4px 0 #c6a771; }
.modal.bb-buy .bb-art img { width: auto; height: 92px; max-width: 96px; max-height: none; image-rendering: pixelated; }
.bb-desc { margin: 0; font-size: 13.5px; color: #5a4636; }
.bb-spec { margin: 0; font-size: 11.5px; font-weight: 700; color: #8a7058; }
.bb-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.bb-stats span { background: #fff3d7; border: 1.5px solid #e2c992; border-radius: 999px; padding: 3px 9px; font-size: 12.5px; font-weight: 700; color: #4a3528; }
.bb-own { display: flex; gap: 14px; font-size: 13px; color: #6b5747; }
.bb-own b { color: #3a2420; font-size: 15px; }
.bb-own .bb-stock { color: #2f7fd0; }
.bb-qty { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.bb-qty .btn { width: 44px; height: 44px; padding: 0; font-size: 24px; line-height: 1; }
.bb-qty .bb-n { min-width: 36px; font: 800 28px/1 'VT323', monospace; }
.bb-acts { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.bb-acts .btn { flex: 1; min-height: 48px; }
.bb-acts .btn.big { flex: 1.6; }

/* ===== TẶNG QUÀ BẠN BÈ ===== */
.bg-actions .st-gift { margin-top: 0; }
.gf-wrap { z-index: 40; }
.gf-sheet { align-items: stretch; text-align: left; gap: 10px; max-height: 86%; }
.gf-top { display: flex; align-items: center; gap: 12px; padding-right: 44px; }
.gf-top > div:last-child { display: flex; flex-direction: column; min-width: 0; }
.gf-top small { font: 800 11px 'Baloo 2', sans-serif; letter-spacing: .1em; color: #c2410c; }
.gf-top b { font: 800 18px/1.15 'Baloo 2', sans-serif; }
.gf-top em { font-style: normal; font-weight: 800; color: #1f7a38; }
.gf-art { flex: none; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 16px; background: #fff; border: 3px solid var(--rc); overflow: hidden; }
.gf-art .gf-img { width: 56px; height: 56px; image-rendering: pixelated; }
.gf-art .bg-av { transform: scale(.8); }
.gf-art .bg-bubble { font-size: 10px; transform: scale(.85); }
.gf-body { display: flex; flex-direction: column; gap: 8px; min-height: 120px; overflow: auto; }
.gf-note { margin: 0; font-size: 12.5px; color: #6b5747; text-align: center; }
.gf-note.err { color: #b3261e; font-weight: 700; }
.gf-list { display: flex; flex-direction: column; gap: 6px; }
.gf-friend { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 14px; border: 2px solid #3a2420; background: #fffaf0; box-shadow: 0 2px 0 #3a2420; font: inherit; color: #2e211d; text-align: left; cursor: pointer; }
.gf-friend:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.gf-friend:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; border-color: #c9b99b; }
.gf-friend span { display: flex; flex-direction: column; min-width: 0; }
.gf-friend b { font: 800 14px 'Baloo 2', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gf-friend small { font-size: 11.5px; color: #8a7058; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gf-friend em { font-style: normal; font-weight: 800; font-size: 12px; color: #8a7058; }
.gf-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; text-align: center; font-weight: 800; color: #5a4636; }
.gf-empty small { font-weight: 600; color: #8a7058; }
.gf-confirm { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.gf-confirm p { margin: 0; font-size: 15px; }
.gf-confirm small { font-size: 11.5px; color: #8a7058; }
.gf-acts { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.gf-acts .btn { flex: 1; min-height: 46px; }
.gf-acts .btn.big { flex: 1.8; }
.modal.gf-picker-modal { width:min(460px,calc(100vw - 24px)); max-height:calc(100dvh - 40px); border-bottom:4px solid #3a2420; border-radius:24px; }
.gf-picker-modal .gf-top h2 { font:800 19px/1.25 'Baloo 2',sans-serif; margin:0; }
.gf-picker-modal .gf-top small { letter-spacing:0; }
.gf-quantity { width:100%; padding:12px; border:2px solid #dfcaa2; border-radius:14px; background:#fff1c8; }
.gf-quantity label { display:block; font-weight:800; margin-bottom:8px; }
.gf-quantity > div { display:flex; justify-content:center; align-items:center; gap:10px; }
.gf-quantity .btn { width:44px; height:44px; min-width:44px; padding:0; }
.gf-quantity input { width:72px; min-height:44px; border:2px solid #8a6f52; border-radius:10px; text-align:center; font:800 18px var(--font); background:#fffdf5; color:var(--ink); }
.gf-quantity input[aria-invalid="true"] { border-color:#b3261e; }
.gf-quantity small { display:block; margin-top:8px; }
.gf-transfer-status { text-align:center; }
.gf-transfer-status .btn { width:100%; min-height:48px; }
/* Popup nhận quà */
.modal.gf-modal { width: min(360px, 94vw); overflow: hidden; }
.gf-pop { --rc: #8f7a5e; position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 4px 4px 2px; }
.gf-pop.r-rare { --rc: #3d8fe0; } .gf-pop.r-epic { --rc: #9b59d0; } .gf-pop.r-legend { --rc: #e0a020; }
.gf-pop > small { font: 800 12px 'Baloo 2', sans-serif; letter-spacing: .12em; color: #c2410c; z-index: 1; }
.gf-rays { position: absolute; left: 50%; top: 150px; width: 360px; height: 360px; margin: -180px 0 0 -180px; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 22%, transparent) 0 12deg, transparent 12deg 24deg); border-radius: 50%; animation: gfSpin 12s linear infinite; pointer-events: none; opacity: .8; }
@keyframes gfSpin { to { transform: rotate(360deg); } }
.gf-from { display: flex; align-items: center; gap: 8px; z-index: 1; font-size: 13px; color: #6b5747; }
.gf-from b { font: 800 15px 'Baloo 2', sans-serif; color: #2e211d; }
.gf-box { z-index: 1; width: 120px; height: 120px; display: grid; place-items: center; border-radius: 26px; background: #fff; border: 4px solid var(--rc); box-shadow: 0 0 0 6px color-mix(in srgb, var(--rc) 20%, transparent), 0 5px 0 color-mix(in srgb, var(--rc) 70%, #000); animation: gfPop .5s cubic-bezier(.2, 1.6, .4, 1); font-size: 56px; }
.gf-box .gf-img { width: 96px; height: 96px; image-rendering: pixelated; }
@keyframes gfPop { from { transform: scale(.3) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.gf-pop h2 { margin: 2px 0 0; font: 800 21px/1.15 'Baloo 2', sans-serif; z-index: 1; }
.gf-pop .pill { z-index: 1; }
.gf-pop .btn.big { z-index: 1; width: 100%; min-height: 50px; margin-top: 4px; }
.gf-modal .auto-cd { position: relative; z-index: 1; }
/* Dòng quà trong chat riêng */
.sc-gift { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 14px; background: linear-gradient(135deg, #fff4d6, #ffe0ec); border: 2px dashed #f0a24a; }
.sc-gift-ic { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #fff; font-size: 26px; }
.sc-gift-ic img { width: 38px; height: 38px; image-rendering: pixelated; }
.sc-gift > span:last-child { display: flex; flex-direction: column; color: #3a2420; }
.sc-gift b { font: 800 13.5px 'Baloo 2', sans-serif; }
.sc-gift small { font-size: 12px; color: #8a4b12; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .gf-rays, .gf-box { animation: none; } }

/* Compact inventory / store details: controls stay outside the scroll area. */
.modal.bag-modal, .modal.store-modal { max-height:calc(var(--ui-vh,100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.bg-detail-sheet { max-height:96%; padding:0; gap:0; align-items:stretch; overflow:hidden; text-align:left; }
.bg-sheet-head { position:relative; flex:none; display:grid; grid-template-columns:72px minmax(0,1fr) 44px; align-items:center; gap:12px; padding:14px 12px 12px; border-bottom:2px solid #ecd2a8; }
.bg-detail-sheet .bg-sheet-art { width:64px; height:64px; border-radius:16px; }
.bg-detail-sheet .bg-sheet-art img { width:54px; height:54px; }
.bg-sheet-title { min-width:0; }
.bg-detail-sheet h3 { margin:0 0 6px; font-size:20px; line-height:1.2; overflow-wrap:anywhere; }
.bg-detail-sheet .bg-pills { justify-content:flex-start; }
.bg-detail-sheet .pill { padding:3px 7px; font-size:11px; line-height:1.35; }
.bg-detail-sheet .x-btn { position:static; width:44px; height:44px; min-width:44px; align-self:start; }
.bg-sheet-body { min-height:0; overflow:auto; overscroll-behavior:contain; display:flex; flex-direction:column; gap:10px; padding:12px; }
.bg-sheet-body > * { flex:none; }
.bg-sheet-body .bg-desc { max-width:none; font-size:13px; margin:0; }
.bg-sheet-body .bg-src { font-size:11.5px; line-height:1.45; }
.bg-sheet-body .bg-note { margin:0; line-height:1.4; }
.bg-detail-sheet .bg-pcs { max-height:none; overflow:visible; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.bg-detail-sheet .bg-pcs .btn { min-width:0; min-height:44px; white-space:normal; }
.bg-say { min-width:0; }
.bg-say > b { overflow-wrap:anywhere; }
.bg-sheet-actions { flex:none; padding:10px 12px calc(12px + env(safe-area-inset-bottom)); border-top:2px solid #ecd2a8; background:#fff3dd; }
.bg-sheet-actions .bg-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; }
.bg-sheet-actions .btn { min-width:0; min-height:44px; padding:8px 7px; font-size:13px; line-height:1.2; white-space:normal; overflow-wrap:anywhere; }
.bg-sheet-actions .btn:only-child, .bg-sheet-actions .bg-actions:has(> .btn:nth-child(3):last-child) > .btn:first-child { grid-column:1/-1; }
.bg-details { padding:0; }
.bg-details summary { min-height:44px; padding:9px 10px; font:800 14px/1.3 'Baloo 2',sans-serif; cursor:pointer; }
.bg-details summary small { display:block; margin-left:16px; font:600 11px/1.3 'Be Vietnam Pro',sans-serif; color:#7a6450; }
.bg-details[open] summary small { display:none; }
.bg-details-body { padding:0 10px 9px; }
.bg-detail-sheet .bg-odds { font-size:12px; }
.bg-detail-sheet .bg-odds td { padding:5px 2px; line-height:1.35; }
.bg-details summary:focus-visible { outline:3px solid #2f7cd6; outline-offset:2px; border-radius:10px; }
.st-footer { flex:none; padding:8px 12px calc(10px + env(safe-area-inset-bottom)); border-top:2px solid #ecd2a8; background:#fff3dd; }
.st-footer .st-bag { margin:0; min-height:44px; font-size:14px; padding:8px; }
.st-head > div:first-child { min-width:0; }
.st-head h2 { white-space:normal; overflow-wrap:anywhere; }
.st-body { overscroll-behavior:contain; }
.st-tiers { flex-wrap:wrap; overflow:visible; gap:6px; }
.st-tiers button { min-height:44px; padding:6px 10px; }
.st-tier-filter { display:flex; align-items:center; gap:10px; margin-bottom:10px; font-size:12px; font-weight:800; }
.st-tier-filter select { flex:1; min-width:0; min-height:44px; border:2px solid #8a6f52; border-radius:10px; padding:6px 10px; background:#fffdf5; color:#3a2420; font:700 16px 'Be Vietnam Pro',sans-serif; }
.st-buy, .st-quick { min-height:44px; }
.bag-modal .bg-tabs button, .store-modal .bg-tabs button { min-height:44px; }
.bag-modal .bg-playing { display:flex; overflow:hidden; padding:8px; }
.bg-playing > .bg-reveal, .bg-playing > .sc-wrap { flex:1; width:100%; min-height:0; padding:10px; gap:0; overflow:hidden; }
.bg-result-scroll { flex:1; min-height:0; width:100%; overflow:auto; overscroll-behavior:contain; display:flex; flex-direction:column; align-items:center; gap:10px; padding:4px 4px 12px; }
.bg-result-scroll > * { flex:none; }
.bg-result-scroll .bg-rewards { min-width:0;max-width:100%; }
.bg-result-scroll .bg-rw { min-width:0;grid-template-columns:36px minmax(0,1fr) auto;gap:8px;padding:8px; }
.bg-result-scroll .bg-rw > b { min-width:0;overflow-wrap:anywhere; }
.bg-result-scroll .bg-rw img { width:36px;height:36px;object-fit:contain; }
.bg-result-scroll .bg-rw.money { grid-template-columns:28px minmax(0,1fr); }
.bg-result-scroll .bg-rw.money b { font-size:clamp(16px,5vw,26px); }
.bg-result-scroll .bg-coin { display:grid;place-items:center; }
.bg-result-scroll .bg-coin .pxi { height:24px;width:auto; }
.bg-playing .bg-actions { flex:none; margin-top:8px; padding-top:8px; border-top:2px solid #e2c992; gap:8px; }
.bg-playing .bg-actions .btn { flex:1; min-width:0; min-height:44px; padding:8px; font-size:13px; line-height:1.25; }
.sc-wrap .bg-result-scroll .bg-note { margin:0; }
.sc-wrap .sc-card { width:min(300px,100%); }
@media (max-width:600px) {
  .bag-modal .bg-tabs, .store-modal .bg-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); overflow:visible; gap:6px; padding:8px; }
  .bag-modal .bg-tabs button, .store-modal .bg-tabs button { min-height:44px; padding:5px 3px; font-size:12px; white-space:normal; line-height:1.2; }
  .bg-head { padding:7px 10px; border-bottom-width:3px; }
  .bg-head small { display:none; }
  .bg-head h2 { font-size:24px; }
  .bg-head .x-btn, .st-head .x-btn { min-width:44px; width:44px; height:44px; }
  .st-head { display:grid; grid-template-columns:minmax(0,1fr) 44px; gap:4px 8px; padding:7px 10px; border-bottom-width:3px; }
  .st-head h2 { font-size:24px; }
  .st-head .x-btn { grid-column:2; grid-row:1/3; }
  .st-money { justify-self:start; min-width:0; font-size:11px; padding:3px 7px; }
  .bg-sheet-head { grid-template-columns:56px minmax(0,1fr) 44px; gap:8px; padding:10px; }
  .bg-detail-sheet .bg-sheet-art { width:52px; height:52px; border-radius:13px; }
  .bg-detail-sheet .bg-sheet-art img { width:44px; height:44px; }
  .bg-detail-sheet h3 { font-size:18px; }
  .bg-detail-sheet .pill { padding:3px 6px; font-size:10.5px; }
  .bg-detail-sheet .bg-pills { gap:4px; }
  .bg-sheet-body { gap:8px; padding:10px; }
  .bg-sheet-actions { padding:8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .bg-banner b { font-size:15px; }
  .bg-grid { gap:8px; }
}
@media (max-height:500px) and (min-width:601px) {
  .modal.bag-modal, .modal.store-modal { height:calc(100dvh - 20px); max-height:calc(100dvh - 20px); }
  .bg-head, .st-head { padding:6px 10px; border-bottom-width:3px; }
  .bg-head small, .st-head small { display:none; }
  .bg-head h2, .st-head h2 { font-size:24px; }
  .bg-tabs { padding:6px 8px; }
  .bg-tabs button { min-height:44px; padding:5px 8px; }
  .bg-sheet-head { padding:8px 10px; }
  .bg-detail-sheet .bg-sheet-art { width:52px; height:52px; }
  .bg-detail-sheet .bg-sheet-art img { width:44px; height:44px; }
  .bg-sheet-actions { padding-block:8px; }
}
