/* PVP 競技場、巔峰競賽（2026-10-01.5，js/arena.js）：由 index.html 在 style.css 後面載入 */
/* 競技場的紅（旗子、主要按鈕）、青銅金；VS 畫面、統計表：左邊挑戰的一方紅、右邊防守的一方藍（跟場上的「VS」、守方的藍色名字牌一樣）；
   樹狀圖上「我的場次」藍框；羊皮紙（淺色）＋夜戰；手機一欄、電腦兩欄，不能橫向捲動
   VS 畫面、結果面板是掛在 body 底下的，所以顏色變數也放在 .ar-vs-overlay、.ar-sheet 上 */
.arena-page, .ar-sheet, .ar-vs-overlay {
  --ar: #b3341c; --ar-ink: #8a2412; --ar-soft: rgba(179, 52, 28, 0.08); --ar-line: rgba(179, 52, 28, 0.34);
  --ar-l: #c0392b; --ar-r: #2f66b3; --ar-me: #2f66b3; --ar-me-soft: rgba(47, 102, 179, 0.1);
  --ar-up: #2e8a57; --ar-down: #b0302a; --ar-win: #c98a0a;
}
:root[data-theme="night"] .arena-page, :root[data-theme="night"] .ar-sheet, :root[data-theme="night"] .ar-vs-overlay {
  --ar: #ff7a52; --ar-ink: #ffb199; --ar-soft: rgba(255, 122, 82, 0.1); --ar-line: rgba(255, 122, 82, 0.42);
  --ar-l: #ff6a5a; --ar-r: #5a9aff; --ar-me: #5a9aff; --ar-me-soft: rgba(90, 154, 255, 0.13);
  --ar-up: #5fd07a; --ar-down: #ff6a5a; --ar-win: #f0c050;
}
.arena-page .card h2::before { background: var(--ar); }
.arena-page .ar-cup-now h2::before, .arena-page .ar-cup-hall h2::before, .arena-page .ar-cup-prize h2::before { background: var(--ar-win); }

/* 版面：手機一欄（實景 → 戰績 → 對手 → 排行 → 紀錄 → 說明；巔峰競賽：實景 → 狀態 → 樹狀圖 → 獎勵 → 歷屆冠軍）
   電腦兩欄（左：實景、對手／樹狀圖；右：戰績、排行、紀錄、說明／狀態、獎勵、歷屆冠軍） */
.ar-grid { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ar-col { display: contents; }
.ar-stage { order: 1; }
.ar-mine-card, .ar-cup-now { order: 2; }
.ar-opp-card, .ar-cup-br { order: 3; }
.ar-rank-card, .ar-cup-prize { order: 4; }
.ar-log-card, .ar-cup-hall { order: 5; }
.ar-info { order: 6; }
.arena-page .card { min-width: 0; }
@media (min-width: 1000px) {
  .ar-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .ar-col { display: grid; gap: 16px; min-width: 0; align-content: start; }
}

/* 分頁：⚔️ 競技場、🏆 巔峰競賽 */
.ar-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ar-tab { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px; min-height: 50px; padding: 6px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); box-shadow: 0 2px 0 var(--line); font: inherit; }
.ar-tab:hover { color: var(--text); border-color: var(--line-3); }
.ar-tab:disabled { cursor: default; opacity: 0.55; }
.ar-tab-t { font: 900 16px/1.2 var(--serif); }
.ar-tab-n { font: 700 12px/1 var(--font); opacity: 0.85; white-space: nowrap; }
.ar-tab.on { color: #fff; border-color: #6e1c0c; background: linear-gradient(180deg, #c8462a, #8c2412); box-shadow: inset 0 0 0 1px rgba(255, 220, 180, 0.35), 0 3px 0 #551407; }
.ar-tab-cup.on { border-color: #6e4806; background: linear-gradient(180deg, #d79a1c, #9a6206); box-shadow: inset 0 0 0 1px rgba(255, 240, 190, 0.4), 0 3px 0 #553604; }
.ar-tab-badge { font: 800 11px/1 var(--font); padding: 4px 8px; border-radius: 999px; background: #e0453a; color: #fff; white-space: nowrap; animation: ar-blink 1.1s ease-in-out infinite alternate; }
.ar-tab-badge.locked { background: #2e8a57; }
:root[data-theme="night"] .ar-tab { border-radius: 12px; box-shadow: none; }
:root[data-theme="night"] .ar-tab.on { background: linear-gradient(180deg, #ff7a52, #c8402a); border-color: #ff7a52; color: #1a0a06; box-shadow: none; }
:root[data-theme="night"] .ar-tab-cup.on { background: linear-gradient(180deg, #f5c85a, #d0941c); border-color: #f5c85a; color: #1a1206; }

/* 主要按鈕：挑戰（紅）、報名（金） */
.btn.ar-go { background: linear-gradient(180deg, #d0482c, #9c2a14); border-color: #73190a; color: #fff; min-width: 92px;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 190, 0.32), 0 3px 0 #551407; }
.btn.ar-go:hover { background: linear-gradient(180deg, #dc5636, #a8301a); border-color: #73190a; }
.btn.ar-go:active { box-shadow: inset 0 0 0 1px rgba(255, 220, 190, 0.32), 0 1px 0 #551407; }
.btn.ar-go:disabled { background: var(--surface-3); border-color: var(--line-2); color: var(--muted); box-shadow: none; opacity: 0.85; }
.btn.ar-cta { background: linear-gradient(180deg, #e0a524, #a86c08); border-color: #7a4c04; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 240, 190, 0.4), 0 3px 0 #553604; }
.btn.ar-cta:hover { background: linear-gradient(180deg, #ebb238, #b4760e); border-color: #7a4c04; }
:root[data-theme="night"] .btn.ar-go { background: linear-gradient(180deg, #ff7a52, #d0452a); border-color: #ff7a52; color: #1a0a06; box-shadow: none; }
:root[data-theme="night"] .btn.ar-go:hover { background: linear-gradient(180deg, #ff8c66, #dc5236); }
:root[data-theme="night"] .btn.ar-go:disabled { background: var(--surface-3); border-color: var(--line-2); color: var(--muted); }
:root[data-theme="night"] .btn.ar-cta { background: linear-gradient(180deg, #f5c85a, #d0941c); border-color: #f5c85a; color: #1a1206; box-shadow: none; }

/* 段位的小牌子（顏色照段位：--tc） */
.t-bronze { --tc: #a86a3a; }
.t-silver { --tc: #7a8794; }
.t-gold { --tc: #c38e0c; }
.t-plat { --tc: #1f9e95; }
.t-diamond { --tc: #3d74dc; }
.t-legend { --tc: #c03a8e; }
:root[data-theme="night"] .t-bronze { --tc: #d99a68; }
:root[data-theme="night"] .t-silver { --tc: #b8c4d2; }
:root[data-theme="night"] .t-gold { --tc: #f2c040; }
:root[data-theme="night"] .t-plat { --tc: #4fd6cb; }
:root[data-theme="night"] .t-diamond { --tc: #7aa6ff; }
:root[data-theme="night"] .t-legend { --tc: #f07ac4; }
.ar-tier { display: inline-flex; align-items: center; gap: 3px; flex: none; padding: 0 8px 0 5px; border-radius: 999px; white-space: nowrap; font: 800 12px/1.6 var(--font);
  color: color-mix(in srgb, var(--tc) 72%, #000); background: color-mix(in srgb, var(--tc) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc) 50%, transparent); }
.ar-tier i { font-style: normal; }
.ar-tier-pts { margin-left: 3px; font-weight: 700; opacity: 0.9; }
:root[data-theme="night"] .ar-tier { color: color-mix(in srgb, var(--tc) 75%, #fff); }

/* 頭像：電腦隊伍＝機器人 */
.ar-bot-head { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1;
  background: linear-gradient(180deg, #9aa8bb, #56647a); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.ar-bot-tag { flex: none; padding: 0 6px; border-radius: 4px; background: #5a6a80; color: #fff; font: 800 10px/1.7 var(--font); white-space: nowrap; }
:root[data-theme="night"] .ar-bot-tag { background: #6a7c96; color: #0c0e12; }

/* 一隊的小圖 */
.ar-team { display: flex; align-items: flex-end; gap: 2px 4px; min-width: 0; }
.ar-mini { display: inline-grid; justify-items: center; align-items: end; flex: none; }
.ar-mini-lv { font: 700 10px/1.3 var(--font); color: var(--muted); }

/* 🏟️ 競技場的實景（上面的 VS 橫條：打的時候才出現） */
.ar-stage { scroll-margin-top: 70px; }
.ar-stage .exp-scene { box-shadow: 0 0 0 2px var(--ar-line); }
.ar-stage.fighting .exp-scene { box-shadow: 0 0 0 2px var(--ar); }
.ar-sign { background: #7a2414; border-color: #3e0e06; }
.ar-vsbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 4px; max-width: 760px; margin: 0 auto 8px; padding: 5px;
  border-radius: 10px; color: #fff; line-height: 1.3; background: linear-gradient(90deg, #7a2016, #2a1c14 44%, #2a1c14 56%, #1c3a72); box-shadow: inset 0 0 0 1px rgba(255, 220, 160, 0.28); }
.ar-vb-side { display: grid; gap: 3px; min-width: 0; padding: 2px 4px; }
.ar-vb-side.l { justify-items: start; }
.ar-vb-side.r { justify-items: end; text-align: right; }
.ar-vb-who { display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.ar-vb-side.r .ar-vb-who { flex-direction: row-reverse; }
.ar-vb-head { width: 24px; height: 24px; }
.ar-bot-head.ar-vb-head { font-size: 15px; }
.ar-vb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ar-vb-bp { font: 700 11px/1 var(--font); color: #ffe08a; white-space: nowrap; }
.ar-vb-bp b { font-size: 13px; }
.ar-vb-slots { display: flex; gap: 3px; }
.ar-slot { position: relative; flex: none; width: 30px; height: 36px; border-radius: 4px; overflow: hidden; display: flex; justify-content: center; align-items: flex-end;
  background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
.ar-slot .hero-doll { display: block; flex: none; height: 92%; }
.ar-slot .hero-doll > svg { display: block; height: 100% !important; width: auto !important; }
.ar-slot-no { position: absolute; left: 2px; top: 1px; z-index: 1; font: 800 9px/1 var(--font); font-style: normal; color: #ffe08a; text-shadow: 0 1px 0 #000; }
.ar-slot.fell .hero-doll { filter: grayscale(1) brightness(0.45); }
.ar-slot.fell::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: #ff6a5a; font: 900 16px/1 var(--font); text-shadow: 0 1px 0 #000; }
.ar-vb-mid { display: grid; place-items: center; padding: 0 2px; }
.ar-vb-mid b { font: italic 900 24px/1 var(--serif); color: #ffd24a; text-shadow: 0 0 2px #000, 2px 2px 0 #7a1a0a; }
.ar-vsbar .ar-bot-tag { background: rgba(255, 255, 255, 0.2); color: #fff; }
@media (max-width: 560px) {
  .ar-vsbar { gap: 2px; padding: 4px; }
  .ar-vb-side { padding: 2px; }
  .ar-vb-name { font-size: 12px; }
  .ar-vb-slots { gap: 2px; }
  .ar-slot { width: 24px; height: 30px; }
  .ar-vb-mid b { font-size: 18px; }
}

/* 「還不能打」的說明 */
.ar-gate { display: grid; gap: 4px; }
.ar-lock b { color: var(--ar-ink); }

/* 🛡️ 我的戰績 */
.ar-me-top { display: flex; align-items: center; gap: 14px; }
.ar-emblem { flex: none; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; line-height: 1;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 55%), var(--tc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 35%, transparent), inset 0 -5px 0 rgba(0, 0, 0, 0.18); }
.ar-emblem i { font-style: normal; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35)); }
.ar-me-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; }
.ar-me-pts { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.ar-me-pts > b { font: 900 32px/1 var(--serif); color: var(--ar-ink); font-variant-numeric: tabular-nums; }
.ar-me-unit { font-weight: 800; color: var(--muted); margin-left: -4px; }
.ar-me-pts .ar-tier { align-self: center; }
.ar-tierbar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.ar-tierbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 55%, #fff)); transition: width 0.4s; }
.ar-stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ar-stat { display: grid; gap: 1px; padding: 8px 6px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; min-width: 0; }
.ar-stat b { font-size: 16px; white-space: nowrap; }
.ar-stat .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-day { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; }
.ar-pips { display: inline-flex; gap: 5px; }
.ar-pip { width: 13px; height: 13px; border-radius: 3px; transform: rotate(45deg) scale(0.82); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.ar-pip.on { background: var(--ar); box-shadow: none; }
.ar-first { margin-top: 10px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.ar-first.on { color: var(--text); background: color-mix(in srgb, #f2c14e 22%, var(--surface)); box-shadow: inset 0 0 0 1px rgba(201, 138, 10, 0.45); }
.ar-myteam { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); display: grid; gap: 6px; }
.ar-myteam-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
.ar-bp { white-space: nowrap; font-weight: 700; color: var(--muted); }
.ar-bp b { font: 900 20px/1 var(--serif); color: var(--ar-ink); }
.ar-myteam-pics { flex-wrap: wrap; gap: 4px 8px; }

/* ⚔️ 挑戰對手 */
.ar-opps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ar-opp { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "head who act" "team team bp"; align-items: center; gap: 8px 10px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); }
.ar-opp.bot { background: repeating-linear-gradient(135deg, var(--surface-2) 0 12px, color-mix(in srgb, var(--surface-2) 90%, #7a8aa0) 12px 24px); }
.ar-opp-head { grid-area: head; width: 42px; height: 42px; }
.ar-bot-head.ar-opp-head { font-size: 24px; }
.ar-opp-who { grid-area: who; min-width: 0; display: grid; gap: 3px; }
.ar-opp-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ar-opp-name b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ar-opp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-variant-numeric: tabular-nums; }
.ar-opp-act { grid-area: act; display: grid; justify-items: end; gap: 4px; }
.ar-opp-pts { display: flex; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ar-opp-pts .up { color: var(--ar-up); font-weight: 800; }
.ar-opp-pts .down { color: var(--ar-down); }
.ar-opp-team { grid-area: team; min-height: 36px; }
.ar-opp-team .ar-mini { height: 36px; }
.ar-opp-team .hero-doll { display: block; height: 100%; }
.ar-opp-team .hero-doll > svg { display: block; height: 100% !important; width: auto !important; }
.ar-opp-bp { grid-area: bp; justify-self: end; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.ar-opp-bp b { font: 900 17px/1 var(--serif); font-variant-numeric: tabular-nums; }
.ar-cmp { font: 800 11px/1 var(--font); padding: 4px 7px; border-radius: 999px; color: #fff; }
.ar-cmp.hard { background: #c0392b; }
.ar-cmp.even { background: #b8800a; }
.ar-cmp.easy { background: #2e8a57; }
:root[data-theme="night"] .ar-cmp { color: #0c0e12; }
:root[data-theme="night"] .ar-cmp.hard { background: #ff7a6a; }
:root[data-theme="night"] .ar-cmp.even { background: #f0c050; }
:root[data-theme="night"] .ar-cmp.easy { background: #5fd07a; }
.ar-opp-note { margin-top: 10px; }
@media (max-width: 400px) {
  .ar-opp { padding: 10px; gap: 6px 8px; }
  .ar-opp-team .ar-mini { height: 32px; }
  .btn.ar-go { min-width: 84px; padding: 0 10px; }
}

/* 🏆 排行榜 */
.ar-rank li { display: grid; grid-template-columns: 26px 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 4px 6px; border-radius: 10px; }
.ar-rank li.me { background: var(--ar-soft); box-shadow: inset 0 0 0 1px var(--ar-line); }
.ar-rank li.top .er-no { font-size: 18px; }
.ar-rk-who { min-width: 0; display: grid; gap: 1px; }
.ar-rk-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ar-rk-name b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-rk-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; }
.ar-rk-v { font: 900 18px/1 var(--serif); color: var(--ar-ink); font-variant-numeric: tabular-nums; }
.ar-you { flex: none; padding: 0 7px; border-radius: 999px; background: var(--ar); color: #fff; font: 800 11px/1.6 var(--font); }
:root[data-theme="night"] .ar-you { color: #1a0a06; }
.ar-rk-mine { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--ar-soft); }
.ar-rank li.ar-rk-gap { display: block; padding: 0; text-align: center; color: var(--muted); line-height: 1; }

/* 📜 對戰紀錄 */
.ar-logs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ar-log { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--ar-up); }
.ar-log.lose { border-left-color: var(--ar-down); }
.ar-log-ico { font-size: 18px; line-height: 1; }
.ar-log-main { min-width: 0; }
.ar-log-t { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; font-size: 14px; line-height: 1.35; }
.ar-log-t b { min-width: 0; overflow-wrap: anywhere; }
.ar-log-res { display: grid; justify-items: center; line-height: 1.25; min-width: 36px; }
.ar-wl { font-size: 13px; }
.ar-log.win .ar-wl { color: var(--ar-up); }
.ar-log.lose .ar-wl { color: var(--ar-down); }
.ar-dp { font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ar-dp.up { color: var(--ar-up); }
.ar-dp.down { color: var(--ar-down); }
.ar-dp.zero { color: var(--muted); }
.ar-replay { padding: 0 10px; }

/* 📖 說明：段位表 */
.ar-tiers { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.ar-tier-row { display: inline-flex; align-items: center; gap: 4px; }

/* 🏆 巔峰競賽：狀態、時間表 */
.ar-cup-state { font: 800 12px/1 var(--font); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.ar-cup-state.signup { background: #e0453a; color: #fff; animation: ar-blink 1.1s ease-in-out infinite alternate; }
.ar-cup-state.live { background: #2e8a57; color: #fff; }
.ar-cup-state.done, .ar-cup-state.soon { background: var(--surface-3); color: var(--text-2); }
:root[data-theme="night"] .ar-cup-state.signup { background: #ff6a5a; color: #1a0707; }
:root[data-theme="night"] .ar-cup-state.live { background: #5fd07a; color: #06140c; }
.ar-cup-now > p + p { margin-top: 4px; }
.ar-cup-big { font: 900 18px/1.4 var(--serif); }
.ar-cup-big b { color: var(--ar-ink); }
.ar-cd { font-weight: 800; color: var(--ar-ink); font-variant-numeric: tabular-nums; }
.ar-steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: none; }
.ar-steps li { display: grid; gap: 1px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
.ar-steps li.done { opacity: 0.62; }
.ar-steps li.done b::after { content: ' ✓'; color: var(--ar-up); }
.ar-steps li.cur { border-color: var(--ar); background: var(--ar-soft); box-shadow: inset 0 0 0 1px var(--ar); }
.ar-steps li .small { color: var(--muted); }
.ar-signup { display: grid; gap: 6px; margin-top: 10px; }
.ar-signup .row-end { margin-top: 0; }
.ar-signed, .ar-auto { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, #2e8a57 12%, var(--surface)); box-shadow: inset 0 0 0 1px rgba(46, 138, 87, 0.4); }
.ar-auto { margin-top: 0; }
.ar-cup-mine { margin-top: 10px; padding: 8px 12px; border-radius: 8px; display: grid; gap: 2px; background: var(--surface-2); }
.ar-cup-mine.alive { background: var(--ar-me-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ar-me) 45%, transparent); }
.ar-cup-mine.champ { background: color-mix(in srgb, #f2c14e 26%, var(--surface)); box-shadow: inset 0 0 0 1px rgba(201, 138, 10, 0.55); }
.ar-prize-line { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.ar-prize-line b { color: var(--gold); }
.ar-cup-rules { margin-top: 4px; }
.ar-h3 { margin: 14px 0 0; }
.ar-champ { position: relative; isolation: isolate; overflow: hidden; display: grid; justify-items: center; gap: 2px; padding: 16px 12px; border-radius: 12px; text-align: center; color: #fff;
  background: radial-gradient(80% 70% at 50% 0%, rgba(255, 220, 110, 0.55), rgba(0, 0, 0, 0) 70%), linear-gradient(180deg, #8a5a08, #3a2404); }
.ar-champ-cup { font-size: 46px; line-height: 1.1; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)); animation: ar-bob 1.6s ease-in-out infinite; }
.ar-champ-head { width: 46px; height: 46px; box-shadow: 0 0 0 2px #ffe08a; }
.ar-champ-t { font: 800 12px/1.4 var(--font); letter-spacing: 0.4em; padding-left: 0.4em; color: #ffe9a8; }
.ar-champ-name { font: 900 26px/1.2 var(--serif); color: #fff3c4; overflow-wrap: anywhere; }
.ar-champ .ar-bot-tag { background: rgba(255, 255, 255, 0.22); }

/* 🌳 對戰樹狀圖：一輪一欄，兩場一組接到下一輪；手機太窄就左右滑（只有這一塊，頁面不會橫向捲） */
.ar-br-wrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 0 -6px; padding: 2px 6px 8px; scrollbar-width: thin; }
.ar-br { display: flex; width: max-content; }
.ar-br-col { flex: none; width: 144px; display: flex; flex-direction: column; }
.ar-br-col:not(:first-child) { width: 156px; }
.ar-br-col.ar-br-end { width: 132px; }
.ar-br-rh { display: grid; gap: 1px; padding: 0 14px 8px 0; font-size: 13px; line-height: 1.3; }
.ar-br-col:not(:first-child) .ar-br-rh { padding-left: 14px; }
.ar-br-rh .small { color: var(--muted); white-space: nowrap; }
.ar-br-col.cur .ar-br-rh b { color: var(--ar); }
.ar-br-col.cur .ar-br-rh b::after { content: ' ◀ 下一輪'; font: 700 11px/1 var(--font); }
.ar-br-cells { height: calc(var(--n) * 66px); display: flex; flex-direction: column; }
.ar-br.big .ar-br-cells { height: calc(var(--n) * 60px); }
.ar-br-cell { position: relative; flex: 1 1 0; min-height: 0; display: flex; align-items: center; padding: 3px 14px 3px 0; }
.ar-br-col:not(:first-child) .ar-br-cell { padding-left: 14px; }
.ar-br-col:not(:last-child) .ar-br-cell::after { content: ''; position: absolute; right: 0; width: 14px; border: 0 solid var(--line-3); }
.ar-br-col:not(:last-child) .ar-br-cell:nth-child(odd)::after { top: calc(50% - 1px); height: 50%; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.ar-br-col:not(:last-child) .ar-br-cell:nth-child(even)::after { top: 0; height: calc(50% + 1px); border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }
.ar-br-col:not(:last-child) .ar-br-cell:only-child::after { top: calc(50% - 1px); height: 0; border-right-width: 0; border-radius: 0; }
.ar-br-col:not(:first-child) .ar-br-cell::before { content: ''; position: absolute; left: 0; top: calc(50% - 1px); width: 14px; border-top: 2px solid var(--line-3); }
.ar-bm { position: relative; z-index: 1; width: 100%; display: grid; gap: 2px; padding: 4px 6px; border-radius: 8px; text-align: left; font: inherit; color: inherit;
  border: 1px solid var(--line-2); background: var(--surface); box-shadow: 0 1px 0 var(--line); }
button.ar-bm { cursor: pointer; }
button.ar-bm:hover:not(:disabled) { border-color: var(--ar); box-shadow: 0 0 0 1px var(--ar); }
button.ar-bm:disabled { cursor: default; }
.ar-bm.mine { border-color: var(--ar-me); box-shadow: 0 0 0 2px var(--ar-me); }
.ar-bm-row { display: grid; grid-template-columns: 16px 20px minmax(0, 1fr) auto; align-items: center; gap: 4px; padding: 1px 2px; border-radius: 4px; font-size: 12px; line-height: 1.35; }
.ar-bm-row.won { font-weight: 800; background: color-mix(in srgb, #f2c14e 32%, transparent); }
.ar-bm-row.lost { opacity: 0.55; }
.ar-bm-row.lost .ar-bm-name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 70%, transparent); }
.ar-bm-row.me .ar-bm-name { color: var(--ar-me); font-weight: 800; }
.ar-bm-row.tbd .ar-bm-name { color: var(--muted); }
.ar-bm-seed { font: 700 10px/1 var(--font); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ar-bm-head { width: 20px; height: 20px; }
.ar-bot-head.ar-bm-head { font-size: 12px; }
.ar-bm-q { display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--muted); font: 800 11px/1 var(--font); }
.ar-bm-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-bm-ok { color: var(--ar-up); font-weight: 900; }
.ar-bm-play { position: absolute; right: -8px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ar); color: #fff; font-size: 8px; line-height: 1; box-shadow: 0 0 0 2px var(--surface); }
:root[data-theme="night"] .ar-bm-play { color: #1a0a06; }
.ar-bm-champ { display: flex; align-items: center; gap: 6px; padding: 10px 8px; font-weight: 900; border-color: #b8800a;
  background: linear-gradient(180deg, color-mix(in srgb, #f2c14e 40%, var(--surface)), color-mix(in srgb, #f2c14e 18%, var(--surface))); }
.ar-bm-champ .ar-bm-name { font-size: 14px; }
.ar-bm-champ .ar-bm-head { width: 26px; height: 26px; }
.ar-br-hint { margin-top: 6px; }

/* 🎁 名次獎勵、👑 歷屆冠軍 */
.ar-prize tr.me td { background: color-mix(in srgb, #f2c14e 22%, transparent); font-weight: 800; }
.ar-prize td .small { white-space: nowrap; }
.ar-hall { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ar-hall li { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; }
.ar-hall li.me { background: var(--ar-soft); box-shadow: inset 0 0 0 1px var(--ar-line); }
.ar-hall-cup { font-size: 18px; }
.ar-hall-who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ar-hall-who b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-hall-when { white-space: nowrap; }

/* VS 畫面（整個畫面蓋起來，伺服器打好、至少 1.7 秒才關；點一下跳過） */
.ar-vs-overlay { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; align-content: center; gap: 14px; padding: 16px; cursor: pointer; color: #fff;
  opacity: 0; transition: opacity 0.18s; background: radial-gradient(120% 80% at 50% 50%, rgba(70, 16, 8, 0.9), rgba(6, 4, 3, 0.96)); }
.ar-vs-overlay.open { opacity: 1; }
.ar-vs-overlay.out { opacity: 0; transition-duration: 0.25s; }
.ar-vs-stage { position: relative; width: min(820px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; }
.ar-vs-half { display: grid; justify-items: center; gap: 8px; min-width: 0; padding: 18px 12px 14px; border-radius: 16px; text-align: center; }
.ar-vs-half.l { background: linear-gradient(160deg, rgba(214, 70, 52, 0.95), rgba(84, 14, 10, 0.94));
  box-shadow: inset 0 0 0 2px rgba(255, 170, 150, 0.7), 0 0 32px rgba(255, 90, 70, 0.45); animation: ar-in-l 0.5s cubic-bezier(0.2, 1.25, 0.4, 1) both; }
.ar-vs-half.r { background: linear-gradient(200deg, rgba(64, 120, 210, 0.95), rgba(18, 36, 84, 0.94));
  box-shadow: inset 0 0 0 2px rgba(150, 196, 255, 0.7), 0 0 32px rgba(90, 154, 255, 0.45); animation: ar-in-r 0.5s cubic-bezier(0.2, 1.25, 0.4, 1) both; }
.ar-vs-who { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; max-width: 100%; }
.ar-vs-head { width: 46px; height: 46px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75); }
.ar-bot-head.ar-vs-head { font-size: 28px; }
.ar-vs-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 900 21px/1.25 var(--serif); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.ar-vs-overlay .ar-tier { color: #fff; background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.ar-vs-overlay .ar-bot-tag { background: rgba(255, 255, 255, 0.22); color: #fff; }
.ar-vs-bp { display: flex; align-items: baseline; gap: 6px; font: 800 13px/1 var(--font); color: #ffe08a; }
.ar-vs-bp b { font: 900 26px/1 var(--serif); color: #fff3c4; font-variant-numeric: tabular-nums; }
.ar-vs-team { flex-wrap: wrap; justify-content: center; gap: 2px 4px; }
.ar-vs-mark span { display: block; font: italic 900 66px/1 var(--serif); color: #ffd24a; -webkit-text-stroke: 2px #6a1606; paint-order: stroke fill;
  text-shadow: 0 4px 0 #6a1606, 0 0 26px rgba(255, 190, 60, 0.85); animation: ar-vs-pop 0.55s 0.25s cubic-bezier(0.2, 1.6, 0.4, 1) both, ar-vs-throb 1.2s 0.8s ease-in-out infinite; }
.ar-vs-hint { font-size: 13px; color: rgba(255, 255, 255, 0.78); animation: ar-blink 0.9s ease-in-out infinite alternate; }
@media (max-width: 640px) {
  .ar-vs-stage { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ar-vs-half { padding: 12px 10px; gap: 6px; }
  .ar-vs-mark { justify-self: center; }
  .ar-vs-mark span { font-size: 50px; }
  .ar-vs-name { font-size: 19px; }
}

/* 結果面板：大大的「勝利！」「戰敗…」、雙方、獎勵、傷害統計 */
.ar-result { display: grid; gap: 12px; }
.ar-banner { position: relative; isolation: isolate; overflow: hidden; display: grid; justify-items: center; gap: 4px; padding: 20px 12px 14px; border-radius: 12px; text-align: center; }
.ar-banner.win { background: radial-gradient(90% 80% at 50% 0%, rgba(255, 214, 90, 0.6), rgba(0, 0, 0, 0) 70%), linear-gradient(180deg, #9a2a12, #45100a); }
.ar-banner.lose { background: linear-gradient(180deg, #4a505e, #23262e); }
.ar-banner.neutral { background: radial-gradient(90% 80% at 50% 0%, rgba(140, 180, 255, 0.45), rgba(0, 0, 0, 0) 70%), linear-gradient(180deg, #2a3f7a, #121b38); }
.ar-banner::before { content: ''; position: absolute; left: 50%; top: 50%; z-index: -1; width: 240%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(rgba(255, 230, 150, 0.16) 0 9deg, rgba(255, 230, 150, 0) 9deg 18deg); animation: ar-spin 18s linear infinite; }
.ar-banner.lose::before { display: none; }
.ar-banner-t { font: 900 clamp(42px, 13vw, 64px)/1.08 var(--serif); letter-spacing: 0.06em; color: #ffe066; -webkit-text-stroke: 3px #4a1004; paint-order: stroke fill;
  text-shadow: 0 5px 0 #4a1004, 0 0 24px rgba(255, 200, 60, 0.6); transform: rotate(-4deg); animation: ar-stamp 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.ar-banner.lose .ar-banner-t { color: #d4d8e2; -webkit-text-stroke-color: #1a1d24; text-shadow: 0 5px 0 #1a1d24; transform: none; animation: ar-sink 0.7s ease both; }
.ar-banner.neutral .ar-banner-t { font-size: clamp(26px, 8vw, 40px); color: #fff3c4; -webkit-text-stroke-color: #101a3a; text-shadow: 0 4px 0 #101a3a; overflow-wrap: anywhere; }
.ar-banner-sub { font: 700 13px/1.4 var(--font); color: rgba(255, 255, 255, 0.86); }
.ar-res-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.ar-res-side { display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 8px 6px; border-radius: 10px; text-align: center; border: 1px solid var(--line-2); background: var(--surface-2); }
.ar-res-side.l { border-top: 3px solid var(--ar-l); }
.ar-res-side.r { border-top: 3px solid var(--ar-r); }
.ar-res-side.won { box-shadow: 0 0 0 2px var(--ar-win); }
.ar-res-head { width: 36px; height: 36px; }
.ar-bot-head.ar-res-head { font-size: 22px; }
.ar-res-who { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; max-width: 100%; }
.ar-res-who b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-res-crown { font: 800 11px/1.6 var(--font); color: #fff; background: var(--ar-win); padding: 0 8px; border-radius: 999px; }
:root[data-theme="night"] .ar-res-crown { color: #1a1206; }
.ar-res-x { font: italic 900 22px/1 var(--serif); color: var(--ar); }
.ar-res-note { margin-top: -4px; text-align: center; }
.ar-gain { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.ar-gain-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ar-gain-k { min-width: 5.6em; font-size: 13px; font-weight: 700; color: var(--muted); }
.ar-gain .ar-dp { font-size: 17px; }
.ar-gain-v { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.ar-coin { color: var(--gold); font-size: 17px; }
.ar-book b { color: var(--ar-ink); }
.ar-tierup { font-weight: 900; color: var(--ar-ink); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ar-tierdown { color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* 📊 戰鬥統計：左右兩邊、每一位一列（名字、數字、長條），可以切輸出、承受、治療 */
.ar-stats { display: grid; gap: 8px; }
.ar-st-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.ar-st-top h3 { margin: 0; }
.ar-st-seg .seg-btn { padding: 5px 9px; font-size: 13px; }
.ar-st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ar-st-col { min-width: 0; padding: 6px 8px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--ar-l); }
.ar-st-col.r { border-top-color: var(--ar-r); }
.ar-st-col.won { box-shadow: 0 0 0 1px var(--ar-win); }
.ar-st-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ar-st-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-st-total { font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text-2); }
.ar-st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.ar-st-row { display: grid; grid-template-columns: 10px 24px minmax(0, 1fr); align-items: center; gap: 4px; }
.ar-st-row.fell .ar-st-pic { filter: grayscale(1) opacity(0.55); }
.ar-st-no { font: 800 10px/1 var(--font); color: var(--muted); text-align: center; }
.ar-st-pic { width: 24px; height: 30px; display: flex; justify-content: center; align-items: flex-end; overflow: hidden; }
.ar-st-pic .hero-doll { display: block; flex: none; height: 100%; }
.ar-st-pic .hero-doll > svg { display: block; height: 100% !important; width: auto !important; }
.ar-st-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 4px; min-width: 0; }
.ar-st-name { display: flex; align-items: center; gap: 3px; min-width: 0; font-size: 12px; }
.ar-st-name > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-st-v { font-size: 13px; font-variant-numeric: tabular-nums; }
.ar-st-bar { grid-column: 1 / -1; height: 5px; margin-top: 2px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.ar-st-bar i { display: block; height: 100%; border-radius: 3px; background: var(--ar-l); transition: width 0.3s; }
.ar-st-col.r .ar-st-bar i { background: var(--ar-r); }
.ar-mvp { flex: none; padding: 0 4px; border-radius: 3px; background: var(--ar-win); color: #fff; font: 900 9px/1.5 var(--font); }
:root[data-theme="night"] .ar-mvp { color: #1a1206; }

/* 彩帶、動畫 */
.ar-confetti { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ar-confetti i { position: absolute; top: -14px; width: 6px; height: 10px; border-radius: 1px; background: var(--c); opacity: 0.9; animation: ar-fall var(--t, 2.6s) linear var(--d, 0s) infinite; }
@keyframes ar-fall { 0% { transform: translate(0, 0) rotate(0deg); } 100% { transform: translate(var(--x, 0px), 420px) rotate(var(--r, 180deg)); } }
@keyframes ar-blink { from { opacity: 0.6; } to { opacity: 1; } }
@keyframes ar-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-4px) rotate(4deg); } }
@keyframes ar-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes ar-stamp { 0% { opacity: 0; transform: rotate(-4deg) scale(2.4); } 70% { opacity: 1; transform: rotate(-4deg) scale(0.92); } 100% { opacity: 1; transform: rotate(-4deg) scale(1); } }
@keyframes ar-sink { 0% { opacity: 0; transform: translateY(-14px); } 100% { opacity: 1; transform: none; } }
@keyframes ar-in-l { 0% { opacity: 0; transform: translateX(-60px) skewX(8deg); } 100% { opacity: 1; transform: none; } }
@keyframes ar-in-r { 0% { opacity: 0; transform: translateX(60px) skewX(-8deg); } 100% { opacity: 1; transform: none; } }
@keyframes ar-vs-pop { 0% { opacity: 0; transform: scale(3) rotate(-12deg); } 100% { opacity: 1; transform: none; } }
@keyframes ar-vs-throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@media (max-width: 640px) {
  @keyframes ar-in-l { 0% { opacity: 0; transform: translateY(-40px); } 100% { opacity: 1; transform: none; } }
  @keyframes ar-in-r { 0% { opacity: 0; transform: translateY(40px); } 100% { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .ar-tab-badge, .ar-cup-state.signup, .ar-champ-cup, .ar-vs-half.l, .ar-vs-half.r, .ar-vs-mark span, .ar-vs-hint, .ar-banner::before, .ar-banner-t, .ar-banner.lose .ar-banner-t { animation: none; }
  .ar-confetti { display: none; }
}
.ar-vs-overlay.calm .ar-vs-half, .ar-vs-overlay.calm .ar-vs-mark span, .ar-vs-overlay.calm .ar-vs-hint { animation: none; }
