*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.close-btn {
  position: fixed;
  top: max(0.55rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 6;
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(40, 40, 40, 0.85);
  color: rgba(255, 255, 255, 0.82);
  font: 600 1.35rem/1 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  opacity: 0.78;
  touch-action: manipulation;
  transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.close-btn:hover,
.close-btn:focus-visible {
  opacity: 1;
  color: #fff;
  background: rgba(70, 70, 70, 0.95);
  transform: scale(1.06);
  outline: none;
}

.hud {
  position: fixed;
  top: max(0.55rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(12, 12, 12, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.38);
  font: 500 0.62rem/1.1 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.42;
  cursor: auto;
  touch-action: manipulation;
  transition: opacity 0.25s ease;
}

.hud:hover,
.hud:focus-within {
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.72);
}

.hud__row,
.hud__hits {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.hud__label {
  opacity: 0.85;
}

.hud__slider {
  width: clamp(4.5rem, 14vw, 7rem);
  height: 1.1rem;
  margin: 0;
  cursor: pointer;
  accent-color: rgba(220, 220, 220, 0.7);
  background: transparent;
}

.hud__hits span:last-child {
  min-width: 1.5ch;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.55);
}

.hud:hover .hud__hits span:last-child,
.hud:focus-within .hud__hits span:last-child {
  color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 520px) {
  .hud {
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 0.75rem;
    gap: 0.45rem 0.75rem;
    padding: 0.4rem 0.55rem;
  }

  .hud__slider {
    width: 5.5rem;
  }
}
