/* 战斗场 */

.field {
  position: relative;
  isolation: isolate;
  flex: 1 0 auto;
  min-height: 560px;
  /* 三行：敌军 / 战斗日志 / 友军。日志放中间正好填掉原先空着的一大块，
     同时玩家能看到「刚刚发生了什么」，不用全靠猜。 */
  display: grid; grid-template-rows: 1fr auto 1fr;
  gap: 4px; padding: 10px 8px;
  background:
    radial-gradient(90% 42% at 50% 8%, #3a2a1c, transparent),
    radial-gradient(90% 42% at 50% 92%, #2a1d14, transparent),
    linear-gradient(180deg, #1d1611, #12100e 55%, #1a1310);
  overflow: hidden;
}

/* 两行各占一半：敌军贴顶，友军贴底，中间留开给飘字 */
.row { display: flex; gap: 8px; justify-content: center; align-items: flex-start; }
.row--ally { align-items: flex-end; padding-bottom: 6px; }
.row--enemy { grid-area:1 / 1; }
.row--ally { grid-area:3 / 1; }

/* 战斗单位 */
.fighter { width: 19%; position: relative; transition: opacity .18s; }
.fighter__art {
  width: 100%; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden;
  border: 1px solid #6a543a; background: #2a2318;
  box-shadow: 0 3px 10px #0009;
}
.fighter__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fighter.is-dead { opacity: .25; }
.fighter.is-act .fighter__art { border-color: var(--gold); box-shadow: 0 0 0 2px #e0b64a55; }
.fighter.is-hit .fighter__art { animation: shake .28s; }
.fighter.is-low .fighter__art { border-color: var(--red); }

.fighter__bar {
  position: relative; height: 5px; margin-top: 2px; border-radius: 3px;
  background: #3a3026; overflow: hidden;
}
.fighter__bar i { position: absolute; inset: 0 0 0 0; background: linear-gradient(90deg,#4e9c6a,#7cc08d); }
.fighter__bar.is-low i { background: linear-gradient(90deg,#c0392b,#e0705f); }
.fighter__shd { position: absolute; inset: 0 0 0 0; background: #7fb2e055; }
.fighter__nm { font-size: 10px; text-align: center; color: var(--ink2); white-space: nowrap;
               overflow: hidden; text-overflow: ellipsis; }
.fighter__lv { position: absolute; top: 3px; left: 3px; font-size: 9px; padding: 1px 3px;
               border-radius: 4px; background: #000b; }

/* 飘字 */
.float {
  position: absolute; left: 50%; transform: translateX(-50%);
  z-index: 6; padding:2px 5px; border-radius:4px; background:#071723d9;
  top:18%; margin-top:calc(var(--float-lane, 0) * 28px);
  font-weight: 700; font-size: 17px; pointer-events: none;
  animation: rise .8s ease-out forwards; text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}
.float--dmg { color: #ff7a5c; }
.float--crit { color: #ffcc44; font-size: 19px; }
.float--heal { color: #7cc08d; }
.float--shd { color: #8fb8e8; }
.float--buff { color: #b48ce8; font-size: 12px; }
.float--dot { color: #e0873c; font-size: 13px; }
.row .fighter:first-child .float { left:0; transform:none; }
.row .fighter:last-child .float { left:auto; right:0; transform:none; }

@keyframes rise { 0% { opacity: 0; translate:0 5px; } 15%,70% { opacity: 1; }
                  100% { opacity: 0; translate:0 -5px; } }
@keyframes shake { 0%,100% { transform: none } 25% { transform: translateX(-4px) }
                   75% { transform: translateX(4px) } }

/* 回合提示 */
/* 战斗日志：中间那一栏，只留最近几条 */
.comblog {
  grid-area: 2 / 1;
  align-self: center;
  justify-self: center;
  width: min(100%, 680px);
  height: 144px; min-height: 144px; max-height: none;
  overflow-y: auto;
  display: flex; flex-direction: column; justify-content: flex-start;
  gap: 2px; padding: 10px 12px;
  font-size: 13px; line-height: 22px; color: #edf2ec;
  -webkit-mask-image: none;
          mask-image: none;
}
.comblog div { flex:0 0 auto; min-height:22px; white-space:normal; overflow-wrap:anywhere; }
.comblog .l-skill { color: var(--gold); }
.comblog .l-dmg { color: #e08a72; }
.comblog .l-death { color: #e0705c; }
.comblog .l-skill { font-weight: 600; }
.comblog .l-heal { color: #7cc08d; }

.battlebar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg2);
}
.turns { font-size: 13px; color: var(--ink2); }
#btn-skip { min-height: 38px; padding: 6px 14px; font-size: 13px; }
.speeds { display: flex; gap: 4px; }
.speed { min-width: 38px; padding: 6px 8px; font-size: 12px; }
.speed.is-on { border-color: var(--gold); color: var(--gold); background: rgba(201,162,39,.14); }

/* 技能横幅 */
.castbar {
  position: absolute; left: 0; right: 0; top: 32%;
  text-align: center; pointer-events: none; z-index: 5;
}
.castbar span {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  background: #000000aa; border: 1px solid #e0b64a66;
  color: var(--gold); font-size: 13px; animation: fade .9s ease-out forwards;
}
@keyframes fade { 0%,70% { opacity: 1 } 100% { opacity: 0 } }

/* 结算 */
.result {
  position: fixed; inset: 0; z-index: 20;
  background: #000000dd; backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.result__card {
  width: 100%; max-width: 340px; padding: 18px;
  background: linear-gradient(180deg,#2a2118,#191511);
  border: 1px solid var(--line); border-radius: 14px; text-align: center;
}
.result__t { font-size: 24px; margin: 0 0 4px; letter-spacing: 2px; }
.result__t--win { color: var(--gold); }
.result__t--lose { color: #b0503c; }
.result__sub { font-size: 12px; color: var(--ink2); margin: 0 0 14px; }
.result__drops { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.drop {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px; background: #1e1913; font-size: 13px;
}
.drop__n { margin-left: auto; color: var(--gold); font-variant-numeric: tabular-nums; }
.drop--up { color: var(--star); }
.result__ops { display: flex; gap: 8px; }
.result__ops .btn { flex: 1; }

/* ── 无尽词条 ───────────────────────────────────── */
.affixes { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; }
.affixes { flex:0 0 auto; background:#102630ed; }
.affix {
  font-size: 10px; line-height: 1.5; padding: 2px 6px; border-radius: 5px;
  background: rgba(180,70,60,.16); border: 1px solid rgba(190,90,80,.4); color: #e0a49c;
}
