:root {
  color-scheme: dark;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #17120f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 20%, #4a1714, #130d0b 64%);
}

.phone-shell {
  width: min(100vw, 56.25vh);
  height: min(177.78vw, 100vh);
  max-width: 1080px;
  max-height: 1920px;
  overflow: hidden;
  background: #b52421;
}

.game {
  position: relative;
  width: 1080px;
  height: 1920px;
  transform-origin: top left;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hud {
  position: absolute;
  left: 54px;
  top: 84px;
  width: 972px;
  height: 220px;
  border: 4px solid #5f1c16;
  border-radius: 30px;
  background: rgba(255, 236, 194, 0.9);
  box-shadow: 0 7px 0 rgba(63, 18, 14, 0.8);
}

.hud::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255, 204, 82, 0.75);
  border-radius: 24px;
  pointer-events: none;
}

.bulbs {
  position: absolute;
  left: 28px;
  right: auto;
  top: 18px;
  width: 138px;
  height: 14px;
  background-image: radial-gradient(circle, #ffd96a 0 6px, #884f19 6px 7px, transparent 8px);
  background-size: 46px 14px;
  opacity: .72;
}

.bulbs::after {
  content: "";
  position: absolute;
  left: 806px;
  top: 0;
  width: 138px;
  height: 14px;
  background-image: radial-gradient(circle, #ffd96a 0 6px, #884f19 6px 7px, transparent 8px);
  background-size: 46px 14px;
}

.brand {
  position: absolute;
  left: 30px;
  right: 30px;
  top: 14px;
  color: #5d1e18;
  font-size: 50px;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 1px 0 #ffeec3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.hud-row {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 22px;
  display: flex;
  justify-content: space-between;
}

.hud-pill {
  min-width: 270px;
  height: 76px;
  border: 3px solid #e9b244;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #231c19;
  font-size: 36px;
  font-weight: 800;
  background: rgba(255, 255, 248, 0.94);
}

.message {
  position: absolute;
  left: 54px;
  top: 330px;
  width: 972px;
  height: 96px;
  border: 3px solid #5f1c16;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 30px;
  background: rgba(255, 219, 157, 0.74);
  color: #231c19;
  font-size: 42px;
  font-weight: 700;
}

.targets {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.target {
  position: absolute;
  transform-origin: center bottom;
  pointer-events: auto;
}

.post,
.turtle {
  position: absolute;
  display: block;
  user-drag: none;
  -webkit-user-drag: none;
}

.turtle {
  filter: drop-shadow(4px 7px 4px rgba(0, 0, 0, 0.42));
  cursor: pointer;
  transform-origin: center bottom;
}

.target.down .turtle {
  pointer-events: none;
  animation: turtleFall 760ms cubic-bezier(.18, .77, .29, 1.01) forwards;
}

.target.shake .turtle {
  animation: shake 320ms ease-in-out;
}

.target.unlocked .turtle {
  filter: drop-shadow(0 0 12px rgba(255, 227, 96, 0.95)) drop-shadow(4px 7px 4px rgba(0, 0, 0, 0.42));
}

.round-ended .targets,
.round-ended .stage-shadow,
.round-ended .stage-rail {
  opacity: 0;
  transition: opacity 240ms ease;
}

.number-badge {
  position: absolute;
  z-index: 2;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border: 3px solid #5f1c16;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 239, 196, 0.96);
  color: #231c19;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 4px 0 rgba(63, 18, 14, 0.55);
  pointer-events: none;
}

.number-badge.hidden {
  display: none;
}

.stage-shadow {
  position: absolute;
  left: 70px;
  top: 1047px;
  width: 940px;
  height: 82px;
  border-radius: 50%;
  background: rgba(58, 15, 12, 0.18);
}

.stage-rail {
  position: absolute;
  left: 68px;
  top: 1107px;
  width: 944px;
  height: 23px;
  border-radius: 12px;
  background: rgba(122, 25, 24, 0.82);
  border-top: 5px solid rgba(246, 57, 48, 0.86);
}

.throw-zone {
  position: absolute;
  left: 72px;
  top: 1220px;
  width: 936px;
  height: 382px;
  border: 2px solid rgba(255, 226, 180, 0.55);
  border-radius: 28px;
  background: rgba(74, 43, 36, 0.38);
  overflow: visible;
}

.throw-zone::before {
  content: "";
  position: absolute;
  left: 156px;
  top: 115px;
  width: 620px;
  height: 280px;
  border-radius: 50%;
  background: rgba(205, 145, 80, 0.13);
}

.aim-arrow {
  position: absolute;
  left: 466px;
  top: -120px;
  width: 8px;
  height: 210px;
  background: #5aa0e8;
  transform: rotate(3deg);
  transform-origin: center bottom;
  transition: height 80ms linear, transform 80ms linear, opacity 80ms linear;
  opacity: 0;
}

.aim-arrow.active {
  opacity: 1;
}

.aim-arrow::before {
  content: "";
  position: absolute;
  left: -25px;
  top: -18px;
  width: 0;
  height: 0;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 60px solid #5aa0e8;
}

.power-line {
  position: absolute;
  left: 469px;
  top: 114px;
  width: 10px;
  height: 0;
  border-radius: 99px;
  background: rgba(255, 220, 92, 0.92);
  box-shadow: 0 0 12px rgba(255, 220, 92, 0.35);
  opacity: 0;
  transform-origin: center bottom;
  pointer-events: none;
}

.power-line.active {
  opacity: 1;
}

.beanbag {
  position: absolute;
  left: 416px;
  top: 72px;
  width: 108px;
  height: 108px;
  border-radius: 20px;
  background: url("assets/beanbag.png") center / contain no-repeat;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.35));
}

.beanbag.fly {
  position: absolute;
  z-index: 20;
  transition: transform 260ms cubic-bezier(.2, .7, .2, 1);
}

.flight-trail {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 0;
  z-index: 18;
  border-radius: 999px;
  background: linear-gradient(to top, rgba(90, 160, 232, 0), rgba(90, 160, 232, 0.95));
  box-shadow: 0 0 16px rgba(90, 160, 232, 0.45);
  opacity: 0;
  transform-origin: center bottom;
  pointer-events: none;
}

.flight-trail.show {
  animation: trailFade 330ms ease-out forwards;
}

.swipe-label {
  position: absolute;
  left: 532px;
  top: 104px;
  color: #fff;
  font-size: 20px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.controls {
  position: absolute;
  left: 82px;
  right: 82px;
  top: 1686px;
  display: flex;
  justify-content: space-between;
}

button {
  width: 190px;
  height: 78px;
  border: 3px solid #4a2f28;
  border-radius: 16px;
  background: rgba(255, 247, 233, 0.9);
  color: #231c19;
  font: inherit;
  font-size: 28px;
  font-weight: 800;
  cursor: pointer;
}

button:active {
  transform: translateY(2px);
}

.toast {
  position: absolute;
  left: 170px;
  top: 590px;
  min-width: 160px;
  color: #ffda58;
  font-size: 38px;
  font-weight: 700;
  text-shadow: 2px 2px 0 rgba(105, 35, 24, 0.88);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.toast.show {
  animation: toast 780ms ease-out;
}

.audio-prompt {
  position: absolute;
  left: 0;
  right: 0;
  top: 1558px;
  z-index: 28;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.audio-prompt.hidden {
  display: none;
}

.audio-prompt button {
  width: 230px;
  background: rgba(255, 239, 196, 0.96);
  box-shadow: 0 6px 0 rgba(82, 19, 15, 0.55);
  pointer-events: auto;
}

.celebration {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(255, 223, 114, 0.34), rgba(190, 24, 24, 0.55) 42%, rgba(22, 12, 9, 0.72));
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}

.celebration.show {
  opacity: 1;
  pointer-events: auto;
}

.celebration-card {
  position: relative;
  width: 760px;
  min-height: 560px;
  border: 4px solid #6b2019;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: rgba(255, 239, 196, 0.94);
  box-shadow: 0 18px 0 rgba(82, 19, 15, 0.7), 0 0 70px rgba(255, 219, 92, 0.35);
  color: #241b17;
  transform: translateY(20px) scale(.96);
  transition: transform 360ms ease;
}

.celebration.show .celebration-card {
  transform: translateY(0) scale(1);
}

.celebration-title {
  font-size: 72px;
  font-weight: 800;
}

.celebration-subtitle {
  font-size: 32px;
}

.celebration-score {
  min-width: 260px;
  height: 64px;
  border: 3px solid #e9b244;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #fffdf1;
  font-size: 30px;
}

.celebration-actions {
  display: flex;
  gap: 18px;
}

.celebration-actions button {
  width: 220px;
}

.leaderboard {
  width: 520px;
  border: 2px solid rgba(107, 32, 25, 0.35);
  border-radius: 14px;
  padding: 12px 18px;
  background: rgba(255, 253, 241, 0.72);
}

.leaderboard-title {
  margin-bottom: 6px;
  color: #6b2019;
  font-size: 22px;
  font-weight: 700;
}

.leaderboard ol {
  margin: 0;
  padding-left: 28px;
}

.leaderboard li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0;
  font-size: 20px;
}

.leaderboard .empty-rank {
  justify-content: center;
  color: rgba(35, 28, 25, 0.68);
}

.artist-link {
  width: 520px;
  min-height: 76px;
  border: 2px solid rgba(107, 32, 25, 0.24);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  gap: 1px;
  padding: 10px 16px;
  background: rgba(255, 253, 241, 0.58);
  color: #241b17;
  text-decoration: none;
}

.artist-link span {
  color: #6b2019;
  font-size: 20px;
  font-weight: 800;
}

.artist-link strong {
  font-size: 24px;
}

.artist-link em {
  color: rgba(35, 28, 25, 0.68);
  font-size: 18px;
  font-style: normal;
}

.confetti,
.confetti::before,
.confetti::after {
  position: absolute;
  inset: -80px 0 0 0;
  content: "";
  background-image:
    radial-gradient(circle, #ffe06f 0 5px, transparent 6px),
    radial-gradient(circle, #5aa0e8 0 4px, transparent 5px),
    radial-gradient(circle, #ffffff 0 4px, transparent 5px),
    radial-gradient(circle, #f26d53 0 5px, transparent 6px);
  background-size: 90px 140px, 130px 160px, 160px 180px, 110px 170px;
  animation: confettiFall 1500ms linear infinite;
}

.confetti::before {
  transform: translateX(35px);
  animation-duration: 1900ms;
  opacity: .72;
}

.confetti::after {
  transform: translateX(-50px);
  animation-duration: 2300ms;
  opacity: .58;
}

.paused::before {
  content: "已暂停";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
  color: #fff5d0;
  font-size: 70px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.38);
}

@keyframes turtleFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  55% { transform: translateY(135px) rotate(-24deg); opacity: 1; }
  100% { transform: translateY(340px) rotate(-80deg); opacity: 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-12px) rotate(-4deg); }
  45% { transform: translateX(10px) rotate(4deg); }
  70% { transform: translateX(-7px) rotate(-2deg); }
}

@keyframes toast {
  0% { opacity: 0; transform: translateY(18px) scale(.94); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(-18px) scale(1); }
  100% { opacity: 0; transform: translateY(-35px) scale(.98); }
}

@keyframes trailFade {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes confettiFall {
  from { background-position: 0 -160px, 0 -120px, 0 -180px, 0 -90px; }
  to { background-position: 0 600px, 0 520px, 0 640px, 0 560px; }
}
