/* pk/assets/pk-arena.css — bố cục đấu trường đè lên pk.css.
   Đấu trường toàn màn hình, HUD chỉ nằm ở mép: thanh đối đầu trên đỉnh, cụm icon góc
   phải, nút đánh lớn góc dưới phải; danh sách và đội hình mở khi cần. */
html, body { height: 100%; overflow: hidden; }

/* ---------- Đấu trường ---------- */
.arena { position: fixed; inset: 0; overflow: hidden; background: #0a1a14; }
.arena-bg { position: absolute; inset: 0; background: center bottom / cover no-repeat; filter: brightness(1.12) saturate(1.1); }
.arena-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 12, 9, .42), rgba(3, 12, 9, 0) 20%); }
.arena-ring { position: absolute; left: 50%; top: 72%; width: min(78vw, 860px); height: min(23vw, 240px); transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(248, 232, 152, .3); box-shadow: 0 0 0 10px rgba(248, 232, 152, .05), inset 0 0 50px rgba(248, 232, 152, .1); }
.field { position: absolute; inset: 0; }

.token { transform-origin: 75px 96px; position: absolute; left: 0; top: 0; width: 150px; height: 120px; margin: -96px 0 0 -75px; padding: 0; border: 0; background: none; cursor: pointer; will-change: transform; transition: opacity .3s ease, filter .15s ease; -webkit-tap-highlight-color: transparent; }
.token:hover { filter: brightness(1.25); }
.token.dim { opacity: .72; }
.token.me { cursor: default; }
.squad { position: absolute; inset: 0; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .55)); }
.token.flip .squad { transform: scaleX(-1); }
.spr { position: absolute; width: 114px; height: 114px; background-repeat: no-repeat; background-size: auto 100%; image-rendering: auto; pointer-events: none; }
.spr:nth-child(1) { left: 18px; top: 10px; }
.spr:nth-child(2) { left: -6px; top: 26px; }
.spr:nth-child(3) { left: 42px; top: 28px; }
.token.moving .spr { animation: bob .42s ease-in-out infinite alternate; }
.token.moving .spr:nth-child(2) { animation-delay: .14s; }
.token.moving .spr:nth-child(3) { animation-delay: .27s; }
@keyframes bob { to { translate: 0 -5px; } }
.token-tag { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 34px) scale(calc(1 / var(--s, 1))); transform-origin: bottom center; display: flex; flex-direction: column; align-items: center; max-width: 170px; pointer-events: none; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; }
.token-tag b { max-width: 170px; overflow: hidden; text-overflow: ellipsis; font: 700 13.5px/1.2 var(--title); color: #fff; }
.token-tag small { font: 400 11px/1.2 var(--body); color: var(--gold-2); }
.token.me .token-tag b { color: #a7f3b5; }
.token.foe .token-tag b { color: #ffb09e; }
.token::after { content: ""; position: absolute; left: 50%; top: 82px; width: 104px; height: 30px; transform: translateX(-50%); border-radius: 50%; pointer-events: none; }
.token.me::after { box-shadow: 0 0 0 2px #58c098, 0 0 18px #58c098; }
.token.foe::after { box-shadow: 0 0 0 2px #e0553f, 0 0 18px #e0553f; animation: ring-pulse 1.1s ease-in-out infinite; }
@keyframes ring-pulse { 50% { box-shadow: 0 0 0 3px #ff8a70, 0 0 28px #ff6a4a; } }

/* ---------- HUD ---------- */
body .hud { position: fixed; inset: 0; z-index: 10; display: block; height: auto; min-height: 0; padding: 0; overflow: hidden; pointer-events: none; }
.hud button, .hud a, .hud .modes { pointer-events: auto; }

/* Thanh đối đầu: hai thanh chĩa vào đồng hồ giữa. */
.vs-hud { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: min(100% - 16px, 780px); display: grid; grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr); align-items: start; gap: 6px; }
.side-hud { min-width: 0; display: flex; align-items: flex-start; gap: 8px; }
.side-hud.p2 { justify-content: flex-end; text-align: right; }
.side-body { flex: 1; min-width: 0; }
.vs-hud .avatar { position: relative; flex: none; width: 62px; height: 62px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: #071e1a; cursor: pointer; box-shadow: 0 0 0 2px var(--gold), 0 3px 8px #000b; }
.vs-hud .p2 .avatar { box-shadow: 0 0 0 2px #c6452f, 0 3px 8px #000b; }
.vs-hud .avatar img { width: 100%; height: 100%; object-fit: cover; }
.vs-hud .avatar .lv { position: absolute; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: auto; min-width: 0; margin: 0; padding: 0; transform: none; border: 0; background-image: none; font: 700 11px/1.35 var(--title); text-align: center; color: var(--gold-2); background: rgba(0, 0, 0, .68); }
.unit-name { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 14.5px; text-shadow: 0 1px 3px #000; }
.p2 .unit-name { justify-content: flex-end; }
.unit-name strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 15.5px/1.25 var(--title); }
.hp { height: 17px; margin-top: 3px; overflow: hidden; background: rgba(0, 0, 0, .68); box-shadow: 0 0 0 1px rgba(255, 255, 255, .28), 0 2px 5px #000a; }
.p1 .hp { transform: skewX(-22deg); display: flex; justify-content: flex-end; }
.p2 .hp { transform: skewX(22deg); }
.hp i { display: block; height: 100%; width: 0; transition: width .7s cubic-bezier(.2, .8, .3, 1); }
.p1 .hp i { background: linear-gradient(180deg, #ffe08a, #e0932e 60%, #b4631a); }
.p2 .hp i { background: linear-gradient(180deg, #ffb09e, #d7533f 60%, #8f2a1c); }
body .segbar { max-width: none; height: 9px; margin: 4px 0 4px; padding: 1px; }
.pips { display: flex; justify-content: flex-end; gap: 3px; height: 9px; margin: 4px 0; }
.pips i { width: 26px; transform: skewX(22deg); background: rgba(0, 0, 0, .55); box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.pips i.on { background: linear-gradient(180deg, #e7ff8a, #71c23a); }
body .res { gap: 3px; }
body .res div { padding: 0 6px; }
body .res dt { font-size: 11px; }
body .res dd { font-size: 13px; }
.foe-sub { font-size: 12px; color: var(--ink-2); text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.timer b { display: grid; place-items: center; width: 66px; height: 54px; clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%); background: linear-gradient(180deg, #24463e, #071b17); font: 700 26px/1 var(--title); color: var(--gold-2); text-shadow: 0 2px 4px #000; }
.timer small { font-size: 10.5px; color: var(--ink-2); white-space: nowrap; text-shadow: 0 1px 2px #000; }
.timer small span { color: var(--gold-2); }

/* Góc trái: chế độ đấu và mục tiêu. */
.left-rail { position: absolute; left: 10px; top: 100px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 46vw; }
.modes { display: flex; padding: 3px; border-radius: 18px; background: rgba(4, 22, 18, .82); box-shadow: 0 0 0 1px var(--jade-line); }
.modes button { padding: 5px 14px; border: 0; border-radius: 15px; background: none; font: 700 13.5px/1.2 var(--title); color: var(--ink-2); }
.modes button[aria-pressed="true"] { color: #06211d; background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.goal { padding: 3px 10px; border-radius: 10px; font-size: 12.5px; color: var(--gold-2); background: rgba(0, 0, 0, .5); text-shadow: 0 1px 2px #000; }

/* Góc phải: cụm icon tròn. */
body .menu { position: absolute; right: 10px; top: 100px; display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
@media (min-width: 1400px) { body .menu { top: 8px; } .left-rail { top: 8px; } }
body .mbtn { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 52px; padding: 0; border: 0; background: none; font: 700 10.5px/1.1 var(--title); color: var(--gold-2); text-decoration: none; text-shadow: 0 1px 2px #000, 0 0 3px #000; cursor: pointer; }
body .mbtn .ic { width: 40px; height: 40px; padding: 4px; border-radius: 50%; background: rgba(4, 22, 18, .78); box-shadow: 0 0 0 1px var(--jade-line); object-fit: contain; }
body .mbtn:hover .ic { box-shadow: 0 0 0 2px var(--gold-2); }

/* Góc dưới phải: nút đánh lớn, các nút phụ xếp thành cụm. */
body .dock { position: absolute; right: 10px; bottom: 10px; left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 0; background: none; }
body .actions { display: grid; grid-template-columns: repeat(3, 54px) 104px; grid-template-rows: 62px 62px; gap: 2px 4px; align-items: center; justify-items: center; }
.round { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 54px; padding: 0; border: 0; background: none; font: 700 10.5px/1.1 var(--title); color: var(--gold-2); text-decoration: none; text-shadow: 0 1px 2px #000, 0 0 3px #000; cursor: pointer; }
.round .ic { width: 42px; height: 42px; padding: 4px; border-radius: 50%; background: rgba(4, 22, 18, .82); box-shadow: 0 0 0 1px var(--jade-line); object-fit: contain; }
.round:hover .ic { box-shadow: 0 0 0 2px var(--gold-2); }
.round[aria-disabled="true"] { opacity: .5; }
#btn-foes { grid-column: 1; grid-row: 1; }
#btn-lineup { grid-column: 2; grid-row: 1; }
#btn-replay { grid-column: 3; grid-row: 1; }
#btn-refresh { grid-column: 2; grid-row: 2; }
#btn-switch-2 { grid-column: 3; grid-row: 2; }
body .act.fight { grid-column: 4; grid-row: 1 / span 2; width: 104px; height: 124px; margin: 0; }
body .act.fight .ic { width: 98px; height: 98px; }
body .watch-toggle { grid-column: auto; margin: 0; }
.chat-open { position: absolute; left: 10px; bottom: 12px; width: 56px; height: 56px; justify-content: center; border-radius: 50%; background: rgba(4, 22, 18, .82); box-shadow: 0 0 0 1px var(--jade-line); font-size: 13px; }
.chat-open .dot { position: absolute; right: 4px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #ff6a4a; }

/* ---------- Ngăn kéo ---------- */
.drawer { position: fixed; top: 0; bottom: 0; z-index: 30; display: flex; flex-direction: column; gap: 8px; width: min(100%, 390px); padding: 8px; overflow-y: auto; background: rgba(3, 16, 13, .9); box-shadow: 0 0 26px #000c; animation: drawer-r .22s cubic-bezier(.2, .8, .3, 1) both; }
.drawer.right { right: 0; }
.drawer.left { left: 0; animation-name: drawer-l; }
@keyframes drawer-r { from { transform: translateX(100%); } }
@keyframes drawer-l { from { transform: translateX(-100%); } }
.drawer-x { flex: none; align-self: flex-end; width: 36px; height: 36px; border: 1px solid var(--jade-line); border-radius: 50%; background: rgba(0, 0, 0, .5); font-size: 20px; line-height: 1; }
.drawer .panel { display: flex !important; flex-direction: column; flex: none; height: auto; }
.drawer .panel[hidden] { display: none !important; }
.drawer .panel.foes, .drawer .panel.chat { flex: 1; min-height: 340px; }
.drawer .foe-list { max-height: none; }
.drawer .chat { height: auto; }

/* ---------- Soi đội hình ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 10px; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .68); }
.sheet-box { position: relative; width: min(100%, 880px); max-height: calc(100dvh - 20px); overflow-y: auto; padding: 14px; border-radius: 10px; background: rgba(5, 30, 25, .97); box-shadow: 0 0 0 1px var(--jade-line), 0 10px 40px #000; animation: win-in .24s cubic-bezier(.2, .9, .3, 1.1) both; }
.sheet-box .win-x { position: absolute; right: 8px; top: 8px; z-index: 5; }
.sheet .stage { display: grid; grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr); align-items: center; gap: 6px; padding-top: 18px; }
.sheet .quickbar { display: flex; justify-content: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Hội 3v3 ---------- */
.team-pane h2 { text-align: center; }
.team-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.team-head b { font: 700 18px/1.2 var(--title); color: var(--gold-2); }
.team-stat { font-size: 12.5px; color: var(--ink-2); }
.team-code { display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 5px 10px; border-radius: 6px; background: rgba(0, 0, 0, .34); font-size: 12.5px; color: var(--ink-2); }
.team-code code { font: 700 17px/1.2 var(--title); letter-spacing: 2px; color: var(--gold-2); user-select: all; }
.team-code button, .team-row button.mini, .team-form button { padding: 4px 10px; border: 1px solid var(--jade-line); border-radius: 5px; background: rgba(0, 0, 0, .35); font-size: 12.5px; }
.team-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px; border-bottom: 1px solid rgba(113, 214, 186, .14); }
.team-row img { width: 42px; height: 42px; border-radius: 4px; object-fit: cover; background: #06211d; }
.team-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; font-size: 14px; }
.team-row small { display: block; font-size: 11.5px; color: var(--ink-2); }
.merit { font: 700 13px/1 var(--title); color: var(--gold-2); text-align: right; white-space: nowrap; }
.team-form { display: flex; gap: 6px; margin-top: 8px; }
.team-form input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--jade-line); border-radius: 5px; background: rgba(0, 0, 0, .42); }
.team-note { margin: 6px 0; font-size: 12.5px; color: var(--ink-2); }
.team-sub { margin: 10px 0 4px; font: 700 14px/1.2 var(--title); color: var(--gold-2); }
.team-foe { display: block; width: 100%; margin-bottom: 4px; padding: 6px 8px; border: 1px solid var(--jade-line); border-radius: 6px; background: rgba(0, 0, 0, .34); text-align: left; cursor: pointer; }
.team-foe[aria-pressed="true"] { border-color: var(--gold-2); background: rgba(248, 232, 152, .12); }
.team-foe > span { display: flex; justify-content: space-between; gap: 6px; font-size: 14px; }
.team-foe em { font: 400 11.5px/1.5 var(--body); color: var(--win); }
.team-faces { display: flex; gap: 3px; margin-top: 4px; }
.team-faces img { width: 30px; height: 30px; border-radius: 3px; object-fit: cover; background: #06211d; }
.bout { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 5px 6px; border-bottom: 1px solid rgba(113, 214, 186, .14); font-size: 13.5px; animation: row-in-up .28s ease both; animation-delay: calc(var(--i, 0) * 90ms + .3s); }
.bout small { color: var(--ink-2); }
.bout .w { color: var(--win); font-weight: 700; }
.bout .l { color: var(--ink-3); text-decoration: line-through; }
.score-line { margin-top: 4px; font: 700 15px/1.3 var(--title); text-shadow: 0 1px 3px #000; }
.win-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.win-tabs button { flex: 1; padding: 6px; border: 1px solid var(--jade-line); border-radius: 6px; background: rgba(0, 0, 0, .35); font-size: 13.5px; }
.win-tabs button[aria-pressed="true"] { color: var(--gold-2); border-color: var(--gold); }

/* ---------- Màn hẹp ---------- */
@media (max-width: 760px) {
  .vs-hud { grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr); gap: 3px; top: 4px; }
  .vs-hud .avatar { width: 40px; height: 40px; }
  .side-hud { gap: 4px; }
  .unit-name strong { font-size: 12.5px; }
  .unit-name .flag, .unit-name .tag:not(.tier) { display: none; }
  .unit-name .tag.tier { padding: 0 4px; font-size: 10px; }
  .hp { height: 12px; }
  body .segbar { height: 7px; margin: 3px 0; }
  .pips { height: 7px; margin: 3px 0; }
  .pips i { width: 16px; }
  body .res dt { font-size: 9.5px; }
  body .res dd { font-size: 11px; }
  body .res div { padding: 0 3px; gap: 2px; }
  .foe-sub { font-size: 10.5px; }
  .timer b { width: 50px; height: 40px; font-size: 19px; }
  .timer small { display: none; }
  .left-rail { left: 6px; top: 92px; max-width: 54vw; }
  .modes button { padding: 4px 10px; font-size: 12px; }
  .goal { font-size: 11.5px; }
  body .menu { right: 6px; top: 92px; gap: 2px; }
  body .mbtn { width: 36px; font-size: 0; }
  body .mbtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body .mbtn .ic { width: 34px; height: 34px; }
  .sheet .stage { grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr); }
  .sheet .vs img { width: 26px; height: 26px; }
  .sheet-box { padding: 10px 6px; }
  body .dock { right: 6px; bottom: 8px; }
  body .actions { grid-template-columns: repeat(2, 50px) 92px; grid-template-rows: 58px 58px 58px; }
  #btn-foes { grid-column: 1; grid-row: 2; }
  #btn-lineup { grid-column: 2; grid-row: 2; }
  #btn-replay { grid-column: 1; grid-row: 3; }
  #btn-refresh { grid-column: 3; grid-row: 1; }
  #btn-switch-2 { grid-column: 2; grid-row: 3; }
  .round { width: 50px; }
  .round .ic { width: 38px; height: 38px; }
  body .act.fight { grid-column: 3; grid-row: 2 / span 2; width: 92px; height: 110px; }
  body .act.fight .ic { width: 86px; height: 86px; }
  .chat-open { width: 48px; height: 48px; left: 6px; bottom: 10px; }
  .token { transform-origin: 75px 96px; }
}
@media (max-height: 520px) {
  .left-rail, body .menu { top: 62px; }
  body .res, .foe-sub, .timer small { display: none; }
  .left-rail { flex-direction: row; align-items: center; }
  .goal { display: none; }
  body .actions { grid-template-rows: 50px 50px; }
  .round .ic { width: 34px; height: 34px; }
  .round span { font-size: 9px; }
  body .act.fight { height: 96px; }
}

/* Điện thoại dọc: xoay riêng khung phát để client game vẫn thấy màn ngang. */
@media (orientation: portrait) and (max-width: 820px) {
  .th-bar { height: 52px; }
  .th-stage iframe { left: 50%; top: 50%; width: calc(100dvh - 52px); height: 100vw; inset: auto auto auto auto; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(90deg); }
}

/* ---------- Di chuyển trên sân ---------- */
.field { cursor: crosshair; }
.move-mark { position: absolute; width: 64px; height: 26px; margin: -13px 0 0 -32px; border: 2px solid #a7f3b5; border-radius: 50%; pointer-events: none; animation: move-mark .55s ease-out both; }
@keyframes move-mark { from { opacity: 1; transform: scale(.3); } to { opacity: 0; transform: scale(1.3); } }
.move-hint { padding: 3px 10px; border-radius: 10px; font-size: 12px; color: var(--ink-2); background: rgba(0, 0, 0, .5); }
@media (hover: none) { .move-hint { display: none; } }

/* ---------- Desktop: nút to, xếp vòng cung quanh nút đánh ---------- */
@media (min-width: 1100px) and (min-height: 640px) {
  .vs-hud { width: min(100% - 16px, 56vw); min-width: 760px; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr); }
  .vs-hud .avatar { width: 84px; height: 84px; }
  .unit-name strong { font-size: 19px; }
  .hp { height: 24px; }
  body .segbar { height: 11px; }
  .pips { height: 11px; }
  body .res dt { font-size: 13px; }
  body .res dd { font-size: 16px; }
  .foe-sub { font-size: 14px; }
  .timer b { width: 88px; height: 70px; font-size: 34px; }
  .timer small { font-size: 12px; }
  .modes button { padding: 9px 20px; font-size: 16px; }
  .goal { font-size: 15px; padding: 5px 12px; }
  .move-hint { font-size: 13.5px; padding: 4px 12px; }
  .left-rail, body .menu { top: 132px; }
  body .menu { gap: 10px; }
  body .mbtn { width: 80px; font-size: 13px; gap: 3px; }
  body .mbtn .ic { width: 64px; height: 64px; padding: 8px; }

  body .dock { right: 14px; bottom: 14px; }
  body .actions { display: block; position: relative; width: 340px; height: 355px; }
  body .act.fight { position: absolute; right: 0; bottom: 0; width: 178px; height: 196px; }
  body .act.fight .ic { width: 170px; height: 170px; }
  body .act.fight span { font-size: 18px; }
  body .actions .round { position: absolute; width: 88px; font-size: 13px; gap: 3px; }
  body .actions .round .ic { width: 72px; height: 72px; padding: 9px; }
  #btn-refresh { right: 243px; bottom: 10px; }
  #btn-switch-2 { right: 236px; bottom: 112px; }
  #btn-replay { right: 184px; bottom: 203px; }
  #btn-lineup { right: 96px; bottom: 250px; }
  #btn-foes { right: 0; bottom: 250px; }
  body .watch-toggle { position: absolute; right: 0; bottom: 362px; font-size: 14px; padding: 5px 14px; }
  .chat-open { width: 76px; height: 76px; left: 14px; bottom: 16px; font-size: 16px; }
  .token-tag b { font-size: 16px; }
  .token-tag small { font-size: 13px; }
}
@media (min-width: 1100px) and (max-width: 1500px) and (min-height: 640px) {
  .vs-hud { min-width: 680px; }
}

/* ---------- Kính trong, viền sáng ---------- */
.round .ic, body .mbtn .ic, .chat-open { background: rgba(20, 44, 52, .34); box-shadow: 0 0 0 2px rgba(255, 255, 255, .78), 0 3px 10px rgba(0, 0, 0, .3); backdrop-filter: blur(5px) saturate(1.2); -webkit-backdrop-filter: blur(5px) saturate(1.2); transition: transform .12s ease, background .12s ease; }
.round:hover .ic, body .mbtn:hover .ic, .chat-open:hover { background: rgba(255, 255, 255, .28); box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(255, 255, 255, .55); }
.round:active .ic, body .mbtn:active .ic { transform: scale(.92); }
.round, body .mbtn, .chat-open { color: #fff; text-shadow: 0 1px 3px #000, 0 0 5px rgba(0, 0, 0, .8); }
.modes { background: rgba(20, 44, 52, .42); box-shadow: 0 0 0 1px rgba(255, 255, 255, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.modes button { color: #fff; text-shadow: 0 1px 2px #000; }
.modes button[aria-pressed="true"] { text-shadow: none; }

/* Nhãn đọc được trên nền sáng. */
.token-tag b { padding: 1px 7px; border-radius: 9px; background: rgba(4, 22, 18, .62); }
.foe-sub, .timer small, body .res div { background: rgba(4, 22, 18, .6); }
.foe-sub { display: inline-block; max-width: 100%; padding: 1px 8px; border-radius: 9px; color: #fff; }
.timer small { padding: 1px 7px; border-radius: 8px; }
.unit-name strong { text-shadow: 0 1px 3px #000, 0 0 6px #000; color: #fff; }

/* Mục tiêu có thanh tiến độ mảnh. */
.goal { position: relative; padding-bottom: 7px; background: rgba(4, 22, 18, .6); color: #fff; }
.goal::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 2px; background: linear-gradient(90deg, var(--gold-2) var(--p, 0%), rgba(255, 255, 255, .28) var(--p, 0%)); }

/* Danh sách chân dung. */
.party { position: absolute; left: 12px; top: 250px; display: flex; flex-direction: column; gap: 8px; }
.party-row { display: flex; align-items: center; justify-content: flex-end; flex-direction: row-reverse; gap: 8px; min-width: 186px; padding: 0 12px 0 0; border: 0; border-radius: 30px; background: linear-gradient(90deg, rgba(4, 22, 18, .68), rgba(4, 22, 18, .08)); cursor: pointer; text-align: left; transition: transform .14s ease; }
.party-row:hover { transform: translateX(4px); }
.party-row img { flex: none; width: 58px; height: 58px; border-radius: 50%; object-fit: cover; background: #06211d; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.party-row[aria-pressed="true"] img { box-shadow: 0 0 0 3px #ff8a70, 0 0 16px #ff6a4a; }
.party-text b { display: block; max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 15px/1.25 var(--title); color: #fff; text-shadow: 0 1px 2px #000; }
.party-text small { font-size: 12.5px; color: var(--gold-2); text-shadow: 0 1px 2px #000; }

.sheet .quickbar { position: static; display: flex; justify-content: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; background: none; }

/* Joystick chỉ cho màn cảm ứng. */
.stick { display: none; }
@media (hover: none) {
  .stick { position: absolute; left: 16px; bottom: 72px; display: grid; place-items: center; width: 116px; height: 116px; border-radius: 50%; background: rgba(255, 255, 255, .12); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); pointer-events: auto; touch-action: none; }
  .stick i { width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); pointer-events: none; }
}
@media (max-width: 760px) {
  .party { left: 6px; top: 158px; gap: 6px; }
  .party-row { min-width: 0; padding: 0; background: none; }
  .party-text { display: none; }
  .party-row img { width: 44px; height: 44px; }
  .stick { width: 96px; height: 96px; left: 10px; bottom: 66px; }
  .stick i { width: 42px; height: 42px; }
}
@media (max-height: 520px) {
  .party { display: none; }
  .stick { left: 64px; bottom: 8px; width: 92px; height: 92px; }
  .stick i { width: 40px; height: 40px; }
}
@media (max-height: 760px) and (min-width: 1100px) {
  .party { top: 232px; gap: 4px; }
  .party-row img { width: 46px; height: 46px; }
}

/* ---------- Quân đại diện ---------- */
.avatar-pick { margin-top: 10px; }
.avatar-row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.avatar-opt { flex: none; width: 84px; padding: 4px; border: 1px solid var(--jade-line); border-radius: 8px; background: rgba(0, 0, 0, .3); cursor: pointer; font-size: 11.5px; line-height: 1.2; }
.avatar-opt[aria-pressed="true"] { border-color: var(--gold-2); background: rgba(248, 232, 152, .16); box-shadow: 0 0 0 1px var(--gold-2); }
.avatar-opt i { display: block; width: 72px; height: 72px; margin: 0 auto 2px; background-repeat: no-repeat; background-position: 0 0; background-size: auto 100%; }
.avatar-opt span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Emoji chat ---------- */
.emo { display: inline-block; width: 26px; height: 26px; margin: 0 1px; vertical-align: middle; object-fit: contain; }
.chat-form .emoji-btn { width: 40px; padding: 0; border: 1px solid var(--jade-line); border-image: none; border-radius: 6px; background: rgba(0, 0, 0, .4); display: grid; place-items: center; }
.chat-form .emoji-btn img { width: 26px; height: 26px; object-fit: contain; }
.chat-form .emoji-btn:disabled { opacity: .5; }
.emoji-pan { flex: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; margin-top: 6px; padding: 6px; border-radius: 6px; background: rgba(0, 0, 0, .4); box-shadow: 0 0 0 1px var(--jade-line); }
.emoji-pan button { display: grid; place-items: center; height: 42px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.emoji-pan button:hover { background: rgba(255, 255, 255, .14); }
.emoji-pan img { width: 32px; height: 32px; object-fit: contain; }
