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

html, body {
  height: 100%;
  overflow: hidden;
  background: #38bdf8;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

canvas {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

#hud {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

#hearts {
  font-size: 22px;
  letter-spacing: 1px;
  white-space: nowrap;
}

#score-box {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

#hud-buttons {
  display: flex;
  gap: 8px;
}

.icon-btn {
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  font-size: 22px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}

#boss-bar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0) + 66px);
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 3px solid #fff;
  border-radius: 10px;
  overflow: hidden;
  display: none;
  pointer-events: none;
}

#boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  transition: width 0.15s;
}

#banner {
  position: fixed;
  top: 32%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(44px, 13vw, 72px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 5px 0 #0369a1;
  pointer-events: none;
  opacity: 0;
}

#banner.show {
  animation: banner 1.8s ease-out forwards;
}

@keyframes banner {
  0% { opacity: 0; transform: scale(0.4); }
  15% { opacity: 1; transform: scale(1.15); }
  28% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

#weapons {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0) + 14px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  padding: 10px 0;
}

.weapon {
  width: 70px;
  height: 70px;
  padding: 10px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.85);
  transition: transform 0.15s;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

.weapon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.weapon.active {
  transform: scale(1.2);
  border-color: #fff;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.9), 0 6px 14px rgba(0, 0, 0, 0.3);
}

body:not(.playing) #hud,
body:not(.playing) #weapons,
body:not(.playing) #boss-bar {
  display: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 20px;
  background: rgba(14, 165, 233, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10;
}

.hidden {
  display: none;
}

.title {
  font-size: clamp(40px, 12vw, 70px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 5px 0 #0369a1;
  text-align: center;
}

.plane-art {
  font-size: clamp(70px, 24vw, 130px);
  animation: float 2.2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-14px) rotate(6deg); }
}

.big-btn {
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 800;
  padding: 18px 44px;
  border-radius: 50px;
  border: 0;
  background: #fbbf24;
  color: #78350f;
  box-shadow: 0 7px 0 #d97706;
}

.big-btn:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #d97706;
}

.hint {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.result {
  font-size: clamp(40px, 12vw, 60px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 #0369a1;
}

.best {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
