/* V1.138 — semantic phase motion: advance, retreat and lateral shift stay local. */
.battle-command-state-stage-forward {
  animation: battle-command-stage-forward 420ms cubic-bezier(0.16, 0.82, 0.24, 1) both;
}

.battle-command-state-stage-retreat {
  animation: battle-command-stage-retreat 360ms cubic-bezier(0.24, 0.7, 0.3, 1) both;
}

.battle-command-state-stage-shift {
  animation: battle-command-stage-shift 300ms ease-out both;
}

.battle-command-state[data-stage-direction]::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(98deg, transparent 12%, color-mix(in srgb, var(--battle-state-color) 12%, transparent) 46%, transparent 76%);
  transform: translateX(-105%);
  animation: battle-command-stage-wash 560ms ease-out both;
  pointer-events: none;
}

.battle-command-state[data-stage-direction="retreat"]::before {
  transform: translateX(105%);
  animation-name: battle-command-stage-wash-retreat;
}

.battle-command-state[data-stage-direction="forward"] .battle-command-state-progress > i {
  animation: battle-command-stage-pip-forward 380ms ease-out both;
}

.battle-command-state[data-stage-direction="retreat"] .battle-command-state-progress > i {
  animation: battle-command-stage-pip-retreat 300ms ease-out both;
}

.battle-command-state-progress > i:nth-child(1) { animation-delay: 0ms; }
.battle-command-state-progress > i:nth-child(2) { animation-delay: 30ms; }
.battle-command-state-progress > i:nth-child(3) { animation-delay: 60ms; }
.battle-command-state-progress > i:nth-child(4) { animation-delay: 90ms; }
.battle-command-state-progress > i:nth-child(5) { animation-delay: 120ms; }
.battle-command-state-progress > i:nth-child(6) { animation-delay: 150ms; }

.battle-command-state[data-stage-direction="retreat"] .battle-command-state-progress > i:nth-child(1) { animation-delay: 150ms; }
.battle-command-state[data-stage-direction="retreat"] .battle-command-state-progress > i:nth-child(2) { animation-delay: 120ms; }
.battle-command-state[data-stage-direction="retreat"] .battle-command-state-progress > i:nth-child(3) { animation-delay: 90ms; }
.battle-command-state[data-stage-direction="retreat"] .battle-command-state-progress > i:nth-child(4) { animation-delay: 60ms; }
.battle-command-state[data-stage-direction="retreat"] .battle-command-state-progress > i:nth-child(5) { animation-delay: 30ms; }
.battle-command-state[data-stage-direction="retreat"] .battle-command-state-progress > i:nth-child(6) { animation-delay: 0ms; }

.battle-command-state:is([data-phase="locked"], [data-phase="complete"]) .battle-command-state-emblem::before {
  width: 11px;
  height: 6px;
  border-width: 0 0 2px 2px;
  border-radius: 0;
  transform: rotate(-90deg);
}

.battle-command-state:is([data-phase="targeting"], [data-phase="required"]) .battle-command-state-emblem::before {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  transform: rotate(45deg);
}

.battle-command-state[data-phase="settling"] .battle-command-state-emblem::before {
  width: 11px;
  height: 11px;
  border-color: var(--battle-state-color) transparent var(--battle-state-color) transparent;
  border-radius: 50%;
  animation: battle-command-settlement-orbit 880ms linear infinite;
}

@keyframes battle-command-stage-forward {
  0% { opacity: 0.72; transform: translateX(-4px); filter: brightness(0.9); }
  58% { opacity: 1; transform: translateX(1px); filter: brightness(1.08); }
  100% { transform: none; filter: none; }
}

@keyframes battle-command-stage-retreat {
  0% { opacity: 0.76; transform: translateX(4px); filter: saturate(0.72); }
  100% { opacity: 1; transform: none; filter: none; }
}

@keyframes battle-command-stage-shift {
  0% { opacity: 0.78; filter: brightness(0.88); }
  100% { opacity: 1; filter: none; }
}

@keyframes battle-command-stage-wash {
  0% { opacity: 0; transform: translateX(-105%); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translateX(105%); }
}

@keyframes battle-command-stage-wash-retreat {
  0% { opacity: 0; transform: translateX(105%); }
  24% { opacity: 0.76; }
  100% { opacity: 0; transform: translateX(-105%); }
}

@keyframes battle-command-stage-pip-forward {
  0% { opacity: 0.34; transform: scaleX(0.7); filter: brightness(0.8); }
  70% { opacity: 1; transform: scaleX(1.04); filter: brightness(1.25); }
  100% { transform: none; filter: none; }
}

@keyframes battle-command-stage-pip-retreat {
  0% { opacity: 1; filter: brightness(1.1); }
  100% { opacity: 0.72; filter: none; }
}

@keyframes battle-command-settlement-orbit {
  to { transform: rotate(1turn); }
}

body[data-vfx-quality="low"] .battle-command-state[data-stage-direction]::before {
  display: none;
}

body[data-vfx-quality="low"] .battle-command-state-stage-forward,
body[data-vfx-quality="low"] .battle-command-state-stage-retreat,
body[data-vfx-quality="low"] .battle-command-state-stage-shift,
body[data-vfx-quality="low"] .battle-command-state-progress > i {
  animation-duration: 1ms !important;
  animation-delay: 0ms !important;
}

@media (prefers-reduced-motion: reduce) {
  .battle-command-state-stage-forward,
  .battle-command-state-stage-retreat,
  .battle-command-state-stage-shift,
  .battle-command-state[data-stage-direction]::before,
  .battle-command-state-progress > i,
  .battle-command-state-emblem::before {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .battle-command-state[data-stage-direction]::before {
    display: none;
  }

  .battle-command-state:is([data-phase="locked"], [data-phase="complete"]) .battle-command-state-emblem::before {
    border-color: Highlight;
  }
}
