* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #ecfff3;
  background: #020806;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #020806;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

.hud {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 42px);
  letter-spacing: 2px;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.45);
}

p {
  margin-top: 6px;
  color: #a9cdb4;
}

.score-row {
  display: flex;
  gap: 10px;
}

.score-card {
  min-width: 96px;
  padding: 10px 16px;
  text-align: center;
  border: 1px solid rgba(160, 255, 193, 0.22);
  border-radius: 18px;
  background: rgba(4, 18, 10, 0.82);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.score-card span {
  display: block;
  font-size: 13px;
  color: #a9cfb4;
}

.score-card strong {
  font-size: 32px;
  color: #69ff9d;
}

.legend {
  position: fixed;
  left: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(160, 255, 193, 0.2);
  border-radius: 18px;
  background: rgba(4, 18, 10, 0.82);
  color: #d9f7e2;
  font-size: 14px;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.food-red { background: #ff4f6d; }
.food-gold { background: #ffd84a; }
.food-purple { background: #b66cff; }
.food-boost {
  background: #69ff9d;
  box-shadow: 0 0 10px rgba(105, 255, 157, 0.75);
}
.npc-blue {
  width: 22px !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #33c4ff, #148ad6);
  box-shadow: 0 0 12px rgba(51, 196, 255, 0.65);
}

.npc-orange {
  width: 22px !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #ff8b2f, #d94d1f);
  box-shadow: 0 0 12px rgba(255, 139, 47, 0.65);
}

.npc-pink {
  width: 22px !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #ff66d8, #c53cff);
  box-shadow: 0 0 12px rgba(255, 102, 216, 0.65);
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
  background: rgba(2, 10, 6, 0.86);
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  margin: 0;
  font-size: clamp(36px, 7vw, 72px);
}

button {
  touch-action: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  color: #061f10;
  background: linear-gradient(135deg, #69ff9d, #ffd84a);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px);
}

.actions {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 10px;
}

.actions button,
.mobile-controls button {
  color: #ecfff3;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(164, 255, 196, 0.24);
}

.mobile-controls {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: none;
  justify-items: center;
  gap: 8px;
}

.mobile-controls div {
  display: flex;
  gap: 8px;
}

.mobile-controls button {
  width: 58px;
  height: 48px;
  padding: 0;
  font-size: 22px;
}

@media (max-width: 720px) {
  .hud {
    flex-direction: column;
  }

  .legend {
    display: none;
  }

  .actions {
    right: 12px;
    top: 12px;
    bottom: auto;
  }

  .mobile-controls {
    display: grid;
  }
}
