@import url("https://fonts.googleapis.com/css2?family=Oxanium:wght@400;500;600;700;800;900&display=swap");

:root {
  --bg: #343a42;
  --text: #162033;
  --muted: #c9d1dc;
  --panel: #f2f5f9;
  --line: #c9d3df;
  --button: #d71920;
  --button-dark: #a50f15;
  --button-hot: #ff4a52;
  --light-off: #b9c2ce;
  --light-on: #ffd447;
  --light-core: #fff3a2;
  --good: #176f4d;
  --warn: #b34b00;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: #f8fafc;
  font-family: "Oxanium", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sound-controls {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  width: 40px;
  display: grid;
  grid-template-columns: auto;
  justify-items: center;
  gap: 5px;
  padding: 2px 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(39, 47, 57, 0.9);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
}

.sound-toggle {
  width: 34px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(184, 243, 209, 0.34);
  border-radius: 6px;
  background: rgba(55, 65, 77, 0.94);
  color: #f8fafc;
  cursor: pointer;
}

.sound-toggle[aria-pressed="true"] {
  border-color: rgba(255, 161, 161, 0.4);
  color: #ffd1d1;
}

.sound-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-icon-off,
.sound-toggle[aria-pressed="true"] .sound-icon-on {
  display: none;
}

.sound-toggle[aria-pressed="true"] .sound-icon-off {
  display: block;
}

.sound-toggle:focus-visible,
.sound-volume:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.9);
  outline-offset: 2px;
}

.sound-volume {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 16px;
  accent-color: #b8f3d1;
  cursor: pointer;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  margin: 0;
}

.sound-volume-track {
  position: relative;
  width: 34px;
  height: 150px;
  overflow: visible;
}

.app {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.game {
  width: min(820px, 100%);
  height: 100%;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.header {
  position: relative;
  z-index: 10;
  text-align: center;
}

h1 {
  margin: 0 0 6px;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
}

.header-blocks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.instruction-block,
.message-block {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(39, 47, 57, 0.48);
  text-align: left;
}

.instruction-block {
  min-height: 58px;
}

.message-block {
  min-height: 132px;
  display: grid;
  place-items: center;
  padding: 10px 16px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(45, 51, 59, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 16px 44px rgba(15, 23, 42, 0.32);
  text-align: center;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  text-transform: uppercase;
}

.instruction-block p {
  margin: 5px 0 0;
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.45;
}

.message-block .status {
  margin: 0;
  color: #f8fafc;
  font-size: 58px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 12px rgba(125, 211, 252, 0.35);
  white-space: nowrap;
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(80px, 0.72fr) minmax(150px, 1fr);
  row-gap: 10px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
  user-select: none;
  touch-action: manipulation;
  overflow: visible;
}

.best-overlay {
  position: absolute;
  inset: -18px;
  z-index: 8;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.best-overlay.is-showing {
  opacity: 1;
}

.hit-marker {
  position: absolute;
  width: 104px;
  height: 104px;
  opacity: 0;
}

.hit-marker::before,
.hit-marker::after {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 96px;
  height: 5px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow:
    0 0 6px rgba(255, 255, 255, 0.82),
    0 0 12px rgba(255, 48, 56, 0.68);
  content: "";
  transform-origin: center;
}

.hit-marker::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.hit-marker::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.best-overlay.is-showing .hit-marker-main {
  animation: hit-pop 980ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.best-overlay.is-showing .hit-marker-echo {
  animation: hit-echo 1250ms 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.best-callout {
  position: absolute;
  top: 42%;
  padding: 8px 14px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: rgba(20, 24, 30, 0.92);
  color: #ffffff;
  font-size: 62px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    2px 2px 0 #000000,
    0 0 16px rgba(255, 48, 56, 0.92);
  transform: translateY(-50%) rotate(-3deg) scale(0.6);
  opacity: 0;
}

.best-overlay.is-inhuman .best-callout {
  top: 40%;
  padding: 12px 18px;
  border-color: rgba(255, 255, 255, 0.96);
  background: rgba(12, 16, 20, 0.96);
  color: #fff8d5;
  font-size: 58px;
  text-shadow:
    3px 3px 0 #000000,
    0 0 18px rgba(255, 255, 255, 0.95),
    0 0 34px rgba(255, 212, 71, 0.95),
    0 0 58px rgba(255, 48, 56, 0.82);
  box-shadow:
    0 0 28px rgba(255, 255, 255, 0.28),
    0 0 62px rgba(255, 48, 56, 0.42);
}

.best-overlay.is-fast .best-callout,
.best-overlay.is-elite .best-callout,
.best-overlay.is-ultra .best-callout {
  top: 40%;
  padding: 10px 16px;
  background: rgba(12, 16, 20, 0.94);
}

.best-overlay.is-fast .best-callout {
  border-color: rgba(184, 243, 209, 0.9);
  color: #d8ffe9;
  font-size: 54px;
  text-shadow:
    2px 2px 0 #000000,
    0 0 20px rgba(184, 243, 209, 0.78),
    0 0 36px rgba(74, 222, 128, 0.5);
}

.best-overlay.is-elite .best-callout {
  border-color: rgba(125, 211, 252, 0.95);
  color: #dff7ff;
  font-size: 56px;
  text-shadow:
    2px 2px 0 #000000,
    0 0 22px rgba(125, 211, 252, 0.88),
    0 0 42px rgba(56, 189, 248, 0.62);
  box-shadow: 0 0 44px rgba(56, 189, 248, 0.22);
}

.best-overlay.is-ultra .best-callout {
  border-color: rgba(255, 212, 71, 0.98);
  color: #fff4b8;
  font-size: 52px;
  text-shadow:
    3px 3px 0 #000000,
    0 0 24px rgba(255, 212, 71, 0.9),
    0 0 50px rgba(255, 48, 56, 0.58);
  box-shadow:
    0 0 34px rgba(255, 212, 71, 0.24),
    0 0 56px rgba(255, 48, 56, 0.28);
}

.best-overlay.is-showing .best-callout {
  animation: callout-slam 1850ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.firework {
  position: absolute;
  width: 340px;
  height: 340px;
  opacity: 0;
  --burst-delay: 120ms;
  --spark-distance: 188px;
  --spark-size: 104px;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.38));
}

.firework-left {
  top: 38%;
  left: -7%;
  --burst-delay: 110ms;
}

.firework-right {
  top: 39%;
  right: -7%;
  --burst-delay: 210ms;
}

.firework-top-left {
  top: 4%;
  left: 12%;
  --burst-delay: 310ms;
  --spark-distance: 166px;
}

.firework-top-right {
  top: 4%;
  right: 12%;
  --burst-delay: 390ms;
  --spark-distance: 166px;
}

.firework-bottom {
  top: 62%;
  left: 50%;
  margin-left: -170px;
  --burst-delay: 480ms;
  --spark-distance: 176px;
}

.firework-top-left,
.firework-top-right,
.firework-bottom {
  visibility: hidden;
}

.best-overlay.is-fast .firework-top-left,
.best-overlay.is-elite .firework-top-left,
.best-overlay.is-ultra .firework-top-left,
.best-overlay.is-inhuman .firework-top-left,
.best-overlay.is-elite .firework-top-right,
.best-overlay.is-ultra .firework-top-right,
.best-overlay.is-inhuman .firework-top-right,
.best-overlay.is-ultra .firework-bottom,
.best-overlay.is-inhuman .firework-bottom {
  visibility: visible;
}

.best-overlay.is-fast .firework {
  width: 360px;
  height: 360px;
  --spark-distance: 202px;
  --spark-size: 112px;
  filter: drop-shadow(0 0 16px rgba(184, 243, 209, 0.46));
}

.best-overlay.is-elite .firework {
  width: 380px;
  height: 380px;
  --spark-distance: 218px;
  --spark-size: 120px;
  filter:
    drop-shadow(0 0 17px rgba(255, 255, 255, 0.52))
    drop-shadow(0 0 28px rgba(125, 211, 252, 0.42));
}

.best-overlay.is-ultra .firework {
  width: 405px;
  height: 405px;
  --spark-distance: 234px;
  --spark-size: 126px;
  filter:
    drop-shadow(0 0 18px rgba(255, 255, 255, 0.62))
    drop-shadow(0 0 32px rgba(255, 212, 71, 0.46));
}

.best-overlay.is-fast .firework-bottom {
  margin-left: -180px;
}

.best-overlay.is-elite .firework-bottom {
  margin-left: -190px;
}

.best-overlay.is-ultra .firework-bottom {
  margin-left: -202px;
}

.best-overlay.is-inhuman .firework {
  width: 430px;
  height: 430px;
  --spark-distance: 248px;
  --spark-size: 132px;
  filter:
    drop-shadow(0 0 18px rgba(255, 255, 255, 0.72))
    drop-shadow(0 0 34px rgba(255, 212, 71, 0.48));
}

.best-overlay.is-inhuman .firework-left {
  left: -12%;
}

.best-overlay.is-inhuman .firework-right {
  right: -12%;
}

.best-overlay.is-inhuman .firework-top-left {
  top: 0;
  left: 7%;
}

.best-overlay.is-inhuman .firework-top-right {
  top: 0;
  right: 7%;
}

.best-overlay.is-inhuman .firework-bottom {
  margin-left: -215px;
}

.firework::before,
.firework::after {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 16px rgba(255, 255, 255, 0.95),
    0 0 26px rgba(255, 212, 71, 0.75);
  content: "";
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.1);
}

.firework::after {
  width: 210px;
  height: 210px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  box-shadow:
    0 0 18px rgba(255, 255, 255, 0.5),
    inset 0 0 16px rgba(255, 255, 255, 0.2);
}

.best-overlay.is-fast .firework::before {
  width: 16px;
  height: 16px;
}

.best-overlay.is-fast .firework::after {
  width: 230px;
  height: 230px;
}

.best-overlay.is-elite .firework::before {
  width: 18px;
  height: 18px;
}

.best-overlay.is-elite .firework::after {
  width: 250px;
  height: 250px;
  border-color: rgba(125, 211, 252, 0.82);
  box-shadow:
    0 0 22px rgba(255, 255, 255, 0.62),
    inset 0 0 20px rgba(125, 211, 252, 0.22);
}

.best-overlay.is-ultra .firework::before {
  width: 19px;
  height: 19px;
  box-shadow:
    0 0 20px rgba(255, 255, 255, 0.98),
    0 0 34px rgba(255, 212, 71, 0.82);
}

.best-overlay.is-ultra .firework::after {
  width: 270px;
  height: 270px;
  border-color: rgba(255, 212, 71, 0.86);
  box-shadow:
    0 0 24px rgba(255, 255, 255, 0.7),
    inset 0 0 22px rgba(255, 212, 71, 0.26),
    0 0 46px rgba(255, 48, 56, 0.24);
}

.best-overlay.is-inhuman .firework::before {
  width: 20px;
  height: 20px;
  box-shadow:
    0 0 22px rgba(255, 255, 255, 1),
    0 0 40px rgba(255, 212, 71, 0.95),
    0 0 72px rgba(255, 48, 56, 0.78);
}

.best-overlay.is-inhuman .firework::after {
  width: 290px;
  height: 290px;
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 26px rgba(255, 255, 255, 0.82),
    inset 0 0 24px rgba(255, 255, 255, 0.3),
    0 0 54px rgba(255, 212, 71, 0.42);
}

.firework span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--spark-size);
  height: 5px;
  border-radius: 999px;
  opacity: 0;
  transform-origin: left center;
  --spark-color: #ffffff;
  --spark-glow: rgba(125, 211, 252, 0.78);
  --spark-angle: 0deg;
  --spark-delay: 0ms;
  background: linear-gradient(90deg, transparent 0%, var(--spark-color) 42%, #ffffff 100%);
  box-shadow:
    0 0 9px rgba(255, 255, 255, 0.95),
    0 0 20px var(--spark-glow);
}

.best-overlay.is-inhuman .firework span {
  height: 7px;
  box-shadow:
    0 0 13px rgba(255, 255, 255, 1),
    0 0 30px var(--spark-glow),
    0 0 54px var(--spark-glow);
}

.best-overlay.is-fast .firework span {
  height: 6px;
}

.best-overlay.is-elite .firework span,
.best-overlay.is-ultra .firework span {
  height: 6px;
  box-shadow:
    0 0 11px rgba(255, 255, 255, 0.98),
    0 0 25px var(--spark-glow),
    0 0 40px var(--spark-glow);
}

.firework span:nth-child(1) {
  --spark-angle: -90deg;
  --spark-delay: 0ms;
}

.firework span:nth-child(2) {
  --spark-angle: -60deg;
  --spark-color: #ffd447;
  --spark-glow: rgba(255, 212, 71, 0.8);
  --spark-delay: 30ms;
}

.firework span:nth-child(3) {
  --spark-angle: -30deg;
  --spark-color: #7dd3fc;
  --spark-glow: rgba(125, 211, 252, 0.82);
  --spark-delay: 55ms;
}

.firework span:nth-child(4) {
  --spark-angle: 0deg;
  --spark-color: #ffeff2;
  --spark-glow: rgba(255, 255, 255, 0.82);
  --spark-delay: 20ms;
}

.firework span:nth-child(5) {
  --spark-angle: 30deg;
  --spark-color: #ff5c64;
  --spark-glow: rgba(255, 48, 56, 0.76);
  --spark-delay: 70ms;
}

.firework span:nth-child(6) {
  --spark-angle: 60deg;
  --spark-color: #ffd447;
  --spark-glow: rgba(255, 212, 71, 0.82);
  --spark-delay: 45ms;
}

.firework span:nth-child(7) {
  --spark-angle: 90deg;
  --spark-color: #ffffff;
  --spark-delay: 10ms;
}

.firework span:nth-child(8) {
  --spark-angle: 120deg;
  --spark-color: #7dd3fc;
  --spark-glow: rgba(125, 211, 252, 0.78);
  --spark-delay: 80ms;
}

.firework span:nth-child(9) {
  --spark-angle: 150deg;
  --spark-color: #ffd447;
  --spark-glow: rgba(255, 212, 71, 0.78);
  --spark-delay: 35ms;
}

.firework span:nth-child(10) {
  --spark-angle: 180deg;
  --spark-color: #ffffff;
  --spark-delay: 65ms;
}

.firework span:nth-child(11) {
  --spark-angle: 220deg;
  --spark-color: #ff5c64;
  --spark-glow: rgba(255, 48, 56, 0.72);
  --spark-delay: 95ms;
}

.firework span:nth-child(12) {
  --spark-angle: 260deg;
  --spark-color: #7dd3fc;
  --spark-glow: rgba(125, 211, 252, 0.78);
  --spark-delay: 25ms;
}

.best-overlay.is-showing .firework {
  animation: firework-shell 2200ms var(--burst-delay) ease-out both;
}

.best-overlay.is-showing .firework::before {
  animation: firework-core 900ms var(--burst-delay) ease-out both;
}

.best-overlay.is-showing .firework::after {
  animation: firework-ring 1200ms calc(var(--burst-delay) + 40ms) ease-out both;
}

.best-overlay.is-showing .firework span {
  animation: firework-spark 1680ms calc(var(--burst-delay) + var(--spark-delay)) cubic-bezier(0.14, 0.86, 0.2, 1) both;
}

.particle-burst {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
}

.particle-burst span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.95),
    0 0 18px rgba(255, 48, 56, 0.72);
}

.particle-burst span:nth-child(3n) {
  background: #ff3038;
}

.particle-burst span:nth-child(3n + 1) {
  background: #7dd3fc;
}

.best-overlay.is-showing .particle-burst {
  animation: particles-shell 1700ms 120ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(1) {
  animation: particle-1 1400ms 120ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(2) {
  animation: particle-2 1450ms 130ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(3) {
  animation: particle-3 1380ms 150ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(4) {
  animation: particle-4 1500ms 115ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(5) {
  animation: particle-5 1420ms 160ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(6) {
  animation: particle-6 1520ms 130ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(7) {
  animation: particle-7 1340ms 180ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(8) {
  animation: particle-8 1460ms 140ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(9) {
  animation: particle-9 1500ms 165ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(10) {
  animation: particle-10 1380ms 190ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(11) {
  animation: particle-11 1440ms 125ms ease-out both;
}

.best-overlay.is-showing .particle-burst span:nth-child(12) {
  animation: particle-12 1540ms 155ms ease-out both;
}

@keyframes hit-pop {
  0% {
    opacity: 0;
    transform: scale(0.25) rotate(0deg);
  }
  18% {
    opacity: 1;
    transform: scale(1.18) rotate(0deg);
  }
  42% {
    opacity: 1;
    transform: scale(0.94) rotate(8deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.65) rotate(14deg);
  }
}

@keyframes hit-echo {
  0% {
    opacity: 0;
    transform: scale(0.45);
  }
  32% {
    opacity: 0.58;
    transform: scale(1.35);
  }
  100% {
    opacity: 0;
    transform: scale(2.05);
  }
}

@keyframes callout-slam {
  0% {
    opacity: 0;
    transform: translateY(-50%) rotate(-8deg) scale(0.35);
  }
  14% {
    opacity: 1;
    transform: translateY(-50%) rotate(4deg) scale(1.18);
  }
  28% {
    transform: translateY(-50%) rotate(-3deg) scale(1);
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-80%) rotate(3deg) scale(1.08);
  }
}

@keyframes particles-shell {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.12) rotate(36deg);
  }
}

@keyframes firework-shell {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.42);
  }
  12% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-16px) scale(1.08);
  }
}

@keyframes firework-core {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.1);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  62% {
    opacity: 0.35;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
  }
}

@keyframes firework-ring {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
  }
  18% {
    opacity: 0.46;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes firework-spark {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--spark-angle)) translateX(4px) scaleX(0.04);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--spark-angle)) translateX(18px) scaleX(0.92);
  }
  56% {
    opacity: 0.88;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--spark-angle)) translateX(var(--spark-distance)) scaleX(0.08);
  }
}

@keyframes particle-1 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(124px, -106px) scale(0.15); }
}

@keyframes particle-2 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(182px, -24px) scale(0.2); }
}

@keyframes particle-3 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(126px, 96px) scale(0.16); }
}

@keyframes particle-4 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(22px, 154px) scale(0.18); }
}

@keyframes particle-5 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-112px, 116px) scale(0.14); }
}

@keyframes particle-6 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-178px, 18px) scale(0.22); }
}

@keyframes particle-7 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-118px, -98px) scale(0.15); }
}

@keyframes particle-8 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-16px, -162px) scale(0.2); }
}

@keyframes particle-9 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(72px, -148px) scale(0.12); }
}

@keyframes particle-10 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(164px, 54px) scale(0.17); }
}

@keyframes particle-11 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-58px, 166px) scale(0.19); }
}

@keyframes particle-12 {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-164px, -48px) scale(0.13); }
}

@keyframes horn-left {
  0% {
    opacity: 0;
    transform: translate(-34px, 18px) rotate(-28deg) scale(0.55);
  }
  18% {
    opacity: 1;
    transform: translate(0, 0) rotate(-18deg) scale(1.06);
  }
  36% {
    transform: translate(5px, -2px) rotate(-12deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-8px, -38px) rotate(-24deg) scale(0.9);
  }
}

@keyframes horn-right {
  0% {
    opacity: 0;
    transform: translate(34px, 18px) scaleX(-1) rotate(-28deg) scale(0.55);
  }
  18% {
    opacity: 1;
    transform: translate(0, 0) scaleX(-1) rotate(-18deg) scale(1.06);
  }
  36% {
    transform: translate(-5px, -2px) scaleX(-1) rotate(-12deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(8px, -38px) scaleX(-1) rotate(-24deg) scale(0.9);
  }
}

.bulb {
  position: relative;
  z-index: 4;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  transform: translateY(-4px);
}

.bulb::before {
  position: absolute;
  z-index: 3;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(99, 255, 146, 0.36) 0 11%, rgba(45, 218, 94, 0.19) 27%, rgba(20, 175, 73, 0.08) 45%, rgba(20, 175, 73, 0.028) 63%, rgba(20, 175, 73, 0) 82%);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
  filter: blur(14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.bulb::after {
  position: absolute;
  z-index: 3;
  width: 760px;
  height: 760px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(91, 255, 137, 0.12) 0 18%, rgba(42, 218, 91, 0.05) 40%, rgba(20, 175, 73, 0.018) 60%, rgba(20, 175, 73, 0) 84%);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
  filter: blur(38px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.bulb svg {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.panel-shadow {
  fill: rgba(0, 0, 0, 0.32);
  transform: translate(0, 3px);
}

.panel-bezel {
  fill: url(#panel-bezel);
}

.panel-inner {
  fill: #303740;
}

.panel-lens {
  fill: url(#panel-lens-off);
}

.is-lit.bulb::before {
  opacity: 1;
  transform: scale(1);
}

.is-lit.bulb::after {
  opacity: 1;
  transform: scale(1);
}

.is-lit .panel-lens {
  fill: url(#panel-lens-on);
  filter:
    drop-shadow(0 0 15px rgba(93, 255, 140, 0.82))
    drop-shadow(0 0 34px rgba(35, 216, 93, 0.58));
}


.reaction-button {
  position: relative;
  z-index: 1;
  width: min(220px, 43dvh);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle at 36% 22%, rgba(255, 255, 255, 0.62) 0 12%, rgba(255, 255, 255, 0.16) 22%, transparent 36%),
    radial-gradient(circle at 50% 38%, #ff6b72 0 25%, var(--button-hot) 26% 46%, #ed161f 47% 68%, #9b070d 69% 100%);
  box-shadow:
    inset 0 22px 32px rgba(255, 255, 255, 0.28),
    inset 0 -28px 38px rgba(74, 0, 0, 0.46),
    0 24px 0 #64090d,
    0 42px 48px rgba(20, 2, 5, 0.46),
    0 0 34px rgba(255, 44, 54, 0.34);
  cursor: pointer;
  outline-offset: 8px;
  transform: translateY(-8px);
  transition: transform 80ms ease, box-shadow 80ms ease;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.reaction-button::before {
  position: absolute;
  inset: -13px;
  z-index: -1;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.16)),
    #a80f16;
  box-shadow:
    inset 0 4px 8px rgba(255, 255, 255, 0.14),
    inset 0 -10px 18px rgba(0, 0, 0, 0.28);
  content: "";
}

.reaction-button::after {
  position: absolute;
  inset: 14%;
  z-index: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 20%, rgba(255, 255, 255, 0.34), transparent 23%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 54%);
  content: "";
  pointer-events: none;
}

.reaction-button:active,
.is-pressed .reaction-button {
  transform: translateY(8px);
  box-shadow:
    inset 0 14px 24px rgba(255, 255, 255, 0.14),
    inset 0 -12px 24px rgba(67, 0, 0, 0.4),
    0 8px 0 #64090d,
    0 22px 30px rgba(20, 2, 5, 0.38),
    0 0 24px rgba(255, 44, 54, 0.28);
}

.button-ring {
  display: none;
}

.button-label {
  position: relative;
  z-index: 3;
  display: inline-block;
  max-width: 74%;
  font-size: 42px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 10px rgba(72, 0, 0, 0.45);
}

.info-panel {
  position: relative;
  z-index: 10;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(39, 47, 57, 0.48);
  box-shadow: 0 18px 48px rgba(18, 24, 32, 0.2);
}

.measurements {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  min-width: 0;
  min-height: 50px;
  display: grid;
  align-content: center;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05)),
    rgba(23, 31, 41, 0.34);
}

.metric-best {
  box-shadow: inset 4px 0 0 #ffd447;
}

.metric-runs {
  box-shadow: inset 4px 0 0 #7dd3fc;
}

.metric-median {
  box-shadow: inset 4px 0 0 #b8f3d1;
}

.metric-current {
  box-shadow: inset 4px 0 0 #ffffff;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: #ffffff;
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.state-waiting .message-block {
  color: #ffe1b8;
  border-color: rgba(255, 225, 184, 0.42);
}

.state-waiting .status {
  color: #ffe1b8;
}

.state-active .message-block,
.state-result .message-block {
  border-color: rgba(184, 243, 209, 0.42);
}

.state-active .status,
.state-result .status {
  color: #b8f3d1;
}

@media (max-width: 640px) {
  .app {
    padding: 10px;
  }

  .game {
    gap: 8px;
  }

  h1 {
    font-size: 32px;
  }

  .header-blocks {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .instruction-block,
  .message-block {
    min-height: 0;
    padding: 7px 9px;
  }

  .instruction-block p {
    font-size: 12px;
    line-height: 1.3;
  }

  .message-block .status {
    font-size: 36px;
  }

  .measurements {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .stage {
    grid-template-rows: minmax(58px, 0.62fr) minmax(132px, 1fr);
    row-gap: 6px;
  }

  .bulb {
    width: 78px;
    height: 78px;
  }

  .bulb::before {
    width: 430px;
    height: 430px;
  }

  .bulb::after {
    width: 560px;
    height: 560px;
  }

  .reaction-button {
    width: min(176px, 34dvh);
  }

  .button-label {
    font-size: 32px;
  }

  .info-panel {
    padding: 7px;
  }

  .metric {
    min-height: 38px;
    padding: 6px 8px;
  }

  .metric strong {
    font-size: 18px;
  }

  .best-callout {
    font-size: 44px;
  }

  .best-overlay.is-fast .best-callout,
  .best-overlay.is-elite .best-callout,
  .best-overlay.is-ultra .best-callout,
  .best-overlay.is-inhuman .best-callout {
    font-size: 34px;
  }
}

@media (max-height: 720px) {
  .app {
    padding: 8px;
  }

  .game {
    gap: 8px;
  }

  h1 {
    font-size: 32px;
    margin-bottom: 4px;
  }

  .instruction-block,
  .message-block {
    min-height: 0;
    padding: 7px 9px;
  }

  .instruction-block p {
    font-size: 12px;
    line-height: 1.3;
  }

  .message-block .status {
    font-size: 34px;
  }

  .bulb {
    width: 78px;
    height: 78px;
  }

  .bulb::before {
    width: 430px;
    height: 430px;
  }

  .bulb::after {
    width: 560px;
    height: 560px;
  }

  .reaction-button {
    width: min(176px, 34dvh);
  }

  .button-label {
    font-size: 32px;
  }

  .info-panel,
  .metric {
    padding: 7px;
  }

  .metric {
    min-height: 38px;
  }

  .metric strong {
    font-size: 18px;
  }

  .best-callout {
    font-size: 44px;
  }

  .best-overlay.is-fast .best-callout,
  .best-overlay.is-elite .best-callout,
  .best-overlay.is-ultra .best-callout,
  .best-overlay.is-inhuman .best-callout {
    font-size: 34px;
  }
}

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