* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: "Trebuchet MS", "Arial Black", Arial, sans-serif;
  background: #17093d;
  color: #ffffff;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

button {
  font: inherit;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: relative;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 238, 98, 0.9) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 22%, rgba(255, 79, 216, 0.85) 0 5px, transparent 6px),
    radial-gradient(circle at 66% 74%, rgba(49, 218, 255, 0.8) 0 4px, transparent 5px),
    radial-gradient(circle at 28% 82%, rgba(255, 140, 47, 0.85) 0 6px, transparent 7px),
    linear-gradient(125deg, #073f82 0%, #5620a8 35%, #ff2b89 70%, #ff8a1d 100%);
}

#game::before,
#game::after {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
}

#game::before {
  background:
    conic-gradient(from 10deg at 50% 45%,
      rgba(255, 235, 82, 0.25),
      transparent 8deg 18deg,
      rgba(35, 226, 255, 0.2) 22deg,
      transparent 32deg 44deg,
      rgba(255, 48, 117, 0.24) 48deg,
      transparent 60deg 76deg);
  animation: slowSpin 24s linear infinite;
}

#game::after {
  background:
    radial-gradient(circle at 12% 38%, rgba(255, 255, 255, 0.88) 0 2px, transparent 3px),
    radial-gradient(circle at 22% 12%, rgba(255, 235, 82, 0.9) 0 5px, transparent 6px),
    radial-gradient(circle at 76% 13%, rgba(255, 255, 255, 0.75) 0 2px, transparent 3px),
    radial-gradient(circle at 86% 58%, rgba(255, 235, 82, 0.9) 0 6px, transparent 7px),
    radial-gradient(circle at 44% 88%, rgba(49, 218, 255, 0.85) 0 5px, transparent 6px);
  opacity: 0.8;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  overflow: hidden;
}

.hidden {
  display: none;
}

.music-button {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  right: auto;
  z-index: 20;
  min-width: 94px;
  padding: 9px 12px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(#31daff, #0868d8);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 0 #063a83, 0 9px 18px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}

.burst-card {
  position: absolute;
  width: min(760px, 92vw);
  aspect-ratio: 1.8;
  background: linear-gradient(135deg, #2de0ff, #7d34ff 48%, #ff3f9e);
  clip-path: polygon(50% 0, 58% 25%, 82% 10%, 74% 36%, 100% 34%, 78% 52%, 94% 74%, 66% 68%, 63% 100%, 48% 76%, 28% 100%, 32% 70%, 3% 80%, 22% 55%, 0 38%, 27% 36%, 17% 10%, 42% 26%);
  filter: drop-shadow(0 18px 0 #22025a) drop-shadow(0 24px 30px rgba(0, 0, 0, 0.34));
  opacity: 0.9;
}

.burst-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: rgba(255, 255, 255, 0.18);
  clip-path: inherit;
}

.star {
  position: absolute;
  width: 34px;
  height: 34px;
  background: #ffec4d;
  clip-path: polygon(50% 0, 61% 36%, 98% 36%, 68% 58%, 79% 95%, 50% 72%, 21% 95%, 32% 58%, 2% 36%, 39% 36%);
}

.star-one {
  top: 20%;
  left: 24%;
}

.star-two {
  top: 18%;
  right: 24%;
  transform: scale(0.8) rotate(18deg);
}

.star-three {
  bottom: 22%;
  left: 48%;
  transform: scale(0.65) rotate(-12deg);
}

h1,
h2 {
  position: relative;
  z-index: 2;
  margin: 0;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 960px;
  font-size: clamp(54px, 13vw, 138px);
  line-height: 0.82;
  color: #ffe64d;
  text-shadow:
    0 5px 0 #ff8a1d,
    0 10px 0 #33207d,
    0 16px 26px rgba(0, 0, 0, 0.36);
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(44px, 10vw, 92px);
  color: #ff4fd8;
  text-shadow:
    0 5px 0 #ffffff,
    0 10px 0 #33207d,
    0 16px 26px rgba(0, 0, 0, 0.34);
}

.end-title {
  max-width: min(920px, 94vw);
  color: #fff48a;
  font-size: clamp(42px, 10vw, 104px);
  line-height: 0.92;
  text-shadow:
    0 5px 0 #ff8a1d,
    0 10px 0 #5b1ba8,
    0 0 30px rgba(255, 230, 77, 0.82),
    0 0 54px rgba(255, 79, 216, 0.68);
}

.end-title::before,
.end-title::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 64px;
  height: 64px;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 8%, #ffe64d 0 8%, transparent 9%),
    radial-gradient(circle at 85% 38%, #31daff 0 7%, transparent 8%),
    radial-gradient(circle at 18% 52%, #ff4fd8 0 7%, transparent 8%),
    radial-gradient(circle at 58% 86%, #ff8a1d 0 8%, transparent 9%);
  filter: drop-shadow(0 0 12px rgba(255, 230, 77, 0.72));
  opacity: 0.85;
  transform: translateY(-50%);
}

.end-title::before {
  right: calc(100% + 8px);
}

.end-title::after {
  left: calc(100% + 8px);
  transform: translateY(-50%) scaleX(-1) rotate(10deg);
}

.reward-pop .end-title {
  animation: endTitlePop 760ms ease-out;
}

p {
  position: relative;
  z-index: 2;
  margin: 0 0 24px;
  font-size: clamp(17px, 3.8vw, 25px);
  font-weight: 900;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.32);
}

.tagline {
  max-width: 580px;
  margin-top: 20px;
}

.start-best {
  margin-bottom: 16px;
  padding: 8px 14px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: rgba(31, 8, 86, 0.46);
  color: #ffe64d;
  font-size: clamp(16px, 3vw, 21px);
}

.big-button {
  position: relative;
  z-index: 2;
  min-width: 200px;
  padding: 18px 34px 20px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.45), transparent 36%),
    linear-gradient(#ff4fd8, #ff276b 58%, #ca0f4d);
  font-size: 30px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 10px 0 #770537,
    0 18px 28px rgba(0, 0, 0, 0.35);
}

.big-button:active,
.music-button:active {
  transform: translateY(5px);
}

.music-button:active {
  transform: translateX(-50%) translateY(4px);
}

#playScreen {
  position: fixed;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

.hud {
  position: relative;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  padding: 12px;
  pointer-events: none;
}

.hud-panel {
  min-width: 136px;
  padding: 10px 14px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.46), transparent 36%),
    linear-gradient(135deg, rgba(53, 218, 255, 0.94), rgba(132, 52, 255, 0.94) 52%, rgba(255, 47, 137, 0.94));
  box-shadow: 0 8px 0 rgba(28, 7, 85, 0.75), 0 14px 26px rgba(0, 0, 0, 0.28);
}

.score-panel {
  position: relative;
  isolation: isolate;
}

.timer-panel {
  background:
    linear-gradient(rgba(255, 255, 255, 0.46), transparent 36%),
    linear-gradient(135deg, #ffe64d, #ff8a1d 58%, #ff3164);
}

.timer-panel.danger {
  background:
    linear-gradient(rgba(255, 255, 255, 0.5), transparent 36%),
    linear-gradient(135deg, #ffdf4f, #ff6736 38%, #e41340 78%);
  box-shadow:
    0 8px 0 rgba(102, 10, 51, 0.75),
    0 14px 26px rgba(0, 0, 0, 0.28),
    0 0 26px rgba(255, 49, 100, 0.58);
  animation: dangerPulse 560ms ease-in-out infinite alternate;
}

.timer-panel.critical {
  box-shadow:
    0 8px 0 rgba(102, 10, 51, 0.8),
    0 14px 26px rgba(0, 0, 0, 0.3),
    0 0 34px rgba(255, 49, 100, 0.78),
    0 0 18px rgba(255, 230, 77, 0.62);
  animation: criticalPulse 380ms ease-in-out infinite alternate;
}

.score-panel.bump {
  animation: scoreBump 250ms ease-out;
}

.score-panel.max-combo-glow {
  animation: maxComboScoreGlow 1100ms ease-out;
}

.score-panel.max-combo-glow::after {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: -1;
  border-radius: 14px;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255, 244, 138, 0.78), rgba(255, 230, 77, 0.26) 44%, transparent 72%);
  animation: maxComboBloom 1100ms ease-out;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.hud strong,
#comboBar strong {
  display: block;
  font-size: clamp(28px, 7vw, 44px);
  line-height: 1;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
}

#comboBar {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid rgba(255, 255, 255, 0.42);
  text-align: left;
  pointer-events: none;
  transform-origin: left center;
}

#comboBar strong {
  font-size: clamp(21px, 5vw, 30px);
}

#comboBar.hot {
  animation: comboBounce 420ms ease-out;
}

#comboBar.lost {
  animation: comboLost 320ms ease-out;
}

#comboBar.max-combo-pulse {
  animation: maxComboPulse 860ms ease-out;
}

#comboBar.max-combo-pulse strong {
  color: #fff48a;
  text-shadow:
    0 3px 0 #ff8a1d,
    0 0 18px rgba(255, 230, 77, 0.98),
    0 0 32px rgba(255, 79, 216, 0.72);
}

#comboMessage {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 900;
}

.max-combo-label {
  position: absolute;
  left: calc(100% + 10px);
  top: 52%;
  z-index: 2;
  padding: 7px 9px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  color: #35126f;
  background:
    linear-gradient(rgba(255, 255, 255, 0.52), transparent 36%),
    linear-gradient(135deg, #fff48a, #ffe64d 48%, #ff8a1d);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: none;
  box-shadow:
    0 5px 0 rgba(28, 7, 85, 0.72),
    0 0 18px rgba(255, 230, 77, 0.86),
    0 0 28px rgba(255, 79, 216, 0.46);
  animation: maxComboLabelPop 1050ms ease-out forwards;
}

.max-combo-spark {
  position: absolute;
  z-index: 16;
  width: 12px;
  height: 12px;
  pointer-events: none;
  background: #fff48a;
  clip-path: polygon(50% 0, 61% 36%, 98% 36%, 68% 58%, 79% 95%, 50% 72%, 21% 95%, 32% 58%, 2% 36%, 39% 36%);
  filter:
    drop-shadow(0 0 8px rgba(255, 230, 77, 0.98))
    drop-shadow(0 0 14px rgba(255, 138, 29, 0.72));
  transform: translate(-50%, -50%) scale(0.35);
  animation: maxComboSparkFly 860ms ease-out forwards;
}

#scoreText.max-combo-score-flash {
  animation: maxComboScoreNumber 900ms ease-out;
}

#comboBar.lost #comboMessage {
  color: #ffe64d;
}

#gameArea {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

body.playing,
body.playing #gameArea,
body.playing .balloon {
  cursor: none;
}

#gameArea.shake {
  animation: screenShake 190ms linear;
}

#gameArea.golden-shake {
  animation: goldenScreenShake 260ms linear;
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 30;
  width: 50px;
  height: 50px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  filter: drop-shadow(0 0 12px rgba(49, 218, 255, 0.75));
}

#crosshair.visible {
  opacity: 1;
}

#crosshair.fire {
  animation: scopeFire 150ms ease-out;
}

#crosshair.hit {
  animation: scopeHit 220ms ease-out;
}

.scope-ring {
  position: absolute;
  inset: 5px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px rgba(34, 13, 87, 0.72),
    0 0 0 2px rgba(34, 13, 87, 0.72),
    0 0 16px rgba(255, 79, 216, 0.64);
}

.scope-ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(255, 255, 255, 0.72);
  border-radius: 50%;
}

.scope-line {
  position: absolute;
  left: 50%;
  top: 50%;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(34, 13, 87, 0.85), 0 0 10px rgba(49, 218, 255, 0.65);
}

.scope-line-x {
  width: 45px;
  height: 2px;
  transform: translate(-50%, -50%);
}

.scope-line-y {
  width: 2px;
  height: 45px;
  transform: translate(-50%, -50%);
}

.scope-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe64d 0 30%, #ff4fd8 31% 62%, #31daff 63%);
  box-shadow: 0 0 14px rgba(255, 230, 77, 0.95);
  transform: translate(-50%, -50%);
}

.balloon {
  padding: 0;
  border: 0;
  appearance: none;
  position: absolute;
  left: 50%;
  top: 100%;
  width: var(--size);
  height: calc(var(--size) * 1.24);
  border-radius: 52% 52% 47% 47%;
  background:
    radial-gradient(circle at 29% 24%, rgba(255, 255, 255, 0.78) 0 10%, rgba(255, 255, 255, 0.12) 11% 20%, transparent 21%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), transparent 42%),
    var(--color);
  box-shadow:
    inset -14px -22px 0 rgba(0, 0, 0, 0.16),
    inset 9px 8px 0 rgba(255, 255, 255, 0.24),
    0 9px 16px rgba(0, 0, 0, 0.18);
  transform: translateX(-50%);
  cursor: pointer;
  user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.balloon::before {
  content: "";
  position: absolute;
  top: 17%;
  left: 22%;
  width: 22%;
  height: 17%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  transform: rotate(-18deg);
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: calc(var(--size) * 0.18);
  height: calc(var(--size) * 0.15);
  background: inherit;
  border-radius: 2px;
  transform: translateX(-50%) rotate(45deg);
}

.golden {
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.95) 0 10%, transparent 18%),
    linear-gradient(145deg, #fff9b8, #ffe13a 42%, #ff9f05 78%);
  box-shadow:
    0 0 0 7px rgba(255, 230, 75, 0.16),
    0 0 26px rgba(255, 230, 75, 0.98),
    0 0 58px rgba(255, 146, 24, 0.82),
    inset -16px -23px 0 rgba(165, 88, 0, 0.18),
    inset 10px 8px 0 rgba(255, 255, 255, 0.46);
  filter: brightness(1.12) saturate(1.15);
  animation: goldenPulse 760ms ease-in-out infinite alternate;
}

.golden::before {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.88);
}

.golden .golden-ring {
  position: absolute;
  inset: -16px;
  border: 3px solid rgba(255, 244, 138, 0.88);
  border-radius: 50%;
  pointer-events: none;
  box-shadow:
    0 0 18px rgba(255, 230, 77, 0.88),
    inset 0 0 14px rgba(255, 146, 24, 0.38);
  animation: goldenRing 980ms ease-in-out infinite;
}

.golden .golden-ring::before,
.golden .golden-ring::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -9px;
  width: 18px;
  height: 18px;
  background: #fff48a;
  clip-path: polygon(50% 0, 61% 36%, 98% 36%, 68% 58%, 79% 95%, 50% 72%, 21% 95%, 32% 58%, 2% 36%, 39% 36%);
  filter: drop-shadow(0 0 8px rgba(255, 230, 77, 0.95));
  transform: translateX(-50%);
}

.golden .golden-ring::after {
  top: auto;
  bottom: -9px;
  transform: translateX(-50%) scale(0.72) rotate(22deg);
}

.pop-text,
.score-float,
.kabooom-text,
.combo-callout {
  position: absolute;
  z-index: 14;
  pointer-events: none;
  font-weight: 900;
  text-shadow: 0 3px 0 #3b147d, 0 7px 12px rgba(0, 0, 0, 0.28);
}

.pop-text {
  color: #ffffff;
  font-size: clamp(24px, 7vw, 40px);
  animation: popText 540ms ease-out forwards;
}

.score-float {
  color: #ffe64d;
  font-size: clamp(20px, 5vw, 30px);
  animation: scoreFloat 720ms ease-out forwards;
}

.golden-score {
  color: #fff48a;
  font-size: clamp(29px, 8vw, 48px);
  text-shadow: 0 4px 0 #ff8a1d, 0 0 20px rgba(255, 230, 77, 0.95);
}

.kabooom-text {
  color: #fff48a;
  font-size: clamp(38px, 11vw, 78px);
  text-transform: uppercase;
  text-shadow:
    0 5px 0 #ff8a1d,
    0 10px 0 #5b1ba8,
    0 0 34px rgba(255, 230, 77, 0.95),
    0 0 52px rgba(255, 79, 216, 0.72);
  animation: kabooomText 900ms ease-out forwards;
}

.combo-callout {
  left: 50%;
  top: 42%;
  color: #ffe64d;
  font-size: clamp(30px, 9vw, 68px);
  text-transform: uppercase;
  animation: comboCallout 860ms ease-out forwards;
}

.burst {
  position: absolute;
  z-index: 12;
  width: var(--burst-size);
  height: var(--burst-size);
  pointer-events: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 10%, transparent 12%),
    conic-gradient(#ffe64d, #ff4fd8, #31daff, #ff8a1d, #ffe64d);
  clip-path: polygon(50% 0, 60% 34%, 95% 20%, 70% 50%, 100% 65%, 63% 63%, 70% 100%, 50% 70%, 28% 100%, 36% 63%, 0 66%, 29% 50%, 5% 18%, 41% 34%);
  transform: translate(-50%, -50%) scale(0.25);
  animation: burstPop 430ms ease-out forwards;
}

.spark {
  position: absolute;
  z-index: 13;
  width: 12px;
  height: 12px;
  pointer-events: none;
  background: var(--spark-color);
  clip-path: polygon(50% 0, 61% 36%, 98% 36%, 68% 58%, 79% 95%, 50% 72%, 21% 95%, 32% 58%, 2% 36%, 39% 36%);
  animation: sparkFly 620ms ease-out forwards;
}

.gold-spark {
  width: 19px;
  height: 19px;
  filter: drop-shadow(0 0 13px rgba(255, 230, 77, 0.98));
}

.golden-glow {
  position: absolute;
  z-index: 11;
  width: 190px;
  height: 190px;
  pointer-events: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 244, 138, 0.78) 0 9%, rgba(255, 138, 29, 0.34) 24%, rgba(255, 79, 216, 0.18) 42%, transparent 66%);
  transform: translate(-50%, -50%) scale(0.25);
  animation: goldenGlow 520ms ease-out forwards;
}

.golden-live-sparkle {
  position: absolute;
  z-index: 7;
  width: 11px;
  height: 11px;
  pointer-events: none;
  background: #fff48a;
  clip-path: polygon(50% 0, 61% 36%, 98% 36%, 68% 58%, 79% 95%, 50% 72%, 21% 95%, 32% 58%, 2% 36%, 39% 36%);
  filter: drop-shadow(0 0 8px rgba(255, 230, 77, 0.95));
  transform: translate(-50%, -50%) scale(0.3);
  animation: goldenLiveSparkle 620ms ease-out forwards;
}

.golden-stat,
.final-score,
.best-score {
  margin-bottom: 8px;
}

.golden-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
}

.golden-stat-icon {
  width: 22px;
  height: 28px;
  border-radius: 52% 52% 47% 47%;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.95) 0 15%, transparent 24%),
    linear-gradient(145deg, #fff9b8, #ffe13a 44%, #ff9f05 82%);
  box-shadow: 0 0 13px rgba(255, 230, 77, 0.82);
  transform: rotate(-8deg);
}

.gold-count {
  color: #fff48a;
  text-shadow:
    0 3px 0 #ff8a1d,
    0 0 16px rgba(255, 230, 77, 0.9);
}

.golden-hunter {
  margin-top: -2px;
  margin-bottom: 10px;
  color: #fff48a;
  font-size: clamp(20px, 5vw, 34px);
  text-transform: uppercase;
  text-shadow:
    0 3px 0 #ff8a1d,
    0 0 20px rgba(255, 230, 77, 0.9);
  animation: newBestGlow 720ms ease-in-out infinite alternate;
}

.reward-pop .final-score {
  animation: finalScoreReward 720ms ease-out;
}

.rank-block {
  position: relative;
  z-index: 2;
  margin-bottom: 12px;
  text-align: center;
}

.rank-label {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 900;
  text-shadow: 0 3px 0 #3b147d, 0 7px 12px rgba(0, 0, 0, 0.28);
}

.new-best {
  margin-bottom: 12px;
  color: #ffe64d;
  font-size: clamp(25px, 6vw, 42px);
  text-transform: uppercase;
  animation: newBestGlow 720ms ease-in-out infinite alternate;
}

.rank {
  display: inline-block;
  margin-bottom: 0;
  padding: 13px 18px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.45), transparent 36%),
    linear-gradient(135deg, #ffe64d, #ff8a1d);
  color: #35126f;
  box-shadow: 0 8px 0 rgba(28, 7, 85, 0.75), 0 14px 26px rgba(0, 0, 0, 0.28);
  text-shadow: none;
}

.kabooom-master .rank {
  color: #ffffff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.5), transparent 36%),
    linear-gradient(135deg, #ff4fd8, #ffe64d 38%, #31daff 72%, #ff8a1d);
  font-size: clamp(25px, 6.5vw, 52px);
  text-shadow:
    0 3px 0 #5b1ba8,
    0 0 20px rgba(255, 230, 77, 0.95),
    0 0 38px rgba(255, 79, 216, 0.72);
  box-shadow:
    0 9px 0 rgba(28, 7, 85, 0.78),
    0 16px 30px rgba(0, 0, 0, 0.3),
    0 0 28px rgba(255, 230, 77, 0.84),
    0 0 48px rgba(49, 218, 255, 0.58);
  animation: masterRankPop 980ms ease-out, masterRankGlow 740ms ease-in-out infinite alternate;
}

.kabooom-master::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 244, 138, 0.5), transparent 24%),
    radial-gradient(circle at 32% 42%, rgba(255, 79, 216, 0.28), transparent 24%),
    radial-gradient(circle at 68% 42%, rgba(49, 218, 255, 0.26), transparent 26%);
  opacity: 0;
}

.reward-pop.kabooom-master::before {
  animation: masterScreenGlow 1450ms ease-out forwards;
}

.master-particle {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background: var(--particle-color);
  clip-path: polygon(50% 0, 61% 36%, 98% 36%, 68% 58%, 79% 95%, 50% 72%, 21% 95%, 32% 58%, 2% 36%, 39% 36%);
  filter: drop-shadow(0 0 13px rgba(255, 230, 77, 0.95));
  animation: masterParticleFly 1050ms ease-out forwards;
}

@keyframes slowSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sway {
  from {
    margin-left: calc(var(--sway) * -1px);
    rotate: -3deg;
  }
  to {
    margin-left: calc(var(--sway) * 1px);
    rotate: 3deg;
  }
}

@keyframes goldenPulse {
  from {
    scale: 0.96;
    filter: brightness(1.08) saturate(1.12);
  }
  to {
    scale: 1.06;
    filter: brightness(1.22) saturate(1.26);
  }
}

@keyframes goldenRing {
  from {
    opacity: 0.72;
    transform: scale(0.92) rotate(0deg);
  }
  to {
    opacity: 0.2;
    transform: scale(1.18) rotate(16deg);
  }
}

@keyframes popText {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.7) rotate(-9deg);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -128%) scale(1.5) rotate(8deg);
  }
}

@keyframes scoreFloat {
  from {
    opacity: 1;
    transform: translate(-50%, -10%) scale(0.85);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1.18);
  }
}

@keyframes kabooomText {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45) rotate(-8deg);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -72%) scale(1.18) rotate(5deg);
  }
  34% {
    transform: translate(-50%, -78%) scale(1.02) rotate(-2deg);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -158%) scale(1.34) rotate(-2deg);
  }
}

@keyframes goldenGlow {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.25);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.25);
  }
}

@keyframes goldenLiveSparkle {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.25) rotate(0deg);
  }
  28% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--sparkle-drift)), -95%) scale(1.1) rotate(150deg);
  }
}

@keyframes burstPop {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.18) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.15) rotate(28deg);
  }
}

@keyframes sparkFly {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.6) rotate(0deg);
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(160deg);
  }
}

@keyframes screenShake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(5px, -3px);
  }
  50% {
    transform: translate(-4px, 4px);
  }
  75% {
    transform: translate(3px, 3px);
  }
}

@keyframes goldenScreenShake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  18% {
    transform: translate(10px, -6px);
  }
  36% {
    transform: translate(-9px, 7px);
  }
  58% {
    transform: translate(7px, 6px);
  }
  78% {
    transform: translate(-5px, -4px);
  }
}

@keyframes scopeFire {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  45% {
    transform: translate(-50%, -50%) scale(0.82);
    filter: drop-shadow(0 0 18px rgba(255, 230, 77, 0.95));
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes scopeHit {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  35% {
    transform: translate(-50%, -50%) scale(1.22);
    filter: drop-shadow(0 0 22px rgba(255, 79, 216, 0.95));
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes comboBounce {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes comboLost {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  45% {
    transform: scale(0.94);
    filter: brightness(1.26);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes maxComboPulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  24% {
    transform: scale(1.32);
    filter: brightness(1.36) saturate(1.42);
  }
  48% {
    transform: scale(1.12);
    filter: brightness(1.18) saturate(1.24);
  }
  76% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes scoreBump {
  50% {
    transform: scale(1.08);
  }
}

@keyframes maxComboScoreGlow {
  0% {
    filter: brightness(1);
    box-shadow: 0 8px 0 rgba(28, 7, 85, 0.75), 0 14px 26px rgba(0, 0, 0, 0.28);
  }
  28% {
    filter: brightness(1.34) saturate(1.44);
    box-shadow:
      0 8px 0 rgba(28, 7, 85, 0.75),
      0 14px 26px rgba(0, 0, 0, 0.28),
      0 0 0 5px rgba(255, 244, 138, 0.52),
      0 0 34px rgba(255, 230, 77, 1),
      0 0 58px rgba(255, 138, 29, 0.82),
      0 0 42px rgba(255, 79, 216, 0.66);
  }
  62% {
    filter: brightness(1.12) saturate(1.16);
    box-shadow:
      0 8px 0 rgba(28, 7, 85, 0.75),
      0 14px 26px rgba(0, 0, 0, 0.28),
      0 0 22px rgba(255, 230, 77, 0.78),
      0 0 34px rgba(255, 138, 29, 0.46);
  }
  100% {
    filter: brightness(1);
    box-shadow: 0 8px 0 rgba(28, 7, 85, 0.75), 0 14px 26px rgba(0, 0, 0, 0.28);
  }
}

@keyframes maxComboBloom {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }
  22% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@keyframes maxComboScoreNumber {
  0% {
    color: #ffffff;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
  }
  30% {
    color: #fff48a;
    text-shadow:
      0 4px 0 #ff8a1d,
      0 0 18px rgba(255, 230, 77, 1),
      0 0 36px rgba(255, 79, 216, 0.68);
  }
  100% {
    color: #ffffff;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
  }
}

@keyframes maxComboLabelPop {
  0% {
    opacity: 0;
    transform: translate(-8px, -50%) scale(0.68) rotate(-5deg);
  }
  20% {
    opacity: 1;
    transform: translate(0, -50%) scale(1.14) rotate(3deg);
  }
  48% {
    transform: translate(0, -50%) scale(1) rotate(-1deg);
  }
  100% {
    opacity: 0;
    transform: translate(6px, -82%) scale(1.04) rotate(-1deg);
  }
}

@keyframes maxComboSparkFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.12) rotate(190deg);
  }
}

@keyframes dangerPulse {
  from {
    filter: saturate(1.08);
    transform: scale(1);
  }
  to {
    filter: saturate(1.38) brightness(1.08);
    transform: scale(1.035);
  }
}

@keyframes criticalPulse {
  from {
    filter: saturate(1.22) brightness(1.04);
    transform: scale(1.02);
  }
  to {
    filter: saturate(1.62) brightness(1.14);
    transform: scale(1.07);
  }
}

@keyframes comboCallout {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55) rotate(-7deg);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08) rotate(4deg);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -95%) scale(1.25) rotate(-2deg);
  }
}

@keyframes newBestGlow {
  from {
    transform: scale(1);
    text-shadow: 0 3px 0 #ff8a1d, 0 8px 18px rgba(255, 230, 77, 0.36);
  }
  to {
    transform: scale(1.08);
    text-shadow: 0 3px 0 #ff3164, 0 8px 26px rgba(255, 230, 77, 0.8);
  }
}

@keyframes finalScoreReward {
  0% {
    transform: scale(0.86);
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.32);
  }
  34% {
    transform: scale(1.18);
    color: #fff48a;
    text-shadow:
      0 4px 0 #ff8a1d,
      0 0 26px rgba(255, 230, 77, 0.92),
      0 0 42px rgba(255, 79, 216, 0.66);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes masterRankPop {
  0% {
    transform: scale(0.62) rotate(-5deg);
  }
  28% {
    transform: scale(1.22) rotate(3deg);
  }
  52% {
    transform: scale(0.96) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes masterRankGlow {
  from {
    filter: brightness(1) saturate(1.08);
  }
  to {
    filter: brightness(1.16) saturate(1.34);
  }
}

@keyframes masterScreenGlow {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0.72;
    transform: scale(1.1);
  }
}

@keyframes masterParticleFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.25) rotate(190deg);
  }
}

@keyframes endTitlePop {
  0% {
    opacity: 0;
    transform: scale(0.72) rotate(-5deg);
  }
  24% {
    opacity: 1;
    transform: scale(1.14) rotate(3deg);
  }
  46% {
    transform: scale(0.98) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@media (pointer: coarse) {
  body.playing,
  body.playing #gameArea,
  body.playing .balloon {
    cursor: default;
  }

  #crosshair {
    display: none;
  }
}

@media (max-width: 620px) {
  .screen {
    padding: 16px;
  }

  .music-button {
    top: calc(10px + env(safe-area-inset-top));
    right: auto;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    min-width: 82px;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 11px;
  }

  .music-button:active {
    transform: translateX(-50%) translateY(4px);
  }

  h1 {
    font-size: clamp(48px, 17vw, 82px);
  }

  h2 {
    margin-bottom: 10px;
  }

  p {
    margin-bottom: 14px;
    font-size: clamp(15px, 4vw, 20px);
  }

  .tagline {
    margin-top: 16px;
  }

  .start-best {
    margin-bottom: 14px;
    font-size: clamp(15px, 4vw, 18px);
  }

  .end-title {
    max-width: 86vw;
    font-size: clamp(37px, 12vw, 66px);
    text-shadow:
      0 4px 0 #ff8a1d,
      0 8px 0 #5b1ba8,
      0 0 22px rgba(255, 230, 77, 0.76),
      0 0 36px rgba(255, 79, 216, 0.62);
  }

  .end-title::before,
  .end-title::after {
    width: 38px;
    height: 38px;
  }

  .end-title::before {
    right: calc(100% + 2px);
  }

  .end-title::after {
    left: calc(100% + 2px);
  }

  .hud {
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
  }

  .hud-panel {
    min-width: clamp(98px, 31vw, 118px);
    padding: 8px;
    border-width: 2px;
  }

  .hud strong,
  #comboBar strong {
    font-size: clamp(27px, 8vw, 34px);
  }

  #comboBar {
    margin-top: 6px;
    padding-top: 6px;
    border-top-width: 2px;
  }

  #comboBar strong {
    font-size: clamp(20px, 6vw, 26px);
  }

  #comboMessage {
    font-size: 12px;
  }

  .max-combo-label {
    left: 8px;
    top: calc(100% + 12px);
    font-size: 12px;
    animation-name: maxComboLabelPopMobile;
  }

  .big-button {
    width: min(86vw, 280px);
    min-height: 58px;
    padding: 15px 24px 17px;
    font-size: clamp(24px, 8vw, 30px);
  }

  .golden-stat {
    justify-content: center;
    gap: 6px;
    max-width: 94vw;
    line-height: 1.1;
  }

  .golden-stat-icon {
    width: 18px;
    height: 23px;
    flex: 0 0 auto;
  }

  .golden-hunter,
  .new-best {
    font-size: clamp(19px, 5vw, 28px);
    margin-bottom: 8px;
  }

  .rank {
    max-width: 92vw;
    padding: 10px 14px;
    font-size: clamp(17px, 4.6vw, 22px);
  }

  .kabooom-master .rank {
    font-size: clamp(21px, 5.8vw, 31px);
  }
}

@media (max-width: 380px) {
  .screen {
    padding: 12px;
  }

  h1 {
    font-size: clamp(42px, 16vw, 62px);
  }

  .end-title {
    font-size: clamp(32px, 11vw, 48px);
  }

  .hud-panel {
    min-width: 92px;
    padding: 7px;
  }

  .label,
  #comboMessage {
    font-size: 11px;
  }

  .hud strong,
  #comboBar strong {
    font-size: 26px;
  }

  #comboBar strong {
    font-size: 22px;
  }

  .big-button {
    min-height: 54px;
  }

  p {
    margin-bottom: 10px;
  }
}

@keyframes maxComboLabelPopMobile {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.68) rotate(-5deg);
  }
  20% {
    opacity: 1;
    transform: translateY(0) scale(1.12) rotate(3deg);
  }
  48% {
    transform: translateY(0) scale(1) rotate(-1deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-12px) scale(1.03) rotate(-1deg);
  }
}
