/* Royal Chess Crown League 5811237 — CSS của runtime HTML5 gốc (goc/client_axmol/Content/index.html) giữ nguyên ở phần đầu;
   phần SỬA cho căn hộ hub nằm ở cuối tệp, sau dòng "==== CĂN HỘ HUB ====". */
  @font-face {
    font-family: 'DigiiMonoStd';
    src: url('../assets/font/DigiiMonoStd.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
  }
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'DigiiMonoStd', monospace, sans-serif;
  }
  html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at 50% 18%, #1e2a4a 0%, #0d1324 58%, #070a14 100%);
    color: #f8fafc;
  }
  #app-root {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)) 10px;
    position: relative;
  }
  /* TOP BRAND & STATUS HEADER */
  .top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: linear-gradient(180deg, rgba(28, 39, 68, 0.96) 0%, rgba(15, 22, 42, 0.96) 100%);
    border: 1.5px solid #d4af37;
    border-radius: 10px;
    padding: 5px 8px;
    min-height: 50px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  }
  .brand-cluster {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    flex: 1;
  }
  .brand-logo-img {
    height: 26px;
    max-width: 86px;
    width: auto;
    object-fit: contain;
    border-radius: 5px;
    border: 1px solid rgba(212, 175, 55, 0.65);
    flex-shrink: 0;
  }
  .brand-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .brand-main {
    font-size: 9.5px;
    font-weight: 700;
    color: #fde047;
    letter-spacing: 0.15px;
    line-height: 1.15;
  }
  .brand-sub {
    font-size: 8px;
    color: #93c5fd;
    letter-spacing: 0.1px;
    line-height: 1.15;
  }
  .treasury-cluster {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }
  .stat-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(9, 13, 26, 0.9);
    border: 1px solid #f59e0b;
    border-radius: 7px;
    padding: 3px 6px;
    font-size: 10.5px;
    font-weight: 700;
    color: #fef08a;
  }
  .stat-pill img {
    width: 14px;
    height: 14px;
    object-fit: contain;
  }
  .btn-top-vault {
    background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
    color: #090d16;
    border: 1px solid #fef08a;
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    min-width: 64px;
    text-align: center;
  }
  /* MODE & TOURNAMENT BAR */
  .mode-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    height: 36px;
    flex-shrink: 0;
  }
  .mode-btn {
    background: rgba(20, 30, 56, 0.92);
    border: 1px solid #475569;
    border-radius: 7px;
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s ease;
  }
  .mode-btn.active {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
  }
  .mode-btn img {
    width: 14px;
    height: 14px;
    object-fit: contain;
  }
  /* OPPONENT & PLAYER CARDS */
  .player-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    padding: 4px 8px;
    height: 46px;
    flex-shrink: 0;
  }
  .player-strip.active-turn {
    border-color: #facc15;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.96) 0%, rgba(49, 46, 129, 0.85) 100%);
  }
  .player-meta {
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .avatar-frame {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1.5px solid #d4af37;
    overflow: hidden;
    background: #0f172a;
    flex-shrink: 0;
  }
  .avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .player-info-col {
    display: flex;
    flex-direction: column;
  }
  .player-name {
    font-size: 11px;
    font-weight: 700;
    color: #f8fafc;
  }
  .player-sub {
    font-size: 9px;
    color: #94a3b8;
  }
  .cup-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(30, 27, 75, 0.85);
    border: 1px solid #818cf8;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 10px;
    color: #e0e7ff;
    cursor: pointer;
  }
  .cup-badge img {
    width: 18px;
    height: 18px;
    object-fit: contain;
  }
  .clock-box {
    background: #090d16;
    border: 1px solid #38bdf8;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #38bdf8;
    min-width: 62px;
    text-align: center;
  }
  /* MAIN CHESSBOARD CONTAINER */
  .board-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    min-height: 0;
    padding: 2px 0;
  }
  .board-frame {
    width: min(92vw, 46vh);
    height: min(92vw, 46vh);
    position: relative;
    border: 2.5px solid #d4af37;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
    overflow: hidden;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    padding: 1.9% 3.6% 7.4% 3.9%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
  }
  .sq-cell {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .sq-cell.selected {
    background: rgba(250, 204, 21, 0.48) !important;
    box-shadow: inset 0 0 0 2px #fde047;
  }
  .sq-cell.last-move {
    background: rgba(56, 189, 248, 0.30);
  }
  .sq-cell.in-check {
    background: rgba(239, 68, 68, 0.62) !important;
    box-shadow: inset 0 0 0 2px #fca5a5;
  }
  .legal-dot {
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.88);
    border: 1.5px solid #ffffff;
    pointer-events: none;
    z-index: 4;
  }
  .legal-capture-ring {
    position: absolute;
    inset: 3px;
    border-radius: 6px;
    border: 2.5px solid #ef4444;
    background: rgba(239, 68, 68, 0.24);
    pointer-events: none;
    z-index: 4;
  }
  .piece-sprite {
    width: 84%;
    height: 84%;
    object-fit: contain;
    z-index: 3;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.65));
    pointer-events: none;
  }
  /* STATUS BANNER BAR ABOVE BOARD */
  .state-banner {
    background: rgba(9, 13, 26, 0.94);
    border: 1.5px solid #facc15;
    border-radius: 8px;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.7);
    flex-shrink: 0;
  }
  .state-banner img {
    height: 16px;
    width: auto;
  }
  .state-banner span {
    font-size: 10.5px;
    font-weight: 700;
    color: #fde047;
  }
  /* TACTICAL ACTION & ITEM BAR */
  .tactical-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    height: 44px;
    flex-shrink: 0;
  }
  .tac-btn {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #64748b;
    border-radius: 8px;
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 3px 2px;
  }
  .tac-btn.gold-accent {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #451a03 0%, #1c1917 100%);
  }
  .tac-btn-title {
    font-size: 10px;
    font-weight: 700;
    color: #f8fafc;
  }
  .tac-btn-sub {
    font-size: 8px;
    color: #fbbf24;
  }
  /* 3-TAB MODAL OVERLAY */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 17, 0.86);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;
  }
  .modal-backdrop.open {
    display: flex;
  }
  .modal-card {
    width: 100%;
    max-width: 420px;
    max-height: 86vh;
    background: linear-gradient(180deg, #17203a 0%, #0b1021 100%);
    border: 2px solid #d4af37;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85);
  }
  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(9, 13, 26, 0.9);
    border-bottom: 1px solid rgba(212, 175, 55, 0.4);
  }
  .modal-title {
    font-size: 13px;
    font-weight: 700;
    color: #fde047;
  }
  .modal-close-btn {
    background: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
  }
  .modal-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.95);
  }
  .tab-switch-btn {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 7px;
    color: #cbd5e1;
    padding: 7px 4px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
  }
  .tab-switch-btn.active {
    background: #d4af37;
    color: #090d16;
    border-color: #fef08a;
  }
  .modal-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: max-content;
    gap: 8px;
  }
  .catalog-item {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    min-width: 0;
    overflow: hidden;
  }
  .catalog-item.equipped {
    border-color: #22c55e;
    background: rgba(20, 83, 45, 0.35);
  }
  .catalog-item img {
    height: 40px;
    max-width: 90%;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
  }
  .catalog-item-name {
    font-size: 10px;
    font-weight: 700;
    color: #f8fafc;
    text-align: center;
  }
  .catalog-item-cost {
    font-size: 9px;
    color: #facc15;
  }

/* ==== CĂN HỘ HUB ==== */
:root { --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --f-chu: 'DigiiMonoStd', monospace, sans-serif; --f-so: 'DigiiMonoStd', ui-monospace, monospace; }
/* Phông gốc DigiiMonoStd không có dấu tiếng Việt → chữ Việt dùng phông hệ thống đậm, số + đồng hồ giữ phông gốc */
body.vi { --f-chu: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
* { font-family: var(--f-chu); }
.clock-box, .stat-pill, .brand-main, #ring-count, .eval-pill { font-family: var(--f-so); }
body.vi .player-name, body.vi .tac-btn-title, body.vi .mode-btn, body.vi .state-banner span { font-weight: 800; letter-spacing: 0; }
html, body { width: 100%; height: 100%; max-width: 100%; overflow: hidden; touch-action: manipulation; }
/* Hợp đồng 1.4: trong hub chừa dải ĐỈNH 46px (Lối ra + 5 nút của hub) và dải ĐÁY 60px (quảng cáo hub vẽ), game kẹp giữa.
   Ngoài hub chỉ né viền an toàn của máy. */
#app-root { position: fixed; left: 0; right: 0; top: 0; bottom: 0; width: auto; height: auto; max-width: 100%; overflow: hidden; gap: 5px;
  padding: max(6px, var(--st)) max(6px, var(--sr)) max(6px, var(--sb)) max(6px, var(--sl)); }
body.trong-hub #app-root { top: calc(46px + var(--st)); bottom: calc(60px + var(--sb)); padding: 4px max(6px, var(--sr)) 4px max(6px, var(--sl)); }
body.trong-hub .modal-backdrop { top: calc(46px + var(--st)); bottom: calc(60px + var(--sb)); padding: 10px max(10px, var(--sr)) 10px max(10px, var(--sl)); }
button { font: inherit; }
.top-header { min-width: 0; max-width: 100%; overflow: hidden; }
.brand-titles { min-width: 0; flex: 1; overflow: hidden; }
.brand-main:not(.dai), .brand-sub { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { width: 44px; height: 44px; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 8px; border: 1px solid #d4af37; background: rgba(9,13,26,.9); color: #fde047; font-size: 18px; cursor: pointer; }
.btn-icon[hidden] { display: none !important; }
.btn-top-vault { min-height: 44px; min-width: 54px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; white-space: nowrap; overflow: hidden; }
.btn-top-vault .ic { flex-shrink: 0; }
.btn-top-vault span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mode-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); height: auto; min-height: 44px; gap: 4px; }
.mode-btn { min-width: 44px; min-height: 44px; padding: 2px 3px; gap: 3px; overflow: hidden; }
.mode-btn img, .mode-btn .ic { flex-shrink: 0; }
.mode-btn span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-strip { height: auto; min-height: 48px; padding: 2px 6px; gap: 5px; min-width: 0; max-width: 100%; overflow: hidden; }
.player-meta { min-width: 0; flex: 1; }
.player-info-col { min-width: 0; flex: 1; overflow: hidden; }
.player-name, .player-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cup-badge { flex-shrink: 0; min-height: 44px; min-width: 44px; padding: 4px 6px; gap: 4px; }
.cup-badge span { white-space: nowrap; }
.cup-badge.an { display: none; }
.clock-box { flex-shrink: 0; min-width: 54px; padding: 4px 6px; }
.clock-box.gap { color: #f87171; border-color: #f87171; animation: nhap 1s infinite; }
@keyframes nhap { 50% { opacity: .55; } }
.eval-pill { min-width: 50px; justify-content: center; flex-shrink: 0; }
/* BÀN: luôn VUÔNG, cạnh = min(bề ngang, chiều cao còn lại) — JS đặt --canh. Lỗi gốc: hàng lưới 1fr giãn theo ảnh quân
   (131px) nên sau vài nước bàn bị đẩy lệch mất hàng 8; nay hàng/cột minmax(0,1fr) + quân nằm absolute. */
.board-stage { gap: 5px; padding: 0; min-width: 0; width: 100%; overflow: hidden; }
.board-wrap { flex: 0 0 auto; width: 100%; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.board-frame { width: var(--canh, min(90vw, 44vh)); height: var(--canh, min(90vw, 44vh)); max-width: 100%; flex-shrink: 0;
  grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); }
.sq-cell { overflow: visible; min-width: 0; min-height: 0; }
.piece-sprite { position: absolute; left: 8%; top: 4%; width: 84%; height: 92%; transition: transform .16s ease-out; }
.piece-sprite.nhac { transform: translateY(-8%) scale(1.08); }
.sq-cell.goi-y { background: rgba(250, 204, 21, 0.38); box-shadow: inset 0 0 0 2px #fbbf24; }
.sq-cell .toa { position: absolute; font-size: 8px; color: rgba(255,255,255,.55); pointer-events: none; z-index: 2; }
.state-banner { max-width: 100%; min-width: 0; min-height: 26px; overflow: hidden; padding: 4px 10px; }
.state-banner span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tactical-bar { grid-template-columns: repeat(5, minmax(0, 1fr)); height: auto; min-height: 46px; gap: 4px; }
.tac-btn { min-width: 44px; min-height: 44px; padding: 2px; overflow: hidden; }
.tac-btn:disabled { opacity: .45; }
.tac-btn-title, .tac-btn-sub { display: block; width: 100%; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; line-height: 1.15; }
button:active { transform: scale(.96); }
.modal-backdrop { padding: max(10px, var(--st)) max(10px, var(--sr)) max(10px, var(--sb)) max(10px, var(--sl)); }
.modal-card { max-height: 100%; }
.modal-header { gap: 8px; padding: 6px 10px; }
.modal-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-close-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 4px; font-size: 14px; }
.modal-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 8px; gap: 5px; }
.tab-switch-btn { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; padding: 4px; line-height: 1.15; overflow: hidden; }
.modal-body { grid-template-columns: repeat(2, minmax(0, 1fr)); -webkit-overflow-scrolling: touch; }
.catalog-item { min-width: 44px; min-height: 48px; }
.catalog-item > div { min-width: 0; max-width: 100%; }
.catalog-item-name, .catalog-item-cost { overflow-wrap: break-word; word-break: break-word; }
.catalog-item.khoa { opacity: .55; }
.catalog-item.rong { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; text-align: left; }
.catalog-item.rong > div { flex: 1; }
.catalog-item.rong img { height: 34px; flex-shrink: 0; }
.catalog-head { grid-column: 1 / -1; font-size: 11px; color: #fde047; font-weight: 700; padding: 4px 2px 0; }
/* Phong cấp + kết quả + menu */
.promo-card, .kq-card { width: 100%; max-width: 360px; background: linear-gradient(180deg, #17203a 0%, #0b1021 100%);
  border: 2px solid #d4af37; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.85); max-height: 100%; overflow-y: auto; }
.promo-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.promo-row button { min-width: 44px; min-height: 44px; width: 100%; height: clamp(60px, 18vw, 88px); background: #1e293b; border: 1px solid #d4af37; border-radius: 8px; padding: 4px; cursor: pointer; }
.promo-row img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.kq-card img#kq-img { max-height: 110px; max-width: 80%; object-fit: contain; }
.kq-title { font-size: 20px; font-weight: 800; color: #fde047; text-align: center; max-width: 100%; overflow-wrap: break-word; }
.kq-sub { font-size: 12px; color: #cbd5e1; text-align: center; line-height: 1.5; white-space: pre-line; max-width: 100%; overflow-wrap: break-word; }
.kq-bracket { display: flex; gap: 6px; justify-content: center; width: 100%; }
.kq-bracket .vong { flex: 1; min-width: 0; overflow: hidden; overflow-wrap: break-word; border: 1px solid #475569; border-radius: 8px; padding: 6px 2px; text-align: center; font-size: 10px; color: #94a3b8; }
.kq-bracket .vong img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; display: block; margin: 0 auto 4px; }
.kq-bracket .vong.qua { border-color: #22c55e; color: #bbf7d0; }
.kq-bracket .vong.dang { border-color: #facc15; color: #fde047; box-shadow: 0 0 8px rgba(250,204,21,.4); }
.kq-bracket .vong.thua { border-color: #ef4444; color: #fecaca; }
.kq-btns { display: flex; gap: 8px; width: 100%; }
.kq-btn { flex: 1; min-width: 44px; min-height: 44px; border-radius: 8px; border: 1px solid #64748b; background: #1e293b; color: #f8fafc; font-weight: 800; font-size: 13px; padding: 8px 10px; cursor: pointer; }
.kq-btn.chinh { background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%); color: #090d16; border-color: #fef08a; }
.menu-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.menu-list button { min-width: 44px; min-height: 46px; border-radius: 8px; border: 1px solid #475569; background: #1e293b; color: #f8fafc; font-weight: 700; font-size: 13px; text-align: left; padding: 6px 12px; cursor: pointer; overflow-wrap: break-word; }
.menu-list button small { display: block; font-size: 10px; color: #94a3b8; font-weight: 400; margin-top: 2px; }
.menu-list button.bat { border-color: #22c55e; }
#toast { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(9,13,26,.95); border: 1.5px solid #facc15;
  color: #fde047; border-radius: 10px; padding: 10px 16px; font-size: 13px; font-weight: 700; z-index: 90; pointer-events: none;
  opacity: 0; transition: opacity .2s; max-width: min(86%, calc(100% - max(24px, var(--sl) + var(--sr)))); text-align: center; }
#toast.hien { opacity: 1; }
@media (max-height: 640px) {
  #app-root { gap: 4px; }
  .top-header { min-height: 50px; padding: 2px 6px; }
  .mode-bar { min-height: 44px; }
  .player-strip { min-height: 46px; padding: 1px 6px; }
  .avatar-frame { width: 32px; height: 32px; }
  .tactical-bar { min-height: 44px; }
}

/* SKIN CHUNG 20-11 — bộ có mảnh nào thì nút/khung đó đổi ảnh (body.sk-<mảnh>, biến --sk-<mảnh> do datSkin đặt); bộ gốc không có lớp nào → y cũ */
.ic { font-style: normal; display: inline-block; }
.ic:empty { display: none; }
.ic img { height: 1.25em; width: auto; vertical-align: -0.28em; margin-right: .15em; }
#btn-menu .ic img { height: 26px; vertical-align: middle; }
.modal-close-btn .ic img { height: 1.4em; }
body.sk-nut_cai #btn-menu { background: none !important; padding: 0; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_kho .btn-top-vault { background: var(--sk-nut_kho) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_che_do .mode-btn { background: var(--sk-nut_che_do) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_che_do_bat .mode-btn.active { background: var(--sk-nut_che_do_bat) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_thanh_duoi .tac-btn { background: var(--sk-nut_thanh_duoi) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_thanh_duoi_vang .tac-btn.gold-accent { background: var(--sk-nut_thanh_duoi_vang) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_dong .modal-close-btn { background: none !important; padding: 0; border-color: transparent !important; box-shadow: none !important; }
body.sk-tab .tab-switch-btn { background: var(--sk-tab) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-tab_bat .tab-switch-btn.active { background: var(--sk-tab_bat) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_dai .kq-btn, body.sk-nut_dai .menu-list button { background: var(--sk-nut_dai) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-nut_dai_chinh .kq-btn.chinh { background: var(--sk-nut_dai_chinh) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_tren .top-header { background: var(--sk-khung_tren) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_che_do .mode-bar { background: var(--sk-khung_che_do) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_nguoi .player-strip { background: var(--sk-khung_nguoi) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_anh .avatar-frame { background: var(--sk-khung_anh) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_dong_ho .clock-box { background: var(--sk-khung_dong_ho) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_chip .stat-pill, body.sk-khung_chip .cup-badge { background: var(--sk-khung_chip) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-bang_trang_thai .state-banner { background: var(--sk-bang_trang_thai) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_bang .modal-card, body.sk-khung_bang .promo-card, body.sk-khung_bang .kq-card { background: var(--sk-khung_bang) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_the .catalog-item { background: var(--sk-khung_the) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
body.sk-khung_thanh_duoi .tactical-bar { background: var(--sk-khung_thanh_duoi) center / 100% 100% no-repeat !important; border-color: transparent !important; box-shadow: none !important; }
/* 21-11 (chấm 5811031 lô 21-11): hiệu ứng ô bàn cũng theo bộ — chấm đi, vòng ăn, ô chọn, ô nước cuối, ô bị chiếu */
body.sk-cham_di .legal-dot { background: var(--sk-cham_di) center / contain no-repeat !important; border: 0 !important; width: 38%; height: 38%; }
body.sk-vong_an .legal-capture-ring { background: var(--sk-vong_an) center / 100% 100% no-repeat !important; border: 0 !important; }
body.sk-o_chon .sq-cell.selected { background: var(--sk-o_chon) center / 100% 100% no-repeat !important; box-shadow: none !important; }
body.sk-o_nuoc_cuoi .sq-cell.last-move { background: var(--sk-o_nuoc_cuoi) center / 100% 100% no-repeat; box-shadow: none; }
body.sk-o_chieu .sq-cell.in-check { background: var(--sk-o_chieu) center / 100% 100% no-repeat !important; box-shadow: none !important; }
/* 21-11: chữ Việt game viết lên mảnh chu_* / vo_dich (bảng trống của bộ) — anhChu() đặt đúng khung ảnh */
#banner, .kq-card { position: relative; }
.chu-bang { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: none;
  font-weight: 900; letter-spacing: .04em; line-height: 1; color: var(--khung-chu, #fff8e1); font-size: clamp(14px, 4.2vw, 26px);
  text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 0 10px rgba(0,0,0,.45); white-space: nowrap; }
.kq-card .chu-bang { font-size: clamp(22px, 7vw, 40px); }
/* 25-11 (chấm keo-ngot): bộ có khung sáng khai bien --sk-chu (chữ chính) + --sk-chu-phu (chữ phụ) → mọi chữ nằm trên khung/nút đổi màu, bỏ bóng chữ tối */
body.sk-chu .top-header, body.sk-chu .top-header *, body.sk-chu .mode-btn, body.sk-chu .mode-btn *, body.sk-chu .player-strip, body.sk-chu .player-strip *,
body.sk-chu .clock-box, body.sk-chu .stat-pill, body.sk-chu .stat-pill *, body.sk-chu .cup-badge, body.sk-chu .cup-badge *, body.sk-chu .eval-pill,
body.sk-chu .state-banner, body.sk-chu .state-banner *, body.sk-chu .tac-btn, body.sk-chu .tac-btn *, body.sk-chu .btn-top-vault, body.sk-chu .btn-top-vault *,
body.sk-chu .tab-switch-btn, body.sk-chu .catalog-item, body.sk-chu .catalog-item *, body.sk-chu .modal-card, body.sk-chu .kq-card { color: var(--sk-chu) !important; text-shadow: none !important; -webkit-text-fill-color: currentColor; }
body.sk-chu .player-sub, body.sk-chu .player-meta, body.sk-chu .tac-btn-sub, body.sk-chu .brand-sub { color: var(--sk-chu-phu, var(--sk-chu)) !important; }
body.sk-chu .clock-box { color: var(--sk-dong-ho, var(--sk-chu)) !important; }
/* 25-11 (chấm keo-ngot): dải TRẠNG THÁI có nền hoa văn → chữ nằm trên một viên nền đặc riêng + viền sáng cho đọc được */
body.sk-bang_trang_thai #banner-t { background: var(--sk-nen-chu, rgba(255,255,255,.86)); color: var(--sk-chu, #1f2937) !important;
  padding: 2px 12px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.25); text-shadow: none !important; -webkit-text-fill-color: currentColor; }
/* 30-11 (chấm pha-le-xanh 5811031): tấm thẻ/nút lòng ĐẬM giữa + mép SÁNG — chữ sáng hay tối đều chìm một nửa → bộ khai
   bien --sk-vien-chu (text-shadow tối) thì mọi chữ trên thẻ/nút có viền tối; --sk-chu-phu-vien = màu chữ phụ (mặc định trắng sáng) */
body.sk-vien-chu .top-header *, body.sk-vien-chu .mode-btn *, body.sk-vien-chu .player-strip *, body.sk-vien-chu .clock-box,
body.sk-vien-chu .stat-pill *, body.sk-vien-chu .cup-badge *, body.sk-vien-chu .state-banner span, body.sk-vien-chu .tac-btn *,
body.sk-vien-chu .btn-top-vault *, body.sk-vien-chu .tab-switch-btn, body.sk-vien-chu .catalog-item *, body.sk-vien-chu .modal-card *,
body.sk-vien-chu .kq-card *, body.sk-vien-chu .menu-list button { text-shadow: var(--sk-vien-chu) !important; }
body.sk-vien-chu .player-sub, body.sk-vien-chu .tac-btn-sub, body.sk-vien-chu .tac-btn-sub *, body.sk-vien-chu .brand-sub,
body.sk-vien-chu .kq-sub { color: var(--sk-chu-phu-vien, #f1f9ff) !important; -webkit-text-fill-color: currentColor; }
body.sk-vien-chu .btn-top-vault, body.sk-vien-chu .btn-top-vault *, body.sk-vien-chu .kq-btn, body.sk-vien-chu .kq-btn.chinh,
body.sk-vien-chu .gold-accent * { color: var(--sk-chu-nut-vien, #ffffff) !important; -webkit-text-fill-color: currentColor; text-shadow: var(--sk-vien-chu) !important; }
/* 30-11 tên game của truyện dài hơn ROYAL CHESS CROWN → co chữ, xuống 2 dòng; thẻ truyện màn đầu */
.brand-main.dai { font-size: clamp(9.5px, 2.8vw, 12px); line-height: 1.1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brand-main.dai ~ .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#truyen { z-index: 60; }
.tr-card { gap: 10px; max-height: 100%; overflow-y: auto; }
.tr-card .kq-title { font-size: clamp(18px, 5.4vw, 24px); line-height: 1.2; text-align: center; }
.tr-card .tr-chuyen { font-size: 13px; text-align: justify; }
.tr-card .tr-nv { font-size: 11.5px; text-align: left; opacity: .92; }
.tr-card .tr-muc { font-size: 12.5px; font-weight: 800; color: var(--khung-tieu, #fde68a); }
.brand-cluster:has(.brand-main.dai) .brand-logo-img { max-width: 30px; }
/* 30-11 (chấm keo-ngot 5811031): bảng truyện màn đầu theo --sk-chu/--sk-chu-phu như .modal-card — bộ khung sáng thì chữ tối, bỏ bóng chữ */
body.sk-chu .tr-card .kq-title, body.sk-chu .tr-card .tr-muc { color: var(--sk-chu) !important; text-shadow: none !important; -webkit-text-fill-color: currentColor; }
body.sk-chu .tr-card .tr-chuyen, body.sk-chu .tr-card .tr-nv { color: var(--sk-chu-phu, var(--sk-chu)) !important; text-shadow: none !important; -webkit-text-fill-color: currentColor; }

/* ==== PHẢN HỒI HÌNH & TIẾNG TRÊN BÀN CỜ ==== */
.piece-sprite { will-change: transform; }
.piece-sprite.nhac { transform: translateY(-10%) scale(1.1); filter: drop-shadow(0 6px 8px rgba(250, 204, 21, 0.55)); z-index: 6; }
.piece-sprite.lac-khong { animation: lacKhong 0.28s ease-in-out; }
@keyframes lacKhong {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12%); }
  45% { transform: translateX(11%); }
  70% { transform: translateX(-7%); }
  88% { transform: translateX(4%); }
}
.legal-dot { animation: dotPop 0.16s cubic-bezier(0.22, 1.3, 0.36, 1) both; }
@keyframes dotPop {
  0% { transform: scale(0.2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.legal-capture-ring { animation: ringPop 0.18s cubic-bezier(0.22, 1.25, 0.36, 1) both, capPulse 1.3s ease-in-out 0.18s infinite; }
@keyframes ringPop {
  0% { transform: scale(1.24); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes capPulse {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(0.93); opacity: 1; }
}
.sq-cell.last-move-moi::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(250, 204, 21, 0.42);
  pointer-events: none;
  z-index: 1;
  animation: oMoi 0.42s ease-out forwards;
}
@keyframes oMoi {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}
.sq-cell.in-check::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 6px;
  border: 2.5px solid #fecaca;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.9), inset 0 0 10px rgba(239, 68, 68, 0.65);
  pointer-events: none;
  z-index: 2;
  animation: chieuPulse 1s ease-in-out infinite;
}
.sq-cell.in-check.bao-manh::after {
  border-color: #ffffff;
  box-shadow: 0 0 18px #ef4444, inset 0 0 14px rgba(254, 202, 202, 0.9);
  animation: chieuManh 0.48s ease-out;
}
@keyframes chieuPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.02); }
}
@keyframes chieuManh {
  0% { transform: scale(1.18); opacity: 1; }
  50% { transform: scale(0.94); opacity: 1; }
  100% { transform: scale(1); opacity: 0.85; }
}
.sq-cell.goi-y { animation: goiYPulse 1s ease-in-out infinite; }
@keyframes goiYPulse {
  0%, 100% { box-shadow: inset 0 0 0 2px #fbbf24; }
  50% { box-shadow: inset 0 0 0 3px #fef08a, inset 0 0 12px rgba(250, 204, 21, 0.72); }
}
/* Lớp hiệu ứng canvas & bóng nằm DƯỚI quân cờ (z-index: 2 < piece-sprite: 3) nên không bao giờ che nhân vật */
.board-fx-canvas,
.board-fx-duoi {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}
/* Lớp nhãn nổi gọn đặt lệch mép ô, không chiếm ô lưới và không che quân */
.board-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 14;
  overflow: hidden;
}
.fx-ghost {
  position: absolute;
  object-fit: contain;
  pointer-events: none;
  animation: fxGhost 0.28s ease-out forwards;
}
@keyframes fxGhost {
  0% { transform: scale(1.04) rotate(0deg); opacity: 0.88; filter: brightness(1.45) drop-shadow(0 0 8px rgba(239, 68, 68, 0.85)); }
  100% { transform: scale(0.28) rotate(18deg) translateY(-22%); opacity: 0; filter: brightness(0.7); }
}
.fx-badge {
  position: absolute;
  transform: translate(-50%, -95%);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #fde047;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.72);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  animation: fxBadge 0.76s cubic-bezier(0.18, 0.88, 0.3, 1) forwards;
}
.fx-badge.fx-badge-top {
  animation-name: fxBadgeTop;
}
.fx-badge.fx-b-vang { background: linear-gradient(180deg, rgba(180, 83, 9, 0.96), rgba(120, 53, 15, 0.96)); border-color: #fef08a; color: #fef9c3; }
.fx-badge.fx-b-moc { background: linear-gradient(180deg, rgba(217, 119, 6, 0.98), rgba(146, 64, 14, 0.98)); border-color: #fef08a; color: #ffffff; box-shadow: 0 0 12px rgba(250, 204, 21, 0.65); }
.fx-badge.fx-b-xanh { background: linear-gradient(180deg, rgba(29, 78, 216, 0.96), rgba(30, 58, 138, 0.96)); border-color: #93c5fd; color: #eff6ff; }
.fx-badge.fx-b-do, .fx-badge.fx-b-chieu, .fx-badge.fx-b-thua { background: linear-gradient(180deg, rgba(220, 38, 38, 0.96), rgba(127, 29, 29, 0.96)); border-color: #fecaca; color: #ffffff; }
.fx-badge.fx-b-het { background: linear-gradient(180deg, #b91c1c, #7f1d1d); border-color: #fde047; color: #fef08a; font-size: 11.5px; padding: 2px 9px; }
@keyframes fxBadge {
  0% { transform: translate(-50%, -65%) scale(0.72); opacity: 0; }
  22% { transform: translate(-50%, -110%) scale(1.06); opacity: 1; }
  76% { transform: translate(-50%, -142%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -175%) scale(0.92); opacity: 0; }
}
@keyframes fxBadgeTop {
  0% { transform: translate(-50%, 6%) scale(0.72); opacity: 0; }
  22% { transform: translate(-50%, -6%) scale(1.05); opacity: 1; }
  76% { transform: translate(-50%, -18%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -32%) scale(0.92); opacity: 0; }
}
/* Viền ánh sáng nội khung bàn (z-index: 1, dưới quân cờ) cho thắng / thua / mốc / lùi / đổi bộ */
.board-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
}
.board-frame.hieu-ung-thua::after {
  box-shadow: inset 0 0 28px rgba(239, 68, 68, 0.92), inset 0 0 0 3px rgba(252, 165, 165, 0.9);
  background: radial-gradient(circle at center, transparent 54%, rgba(185, 28, 28, 0.34) 100%);
  animation: khungLo 0.66s ease-out forwards;
}
.board-frame.hieu-ung-thang::after {
  box-shadow: inset 0 0 28px rgba(34, 197, 94, 0.82), inset 0 0 0 3px rgba(254, 240, 138, 0.9);
  background: radial-gradient(circle at center, transparent 58%, rgba(250, 204, 21, 0.24) 100%);
  animation: khungLo 0.66s ease-out forwards;
}
.board-frame.hieu-ung-moc::after {
  box-shadow: inset 0 0 24px rgba(250, 204, 21, 0.88), inset 0 0 0 3px rgba(254, 240, 138, 0.92);
  background: radial-gradient(circle at center, transparent 60%, rgba(245, 158, 11, 0.22) 100%);
  animation: khungLo 0.64s ease-out forwards;
}
.board-frame.hieu-ung-lui::after {
  box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.72), inset 0 0 0 2px rgba(186, 230, 253, 0.8);
  animation: khungLo 0.32s ease-out forwards;
}
.board-frame.doi-skin {
  animation: doiSkin 0.32s ease-out;
}
@keyframes khungLo {
  0% { opacity: 0; }
  22% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes doiSkin {
  0% { transform: scale(0.985); filter: brightness(1.16); }
  100% { transform: scale(1); filter: brightness(1); }
}
/* Rung nhẹ bàn cờ khi ăn quân / chiếu */
.board-frame.rung-nhe { animation: rungNhe 0.18s ease-out; }
.board-frame.rung-manh { animation: rungManh 0.28s ease-out; }
@keyframes rungNhe {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-2px, 1px, 0); }
  60% { transform: translate3d(2px, -1px, 0); }
}
@keyframes rungManh {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-4px, 2px, 0); }
  45% { transform: translate3d(4px, -2px, 0); }
  70% { transform: translate3d(-2px, -1px, 0); }
}
/* Nhấn mạnh băng trạng thái, thanh ưu thế, túi nhẫn, đồng hồ, dải kỳ thủ & máy đang nghĩ */
.state-banner { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.state-banner.bao-chieu { border-color: #ef4444; box-shadow: 0 0 14px rgba(239, 68, 68, 0.65); animation: bannerPop 0.32s ease-out; }
.state-banner.bao-thang { border-color: #22c55e; box-shadow: 0 0 14px rgba(34, 197, 94, 0.55); animation: bannerPop 0.34s ease-out; }
.state-banner.bao-thua { border-color: #ef4444; box-shadow: 0 0 14px rgba(239, 68, 68, 0.72); }
.state-banner.bao-thua-nhay { animation: bannerThua 0.44s ease-out; }
.state-banner.bao-moc-nhay { border-color: #fef08a; box-shadow: 0 0 16px rgba(250, 204, 21, 0.85); animation: bannerPop 0.46s cubic-bezier(0.22, 1.3, 0.36, 1); }
.state-banner.bao-nuoc { animation: bannerPop 0.22s ease-out; }
@keyframes bannerPop {
  0% { transform: scale(0.96); }
  55% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes bannerThua {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}
.stat-pill.pill-tang { animation: pillTang 0.44s cubic-bezier(0.22, 1.3, 0.36, 1); }
.stat-pill.pill-giam { animation: pillGiam 0.32s ease-out; }
@keyframes pillTang {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.14); filter: brightness(1.3) drop-shadow(0 0 8px rgba(250, 204, 21, 0.85)); }
  100% { transform: scale(1); filter: brightness(1); }
}
@keyframes pillGiam {
  0% { transform: scale(1); }
  45% { transform: scale(0.93); filter: brightness(0.88); }
  100% { transform: scale(1); filter: brightness(1); }
}
.clock-box.clock-them { animation: clockThem 0.44s cubic-bezier(0.22, 1.25, 0.36, 1); }
@keyframes clockThem {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.12); filter: brightness(1.32) drop-shadow(0 0 8px rgba(56, 189, 248, 0.9)); }
  100% { transform: scale(1); filter: brightness(1); }
}
.cup-badge.moc-nhay,
.mode-btn.moc-nhay { animation: mocNhay 0.52s cubic-bezier(0.22, 1.3, 0.36, 1); }
@keyframes mocNhay {
  0% { transform: scale(1); filter: brightness(1); }
  42% { transform: scale(1.1); filter: brightness(1.28) drop-shadow(0 0 10px rgba(250, 204, 21, 0.85)); }
  100% { transform: scale(1); filter: brightness(1); }
}
.player-strip.bao-thua-nhay { animation: stripThua 0.54s ease-out; }
.player-strip.bao-thang-nhay { animation: stripThang 0.52s ease-out; }
.player-strip.bao-moc-nhay { animation: stripMoc 0.54s ease-out; }
@keyframes stripThua {
  0% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); filter: brightness(1); }
  25% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.9); filter: brightness(1.12); transform: translateX(-3px); }
  55% { transform: translateX(2px); }
  100% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); filter: brightness(1); transform: translateX(0); }
}
@keyframes stripThang {
  0% { box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
  35% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.85); filter: brightness(1.16); }
  100% { box-shadow: 0 0 0 rgba(34, 197, 94, 0); filter: brightness(1); }
}
@keyframes stripMoc {
  0% { box-shadow: 0 0 0 rgba(250, 204, 21, 0); }
  35% { box-shadow: 0 0 16px rgba(250, 204, 21, 0.9); filter: brightness(1.18); }
  100% { box-shadow: 0 0 0 rgba(250, 204, 21, 0); filter: brightness(1); }
}
.modal-backdrop.open .kq-card { animation: kqVao 0.22s cubic-bezier(0.22, 1.15, 0.36, 1) both; }
@keyframes kqVao {
  0% { transform: scale(0.93) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.eval-pill { position: relative; overflow: hidden; padding-bottom: 5px; transition: border-color 0.22s ease, transform 0.18s ease; }
.eval-pill::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: var(--ev-pct, 50%);
  background: #facc15;
  transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.22s ease;
}
.eval-pill.ev-loi { border-color: #22c55e; color: #86efac; }
.eval-pill.ev-loi::after { background: #22c55e; }
.eval-pill.ev-bat { border-color: #f87171; color: #fca5a5; }
.eval-pill.ev-bat::after { background: #ef4444; }
.eval-pill.ev-nhay { animation: evalNhay 0.26s ease-out; }
@keyframes evalNhay {
  0% { transform: scale(1); }
  45% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.player-strip.dang-nghi .avatar-frame {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
  animation: nghiPulse 0.9s ease-in-out infinite;
}
@keyframes nghiPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.82; }
}
@media (prefers-reduced-motion: reduce) {
  .board-frame.rung-nhe, .board-frame.rung-manh, .board-frame.doi-skin, .legal-capture-ring,
  .player-strip.dang-nghi .avatar-frame, .player-strip.bao-thua-nhay, .state-banner.bao-thua-nhay,
  .modal-backdrop.open .kq-card { animation: none !important; }
}

/* ==== CỔNG PHÁT HÀNH: NÚT THƯỞNG & TẠM DỪNG QUẢNG CÁO ==== */
.btn-thuong-qc {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: inline-block;
  max-width: 100%;
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  color: #090d16;
  border: 1.5px solid #fef08a;
  border-radius: 8px;
  padding: 12px 12px;
  line-height: 1.45;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-thuong-qc[hidden] { display: none !important; }
.btn-thuong-qc:disabled, .btn-thuong-qc.da-nhan {
  opacity: 0.55;
  cursor: default;
  background: #1e293b;
  color: #cbd5e1;
  border-color: #475569;
  box-shadow: none;
}
body.sk-vien-chu .btn-thuong-qc { color: var(--sk-chu-nut-vien, #ffffff) !important; text-shadow: var(--sk-vien-chu) !important; }
body.tam-dung-qc #app-root, body.tam-dung-qc .modal-backdrop { pointer-events: none; }
body.tam-dung-qc #app-root *, body.tam-dung-qc #app-root *::before, body.tam-dung-qc #app-root *::after,
body.tam-dung-an #app-root *, body.tam-dung-an #app-root *::before, body.tam-dung-an #app-root *::after { animation-play-state: paused !important; }

/* ==== GIAO DIỆN ĐIỆN THOẠI (360px · VÙNG AN TOÀN · XOAY NGANG) ==== */
@media (max-width: 400px) {
  .top-header { padding: 3px 5px; gap: 3px; }
  .brand-cluster { gap: 4px; }
  .brand-logo-img { height: 22px; max-width: 34px; }
  .brand-main:not(.dai) { font-size: 9px; }
  .brand-sub { font-size: 7.5px; }
  .treasury-cluster { gap: 3px; }
  .stat-pill { padding: 3px 4px; font-size: 9.5px; gap: 2px; }
  .stat-pill img { width: 13px; height: 13px; }
  .btn-top-vault { min-width: 46px; padding: 4px 5px; font-size: 9px; }
  .mode-btn { font-size: 9.5px; }
  .mode-btn img { width: 12px; height: 12px; }
  .player-name { font-size: 10.5px; }
  .player-sub { font-size: 8.5px; }
  .cup-badge { font-size: 9px; padding: 4px 5px; gap: 3px; }
  .cup-badge img { width: 15px; height: 15px; }
  .clock-box { min-width: 52px; padding: 4px 5px; font-size: 11px; }
  .eval-pill { min-width: 46px; }
  .tac-btn-title { font-size: 9.5px; }
  .tac-btn-sub { font-size: 7.5px; }
}

@media (orientation: landscape) and (max-height: 540px) and (min-width: 480px) {
  #app-root {
    display: grid;
    grid-template-columns: var(--cot-ban, minmax(160px, min(calc(100% - 256px), calc(100vh - 36px)))) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(46px, 1fr) minmax(44px, 1fr) auto;
    column-gap: 8px;
    row-gap: 4px;
    align-items: center;
    padding: max(4px, var(--st)) max(6px, var(--sr)) max(4px, var(--sb)) max(6px, var(--sl));
  }
  body.trong-hub #app-root {
    padding: 3px max(6px, var(--sr)) 3px max(6px, var(--sl));
    row-gap: 3px;
  }
  .board-stage {
    grid-column: 1;
    grid-row: 1 / 6;
    height: 100%;
    width: 100%;
    align-self: stretch;
    justify-content: center;
    gap: 4px;
  }
  .top-header {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: 48px;
    padding: 2px 6px;
    gap: 4px;
  }
  .brand-cluster { gap: 5px; }
  .brand-logo-img { height: 22px; max-width: 34px; }
  .brand-main:not(.dai) { font-size: 9px; }
  .brand-sub { font-size: 7.5px; }
  .treasury-cluster { gap: 3px; }
  .stat-pill { padding: 3px 4px; font-size: 9.5px; gap: 2px; }
  .stat-pill img { width: 13px; height: 13px; }
  .btn-top-vault { min-width: 44px; padding: 4px 5px; font-size: 9px; }
  .mode-bar {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    min-height: 44px;
    gap: 4px;
  }
  .mode-btn { font-size: 9px; padding: 2px; gap: 2px; }
  .mode-btn img { width: 12px; height: 12px; }
  #strip-black {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
    min-height: 46px;
    padding: 1px 6px;
  }
  #strip-white {
    grid-column: 2;
    grid-row: 4;
    width: 100%;
    min-height: 44px;
    padding: 1px 6px;
  }
  .avatar-frame { width: 30px; height: 30px; }
  .player-name { font-size: 10px; }
  .player-sub { font-size: 8.5px; }
  .cup-badge { font-size: 9px; padding: 3px 5px; gap: 3px; }
  .cup-badge img { width: 14px; height: 14px; }
  .clock-box { min-width: 50px; padding: 3px 5px; font-size: 11px; }
  .eval-pill { min-width: 44px; }
  .tactical-bar {
    grid-column: 2;
    grid-row: 5;
    width: 100%;
    min-height: 44px;
    gap: 3px;
  }
  .tac-btn-title { font-size: 9px; }
  .tac-btn-sub { font-size: 7.5px; }
  .state-banner { padding: 2px 8px; min-height: 22px; }
  .state-banner span { font-size: 9.5px; }
  .btn-thuong-qc { font-size: 10px; padding: 13px 10px; }
  .modal-card { max-width: min(560px, 100%); }
  .modal-body { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px; }
  .promo-card, .kq-card { max-width: min(440px, 100%); padding: 10px 14px; gap: 6px; }
  .promo-row button { height: 64px; }
  .kq-card img#kq-img { max-height: 62px; }
  .kq-title { font-size: 17px; }
  .kq-sub { font-size: 11px; line-height: 1.35; }
  .kq-bracket .vong { padding: 4px 2px; }
  .kq-bracket .vong img { width: 24px; height: 24px; margin-bottom: 2px; }
}

@media (orientation: landscape) and (max-height: 540px) and (max-width: 620px) {
  .brand-logo-img { display: none; }
}

/* ==== LỐI CHƠI: NHÃN CHUỖI NƯỚC CHUẨN ==== */
.state-banner .streak-chip {
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.15;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fde68a;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.state-banner .streak-chip[hidden] { display: none !important; }
.state-banner .streak-chip.co-chuoi {
  background: linear-gradient(180deg, rgba(146, 64, 14, 0.95) 0%, rgba(92, 38, 10, 0.95) 100%);
  border-color: #facc15;
  color: #fef08a;
}
.state-banner .streak-chip.sap-moc {
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.98) 0%, rgba(120, 53, 15, 0.98) 100%);
  border-color: #fef08a;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.55);
}
.state-banner .streak-chip.dat-moc {
  animation: chuoiMoc 0.45s cubic-bezier(0.22, 1.3, 0.36, 1);
}
@keyframes chuoiMoc {
  0% { transform: scale(0.88); }
  45% { transform: scale(1.16); box-shadow: 0 0 14px rgba(250, 204, 21, 0.9); }
  100% { transform: scale(1); }
}
body.sk-chu .state-banner .streak-chip,
body.sk-bang_trang_thai .state-banner .streak-chip {
  background: var(--sk-nen-chu, rgba(255, 255, 255, 0.88));
  border-color: var(--sk-chu, #b45309);
  color: var(--sk-chu, #1f2937) !important;
  text-shadow: none !important;
  -webkit-text-fill-color: currentColor;
}
@media (max-width: 400px) {
  .state-banner { gap: 5px; padding: 3px 7px; }
  .state-banner .streak-chip { font-size: 8.5px; padding: 2px 5px; }
}
@media (orientation: landscape) and (max-height: 540px) and (min-width: 480px) {
  .state-banner { gap: 5px; padding: 2px 6px; }
  .state-banner .streak-chip { font-size: 8.5px; padding: 1px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .state-banner .streak-chip.dat-moc { animation: none !important; }
}

/* ==== ÂM THANH: NÚT TẮT / BẬT TIẾNG ==== */
.btn-mute {
  position: relative;
  padding: 0;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}
.btn-mute .ic-loa {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}
.btn-mute .loa-tat { display: none; }
.btn-mute.tat-am {
  border-color: #ef4444;
  background: rgba(30, 15, 25, 0.92);
  color: #fca5a5;
}
.btn-mute.tat-am .loa-song { display: none; }
.btn-mute.tat-am .loa-tat { display: inline; }
body.sk-chu .btn-mute:not(.tat-am) {
  color: var(--sk-chu, #1f2937) !important;
  border-color: var(--sk-chu, #b45309);
  background: var(--sk-nen-chu, rgba(255, 255, 255, 0.85));
}
body.sk-chu .btn-mute.tat-am {
  color: #dc2626 !important;
  border-color: #dc2626;
  background: rgba(254, 226, 226, 0.9);
}
body.sk-vien-chu .btn-mute {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}
