/* ============================================================
   战斗
   左右对峙 + 中轴交锋线 + 下方战斗日志 + 底部动作栏
   ============================================================ */
.battle {
  position: relative;
  width: min(820px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0f0d0e, var(--ink-1) 55%);
  border: 1px solid var(--line-bright);
  border-radius: var(--r-md);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  animation: panel-in 0.3s var(--ease-out) both;
}

/* ---------- 头 ---------- */
.battle__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.battle__title {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.1em;
  color: #e8b8b3;
  text-shadow: 0 0 18px rgba(192, 80, 77, 0.45);
}

.battle__where {
  font-size: 11px;
  color: var(--t-2);
  letter-spacing: 0.08em;
}

.battle__where .sep {
  margin: 0 8px;
  color: var(--t-3);
}

.battle__turn {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--t-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- 对峙区 ---------- */
.battle__stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  gap: 6px;
  padding: 22px 24px 20px;
  align-items: start;
}

.fighter {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.fighter--foe {
  align-items: flex-end;
  text-align: right;
}

.fighter__name {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--t-0);
}

.fighter--me .fighter__name {
  color: var(--qing);
  text-shadow: 0 0 16px rgba(93, 202, 165, 0.28);
}

.fighter--foe .fighter__name {
  color: #dda7a3;
  text-shadow: 0 0 16px rgba(192, 80, 77, 0.3);
}

.fighter--foe .fighter__name em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--zhu);
  margin-right: 8px;
  opacity: 0.85;
}

.fighter__realm {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--t-3);
  margin-top: -5px;
}

.fighter__tags {
  display: flex;
  gap: 6px;
}

.fighter__tags span {
  font-size: 10px;
  color: var(--t-2);
  border: 1px solid var(--line);
  border-radius: 1px;
  padding: 1px 6px;
}

/* ---------- 血条 ---------- */
.fbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.fbar-row__k {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--t-3);
  flex: none;
  width: 24px;
}

.fbar-row__v {
  font-size: 11px;
  font-weight: 400;
  color: var(--t-1);
  font-variant-numeric: tabular-nums;
  flex: none;
  width: 28px;
  text-align: right;
}

.fbar {
  position: relative;
  flex: 1;
  height: 6px;
  background: var(--ink-3);
  border-radius: 1px;
  overflow: hidden;
  min-width: 0;
}

.fbar__fill,
.fbar__ghost {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  border-radius: 1px;
}

/* 残影：先看到白条退下去，再看到真实血量。这是格斗游戏的经典细节 */
.fbar__ghost {
  background: rgba(233, 230, 223, 0.17);
  transition: width 0.5s var(--ease) 0.34s;
}

.fbar__fill {
  transition: width 0.26s var(--ease);
  z-index: 1;
}

.fbar--hp .fbar__fill {
  background: linear-gradient(90deg, #2c6353, #5dcaa5);
}

.fbar--foe .fbar__fill {
  background: linear-gradient(270deg, #6a2b29, #c0504d);
}

.fbar--mp .fbar__fill {
  background: linear-gradient(90deg, #2a4a63, #7fd4ff);
}

/* ---------- 势 ---------- */
.shi {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 14px;
}

.fighter--foe .shi {
  display: none;
}

.shi__k {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--t-3);
}

.shi__d {
  width: 8px;
  height: 8px;
  background: var(--ink-4);
  border-radius: 1px;
  transform: rotate(45deg);
  transition: all 0.3s var(--ease);
}

.shi__d.is-on {
  background: var(--jin);
  box-shadow: 0 0 10px rgba(217, 164, 65, 0.8);
  animation: shi-pop 0.34s var(--ease-out);
}

@keyframes shi-pop {
  0% {
    transform: rotate(45deg) scale(0.5);
  }
  60% {
    transform: rotate(45deg) scale(1.35);
  }
  100% {
    transform: rotate(45deg) scale(1);
  }
}

/* ---------- 中轴交锋线 ---------- */
.clash {
  position: relative;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clash::before {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--line-bright) 25%, var(--line-bright) 75%, transparent);
  opacity: 0.7;
}

/* 中轴底下压一团极淡的血光，让"对峙"有重量 */
.clash::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(192, 80, 77, 0.1), transparent 65%);
  pointer-events: none;
}

.clash__x {
  position: relative;
  width: 26px;
  height: 26px;
  z-index: 1;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.8));
}

.clash__x i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 1.5px;
  background: var(--t-3);
  transition: background 0.16s var(--ease);
}

.clash__x i:nth-child(1) {
  transform: translate(-50%, -50%) rotate(45deg);
}

.clash__x i:nth-child(2) {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.clash.is-hit .clash__x {
  animation: clash-shake 0.34s var(--ease);
}

.clash.is-hit .clash__x i {
  background: var(--zhu);
  box-shadow: 0 0 12px rgba(192, 80, 77, 0.9);
}

.clash.is-miss .clash__x {
  opacity: 0.35;
  transform: scale(0.85);
  transition: all 0.2s var(--ease);
}

.clash.is-heal .clash__x i {
  background: var(--qing);
  box-shadow: 0 0 12px rgba(93, 202, 165, 0.8);
}

@keyframes clash-shake {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  25% {
    transform: translateX(-3px) scale(1.18);
  }
  55% {
    transform: translateX(3px) scale(1.1);
  }
  80% {
    transform: translateX(-1px) scale(1.04);
  }
}

/* ---------- 伤害飘字 ---------- */
.float {
  position: absolute;
  top: 24%;
  font-family: var(--serif);
  font-size: 23px;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 5;
  animation: float-up 0.95s var(--ease-out) forwards;
}

.float--me {
  left: 22%;
}

.float--foe {
  right: 22%;
}

.float.is-dmg {
  color: #e06a66;
  text-shadow: 0 0 2px #000, 0 0 18px rgba(192, 80, 77, 0.75);
}

.float.is-heal {
  color: #7fd8b8;
  text-shadow: 0 0 2px #000, 0 0 18px rgba(93, 202, 165, 0.65);
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.9);
  }
  18% {
    opacity: 1;
    transform: translateY(0) scale(1.06);
  }
  100% {
    opacity: 0;
    transform: translateY(-34px) scale(1);
  }
}

/* ---------- 战斗日志 ---------- */
.battle__log {
  flex: 1;
  min-height: 132px;
  max-height: 190px;
  overflow-y: auto;
  padding: 12px 24px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 7px;
  scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px);
  mask-image: linear-gradient(180deg, transparent 0, #000 14px);
}

.blog__line {
  font-size: 12.5px;
  line-height: 1.7;
  padding-left: 11px;
  border-left: 2px solid var(--line);
  animation: log-in 0.24s var(--ease-out) both;
}

@keyframes log-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.blog__line--sys {
  color: var(--t-2);
  border-left-color: var(--line);
}

.blog__line--me {
  color: var(--t-0);
  border-left-color: var(--qing-dim);
}

.blog__line--foe {
  color: #d8c0be;
  border-left-color: var(--zhu-dim);
}

.blog__line .dmg {
  color: var(--zhu);
  font-variant-numeric: tabular-nums;
}

.blog__line .heal {
  color: var(--qing);
  font-variant-numeric: tabular-nums;
}

.blog__line .miss {
  color: var(--t-3);
  letter-spacing: 0.1em;
}

/* ---------- 动作栏 ---------- */
.battle__acts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line-soft);
}

.act {
  text-align: left;
  padding: 9px 11px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--ink-2);
  transition: all 0.16s var(--ease);
  position: relative;
  overflow: hidden;
}

.act::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--line-bright);
  opacity: 0.7;
}

.act:hover:not(:disabled) {
  border-color: var(--line-bright);
  background: var(--ink-3);
  transform: translateY(-1px);
}

.act:hover:not(:disabled)::before {
  background: var(--qing);
}

.act__name {
  display: block;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--t-0);
  margin-bottom: 3px;
}

.act__sub {
  display: block;
  font-size: 10px;
  color: var(--t-2);
  margin-bottom: 4px;
}

.act__note {
  display: block;
  font-size: 10px;
  color: var(--t-3);
  letter-spacing: 0.04em;
}

.act--risk::before {
  background: var(--jin);
}

.act--risk .act__name {
  color: var(--jin);
}

.act--risk .act__note {
  color: var(--jin-dim);
}

.act--calm::before {
  background: var(--zi);
}

.act--calm .act__name {
  color: var(--zi);
}

/* 灵力/势不够：置灰但不清除，玩家要看得见"再攒一点就能放" */
.act.is-lack {
  opacity: 0.46;
  cursor: not-allowed;
}

.act.is-lack:hover {
  transform: none;
  border-color: var(--line);
  background: var(--ink-2);
}

/* ---------- 结算 ---------- */
.battle__over {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 7, 9, 0.86);
  backdrop-filter: blur(3px);
  animation: log-in 0.3s var(--ease-out) both;
}

.bover {
  text-align: center;
  padding: 30px 40px;
}

.bover__mark {
  font-family: var(--serif);
  font-size: 62px;
  letter-spacing: 0.1em;
  line-height: 1;
  margin-bottom: 20px;
  animation: mark-in 0.6s var(--ease-out) both;
}

.bover.is-win .bover__mark {
  color: var(--jin);
  text-shadow: 0 0 12px rgba(217, 164, 65, 0.55), 0 0 60px rgba(217, 164, 65, 0.35);
}

.bover.is-lose .bover__mark {
  color: var(--zhu);
  text-shadow: 0 0 12px rgba(192, 80, 77, 0.5), 0 0 60px rgba(192, 80, 77, 0.3);
}

@keyframes mark-in {
  from {
    opacity: 0;
    transform: scale(1.6);
    letter-spacing: 0.5em;
  }
  to {
    opacity: 1;
    transform: none;
    letter-spacing: 0.1em;
  }
}

.bover__text {
  font-size: 13.5px;
  line-height: 1.95;
  color: var(--t-1);
  margin-bottom: 20px;
}

.bover__meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 11px;
  color: var(--t-3);
  letter-spacing: 0.06em;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  margin-bottom: 22px;
}

.bover__acts {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .battle__stage {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .clash {
    height: 26px;
  }
  .clash::before {
    top: auto;
    bottom: auto;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-bright), transparent);
  }
  .fighter--foe {
    align-items: flex-start;
    text-align: left;
  }
  .fighter--foe .fbar-row {
    flex-direction: row;
  }
  .fighter--foe .fbar__fill,
  .fighter--foe .fbar__ghost {
    left: 0;
    right: auto;
  }
  .fighter--foe .fbar-row__v {
    text-align: right;
  }
  .battle__acts {
    grid-template-columns: repeat(3, 1fr);
  }
  .float--me {
    left: 20%;
  }
  .float--foe {
    right: 20%;
  }
}
