.duel-stage {
  overflow: hidden;
  border: 1px solid #956438;
  border-radius: 6px;
  color: #fbe9c2;
  background: #352016;
  box-shadow: inset 0 0 0 3px #b9905d55;
}
.duel-stage__header {
  display: grid;
  align-items: center;
  gap: clamp(8px,3vw,25px);
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  padding: 13px 17px;
  border-bottom: 1px solid #ba8653;
  background: linear-gradient(105deg,#502826,#342019 52%,#492c34);
}
.duel-stage__identity {
  display: grid;
  gap: 4px;
  min-width: 0;
  line-height: 1.25;
}
.duel-stage__identity:last-child { text-align: right; }
.duel-stage__identity strong {
  font: 780 clamp(.83rem,2vw,1.25rem)/1.25 var(--serif);
  overflow-wrap: anywhere;
}
.duel-stage__identity > span { color: #e3c499; font-size: .78rem; }
.duel-stage__score {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  padding: 5px 12px;
  color: #fde8b8;
  background: #23150f;
  border: 1px solid #a67945;
  border-radius: 4px;
  font: 780 clamp(1.2rem,3vw,1.65rem)/1.15 var(--serif);
  font-variant-numeric: tabular-nums;
}
.duel-stage__field {
  overflow: hidden;
  isolation: isolate;
  position: relative;
  height: clamp(184px,39vw,370px);
  background:
    radial-gradient(ellipse at 49% 6%,#f5d3a761 1%,transparent 46%),
    linear-gradient(180deg,#7a5248 0%,#b78965 52%,#d2a775 67%,#8d6241 100%);
}
.duel-stage__field::after {
  position: absolute;
  z-index: 0;
  content: '';
  inset: 64% 0 0;
  background: radial-gradient(ellipse at 50% 0%,#edc692,#a4784d 54%,#654333 110%);
  border-top: 1px solid #dbc09b82;
}
.duel-stage__arches {
  position: absolute;
  z-index: -1;
  inset: 15% -4% 34%;
  opacity: .68;
  background: radial-gradient(ellipse 36px 57px at 47px 63%,#553835 82%,#d7aa7c 85% 91%,#76513e 94% 99%,transparent) left center/94px 100% repeat-x,
    repeating-linear-gradient(180deg,#9d7358 0 12px,#ad8265 13px 27px);
  border-top: 4px double #e6bd92a8;
}
.duel-stage__arches::before, .duel-stage__arches::after {
  content: '';
  position: absolute;
  inset: -13px auto auto 17%;
  width: 30px;
  height: 82px;
  background: linear-gradient(100deg,#623232,#95463f,#6a302d);
  border-top: 3px solid #d0a774;
  clip-path: polygon(0 0,100% 0,100% 100%,50% 87%,0 100%);
}
.duel-stage__arches::after { left: 79%; }
.duel-fighter {
  position: absolute;
  inset: auto auto 6%;
  z-index: 2;
  display: grid;
  align-items: end;
  justify-items: center;
  height: 83%;
  aspect-ratio: 456 / 672;
}
.duel-fighter--player { left: 13%; }
.duel-fighter--opponent { right: 13%; }
.duel-fighter__sprite, .duel-fighter__fallback {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.duel-fighter__sprite { filter: drop-shadow(1px 2px 2px #170e0c91); opacity: 0; }
.duel-fighter--opponent .duel-fighter__sprite { transform: scaleX(-1); }
.duel-fighter__sprite[data-image-ready] { opacity: 1; }
.duel-fighter__fallback {
  display: grid;
  place-items: center;
  color: #f0ce99;
  opacity: .78;
}
.duel-fighter:has([data-image-ready]) .duel-fighter__fallback { opacity: 0; }
.duel-fighter__fallback .icon {
  width: 55%;
  height: 55%;
  padding: 12%;
  background: #462821;
  border: 1px solid #e5c084;
  border-radius: 50%;
}
.duel-fighter__shade {
  width: 78%;
  height: 8%;
  margin-bottom: -1%;
  border-radius: 50%;
  background: #3d271d9d;
  filter: blur(5px);
}
.duel-stage__impact {
  position: absolute;
  z-index: 4;
  display: grid;
  place-content: center;
  inset: 37% 35% auto;
  height: 38%;
  pointer-events: none;
  opacity: 0;
}
.duel-stage__impact i {
  display: block;
  width: clamp(55px,16vw,128px);
  height: 9px;
  border-radius: 0 95% 55%;
  background: #fff5d4;
  transform: rotate(-36deg);
  box-shadow: 0 1px 7px 3px #ffb64a;
}
.duel-stage__impact i + i {
  margin: -3px 0 0 15px;
  transform: rotate(29deg) scale(.72);
  background: #ffdf9c;
}
.duel-stage[data-attacker="player"] .duel-fighter--player { animation: duel-lunge .255s ease-out both; --direction: 1; z-index: 3; }
.duel-stage[data-attacker="opponent"] .duel-fighter--opponent { animation: duel-lunge .255s ease-out both; --direction: -1; z-index: 3; }
.duel-stage[data-attacker="player"] .duel-fighter--opponent { animation: duel-recoil .27s .07s ease-out both; --direction: 1; }
.duel-stage[data-attacker="opponent"] .duel-fighter--player { animation: duel-recoil .27s .07s ease-out both; --direction: -1; }
.duel-stage[data-attacker="player"] .duel-stage__impact,
.duel-stage[data-attacker="opponent"] .duel-stage__impact { animation: duel-strike .2s .065s ease-out both; }
.duel-stage[data-attacker="opponent"] .duel-stage__impact { scale: -1 1; }

@keyframes duel-lunge {
  0% { transform: translateX(0); }
  18% { transform: translateX(calc(var(--direction) * -10%)) rotate(calc(var(--direction) * -3deg)); }
  43%, 55% { transform: translateX(calc(var(--direction) * 54%)) rotate(calc(var(--direction) * 8deg)); }
  100% { transform: translateX(0); }
}
@keyframes duel-recoil {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(calc(var(--direction) * 16%)) rotate(calc(var(--direction) * 8deg)); filter: brightness(1.32); }
}
@keyframes duel-strike {
  0% { opacity: 0; transform: scale(.35); }
  28% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.34); }
}
.duel-stage__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 62px;
  padding: 9px 15px;
  border-top: 1px solid #c59663;
  background: #492f23;
}
.duel-stage__readout { display: grid; gap: 5px; }
.duel-stage__readout p { font-size: .83rem; }
.duel-stage__beats { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.duel-stage__beats li {
  display: grid;
  width: 23px;
  height: 21px;
  place-items: center;
  font: 750 .72rem/1 var(--sans);
  color: #f8dfb2;
  background: #34241e;
  border: 1px solid #b08b61;
  border-radius: 3px;
}
.duel-stage__beats [data-winner="player"] { color: #faf0d8; background: #774137; }
.duel-stage__beats [data-winner="opponent"] { color: #faf0d8; background: #4a506e; }
.duel-stage[data-beat="1"] [data-beat-step="1"],
.duel-stage[data-beat="2"] [data-beat-step="2"],
.duel-stage[data-beat="3"] [data-beat-step="3"] { border-color: #f4cc83; }
.duel-stage__footer button { flex: none; }
@media (max-width: 620px) {
  .duel-fighter--player { left: 9%; }
  .duel-fighter--opponent { right: 9%; }
  .duel-stage__header, .duel-stage__footer { padding-inline: 9px; }
  .duel-stage__score { gap: 6px; padding-inline: 7px; }
}

.duel-stage__match {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 12px;
  padding: 7px 17px;
  border-bottom: 1px solid #b48657a0;
  color: #f9dfa9;
  background: #3a261c;
  font-size: .81rem;
}
.duel-stage__match span { color: #e3c499; }
@media (max-width: 620px) {
  .duel-stage__match { padding-inline: 9px; }
}
