*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-0: #fff9f1;
  --bg-1: #ffeedb;
  --text: #4a2e1f;
  --muted: rgba(74, 46, 31, 0.68);
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 20% 0%, #ffd7b2 0%, var(--bg-1) 42%, var(--bg-0) 100%);
  color: var(--text);
  font-family: 'Avenir Next', 'Segoe UI', sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

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

#hud {
  text-align: center;
  position: fixed;
  top: max(calc(10px + env(safe-area-inset-top, 0px)), 24px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--text);
  font-size: 2.5rem;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.72), 0 2px 8px rgba(170, 116, 72, 0.45);
  z-index: 10;
  pointer-events: none;
  transition: transform 0.15s ease-out, color 0.15s ease-out;
  line-height: 1;
}

#current-score {
  display: block;
  font-variant-numeric: tabular-nums;
}

#hud.pulse {
  transform: translateX(-50%) scale(1.15);
  color: #d97706;
  animation: scorePulse 0.45s ease-out;
}

@keyframes scorePulse {
  0% {
    transform: translateX(-50%) scale(1.15);
    color: #d97706;
  }
  40% {
    transform: translateX(-50%) scale(1.3);
    color: #b45309;
  }
  100% {
    transform: translateX(-50%) scale(1);
    color: var(--text);
  }
}

.hint {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  z-index: 3;
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.6);
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 249, 241, 0.68);
  border: 1px solid rgba(178, 129, 95, 0.14);
  box-shadow: 0 8px 24px rgba(115, 74, 47, 0.08);
}

.hint.hidden {
  display: none;
}
