/* 盛宴 · 米歇尔1 · 14分身练习 */
@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Noto+Serif+SC:wght@400;600;700&display=swap");

:root {
  --ink: #0d0b08;
  --gold: #c9a227;
  --red: #d44545;
  --red-glow: rgba(220, 60, 60, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --player-size: 64px;
  --clone-size: 72px;
  --boss-size: 55px;
  /* 红圈固定直径（不随屏幕缩放） */
  --aoe-size: 540px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--ink);
  color: #f2ead8;
  font-family: "Noto Serif SC", "Songti SC", serif;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.practice {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 2rem;
}

.practice__bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(160, 50, 55, 0.18), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(201, 162, 39, 0.08), transparent 50%),
    linear-gradient(165deg, #1a1210 0%, #0d0b08 60%, #16100c 100%);
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 3vw, 1.6rem) clamp(1.2rem, 4vw, 2.5rem);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  color: rgba(242, 234, 216, 0.78);
  border-bottom: 1px solid transparent;
  transition: color 0.3s, border-color 0.3s;
}

.back::before {
  content: "←";
  font-family: "Cinzel", serif;
}

.back:hover {
  color: #f7efd6;
  border-color: var(--gold);
}

.topbar__mark {
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: 0.82rem;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: rgba(201, 162, 39, 0.85);
}

.practice__main {
  position: relative;
  z-index: 2;
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.practice__head {
  text-align: center;
}

.practice__title {
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
}

.practice__tip {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  line-height: 1.75;
  color: rgba(242, 234, 216, 0.7);
}

.arena {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(62vh, 620px);
  margin-inline: auto;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(60, 28, 30, 0.4), transparent 62%),
    linear-gradient(180deg, rgba(24, 16, 14, 0.96), rgba(10, 8, 8, 0.98));
  border: 1px solid rgba(201, 162, 39, 0.28);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  outline: none;
  touch-action: none;
}

.arena:focus-visible {
  border-color: rgba(220, 100, 100, 0.7);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(180, 60, 60, 0.25);
}

.arena__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 78%;
  width: min(94%, calc(78% * 1.95 * 16 / 9));
  max-width: 94%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(201, 162, 39, 0.18);
  pointer-events: none;
}

.clones,
.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* 分身在路径层之上，避免被充能列盖住 */
.fx-layer {
  z-index: 1;
}

.clones {
  z-index: 4;
}

.boss {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--boss-size);
  height: var(--boss-size);
  transform: translate(-50%, -50%);
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.boss.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.boss__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.55));
}

.clone {
  position: absolute;
  width: var(--clone-size);
  height: var(--clone-size);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  z-index: 3;
  transition:
    left 0.85s var(--ease),
    top 0.85s var(--ease),
    opacity 0.35s var(--ease),
    filter 0.35s;
}

.clone.is-cleared {
  opacity: 0;
  filter: brightness(2);
  pointer-events: none;
}

.clone.is-armed .clone__img {
  filter: drop-shadow(0 0 12px rgba(220, 60, 60, 0.85));
}

.clone.is-gold .clone__img {
  filter:
    drop-shadow(0 0 10px rgba(255, 210, 80, 0.95))
    drop-shadow(0 0 22px rgba(201, 162, 39, 0.75))
    brightness(1.15);
}

.clone.is-purple .clone__img {
  filter:
    hue-rotate(250deg) saturate(1.55) brightness(1.12)
    drop-shadow(0 0 10px rgba(180, 120, 255, 0.95))
    drop-shadow(0 0 22px rgba(120, 70, 200, 0.75));
}

.clone.is-purple .clone__mark {
  color: rgba(210, 180, 255, 0.95);
  text-shadow: 0 0 8px rgba(140, 80, 255, 0.8);
}

.clone.is-gold.is-armed .clone__img {
  filter:
    drop-shadow(0 0 10px rgba(255, 210, 80, 0.95))
    drop-shadow(0 0 18px rgba(220, 60, 60, 0.75))
    brightness(1.15);
}

.clone.is-cast-ready {
  animation: gold-pulse 0.9s ease-in-out infinite;
}

.clone__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.clone__mark {
  position: absolute;
  bottom: -0.15rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: rgba(242, 234, 216, 0.55);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.clone__cast {
  position: absolute;
  left: 50%;
  top: -0.85rem;
  transform: translateX(-50%);
  width: 4.2rem;
  height: 0.38rem;
  border: 1px solid rgba(201, 162, 39, 0.65);
  background: rgba(12, 8, 8, 0.75);
  overflow: hidden;
  opacity: 0;
}

.clone__cast.is-on {
  opacity: 1;
}

.clone__cast > i {
  display: block;
  height: 100%;
  width: calc(var(--cast, 0) * 100%);
  background: linear-gradient(90deg, #c9a227, #f0d878);
}

.clone__xhint {
  position: absolute;
  top: -0.15rem;
  right: -1.15rem;
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  background: #f4f4f4;
  color: #1a1610;
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0;
  text-indent: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
}

.clone__xhint.is-on {
  opacity: 1;
}

@keyframes gold-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.25);
  }
}

.aoe {
  position: absolute;
  width: var(--aoe-size);
  height: var(--aoe-size);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 90, 90, 0.9);
  background: rgba(80, 16, 16, 0.22);
  box-shadow:
    0 0 0 1px rgba(120, 20, 20, 0.4),
    0 0 28px var(--red-glow);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.aoe__charge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 120, 100, 0.55) 0%,
    rgba(220, 50, 50, 0.7) 55%,
    rgba(180, 30, 30, 0.45) 100%
  );
  transform: scale(var(--charge, 0));
  transform-origin: center;
  opacity: calc(0.35 + var(--charge, 0) * 0.65);
  will-change: transform, opacity;
}

.aoe.is-charge {
  opacity: 1;
}

.aoe.is-boom {
  opacity: 1;
  animation: aoe-boom 0.45s var(--ease) forwards;
  background: radial-gradient(
    circle at center,
    rgba(255, 200, 180, 0.55) 0%,
    rgba(220, 40, 40, 0.55) 40%,
    rgba(120, 10, 10, 0.2) 100%
  );
  border-color: rgba(255, 220, 180, 0.9);
}

.aoe.is-boom .aoe__charge {
  opacity: 0;
}

.right-zone,
.side-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  opacity: 0;
  pointer-events: none;
  background: rgba(80, 16, 16, 0.18);
  overflow: hidden;
  z-index: 1;
}

.right-zone {
  right: 0;
  left: 50%;
  border-left: 1px solid rgba(255, 90, 90, 0.55);
}

.side-zone.is-left {
  left: 0;
  width: 75%;
  border-right: 1px solid rgba(255, 90, 90, 0.55);
}

.side-zone.is-right {
  right: 0;
  width: 75%;
  border-left: 1px solid rgba(255, 90, 90, 0.55);
}

.right-zone.is-on,
.side-zone.is-on {
  opacity: 1;
}

.right-zone__fill,
.side-zone__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 100, 90, 0.55),
    rgba(180, 30, 30, 0.62)
  );
  transform: scaleX(var(--charge, 0));
  opacity: calc(0.4 + var(--charge, 0) * 0.55);
}

.right-zone__fill {
  transform-origin: left center;
}

.side-zone.is-left .side-zone__fill {
  transform-origin: left center;
}

.side-zone.is-right .side-zone__fill {
  transform-origin: right center;
}

.right-zone.is-boom,
.side-zone.is-boom {
  animation: right-boom 0.45s var(--ease) forwards;
  background: rgba(220, 50, 50, 0.45);
}

.right-zone.is-boom .right-zone__fill,
.side-zone.is-boom .side-zone__fill {
  opacity: 0;
}

@keyframes right-boom {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.follow-aoe {
  position: absolute;
  width: var(--aoe-size);
  height: var(--aoe-size);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 90, 90, 0.9);
  background: rgba(80, 16, 16, 0.22);
  box-shadow:
    0 0 0 1px rgba(120, 20, 20, 0.4),
    0 0 28px var(--red-glow);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.follow-aoe.is-on {
  opacity: 1;
}

.follow-aoe.is-locked {
  border-color: rgba(255, 160, 80, 0.95);
  box-shadow:
    0 0 0 1px rgba(120, 20, 20, 0.4),
    0 0 28px rgba(255, 140, 60, 0.45);
}

.follow-aoe__charge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 120, 100, 0.55) 0%,
    rgba(220, 50, 50, 0.7) 55%,
    rgba(180, 30, 30, 0.45) 100%
  );
  transform: scale(var(--charge, 0));
  transform-origin: center;
  opacity: calc(0.35 + var(--charge, 0) * 0.65);
}

.follow-aoe.is-boom {
  animation: aoe-boom 0.45s var(--ease) forwards;
  background: radial-gradient(
    circle at center,
    rgba(255, 200, 180, 0.55) 0%,
    rgba(220, 40, 40, 0.55) 40%,
    rgba(120, 10, 10, 0.2) 100%
  );
}

.follow-aoe.is-boom .follow-aoe__charge {
  opacity: 0;
}

.slash-path {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  border-left: 1px solid rgba(255, 90, 90, 0.4);
  border-right: 1px solid rgba(255, 90, 90, 0.4);
  background: rgba(80, 16, 16, 0.18);
  box-shadow: inset 0 0 24px rgba(220, 60, 60, 0.12);
  overflow: hidden;
  pointer-events: none;
  opacity: 0.92;
  z-index: 2;
  transform: none;
  transform-origin: center center;
}

.slash-path__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(160, 20, 20, 0.35) 0%,
    rgba(220, 50, 50, 0.78) 50%,
    rgba(160, 20, 20, 0.35) 100%
  );
  /* 初始即满高，宽度从中心由窄变宽 */
  transform: scaleX(var(--charge, 0));
  transform-origin: center center;
  opacity: calc(0.45 + var(--charge, 0) * 0.55);
  will-change: transform, opacity;
}

.slash-path.is-purple {
  border-left-color: rgba(170, 110, 255, 0.5);
  border-right-color: rgba(170, 110, 255, 0.5);
  background: rgba(50, 24, 80, 0.2);
}

.slash-path.is-purple .slash-path__fill {
  background: linear-gradient(
    90deg,
    rgba(70, 30, 120, 0.35) 0%,
    rgba(150, 90, 230, 0.8) 50%,
    rgba(70, 30, 120, 0.35) 100%
  );
}

.slash-path.is-gold {
  border-left-color: rgba(240, 190, 80, 0.55);
  border-right-color: rgba(240, 190, 80, 0.55);
}

.slash-path.is-gold .slash-path__fill {
  background: linear-gradient(
    90deg,
    rgba(140, 70, 10, 0.35) 0%,
    rgba(240, 180, 60, 0.82) 50%,
    rgba(140, 70, 10, 0.35) 100%
  );
}

/* 紫色充能期间：金色列为安全区 */
.slash-path.is-safe {
  background: rgba(18, 14, 16, 0.92);
  border-left: 1px dashed rgba(240, 190, 80, 0.75);
  border-right: 1px dashed rgba(240, 190, 80, 0.75);
  box-shadow: inset 0 0 28px rgba(201, 162, 39, 0.12);
  opacity: 1;
  z-index: 3;
}

.slash-path.is-safe .slash-path__fill {
  opacity: 0;
  transform: scaleX(0);
}

.slash-path.is-waiting:not(.is-safe) {
  opacity: 0.35;
  border-style: dashed;
}

.slash-path.is-boom {
  animation: path-boom 0.45s var(--ease) forwards;
  background: rgba(220, 50, 50, 0.4);
}

.slash-path.is-boom .slash-path__fill {
  opacity: 0;
}

@keyframes path-boom {
  0% {
    transform: scaleX(1);
    opacity: 1;
  }
  100% {
    transform: scaleX(1.06);
    opacity: 0;
  }
}

@keyframes aoe-boom {
  0% {
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 0;
  }
}

.player {
  position: absolute;
  width: var(--player-size);
  height: var(--player-size);
  object-fit: contain;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
  z-index: 5;
  pointer-events: none;
  transition: filter 0.2s;
}

.player.is-left {
  transform: translate(-50%, -50%) scaleX(-1);
}

.player.is-x-swing-right {
  animation: x-swing-right 0.32s var(--ease);
}

.player.is-x-swing-left {
  animation: x-swing-left 0.32s var(--ease);
}

.player.is-hit {
  filter: drop-shadow(0 0 16px rgba(255, 80, 80, 0.9)) brightness(1.3);
}

/* 面朝右：绕图片中心顺时针 45° 再回正 */
@keyframes x-swing-right {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  45% {
    transform: translate(-50%, -50%) rotate(45deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
}

/* 面朝左：保持镜像；本地顺时针经水平翻转后，屏幕上为逆时针 */
@keyframes x-swing-left {
  0% {
    transform: translate(-50%, -50%) scaleX(-1) rotate(0deg);
  }
  45% {
    transform: translate(-50%, -50%) scaleX(-1) rotate(45deg);
  }
  100% {
    transform: translate(-50%, -50%) scaleX(-1) rotate(0deg);
  }
}

.hud {
  position: absolute;
  left: 50%;
  bottom: 0.85rem;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
}

.hud__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.2rem;
  padding: 0.45rem 1rem;
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: #f7efd6;
  background: rgba(12, 8, 8, 0.72);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 999px;
  box-shadow: 0 0 20px rgba(160, 50, 55, 0.2);
}

.status {
  text-align: center;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: rgba(242, 234, 216, 0.72);
  min-height: 1.5em;
}

.status.is-hint {
  color: rgba(240, 216, 140, 0.9);
}

.status.is-warn {
  color: rgba(255, 140, 140, 0.95);
}

.status.is-win {
  color: rgba(160, 220, 120, 0.95);
}

.controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.btn {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: rgba(26, 18, 16, 0.85);
  color: #f2ead8;
  font-family: inherit;
  font-size: 0.92rem;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.btn--primary {
  background: linear-gradient(180deg, rgba(96, 36, 40, 0.92), rgba(36, 14, 16, 0.94));
  border-color: rgba(200, 90, 90, 0.55);
}

.btn:hover,
.btn:focus-visible {
  border-color: rgba(240, 140, 140, 0.85);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  outline: none;
}

@media (max-width: 520px) {
  :root {
    --player-size: 52px;
    --clone-size: 56px;
    --boss-size: 44px;
    --aoe-size: 420px;
  }

  .practice__main {
    width: min(100% - 1.2rem, 1100px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aoe.is-boom,
  .clone,
  .btn {
    animation: none !important;
    transition: none !important;
  }
}
