/* PriceGenie — tab "Game" (theme game-*): chi tiết riêng từng theme + bộ Game FX.
   Màu nền: themes-more.css · nền động: theme-fx.js · thành tựu / XP / combo: theme-game.js.
   Đèn rọi, nút hút, hiện thẻ khi cuộn, vòng tròn đổi theme: dùng chung FX 2.0 (theme-hot.css / theme-fx2.js). */

@property --game-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

html[data-theme^="game-"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { position: relative; }
html[data-theme^="game-"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
}
html[data-theme^="game-"] :is(.kpi-tile, .mon-tile) .kpi-value,
html[data-theme^="game-"] :is(.kpi-tile, .mon-tile) :is(.kpi-num, .mon-num) { font-variant-numeric: tabular-nums; }

/* ---------- Game FX: độ hiếm của đơn (Live Orders) ---------- */
html[data-theme^="game-"] #orders-table tr:is(.u-fresh, .u-warn, .u-hot) > td:first-child { box-shadow: inset 3px 0 0 var(--rar); }
html[data-theme^="game-"] #orders-table tr.u-fresh { --rar: #3d8bff; }
html[data-theme^="game-"] #orders-table tr.u-warn { --rar: #a855f7; }
html[data-theme^="game-"] #orders-table tr.u-hot { --rar: #f5a623; }
html[data-theme^="game-"] #orders-table tr:is(.u-fresh, .u-warn, .u-hot) > td {
    background-image: linear-gradient(90deg, color-mix(in srgb, var(--rar) 10%, transparent), transparent 40%);
}
html[data-theme^="game-"].pg-fx-on #orders-table tr.u-hot > td:first-child { animation: pg-game-legend 1.8s ease-in-out infinite; }
@keyframes pg-game-legend {
    0%, 100% { box-shadow: inset 3px 0 0 var(--rar); }
    50% { box-shadow: inset 5px 0 0 var(--rar), inset 14px 0 18px -12px var(--rar); }
}

/* ---------- Game FX: thanh XP, thành tựu, combo ---------- */
.pg-xp { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 1085; pointer-events: none; background: color-mix(in srgb, var(--color-primary) 14%, transparent); }
.pg-xp > i { display: block; height: 100%; width: var(--xp, 0%); background: linear-gradient(90deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 40%, #fff)); box-shadow: 0 0 10px var(--color-primary); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.pg-xp > b { position: absolute; right: 10px; top: 5px; font: 700 10.5px/1 ui-monospace, Consolas, monospace; letter-spacing: .06em; padding: 3px 6px; border-radius: 4px;
    background: color-mix(in srgb, var(--bg-surface) 88%, transparent); color: var(--color-primary); border: 1px solid color-mix(in srgb, var(--color-primary) 40%, transparent); }
.pg-xp.is-up > b { animation: pg-game-pop .7s ease; }

.pg-ach { position: fixed; right: 18px; bottom: 18px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.pg-ach > div { display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 340px; padding: 10px 14px 10px 10px; border-radius: 12px;
    background: color-mix(in srgb, var(--bg-surface) 94%, transparent); color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--color-primary) 45%, transparent);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45), 0 0 22px -6px var(--color-primary);
    animation: pg-game-ach-in .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.pg-ach > div.is-out { animation: pg-game-ach-out .35s ease-in both; }
.pg-ach .ach-ic { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; font-size: 20px;
    background: radial-gradient(circle at 35% 30%, #fff6, transparent 60%), var(--color-primary); }
.pg-ach .ach-t { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--color-primary); font-weight: 700; }
.pg-ach .ach-n { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.pg-ach .ach-x { margin-left: auto; font: 700 12px ui-monospace, Consolas, monospace; color: var(--color-primary); }
@keyframes pg-game-ach-in { from { opacity: 0; transform: translateX(40px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes pg-game-ach-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes pg-game-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

.pg-combo { position: fixed; z-index: 1090; pointer-events: none; font: italic 900 18px/1 system-ui, sans-serif; color: var(--color-primary);
    text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 12px var(--color-primary); animation: pg-game-combo .8s ease-out both; white-space: nowrap; }
@keyframes pg-game-combo { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -14px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -44px) scale(1); } }

/* rung màn khi đánh (Fighting KO) — chỉ vùng nội dung */
html.pg-shake :is(.app-main, main) { animation: pg-game-shake .28s linear; }
@keyframes pg-game-shake { 0%, 100% { translate: 0 0; } 20% { translate: -4px 2px; } 40% { translate: 4px -2px; } 60% { translate: -3px -1px; } 80% { translate: 2px 1px; } }

/* ---------- Loot Legendary ---------- */
html[data-theme="game-loot"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after {
    padding: 1.5px; background: conic-gradient(from var(--game-a), #9e9e9e, #3d8bff, #a855f7, #f5a623, #9e9e9e);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
    opacity: .35; animation: pg-game-spin 10s linear infinite;
}
html[data-theme="game-loot"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile):hover::after { opacity: .9; }
html[data-theme="game-loot"] .btn-primary { background-image: linear-gradient(180deg, #ffc44d, #f5a623 55%, #c97f0a); border-color: #ffcf70; color: #1a0f00; box-shadow: 0 0 16px rgba(245, 166, 35, .4); }
html[data-theme="game-loot"] :is(h1, .h1, .page-title) { color: #ffcf70; text-shadow: 0 0 18px rgba(245, 166, 35, .45); }
@keyframes pg-game-spin { to { --game-a: 360deg; } }

/* ---------- Battle Royale ---------- */
html[data-theme="game-royale"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-radius: 4px; border-color: rgba(194, 180, 142, .25); }
html[data-theme="game-royale"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after {
    background: linear-gradient(90deg, #ff8a1f 0 18px, transparent 18px) 0 0 / 100% 2px no-repeat;
}
html[data-theme="game-royale"] :is(h1, .h1, .page-title, .card-header, th) { text-transform: uppercase; letter-spacing: .07em; }
html[data-theme="game-royale"] .btn { border-radius: 3px; }
html[data-theme="game-royale"] .btn-primary { color: #1a0c00; }

/* ---------- MOBA Lane: thanh máu dưới thẻ ---------- */
html[data-theme="game-moba"] :is(.kpi-tile, .mon-tile, .src-card)::after {
    inset: auto 10px 6px 10px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, #2fbf71 0 var(--hp, 78%), rgba(255, 77, 94, .5) var(--hp, 78%) 100%);
}
html[data-theme="game-moba"] :is(.card, .og-card, .panel) { border-color: rgba(61, 139, 255, .3); }
html[data-theme="game-moba"] :is(.card, .og-card, .panel)::after { box-shadow: inset 0 1px 0 rgba(61, 139, 255, .35); }
html[data-theme="game-moba"] .btn-primary { box-shadow: 0 0 14px rgba(61, 139, 255, .45); }

/* ---------- Gacha Summon: thẻ lật khi vào trang ---------- */
html[data-theme="game-gacha"].pg-fx-on :is(.kpi-tile, .mon-tile, .src-card) { animation: pg-game-flip .7s cubic-bezier(.2, .9, .3, 1.2) both; }
html[data-theme="game-gacha"].pg-fx-on :is(.kpi-tile, .mon-tile, .src-card):nth-child(2) { animation-delay: .08s; }
html[data-theme="game-gacha"].pg-fx-on :is(.kpi-tile, .mon-tile, .src-card):nth-child(3) { animation-delay: .16s; }
html[data-theme="game-gacha"].pg-fx-on :is(.kpi-tile, .mon-tile, .src-card):nth-child(4) { animation-delay: .24s; }
html[data-theme="game-gacha"].pg-fx-on :is(.kpi-tile, .mon-tile, .src-card):nth-child(n+5) { animation-delay: .32s; }
html[data-theme="game-gacha"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after { box-shadow: inset 0 0 0 1px rgba(255, 211, 110, .28), inset 0 0 26px rgba(165, 180, 255, .07); }
html[data-theme="game-gacha"] .btn-primary { background-image: linear-gradient(135deg, #ffe08f, #ffd36e 45%, #ff9ae6); border-color: transparent; color: #1a1200; }
@keyframes pg-game-flip { from { opacity: 0; transform: perspective(700px) rotateY(-90deg); } to { opacity: 1; transform: none; } }

/* ---------- Esports Arena: bảng điểm ---------- */
html[data-theme="game-esports"] :is(.kpi-tile, .mon-tile) { border-color: rgba(0, 229, 255, .35); }
html[data-theme="game-esports"] :is(.kpi-tile, .mon-tile)::after { background: linear-gradient(180deg, rgba(0, 229, 255, .12), transparent 35%); }
html[data-theme="game-esports"] :is(h1, .h1, .page-title) { text-transform: uppercase; font-style: italic; font-weight: 900; letter-spacing: .04em;
    background: linear-gradient(90deg, #00e5ff, #7c4dff, #ff2bd6); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-theme="game-esports"] .btn { clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); border-radius: 0; }
html[data-theme="game-esports"] .btn-primary { color: #00131a; }

/* ---------- Fantasy MMO: khung chạm khắc ---------- */
html[data-theme="game-mmo"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-color: rgba(252, 211, 77, .25); }
html[data-theme="game-mmo"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after {
    inset: 4px; border-radius: calc(var(--bs-card-border-radius, 8px) - 3px); border: 1px solid rgba(52, 211, 153, .2);
}
html[data-theme="game-mmo"] :is(h1, .h1, .page-title) { font-family: 'Noto Serif', 'Times New Roman', serif; color: #fcd34d; text-shadow: 0 0 14px rgba(52, 211, 153, .35); }
html[data-theme="game-mmo"] .btn-primary { background-image: linear-gradient(180deg, #5ee3b0, #34d399 60%, #1f9e70); border-color: #a7f3d0; color: #02140c; }

/* ---------- Space Shooter ---------- */
html[data-theme="game-shooter"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-color: rgba(56, 189, 248, .3); border-radius: 6px; }
html[data-theme="game-shooter"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after {
    background: linear-gradient(rgba(56, 189, 248, .7), rgba(56, 189, 248, .7)) 0 0 / 22px 2px no-repeat, linear-gradient(rgba(56, 189, 248, .7), rgba(56, 189, 248, .7)) 100% 100% / 22px 2px no-repeat;
}
html[data-theme="game-shooter"] .btn-primary { box-shadow: 0 0 14px rgba(56, 189, 248, .45); color: #001321; }

/* ---------- Retro Arcade: chữ điểm cao + khung pixel ---------- */
html[data-theme="game-arcade"] :is(h1, .h1, .page-title, .kpi-value, th) { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .04em; }
html[data-theme="game-arcade"] :is(h1, .h1, .page-title) { text-transform: uppercase; color: #fff200; text-shadow: 3px 3px 0 #ff3df2, -1px -1px 0 #00f0ff; }
html[data-theme="game-arcade"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-radius: 0; border: 2px solid rgba(0, 240, 255, .45); box-shadow: 4px 4px 0 rgba(255, 61, 242, .35); }
html[data-theme="game-arcade"] .btn { border-radius: 0; box-shadow: 3px 3px 0 rgba(0, 0, 0, .5); }
html[data-theme="game-arcade"] .btn:active { translate: 2px 2px; box-shadow: 1px 1px 0 rgba(0, 0, 0, .5); }
html[data-theme="game-arcade"] .btn-primary { color: #1a0018; }

/* ---------- Speed Racing: sọc đua ---------- */
html[data-theme="game-racing"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after {
    background: repeating-linear-gradient(90deg, #ef4444 0 10px, #f5f5f5 10px 20px) 0 0 / 100% 3px no-repeat; opacity: .7;
}
html[data-theme="game-racing"] :is(h1, .h1, .page-title) { font-style: italic; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
html[data-theme="game-racing"] .btn { transform: skewX(-8deg); }
html[data-theme="game-racing"] .btn-primary { color: #1a0000; box-shadow: 0 0 14px rgba(239, 68, 68, .45); }

/* ---------- Cozy Farm: thẻ gỗ ---------- */
html[data-theme="game-farm"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-radius: 16px; border: 2px solid #d6c3a0; box-shadow: 0 4px 0 #c4ad84; }
html[data-theme="game-farm"] .btn { border-radius: 999px; }
html[data-theme="game-farm"] .btn-primary { box-shadow: 0 3px 0 #2f5d17; }
html[data-theme="game-farm"] .btn-primary:active { translate: 0 2px; box-shadow: 0 1px 0 #2f5d17; }

/* ---------- Fighting KO ---------- */
html[data-theme="game-fight"] :is(h1, .h1, .page-title) { font-style: italic; font-weight: 900; text-transform: uppercase; color: #ffd23f; text-shadow: 3px 3px 0 #a3220a, 0 0 18px rgba(255, 90, 31, .5); }
html[data-theme="game-fight"] :is(.kpi-tile, .mon-tile, .src-card)::after {
    inset: auto 10px 6px 10px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #ffd23f, #ff5a1f 70%, rgba(255, 255, 255, .12) 70%);
}
html[data-theme="game-fight"] .btn:active { transform: scale(.94); }
html[data-theme="game-fight"] .btn-primary { color: #1a0600; }

/* ---------- Mecha Hangar: sọc cảnh báo + ốc vít ---------- */
html[data-theme="game-mecha"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-radius: 3px; border-color: #3a4247; }
html[data-theme="game-mecha"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile)::after {
    background:
        radial-gradient(circle, #6b767c 2px, transparent 2.5px) 6px 6px / 8px 8px no-repeat,
        radial-gradient(circle, #6b767c 2px, transparent 2.5px) calc(100% - 6px) 6px / 8px 8px no-repeat,
        radial-gradient(circle, #6b767c 2px, transparent 2.5px) 6px calc(100% - 6px) / 8px 8px no-repeat,
        radial-gradient(circle, #6b767c 2px, transparent 2.5px) calc(100% - 6px) calc(100% - 6px) / 8px 8px no-repeat,
        repeating-linear-gradient(-45deg, #facc15 0 8px, #111 8px 16px) 0 0 / 100% 3px no-repeat;
}
html[data-theme="game-mecha"] :is(h1, .h1, .page-title, th) { text-transform: uppercase; letter-spacing: .08em; }
html[data-theme="game-mecha"] .btn { border-radius: 2px; }
html[data-theme="game-mecha"] .btn-primary { color: #171300; }

/* ---------- Candy Match: kẹo bóng ---------- */
html[data-theme="game-candy"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-radius: 20px; }
html[data-theme="game-candy"] .btn { border-radius: 999px; }
html[data-theme="game-candy"] .btn-primary { background-image: linear-gradient(180deg, #ff6f9a, #d6336c); border-color: transparent; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15), inset 0 2px 0 rgba(255, 255, 255, .4); }
html[data-theme="game-candy"] .btn:hover { animation: pg-game-boing .5s ease; }
@keyframes pg-game-boing { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.1, .9); } 55% { transform: scale(.95, 1.06); } 80% { transform: scale(1.02, .98); } }

/* ---------- Survival Craft: ô túi đồ ---------- */
html[data-theme="game-craft"] :is(.card, .og-card, .panel, .kpi-tile, .src-card, .mon-tile) { border-radius: 0; border: 2px solid #0a0c07; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .08), inset -2px -2px 0 rgba(0, 0, 0, .35); }
html[data-theme="game-craft"] :is(h1, .h1, .page-title) { font-family: ui-monospace, Consolas, monospace; text-shadow: 2px 2px 0 rgba(0, 0, 0, .6); }
html[data-theme="game-craft"] .btn { border-radius: 0; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .2), inset -2px -2px 0 rgba(0, 0, 0, .3); }
html[data-theme="game-craft"] .btn-primary { color: #0c1400; }

/* ---------- dừng khi tắt hiệu ứng / giảm chuyển động ---------- */
html[data-theme^="game-"]:not(.pg-fx-on) *, html[data-theme^="game-"]:not(.pg-fx-on) *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
    html[data-theme^="game-"] *, html[data-theme^="game-"] *::after, .pg-ach > div, .pg-combo { animation: none !important; }
}
