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

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background: #4A2C1A;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
}

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

/* ---- Score ---- */

#score-display {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 20;
  pointer-events: none;
}

#score-display.hidden {
  display: none;
}

.score-icon {
  font-size: 28px;
  line-height: 1;
}

#score-value {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 32px;
  color: #4A2C1A;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ---- Perfect ---- */

#perfect {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-family: 'Bungee', sans-serif;
  font-size: clamp(22px, 5vw, 38px);
  color: #F07900;
  text-shadow:
    0 2px 8px rgba(240, 121, 0, 0.4),
    0 0 20px rgba(240, 121, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#perfect.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---- Overlays ---- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  transition: opacity 0.4s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---- Start Screen ---- */

#start-screen {
  background: radial-gradient(
    ellipse at center,
    rgba(74, 44, 26, 0.82) 0%,
    rgba(74, 44, 26, 0.94) 100%
  );
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.start-content {
  text-align: center;
  color: #F5EBDC;
  animation: fadeIn 0.6s ease;
}

/* CSS BK Logo */

.bk-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  filter: drop-shadow(0 0 18px rgba(240, 121, 0, 0.25));
}

.bk-logo .bun {
  background: #F07900;
  border: 2px solid #4A2C1A;
}

.bk-logo .bun.top {
  width: 110px;
  height: 28px;
  border-radius: 55px 55px 4px 4px;
}

.bk-logo .bun.bottom {
  width: 120px;
  height: 24px;
  border-radius: 4px 4px 60px 60px;
}

.bk-logo .bk-text {
  font-family: 'Bungee', sans-serif;
  font-size: 15px;
  color: #AE1622;
  background: #F5EBDC;
  padding: 3px 18px;
  line-height: 1.2;
  letter-spacing: 1px;
  border-left: 2px solid #4A2C1A;
  border-right: 2px solid #4A2C1A;
}

.game-title {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(26px, 7vw, 46px);
  color: #F07900;
  text-shadow: 0 3px 0 #AE1622, 0 6px 14px rgba(0, 0, 0, 0.3);
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.tagline {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: clamp(11px, 2.5vw, 15px);
  color: #F5EBDC;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 36px;
}

/* ---- Buttons ---- */

#play-btn,
#restart-btn {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(16px, 4vw, 22px);
  color: #F5EBDC;
  background: #AE1622;
  border: none;
  border-radius: 50px;
  padding: 14px 52px;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
  box-shadow: 0 4px 0 #7A101A, 0 8px 22px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 2px;
}

#play-btn:not(:disabled) {
  animation: pulse 2s ease-in-out infinite;
}

#play-btn:disabled {
  background: #888;
  box-shadow: 0 4px 0 #555;
  cursor: wait;
}

#play-btn:hover:not(:disabled),
#restart-btn:hover {
  transform: translateY(-2px);
  background: #C51A26;
  animation: none;
}

#play-btn:active:not(:disabled),
#restart-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7A101A, 0 4px 10px rgba(0, 0, 0, 0.3);
}

.hint {
  font-size: clamp(11px, 2vw, 13px);
  color: #F5EBDC;
  opacity: 0.45;
  margin-top: 22px;
}

/* ---- Game Over ---- */

#game-over {
  background: radial-gradient(
    ellipse at center,
    rgba(74, 44, 26, 0.85) 0%,
    rgba(74, 44, 26, 0.95) 100%
  );
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.gameover-content {
  text-align: center;
  color: #F5EBDC;
  animation: fadeIn 0.4s ease;
}

.gameover-content h2 {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(26px, 7vw, 42px);
  color: #F07900;
  text-shadow: 0 3px 0 #AE1622, 0 6px 14px rgba(0, 0, 0, 0.3);
  margin-bottom: 24px;
}

.final-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 36px;
}

.burger-icon-large {
  font-size: 48px;
  line-height: 1;
}

#final-score-value {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(44px, 10vw, 68px);
  color: #FFD400;
  text-shadow: 0 3px 0 #F07900, 0 6px 14px rgba(0, 0, 0, 0.3);
}

/* ---- Animations ---- */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
