/* ===== バトル(battle担当)ネオンサイバー刷新 ===== */

/* ---- 相手選択: ヒーローカード ---- */
.bt-hero {
  text-align: center;
  padding: 18px 14px 14px;
  overflow: hidden;
}
.bt-hero-title {
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.06em;
  background: linear-gradient(95deg, #fff 10%, var(--cyan) 45%, var(--magenta) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.35));
}
.bt-hero-sub {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--cyan);
}
.bt-hero-rule {
  margin-top: 10px;
  text-align: left;
  line-height: 1.55;
}

/* ---- 相手選択: VSカード ---- */
.bt-vs-card {
  padding: 16px 14px 14px;
}
.bt-vs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.bt-fighter {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bt-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
}
.bt-avatar-me {
  background: linear-gradient(135deg, #4da3ff, #8b5cf6);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.6);
}
.bt-avatar-foe {
  background: linear-gradient(135deg, #ff3d9a, #ff7a3d);
  box-shadow: 0 0 16px rgba(255, 61, 154, 0.55);
}
.bt-fighter-name {
  max-width: 100%;
  font-size: 12.5px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-fighter-sub {
  font-size: 10px;
  font-weight: 900;
  color: var(--cyan);
}
.bt-arch-badge {
  flex: none;
}

/* ---- 相手選択: 偵察ミニマップ ---- */
.bt-scout-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
}
.battle-minimap {
  width: 112px;
  flex-shrink: 0;
}
.battle-minimap .city-grid {
  gap: 2px;
}
.battle-minimap .city-cell {
  border-radius: 4px;
}
.battle-minimap .cell-icon {
  font-size: 10px;
}
.bt-scout-label {
  margin-top: 4px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.bt-opp-desc {
  flex: 1;
  min-width: 0;
  line-height: 1.55;
}
.battle-city-warn {
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(255, 77, 109, 0.2);
}
.battle-city-warn a {
  text-decoration: none;
}

/* ---- 対戦: 上部固定バー(HP×2+残り時間) ---- */
.bt-head {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top) - 4px);
  z-index: 40;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.bt-head-grid {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bt-side {
  flex: 1;
  min-width: 0;
}
.bt-side-name {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.bt-side-me {
  color: var(--cyan);
}
.bt-side-foe {
  color: var(--no);
}
.bt-side-right .bt-side-name {
  text-align: right;
}
.bt-side-right .bt-hp-num {
  text-align: right;
}
.bt-hpbar {
  height: 10px;
}
.bt-hp-num {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-dim);
}
.bt-center {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bt-vs-mini {
  width: 30px;
  height: 30px;
  font-size: 11px;
}
.bt-timer {
  display: flex;
  align-items: baseline;
  gap: 2px;
  justify-content: center;
}
.bt-timer-num {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 193, 77, 0.5);
}
.bt-timer-unit {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-dim);
}
.bt-urgent .bt-timer-num {
  color: var(--red);
  text-shadow: 0 0 14px rgba(255, 77, 109, 0.8);
  animation: bt-blink 0.5s steps(2) infinite;
}
@keyframes bt-blink {
  50% {
    opacity: 0.35;
  }
}

/* ---- ターゲット選択バナー ---- */
.bt-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(255, 193, 77, 0.1);
  border: 1px solid var(--yellow);
  border-radius: 10px;
  padding: 6px 10px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--yellow);
  box-shadow: 0 0 12px rgba(255, 193, 77, 0.25);
}

/* ---- 対戦グリッド+ユニットレイヤー ---- */
.bt-grid-wrap {
  position: relative;
  max-width: 340px;
  margin: 0 auto;
  padding: 6px;
  border-radius: 16px;
  background: rgba(12, 17, 36, 0.55);
}
.bt-grid-enemy {
  border: 1px solid rgba(255, 61, 122, 0.4);
  box-shadow: 0 0 18px rgba(255, 61, 122, 0.14), inset 0 0 24px rgba(255, 61, 122, 0.05);
}
.bt-grid-my {
  max-width: 285px;
  border: 1px solid rgba(34, 211, 238, 0.4);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.12), inset 0 0 24px rgba(34, 211, 238, 0.05);
}
.bt-grid .cell-icon {
  font-size: 15px;
}
.bt-zone-chip {
  flex: none;
  font-size: 9.5px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}
.bt-zone-raid {
  color: #fff;
  background: var(--grad-hot);
  box-shadow: 0 0 10px rgba(255, 61, 122, 0.45);
}
.bt-zone-def {
  color: #04101c;
  background: linear-gradient(95deg, #22d3ee, #34d399);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.45);
}
.bt-unit-layer {
  position: absolute;
  inset: 6px; /* グリッド本体に重ねる(wrapのpadding分) */
  pointer-events: none; /* マスのタップを邪魔しない */
  z-index: 6;
}

/* ---- ユニット(transform配置で使い回し、チームカラーのグローリング) ---- */
.bt-unit {
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  transition: transform 0.12s linear;
  will-change: transform;
}
.bt-unit-body {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: filter 0.12s;
}
.bt-unit-player .bt-unit-body {
  background: radial-gradient(circle at 35% 30%, rgba(190, 233, 255, 0.95), rgba(34, 144, 238, 0.92));
  border: 2px solid #bfe9ff;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.85), 0 0 22px rgba(34, 211, 238, 0.4);
}
.bt-unit-cpu .bt-unit-body {
  background: radial-gradient(circle at 35% 30%, rgba(255, 200, 215, 0.95), rgba(235, 49, 105, 0.92));
  border: 2px solid #ffc4d1;
  box-shadow: 0 0 10px rgba(255, 61, 122, 0.85), 0 0 22px rgba(255, 61, 122, 0.4);
}
.bt-unit-img img,
.bt-unit-img .asset-fallback {
  width: 18px;
  height: 18px;
  font-size: 13px;
  line-height: 1;
}
.bt-unit-img img {
  object-fit: contain;
  display: block;
}
.bt-unit-hp {
  position: absolute;
  bottom: -6px;
  left: 10%;
  width: 80%;
  height: 3px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 2px;
  overflow: hidden;
}
.bt-unit-hp-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}
.bt-unit-attacking .bt-unit-body {
  animation: bt-attack 0.5s infinite alternate;
}
@keyframes bt-attack {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.25);
  }
}
.bt-unit-waiting {
  opacity: 0.55;
}
.bt-unit-hit .bt-unit-body {
  filter: brightness(1.9) saturate(1.6) drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
}
/* 撃破: スケール+フェード */
.bt-unit-dead {
  pointer-events: none;
}
.bt-unit-dead .bt-unit-body {
  animation: bt-die 0.45s ease-out forwards;
}
@keyframes bt-die {
  35% {
    transform: scale(1.6);
    opacity: 1;
    filter: brightness(2.4);
  }
  100% {
    transform: scale(0.15);
    opacity: 0;
  }
}

/* ---- 市役所被弾shake ---- */
.city-cell.bt-th-hit {
  animation: bt-shake 0.4s linear infinite;
  box-shadow: inset 0 0 14px rgba(255, 77, 109, 0.85);
}
@keyframes bt-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-2px, 1px);
  }
  50% {
    transform: translate(2px, -1px);
  }
  75% {
    transform: translate(-1px, -2px);
  }
}

/* ---- マスのエフェクト(封鎖🚧 / 停電🌑 残り秒) ---- */
.bt-cell-fx {
  position: absolute;
  right: 1px;
  bottom: 1px;
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 1px 3px;
  border-radius: 5px;
  background: rgba(5, 8, 16, 0.82);
  z-index: 3;
}
.city-cell.is-blocked { outline: 1.5px solid var(--yellow); }
.city-cell.is-stopped { outline: 1.5px solid var(--purple); }
.city-cell.is-blocked .bt-cell-fx,
.city-cell.is-stopped .bt-cell-fx {
  display: flex;
}
.bt-fx-icon {
  font-size: 8px;
  line-height: 1;
}
.bt-fx-sec {
  font-size: 7px;
  font-weight: 800;
  color: var(--text);
}

/* 入口A/Bマーク */
.bt-entry-mark {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 9px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(34, 211, 238, 0.8);
  z-index: 2;
}

/* ---- ターゲット選択モードのハイライト ---- */
.bt-targeting-road .city-cell.cell-road {
  outline: 2px solid var(--yellow);
  outline-offset: -2px;
  cursor: pointer;
  animation: bt-target-pulse 0.8s infinite;
}
.bt-targeting-fac .city-cell.cell-police,
.bt-targeting-fac .city-cell.cell-hospital,
.bt-targeting-fac .city-cell.cell-power,
.bt-targeting-fac .city-cell.cell-shopping,
.bt-targeting-fac .city-cell.cell-station,
.bt-targeting-fac .city-cell.cell-tv {
  outline: 2px solid var(--red);
  outline-offset: -2px;
  cursor: pointer;
  animation: bt-target-pulse 0.8s infinite;
}
@keyframes bt-target-pulse {
  50% {
    filter: brightness(1.5);
  }
}

/* ---- コントロール(エネルギー/入口/部隊/スキル) ---- */
.bt-controls {
  margin-top: 12px;
  padding: 12px;
}
.bt-energy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.bt-energy-row .seg-gauge {
  flex: 1;
}
.bt-energy-ic {
  font-size: 15px;
  line-height: 1;
}
.bt-energy-tag {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  min-width: 26px;
}

/* 挑戦ボタン(中央寄せ・グラデ+グロー+シャイン) */
.bt-challenge-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin-top: 12px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #ff3d9a 0%, #a855f7 48%, #22d3ee 100%);
  background-size: 200% 200%;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
  animation: bt-challenge-shine 4s ease infinite;
}
/* 斜めの光沢スイープ */
.bt-challenge-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  animation: bt-challenge-sweep 3.2s ease-in-out infinite;
}
@keyframes bt-challenge-shine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes bt-challenge-sweep {
  0%, 60% { left: -60%; }
  100% { left: 120%; }
}
.bt-challenge-btn:hover { filter: brightness(1.08); box-shadow: 0 10px 30px rgba(168, 85, 247, 0.6); }
.bt-challenge-btn:active { transform: scale(0.97); }
.bt-challenge-btn:disabled {
  opacity: 0.5;
  filter: grayscale(0.4);
  cursor: not-allowed;
  animation: none;
}
.bt-challenge-btn:disabled::before { display: none; }
.bt-challenge-ic { font-size: 20px; line-height: 1; }
.bt-challenge-label { position: relative; }
.bt-challenge-cost {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  letter-spacing: 0;
}
/* スキルエネルギーは部隊(シアン)と色分け(マゼンタ) */
.bt-energy-skill .bt-energy-val {
  color: var(--magenta);
  text-shadow: 0 0 10px rgba(255, 61, 154, 0.5);
}
.bt-energy-skill .seg-gauge { filter: hue-rotate(115deg); }
.bt-energy-val {
  font-size: 17px;
  font-weight: 900;
  color: var(--cyan);
  min-width: 34px;
  text-align: right;
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}
.bt-energy-max {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
}

/* 入口トグル */
.bt-entry-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.bt-entry-btn {
  flex: 1;
}
.bt-entry-on {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

/* 部隊カード/スキルボタン(3枚グリッド) */
.bt-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.bt-actions:last-child {
  margin-bottom: 0;
}
.bt-action-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 7px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.06s, border-color 0.2s, box-shadow 0.2s, filter 0.2s, opacity 0.2s;
  user-select: none;
}
.bt-action-btn:active {
  transform: scale(0.95);
}
.bt-action-btn.is-ready {
  border-color: var(--border-glow);
  box-shadow: 0 0 12px rgba(77, 163, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.bt-action-btn:disabled {
  cursor: default;
  filter: grayscale(0.85);
  opacity: 0.5;
}
.bt-card-img img,
.bt-card-img .asset-fallback {
  width: 34px;
  height: 34px;
  font-size: 24px;
  line-height: 34px;
}
.bt-card-img img {
  object-fit: contain;
  display: block;
}
.bt-card-name {
  font-size: 10.5px;
  font-weight: 900;
}
.bt-card-cost {
  font-size: 10px;
  font-weight: 900;
  color: var(--yellow);
}
/* 部隊召喚: クールダウン残秒オーバーレイ(準備中はカードを覆って秒数表示) */
.bt-card-cd {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 20, 0.72);
  border-radius: inherit;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  z-index: 3;
  pointer-events: none;
}
.bt-unit-card.is-cooldown .bt-card-cd { display: flex; }
.bt-unit-card.is-cooldown { filter: grayscale(0.5) brightness(0.8); }
/* スキル: クールダウン残秒オーバーレイ */
.bt-cd {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 20, 0.78);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 900;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
.bt-skill-btn.is-targeting {
  border-color: var(--yellow);
  box-shadow: 0 0 14px rgba(255, 193, 77, 0.5);
}
.bt-skill-active {
  border-color: var(--magenta);
  box-shadow: 0 0 14px rgba(255, 61, 154, 0.55);
}

/* ---- バトルログ小窓(固定オーバーレイ、タップで展開) ---- */
.bt-log-box {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
  width: min(452px, calc(100vw - 24px));
  z-index: 45;
  background: rgba(11, 16, 33, 0.94);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 14px rgba(77, 163, 255, 0.15);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.bt-log-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}
.bt-log-title {
  flex: 1;
  text-align: left;
}
.bt-log-count {
  font-size: 10px;
  font-weight: 900;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 999px;
  padding: 1px 7px;
}
.bt-log-arrow {
  color: var(--text-dim);
  transition: transform 0.2s;
}
.bt-log-open .bt-log-arrow {
  transform: rotate(180deg);
}
.bt-log-list {
  padding: 0 12px 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.bt-log-line {
  line-height: 1.5;
}
/* 折りたたみ時は最新2件のみオーバーレイ表示 */
.bt-log-box:not(.bt-log-open) .bt-log-line {
  display: none;
}
.bt-log-box:not(.bt-log-open) .bt-log-line:nth-last-child(-n + 2) {
  display: block;
}
/* 展開時は全文スクロール */
.bt-log-open .bt-log-list {
  max-height: 38vh;
  overflow-y: auto;
}

/* ---- リザルト全画面演出 ---- */
.bt-result-screen {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
  animation: fade-in 0.3s;
}
.bt-rs-win {
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(34, 211, 238, 0.22), transparent 70%),
    radial-gradient(60% 45% at 50% 100%, rgba(139, 92, 246, 0.2), transparent 70%),
    rgba(4, 7, 16, 0.97);
}
.bt-rs-lose {
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(255, 61, 122, 0.16), transparent 70%),
    rgba(4, 7, 16, 0.97);
}
.bt-result-inner {
  width: min(380px, 100%);
  margin: auto;
  text-align: center;
  animation: pop-in 0.4s cubic-bezier(0.2, 1.2, 0.3, 1);
}
.bt-emblem {
  display: inline-flex;
}
.bt-emblem img,
.bt-emblem .asset-fallback {
  width: 110px;
  height: 110px;
  font-size: 78px;
  line-height: 110px;
}
.bt-emblem img {
  object-fit: contain;
}
.bt-emblem {
  animation: bt-emblem-pop 0.7s cubic-bezier(0.3, 1.6, 0.4, 1);
  filter: drop-shadow(0 0 24px rgba(77, 163, 255, 0.45));
}
@keyframes bt-emblem-pop {
  0% {
    transform: scale(0) rotate(-18deg);
  }
  60% {
    transform: scale(1.2);
  }
}
.bt-result-title {
  font-size: 46px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.08em;
  line-height: 1.15;
  margin-top: 4px;
  background: var(--grad-cta);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.45));
  animation: bt-title-in 0.5s cubic-bezier(0.2, 1.4, 0.3, 1) both;
}
.bt-rs-lose .bt-result-title {
  background: linear-gradient(95deg, #ff4d6d, #ff3d9a 55%, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 18px rgba(255, 61, 122, 0.4));
}
@keyframes bt-title-in {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}
.bt-result-sub {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-dim);
  margin-top: 4px;
}
.bt-rs-hp-card {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  text-align: left;
}
.bt-rs-hp + .bt-rs-hp {
  margin-top: 10px;
}
.bt-rs-hp-row {
  font-size: 11.5px;
  font-weight: 800;
  margin-bottom: 4px;
}

/* 報酬カウントアップ */
.bt-rw-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(26, 34, 66, 0.92), rgba(15, 20, 42, 0.94));
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 18px rgba(57, 112, 255, 0.14);
}

/* ===== Compact battle UX v2 ===== */
#view:has(.bt-mode-screen),
#view:has(.bt-event-screen),
#view:has(.bt-select-screen),
#view:has(.bt-live-screen) {
  height: calc(100dvh - var(--topbar-h));
  padding: 8px 10px calc(var(--nav-h) + var(--safe-bottom) + 8px);
  overflow: hidden;
}

.bt-mode-screen,
.bt-event-screen,
.bt-select-screen,
.bt-live-screen {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bt-mode-screen {
  position: relative;
  gap: 12px;
  padding: 18px 14px 14px;
  overflow: hidden;
  border: 1px solid rgba(117, 81, 255, 0.68);
  border-radius: 18px;
  background:
    radial-gradient(circle at 76% 8%, rgba(34, 211, 238, 0.2), transparent 30%),
    linear-gradient(180deg, rgba(4, 10, 28, 0.28), rgba(3, 8, 24, 0.96)),
    url('/assets/img/battle-arena.png') center / cover;
  box-shadow: inset 0 0 54px rgba(13, 8, 54, 0.78), 0 0 24px rgba(117, 81, 255, 0.2);
}

.bt-mode-hero {
  text-align: center;
}

.bt-mode-kicker {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .2em;
  text-shadow: 0 0 12px var(--cyan);
}

.bt-mode-hero h1,
.bt-event-visual h1 {
  margin: 5px 0 3px;
  color: #fff;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: .04em;
  text-shadow: 0 0 18px rgba(112, 89, 255, .8);
}

.bt-mode-hero p,
.bt-event-visual p {
  margin: 0;
  color: var(--text-dim);
  font-size: 10px;
}

.bt-mode-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bt-mode-card {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px;
  overflow: hidden;
  border: 1px solid rgba(92, 180, 255, .5);
  border-radius: 17px;
  cursor: pointer;
  isolation: isolate;
  transition: transform .16s ease, border-color .16s ease;
}

.bt-mode-card:active {
  transform: scale(.985);
}

.bt-mode-card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.bt-mode-story {
  background:
    linear-gradient(90deg, rgba(2, 8, 24, .94) 6%, rgba(4, 15, 43, .66) 58%, rgba(4, 15, 43, .18)),
    url('/assets/img/city-diorama.png') 72% center / cover;
}

.bt-mode-event {
  border-color: rgba(255, 61, 154, .5);
  background:
    linear-gradient(90deg, rgba(19, 4, 31, .96) 6%, rgba(43, 5, 42, .68) 58%, rgba(43, 5, 42, .2)),
    url('/assets/img/banner-event.png') center / cover;
}

.bt-mode-card-glow {
  position: absolute;
  z-index: -1;
  inset: auto -20% -50% 20%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(34, 211, 238, .28), transparent 68%);
}

.bt-mode-event .bt-mode-card-glow {
  background: radial-gradient(ellipse, rgba(255, 61, 154, .32), transparent 68%);
}

.bt-mode-card-copy {
  max-width: 70%;
}

.bt-mode-eyebrow {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .16em;
}

.bt-mode-event .bt-mode-eyebrow {
  color: #ff89c2;
}

.bt-mode-title {
  margin: 4px 0;
  color: #fff;
  font-size: 25px;
  line-height: 1;
}

.bt-mode-description {
  margin: 0;
  color: #c6d5f3;
  font-size: 10px;
  line-height: 1.45;
}

.bt-mode-meta {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(80, 218, 255, .4);
  border-radius: 999px;
  color: #b9f4ff;
  background: rgba(5, 34, 55, .72);
  font-size: 8px;
  font-weight: 800;
}

.bt-mode-event .bt-mode-meta {
  border-color: rgba(255, 92, 172, .45);
  color: #ffc3e1;
  background: rgba(62, 8, 42, .72);
}

.bt-mode-enter {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}

.bt-mode-enter b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #06101d;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(34, 211, 238, .7);
  font-size: 22px;
}

.bt-mode-event .bt-mode-enter b {
  background: var(--magenta);
  box-shadow: 0 0 14px rgba(255, 61, 154, .7);
}

.bt-mode-footer {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 8px;
  font-weight: 800;
}

.bt-page-back {
  flex: none;
  padding: 5px 8px;
  border: 1px solid rgba(99, 180, 255, .42);
  border-radius: 9px;
  color: var(--cyan);
  background: rgba(3, 15, 37, .8);
  font-size: 9px;
  font-weight: 900;
}

.bt-story-heading {
  flex: 1;
  min-width: 0;
  margin-left: 8px;
}

.bt-event-screen {
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 61, 154, .55);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(12, 5, 30, .4), rgba(3, 8, 24, .96)),
    url('/assets/img/banner-event.png') center / cover;
}

.bt-event-visual {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  border: 1px solid rgba(255, 91, 173, .3);
  border-radius: 16px;
  background: rgba(4, 7, 22, .76);
  backdrop-filter: blur(3px);
}

.bt-event-lock {
  display: grid;
  width: 78px;
  height: 78px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid rgba(255, 100, 178, .7);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 61, 154, .22), rgba(112, 66, 255, .24));
  box-shadow: 0 0 28px rgba(255, 61, 154, .28);
  font-size: 34px;
}

.bt-event-notice {
  margin-top: 16px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #ffc1df;
  background: rgba(255, 61, 154, .12);
  font-size: 9px;
  font-weight: 800;
}

.bt-event-return {
  flex: none;
}

.bt-select-screen {
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(117, 81, 255, 0.68);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(4, 10, 28, 0.34), rgba(3, 8, 24, 0.96)),
    url('/assets/img/battle-arena.png') center / cover;
  box-shadow: inset 0 0 44px rgba(13, 8, 54, 0.72), 0 0 24px rgba(117, 81, 255, 0.2);
}

.bt-select-head,
.bt-cycle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bt-select-head .bt-hero-title {
  font-size: 22px;
  line-height: 1;
}

.bt-select-head .bt-hero-sub {
  margin-top: 4px;
  font-size: 8px;
}

.bt-select-status {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(52, 211, 153, 0.6);
  border-radius: 999px;
  color: var(--green);
  background: rgba(6, 45, 39, 0.72);
  font-size: 8px;
  font-weight: 900;
}

.bt-select-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 9px var(--green);
}

.bt-cycle {
  min-height: 28px;
}

.bt-cycle-center {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.bt-opponent-counter {
  color: var(--cyan);
  font-size: 10px;
}

.bt-cycle-btn {
  width: 34px;
  height: 28px;
  border: 1px solid var(--border-glow);
  border-radius: 9px;
  color: var(--cyan);
  background: rgba(5, 17, 42, 0.9);
  font-size: 24px;
  line-height: 20px;
}

.bt-opponent-stage {
  flex: 1;
  min-height: 0;
}

.bt-opponent-stage .bt-vs-card {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: linear-gradient(160deg, rgba(9, 24, 58, 0.96), rgba(14, 8, 42, 0.96));
}

.bt-opponent-stage .bt-vs-row {
  min-height: 88px;
}

.bt-opponent-stage .bt-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 22px;
}

.bt-target-art {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(118px, 42%) 1fr;
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
}

/* 左: 縦長ストーリーアートのパネル */
.bt-story-frame {
  position: relative;
  min-height: 172px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(78, 156, 255, 0.35);
  background: #02091b;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(120, 170, 255, .12);
}
.bt-story-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  filter: saturate(1.12) contrast(1.06);
}
.bt-story-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgba(2, 7, 20, .72), transparent 42%),
    linear-gradient(180deg, rgba(2, 7, 20, .4), transparent 26%);
}
.bt-story-frame .bt-intel-label {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  margin: 0;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(3, 8, 22, .72);
  backdrop-filter: blur(2px);
}

/* 右: ミニマップ + 情報 */
.bt-target-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.bt-target-art .battle-minimap {
  position: relative;
  z-index: 1;
  width: 100%;
}

.bt-target-art .city-grid {
  gap: 3px;
  padding: 5px;
  border-radius: 11px;
  background: radial-gradient(circle at 50% 50%, rgba(54, 201, 255, 0.12), rgba(2, 7, 20, 0.9));
}

.bt-target-art .city-cell {
  border-color: rgba(71, 135, 224, 0.5);
  background: rgba(11, 27, 61, 0.9);
}

.bt-target-intel {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 7px;
  border-radius: 9px;
  background: rgba(3, 10, 28, .55);
  backdrop-filter: blur(2px);
}

.bt-intel-label {
  color: var(--magenta);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}

.bt-opp-desc {
  font-size: 10.5px;
  line-height: 1.45;
}

.bt-intel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.bt-intel-tags span {
  padding: 3px 6px;
  border: 1px solid rgba(255, 61, 154, 0.45);
  border-radius: 999px;
  color: #ffc4e4;
  background: rgba(255, 61, 154, 0.1);
  font-size: 8px;
  font-weight: 800;
}

.bt-opponent-stage .cta-btn {
  flex: none;
  margin-top: 8px;
  padding: 11px;
  border-radius: 11px;
  font-size: 14px;
}

.bt-opponent-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.bt-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(148, 160, 196, 0.42);
}

.bt-dot.on {
  width: 22px;
  border-radius: 999px;
  background: var(--grad-cta);
  box-shadow: 0 0 9px var(--cyan);
}

.bt-rule-strip {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 8px;
  font-weight: 800;
}

.bt-rule-strip span {
  color: var(--yellow);
}

/* Live battle fits between the persistent header and navigation. */
.bt-live-screen {
  gap: 6px;
}

.bt-live-screen .bt-head {
  position: relative;
  top: auto;
  flex: none;
  margin: 0;
  padding: 7px 9px;
  border-radius: 12px;
}

.bt-live-screen .bt-side-name {
  margin-bottom: 2px;
  font-size: 9px;
}

.bt-live-screen .bt-hpbar {
  height: 7px;
}

.bt-live-screen .bt-hp-num {
  margin-top: 1px;
  font-size: 8px;
}

.bt-live-screen .bt-vs-mini {
  width: 22px;
  height: 22px;
  font-size: 8px;
}

.bt-live-screen .bt-timer-num {
  font-size: 20px;
}

.bt-battlefield {
  flex: 1;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 18px 1fr;
  align-items: center;
  gap: 3px;
  padding: 7px;
  border: 1px solid rgba(112, 75, 255, 0.52);
  border-radius: 13px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 31, 111, 0.08), rgba(4, 9, 28, 0.38) 48%, rgba(32, 207, 255, 0.08)),
    url('/assets/img/battle-arena.png') center / cover;
}

.bt-field-panel {
  min-width: 0;
}

.bt-field-label {
  height: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bt-field-player .bt-field-label {
  justify-content: flex-end;
}

.bt-field-divider {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bt-field-divider::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(transparent, var(--magenta), var(--cyan), transparent);
}

.bt-field-divider span {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--magenta), var(--cyan));
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.8);
  font-size: 8px;
  font-weight: 900;
}

.bt-live-screen .bt-grid-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 4px;
  border-radius: 9px;
}

.bt-live-screen .bt-grid-my {
  max-width: none;
}

.bt-live-screen .bt-grid {
  gap: 2px;
}

.bt-live-screen .city-cell {
  border-radius: 4px;
}

.bt-live-screen .bt-grid .cell-icon {
  font-size: clamp(8px, 2.5vw, 12px);
}

.bt-live-screen .bt-unit-layer {
  inset: 4px;
}

.bt-live-screen .bt-unit {
  width: 22px;
  height: 22px;
}

.bt-live-screen .bt-unit-img img,
.bt-live-screen .bt-unit-img .asset-fallback {
  width: 22px;
  height: 22px;
}

.bt-live-screen .bt-controls {
  flex: none;
  margin: 0;
  padding: 7px;
  border-radius: 12px;
}

.bt-control-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.bt-live-screen .bt-energy-row,
.bt-live-screen .bt-entry-toggle {
  margin: 0;
}

.bt-live-screen .bt-energy-row {
  gap: 4px;
}

/* 部隊デッキとスキルデッキの間に余白(スキルエネルギー行の前で区切る) */
.bt-live-screen .bt-energy-row.bt-energy-skill {
  margin-top: 14px;
}

.bt-live-screen .bt-energy-val {
  min-width: 22px;
  font-size: 12px;
}

.bt-live-screen .bt-energy-max {
  display: none;
}

.bt-live-screen .bt-entry-toggle {
  gap: 3px;
}

.bt-live-screen .bt-entry-btn {
  min-width: 0;
  padding: 5px 3px;
  font-size: 8px;
  border-radius: 7px;
}

.bt-deck-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.bt-live-screen .bt-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 5px;
}

.bt-live-screen .bt-actions:last-child {
  margin: 0;
}

.bt-live-screen .bt-action-btn {
  height: 56px;
  display: grid;
  grid-template-columns: 35px 1fr;
  grid-template-rows: 1fr 1fr;
  justify-items: start;
  gap: 0 4px;
  padding: 4px;
  border-radius: 9px;
}

.bt-live-screen .bt-card-img {
  grid-row: 1 / 3;
  align-self: center;
}

.bt-live-screen .bt-card-img img,
.bt-live-screen .bt-card-img .asset-fallback {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.bt-live-screen .bt-card-name {
  align-self: end;
  font-size: 8px;
  white-space: nowrap;
}

.bt-live-screen .bt-card-cost {
  align-self: start;
  font-size: 8px;
}

.bt-live-screen .bt-log-box {
  display: none;
}

/* ===== Battle systems v3: countdown, targets, facility HP, defense deployment ===== */
.bt-target-status {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 4px;
  border-top: 1px solid rgba(75, 145, 255, 0.2);
  color: var(--text-dim);
  font-size: 8px;
  font-weight: 800;
}

.bt-target-name {
  color: var(--yellow);
  font-size: 9px;
  font-weight: 900;
}

/* 各8×8グリッド下の攻撃目標(双方) */
.bt-grid-target {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(13, 18, 38, 0.85);
  border: 1px solid rgba(255, 61, 122, 0.32);
  font-size: 9.5px;
  font-weight: 800;
  color: var(--text-dim);
}
.bt-grid-target-foe { border-color: rgba(34, 211, 238, 0.32); }
.bt-gt-cap { letter-spacing: 0.03em; white-space: nowrap; }
.bt-gt-name {
  color: var(--yellow);
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 0 7px rgba(245, 179, 1, 0.45);
}
.bt-gt-foe { color: #6ee7ff; text-shadow: 0 0 7px rgba(34, 211, 238, 0.5); }

/* グリッド下の補助情報(発動中スキル・部隊数) */
.bt-grid-info {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(13, 18, 38, 0.7);
  font-size: 9px;
  font-weight: 800;
  color: var(--text-dim);
}
.bt-gi-cap { flex: none; white-space: nowrap; align-self: flex-start; }
.bt-grid-info { align-items: flex-start; }
.bt-gi-val {
  color: #e7ecff;
  font-weight: 900;
  font-size: 10px;
  line-height: 1.35;
  word-break: break-word;
}

.bt-target-status small {
  color: var(--cyan);
  font-size: 7px;
  font-weight: 700;
}

.bt-attack-target {
  outline: 2px solid var(--yellow);
  outline-offset: -2px;
  box-shadow: inset 0 0 12px rgba(255, 193, 77, 0.45), 0 0 9px rgba(255, 193, 77, 0.5);
  animation: bt-target-pulse 0.9s infinite;
}

.bt-facility-hp {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 2px;
  z-index: 5;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.76);
}

.bt-facility-hp i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 5px var(--cyan);
}

.bt-grid-enemy .bt-facility-hp i {
  background: linear-gradient(90deg, var(--red), var(--yellow));
}

.bt-facility-destroyed {
  filter: grayscale(1) brightness(0.35);
  opacity: 0.58;
}

.bt-facility-destroyed::after {
  content: "×";
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  color: var(--red);
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 0 8px #000;
}

.bt-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

.bt-mode-btn {
  min-width: 0;
  padding: 5px 2px;
  border-radius: 7px;
  font-size: 8px;
}

.bt-mode-btn.bt-mode-on {
  border-color: var(--cyan);
  color: #03131e;
  background: var(--grad-cta);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.35);
}

.bt-live-screen .bt-entry-toggle {
  margin-bottom: 5px;
}

.bt-live-screen .bt-unit-deck {
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
}

.bt-live-screen .bt-unit-deck .bt-action-btn {
  height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: 2px;
}

.bt-live-screen .bt-unit-deck .bt-card-img {
  grid-row: auto;
}

.bt-live-screen .bt-unit-deck .bt-card-img img,
.bt-live-screen .bt-unit-deck .bt-card-img .asset-fallback {
  width: 27px;
  height: 27px;
}

.bt-live-screen .bt-unit-deck .bt-card-name,
.bt-live-screen .bt-unit-deck .bt-card-cost {
  font-size: 7px;
  line-height: 1.1;
}

.bt-countdown {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 48%, rgba(90, 71, 255, 0.32), transparent 32%),
    rgba(1, 5, 17, 0.72);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.bt-countdown-label {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-shadow: 0 0 12px var(--cyan);
}

.bt-countdown-num {
  margin-top: 4px;
  color: #fff;
  font-size: 76px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 16px var(--magenta), 0 0 36px var(--cyan);
  animation: bt-count-pop 1s steps(1) infinite;
}

.bt-countdown.is-go {
  animation: bt-count-go 0.65s ease-out forwards;
}

.bt-countdown.is-go .bt-countdown-num {
  color: var(--green);
  font-size: 54px;
}

@keyframes bt-count-pop {
  50% { transform: scale(1.08); }
}

@keyframes bt-count-go {
  to { opacity: 0; transform: scale(1.12); }
}

.bt-unit-engaged .bt-unit-body {
  animation: bt-attack 0.22s infinite alternate;
  box-shadow: 0 0 13px var(--yellow);
}

@media (max-height: 740px) {
  .bt-opponent-stage .bt-vs-row {
    min-height: 72px;
  }
  .bt-target-art {
    padding: 5px;
  }
  .bt-live-screen .bt-action-btn {
    height: 48px;
  }
  .bt-live-screen .bt-card-img img,
  .bt-live-screen .bt-card-img .asset-fallback {
    width: 29px;
    height: 29px;
  }
}
.bt-rw-title {
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.bt-rw-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.bt-rw-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 4px;
  border-radius: 12px;
  background: rgba(15, 21, 44, 0.85);
  border: 1px solid var(--border);
}
.bt-rw-ic {
  font-size: 18px;
  line-height: 1.2;
}
/* ドッグタグのドロップ表示 */
.bt-rw-tags { margin-top: 10px; }
.bt-rw-tags-label { font-size: 11px; font-weight: 900; color: var(--text-dim); margin-bottom: 6px; }
.bt-rw-tags-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-rw-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(15, 21, 44, 0.85); border: 1px solid var(--border);
  font-size: 11px; font-weight: 800;
}
.bt-rw-tag-ic { display: inline-flex; }
.bt-rw-tag-ic img, .bt-rw-tag-ic .asset-fallback { width: 20px; height: 26px; object-fit: contain; }
.bt-rw-tag-ic .asset-fallback { font-size: 14px; }
.bt-rw-tag-name { color: var(--text-dim); }
.bt-rw-tag b { font-variant-numeric: tabular-nums; }
.bt-rw-num {
  font-size: 17px;
  font-weight: 900;
  color: var(--yellow);
}
.bt-rw-label {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.bt-rw-status {
  margin-top: 8px;
  font-weight: 700;
}
.bt-result-btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.bt-result-btns .cta-btn,
.bt-result-btns .btn {
  flex: 1;
  text-decoration: none;
}
.bt-city-link {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 紙吹雪(勝利時、有限アニメーション) */
.bt-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.bt-confetti i {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: bt-confetti-fall 2.6s ease-in 0s forwards;
}
@keyframes bt-confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(105vh) rotate(680deg);
    opacity: 0.5;
  }
}

/* Reference battle presentation */
.bt-hero {
  border-radius: 9px;
  background:
    linear-gradient(90deg, rgba(3,10,29,.93), rgba(3,10,29,.48)),
    url('/assets/img/battle-arena.png') center/cover;
}
.bt-vs-card {
  border-radius: 9px;
  border-color: rgba(102, 57, 255, .55);
}
.bt-vs-card:nth-of-type(odd) { box-shadow: inset 0 0 26px rgba(255,45,139,.05), 0 0 16px rgba(255,45,139,.08); }
.bt-vs-card .cta-btn { border: 1px solid rgba(104,214,255,.7); }

.bt-head { border-radius: 8px; background: rgba(3,10,28,.97); }
.bt-head + * { position: relative; }
.bt-battlefield, .bt-field, .bt-stage {
  background-image:
    linear-gradient(180deg, rgba(2,8,23,.16), rgba(2,8,23,.58)),
    url('/assets/img/battle-arena.png');
  background-position: center;
  background-size: cover;
}
.bt-unit-controls, .bt-controls {
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(7,22,54,.98), rgba(3,10,27,.98));
}

/* 小さな戦場でも施設の固定色と大きなシンボルで判別できる */
.bt-grid .city-cell.cell-police,
.bt-grid-mini .city-cell.cell-police {
  border-color: #2d9aff;
  background: radial-gradient(circle, rgba(27, 132, 255, .42), #071a3b) !important;
}
.bt-grid .city-cell.cell-hospital,
.bt-grid-mini .city-cell.cell-hospital {
  border-color: #ff5252;
  background: radial-gradient(circle, rgba(255, 65, 65, .44), #350b17) !important;
}
.bt-grid .city-cell.cell-power,
.bt-grid-mini .city-cell.cell-power {
  border-color: #ffd43b;
  background: radial-gradient(circle, rgba(255, 190, 28, .44), #302407) !important;
}
.bt-grid .city-cell.cell-shopping,
.bt-grid-mini .city-cell.cell-shopping {
  border-color: #2edb89;
  background: radial-gradient(circle, rgba(31, 207, 119, .42), #092c21) !important;
}
.bt-grid .city-cell.cell-station,
.bt-grid-mini .city-cell.cell-station {
  border-color: #53c4ff;
  background: radial-gradient(circle, rgba(45, 173, 255, .42), #08263b) !important;
}
.bt-grid .city-cell.cell-tv,
.bt-grid-mini .city-cell.cell-tv {
  border-color: #c064ff;
  background: radial-gradient(circle, rgba(165, 61, 255, .44), #260d3b) !important;
}
.bt-grid .city-cell.cell-port,
.bt-grid-mini .city-cell.cell-port {
  border-color: #36ded2;
  background: radial-gradient(circle, rgba(32, 199, 194, .44), #072e34) !important;
}
.bt-grid .city-cell.cell-road,
.bt-grid-mini .city-cell.cell-road {
  border-color: #4a78a8;
  background:
    linear-gradient(rgba(5, 13, 32, .04), rgba(5, 13, 32, .04)),
    url('/assets/img/generated/road-cross-v1.png') center / 118% 118% no-repeat,
    #101b36 !important;
}
.bt-grid .city-cell[data-level]::before {
  content: "Lv." attr(data-level);
  position: absolute;
  top: 1px;
  right: 2px;
  z-index: 4;
  color: #fff;
  font-size: 5px;
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}

/* ===== バトル演出層(FX/SE 統合) ===== */
.bt-battlefield > canvas { pointer-events: none; }
.bt-battlefield { will-change: transform; }
.bt-head { position: relative; }

/* HUDトグル(効果音/エフェクト) */
/* 右下のツール群(効果音/エフェクト切替 + ギブアップ)。バトル中だけ画面右下に固定表示。 */
.bt-corner-tools {
  position: fixed;
  right: 10px;
  bottom: calc(var(--safe-bottom, 0px) + 10px);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 7;
}
.bt-giveup-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 90, 90, 0.6);
  background: rgba(40, 12, 16, 0.9);
  color: #ff9a9a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.bt-giveup-btn:active { transform: scale(0.94); }
.bt-giveup-btn:hover { background: rgba(60, 16, 22, 0.95); }
.bt-giveup-ic { font-size: 14px; line-height: 1; }
.bt-icon-toggle {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(10, 15, 32, 0.85);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s, opacity 0.15s;
}
.bt-icon-toggle:active { transform: scale(0.9); }
.bt-icon-toggle.is-off { opacity: 0.45; }

/* 勢力バー(押し込み具合) */
.bt-momentum {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
}
.bt-momentum-cap {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.bt-momentum-you { color: var(--cyan); }
.bt-momentum-foe { color: var(--no); }
.bt-momentum-track {
  position: relative;
  flex: 1;
  height: 7px;
  border-radius: 99px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.18), rgba(255, 61, 122, 0.22));
  border: 1px solid var(--border);
}
.bt-momentum-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  background: linear-gradient(90deg, #22d3ee, #4da3ff);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.65);
  transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bt-momentum-fill::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: #eaffff;
  box-shadow: 0 0 8px #22d3ee;
}

/* ダメージビネット(画面端の発光) */
.bt-vignette {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

/* スキル/勝敗カットイン */
.bt-cutin {
  position: fixed;
  top: 38%;
  left: 0;
  right: 0;
  z-index: 70;
  pointer-events: none;
  text-align: center;
  font-size: clamp(30px, 11vw, 64px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--cutin-color, #22d3ee);
  text-shadow: 0 0 18px var(--cutin-color, #22d3ee), 0 3px 10px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateX(-40%) skewX(-8deg);
}
.bt-cutin.is-show { animation: bt-cutin-sweep 0.85s cubic-bezier(0.15, 0.9, 0.2, 1) forwards; }
/* 相手のスキル発動: 画面下寄りに表示(自分は上=38%)。少し小さめ。 */
.bt-cutin-foe {
  top: auto;
  bottom: 26%;
  font-size: clamp(22px, 8vw, 46px);
}
@keyframes bt-cutin-sweep {
  0% { opacity: 0; transform: translateX(-46%) skewX(-8deg) scale(0.8); }
  18% { opacity: 1; transform: translateX(0) skewX(-8deg) scale(1.04); }
  72% { opacity: 1; transform: translateX(2%) skewX(-8deg) scale(1); }
  100% { opacity: 0; transform: translateX(34%) skewX(-8deg) scale(1); }
}

/* コンボ表示 */
.bt-combo {
  position: fixed;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 65;
  pointer-events: none;
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  color: #ffd24d;
  text-shadow: 0 0 14px rgba(255, 200, 60, 0.8), 0 2px 6px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.3s;
}
.bt-combo.is-pop { animation: bt-combo-pop 0.4s cubic-bezier(0.2, 1.5, 0.3, 1); }
@keyframes bt-combo-pop {
  0% { transform: translateX(-50%) scale(0.4); }
  60% { transform: translateX(-50%) scale(1.25); }
  100% { transform: translateX(-50%) scale(1); }
}

/* 部隊オーラ(部隊ごと=その部隊のサイドのバフで点灯。攻撃部隊も防衛部隊も対象) */
/* charge=加速 / buff=攻撃UP・吸収(鼓舞/オーバードライブ) / smoke=煙幕 */
.bt-unit.bt-aura-charge .bt-unit-img {
  filter: drop-shadow(0 0 6px #ff8a3d) drop-shadow(0 0 10px #ffb13d) brightness(1.12);
}
.bt-unit.bt-aura-buff .bt-unit-img {
  filter: drop-shadow(0 0 6px #ffd24d) drop-shadow(0 0 11px #ff5cf0) brightness(1.14);
}
.bt-unit.bt-aura-smoke {
  opacity: 0.55;
  filter: blur(0.6px) grayscale(0.3);
}

@media (prefers-reduced-motion: reduce) {
  .bt-cutin.is-show { animation-duration: 0.5s; }
}

/* ===== バトル: 部隊グレード(変種)カード ===== */
.bt-unit-card { position: relative; }
.bt-grade-badge {
  position: absolute; top: 3px; left: 3px; z-index: 2;
  font-size: 8.5px; font-weight: 900; padding: 0 4px; border-radius: 5px;
  color: #06101f; line-height: 1.5; letter-spacing: .03em;
}
.bt-card-base { font-size: 7.5px; color: var(--text-dim); line-height: 1.1; }
