:root {
  --bg-1: #1f1510;
  --bg-2: #3a271a;
  --bg-3: #130d0a;
  --sand: #c5a37f;
  --blood: #7f1f1f;
  --blood-bright: #bb3e32;
  --bronze: #b98a4a;
  --ivory: #f2e8d8;
  --panel: rgba(33, 19, 14, 0.82);
  --panel-border: rgba(222, 172, 102, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ivory);
  font-family: "Noto Serif SC", "STZhongsong", "Source Han Serif SC", serif;
  background:
    radial-gradient(circle at 20% 8%, rgba(223, 160, 97, 0.2), transparent 36%),
    radial-gradient(circle at 84% 24%, rgba(142, 40, 32, 0.22), transparent 33%),
    radial-gradient(circle at 50% 140%, rgba(27, 12, 8, 0.8), rgba(9, 7, 7, 0.95) 52%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 58%, var(--bg-3));
}

.arena-page {
  position: relative;
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 16px 30px;
  overflow: hidden;
}

.arena-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(105deg, rgba(255, 207, 132, 0) 36%, rgba(255, 207, 132, 0.2) 50%, rgba(255, 207, 132, 0) 64%);
  transform: translateX(-120%);
  animation: arena-scan 9s ease-in-out infinite;
}

@keyframes arena-scan {
  0% {
    transform: translateX(-120%);
  }
  46% {
    transform: translateX(-120%);
  }
  66% {
    transform: translateX(120%);
  }
  100% {
    transform: translateX(120%);
  }
}

.arena-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 25%, rgba(255, 195, 122, 0.1), transparent 42%),
    radial-gradient(circle at 50% 110%, rgba(127, 31, 31, 0.35), transparent 50%),
    linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.35) 100%);
}

.arena-crowd-bands {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 18px;
  height: 120px;
  z-index: 3;
  pointer-events: none;
  opacity: 0.8;
}

.crowd-band {
  display: block;
  border-radius: 999px;
  margin: 0 auto 8px;
  box-shadow: inset 0 1px 0 rgba(231, 192, 128, 0.08);
  animation: crowd-wave 4.8s ease-in-out infinite;
}

.band-2 {
  animation-delay: 0.35s;
}

.band-3 {
  animation-delay: 0.72s;
}

@keyframes crowd-wave {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.95;
  }
  50% {
    transform: translateY(-2px);
    opacity: 0.82;
  }
}

.band-1 {
  width: 96%;
  height: 22px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(44, 30, 26, 0.92) 0,
      rgba(44, 30, 26, 0.92) 11px,
      rgba(66, 43, 34, 0.92) 11px,
      rgba(66, 43, 34, 0.92) 22px
    );
}

.band-2 {
  width: 90%;
  height: 18px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(41, 29, 22, 0.82) 0,
      rgba(41, 29, 22, 0.82) 10px,
      rgba(72, 49, 35, 0.82) 10px,
      rgba(72, 49, 35, 0.82) 20px
    );
}

.band-3 {
  width: 84%;
  height: 14px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(45, 29, 21, 0.76) 0,
      rgba(45, 29, 21, 0.76) 8px,
      rgba(67, 41, 30, 0.76) 8px,
      rgba(67, 41, 30, 0.76) 16px
    );
}

.arena-pillars,
.arena-banners,
.arena-torches {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.pillar {
  position: absolute;
  top: 36px;
  width: 38px;
  height: 72%;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(140, 105, 72, 0.6), rgba(79, 53, 36, 0.84), rgba(129, 93, 62, 0.52));
  box-shadow:
    inset 0 8px 16px rgba(255, 210, 140, 0.1),
    0 18px 22px rgba(0, 0, 0, 0.32);
}

.pillar::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -8px;
  right: -8px;
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(196, 155, 102, 0.68), rgba(101, 68, 42, 0.94));
}

.pillar-left {
  left: 0;
}

.pillar-right {
  right: 0;
}

.banner {
  position: absolute;
  top: 64px;
  width: 92px;
  height: 180px;
  border: 1px solid rgba(232, 182, 114, 0.35);
  background:
    linear-gradient(180deg, rgba(140, 31, 31, 0.95), rgba(76, 17, 17, 0.95));
  clip-path: polygon(0 0, 100% 0, 100% 80%, 74% 100%, 50% 84%, 26% 100%, 0 80%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 18px rgba(179, 38, 38, 0.3);
  transform-origin: 50% 0;
  animation: banner-sway 2.1s ease-in-out infinite;
}

@keyframes banner-sway {
  0%,
  100% {
    transform: rotate(-3.2deg) translateY(0);
  }
  50% {
    transform: rotate(3.2deg) translateY(3px);
  }
}

.banner::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  bottom: 30px;
  border: 1px solid rgba(245, 211, 162, 0.46);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 40%, rgba(250, 204, 128, 0.25), rgba(250, 204, 128, 0));
}

.banner-left {
  left: 12px;
  animation-delay: 0.2s;
}

.banner-right {
  right: 12px;
  animation-delay: 0.9s;
}

.torch {
  position: absolute;
  top: 156px;
  width: 22px;
  height: 132px;
  border-radius: 999px;
  background: linear-gradient(180deg, #957451, #493426 72%);
  box-shadow: inset 0 -8px 12px rgba(0, 0, 0, 0.22);
}

.torch::before {
  content: "";
  position: absolute;
  top: -9px;
  left: -8px;
  width: 38px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d1a365, #755332);
}

.torch-left {
  left: 86px;
}

.torch-right {
  right: 86px;
}

.flame {
  position: absolute;
  left: 50%;
  top: -38px;
  width: 24px;
  height: 38px;
  transform: translateX(-50%);
  border-radius: 16px 16px 18px 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 241, 202, 0.9), rgba(255, 241, 202, 0) 36%),
    linear-gradient(180deg, #ffd983, #ff9b3b 50%, #b73b20);
  box-shadow:
    0 0 22px rgba(255, 176, 68, 0.65),
    0 0 46px rgba(199, 68, 35, 0.35);
  animation: flame-flicker 0.9s ease-in-out infinite alternate;
}

@keyframes flame-flicker {
  from {
    transform: translateX(-50%) scale(0.95) rotate(-1.2deg);
    filter: brightness(0.92);
  }
  to {
    transform: translateX(-50%) scale(1.06) rotate(1.8deg);
    filter: brightness(1.12);
  }
}

.arena-smoke {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(26px);
  opacity: 0.55;
  z-index: 3;
  animation: drift 5.2s ease-in-out infinite alternate;
}

.arena-smoke-a {
  width: 380px;
  height: 260px;
  left: -120px;
  top: 80px;
  background: radial-gradient(circle, rgba(158, 54, 39, 0.65), rgba(158, 54, 39, 0));
}

.arena-smoke-b {
  width: 350px;
  height: 300px;
  right: -90px;
  top: 20px;
  background: radial-gradient(circle, rgba(190, 142, 82, 0.5), rgba(190, 142, 82, 0));
  animation-delay: 1.6s;
}

@keyframes drift {
  from {
    transform: translateY(-8px) scale(1);
  }
  to {
    transform: translateY(16px) scale(1.07);
  }
}

.arena-header {
  position: relative;
  z-index: 2;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background:
    linear-gradient(140deg, rgba(40, 22, 15, 0.88), rgba(67, 38, 25, 0.66)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 7px,
      rgba(0, 0, 0, 0.03) 7px,
      rgba(0, 0, 0, 0.03) 14px
    );
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.48);
  transform: translateY(0);
  opacity: 1;
  animation: reveal-up 0.8s ease both;
}

.kicker {
  margin: 0;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: #e2c18a;
}

.arena-header h1 {
  margin: 8px 0;
  font-size: clamp(30px, 4.8vw, 54px);
  line-height: 1.05;
  color: #f3dec1;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

.sub {
  margin: 0;
  color: #e4d4be;
  line-height: 1.6;
}

.arena-layout {
  position: relative;
  z-index: 2;
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
  transform: translateY(0);
  opacity: 1;
  animation: reveal-up 0.9s ease 0.12s both;
}

@keyframes reveal-up {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.motion-probe {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 183, 110, 0.38);
  background: rgba(72, 29, 20, 0.52);
  color: #f3dfc3;
  font-size: 12px;
}

.probe-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff9f4a;
  box-shadow: 0 0 0 rgba(255, 159, 74, 0.7);
  animation: probe-ping 1.1s ease-out infinite;
}

@keyframes probe-ping {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(255, 159, 74, 0.64);
  }
  70% {
    transform: scale(1.12);
    box-shadow: 0 0 0 11px rgba(255, 159, 74, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 159, 74, 0);
  }
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0, rgba(196, 137, 79, 0.08), transparent 34%),
    linear-gradient(170deg, rgba(36, 21, 15, 0.8), rgba(22, 13, 10, 0.78));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.42);
  padding: 14px;
}

.board-panel {
  position: relative;
}

.board-panel::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 180px;
  height: 120px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(128, 25, 25, 0.2), rgba(128, 25, 25, 0));
}

.board-head h2,
.chooser-panel h2 {
  margin: 0;
  font-size: 24px;
  color: #f0d7b4;
}

.board-head p,
.chooser-tip {
  margin: 8px 0 0;
  color: #d9c3a2;
  font-size: 14px;
  line-height: 1.55;
}

.board-shell {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(214, 165, 92, 0.22);
  background:
    radial-gradient(circle at 50% 15%, rgba(201, 138, 71, 0.23), transparent 60%),
    linear-gradient(180deg, rgba(114, 64, 40, 0.14), rgba(14, 9, 8, 0.24)),
    rgba(31, 19, 14, 0.85);
  box-shadow: inset 0 6px 14px rgba(251, 196, 119, 0.08);
  position: relative;
  overflow: hidden;
}

.board-shell::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  border: 1px solid rgba(233, 162, 98, 0.45);
  pointer-events: none;
  animation: shell-border-pulse 2s ease-in-out infinite;
}

@keyframes shell-border-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(213, 86, 64, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(213, 86, 64, 0.35);
  }
}

.board-shell::after {
  content: "";
  position: absolute;
  inset: -20% -25%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(236, 150, 78, 0.16), rgba(236, 150, 78, 0));
  animation: board-aura 3.4s ease-in-out infinite;
}

@keyframes board-aura {
  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.92;
  }
}

.board-mount {
  width: 100%;
  display: grid;
  place-items: center;
}

.arena-goban {
  max-width: 100%;
  touch-action: manipulation;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
}

.board-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button,
.btn-link,
select {
  font: inherit;
}

button,
.btn-link {
  border-radius: 999px;
  border: 1px solid rgba(226, 177, 107, 0.42);
  padding: 9px 16px;
  color: #f2e5d4;
  background: linear-gradient(180deg, rgba(95, 48, 31, 0.95), rgba(61, 29, 20, 0.95));
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.18s ease;
}

button:hover,
.btn-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn-primary {
  border-color: rgba(241, 184, 100, 0.9);
  color: #291609;
  font-weight: 700;
  background: linear-gradient(180deg, #ebc489, #bf7d43);
}

.btn-primary:focus-visible,
button:focus-visible,
.btn-link:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(255, 206, 139, 0.85);
  outline-offset: 2px;
}

.battle-metrics {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(214, 162, 89, 0.2);
  background:
    linear-gradient(180deg, rgba(84, 43, 32, 0.35), rgba(47, 28, 20, 0.6));
}

.metric span {
  display: block;
  font-size: 12px;
  color: #ceb48e;
}

.metric strong {
  display: block;
  margin-top: 2px;
  color: #f6e9d4;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.field span {
  font-size: 13px;
  color: #d8be9b;
}

select {
  border-radius: 10px;
  border: 1px solid rgba(214, 162, 89, 0.42);
  padding: 9px 10px;
  color: #f3e5d2;
  background: rgba(58, 30, 21, 0.86);
}

select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(187, 121, 58, 0.22);
}

.opponent-card,
.lore-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(214, 162, 89, 0.25);
  background:
    linear-gradient(135deg, rgba(79, 35, 25, 0.88), rgba(38, 18, 13, 0.86));
}

.opponent-card h3,
.lore-box h3 {
  margin: 0;
  color: #f4d7ae;
}

.opponent-card p,
.lore-box p {
  margin: 8px 0 0;
  line-height: 1.6;
  color: #ead6bb;
}

.oath-line {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px dashed rgba(233, 177, 106, 0.33);
  background: linear-gradient(180deg, rgba(70, 25, 25, 0.46), rgba(35, 16, 16, 0.46));
  color: #f1ddc3;
  padding: 10px 12px;
  letter-spacing: 0.02em;
  animation: oath-pulse 2.8s ease-in-out infinite;
}

@keyframes oath-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(187, 62, 50, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(187, 62, 50, 0.22);
  }
}

.oath-line strong {
  color: #f7ca8f;
}

body.duel-live .arena-header {
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(217, 103, 70, 0.25),
    0 0 42px rgba(187, 56, 42, 0.24);
}

body.duel-live .panel {
  border-color: rgba(224, 147, 90, 0.4);
}

body.duel-live .flame {
  animation-duration: 0.64s;
}

@media (max-width: 960px) {
  .arena-crowd-bands {
    left: 0;
    right: 0;
  }

  .banner {
    width: 72px;
    height: 152px;
    top: 74px;
  }

  .banner-left {
    left: 8px;
  }

  .banner-right {
    right: 8px;
  }

  .torch {
    top: 170px;
    height: 108px;
  }

  .torch-left {
    left: 64px;
  }

  .torch-right {
    right: 64px;
  }

  .arena-layout {
    grid-template-columns: 1fr;
  }

  .battle-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .pillar,
  .banner,
  .torch {
    display: none;
  }

  .arena-page::before {
    animation-duration: 6.4s;
  }

  .arena-smoke {
    opacity: 0.56;
    filter: blur(22px);
  }

  .arena-header h1 {
    font-size: clamp(28px, 9vw, 42px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .probe-dot,
  .flame,
  .arena-page::before,
  .crowd-band,
  .banner,
  .arena-smoke,
  .board-shell::after,
  .oath-line {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
