/* ============================================================
 * battle-replay.css — 戦闘シミュレーター 実機再現モード (Phase 2)
 * ------------------------------------------------------------
 * bsr-* プレフィックス。フルスクリーンモーダル + Spineステージ +
 * ユニットパネル + ダメージ数字オーバーレイ。
 * ============================================================ */

body.bsr-lock {
  overflow: hidden;
  /* iOS/Androidとも overflow:hidden だけでは背面スクロールが抜けることがあるため
     背面ページ自体を固定 + スクロール連鎖と引っ張り更新(Android)も遮断 */
  position: fixed; inset: 0; width: 100%;
  overscroll-behavior: none;
}

.bsr-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(10, 12, 24, 0.92);
  display: flex; align-items: center; justify-content: center;
}
/* ★ ボタン連打 (×1→×4等) がスマホのダブルタップ拡大と解釈されるのを防ぐ */
.bsr-overlay, .bsr-overlay button, .bsr-overlay input, .bsr-overlay img, .bsr-overlay canvas {
  touch-action: manipulation;
}
.bsr-overlay { overscroll-behavior: none; }
.bsr-modal {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: #0d1020;
  color: #e8eaf6;
}
.bsr-main {
  position: relative;            /* 開幕画面(bsr-vsintro)の全面配置基準 */
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
/* ステージ+カード列の包含層 (検分パネルの絶対配置基準) */
.bsr-body {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
/* 検分パネルを開いている間、カード列は場所を残したまま見えなくする (レイアウト不動) */
.bsr-main.bsr-inspecting .bsr-allycards { visibility: hidden; }
.bsr-side { display: none; }

/* ---- PC: 左=実機比率の縦長プレイヤー / 右=検分パネル常設 ---- */
@media (min-width: 960px) {
  .bsr-modal {
    flex-direction: row;
    width: auto; height: min(96vh, 1040px);
    border-radius: 14px; overflow: hidden;
    box-shadow: 0 12px 60px rgba(0,0,0,0.6);
  }
  .bsr-main {
    /* 実機画面の縦横比 (1180:2556 ≒ 0.46) を維持 */
    width: clamp(340px, calc(min(96vh, 1040px) * 0.47), 500px);
    flex: 0 0 auto;
  }
  .bsr-side {
    display: flex; flex-direction: column;
    flex: 0 0 400px; min-width: 0;
    border-left: 1px solid #262c55;
    background: #0b0e1e;
  }
  .bsr-side .bsr-inspect.bsr-docked {
    position: static;
    display: flex !important;
    flex: 1 1 auto; min-height: 0;
    max-height: none;
    border-top: none;
    background: transparent;
    backdrop-filter: none;
  }
  .bsr-side .bsr-inspect-close { display: none; }
  /* PCでは閉じる×を検分パネル右上 (bsr-close-side) に出し、ヘッダ側は隠す */
  .bsr-head .bsr-close { display: none; }
}

/* ---- ヘッダ (実機の MY TEAM vs ENEMY TEAM バー) ---- */
.bsr-head {
  display: flex; align-items: stretch; gap: 0;
  background: #0d1020;
  flex: 0 0 auto;
  min-height: 52px;   /* 帯のMY TEAM/ENEMY TEAM文字と編成名が重ならない高さ */
}
.bsr-teambar {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; justify-content: flex-end;   /* 帯の文字の下に編成名を置く */
  padding: 4px 12px 6px;
}
/* 実機のヘッダ帯素材 (frm_header_battle_1/2 = MY TEAM / ENEMY TEAM の文字入り斜め帯)。
   帯の文字を活かすため等倍で敷き、編成名は下寄せにして重ならないようにする */
.bsr-teambar-my {
  background: #0a2f7e url('../images/battle/fx/frm_header_battle_1.png') left center / 100% 100% no-repeat;
}
.bsr-teambar-enemy {
  background: #5c165a url('../images/battle/fx/frm_header_battle_2.png') right center / 100% 100% no-repeat;
  text-align: right;
}
.bsr-teambar-name {
  font-size: 13.5px; font-weight: 900; color: #fff;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bsr-head-mid {
  position: relative; z-index: 2;      /* エンブレムを両バーの上に重ねる (実機準拠) */
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 0 -14px;
  gap: 0;
}
.bsr-vs-img {
  height: 60px; width: auto; display: block;
  margin: -11px 0 -12px;   /* 発光の余白ぶんを詰めてヘッダ高を保つ */
}
.bsr-turnchip {
  color: #cdd4ff;
  font-weight: 700; font-size: 10px; letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.bsr-close {
  flex: 0 0 auto;
  background: none; border: none; color: #9aa3d0;
  font-size: 18px; cursor: pointer; padding: 6px 12px;
}
.bsr-close:hover, .bsr-close:focus-visible { color: #fff; }

/* ---- ステージ ---- */
.bsr-stagewrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 220px;
  background-size: cover;
  background-position: center top;   /* 実機同様、上端の都市スカイラインを見せる */
  overflow: hidden;
}
.bsr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bsr-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* 必殺暗転 (キャンバスより下層 = 背景のみ暗くなる。キャラの暗転はステージ側のtintで行う) */
.bsr-dimmer {
  position: absolute; inset: 0;
  background: rgba(3, 5, 16, 0.75);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.bsr-dimmer.bsr-show { opacity: 1; }
.bsr-oh-dim { opacity: 0.18; }

.bsr-loading {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(10, 12, 24, 0.7);
  font-size: 13px; color: #cdd4ff;
}

/* ラウンド帯 (実機の「2nd Round」暗色バンド) */
.bsr-turnbanner {
  position: absolute; top: 42%; left: 0; right: 0;
  padding: 12px 0;
  text-align: center;
  font-size: clamp(18px, 4.6vw, 26px);
  font-weight: 800; letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(90deg,
    rgba(46, 8, 34, 0) 0%, rgba(64, 10, 46, 0.92) 14%,
    rgba(74, 12, 52, 0.95) 50%,
    rgba(64, 10, 46, 0.92) 86%, rgba(46, 8, 34, 0) 100%);
  border-top: 1px solid rgba(255, 120, 190, 0.35);
  border-bottom: 1px solid rgba(255, 120, 190, 0.35);
  opacity: 0; pointer-events: none;
  font-variant-numeric: tabular-nums;
  z-index: 3;
}
.bsr-turnbanner.bsr-show { animation: bsrBanner 1.0s ease-out forwards; }
@keyframes bsrBanner {
  0%   { opacity: 0; transform: scaleX(0.6); }
  16%  { opacity: 1; transform: scaleX(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* SUB SKILL帯 (実機のスキル発動カットイン帯) */
.bsr-skillstrip {
  position: absolute; top: 9%; right: 0;
  max-width: 78%;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 8px;
  background: linear-gradient(270deg, rgba(20, 24, 60, 0.95) 60%, rgba(20, 24, 60, 0));
  border-radius: 8px 0 0 8px;
  opacity: 0; transform: translateX(24px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 3;
}
.bsr-skillstrip.bsr-show { opacity: 1; transform: translateX(0); }
.bsr-skillstrip-icon {
  width: 34px; height: 34px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.5);
  object-fit: cover;
}
.bsr-skillstrip-lbl {
  font-size: 8px; font-weight: 800; letter-spacing: 0.18em;
  color: #ff9ecb;
}
.bsr-skillstrip-name {
  font-size: 12px; font-weight: 800; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
/* セコンドスキル小窓のセリフ */
.bsr-skillstrip-serif {
  font-size: 10.5px; color: #ffe9a8;
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 230px;
}

/* ---- リザルト (実機準拠: 録画73.8s採寸) ---- */
.bsr-resultbanner {
  position: absolute; inset: 0;
  z-index: 7;                    /* 検分パネル(z6)より前面 = 決着時に隠れない */
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  /* 実機のリザルト背景画像 (bg_battleresult) を暗色で敷いた上に重ねる */
  background: #191631 url('../images/battle/fx/bg_battleresult.png') center / cover no-repeat;
  padding: 8px 10px;
}
.bsr-resultbanner.bsr-show { display: flex; }
.bsr-result-main {
  font-size: clamp(48px, 10vw, 84px);
  font-weight: 900; letter-spacing: 0.14em;
  text-shadow: 0 4px 24px rgba(0,0,0,0.9);
}
.bsr-result-draw  { color: #cfd4e8; }
/* 実機の文字画像 (終了/WIN/LOSE) */
.bsr-glyphrow { display: flex; align-items: center; justify-content: center; gap: 6px; }
.bsr-glyph-end .bsr-glyph { height: clamp(34px, 8vw, 52px); width: auto; }
.bsr-glyph-result { animation: bsrVsPop 0.5s ease-out; }
.bsr-glyph-result .bsr-glyph { height: clamp(32px, 8vw, 56px); width: auto; }

/* 成績テーブル (白カード行) */
.bsr-rt2 {
  width: min(86%, 380px);
  max-height: calc(100% - 84px);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 4px;
}
.bsr-rt2-grid {
  display: grid;
  grid-template-columns: 20px 30px 1fr 1fr 1fr 20px;
  gap: 3px; align-items: center;
}
.bsr-rt2-head {
  background: linear-gradient(90deg, #f0708f, #e85578);
  border-radius: 6px;
  padding: 4px 6px;
  color: #fff; font-size: 9.5px; font-weight: 800;
  text-align: center;
  flex: 0 0 auto;
}
.bsr-rt2-head span { white-space: nowrap; overflow: hidden; }
.bsr-rt2-head span + span { border-left: 1px solid rgba(255,255,255,0.35); }
.bsr-rt2-block { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.bsr-rt2-block + .bsr-rt2-block { margin-top: 3px; }
.bsr-rt2-row {
  position: relative;
  background: #fff;
  border-radius: 7px;
  padding: 1px 5px 1px 9px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.45);
}
.bsr-rt2-row::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  border-radius: 7px 0 0 7px;
}
.bsr-rt2-my .bsr-rt2-row::before { background: #2f7fe0; }
.bsr-rt2-enemy .bsr-rt2-row::before { background: #e0286b; }
.bsr-rt2-medalwrap { position: relative; width: 20px; height: 20px; display: block; }
.bsr-rt2-medal { width: 20px; height: 20px; object-fit: contain; display: block; }
.bsr-rt2-ranknum {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 900; color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.6);
  padding-bottom: 1px;
}
.bsr-rt2-chara { display: inline-flex; align-items: center; }
.bsr-rt2-icon { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; background: #eceef6; }
.bsr-rt2-cell { min-width: 0; text-align: right; }
.bsr-rt2-num {
  color: #1c2140; font-weight: 800; font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.bsr-rt2-bar { height: 3px; width: 70%; margin-left: auto; border-radius: 2px; background: #d8dbe8; margin-top: 2px; overflow: hidden; }
.bsr-rt2-fill { height: 100%; border-radius: 2px; }
.bsr-rt2-f-dmg  { background: linear-gradient(90deg, #ff5f9e, #d81b60); }
.bsr-rt2-f-hp   { background: linear-gradient(90deg, #5ab8ff, #1f74e0); }
.bsr-rt2-f-heal { background: linear-gradient(90deg, #ffd76a, #f0a428); }
.bsr-rt2-kill { color: #1c2140; font-weight: 900; font-size: 11px; text-align: center; }
/* 実機準拠: リザルトは画面タップで閉じる (ボタンは置かない) */
.bsr-rt2-tap {
  flex: 0 0 auto;
  white-space: nowrap;      /* 幅が潰れて縦積みになるのを防ぐ */
  margin-top: 4px;
  font-size: 12px; font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  animation: bsrTapBlink 1.6s ease-in-out infinite;
}
@keyframes bsrTapBlink { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
.bsr-resultbanner.bsr-show { cursor: pointer; }

/* スキル由来SP回復の水色ポップ (ダメージ数字と区別できる色) */
.bsr-sppop {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 13.5px; font-weight: 900;
  color: #6fdcff;
  text-shadow: 0 0 8px rgba(60, 170, 255, 0.95), 0 1px 2px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  animation: bsrSpGain 0.95s ease-out forwards;
  z-index: 3;
}
@keyframes bsrSpGain {
  0%   { opacity: 0; transform: translate(-50%, -86%) scale(0.7); }
  18%  { opacity: 1; transform: translate(-50%, -104%) scale(1.08); }
  32%  { transform: translate(-50%, -108%) scale(1.0); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -132%); }
}

/* カットイン集中線 (実機 ConcentrationLine 8コマ)。
   画像は中央が空洞なので、そのまま出すと中心の穴が目立つ。
   外周だけを見せる放射グラデのマスクを掛け、薄く短く重ねる */
.bsr-cline {
  position: absolute; inset: 0;
  z-index: 2;
  background-image: url('../images/battle/fx/ConcentrationLine_White_0.png');
  background-size: 100% 100%;
  animation: bsrCLine 0.45s steps(1) 1 forwards;
  pointer-events: none;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0) 42%, rgba(0,0,0,0.75) 72%, #000 100%);
          mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0) 42%, rgba(0,0,0,0.75) 72%, #000 100%);
}
@keyframes bsrCLine {
  0%    { background-image: url('../images/battle/fx/ConcentrationLine_White_0.png'); opacity: 0.5; }
  16%   { background-image: url('../images/battle/fx/ConcentrationLine_White_2.png'); opacity: 0.45; }
  33%   { background-image: url('../images/battle/fx/ConcentrationLine_White_3.png'); }
  50%   { background-image: url('../images/battle/fx/ConcentrationLine_White_4.png'); opacity: 0.35; }
  70%   { background-image: url('../images/battle/fx/ConcentrationLine_White_5.png'); opacity: 0.22; }
  100%  { background-image: url('../images/battle/fx/ConcentrationLine_White_7.png'); opacity: 0; }
}

/* カットインの白斬撃ワイプ */
.bsr-cutinwipe {
  position: absolute; inset: -20%;
  z-index: 2;
  background: linear-gradient(115deg,
    rgba(255,255,255,0) 30%, rgba(255,255,255,0.95) 46%,
    #ffffff 50%,
    rgba(255,255,255,0.95) 54%, rgba(255,255,255,0) 70%);
  transform: translateX(-120%);
  animation: bsrWipe 0.42s ease-in forwards;
  pointer-events: none;
}
@keyframes bsrWipe {
  0%   { transform: translateX(-120%); }
  55%  { transform: translateX(0); }
  100% { transform: translateX(130%); }
}

/* ---- 頭上ステータス (実機の InGameCharacterOverheadUI 相当) ---- */
.bsr-overheads { position: absolute; inset: 0; pointer-events: none; }
.bsr-oh {
  position: absolute;
  width: 108px;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.3s ease;
}
.bsr-oh:focus-visible { outline: 2px solid #6f9dff; outline-offset: 1px; }
.bsr-oh-barrow { display: flex; align-items: center; gap: 3px; }
.bsr-oh-elem {
  flex: 0 0 auto;
  width: 17px; height: 17px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}
.bsr-oh-elem-txt {
  flex: 0 0 auto;
  width: 15px; height: 15px; border-radius: 50%;
  font-size: 9px; font-weight: 800; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: #555; box-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.bsr-el-power  { background: radial-gradient(circle at 35% 30%, #ff8a6b, #d43a1f); }
.bsr-el-tech   { background: radial-gradient(circle at 35% 30%, #6bc5ff, #1f6ed4); }
.bsr-el-spirit { background: radial-gradient(circle at 35% 30%, #d59bff, #7a2fd4); }
.bsr-oh-barcol { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bsr-oh-hp {
  height: 8px;
  border-radius: 4px; overflow: hidden;
  background: rgba(8, 10, 24, 0.85);
  border: 1px solid rgba(0,0,0,0.6);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.bsr-oh-fill { height: 100%; width: 100%; transition: width 0.35s ease; }
.bsr-oh-my .bsr-oh-hp .bsr-oh-fill { background: linear-gradient(180deg, #6fc8ff, #1f74e0); }
.bsr-oh-enemy .bsr-oh-hp .bsr-oh-fill { background: linear-gradient(180deg, #ff7fae, #e0286b); }
.bsr-oh-sp {
  height: 6px;
  border-radius: 3px; overflow: hidden;
  background: rgba(8, 10, 24, 0.85);
  border: 1px solid rgba(0,0,0,0.6);
}
.bsr-oh-sp .bsr-oh-fill { background: linear-gradient(180deg, #ffe27a, #f0a428); }
/* SP満タンの発光 (頭上バーと下部カードの両方) */
.bsr-oh-fill.bsr-oh-sp-full,
.bsr-card-sp .bsr-card-fill.bsr-oh-sp-full { background: linear-gradient(180deg, #fff3ae, #ffb63e); box-shadow: 0 0 5px #ffd23e; }

/* スタン = 実機のひよこリング (stun_effect_01.png 6x3=18コマ) */
.bsr-stunfx {
  position: absolute;
  left: 50%; bottom: -74px;
  width: 150px; height: 75px;
  transform: translateX(-50%);
  background-image: url('../images/battle/fx/stun_effect_01.png');
  background-size: 600% 300%;
  animation: bsrStunFx 1.3s steps(1) infinite;
  pointer-events: none;
}
@keyframes bsrStunFx {
  0%      { background-position: 0% 0%; }
  5.55%   { background-position: 20% 0%; }
  11.11%  { background-position: 40% 0%; }
  16.66%  { background-position: 60% 0%; }
  22.22%  { background-position: 80% 0%; }
  27.77%  { background-position: 100% 0%; }
  33.33%  { background-position: 0% 50%; }
  38.88%  { background-position: 20% 50%; }
  44.44%  { background-position: 40% 50%; }
  50%     { background-position: 60% 50%; }
  55.55%  { background-position: 80% 50%; }
  61.11%  { background-position: 100% 50%; }
  66.66%  { background-position: 0% 100%; }
  72.22%  { background-position: 20% 100%; }
  77.77%  { background-position: 40% 100%; }
  83.33%  { background-position: 60% 100%; }
  88.88%  { background-position: 80% 100%; }
  94.44%  { background-position: 100% 100%; }
}

/* 低い画面 (横持ち等) でカード列がシークバーを覆わないよう高さを制限 */
@media (max-height: 620px) {
  .bsr-allycards { max-height: 96px; }
  .bsr-card-icon { max-height: 46px; }
  .bsr-card-sub { display: none; }
}

/* ---- 味方下部カード列 (実機の自チームカード) ---- */
.bsr-allycards {
  flex: 0 0 auto;
  display: flex; gap: 5px;
  padding: 6px 8px;
  background: #0d1020;
}
.bsr-card {
  flex: 1 1 0; min-width: 0;
  position: relative;
  border: 2px solid #3d6ce0;
  border-radius: 8px;
  background: #12162e;
  padding: 3px 3px 4px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  transition: opacity 0.3s ease;
}
.bsr-card.bsr-el-power  { border-color: #d4553a; }
.bsr-card.bsr-el-tech   { border-color: #3a86d4; }
.bsr-card.bsr-el-spirit { border-color: #9a4fd4; }
/* 敵チームのカード列 (実機は敵行動時にピンク系カードへ切り替わる) */
.bsr-enemycards .bsr-card { background: #2a1226; }
.bsr-enemycards .bsr-card-hp .bsr-card-fill { background: linear-gradient(180deg, #ff7fae, #e0286b); }
/* 行動者カードの発光 */
.bsr-card-acting {
  box-shadow: 0 0 10px 2px rgba(255, 230, 140, 0.85);
  filter: brightness(1.12);
}
.bsr-card:focus-visible { outline: 2px solid #6f9dff; outline-offset: 1px; }
.bsr-card.bsr-unit-dead { opacity: 0.45; filter: grayscale(0.85); }
.bsr-card-icon {
  width: 100%; aspect-ratio: 1 / 1.05;
  object-fit: cover; object-position: top;
  border-radius: 5px;
  background: #0d1020;
}
.bsr-card-buffs {
  position: absolute; top: 4px; right: 5px;
  font-size: 9px; font-weight: 800; color: #fff;
  background: rgba(10, 12, 30, 0.75);
  border-radius: 4px; padding: 0 4px;
}
.bsr-card-sub {
  width: 46%; aspect-ratio: 1 / 1;
  object-fit: cover; object-position: top;
  border-radius: 4px;
  align-self: flex-start;
  background: #0d1020;
}
.bsr-card-bar {
  position: relative;
  height: 10px; border-radius: 5px; overflow: hidden;
  background: #0a0d1e; border: 1px solid #262c55;
}
.bsr-card-fill { height: 100%; width: 100%; transition: width 0.35s ease; }
.bsr-card-hp .bsr-card-fill { background: linear-gradient(180deg, #6fc8ff, #1f74e0); }
.bsr-card-sp .bsr-card-fill { background: linear-gradient(180deg, #ffe27a, #f0a428); width: 0; }
.bsr-card-pct {
  position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  font-size: 8px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 2px #000;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
/* ---- スプライト数字 (実機のダメージフォント) ---- */
.bsr-spnum {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  animation: bsrSpPop 0.7s ease-out forwards;   /* 実機実測: 表示は0.4〜0.6秒 */
  pointer-events: none;
}
.bsr-spnum-row { display: flex; align-items: flex-end; }
.bsr-spnum-d { height: 30px; width: auto; display: block; }
.bsr-spnum-big .bsr-spnum-d { height: 46px; }
.bsr-spnum-label { height: 15px; width: auto; display: block; }
.bsr-spnum-big .bsr-spnum-label { height: 24px; }
@keyframes bsrSpPop {
  0%   { opacity: 0; transform: translate(-50%, -92%) scale(0.5); }
  14%  { opacity: 1; transform: translate(-50%, -100%) scale(1.18); }
  28%  { transform: translate(-50%, -100%) scale(1.0); }
  82%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -116%); }
}

/* ヒット閃光リング (実機のインパクト演出) */
.bsr-hitring {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 90px; height: 90px;
  pointer-events: none;
  animation: bsrHitRing 0.28s ease-out forwards;
  filter: brightness(1.6) drop-shadow(0 0 10px rgba(255, 240, 170, 0.9));
}
@keyframes bsrHitRing {
  0%   { opacity: 0.95; transform: translate(-50%, -50%) scale(0.35); }
  60%  { opacity: 0.85; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.35); }
}

/* オノマトペ (被弾時) */
.bsr-ono {
  position: absolute;
  transform: translate(-50%, -50%);
  height: 64px; width: auto;
  animation: bsrOno 0.7s ease-out forwards;
  pointer-events: none;
}
@keyframes bsrOno {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
  40%  { transform: translate(-50%, -50%) scale(1.0); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -56%) scale(1.05); }
}

/* ---- 必殺カットイン動画 ---- */
.bsr-cutin {
  position: absolute; inset: 0;
  display: none;
  background: #000;
  z-index: 5;
}
.bsr-cutin.bsr-show { display: block; }
.bsr-cutin-video {
  width: 100%; height: 100%;
  /* 横幅に合わせて表示し、縦の余白ぶんは上下クロップ (黒帯を出さない・オーナー指示) */
  object-fit: cover;
  object-position: center 42%;   /* 絵の中心 (顔+スキル名) がやや上寄りのため */
  display: block;
}

/* ---- 開幕VS ---- */
.bsr-vsintro {
  position: absolute; inset: 0;
  display: none;
  /* 実機の六角パターン背景 (bg_vs)。ヘッダ/カード/シークバーごと覆う */
  background: #17141f url('../images/battle/fx/bg_vs.png') center / cover no-repeat;
  z-index: 8;
}
.bsr-vsintro.bsr-show { display: flex; align-items: center; justify-content: center; }
.bsr-vsintro-inner { width: min(92%, 480px); display: flex; flex-direction: column; gap: 5px; }
/* チームパネル (実機の編成確認画面: 名前+総戦力+1st-5thのメイン/サブカード) */
.bsr-vsp {
  border-radius: 10px; padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  animation: bsrVsSlide 0.45s ease-out;
}
.bsr-vsp-left  { background: linear-gradient(180deg, rgba(18, 38, 112, 0.94), rgba(10, 22, 70, 0.94)); }
.bsr-vsp-right { background: linear-gradient(180deg, rgba(118, 18, 96, 0.94), rgba(66, 10, 58, 0.94)); }
.bsr-vsp-name { font-size: 12.5px; font-weight: 900; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsr-vsp-power { font-size: 11px; font-weight: 800; color: #ffd23e; margin: 1px 0 4px; font-variant-numeric: tabular-nums; }
.bsr-vsp-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.bsr-vsp-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
/* 実機の斜め順位バッジ (frm_deck_portrait_base_bdg_1〜5) */
.bsr-vsp-rankbdg { width: 100%; max-width: 38px; height: auto; display: block; margin-bottom: 1px; }
.bsr-vsp-icon {
  width: 100%; aspect-ratio: 1; border-radius: 6px;
  object-fit: cover; border: 1px solid rgba(255, 255, 255, 0.5);
  background: #0d1020;
}
.bsr-vsp-sub { width: 78%; }
.bsr-vsintro-vsimg2 { height: 54px; width: auto; margin: -4px auto; display: block; animation: bsrVsPop 0.5s ease-out; }
@keyframes bsrVsSlide { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; } }
@keyframes bsrVsPop { 0% { opacity: 0; transform: scale(1.8); } 100% { opacity: 1; transform: scale(1); } }

/* ---- 検分パネル (Phase 3) ---- */
.bsr-inspect {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 6;                    /* カットイン(z5)より上 = カットイン中も検分は隠れない */
  max-height: 82%;               /* カード列ぶんまで使えるので広めに */
  display: none;
  flex-direction: column;
  background: rgba(9, 11, 24, 0.95);
  border-top: 1px solid #333d78;
  backdrop-filter: blur(2px);
}
.bsr-inspect.bsr-show { display: flex; }
.bsr-inspect-head {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid #262c55;
  flex: 0 0 auto;
}
.bsr-insp-tab {
  background: #171b36; color: #aab2dd;
  border: 1px solid #262c55; border-radius: 7px;
  font-size: 12px; font-weight: 700;
  padding: 5px 14px; cursor: pointer;
}
.bsr-insp-tab-on { background: #2a3162; color: #fff; border-color: #4a55a8; }
/* 「キャラ状態」タブは少し幅広に (視認性・オーナー指示 2026-08-19) */
.bsr-insp-tab-char { padding: 5px 26px; }
.bsr-insp-tab:focus-visible { outline: 2px solid #6f9dff; outline-offset: 1px; }
.bsr-inspect-close {
  margin-left: auto;
  background: none; border: none; color: #9aa3d0;
  font-size: 15px; cursor: pointer; padding: 4px 8px;
}
.bsr-inspect-close:hover { color: #fff; }
.bsr-inspect-body {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 12px 14px;
  font-size: 12px;
}
.bsr-insp-acthead { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; flex-wrap: wrap; }
.bsr-insp-turn {
  background: #2a3162; color: #cdd4ff; font-weight: 800; font-size: 11px;
  border-radius: 5px; padding: 1px 8px; white-space: nowrap;
}
.bsr-insp-actname { font-weight: 700; color: #e8eaf6; font-size: 12.5px; }
.bsr-insp-summary { color: #ffd23e; font-weight: 700; margin: 0 0 6px; font-size: 12.5px; }
.bsr-insp-sec {
  font-size: 11px; font-weight: 800; color: #8f97c4;
  letter-spacing: 0.06em; margin: 10px 0 4px;
  border-left: 3px solid #4a55a8; padding-left: 7px;
}
.bsr-insp-tablewrap { overflow-x: auto; }
.bsr-insp-table {
  border-collapse: collapse; width: 100%;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.bsr-insp-table th, .bsr-insp-table td {
  border-bottom: 1px solid #1e2344;
  padding: 3px 8px; text-align: left; white-space: nowrap;
}
.bsr-insp-table th { color: #aab2dd; font-weight: 600; }
.bsr-insp-table td { color: #e8eaf6; }
.bsr-insp-table tr:first-child th, .bsr-insp-table tr:first-child td { color: #8f97c4; font-size: 10.5px; }
.bsr-insp-note { color: #aab2dd; font-size: 11px; margin-top: 5px; }
.bsr-insp-empty { color: #79819f; padding: 8px 2px; }
/* 丸アイコン (攻撃ログモーダルと同じ見た目に揃える) */
.bsr-insp-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: #0d1020;
  display: inline-block;
  flex: 0 0 auto;
}
.bsr-insp-icon-my { border-color: #3a86d4; }
.bsr-insp-icon-enemy { border-color: #e0286b; }
.bsr-insp-acthead .bsr-insp-icon { width: 32px; height: 32px; }
.bsr-insp-arrow { color: #8f97c4; font-weight: 800; margin: 0 2px; }
.bsr-insp-src { display: inline-flex; align-items: center; gap: 4px; }
.bsr-insp-src .bsr-insp-icon { width: 20px; height: 20px; border-width: 1.5px; }
.bsr-insp-note .bsr-insp-icon { width: 22px; height: 22px; margin-right: 4px; }
/* 複数体同時ヒットの「N体目」見出し */
.bsr-insp-hithead { display: flex; align-items: center; gap: 6px; }
.bsr-insp-hithead .bsr-insp-icon { width: 22px; height: 22px; }

/* PC (右カラム常設時) のモーダル閉じる× — モバイルでは非表示 */
.bsr-close-side { display: none; }
.bsr-inspect.bsr-docked .bsr-close-side { display: block; margin-left: auto; }

.bsr-insp-charsel { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.bsr-insp-charchip {
  width: 38px; height: 38px; padding: 0;
  background: #171b36;
  border: 2px solid #2c3468; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.bsr-insp-charchip .bsr-insp-icon { width: 30px; height: 30px; border-width: 0; }
.bsr-insp-charchip-enemy { border-color: #5c3050; }
.bsr-insp-charchip-on { border-color: #6f9dff; box-shadow: 0 0 7px rgba(111, 157, 255, 0.8); }

/* ---- シークバー (YouTube式) ---- */
.bsr-seekrow {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  background: #0d1020;
}
.bsr-ctrlbtn.bsr-seek-play, .bsr-ctrlbtn.bsr-seek-speed, .bsr-ctrlbtn.bsr-seek-insp {
  min-width: 44px; height: 34px; flex: 0 0 auto;
  padding: 0 10px; font-size: 13.5px;
}
.bsr-seekbar {
  flex: 1 1 auto; min-width: 0;
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px;
  background: #262c55;
  outline: none;
  cursor: pointer;
}
.bsr-seekbar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #6f9dff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.bsr-seekbar::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #6f9dff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.bsr-seekbar:focus-visible { outline: 2px solid #6f9dff; outline-offset: 2px; }

.bsr-ctrlbtn.bsr-ctrlbtn-on { background: #2a3162; border-color: #6f9dff; color: #fff; }

.bsr-ctrlbtn {
  min-width: 64px; height: 40px;
  border-radius: 9px;
  border: 1px solid #333d78;
  background: #1d2348;
  color: #dfe4ff;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.bsr-ctrlbtn:hover { background: #262d5c; }
.bsr-ctrlbtn:focus-visible { outline: 2px solid #6f9dff; outline-offset: 2px; }

/* 結果画面のバトルリプレイボタン (5つ目・全幅・特別色で目立たせる) */
.bs-replay-tabbtn {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #7b2ff7 0%, #d63384 100%) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  font-weight: 700 !important;
  box-shadow: 0 3px 12px rgba(123, 47, 247, 0.35);
}
.bs-replay-tabbtn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(123, 47, 247, 0.5); }

@media (prefers-reduced-motion: reduce) {
  .bsr-turnbanner.bsr-show { animation-duration: 0.6s; }
}
