:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #020617;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

main {
  position: fixed;
  inset: 0;
  isolation: isolate;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.speed,
.score {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  user-select: none;
  z-index: 3;
}

.speed {
  top: calc(14px + env(safe-area-inset-top));
  color: #e5e7eb;
  font-size: 13px;
}

.score {
  top: calc(36px + env(safe-area-inset-top));
  color: #fff;
  font-size: 15px;
}

.speed span:first-child,
.score span:first-child {
  color: #94a3b8;
  font-size: 11px;
}

.speed span:last-child,
.score span:last-child {
  min-width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fs {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.68);
  color: #e5e7eb;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  cursor: pointer;
  z-index: 4;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.fs:active {
  transform: scale(0.95);
  background: rgba(30, 41, 59, 0.9);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(34, 197, 94, 0.14), transparent 30%),
    rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  margin: 0;
  font-size: clamp(38px, 8vw, 64px);
  line-height: 1;
  letter-spacing: 0.04em;
  color: #4ade80;
}

.overlay p {
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .speed,
  .score {
    left: calc(16px + env(safe-area-inset-left));
  }

  .speed {
    top: calc(10px + env(safe-area-inset-top));
    font-size: 12px;
  }

  .score {
    top: calc(30px + env(safe-area-inset-top));
    font-size: 14px;
  }

  .fs {
    top: calc(8px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    width: 36px;
    height: 36px;
  }
}
