/* ---------- Showdown 风格战斗场景 ---------- */
.scene-panel { padding: 8px; position: relative; }
.scene {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 72vh;
  overflow: hidden; border-radius: 10px; background: #0b1220; user-select: none;
}
.scene-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.weather-layer { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s; }
.weather-layer img { width: 100%; height: 100%; object-fit: cover; }
.weather-layer.show { opacity: .55; }
.weather-layer.wt-terrain { opacity: .35; }
.scene-mid { position: absolute; inset: 0; }
.scene-fxlayer { position: absolute; inset: 0; pointer-events: none; }

/* 精灵站位：对方右上、我方左下 */
.sprite { position: absolute; width: 22%; aspect-ratio: 1; display: flex; align-items: flex-end; justify-content: center; cursor: zoom-in; }
.sprite img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.sp-foe { left: 60%; top: 8%; }
.sp-you { left: 14%; top: 44%; }
/* 朝向用素材原生方向：正面图天然面向玩家，背面图天然面向对方，均不翻转 */
.sp-card { border-radius: 8px; object-fit: cover !important; }
.sp-shadow { position: absolute; left: 18%; right: 18%; bottom: 2%; height: 9%; background: radial-gradient(ellipse at center, rgba(0,0,0,.4), transparent 70%); border-radius: 50%; }
.sp-dmax img { transform-origin: 50% 100%; animation: dmaxgrow .6s forwards; }
@keyframes dmaxgrow { to { transform: scale(1.55); } }
.sp-tera img { filter: drop-shadow(0 0 14px rgba(103,232,249,.9)); }
.sp-hit { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.sp-enter { animation: enterpop .55s cubic-bezier(.2,1.6,.4,1); }
@keyframes enterpop { from { transform: translateY(26px) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.sp-fainted, .sp-faint { opacity: 0; transform: translateY(18px) rotate(-12deg); transition: all .7s ease-in; pointer-events: none; }
.sprite.lunge { animation: lunge .6s; }
@keyframes lunge { 30% { transform: translate(9%, -7%); } }
.sprite.lunge-dynamax, .sprite.lunge-z, .sprite.lunge-specialZ, .sprite.lunge-tera { animation: lunge .6s; filter: brightness(1.4); }
.sp-noface { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: rgba(30,41,59,.85); border-radius: 10px; color: var(--muted); font-size: 12px; padding: 6px; text-align: center; }

/* 残影精灵：回放期间代表已离场（被击倒换下）的宝可梦 */
.sp-ghost { z-index: 3; }
.sp-ghost b { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); }
/* 入场等待：换人事件播放前隐藏新上场的精灵 */
.sp-waiting { opacity: 0 !important; pointer-events: none; }

/* HP 框 */
.hpbox {
  position: absolute; width: 34%; min-width: 190px; background: rgba(11,18,32,.82);
  border: 1px solid #334155; border-radius: 10px; padding: 7px 10px; font-size: 13px; z-index: 2;
}
.hpbox-foe { left: 2.5%; top: 4%; }
.hpbox-you { right: 2.5%; bottom: 5%; }
.hb-top { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.bicon { font-size: 11px; background: var(--panel2); border-radius: 6px; padding: 0 5px; }
.bicon-dmax { background: #7f1d1d; color: #fecaca; }
.bicon-tera { color: #082f49; font-weight: 800; }
.hb-hp { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.hb-bar { flex: 1; height: 10px; background: #450a0a; border-radius: 5px; overflow: hidden; }
.hb-bar > div { height: 100%; background: linear-gradient(90deg, #4ade80, #22c55e); transition: width .45s ease; border-radius: 5px; }
.hb-num { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hb-hit .hb-bar { animation: hpflash .45s; }
@keyframes hpflash { 30% { filter: brightness(1.8); } }
.hb-sub { display: flex; align-items: center; gap: 5px; margin-top: 5px; min-height: 16px; flex-wrap: wrap; }
.hb-boosts { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.bchip { font-size: 10px; border-radius: 6px; padding: 0 5px; font-weight: 600; white-space: nowrap; }
.bc-up { background: #14532d; color: #bbf7d0; }
.bc-down { background: #7f1d1d; color: #fecaca; }
.bst { font-size: 11px; border-radius: 6px; padding: 0 6px; background: #7c2d12; color: #fed7aa; }
.st-中毒 { background: #4c1d95; color: #ddd6fe; }
.st-灼烧 { background: #7c2d12; color: #fed7aa; }
.st-麻痹 { background: #713f12; color: #fde68a; }
.st-瞌睡 { background: #1e3a8a; color: #bfdbfe; }
.st-冰冻 { background: #164e63; color: #a5f3fc; }
.st-混乱 { background: #701a75; color: #f5d0fe; }
.fpips { display: inline-flex; gap: 2px; margin-left: auto; }
.fpips i { width: 7px; height: 7px; border-radius: 50%; background: #334155; display: inline-block; }
.fpips i.on { background: var(--gold); box-shadow: 0 0 4px var(--gold); }

/* 后备阵容条：未上场灰、上场过彩色、濒死黑 */
.party { position: absolute; display: flex; gap: 6px; z-index: 2; }
.party[data-side="1"] { left: 3%; top: calc(4% + 92px); }
.party[data-side="0"] { right: 3%; bottom: calc(5% + 104px); }
.psprite {
  width: 40px; height: 40px; border-radius: 8px; background: rgba(11,18,32,.7);
  border: 1px solid #334155; display: inline-flex; align-items: center; justify-content: center;
  cursor: zoom-in; overflow: hidden;
}
.psprite img { width: 90%; height: 90%; object-fit: contain; }
.psprite b { color: var(--muted); font-size: 12px; }
.ps-unused, .ps-benched { filter: grayscale(1); opacity: .45; }
.ps-live { filter: none; opacity: 1; }
.ps-dead { filter: brightness(0) opacity(.75); }
.ps-active { outline: 2px solid var(--gold); }
.ps-foegray img { filter: grayscale(1) opacity(.8); }
.ps-side { border-style: dashed; }
.ps-hidden { background: rgba(11,18,32,.9); }
.ps-hidden b { color: #475569; font-size: 15px; }
.ps-empty { border-style: dashed; opacity: .25; }

/* 选队预览（与构筑同视觉：精灵球点选） */
.pv-row { display: flex; flex-wrap: wrap; gap: 14px; padding: 6px 2px; }
.pv-ball { width: 92px; text-align: center; cursor: pointer; user-select: none; }
.pv-ball .pvb-circle {
  width: 80px; height: 80px; margin: 0 auto; border-radius: 50%;
  border: 3px solid #475569; position: relative;
  background: conic-gradient(from 210deg, #7f1d1d 0 40%, #1e293b 40% 46%, #f8fafc 46% 94%, #1e293b 94% 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 12px rgba(0,0,0,.55), 0 3px 8px rgba(0,0,0,.4);
  transition: transform .1s;
}
.pv-ball:hover .pvb-circle { transform: translateY(-2px); border-color: var(--accent); }
.pv-ball.sel .pvb-circle { border-color: var(--gold); box-shadow: 0 0 14px rgba(251,191,36,.6); }
.pv-ball.lead .pvb-circle::after {
  content: '首发'; position: absolute; top: -9px; right: -10px;
  background: var(--gold); color: #082f49; font-size: 10px; font-weight: 800;
  border-radius: 8px; padding: 1px 7px; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.pv-ball .pvb-circle img { width: 62px; height: 62px; object-fit: contain; }
.pv-ball .pvb-circle b { color: var(--muted); }
.pv-ball .pvb-check { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); font-style: normal; color: var(--gold); font-weight: 800; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.pv-ball.foe { cursor: default; }
.pv-ball.foe .pvb-circle { filter: grayscale(1) opacity(.7); }
.pv-ball > span { display: block; font-size: 10px; color: var(--muted); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 掷骰结果盘 */
.dicetray {
  position: absolute; left: 50%; bottom: 102%; transform: translateX(-50%);
  background: rgba(11,18,32,.92); border: 1px solid var(--gold); border-radius: 10px;
  padding: 6px 10px; font-size: 12px; z-index: 8; white-space: nowrap;
  display: flex; flex-direction: column; gap: 3px; pointer-events: none;
  animation: trayin .9s ease-out forwards;
}
.scene > .dicetray { bottom: auto; top: 30%; }
@keyframes trayin { 0% { opacity: 0; transform: translate(-50%, 8px); } 15% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
.dt-row { display: flex; align-items: center; gap: 6px; }
.dt-face { border-radius: 6px; padding: 0 6px; font-weight: 700; }
.dt-status { background: #4c1d95; color: #ddd6fe; }
.dt-normal { background: #1e3a8a; color: #bfdbfe; }
.dt-crit { background: #7c2d12; color: #fed7aa; }
.dt-total { color: var(--muted); }
.dt-total b { color: #fbbf24; font-size: 14px; }
.dt-blocked { color: #93c5fd; font-weight: 700; }
.lb-noface { width: min(40vw, 300px); display: flex; align-items: center; justify-content: center; color: var(--muted); min-height: 200px; }

/* 漂浮文字 */
.floattext {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  font-weight: 800; font-size: 22px; pointer-events: none; z-index: 6;
  text-shadow: 0 2px 4px rgba(0,0,0,.7); animation: floatup 1.05s ease-out forwards; white-space: nowrap;
}
.ft-dmg { color: #fbbf24; }
.ft-heal { color: #4ade80; font-size: 19px; }
.ft-ko { color: #f87171; font-size: 24px; }
.ft-status { color: #c084fc; font-size: 16px; }
.ft-status-clear { color: #93c5fd; font-size: 14px; }
.ft-fatigue { color: var(--gold); font-size: 13px; }
.ft-dmax { color: #f87171; font-size: 20px; }
.ft-tera { color: #67e8f9; font-size: 18px; }
.ft-system, .ft-weather { color: #e2e8f0; font-size: 16px; }
.scene > .floattext { top: 42%; }
@keyframes floatup { from { opacity: 0; transform: translate(-50%, 12px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -34px); } }

/* 飞行道具 / 精灵球 / 回合横幅 */
.projectile { position: absolute; width: 52px; height: 52px; object-fit: contain; z-index: 5; pointer-events: none; filter: drop-shadow(0 0 8px rgba(255,255,255,.5)); }
.pokeball-throw { position: absolute; width: 26px; height: 26px; z-index: 6; pointer-events: none; }
.turnbanner {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  background: rgba(11,18,32,.88); border: 1px solid var(--gold); color: var(--gold);
  font-size: 20px; font-weight: 800; padding: 8px 26px; border-radius: 999px; z-index: 7;
  animation: bannerfade 1.5s ease-out forwards; pointer-events: none; white-space: nowrap;
}
@keyframes bannerfade { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.7); } 15% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 70% { opacity: 1; } 100% { opacity: 0; } }
.fx-skip { position: absolute; }

/* 招式卡行动区 */
.moves { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.movecard {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  background: var(--panel2); color: var(--text); border: 1px solid #475569;
  border-radius: 10px; padding: 8px 10px; cursor: pointer; line-height: 1.45; font-size: 13px;
}
.movecard:hover { border-color: var(--accent); }
.movecard:disabled { opacity: .4; cursor: not-allowed; }
.mc-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mc-mode { font-size: 11px; border-radius: 6px; padding: 0 6px; font-weight: 700; }
.mc-z, .mc-specialZ { background: #a16207; color: #fef08a; }
.mc-second { background: #065f46; color: #a7f3d0; }
.mc-dynamax { background: #7f1d1d; color: #fecaca; }
.mc-tera { background: #155e75; color: #a5f3fc; }
.mc-sub { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tchip { font-style: normal; font-size: 11px; font-weight: 700; color: #082f49; border-radius: 6px; padding: 0 6px; }
.mc-eff { font-size: 11px; color: var(--muted); }
.mc-switch { border-style: dashed; }
.mc-wait { border-style: dotted; }

.logpanel summary { cursor: pointer; color: var(--gold); font-weight: 600; }
.audiocontrols { margin-top: -4px; margin-bottom: 14px; }
.battleticker {
  margin-top: 8px; min-height: 20px; font-size: 12px; color: var(--text);
  display: flex; flex-direction: column; gap: 2px;
}
.battleticker div {
  background: rgba(11,18,32,.75); border-left: 3px solid var(--accent);
  border-radius: 4px; padding: 3px 8px; animation: tickin .3s ease-out;
}
@keyframes tickin { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; } }
.switcharea { margin-bottom: 10px; }
.switcharea .movecard { border-color: #6b7280; }

@media (max-width: 720px) {
  .scene { aspect-ratio: 4 / 3; }
  .hpbox { min-width: 150px; font-size: 12px; width: 42%; }
  .sprite { width: 30%; }
  .sp-foe { left: 55%; }
  .party[data-side="1"] { top: calc(4% + 96px); }
  .floattext { font-size: 17px; }
}
