:root {
  color-scheme: dark;
  --bg: #0f1020;
  --panel: #1a1b28;
  --panel-2: #212233;
  --accent: #6842ff;
  --accent-2: #8a6dff;
  --orange: #ff7a1a;
  --text: #fff;
  --muted: #aaadbe;
  --line: rgba(255, 255, 255, 0.08);
  font-family:
    "Nunito",
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
body {
  padding: 8px;
}
button {
  font: inherit;
}
.hs-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.hs-shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* HUD */
.hs-hud {
  width: 100%;
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.hs-chip {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #26273a, var(--panel));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 4px 10px rgba(0, 0, 0, 0.25);
  line-height: 1.05;
  transition: transform 0.15s ease;
}
.hs-chip span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hs-chip strong {
  font-size: 19px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.hs-chip.is-bump {
  animation: hs-bump 0.35s ease;
}
.hs-chip.is-warn strong {
  color: #ff5d6c;
}
.hs-chip-streak.is-fire {
  background: linear-gradient(180deg, #ff9a2e, #e8430f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 18px rgba(255, 110, 30, 0.6);
}
.hs-chip-streak.is-fire span {
  color: #fff3c4;
}
.hs-icon-button {
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #2a2b3d;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 10px rgba(0, 0, 0, 0.25);
}
.hs-icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.hs-icon-button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Stage */
.hs-stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 480 / 560;
  border-radius: 22px;
  overflow: hidden;
  background: #16172a;
  box-shadow:
    0 0 0 1px var(--line),
    0 18px 40px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.hs-stage.is-shake {
  animation: hs-shake 0.32s ease;
}
#hs-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  outline: none;
}
#hs-canvas:active {
  cursor: grabbing;
}
.hs-stage:has(#hs-canvas:focus-visible) {
  box-shadow:
    0 0 0 3px var(--accent-2),
    0 18px 40px rgba(0, 0, 0, 0.45);
}

/* Overlays */
.hs-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(24, 16, 60, 0.55),
    rgba(8, 8, 20, 0.82)
  );
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.hs-overlay[hidden] {
  display: none;
}
.hs-card {
  width: min(340px, 100%);
  text-align: center;
  padding: 20px 18px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #262740, var(--panel));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 20px 50px rgba(0, 0, 0, 0.5);
  animation: hs-pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.hs-logo {
  display: grid;
  place-items: center;
  margin: -4px auto 4px;
}
.hs-logo-ball {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(
      circle at 32% 28%,
      rgba(255, 255, 255, 0.75) 0 8%,
      transparent 26%
    ),
    linear-gradient(90deg, transparent 47%, #5a1f00 47% 53%, transparent 53%),
    linear-gradient(0deg, transparent 47%, #5a1f00 47% 53%, transparent 53%),
    radial-gradient(circle at 40% 35%, #ffb25a, #ff7a1a 45%, #c24400 100%);
  box-shadow:
    0 10px 20px rgba(255, 110, 20, 0.35),
    inset -6px -8px 14px rgba(90, 20, 0, 0.45);
  animation: hs-bounce 1.2s ease-in-out infinite;
}
.hs-title {
  margin: 0;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1;
  background: linear-gradient(180deg, #fff 30%, #ffc98a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #c24400)
    drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));
}
.hs-title-small {
  font-size: 32px;
  margin-bottom: 14px;
}
.hs-lead {
  margin: 10px 0 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
}
.hs-modes,
.hs-actions {
  display: grid;
  gap: 10px;
}
.hs-button {
  min-height: 48px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: #2a2b3d;
  color: var(--text);
  font-weight: 900;
  font-size: 17px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 0 #17182a,
    0 8px 16px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease,
    filter 0.15s ease;
}
.hs-button:hover {
  filter: brightness(1.1);
}
.hs-button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 #17182a;
}
.hs-button-primary {
  background: linear-gradient(180deg, #8163ff, var(--accent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 4px 0 #3f22b8,
    0 8px 18px rgba(104, 66, 255, 0.4);
}
.hs-button-primary:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 1px 0 #3f22b8;
}
.hs-button-orange {
  background: linear-gradient(180deg, #ff9b45, #f06414);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 0 #a83d00,
    0 8px 18px rgba(255, 110, 30, 0.35);
}
.hs-button-orange:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 0 #a83d00;
}
.hs-modes .hs-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
}
.hs-mode-best {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}
.hs-keys {
  margin: 14px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: #2a2b3d;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  font: inherit;
  font-weight: 900;
  color: var(--text);
}
.hs-over-kicker {
  margin: 0;
  font-weight: 900;
  font-size: 22px;
  color: #ffc98a;
}
.hs-over-score {
  margin: 4px 0 0;
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 4px 0 #3f22b8,
    0 10px 24px rgba(104, 66, 255, 0.55);
}
.hs-newbest {
  display: inline-block;
  margin: 10px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe066, #ffb800);
  color: #4a2c00;
  font-weight: 900;
  font-size: 13px;
  animation: hs-bump 0.6s ease 0.2s both;
}
.hs-newbest[hidden] {
  display: none;
}
.hs-over-stats {
  margin: 10px 0 16px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.hs-help {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}
.hs-help-keys {
  margin-left: 6px;
  white-space: nowrap;
}

button:focus-visible {
  outline: 3px solid #b9a8ff;
  outline-offset: 3px;
}

@keyframes hs-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes hs-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}
@keyframes hs-pop-in {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes hs-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@media (max-width: 400px) {
  .hs-chip strong {
    font-size: 16px;
  }
  .hs-chip span {
    font-size: 9px;
  }
  .hs-title {
    font-size: 34px;
  }
  .hs-help-keys {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
