:root {
  --bg: #0a0e18;
  --panel: #11182a;
  --panel2: #172036;
  --line: #232e47;
  --line2: #33415f;
  --ink: #eef2fb;
  --soft: #c3cbe0;
  --muted: #8f9bb8;
  --gold: #ffc93d;
  --gold-ink: #1d1500;
  --team0: #5aa9ff;
  --team1: #ff6b6b;
  --hp-low: #ff4d5e;
  font-family: 'BVP', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); font-weight: 500; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- nút ---------- */
.primary, .ghost {
  border-radius: 12px; border: 1px solid transparent; padding: 12px 22px; font-weight: 800;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease, opacity .15s;
}
.primary { background: var(--gold); color: var(--gold-ink); font-size: 18px; padding: 14px 34px; box-shadow: 0 6px 0 #b8861a; }
.primary:hover { transform: translateY(-1px); }
.primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #b8861a; }
.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ghost { background: transparent; border-color: var(--line2); color: var(--ink); font-weight: 600; font-size: 15px; }
.ghost:hover { background: #ffffff0d; border-color: #43557d; }
.primary:focus-visible, .ghost:focus-visible, .mode:focus-visible, .sort:focus-visible, .tile:focus-visible, .mslot:focus-visible { outline: 2px solid #ffffffb0; outline-offset: 2px; }
kbd { font: 700 11px/1 'BVP', system-ui; background: #ffffff14; border: 1px solid #ffffff24; border-radius: 5px; padding: 3px 5px; margin-left: 6px; color: var(--muted); }
.sound { display: inline-flex; align-items: center; gap: 8px; }
.sound svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound .spk { fill: currentColor; stroke: none; }
.sound .off { display: none; }
.sound.muted .on { display: none; }
.sound.muted .off { display: inline; }

/* ---------- màn chọn banh: góc đài trên, kho banh dưới ---------- */
#pick { max-width: 1280px; margin: 0 auto; padding: 18px 28px 120px; }
.pbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; margin-bottom: 14px; }
h1 { margin: 0; font-weight: 800; font-size: 28px; line-height: 1; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
h1::before { content: ''; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff6d6 0%, var(--gold) 42%, #9a6a10 100%); box-shadow: 0 3px 0 #0006; }
.modes { justify-self: start; display: inline-flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.mode { border: 0; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; padding: 7px 16px; border-radius: 9px; }
.mode:hover { color: var(--ink); }
.mode.on { background: var(--ink); color: var(--bg); }

.pright { display: flex; align-items: center; gap: 8px; }
.newsbtn b { margin-left: 2px; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font-size: 12px; }

/* bảng "Vừa cập nhật" */
.news { margin: 0 0 14px; padding: 14px 16px 14px; background: var(--panel); border: 1px solid #ffc93d55; border-radius: 18px; }
.news-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.news-head h2 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; }
.news-head h2::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px #ffc93d2a; }
.news-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.news-list { display: flex; align-items: flex-start; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #33415f transparent; }
.ncard { flex: 0 0 310px; display: flex; gap: 10px; padding: 10px 12px 12px 8px; background: #0c1220; border: 1px solid var(--line); border-radius: 14px; scroll-snap-align: start; }
.ncard canvas { width: 64px; height: 64px; flex: none; margin: -4px -6px 0 -4px; }
.nbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.nhead { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.nhead b { font-size: 15.5px; font-weight: 800; }
.nb { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.nb.add { background: #ffffff17; color: var(--ink); }
.nb.fix { background: #ffc93d24; color: var(--gold); }
.nday { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.ncard ul { margin: 0; padding-left: 16px; font-size: 13px; line-height: 1.45; color: var(--soft); }
.ncard li + li { margin-top: 4px; }
.ncard .ntry { align-self: flex-start; margin-top: 2px; }
.nupd, .nold { display: flex; flex-direction: column; gap: 6px; }
.nold { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.nsec > b { display: block; margin-bottom: 2px; font-size: 12.5px; font-weight: 800; }
.nsec.up > b { color: #8fe3b3; }
.nsec.down > b { color: #ff9090; }
.nnote, .nrate { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.nrate b { color: var(--ink); }
.slot-upd .up { color: #8fe3b3; font-weight: 800; }
.slot-upd .down { color: #ff9090; font-weight: 800; }
.nmore summary { font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.nmore summary:hover { color: var(--ink); }
.nmore[open] summary { margin-bottom: 4px; }
.slot-upd { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: #ffd978; }
.slot-upd b { font-weight: 800; }

/* góc đài: giống mặt sàn trong trận (lưới mờ, vòng giữa sân, nửa trái ánh xanh, nửa phải ánh đỏ) */
.matchup {
  position: relative; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background-color: #0e1525;
  background-image:
    linear-gradient(90deg, rgba(90,169,255,.10) 0%, rgba(90,169,255,0) 40%, rgba(255,107,107,0) 60%, rgba(255,107,107,.10) 100%),
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 100% 100%, 36px 36px, 36px 36px; background-position: 0 0, center, center;
}
.matchup::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed #ffffff17; }
.matchup::after { content: ''; position: absolute; left: 50%; top: 50%; width: 230px; height: 230px; margin: -115px 0 0 -115px; border: 1px solid #ffffff12; border-radius: 50%; }
.duel { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) 220px minmax(0, 1fr); }
.slot { margin: 8px; padding: 14px 20px 10px; border-radius: 18px; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s, background-color .15s; }
.slot:hover { background: #ffffff05; }
.slot.active { outline-color: var(--gold); background: #ffc93d0a; }
.slot:focus-visible { outline-color: #ffffffb0; }
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.side-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.side-name::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.side0 .side-name { color: var(--team0); }
.side1 .side-name { color: var(--team1); }
.now { font-size: 12px; font-weight: 800; color: var(--gold-ink); background: var(--gold); padding: 3px 9px; border-radius: 999px; visibility: hidden; }
.slot.active .now, .mslot.active .now { visibility: visible; }
.slot-top .rnd { margin-left: auto; padding: 5px 10px; font-size: 12.5px; position: relative; z-index: 3; }   /* nút Ngẫu nhiên riêng từng bên (25/11); nổi trên hình banh để bấm được */
.duel.two .side1 .slot-top .rnd { margin-left: 0; margin-right: auto; }
.slot-top .rnd, .slot-top .side-name { white-space: nowrap; }
@media (max-width: 560px) { .slot-top { flex-wrap: wrap; row-gap: 6px; } }   /* màn hẹp: tên bên một dòng, nút Ngẫu nhiên + Đang chọn xuống dòng dưới, không gãy chữ */
.fighter { display: flex; align-items: center; gap: 14px; }
.side1 .fighter { flex-direction: row-reverse; }
.slot-ball { width: 184px; height: 184px; flex: none; margin: -20px -14px -14px -18px; }
.side1 .slot-ball { margin: -20px -18px -14px -14px; }
.meta { min-width: 0; flex: 1; }
.slot-name { font-weight: 800; font-size: 34px; line-height: 1.1; letter-spacing: -.01em; }
.hpline { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.slot-hp { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hpbar { flex: 1; max-width: 150px; height: 6px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.hpbar i { display: block; height: 100%; border-radius: 3px; background: var(--team0); transition: width .3s ease; }
.side1 .hpbar i { background: var(--team1); }
.slot-tag { margin: 0; font-size: 15px; line-height: 1.4; color: var(--soft); }
.moves { margin-top: 8px; }
.moves summary { display: none; }
.moves p { margin: 0 0 5px; font-size: 13.5px; line-height: 1.5; color: #a9b3cb; max-width: 64ch; }
.moves b { color: var(--ink); font-weight: 800; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px 4px; text-align: center; }
.vs { font-weight: 800; font-size: 58px; line-height: 1; color: var(--ink); transform: skewX(-8deg); text-shadow: 0 4px 0 #0009; }
.center .go { width: 100%; max-width: 196px; padding: 15px 0; font-size: 19px; }
.pair { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.small { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.howto { margin: 0; max-width: 200px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* 2 đấu 2 */
.duel.two .team { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.duel.two .side1 .slot-top { justify-content: flex-end; }
.mslot { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; background: #0b111ecc; border: 1px solid var(--line); border-radius: 16px; padding: 8px 14px 8px 8px; outline: 2px solid transparent; outline-offset: -1px; transition: outline-color .15s, border-color .15s; }
.mslot:hover { border-color: var(--line2); }
.mslot.active { outline-color: var(--gold); }
.mslot canvas { width: 88px; height: 88px; flex: none; margin: -8px -4px; }
.mtext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mname { font-weight: 800; font-size: 20px; line-height: 1.15; }
.mhp { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.mtag { font-size: 13px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mslot .now { position: absolute; top: 8px; right: 10px; }
.side1 .mslot { flex-direction: row-reverse; text-align: right; padding: 8px 8px 8px 14px; }
.side1 .mslot .now { right: auto; left: 10px; }
.side1 .mtext { align-items: flex-end; }

/* Đánh boss: ô 3 banh dùng chung kiểu ô 2 đấu 2; thẻ chọn boss */
.duel.boss3 .team { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.bslot { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; background: #0b111ecc; border: 1px solid var(--line); border-radius: 16px; padding: 6px 14px 6px 8px; outline: 2px solid transparent; outline-offset: -1px; transition: outline-color .15s, border-color .15s; }
.bslot:hover { border-color: var(--line2); }
.bslot.active { outline-color: var(--gold); }
.bslot canvas { width: 72px; height: 72px; flex: none; margin: -8px -4px; }
.bslot .mname { font-size: 18px; }
.bslot .now { position: absolute; top: 8px; right: 10px; }
.bslot.active .now { visibility: visible; }
.bosses { display: flex; flex-direction: column; gap: 10px; }
.bosscard { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; background: #120c12cc; border: 1px solid #4a2a2a; border-radius: 16px; padding: 6px 14px 8px 8px; outline: 2px solid transparent; outline-offset: -1px; transition: outline-color .15s, border-color .15s; }
.bosscard:hover { border-color: #7a3a3a; }
.bosscard.on { outline-color: var(--gold); background: #1c1010; }
.bosscard canvas { width: 84px; height: 84px; flex: none; margin: -8px -6px; }
.btext { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bname { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.bhp { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #ff6b6b26; color: #ff9a9a; }
.bline { font-size: 12.5px; line-height: 1.4; color: var(--soft); }
.bline b { color: var(--ink); font-weight: 800; }
.bosscard .now { position: absolute; top: 8px; right: 10px; }
.bosscard.on .now { visibility: visible; }
.focus-ring:focus-visible, .bslot:focus-visible, .bosscard:focus-visible { outline: 2px solid #ffffffb0; outline-offset: 2px; }

/* kho banh */
.rbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 24px 0 6px; }
.rbar h2 { margin: 0 auto 0 0; font-size: 20px; font-weight: 800; }
#count { margin-left: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { width: 250px; font: 600 14px 'BVP', system-ui, sans-serif; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 38px; outline: none; }
.search input:focus { border-color: #5b6c95; }
.search input::placeholder { color: #67738f; }
.sorts { display: inline-flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.sort { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 13.5px; padding: 7px 12px; border-radius: 9px; }
.sort:hover { color: var(--ink); }
.sort.on { background: #ffffff17; color: var(--ink); }
.picking { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.picking b { color: var(--ink); font-weight: 800; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 8px 6px 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; transition: background-color .15s, border-color .15s; }
.tile canvas { width: 100px; height: 100px; margin: -6px 0 -4px; transition: transform .18s ease; }
.tile:hover { background: var(--panel2); border-color: var(--line2); }
.tile:hover canvas { transform: translateY(-3px) scale(1.05); }
.t-name { max-width: 100%; font-weight: 800; font-size: 14.5px; line-height: 1.25; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-hp { margin-top: auto; padding-top: 1px; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.t-new { position: absolute; top: 7px; right: 7px; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: #ffffff17; color: var(--ink); }
.t-new.fix { background: #ffc93d24; color: var(--gold); }
.t-new.up, .nb.up { background: #7fd6a424; color: #8fe3b3; }        /* sếp: ghi rõ tăng (xanh) hay giảm (đỏ) */
.t-new.down, .nb.down { background: #ff6b6b26; color: #ff9090; }
.t-new.mix, .nb.mix { background: #ffc93d24; color: var(--gold); }
.nb.moi { background: #ffffff17; color: var(--ink); }
.t-pick { position: absolute; top: 7px; left: 7px; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; color: #08111f; }
.t-pick:empty { display: none; }
.tile.sel0 { border-color: var(--team0); box-shadow: inset 0 0 0 1px var(--team0); }
.tile.sel0 .t-pick { background: var(--team0); }
.tile.sel1 { border-color: var(--team1); box-shadow: inset 0 0 0 1px var(--team1); }
.tile.sel1 .t-pick { background: var(--team1); }
.tile.sel0.sel1 { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.tile.sel0.sel1 .t-pick { background: var(--gold); }
.empty { margin: 0; padding: 36px 0; text-align: center; color: var(--muted); }

/* thanh dưới đáy */
.dock { position: fixed; left: 50%; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 14px; width: min(720px, calc(100% - 32px)); padding: 8px 8px 8px 12px; background: #0e1424; border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 18px 50px #000c; transform: translate(-50%, 160%); transition: transform .25s cubic-bezier(.2, .9, .3, 1); }
.dock.show { transform: translate(-50%, 0); }
.dock-picks { display: flex; align-items: center; flex: none; }
.dock-picks canvas { width: 46px; height: 46px; margin: -6px -5px; }
.dock-picks .mini-vs { margin: 0 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.dock-msg { flex: 1; min-width: 0; font-size: 13.5px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .go { flex: none; padding: 11px 26px; font-size: 16px; box-shadow: 0 4px 0 #b8861a; }

/* chuyển động chính: banh vừa chọn rơi xuống góc đài */
@keyframes drop { 0% { transform: translateY(-28px) scale(.9); opacity: 0; } 60% { transform: translateY(4px) scale(1.02); opacity: 1; } 100% { transform: none; opacity: 1; } }
.drop { animation: drop .42s cubic-bezier(.2, .9, .3, 1.2) both; }

@media (max-width: 1100px) {
  .duel { grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr); }
  .slot-ball { width: 160px; height: 160px; }
  .slot-name { font-size: 28px; }
}
@media (max-width: 720px) {
  #pick { padding: 12px 12px calc(100px + env(safe-area-inset-bottom)); }
  .pbar { grid-template-columns: 1fr auto; gap: 10px; }
  .news { padding: 12px 12px 10px; border-radius: 16px; }
  .news-head { flex-wrap: wrap; }
  .ncard { flex-basis: 270px; }
  .newsbtn { padding: 8px 10px; }
  .pbar .modes { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .mode { flex: 1; }
  h1 { font-size: 22px; }
  h1::before { width: 16px; height: 16px; }
  .sound { padding: 9px 10px; }
  .sound span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .matchup { border-radius: 18px; }
  .matchup::after { width: 150px; height: 150px; margin: -75px 0 0 -75px; top: 34%; }
  .duel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .duel .center { grid-column: 1 / -1; grid-row: 2; flex-direction: row; flex-wrap: wrap; padding: 0 10px 14px; gap: 8px; }
  .duel .center .go, .duel .center .howto { display: none; }
  .vs { position: absolute; left: 50%; top: 112px; z-index: 2; margin-left: -22px; font-size: 30px; }
  .slot { margin: 6px; padding: 10px 8px 10px; align-self: start; }
  .slot-top { justify-content: center; }
  .side-name { font-size: 13px; }
  .now { display: none; }
  .fighter, .side1 .fighter { flex-direction: column; text-align: center; gap: 2px; }
  .slot-ball, .side1 .slot-ball { width: 118px; height: 118px; margin: -10px 0 -10px; }
  .slot-name { font-size: 19px; }
  .hpline { justify-content: center; margin: 4px 0 6px; }
  .hpbar { max-width: 60px; }
  .slot-tag { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .moves summary { display: block; margin-top: 6px; font-size: 12.5px; font-weight: 800; color: var(--muted); text-align: center; list-style: none; cursor: pointer; }
  .moves summary::-webkit-details-marker { display: none; }
  .moves[open] summary { margin-bottom: 6px; }
  .moves p { font-size: 12.5px; line-height: 1.5; }
  .duel.two .team, .duel.boss3 .team { padding: 8px 6px 10px; }
  .duel.boss3 .slot-top { justify-content: center; }
  .bslot { flex-direction: column; text-align: center; gap: 2px; padding: 6px 4px 8px; }
  .bslot .mtext { align-items: center; }
  .bslot canvas { width: 60px; height: 60px; margin: -6px 0 -4px; }
  .bslot .mname { font-size: 14px; }
  .bslot .mtag, .bslot .now, .bosscard .now { display: none; }
  .bosscard { flex-direction: column; text-align: center; gap: 2px; padding: 6px 6px 8px; }
  .bosscard canvas { width: 64px; height: 64px; margin: -6px 0 -2px; }
  .bname { flex-direction: column; gap: 2px; font-size: 14px; }
  .bline { display: none; }
  .duel.two .slot-top, .duel.two .side1 .slot-top { justify-content: center; }
  .mslot, .side1 .mslot { flex-direction: column; text-align: center; gap: 2px; padding: 8px 6px 10px; }
  .mtext, .side1 .mtext { align-items: center; }
  .mslot canvas { width: 76px; height: 76px; margin: -8px 0 -4px; }
  .mname { font-size: 15px; }
  .mtag, .mslot .now { display: none; }
  .rbar { gap: 8px; margin-top: 16px; }
  .rbar h2 { flex: 1 1 100%; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; font-size: 16px; }
  .sorts { flex: 1 1 100%; }
  .sort { flex: 1; padding: 10px 8px; }
  .mode { padding: 10px 16px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile canvas { width: 84px; height: 84px; }
  .t-name { font-size: 13px; }
  .dock { bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(100% - 20px); gap: 10px; transform: translate(-50%, 0); }
  .dock-msg { font-size: 12.5px; line-height: 1.3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .dock .go { padding: 11px 18px; }
  .dock.two .dock-msg { display: none; }
  .dock.two .dock-picks { margin-right: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .drop { animation: none; }
  .dock { transition: none; }
  .tile canvas { transition: none; }
}

.hud.two .bar.sk, .hud.two .plate-skill { display: none; }
.hud.two .bar.hp.low .fill { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, white) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 75%, black) 100%); animation: lowpulse .8s ease-in-out infinite; }
@keyframes lowpulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.hud.two .plate-name { font-size: 15px; }
.hud.two .plate-row { flex-direction: column; align-items: flex-start; gap: 2px; }
.hud.two .plate[data-side="1"] .plate-row { flex-direction: column; align-items: flex-end; }

/* ---------- màn đấu ---------- */
#fight { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 12px 16px 14px; gap: 10px; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; width: 100%; }
.plate { display: flex; align-items: center; gap: 12px; min-width: 0; }
.plate[data-side="1"] { flex-direction: row-reverse; text-align: right; }
.plate-ball { width: 46px; height: 46px; flex: none; }
.plate-main { flex: 1; min-width: 0; }
.plate-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.plate[data-side="1"] .plate-row { flex-direction: row-reverse; }
.plate-name { font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { display: inline-block; vertical-align: 2px; margin: 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; color: #08111f; }
.who.p0 { background: var(--team0); }
.who.p1 { background: #7f8aa6; }
.plate-hp { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.plate-hp small { font-weight: 600; color: var(--muted); font-size: 12px; }
.bar { position: relative; height: 13px; border-radius: 7px; background: #0b0f1a; border: 1px solid #ffffff14; overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; border-radius: 6px; }
.plate[data-side="1"] .bar i { left: auto; right: 0; }
.bar.hp .fill { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, white) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 75%, black) 100%); }
.bar.hp .ghostfill { background: #ffffffd0; }
.bar.hp .wound { left: auto; right: 0; width: 0; border-radius: 0 6px 6px 0; background: repeating-linear-gradient(135deg, #3a2350 0 4px, #1c1028 4px 8px); box-shadow: inset 2px 0 0 #b8a8ff; }   /* phần thọ bị Thần Chết cắt: không hồi lại được */
.plate[data-side="1"] .bar.hp .wound { right: auto; left: 0; border-radius: 6px 0 0 6px; box-shadow: inset -2px 0 0 #b8a8ff; }
.bar.hp.low .fill { background: linear-gradient(180deg, #ff8a95, var(--hp-low)); }
.bar.sk { height: 6px; margin-top: 5px; border-color: #ffffff0d; }
.bar.sk .fill { background: #b9c4dd; }
.bar.sk.ready .fill { background: var(--gold); box-shadow: 0 0 10px #ffc93d99; }
.bar.sk.drain .fill { background: #3dff7a; box-shadow: 0 0 10px #3dff7a99; }
/* thanh máu, vết cắt thọ, thanh chiêu: game.js đặt độ dài mỗi khung → trượt nhanh tới giá trị mới thay vì nhảy cục.
   Đường cong bắt đầu nhanh (đổi liên tục mỗi khung vẫn bám sát, trễ chừng 50 ms), mất máu một cú thì trượt xong trong 0,16 s.
   Thanh trắng .ghostfill để nguyên: JS đã cho tụt dần. */
.bar.hp .fill, .bar.hp .wound, .bar.sk .fill { transition: width .16s cubic-bezier(.25, .8, .35, 1); }
@media (prefers-reduced-motion: reduce) {
  .bar.hp .fill, .bar.hp .wound, .bar.sk .fill { transition: none; }
}
.plate-skill { margin-top: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-skill b { color: var(--ink); font-weight: 700; }
.plate-skill .rdy { color: var(--gold); font-weight: 800; }
.clock { display: flex; flex-direction: column; align-items: center; min-width: 86px; }
.clock span { font-weight: 800; font-size: 24px; font-variant-numeric: tabular-nums; }
.clock small { font-size: 12px; font-weight: 700; color: var(--hp-low); height: 15px; }
.stage { position: relative; flex: 1; width: 100%; display: flex; justify-content: center; align-items: center; min-height: 0; }
#arena { display: block; }
.bottom { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.bottom .ghost { padding: 8px 14px; font-size: 14px; }

.result { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; pointer-events: none; }
.result .card {
  position: relative; display: flex;
  pointer-events: auto; cursor: default; transform: none; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  width: min(440px, 92%); padding: 24px 26px 22px; background: #0e1424f2; border: 2px solid var(--line2); border-radius: 22px;
  box-shadow: 0 30px 80px #000a; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}
.result .card:hover { transform: none; background: #0e1424f2; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.win-ball { width: 100px; height: 100px; }
.result h2 { margin: 6px 0 2px; font-size: 34px; font-weight: 800; line-height: 1.1; }
.result #winSub { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-bottom: 10px; }
.stats div { background: #ffffff08; border: 1px solid #ffffff10; border-radius: 12px; padding: 9px 10px; font-size: 13px; color: #c3cbe0; line-height: 1.5; }
.stats div b { display: block; color: var(--ink); font-size: 14px; }
.tally { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.result .row { display: flex; gap: 10px; }

@media (max-width: 720px) {
  .plate-skill { display: none; }
  .plate-name { font-size: 15px; }
}
/* điện thoại xoay ngang (sếp 25/11 "chơi ngang nha"): sân cao hết màn ở giữa, bảng máu hai bên, đồng hồ góc trái dưới, nút gọn góc phải dưới; không phải cuộn */
@media (orientation: landscape) and (max-height: 540px) {
  /* màn chọn: thanh trên một hàng, không gãy chữ ("1 / đấu / 1", "Âm / thanh"), nút âm thanh chỉ còn biểu tượng */
  #pick { padding: 10px max(14px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .pbar { gap: 10px; margin-bottom: 10px; }
  h1 { font-size: 22px; white-space: nowrap; }
  h1::before { width: 16px; height: 16px; }
  .mode { white-space: nowrap; font-size: 13px; padding: 6px 11px; }
  .pright .ghost { white-space: nowrap; }
  .sound { padding: 8px 10px; }
  .sound span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #fight { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: 14px; row-gap: 8px;
           align-items: start; height: 100dvh; min-height: 0; overflow: hidden;
           padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  #fight .hud { display: contents; }
  #fight .plate { grid-row: 1; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
  #fight .plate[data-side="0"] { grid-column: 1; }
  #fight .plate[data-side="1"] { grid-column: 3; flex-direction: column; text-align: right; }
  #fight .plate-ball { width: 40px; height: 40px; }
  #fight .plate[data-side="1"] .plate-ball { align-self: flex-end; }
  #fight .plate-row, #fight .plate[data-side="1"] .plate-row { flex-direction: column; align-items: flex-start; gap: 1px; margin-bottom: 5px; }
  #fight .plate[data-side="1"] .plate-row { align-items: flex-end; }
  #fight .plate-name { font-size: 16px; max-width: 100%; }
  #fight .plate-hp { font-size: 15px; white-space: nowrap; }
  #fight .plate-skill { display: block; font-size: 12.5px; }
  #fight .clock { grid-column: 1; grid-row: 3; align-self: end; align-items: flex-start; min-width: 0; }
  #fight .clock span { font-size: 26px; }
  #fight .stage { grid-column: 2; grid-row: 1 / span 3; flex: none; width: min(calc(100dvh - 16px), 64vw); height: calc(100dvh - 16px); }
  #fight .bottom { grid-column: 3; grid-row: 2 / span 2; align-self: end; justify-content: flex-end; gap: 6px; }
  #fight .bottom .ghost { padding: 7px 11px; font-size: 13px; }
  #fight .bottom kbd { display: none; }
  /* thẻ kết quả gọn lại cho vừa sân (trước cao ~500 px, tràn mất mép trên và nút Đấu lại) */
  #fight .result .card { width: 96%; max-height: 96%; overflow-y: auto; padding: 12px 14px 12px; gap: 2px; border-radius: 16px; }
  #fight .win-ball { width: 56px; height: 56px; }
  #fight .result h2 { margin: 2px 0 0; font-size: 24px; }
  #fight .result #winSub { margin: 0 0 6px; font-size: 12.5px; }
  #fight .stats { gap: 6px; margin-bottom: 6px; }
  #fight .stats div { padding: 5px 8px; font-size: 11.5px; line-height: 1.35; border-radius: 10px; }
  #fight .stats div b { font-size: 12.5px; }
  #fight .tally { margin: 0 0 8px; font-size: 11.5px; }
  #fight .result .row .primary, #fight .result .row .ghost { padding: 8px 14px; font-size: 14px; }
}
@media (max-width: 480px) {                                            /* điện thoại: tên trên, số máu dưới (không cắt tên còn "L…", không gãy "81 / 90") */
  .hud { gap: 8px; }
  .plate { gap: 6px; }
  .plate-ball { width: 34px; height: 34px; }
  .plate-row, .plate[data-side="1"] .plate-row { flex-direction: column; align-items: flex-start; gap: 1px; margin-bottom: 4px; }
  .plate[data-side="1"] .plate-row { align-items: flex-end; }
  .plate-name { font-size: 14px; max-width: 100%; }
  .plate-hp { font-size: 14px; white-space: nowrap; }
  .clock { min-width: 56px; }
  .clock span { font-size: 20px; }
}

/* ============ bảng xếp hạng (nút "Bảng xếp hạng" ở thanh trên màn chọn) ============ */
.rank { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px 16px; background: rgba(5, 8, 15, .74); }
.rank[hidden] { display: none; }
.rank-box { width: min(760px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 24px 60px #000a; }
.rank-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.rank-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.rank-head p { margin: 5px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.rank-list { overflow-y: auto; padding: 0 12px 14px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #33415f transparent; }
.rtier { --tc: #8f9bb8; }
.rtier.tS { --tc: #ff6b6b; }
.rtier.tA { --tc: var(--gold); }
.rtier.tB { --tc: #7fd6a4; }
.rtier h3 { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 14px 6px 8px; background: var(--panel); font-size: 16px; font-weight: 800; }
.rtier h3 small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tk { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--tc); color: #0b0f1a; font-size: 14px; font-weight: 900; }
.rrow { width: 100%; display: grid; grid-template-columns: 28px 44px minmax(0, 1fr) minmax(80px, 210px) 46px 44px; align-items: center; gap: 10px; padding: 3px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.rrow:hover, .rrow:focus-visible { background: #ffffff0f; outline: none; }
.rrow:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.rn { font-size: 13px; font-weight: 800; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rrow canvas { width: 44px; height: 44px; }
.rname { min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .rbar { height: 8px; border-radius: 99px; background: #ffffff12; overflow: hidden; }   /* chỉ thanh trong bảng xếp hạng (đừng đè thanh "Kho banh" cùng tên) */
.rrow .rbar i { display: block; height: 100%; border-radius: inherit; background: var(--tc); }
.rpct { font-size: 15px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.rdelta { font-size: 12.5px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rdelta.up { color: #7fd6a4; }
.rdelta.down { color: #ff8a8a; }
body.noscroll { overflow: hidden; }
/* ---------- chỉ số kiểu game (25/11): Tấn công, Phòng thủ, Tốc độ, Hồi phục, Khống chế, Tầm đánh (1–10) ---------- */
.cs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px; margin: 8px 0 6px; }
.cs:empty { display: none; }
.cs-i { display: grid; grid-template-columns: 74px minmax(0, 1fr) 20px; align-items: center; gap: 8px; }
.cs-l { font-size: 12.5px; font-weight: 700; color: var(--soft); white-space: nowrap; }
.cs-b { display: block; height: 7px; border-radius: 99px; background: #ffffff14; overflow: hidden; }
.cs-b i { display: block; height: 100%; border-radius: inherit; background: var(--cc, var(--gold)); }
.cs-v { font-size: 13px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.cs-atk { --cc: #ff7a6b; } .cs-def { --cc: #6bb7ff; } .cs-spd { --cc: #7fe0c8; } .cs-heal { --cc: #7fd67f; } .cs-cc { --cc: #c79bff; } .cs-range { --cc: #ffc93d; }
.cs-big { grid-template-columns: repeat(3, 1fr); gap: 10px 22px; margin: 4px 0 12px; }
.cs-big .cs-i { grid-template-columns: 74px minmax(0, 1fr) 20px; row-gap: 2px; }
.cs-n { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.st-cs { min-width: 92px; }
.st-cs .cs-b { display: inline-block; width: 56px; height: 6px; margin-right: 8px; vertical-align: 2px; }
.st-cs b { display: inline-block; min-width: 16px; color: var(--ink); }
.st-base { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 720px) { .cs { grid-template-columns: 1fr; gap: 4px; } .cs-big { grid-template-columns: 1fr 1fr; } .cs-i { grid-template-columns: 66px minmax(0, 1fr) 18px; } }
/* ---------- bảng thông số từng banh (25/11) ---------- */
.stats-box { width: min(1060px, 100%); min-width: 0; }   /* min-width 0: bảng rộng chỉ cuộn bên trong, không làm hộp phình ra ngoài màn hình */
.st-tools { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.st-tools input { flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; }
.st-tools input:focus { outline: none; border-color: var(--gold); }
.st-tools small { color: var(--muted); font-size: 13px; white-space: nowrap; }
.st-wrap { min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #33415f transparent; }
.st-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.st-table thead th { position: sticky; top: 0; z-index: 2; padding: 0; background: var(--panel); border-bottom: 1px solid var(--line2); text-align: right; white-space: nowrap; }
.st-table thead th:first-child { left: 0; z-index: 3; text-align: left; }
.st-table thead button { width: 100%; padding: 10px 12px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 800; text-align: inherit; }
.st-table thead button:hover { color: var(--ink); }
.st-table thead th[aria-sort="descending"] button, .st-table thead th[aria-sort="ascending"] button { color: var(--gold); }
.st-table thead th[aria-sort="descending"] button::after { content: " ▼"; font-size: 10px; }
.st-table thead th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 10px; }
.st-table tbody td { padding: 6px 12px; text-align: right; color: var(--soft); white-space: nowrap; border-bottom: 1px solid var(--line); }
.st-table tbody th { position: sticky; left: 0; z-index: 1; padding: 4px 12px 4px 8px; text-align: left; font-weight: 500; background: var(--panel); border-bottom: 1px solid var(--line); }
.st-row { cursor: pointer; }
.st-row:hover > *, .st-row:focus-visible > *, .st-row.open > * { background: var(--panel2); }
.st-row:focus-visible { outline: none; }
.st-row:focus-visible th { box-shadow: inset 3px 0 0 var(--gold); }
.st-ball { display: flex; align-items: center; gap: 8px; min-width: 170px; }
.st-ball canvas { width: 40px; height: 40px; flex: none; }
.st-ball b { display: block; font-size: 14.5px; color: var(--ink); }
.st-ball small { display: block; font-size: 12px; color: var(--muted); }
.st-tier { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 6px; background: #8f9bb8; color: #0b0f1a; font-size: 11.5px; font-weight: 900; vertical-align: 1px; }
.st-tier.tS { background: #ff6b6b; } .st-tier.tA { background: var(--gold); } .st-tier.tB { background: #7fd6a4; }
.st-na { color: #55607a; }
.st-table tbody .st-detail td { padding: 0; text-align: left; white-space: normal; color: var(--soft); background: var(--panel2); border-bottom: 1px solid var(--line2); }
.st-dbox { position: sticky; left: 0; max-width: min(900px, calc(100vw - 40px)); padding: 10px 16px 16px; }
.st-moves p { margin: 0 0 8px; color: var(--soft); font-size: 14px; line-height: 1.55; }
.st-moves b { color: var(--ink); }
.st-params summary { margin: 6px 0; color: var(--soft); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.st-params dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 18px; margin: 6px 0 12px; }
.st-params dl div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.st-params dt { color: var(--muted); font-size: 13px; }
.st-params dt.raw { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.st-params dd { margin: 0; color: var(--ink); font-size: 13px; font-weight: 700; }
@media (max-width: 720px) {
  .st-tools { padding: 8px 12px; }
  .st-ball { min-width: 138px; }
  .st-ball canvas { width: 34px; height: 34px; }
  .st-table tbody td, .st-table thead button { padding-left: 8px; padding-right: 8px; }
  .st-dbox { padding: 10px 12px 14px; }
}
@media (max-width: 720px) {
  .rank { padding: 0; place-items: stretch; }
  .rank-box { width: 100%; max-height: 100dvh; border: 0; border-radius: 0; }
  .rank-head { padding: max(14px, env(safe-area-inset-top)) 16px 10px; }
  .rank-list { padding: 0 8px max(14px, env(safe-area-inset-bottom)); }
  .rrow { grid-template-columns: 22px 38px minmax(0, 1fr) 42px 40px; grid-template-areas: "n c nm p d" "n c br br br"; row-gap: 2px; padding: 5px 6px; }
  .rn { grid-area: n; } .rrow canvas { grid-area: c; width: 38px; height: 38px; } .rname { grid-area: nm; } .rrow .rbar { grid-area: br; height: 6px; } .rpct { grid-area: p; } .rdelta { grid-area: d; }
}

/* ============ đấu giải (sếp 24/11): chọn 16 banh → bốc thăm → tự đấu loại trực tiếp → xếp hạng ============ */
/* màn chọn: 16 ô dự giải */
.matchup.cupm::before, .matchup.cupm::after { display: none; }
.matchup.cupm { background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px); background-size: 36px 36px, 36px 36px; }
.duel.cup16 { grid-template-columns: minmax(0, 1fr) 240px; }
.cup16 .team { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.cup16 .side-name { color: var(--gold); }
.cup-count { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 3px 10px; border-radius: 999px; background: #ffffff12; color: var(--soft); }
.cup-count.full { background: var(--gold); color: var(--gold-ink); }
.cup-cells { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.ccell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; min-width: 0; height: 100px; padding: 4px 4px 7px; background: #0b111ecc; border: 1px dashed var(--line2); border-radius: 12px; color: var(--ink); }
.ccell canvas { width: 66px; height: 66px; margin: -4px 0 -2px; }
.ccell:not(.filled) canvas { visibility: hidden; }
.ccell:not(.filled)::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 600; color: #ffffff2e; }
.ccell.filled { border-style: solid; border-color: var(--line); cursor: pointer; transition: border-color .15s, background-color .15s; }
.ccell.filled:hover { border-color: #ff6b6b99; background: #1a1220; }
.ccell.filled:hover::after { content: 'Bỏ ra'; position: absolute; top: 4px; right: 5px; padding: 1px 6px; border-radius: 6px; background: #ff6b6b; color: #1a0508; font-size: 10.5px; font-weight: 800; }
.ccell:disabled { cursor: default; }
.ccell:focus-visible { outline: 2px solid #ffffffb0; outline-offset: 2px; }
.cname { max-width: 100%; font-size: 11.5px; font-weight: 800; line-height: 1.2; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cup-ico { width: 58px; height: 58px; fill: var(--gold); stroke: var(--gold); stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 4px 0 #0008); }
.dock.cupd .dock-picks { display: none; }

/* màn đấu: dòng "Đấu giải: Tứ kết, trận 9 trên 16"; nút riêng của giải */
.cuptag { margin: 0; font-size: 13.5px; font-weight: 800; color: var(--gold); }
#fight:not(.cupmode) .only-cup { display: none !important; }
#fight.cupmode .no-cup { display: none !important; }
.cup-wait { margin: 10px 0 0; min-height: 17px; font-size: 13px; color: var(--muted); }

/* màn đấu giải */
#cup { max-width: 1440px; margin: 0 auto; padding: 18px 28px 40px; }
.cbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.ctitle { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; min-width: 0; }
.cmeta { margin: 0; font-size: 14px; color: var(--muted); }

/* trận sắp đấu: góc đài như màn chọn (nửa trái xanh, nửa phải đỏ) */
.cnext {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 250px minmax(0, 1fr); align-items: center; margin-bottom: 18px; padding: 8px 0;
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background-color: #0e1525;
  background-image: linear-gradient(90deg, rgba(90,169,255,.12) 0%, rgba(90,169,255,0) 40%, rgba(255,107,107,0) 60%, rgba(255,107,107,.12) 100%), linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 100% 100%, 36px 36px, 36px 36px;
}
.cn-side { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 6px 24px; }
.cn-side.side1 { flex-direction: row-reverse; text-align: right; }
.cn-side canvas { width: 156px; height: 156px; flex: none; margin: -16px -12px; }
.cn-text { min-width: 0; }
.cn-name { font-weight: 800; font-size: 30px; line-height: 1.1; letter-spacing: -.01em; }
.cn-sub { margin-top: 6px; font-size: 14px; font-weight: 800; color: var(--team0); }
.cn-side.side1 .cn-sub { color: var(--team1); }
.cn-tag { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: var(--soft); }
.cn-mid { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 6px; text-align: center; }
.cn-round { font-size: 22px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.cn-no { margin-top: -4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.cnext .vs { font-size: 44px; }
.cnext .go { width: 100%; max-width: 200px; padding: 13px 0; font-size: 17px; }
.cn-count { margin: 0; min-height: 17px; font-size: 13px; color: var(--soft); }

/* bảng đấu nhánh */
.bracket { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(170px, 1.15fr) repeat(3, minmax(0, 1fr)); gap: 0 26px; padding: 4px 2px 8px; }
.blinks { position: absolute; left: 0; top: 0; pointer-events: none; }
.blinks path { fill: none; stroke: #2e3a57; stroke-width: 1.5; }
.blinks path.on { stroke: #ffc93d80; }
.bcol { position: relative; display: flex; flex-direction: column; min-width: 0; }
.bcol h3 { margin: 0 0 10px; font-size: 13px; font-weight: 800; color: var(--muted); text-align: center; }
.bms { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 14px; }
.bm { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; padding: 17px 6px 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s, box-shadow .2s; }
.bm-no { position: absolute; top: 3px; left: 10px; font-size: 10.5px; font-weight: 800; color: #6c789a; }
.bcol.R .bm-no { left: auto; right: 10px; }
.bm.cur { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 26px #ffc93d30; }
.bm.cur .bm-no { color: var(--gold); }
.bm.cur .bm-no::after { content: ', sắp đấu'; }
.br { display: flex; align-items: center; gap: 6px; min-width: 0; height: 30px; padding: 0 8px 0 2px; border-radius: 8px; transition: opacity .35s, background-color .35s; }
.bcol.R .br { flex-direction: row-reverse; text-align: right; padding: 0 2px 0 8px; }
.br canvas { width: 34px; height: 34px; flex: none; margin: -4px -3px; }
.br.tbd canvas { visibility: hidden; }
.bn { min-width: 0; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br.tbd .bn { font-weight: 600; color: #6c789a; }
.br.win { background: #ffc93d17; }
.br.win .bn { color: var(--gold); font-weight: 800; }
.br.lose > * { opacity: .36; }                                      /* làm mờ phần trong (khung dòng còn chạy hiệu ứng rơi giữ độ mờ 1) */
.bcol.C { justify-content: center; }
.bcol.C h3 { margin-top: 14px; }
.bcol.C .hfin { color: var(--gold); }
.champ { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.champ .cup-ico { width: 46px; height: 46px; opacity: .32; filter: none; }
.champ.won canvas { width: 104px; height: 104px; margin: -12px 0 -10px; }
.champ.won b { font-size: 18px; font-weight: 800; line-height: 1.15; color: var(--gold); }
.champ.won span { color: var(--soft); }

/* kết quả: bục nhận giải + bảng 1–16 */
.cres { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr); gap: 26px; align-items: start; margin-bottom: 22px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; padding-top: 6px; }
.pd { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.pd canvas { width: 132px; height: 132px; margin-bottom: -14px; }
.pd.p1 canvas { width: 176px; height: 176px; }
.pd b { max-width: 100%; font-size: 18px; font-weight: 800; line-height: 1.15; }
.pd span { margin: 3px 0 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pd.p1 span { color: var(--gold); }
.step { width: 100%; display: grid; place-items: center; border-radius: 12px 12px 4px 4px; font-size: 34px; font-weight: 800; color: #0b0f1a; transform-origin: bottom; animation: rise .6s cubic-bezier(.2, .9, .3, 1) both; }
.p1 .step { height: 150px; background: linear-gradient(#ffd866, #c8921a); }
.p2 .step { height: 108px; background: linear-gradient(#e6ecf7, #8e9ab3); animation-delay: .15s; }
.p3 .step { height: 80px; background: linear-gradient(#f2b27c, #9a5a2a); animation-delay: .3s; }
@keyframes rise { from { transform: scaleY(0); } to { transform: none; } }
.ctable h2 { margin: 0; font-size: 20px; font-weight: 800; }
.cnote { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.clist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(8, auto); grid-auto-flow: column; gap: 3px 16px; }
.crow { display: grid; grid-template-columns: 22px 38px minmax(0, 1fr) auto 62px; align-items: center; gap: 8px; padding: 3px 8px 3px 4px; border-radius: 10px; }
.crow.top { background: #ffffff09; }
.cr { font-size: 13px; font-weight: 800; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.crow.t1 .cr { color: var(--gold); }
.crow.t2 .cr { color: #d6deee; }
.crow.t3 .cr { color: #f2b27c; }
.crow canvas { width: 38px; height: 38px; }
.cnm { display: flex; flex-direction: column; min-width: 0; }
.cnm b { font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnm small { font-size: 12px; line-height: 1.3; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cwl { font-size: 12px; line-height: 1.25; color: var(--soft); text-align: right; white-space: nowrap; }
.cdm { font-size: 14px; font-weight: 800; line-height: 1.15; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cdm small { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.cres-act { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

@media (max-width: 1180px) {
  .cn-side canvas { width: 126px; height: 126px; }
  .cn-name { font-size: 25px; }
  .bracket { gap: 0 16px; }
  .br canvas { width: 30px; height: 30px; }
  .bn { font-size: 12px; }
  .cres { grid-template-columns: minmax(0, 1fr); }
  .podium { max-width: 560px; width: 100%; justify-self: center; }
}
@media (max-width: 980px) {                                           /* bảng đấu xếp dọc theo vòng, không vẽ đường nối */
  .bracket { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 8px; }
  .bcol { grid-column: 1 / -1; }
  .bcol.r2 { grid-column: auto; }                                    /* hai trận bán kết đứng cạnh nhau */
  .bcol.r2 .bms { grid-template-columns: minmax(0, 1fr); }
  .bcol.r2.R { margin-top: 0; }
  .bcol.r2.R h3 { display: block; visibility: hidden; }
  .bcol.r0.L { order: 1; } .bcol.r0.R { order: 2; } .bcol.r1.L { order: 3; } .bcol.r1.R { order: 4; } .bcol.r2.L { order: 5; } .bcol.r2.R { order: 6; } .bcol.C { order: 7; }
  .bcol.R h3 { display: none; }
  .bcol.R { margin-top: -6px; }
  .bcol h3, .bcol.C h3 { margin: 0 0 8px; text-align: left; }
  .bms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bcol.R .br { flex-direction: row; text-align: left; padding: 0 8px 0 2px; }
  .bcol.R .bm-no { left: 10px; right: auto; }
  .bcol.C { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
  .bcol.C > .h3rd { order: 1; grid-column: 2; grid-row: 1; }
  .bcol.C > .bm[data-i="14"] { order: 2; grid-column: 2; grid-row: 2; }
  .bcol.C > .hfin { order: 3; grid-column: 1; grid-row: 1; }
  .bcol.C > .bm[data-i="15"] { order: 4; grid-column: 1; grid-row: 2; }
  .champ { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; }
}
@media (max-width: 720px) {
  .duel.cup16 { grid-template-columns: minmax(0, 1fr); }
  .cup16 .team { padding: 10px 8px 12px; }
  .cup16 .slot-top { justify-content: space-between; }
  .cup16 .cup-ico { display: none; }
  .cup-cells { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .ccell { height: 92px; }
  .ccell canvas { width: 60px; height: 60px; }
  #cup { padding: 12px 12px calc(28px + env(safe-area-inset-bottom)); }
  .cbar { flex-wrap: wrap; gap: 10px; }
  .cbar h1 { font-size: 22px; }
  .cbar .pright { flex-wrap: wrap; }
  .cnext { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 4px 0 10px; border-radius: 18px; }
  .cn-mid { grid-column: 1 / -1; grid-row: 2; margin-top: 10px; padding: 2px 12px 0; gap: 6px; }
  .cn-side, .cn-side.side1 { flex-direction: column; text-align: center; gap: 2px; padding: 8px 6px 0; }
  .cn-side canvas { width: 104px; height: 104px; margin: -8px 0 -6px; }
  .cn-name { font-size: 18px; }
  .cn-sub { margin-top: 3px; font-size: 12.5px; }
  .cn-tag { display: none; }
  .cnext .vs { position: absolute; left: 50%; top: 52px; width: 44px; margin-left: -22px; font-size: 26px; text-align: center; }
  .cn-round { font-size: 19px; }
  .cres { padding: 14px 12px; gap: 18px; border-radius: 18px; }
  .clist { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
  .pd canvas { width: 92px; height: 92px; margin-bottom: -10px; }
  .pd.p1 canvas { width: 118px; height: 118px; }
  .pd b { font-size: 14.5px; }
  .pd span { font-size: 12px; }
  .p1 .step { height: 104px; font-size: 28px; } .p2 .step { height: 76px; font-size: 28px; } .p3 .step { height: 56px; font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .step { animation: none; }
}
.tile.sel0 .t-new, .tile.sel1 .t-new { display: none; }                 /* ô đã chọn: nhãn "Dự giải"/"Của anh" thay chỗ nhãn cập nhật, khỏi đè nhau */
