/* 盛宴 · 乌列尔1 机制练习（玩家移动 + Boss 光圈） */
@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;
  --gold-bright: #f0d878;
  --purple: #9b5fd4;
  --purple-deep: #5a2a8e;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ball-size: 56px;
  --ball-gap: clamp(0.35rem, 1.6vw, 0.85rem);
  --player-size: 72px;
  --monster-size: 86px;
  /* 直径 ≈ 两球宽度 + 间距，刚好罩住一对 */
  --aura-radius: calc(var(--ball-size) + var(--ball-gap) / 2);
}

*,
*::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(120, 70, 160, 0.16), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(201, 162, 39, 0.08), transparent 50%),
    linear-gradient(165deg, #160f18 0%, #0d0b08 60%, #141018 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(960px, 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%;
  display: grid;
  grid-template-rows: 1fr 1fr 1fr;
  min-height: min(68vh, 560px);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(50, 30, 70, 0.35), transparent 65%),
    linear-gradient(180deg, rgba(22, 16, 24, 0.94), rgba(10, 8, 12, 0.97));
  border: 1px solid rgba(201, 162, 39, 0.28);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  outline: none;
  touch-action: none;
}

.arena:focus-visible {
  border-color: rgba(200, 150, 255, 0.7);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(155, 95, 212, 0.25);
}

.zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem;
  min-height: 0;
  pointer-events: none;
}

.zone--top {
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.06), transparent 70%);
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
}

.zone--mid {
  background: linear-gradient(
    180deg,
    rgba(120, 70, 160, 0.04),
    rgba(201, 162, 39, 0.04) 50%,
    rgba(120, 70, 160, 0.04)
  );
  border-bottom: 1px solid rgba(155, 95, 212, 0.12);
}

.zone--bottom {
  background: linear-gradient(0deg, rgba(120, 70, 160, 0.08), transparent 70%);
}

.zone__label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: rgba(242, 234, 216, 0.45);
}

.zone--top .zone__label {
  color: rgba(240, 216, 120, 0.7);
}

.zone--bottom .zone__label {
  color: rgba(180, 130, 220, 0.7);
}

.zone__balls {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(8, var(--ball-size));
  column-gap: var(--ball-gap);
  justify-content: center;
  align-items: center;
  width: 100%;
}

.ball {
  position: relative;
  z-index: 6;
  width: var(--ball-size);
  height: var(--ball-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: calc(var(--ball-size) * 0.42);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  user-select: none;
  animation: ball-in 0.45s var(--ease) both;
  transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}

.ball--gold {
  color: #2a1c05;
  background:
    radial-gradient(circle at 35% 28%, #fff4c8, #e8c04a 42%, #a07818 100%);
  box-shadow:
    0 0 18px rgba(232, 192, 74, 0.55),
    0 0 4px rgba(255, 230, 140, 0.8),
    inset 0 -8px 16px rgba(80, 50, 0, 0.3);
  border: 2px solid rgba(255, 236, 170, 0.65);
}

.ball--purple {
  color: #f4e8ff;
  background:
    radial-gradient(circle at 35% 28%, #d4a8ff, #9b5fd4 42%, #3d1868 100%);
  box-shadow:
    0 0 18px rgba(155, 95, 212, 0.55),
    0 0 4px rgba(200, 150, 255, 0.7),
    inset 0 -8px 16px rgba(20, 0, 40, 0.35);
  border: 2px solid rgba(210, 170, 255, 0.55);
}

/* 中间紫球：默认隐藏，进入 Boss 金圈后显现 */
.ball--purple.is-veiled {
  animation: none;
  opacity: 0;
  transform: scale(0.85);
  filter: blur(2px);
  pointer-events: none;
}

.ball--purple.is-revealed {
  opacity: 1;
  transform: scale(1);
  filter: none;
}

.ball.is-locked {
  box-shadow:
    0 0 0 3px rgba(220, 70, 70, 0.85),
    0 0 18px rgba(220, 70, 70, 0.55),
    inset 0 0 18px rgba(80, 0, 0, 0.35);
  border-color: rgba(255, 140, 140, 0.9);
  filter: brightness(0.72) saturate(0.85);
}

.ball.is-target {
  box-shadow:
    0 0 0 3px rgba(120, 220, 160, 0.75),
    0 0 20px rgba(100, 200, 140, 0.5),
    inset 0 -8px 16px rgba(0, 0, 0, 0.25);
}

.ball.is-cleared {
  animation: none;
  opacity: 0 !important;
  visibility: hidden;
  transform: scale(0.6);
  pointer-events: none;
  filter: none;
}

@keyframes ball-in {
  from {
    opacity: 0;
    transform: scale(0.72);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.monster {
  position: absolute;
  left: 0;
  top: 50%;
  width: var(--monster-size);
  height: calc(var(--monster-size) * 1.35);
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.monster__aura {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--aura-radius) * 2);
  height: calc(var(--aura-radius) * 2);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(240, 216, 120, 0.85);
  background: radial-gradient(
    circle,
    rgba(232, 192, 74, 0.18) 0%,
    rgba(232, 192, 74, 0.06) 55%,
    transparent 72%
  );
  box-shadow:
    0 0 28px rgba(232, 192, 74, 0.45),
    inset 0 0 24px rgba(255, 230, 140, 0.2);
  animation: aura-pulse 2.2s ease-in-out infinite;
  z-index: 0;
}

.monster__img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
}

@keyframes aura-pulse {
  0%,
  100% {
    opacity: 0.85;
    box-shadow:
      0 0 22px rgba(232, 192, 74, 0.4),
      inset 0 0 20px rgba(255, 230, 140, 0.16);
  }
  50% {
    opacity: 1;
    box-shadow:
      0 0 36px rgba(255, 220, 120, 0.65),
      inset 0 0 28px rgba(255, 230, 140, 0.28);
  }
}

.player {
  position: absolute;
  width: var(--player-size);
  height: var(--player-size);
  object-fit: contain;
  transform: translate(-50%, -50%) scaleX(1);
  transform-origin: center center;
  z-index: 5;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55));
}

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

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

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

.btn {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(26, 18, 28, 0.85);
  color: #f7efd6;
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  transition: border-color 0.25s, transform 0.25s, background 0.25s;
}

.btn:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.btn--primary {
  background: linear-gradient(180deg, rgba(72, 40, 96, 0.92), rgba(28, 14, 36, 0.94));
  border-color: rgba(155, 95, 212, 0.55);
}

.btn--primary:hover {
  border-color: rgba(200, 150, 255, 0.75);
}

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

.status.is-hint {
  color: rgba(201, 162, 39, 0.9);
}

.status.is-win {
  color: #7dce5a;
  text-shadow: 0 0 18px rgba(125, 206, 90, 0.45);
}

.status.is-warn {
  color: #e07070;
}

@media (max-width: 640px) {
  :root {
    --ball-size: 44px;
    --ball-gap: 0.28rem;
    --player-size: 58px;
    --monster-size: 70px;
  }

  .arena {
    min-height: 420px;
  }
}
