* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0a18; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #fff;
  user-select: none;
}
#app { position: fixed; inset: 0; }
#world { display: block; width: 100%; height: 100%; cursor: crosshair; }

kbd {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 0.85em;
}

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 270px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
#hud .panel, #hud .brand, #status {
  background: rgba(18, 16, 44, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.brand span { font-size: 1.4rem; }
#status { font-size: 0.85rem; opacity: 0.92; }
.panel p { margin: 6px 0 0; font-size: 0.82rem; line-height: 1.35; opacity: 0.9; }
.panel.compact { display: grid; gap: 4px; font-size: 0.86rem; }
#shop { pointer-events: auto; }
#shop button {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #8b69ff, #ff5ab7);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
#shop button:hover { filter: brightness(1.12); }
#shop button:active { transform: translateY(1px); }

#bottomHud {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(18, 16, 44, 0.6);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.8rem;
}

#scoreboard {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 190px;
  background: rgba(18, 16, 44, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
}
#scoreboard .row { display: flex; justify-content: space-between; padding: 3px 0; }
#scoreboard .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
#scoreboard .lost { opacity: 0.45; text-decoration: line-through; }
#scoreboard .danger { color: #ff8f8f; font-weight: 700; }

#banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.6);
  padding: 14px 30px;
  background: rgba(18, 16, 44, 0.55);
  border-radius: 16px;
}

#collarBar {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 26px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
#collarFill { height: 100%; width: 0%; background: linear-gradient(90deg, #ffd35a, #ff5ab7); transition: width 0.1s linear; }
#collarBar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }

#notice {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(180, 40, 70, 0.9);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  opacity: 0.7;
  pointer-events: none;
}
.hidden { display: none !important; }

/* ---- Responsive: keep the desktop HUD visually sane on small screens ---- */
@media (max-width: 720px) {
  #hud { width: min(240px, 44vw); gap: 6px; top: 10px; left: 10px; }
  #hud .panel, #hud .brand, #status { padding: 7px 9px; border-radius: 10px; }
  .brand { font-size: 1rem; }
  .brand span { font-size: 1.15rem; }
  #status { font-size: 0.74rem; }
  .panel.compact { font-size: 0.76rem; }
  #shop button { padding: 6px 8px; font-size: 0.8rem; }

  #scoreboard { width: min(170px, 42vw); top: 10px; right: 10px; padding: 8px 9px; font-size: 0.76rem; }

  #goalPanel { display: none; } /* reclaim vertical space on phones */

  #bottomHud { font-size: 0.7rem; gap: 8px; padding: 6px 10px; max-width: 96vw; bottom: 10px; }
  #banner { font-size: clamp(1.1rem, 6vw, 2rem); max-width: 92vw; padding: 10px 18px; }
  #collarBar { width: min(280px, 86vw); }
  #notice { max-width: 92vw; text-align: center; }
}

@media (max-width: 430px) {
  #bottomHud { display: none; } /* keyboard hints aren't usable on touch */
  #hud { width: min(200px, 46vw); }
  #scoreboard { width: min(140px, 40vw); font-size: 0.72rem; }
}
