* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1a0828;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  font-family: "SF Pro Rounded", ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

#app {
  position: fixed;
  left: 0;
  top: 0;
  overflow: hidden;
  background: #241048;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#safe-probe {
  position: absolute;
  left: 0;
  top: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  visibility: hidden;
  pointer-events: none;
}

#hud {
  position: absolute;
  z-index: 3;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(16px + env(safe-area-inset-left));
  right: calc(68px + env(safe-area-inset-right));
  pointer-events: none;
}

#hud[hidden] { display: none !important; }

.score-label, .best {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.8);
}

.score-num {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.score-num.pop { animation: pop 0.16s ease-out; }

.best { margin-top: 2px; }

.best.hot { color: #ffd36a; }

.mute {
  position: absolute;
  z-index: 5;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(20, 8, 28, 0.42);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.mute svg { width: 22px; height: 22px; display: block; }
.mute .icon-on { display: none; }
.mute[aria-pressed="true"] .icon-off { display: none; }
.mute[aria-pressed="true"] .icon-on { display: block; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(16px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
}

.screen[hidden] { display: none !important; }

#over { background: rgba(16, 4, 24, 0.34); }

#start {
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.title-block {
  position: relative;
  width: 100%;
  margin-top: calc(4px + env(safe-area-inset-top));
  padding: 0 62px;
  text-align: center;
  pointer-events: none;
}

h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(44px, 16vw, 80px);
  line-height: 0.84;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.zig {
  color: #fff;
  text-shadow: 0 4px 0 rgba(80, 20, 40, 0.28), 0 14px 28px rgba(0, 0, 0, 0.25);
}

.dash {
  color: #ff8fb8;
  text-shadow: 0 4px 0 rgba(120, 20, 60, 0.25), 0 14px 28px rgba(0, 0, 0, 0.2);
}

.start-foot {
  position: relative;
  margin-top: 12px;
  text-align: center;
  pointer-events: none;
}

.prompt {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  animation: pulse 1.35s ease-in-out infinite;
}

.start-best {
  margin: 8px 0 0;
  color: #ffd36a;
  font-weight: 800;
  font-size: 16px;
}

.card {
  width: min(86vw, 340px);
  background: rgba(28, 10, 40, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  padding: 26px 22px 18px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.over-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffd36a;
}

.final {
  margin: 4px 0 0;
  font-size: clamp(56px, 18vw, 76px);
  font-weight: 800;
  line-height: 0.95;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.like-line, .best-line {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  font-size: 16px;
}

#again {
  margin-top: 18px;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff9cbc 0%, #f24d86 100%);
  color: #fff;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 5px 0 #b4235c;
  cursor: pointer;
  touch-action: manipulation;
}

#again:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #b4235c;
}

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

.follow {
  margin: 14px 0 0;
  color: #ffd36a;
  font-weight: 800;
  font-size: 15px;
  -webkit-user-select: text;
  user-select: text;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}

@keyframes pop {
  50% { transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .prompt { animation: none; }
  .score-num.pop { animation: none; }
}
