/* Papan tarung 3D: kanvas + lapisan DOM (bilah, teks melayang, gelembung, label sorotan). */
.b3d-canvas { touch-action: none; display: block; width: 100%; height: 100%; -webkit-user-select: none; user-select: none; }
.b3d-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.b3d-bar, .b3d-ft, .b3d-say, .b3d-label { position: absolute; left: 0; top: 0; will-change: transform; }

/* Bilah unit di atas kepala */
.b3d-bar { margin: -34px 0 0 -36px; width: 72px; font: 700 11px/1.25 system-ui, sans-serif; color: #fbf6ea; text-align: center; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
/* Pelat gelap di belakang nama supaya terbaca di lantai terang (pasir/salju) */
.b3d-bar-name { display: block; width: max-content; max-width: 100%; margin: 0 auto 2px; padding: 0 4px; border-radius: 4px;
  background: rgba(10, 8, 16, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b3d-bar-track { position: relative; height: 7px; background: rgba(8, 6, 12, .85); border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px #000, 0 0 0 2px rgba(255, 255, 255, .28); }
.b3d-bar-fill { display: block; height: 100%; background: linear-gradient(180deg, #7ff09a, #2fae5a); transition: width .25s ease-out; }
.b3d-bar.is-enemy .b3d-bar-fill { background: linear-gradient(180deg, #ff6a55, #d8261c); }
/* Musuh: 4 segmen band (tanpa angka HP) */
.b3d-bar-track.is-band::after { content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 2px), rgba(0, 0, 0, .95) calc(25% - 2px) 25%); }
.b3d-bar.is-active .b3d-bar-name { color: #ffd36a; }
.b3d-bar.is-mine .b3d-bar-track { box-shadow: 0 0 0 1px #000, 0 0 0 2px #ffd36a; }
.b3d-bar-num { display: inline-block; margin-top: 1px; padding: 0 3px; border-radius: 3px; background: rgba(10, 8, 16, .7); font-size: 11px; }
.b3d-bar-st { display: inline-flex; gap: 2px; align-items: center; }
.b3d-bar-st svg { width: 12px; height: 12px; }
.b3d-bar-st b { font-size: 11px; }

/* Teks melayang */
.b3d-ft { margin: -46px 0 0 0; translate: -50% 0; font: 800 16px/1 system-ui, sans-serif; color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000; white-space: nowrap; animation: b3d-rise 1100ms ease-out forwards; }
.b3d-ft.is-dmg { color: #ff6a5a; animation-name: b3d-dmgpop; }
.b3d-ft.is-crit { color: #ffd36a; font-size: 28px; letter-spacing: .5px; text-shadow: 0 1px 3px #000, 0 0 2px #000, 0 0 8px rgba(255, 211, 106, .8); animation-name: b3d-crit; }
.b3d-ft.is-heal { color: #7aeb9a; }
.b3d-ft.is-miss { color: #cfd6e0; font-style: italic; }
.b3d-ft.is-status { color: #c58aff; font-size: 13px; }
.b3d-ft.is-info { color: #e8dcc8; font-size: 13px; }
.b3d-ft.is-big { font-size: 22px; }
.b3d-ft.is-huge { font-size: 30px; -webkit-text-stroke: 1px #000; }
.b3d-ft.is-crit.is-big, .b3d-ft.is-crit.is-huge { font-size: 28px; }
.b3d-ft.is-block { color: #9fd0ff; font-size: 18px; text-transform: uppercase; }
.b3d-ft.is-combo { color: #ffd36a; font-size: 18px; font-style: italic; animation-name: b3d-crit; }
.b3d-ft.is-status-on { color: #c58aff; font-size: 15px; text-transform: uppercase; letter-spacing: .5px; }
.b3d-ft svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
@keyframes b3d-rise { from { opacity: 1; margin-top: -46px; } 70% { opacity: 1; } to { opacity: 0; margin-top: -86px; } }
@keyframes b3d-crit {
  0% { opacity: 1; margin-top: -46px; scale: .6; }
  18% { scale: 1.4; }
  35% { scale: 1.15; }
  75% { opacity: 1; }
  100% { opacity: 0; margin-top: -86px; scale: 1.15; }
}

/* Angka kerusakan: muncul membesar lalu naik (nama berbeda dari b3d-pop milik gelembung celetukan) */
@keyframes b3d-dmgpop {
  0% { scale: .5; opacity: 1; margin-top: -46px; }
  15% { scale: 1.35; }
  30% { scale: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; margin-top: -86px; }
}
/* Vignette ult: gelap di tepi layar sebentar */
.b3d-overlay.is-ult::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(10, 4, 16, .65) 100%); animation: b3d-vig 1200ms ease-out forwards; }
@keyframes b3d-vig { 0% { opacity: 0; } 20% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* Vinyet warna tema: radial statis (bukan gerak, tetap tampil saat reduced); ::before milik vinyet ult */
.b3d-overlay::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, var(--b3d-grade, transparent) 130%); opacity: var(--b3d-vig, .35); }

/* Papan nama intro tarung */
.b3d-intro { position: absolute; left: 50%; top: 12%; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  max-width: 92%; animation: b3d-intro-out 3000ms ease-out forwards; }
.b3d-intro-title { font: 800 22px/1.1 system-ui, sans-serif; color: #ffe9a8; letter-spacing: 1px; text-transform: uppercase; text-align: center;
  text-shadow: 0 2px 4px #000, 0 0 10px rgba(0, 0, 0, .8); animation: b3d-intro-in 420ms ease-out both; }
.b3d-intro-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.b3d-intro-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 6px; background: rgba(10, 8, 16, .82); color: #fbf6ea;
  font: 700 15px/1.2 system-ui, sans-serif; box-shadow: 0 0 0 1px rgba(255, 255, 255, .3), 0 2px 6px rgba(0, 0, 0, .6); animation: b3d-intro-in 420ms ease-out both; }
.b3d-intro-item.is-boss { padding: 7px 18px; font-size: 22px; color: #ffd36a; box-shadow: 0 0 0 2px #c8321f, 0 0 0 3px #ffd36a, 0 3px 10px rgba(0, 0, 0, .7); }
.b3d-intro-tag { padding: 1px 6px; border-radius: 4px; background: #c8321f; color: #fff; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; }
@keyframes b3d-intro-in { from { opacity: 0; transform: translateY(-14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes b3d-intro-out { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
@media (max-height: 460px) { .b3d-intro { top: 6%; gap: 4px; } .b3d-intro-title { font-size: 16px; } .b3d-intro-item { font-size: 13px; padding: 2px 8px; } .b3d-intro-item.is-boss { font-size: 17px; padding: 4px 12px; } }

/* Gelembung celetukan, ekor menunjuk kepala */
.b3d-say { margin: -44px 0 0 0; translate: -50% -100%; max-width: 150px; width: max-content; padding: 4px 8px; border-radius: 8px; background: rgba(20, 18, 28, .92); color: #f4efe4; font: 12px/1.3 system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); animation: b3d-pop 160ms ease-out; }
.b3d-say::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: rgba(20, 18, 28, .92); }
.b3d-say.is-hurt { color: #ffb0a8; }
.b3d-say.is-taunt { color: #ffcf8a; }
.b3d-say.is-cheer { color: #b8f0c4; }
@keyframes b3d-pop { from { opacity: 0; scale: .8; } to { opacity: 1; scale: 1; } }

/* Label sorotan (biaya jalur, perlindungan, tinggi petak) */
.b3d-label { translate: -50% -50%; padding: 1px 5px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; font: 700 12px/1.2 system-ui, sans-serif; white-space: nowrap; }
.b3d-label.b3d-cost { margin-top: -26px; background: rgba(8, 10, 16, .9); color: #ffffff; box-shadow: 0 0 0 1px #ffffff; }
.b3d-label.b3d-cost.is-danger { color: #ffd0d8; box-shadow: 0 0 0 1px #ff3d5e; }
.b3d-label.b3d-cov { margin-top: -58px; width: 14px; height: 16px; padding: 0; border-radius: 0; background: #cfe6ff; clip-path: polygon(50% 0, 100% 15%, 92% 60%, 50% 100%, 8% 60%, 0 15%); }
.b3d-label.b3d-hh { padding: 0 3px; font-size: 10px; background: rgba(0, 0, 0, .55); color: #e8dcc8; }   /* opt-in alat, satu-satunya < 11 px */
.b3d-label.b3d-warn { margin-top: -4px; padding: 0 3px; border-radius: 50%; background: rgba(10, 8, 16, .8); color: #ffd0d8; font-size: 12px; text-shadow: none; }
/* Penanda sekutu terkena area: berkedip di atas kepala */
.b3d-label.b3d-ff { margin-top: -64px; width: 18px; height: 18px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  background: rgba(10, 8, 16, .85); color: #ffe600; border: 1px solid #ffe600; font: 800 13px/1 system-ui, sans-serif; animation: b3d-blink 1s steps(2, jump-none) infinite; }
@keyframes b3d-blink { 50% { opacity: .35; } }

.b3d-overlay.is-reduced .b3d-ft, .b3d-overlay.is-reduced .b3d-say, .b3d-overlay.is-reduced .b3d-ff, .b3d-overlay.is-reduced .b3d-intro, .b3d-overlay.is-reduced .b3d-intro-title, .b3d-overlay.is-reduced .b3d-intro-item { animation: none; }
.b3d-overlay.is-reduced .b3d-bar-fill { transition: none; }
.b3d-overlay.is-reduced.is-ult::before { display: none; }
@media (prefers-reduced-motion: reduce) {
  .b3d-overlay.is-ult::before { display: none; }
  .b3d-ft, .b3d-ft.is-dmg, .b3d-ft.is-crit, .b3d-ft.is-combo, .b3d-say, .b3d-ff, .b3d-intro, .b3d-intro-title, .b3d-intro-item { animation: none; }
  .b3d-ft { margin-top: -66px; }
  .b3d-bar-fill { transition: none; }
}
