:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #576574;
  --paper: #fff8e8;
  --panel: #ffffff;
  --sun: #ffd166;
  --mint: #38b2ac;
  --coral: #f76f72;
  --sky: #4d96ff;
  --line: #1f2d3d;
  --shadow: 0 18px 45px rgba(31, 45, 61, 0.16);
  --comic-shadow: 6px 6px 0 rgba(31, 45, 61, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.58) 0 12%, transparent 12% 18%),
    repeating-linear-gradient(135deg, rgba(31, 45, 61, 0.05) 0 2px, transparent 2px 28px),
    radial-gradient(ellipse at 50% 18%, rgba(255, 245, 207, 0.92) 0 18%, transparent 46%),
    linear-gradient(135deg, #ffe2a8 0%, #a8ede8 46%, #9cc9ff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(72deg, transparent 0 22%, rgba(255, 255, 255, 0.42) 22% 24%, transparent 24% 100%),
    linear-gradient(108deg, transparent 0 36%, rgba(255, 255, 255, 0.36) 36% 38%, transparent 38% 100%),
    linear-gradient(83deg, transparent 0 62%, rgba(255, 255, 255, 0.3) 62% 64%, transparent 64% 100%);
  opacity: 0.7;
  pointer-events: none;
}

.playground-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.playground-bg::before,
.playground-bg::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -230px;
  width: 980px;
  height: 430px;
  border: 4px solid rgba(31, 45, 61, 0.2);
  border-radius: 50%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0 18px, rgba(255, 209, 102, 0.22) 18px 36px),
    #69d2c9;
  transform: translateX(-50%) rotate(-2deg);
}

.playground-bg::after {
  bottom: -285px;
  width: 720px;
  height: 300px;
  background: rgba(255, 255, 255, 0.36);
}

.zigzag,
.ribbon,
.spark {
  position: absolute;
  display: block;
}

.zigzag {
  width: 130px;
  height: 64px;
  background:
    linear-gradient(135deg, transparent 0 36%, var(--coral) 36% 49%, transparent 49% 100%),
    linear-gradient(45deg, transparent 0 36%, var(--sun) 36% 49%, transparent 49% 100%);
  filter: drop-shadow(3px 4px 0 rgba(31, 45, 61, 0.16));
  opacity: 0.75;
  animation: drift 5.5s ease-in-out infinite alternate;
}

.zigzag-one {
  top: 16%;
  left: 4%;
  transform: rotate(-16deg);
}

.zigzag-two {
  right: 6%;
  top: 45%;
  transform: rotate(14deg) scale(0.86);
  animation-delay: -2s;
}

.spark {
  width: 56px;
  height: 56px;
  background: var(--sun);
  clip-path: polygon(50% 0, 60% 34%, 96% 18%, 72% 50%, 100% 72%, 63% 66%, 50% 100%, 38% 66%, 0 72%, 28% 50%, 4% 18%, 40% 34%);
  filter: drop-shadow(3px 4px 0 rgba(31, 45, 61, 0.17));
  animation: twinkle 2.7s ease-in-out infinite;
}

.spark-one {
  top: 8%;
  right: 22%;
}

.spark-two {
  bottom: 30%;
  left: 7%;
  width: 42px;
  height: 42px;
  background: #f76f72;
  animation-delay: -1s;
}

.spark-three {
  bottom: 16%;
  right: 12%;
  width: 46px;
  height: 46px;
  background: #38b2ac;
  animation-delay: -1.7s;
}

.ribbon {
  width: 190px;
  height: 26px;
  border: 3px solid rgba(31, 45, 61, 0.45);
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #ffffff 0 20px, #ffd166 20px 40px, #4d96ff 40px 60px);
  opacity: 0.55;
  transform: rotate(22deg);
}

.ribbon-one {
  top: 64px;
  left: 38%;
}

.ribbon-two {
  bottom: 118px;
  right: 30%;
  transform: rotate(-13deg);
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 36px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  min-height: 150px;
  padding-top: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #14746f;
  font-size: 0.94rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.08;
}

.intro {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  gap: 10px;
}

.scoreboard div,
.music-button {
  min-height: 86px;
  padding: 12px 8px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--comic-shadow);
  text-align: center;
}

.music-button {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 12px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.music-button:hover,
.music-button:focus-visible {
  transform: translate(-2px, -2px);
  background: #fff4c2;
  box-shadow: 8px 8px 0 rgba(31, 45, 61, 0.16);
  outline: none;
}

.music-button.is-on {
  background: #fff0b5;
}

.music-icon {
  display: grid;
  place-items: center;
  width: 28px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
}

.music-button.is-on .music-icon {
  animation: musicBeat 520ms ease-in-out infinite alternate;
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.scoreboard strong {
  display: block;
  margin-top: 5px;
  font-size: 2.1rem;
}

.arena {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.2fr) minmax(180px, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 30px;
}

.battle-burst {
  position: absolute;
  inset: -22px;
  z-index: -1;
  border-radius: 18px;
  background:
    linear-gradient(90deg, transparent 0 4%, rgba(255, 255, 255, 0.62) 4% 5%, transparent 5% 14%),
    repeating-linear-gradient(45deg, rgba(255, 209, 102, 0.34) 0 18px, rgba(247, 111, 114, 0.15) 18px 36px);
  opacity: 0;
  transform: scale(0.96);
}

.arena.is-counting .battle-burst,
.arena.is-revealing .battle-burst {
  animation: burstPulse 900ms ease-in-out infinite;
}

.player-panel,
.round-panel,
.rules {
  border: 3px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.player-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 270px;
  padding: 20px;
  text-align: center;
  transition: transform 220ms ease, background 220ms ease;
}

.player-panel::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px dashed rgba(31, 45, 61, 0.18);
  border-radius: 8px;
  opacity: 0;
  transform: scale(0.9);
}

.player-panel.is-winner {
  background: #fff7cf;
  transform: translateY(-5px);
}

.player-panel.is-winner::before {
  animation: winnerRing 900ms ease-out 1;
}

.player-panel.is-draw {
  background: #eefbf9;
  animation: panelBounce 520ms ease-in-out 1;
}

.panel-label,
.round-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  color: #0f3d3e;
  background: #d8f3ed;
  font-weight: 900;
}

.choice-display {
  display: grid;
  place-items: center;
  width: min(150px, 46vw);
  aspect-ratio: 1;
  margin: 12px 0;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  font-size: 4.3rem;
  font-weight: 900;
  box-shadow: inset 0 -8px 0 rgba(31, 45, 61, 0.08);
  transform-style: preserve-3d;
  transition: background 200ms ease;
}

.choice-symbol {
  display: inline-block;
}

.choice-display.is-hidden .choice-symbol {
  opacity: 0;
}

.choice-display.is-thinking {
  animation: fistShake 430ms ease-in-out infinite;
  background: #fff0d1;
}

.choice-display.is-flipping {
  animation: flipReveal 760ms cubic-bezier(0.2, 0.8, 0.2, 1) 1;
}

.choice-display.is-winner {
  background: #fff0b5;
  animation: winnerPop 560ms ease-out 1;
}

.choice-display.is-draw {
  background: #dff8f4;
  animation: drawWobble 520ms ease-in-out 1;
}

.player-panel p,
.round-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.round-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 270px;
  padding: 28px;
  text-align: center;
  background: #fffdf7;
}

.countdown {
  position: absolute;
  top: 16px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.5) rotate(-8deg);
  box-shadow: var(--comic-shadow);
}

.countdown.is-showing {
  animation: countdownPop 360ms ease-out 1;
  opacity: 1;
}

.round-panel h2 {
  margin: 18px 0 10px;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  line-height: 1.15;
}

.reset-button {
  min-height: 44px;
  margin-top: 22px;
  padding: 0 20px;
  border: 3px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--sun);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 5px 5px 0 rgba(31, 45, 61, 0.17);
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.choice-button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  min-height: 98px;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--comic-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.choice-button:hover,
.choice-button:focus-visible {
  transform: translate(-3px, -3px);
  box-shadow: 9px 9px 0 rgba(31, 45, 61, 0.16);
  outline: none;
}

.choice-button:disabled {
  cursor: wait;
  opacity: 0.64;
  transform: none;
}

.choice-button strong {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.choice-art {
  position: relative;
  display: block;
  width: 62px;
  height: 62px;
  border: 3px solid var(--line);
}

.rock {
  border-radius: 44% 52% 48% 50%;
  background: #9aa6b2;
  box-shadow: inset -9px -9px 0 rgba(31, 45, 61, 0.16);
}

.scissors {
  border: 0;
}

.scissors::before,
.scissors::after {
  content: "";
  position: absolute;
  width: 58px;
  height: 16px;
  left: 2px;
  top: 22px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--coral);
  transform-origin: 10px 50%;
}

.scissors::before {
  transform: rotate(30deg);
}

.scissors::after {
  transform: rotate(-30deg);
}

.paper {
  border-radius: 7px;
  background: #fefefe;
  box-shadow: inset 0 -10px 0 rgba(77, 150, 255, 0.16);
}

.paper::before,
.paper::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  background: #8aa4bf;
}

.paper::before {
  top: 20px;
}

.paper::after {
  top: 34px;
}

.rules {
  margin-top: 22px;
  padding: 22px;
}

.rules h2 {
  margin-bottom: 10px;
  font-size: 1.45rem;
}

.rules ul {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules li {
  min-height: 64px;
  padding: 12px;
  border-radius: 8px;
  background: #ecfbf6;
  color: #24424a;
  font-weight: 800;
  line-height: 1.45;
}

@keyframes drift {
  from {
    translate: 0 0;
  }

  to {
    translate: 0 18px;
  }
}

@keyframes twinkle {
  0%,
  100% {
    transform: rotate(0deg) scale(0.9);
  }

  45% {
    transform: rotate(12deg) scale(1.12);
  }
}

@keyframes burstPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.98);
  }

  50% {
    opacity: 0.74;
    transform: scale(1.02);
  }
}

@keyframes fistShake {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  25% {
    transform: translateY(-11px) rotate(-8deg);
  }

  50% {
    transform: translateY(4px) rotate(7deg);
  }

  75% {
    transform: translateY(-7px) rotate(4deg);
  }
}

@keyframes flipReveal {
  0% {
    transform: rotateY(0deg) scale(1);
  }

  48% {
    transform: rotateY(90deg) scale(1.12);
  }

  100% {
    transform: rotateY(360deg) scale(1);
  }
}

@keyframes winnerPop {
  0% {
    transform: scale(0.84) rotate(-8deg);
  }

  65% {
    transform: scale(1.16) rotate(5deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes drawWobble {
  0%,
  100% {
    transform: translateX(0);
  }

  22% {
    transform: translateX(-12px);
  }

  44% {
    transform: translateX(12px);
  }

  66% {
    transform: translateX(-7px);
  }
}

@keyframes panelBounce {
  0%,
  100% {
    transform: translateY(0);
  }

  45% {
    transform: translateY(-8px);
  }
}

@keyframes winnerRing {
  0% {
    opacity: 0.8;
    transform: scale(0.92);
  }

  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@keyframes countdownPop {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-16deg);
  }

  70% {
    opacity: 1;
    transform: scale(1.12) rotate(8deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes musicBeat {
  from {
    transform: rotate(-8deg) scale(0.94);
  }

  to {
    transform: rotate(8deg) scale(1.08);
  }
}

@media (max-width: 820px) {
  .hero,
  .arena,
  .controls,
  .rules ul {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 8px;
  }

  .playground-bg::before {
    width: 680px;
  }

  .zigzag,
  .ribbon {
    opacity: 0.36;
  }

  .scoreboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .music-button {
    grid-column: 1 / -1;
  }

  .choice-button {
    min-height: 86px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 480px) {
  .game-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 24px;
  }

  .scoreboard {
    gap: 7px;
  }

  .scoreboard div {
    min-height: 74px;
    padding: 10px 4px;
  }

  .scoreboard strong {
    font-size: 1.7rem;
  }

  .player-panel,
  .round-panel {
    min-height: 220px;
  }
}
