* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #7ec8e3;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  touch-action: none;
}

canvas {
  display: block;
  touch-action: none;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

#play-timer {
  position: absolute;
  top: 18px;
  left: 28px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.hint {
  position: absolute;
  top: 58px;
  left: 28px;
  font-size: 15px;
  opacity: 0.92;
}

#mute-toggle {
  position: absolute;
  top: 108px;
  left: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.32);
  pointer-events: auto;
  cursor: pointer;
}

.speaker-icon {
  position: relative;
  display: block;
  width: 22px;
  height: 16px;
  background: transparent;
}

.speaker-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 13px;
  height: 16px;
  background: #fff;
  clip-path: polygon(0 30%, 42% 30%, 100% 0, 100% 100%, 42% 70%, 0 70%);
}

.speaker-icon::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 0;
  width: 6px;
  height: 12px;
  border: 2px solid #fff;
  border-left: 0;
  border-radius: 0 8px 8px 0;
}

#mute-toggle.muted::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 17px;
  width: 24px;
  height: 2px;
  background: #fff;
  transform: rotate(-28deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  font-family: inherit;
  font-size: 13px;
  text-align: center;
}

#speed {
  position: absolute;
  right: 28px;
  bottom: 24px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

#collect-hud {
  position: absolute;
  top: 22px;
  right: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.collect-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collect-total {
  opacity: 0.75;
  font-size: 18px;
  font-weight: 600;
}

.icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.coin-icon {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe58a, #f0c02e 55%, #b8860b);
  box-shadow: 0 0 0 2px #d4a017, 0 2px 8px rgba(0, 0, 0, 0.35);
}

.apple-icon {
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 35% 30%, #ff8a80, #e53935 60%, #b71c1c);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.apple-icon::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 11px;
  width: 7px;
  height: 5px;
  border-radius: 50%;
  background: #43a047;
}

.chip-icon {
  width: 22px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #2e7d32, #1b5e20);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.chip-icon::before {
  content: "";
  position: absolute;
  inset: 3px 6px;
  background: #cfd8dc;
  border-radius: 1px;
}

.can-icon {
  width: 16px;
  height: 20px;
  border-radius: 2px;
  background: linear-gradient(180deg, #ef5350, #c62828);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.key-icon {
  width: 22px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, #155dfc 0 8px, #f5d76e 8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.key-icon::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -4px;
  width: 12px;
  height: 12px;
  border: 3px solid #f5d76e;
  border-radius: 50%;
  box-sizing: border-box;
}

.key-icon::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 10px;
  width: 3px;
  height: 6px;
  background: #f5d76e;
  box-shadow: -5px 0 0 #f5d76e;
}

#bottom-left {
  position: absolute;
  left: 28px;
  bottom: 24px;
  max-width: min(460px, calc(100vw - 180px));
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#direct-link {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#direct-link:hover {
  color: #d6e4ff;
}

#legal-notes {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 10px;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

#legal-notes a {
  color: #d6e4ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.can-icon::before {
  content: "";
  position: absolute;
  top: -3px;
  right: 2px;
  width: 6px;
  height: 5px;
  border-radius: 1px;
  background: #f4c430;
}

#success {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 15;
}

#success[hidden] {
  display: none;
}

.success-banner {
  padding: 32px 64px;
  border-radius: 18px;
  background: rgba(12, 12, 18, 0.9);
  color: #fff6d5;
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 2px solid #ffe082;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  animation: success-pop 0.5s ease;
}

@keyframes success-pop {
  from {
    transform: scale(0.72);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

#error {
  position: fixed;
  z-index: 20;
  left: 24px;
  right: 24px;
  bottom: 24px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(120, 20, 20, 0.9);
  color: #fff;
  font-size: 14px;
  white-space: pre-wrap;
}
