/* 戦闘サンプルの質感を、複数人の3x3盤へ適用する最終上書き。 */
.battle.battle-launch {
  --battle-navy: #111a25;
  --battle-navy-deep: #09111b;
  --battle-panel: rgba(15, 25, 37, .9);
  --battle-panel-soft: rgba(25, 37, 51, .78);
  --battle-brass: #bda16a;
  --battle-brass-soft: rgba(189, 161, 106, .48);
  --battle-ivory: #f3ead6;
  --battle-hit: #f4cf82;
  --battle-heal: #9de0bb;
  gap: 7px;
  color: var(--battle-ivory);
}

.battle-launch .battle-side-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d5c39c;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .18em;
}

.battle-launch .battle-side-label::before,
.battle-launch .battle-side-label::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--battle-brass-soft);
}

.battle-launch .battle-scene {
  position: relative;
  isolation: isolate;
  gap: 7px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--battle-brass);
  border-radius: 2px;
  background-image:
    linear-gradient(180deg, rgba(7, 13, 22, .7), rgba(10, 19, 29, .43) 44%, rgba(6, 12, 19, .82)),
    var(--battle-backdrop);
  background-position: center;
  background-size: cover;
  box-shadow:
    inset 0 0 0 3px rgba(8, 15, 23, .72),
    inset 0 0 52px rgba(0, 0, 0, .58),
    0 8px 22px rgba(0, 0, 0, .22);
}

.battle-launch .battle-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 7, 13, .32), transparent 20% 80%, rgba(3, 7, 13, .32)),
    radial-gradient(ellipse at 50% 50%, rgba(192, 164, 105, .1), transparent 65%);
}

.battle-launch .bgrid {
  position: relative;
  z-index: 1;
  gap: 6px;
}

.battle-launch .bcell {
  border-radius: 2px;
  transition: border-color .12s, box-shadow .12s, opacity .2s;
}

.battle-launch .bcell:not(.empty) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 4px auto;
  column-gap: 7px;
  row-gap: 2px;
  min-height: 70px;
  padding: 7px 8px 6px;
  overflow: hidden;
  border: 1px solid var(--battle-brass-soft);
  background:
    linear-gradient(145deg, rgba(42, 55, 70, .86), rgba(10, 18, 28, .92) 68%),
    var(--battle-panel);
  box-shadow: inset 0 0 0 1px rgba(5, 10, 16, .75);
}

.battle-launch .bcell.has-face {
  grid-template-columns: 44px minmax(0, 1fr);
}

.battle-launch .bcell > .bface {
  grid-column: 1;
  grid-row: 1 / 5;
  align-self: center;
  z-index: 3;
  overflow: hidden;
  border: 1px solid var(--battle-brass);
  border-radius: 2px;
  background: #263444;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .4);
}

.battle-launch .bcell.has-face > .nm,
.battle-launch .bcell.has-face > .tc,
.battle-launch .bcell.has-face > .hpbar,
.battle-launch .bcell.has-face > .hp {
  grid-column: 2;
}

.battle-launch .bcell > .nm { grid-row: 1; }
.battle-launch .bcell > .tc { grid-row: 2; }
.battle-launch .bcell > .hpbar { grid-row: 3; }
.battle-launch .bcell > .hp { grid-row: 4; }

.battle-launch .bcell .nm {
  align-items: center;
  color: var(--battle-ivory);
  font-size: 14px;
  line-height: 1.2;
  text-shadow: 0 1px 2px #000;
}

.battle-launch .bcell .tc {
  color: rgba(231, 224, 207, .68);
  font-size: 14px;
}

.battle-launch .bcell .hp {
  color: rgba(232, 228, 215, .76);
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.battle-launch .bcell .hpbar {
  align-self: end;
  height: 4px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #070c12;
  box-shadow: inset 0 0 0 1px rgba(3, 7, 11, .8);
}

.battle-launch .bcell .hpbar > i { border-radius: 0; }

.battle-launch .bcell.side-mine {
  box-shadow: inset 3px 0 0 #719a91, inset 0 0 0 1px rgba(5, 10, 16, .75);
}

.battle-launch .bcell.side-foe {
  box-shadow: inset 3px 0 0 #9f6b61, inset 0 0 0 1px rgba(5, 10, 16, .75);
}

.battle-launch .bcell.empty {
  min-height: 10px;
  padding: 0;
  border: 1px dashed rgba(189, 161, 106, .25);
  border-radius: 0;
  background: rgba(8, 15, 23, .24);
  opacity: .56;
}

.battle-launch.scene-v2 .bcell.is-actor,
.battle-launch.scene-v2 .bcell.is-target,
.battle-launch.scene-v2 .bcell.is-heal {
  border-color: transparent;
  box-shadow: none;
}

/* 技名を先に読み、効果、被弾の順に見える。カード自体は動かさない。 */
.battle-launch.scene-v2 .battle-mid {
  position: relative;
  z-index: 13;
  min-height: 32px;
  height: 32px;
  margin: 0;
  gap: 8px;
}

.battle-launch.scene-v2 .battle-mid hr {
  border-top-color: var(--battle-brass-soft);
}

.battle-launch.scene-v2 .scene-caption {
  min-width: min(270px, 72%);
  max-width: 78%;
  padding: 5px 18px 4px;
  overflow: hidden;
  border: 0;
  border-top: 1px solid var(--battle-brass);
  border-bottom: 1px solid var(--battle-brass);
  border-radius: 0;
  background: linear-gradient(90deg, transparent, rgba(14, 25, 38, .96) 14% 86%, transparent);
  color: #f0d8a4;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.35;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 2px 5px #000;
  white-space: nowrap;
  animation: battle-launch-title var(--fx-turn) ease-out both;
}

.battle-launch.scene-v2 .scene-caption.is-foe { color: #efc3ad; }

@keyframes battle-launch-title {
  0% { opacity: 0; transform: translateY(3px); }
  12%, 78% { opacity: 1; transform: translateY(0); }
  100% { opacity: .72; }
}

.battle-launch.scene-v2 .bcell.fx2-act > .bface {
  animation: battle-launch-cast-face calc(var(--fx-turn) * .5) ease-out both;
}

.battle-launch.scene-v2 .bcell.fx2-act-brace > .bface {
  animation-name: battle-launch-brace-face;
}

.battle-launch.scene-v2 .bcell.is-target > .bface {
  animation: battle-launch-hit-face calc(var(--fx-turn) * .42) ease-out calc(var(--fx-turn) * .31) both;
}

@keyframes battle-launch-cast-face {
  0%, 100% { translate: 0 0; filter: brightness(1); }
  28%, 52% { translate: 0 calc(var(--fx-dir, -1) * 3px); filter: brightness(1.16); }
}

@keyframes battle-launch-brace-face {
  0%, 100% { translate: 0 0; }
  32%, 58% { translate: 0 2px; }
}

@keyframes battle-launch-hit-face {
  0%, 100% { translate: 0 0; filter: brightness(1); }
  18% { translate: 3px 0; filter: brightness(1.65); }
  42% { translate: -3px 0; filter: brightness(1.2); }
  67% { translate: 1px 0; }
}

.battle-launch.scene-v2 .bcell > .pop {
  top: 3px;
  right: 6px;
  z-index: 18;
  color: var(--battle-hit);
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  text-shadow: -2px -2px 0 #111720, 2px -2px 0 #111720, -2px 2px 0 #111720, 2px 2px 0 #111720, 0 0 12px rgba(244, 207, 130, .45);
  animation: battle-launch-number calc(var(--fx-turn) * .58) ease-out calc(var(--fx-turn) * .3) both;
}

.battle-launch.scene-v2 .bcell.has-face > .pop {
  left: 7px;
  right: auto;
}

.battle-launch.scene-v2 .bcell.has-face > .pop.pop-secondary {
  top: 30px;
}

.battle-launch.scene-v2 .bcell > .pop.heal {
  color: var(--battle-heal);
  text-shadow: -2px -2px 0 #0b1815, 2px -2px 0 #0b1815, -2px 2px 0 #0b1815, 2px 2px 0 #0b1815, 0 0 12px rgba(120, 218, 174, .42);
}

@keyframes battle-launch-number {
  0% { opacity: 0; transform: translateY(7px) scale(.72); }
  26%, 72% { opacity: 1; transform: translateY(-4px) scale(1.08); }
  100% { opacity: 0; transform: translateY(-12px) scale(.96); }
}

.battle-launch .scene-fx-overlay {
  z-index: 9;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .82));
}

.battle-launch .scene-basic-slash-back {
  stroke: #8f612f;
  stroke-width: 8;
  opacity: .72;
}

.battle-launch .scene-basic-slash-glint {
  stroke: #fff4d6;
  stroke-width: 2.5;
}

.battle-launch .scene-impact-core {
  fill: #fff0c4;
  stroke: #8a4f2d;
}

.battle-launch .scene-impact-rays { stroke: #ffe8b0; }

.battle-launch .scene-order-mark {
  fill: none;
  stroke: #f0d8a4;
  stroke-width: 4;
  stroke-linecap: square;
  stroke-linejoin: bevel;
  transform-box: fill-box;
  transform-origin: center;
  animation: battle-launch-order-mark var(--scene-dur, 480ms) ease-out both;
}

.battle-launch .scene-order-aid { stroke: #9de0bb; }
.battle-launch .scene-order-breakthrough { stroke: #f0c374; }

@keyframes battle-launch-order-mark {
  0%, 12% { opacity: 0; transform: translateY(7px) scale(.66); }
  36%, 72% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-4px) scale(.92); }
}

.battle-launch .scene-flame-outer { fill: #c74f2c; stroke: #120e0d; }
.battle-launch .scene-flame-inner { fill: #f5bd54; stroke: #7e3524; }
.battle-launch .scene-link-cover,
.battle-launch .scene-link-intercept { stroke: #c7e0df; }
.battle-launch .scene-link-movement { stroke: #e2d6b9; }

.battle-launch .battle-ticker {
  min-height: 31px;
  border: 1px solid var(--battle-brass-soft);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--battle-navy-deep), #172435, var(--battle-navy-deep));
  color: #d9d3c5;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025);
}

.battle-launch .battle-ticker .act { color: #e0c58d; }
.battle-launch .battle-ticker.is-foe .who { color: #efb6a8; }

.battle-launch .battle-log {
  border: 1px solid var(--battle-brass-soft);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(10, 17, 26, .96), rgba(17, 27, 39, .96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
}

.battle-launch .battle-controls {
  min-height: 44px;
  gap: 6px;
}

.battle-launch .battle-controls button {
  min-height: 42px;
  border: 1px solid var(--battle-brass-soft);
  border-radius: 2px;
  background: linear-gradient(#243347, #121d2a);
  color: #eee4cf;
  box-shadow: inset 0 1px rgba(255, 255, 255, .05);
  transform: none;
}

.battle-launch .battle-controls button:active { background: #101a26; }
.battle-launch .battle-controls button:disabled { opacity: .46; }
.battle-launch .battle-controls .prog { color: #c9b98f; }

.battle-launch .fx2-sweep-back { color: #8f612f; }
.battle-launch .fx2-sweep-glint { color: #fff2d1; }

.battle-launch .fx2-m-order_guard { border-radius: 6px 6px 2px 2px; border-bottom-width: 4px; }
.battle-launch .fx2-m-order_focus { border-radius: 50%; }
.battle-launch .fx2-m-order_aid::before,
.battle-launch .fx2-m-order_aid::after {
  content: '';
  position: absolute;
  background: currentColor;
}
.battle-launch .fx2-m-order_aid::before { left: 3px; top: -1px; width: 2px; height: 9px; }
.battle-launch .fx2-m-order_aid::after { left: 0; top: 2px; width: 8px; height: 2px; }
.battle-launch .fx2-m-order_breakthrough { transform: rotate(45deg); }
.battle-launch .fx2-m-order_plunder { border-radius: 50% 50% 4px 4px; }
.battle-launch .fx2-m-order_ignite {
  border: 0;
  background: currentColor;
  clip-path: polygon(50% 0, 68% 30%, 87% 53%, 76% 100%, 24% 100%, 12% 62%, 31% 34%);
}

@media (max-width: 520px) {
  .battle-launch .battle-scene { padding: 7px; gap: 5px; }
  .battle-launch .bgrid { gap: 4px; }
  .battle-launch .bcell:not(.empty) { column-gap: 4px; min-height: 66px; padding: 5px 4px 4px; }
  .battle-launch .bcell.has-face { grid-template-columns: 44px minmax(0, 1fr); }
  .battle-launch .bcell .nm { font-size: 14px; gap: 2px; }
  .battle-launch .bcell .nm .svgico { display: none; }
  .battle-launch .bcell .tc { font-size: 14px; }
  .battle-launch.scene-v2 .scene-caption { min-width: 62%; max-width: 76%; padding-inline: 8px; font-size: 14px; }
  .battle-launch .battle-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
  .battle-launch .battle-controls button { min-width: 0; padding-inline: 3px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .battle-launch.scene-v2 .scene-caption,
  .battle-launch .scene-order-mark,
  .battle-launch.scene-v2 .bcell.fx2-act > .bface,
  .battle-launch.scene-v2 .bcell.is-target > .bface,
  .battle-launch.scene-v2 .bcell > .pop {
    animation: none !important;
    translate: none !important;
    transform: none !important;
  }

  .battle-launch.scene-v2 .bcell > .pop { opacity: 1; }
}
/* 合格図の対面構成。実際の複数人・配置・ログを使い、顔と短い演出を主役にする。 */
.battle-launch .battle-scene { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-areas:"caption caption" "mine foe"; gap:24px 36px; padding:22px; min-height:360px; border:0; box-shadow:none; background-image:linear-gradient(#111c29aa,#17232cee),var(--battle-backdrop); align-content:center; }
.battle-launch .battle-my-grid { grid-area:mine; }
.battle-launch .battle-foe-grid { grid-area:foe; }
.battle-launch .battle-side-label { display:none; }
.battle-launch.scene-v2 .battle-mid { grid-area:caption; height:42px; min-height:42px; margin-bottom:8px; }
.battle-launch.scene-v2 .scene-caption { font-size:19px; padding:9px 30px; background:#182431da; min-width:0; }
.battle-launch .bcell:not(.empty),.battle-launch .bcell.has-face { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:130px; padding:8px 4px; background:none; border:1px solid transparent; box-shadow:none; overflow:visible; }
.battle-launch .bcell>.bface { align-self:center; margin:0; border:1px solid #8d8166; box-shadow:none; }
.battle-launch .bcell .nm { display:block; text-align:center; font-size:14px; }
.battle-launch .bcell .nm .svgico { display:none; }
.battle-launch .bcell .tc { font-size:14px; text-align:center; }
.battle-launch .bcell .hpbar { width:80%; max-width:95px; align-self:center; background:#545759; }
.battle-launch .bcell.empty { min-height:35px; border:0; background:none; opacity:.3; }
.battle-launch .battle-controls { justify-content:center; }
.battle-launch .battle-log { background:linear-gradient(145deg,#29313cee,#171f29f5); border:1px solid #ae987064; box-shadow:none; }
@media(max-width:700px) {
 .battle-launch .battle-scene { gap:14px 8px; padding:12px 6px; min-height:340px; }
 .battle-launch .bgrid { gap:3px; }
 .battle-launch .bcell:not(.empty),.battle-launch .bcell.has-face { min-height:112px; padding:4px 0; }
 .battle-launch .bcell>.bface { max-width:100%; }
 .battle-launch .bcell .nm { font-size:14px; overflow-wrap:anywhere; }
 .battle-launch .bcell .tc { font-size:14px; }
 .battle-launch.scene-v2 .scene-caption { font-size:15px; padding:8px 12px; max-width:95%; }
}
/* 顔の踏み込み→着弾→浮き数字を、実際の行動ごとに読める強さで出す。 */
.battle-launch .battle-my-grid { --attack-direction:1; }
.battle-launch .battle-foe-grid { --attack-direction:-1; }
.battle-launch.scene-v2 .bcell.fx2-act>.bface { animation:battle-visible-step var(--fx-turn) ease-out both; }
.battle-launch.scene-v2 .bcell.is-target>.bface { animation:battle-visible-hit var(--fx-turn) ease-out both; }
.battle-launch.scene-v2 .bcell.fx2-act-brace>.bface { animation-name:battle-launch-brace-face; }
@keyframes battle-visible-step {
 0%,100% { translate:0 0; filter:brightness(1); }
 20%,38% { translate:calc(var(--attack-x,1) * 14px) calc(var(--attack-y,0) * 14px); filter:brightness(1.25); }
 65% { translate:calc(var(--attack-x,1) * 4px) calc(var(--attack-y,0) * 4px); }
}
@keyframes battle-visible-hit {
 0%,28%,100% { translate:0 0; filter:brightness(1); }
 38% { translate:calc(var(--attack-x,1) * -9px) calc(var(--attack-y,0) * -9px); filter:brightness(2); }
 52% { translate:calc(var(--attack-x,1) * 5px) calc(var(--attack-y,0) * 5px); filter:brightness(1.5); }
 68% { translate:calc(var(--attack-x,1) * -3px) calc(var(--attack-y,0) * -3px); }
}
.battle-launch .battle-log,.overlay.full-mode .battle-launch .battle-log { height:clamp(180px,22dvh,300px); min-height:180px; flex:1 0 clamp(180px,22dvh,300px); }
.battle-launch .battle-log .line { line-height:1.65; padding:2px 0; }
.battle-launch .bcell:not(.empty),.battle-launch .bcell.has-face { min-height:clamp(92px,calc((100dvh - 600px) / 3),130px); }
.battle-launch .battle-ticker:empty { display:none; }
@media(max-width:700px) {
 .battle-launch .bcell:not(.empty),.battle-launch .bcell.has-face { min-height:92px; }
}
@media(prefers-reduced-motion:reduce) {
 .battle-launch.scene-v2 .bcell.fx2-act>.bface,.battle-launch.scene-v2 .bcell.is-target>.bface { animation:none; }
}

/* row=前後、col=横並び。盤の位置だけでなくマスの前後方向も合わせる。 */
.battle-launch .battle-my-grid { --attack-x:1; --attack-y:0; }
.battle-launch .battle-foe-grid { --attack-x:-1; --attack-y:0; }
.battle-launch .bgrid { grid-template-columns:repeat(3,minmax(0,1fr)); grid-template-rows:repeat(3,auto); }
.battle-launch .battle-my-grid>.bcell { grid-column:calc(3 - var(--battle-row)); grid-row:calc(var(--battle-col) + 1); }
.battle-launch .battle-foe-grid>.bcell { grid-column:calc(var(--battle-row) + 1); grid-row:calc(var(--battle-col) + 1); }
.battle-launch .bcell .nm { white-space:normal; overflow-wrap:anywhere; }
.battle-launch .bcell .tc { white-space:normal; }
.battle-launch .battle-controls button { font-size:16px; }
/* 縦に余裕のあるPCでは、盤にも高さを配り、前後列をゆったり見せる。 */
@media(min-width:701px) and (min-height:800px) {
 .battle-launch .battle-scene { min-height:clamp(460px,58dvh,800px); grid-template-rows:42px minmax(0,1fr); align-content:stretch; }
}
@media(max-width:700px) {
 .battle-launch .battle-scene { grid-template-columns:minmax(0,1fr); grid-template-areas:"foe" "caption" "mine"; gap:8px; padding:10px; min-height:0; }
 .battle-launch .battle-my-grid { --attack-x:0; --attack-y:-1; }
 .battle-launch .battle-foe-grid { --attack-x:0; --attack-y:1; }
 .battle-launch .battle-my-grid>.bcell { grid-column:calc(var(--battle-col) + 1); grid-row:calc(var(--battle-row) + 1); }
 .battle-launch .battle-foe-grid>.bcell { grid-column:calc(var(--battle-col) + 1); grid-row:calc(3 - var(--battle-row)); }
 .battle-launch .bcell:not(.empty),.battle-launch .bcell.has-face { min-height:100px; }
 .battle-launch .bcell.empty { min-height:8px; }
 .battle-launch.scene-v2 .battle-mid { margin:0; }
 .battle-launch .battle-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .battle-launch .battle-controls .prog { grid-column:1/-1; text-align:right; }
}

/* 行動者は顔の明るさで示し、マス全体を金枠で囲まない。 */
.battle-launch.scene-v2 .bcell.is-actor > .bface { filter: brightness(1.15); }
