* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #0a0518; }
body {
  font-family: 'Bricolage Grotesque', sans-serif;
  color: #f0eaff;
  touch-action: none;
}
#game-wrap { position: fixed; inset: 0; }
canvas { display: block; position: absolute; inset: 0; }

.hidden { display: none !important; }

/* ---- HUD ---- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 14px 18px; pointer-events: none;
  z-index: 5;
}
#hud-top {
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
#survivors { font-size: 20px; letter-spacing: 1px; }
#timer {
  font-size: 24px; letter-spacing: 2px;
  color: #ffd84f; text-shadow: 0 0 12px rgba(255,216,79,0.6);
}
#role-tag {
  font-size: 12px; letter-spacing: 3px;
  background: rgba(255,255,255,0.08); padding: 5px 12px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
}

#stamina-wrap {
  max-width: 420px; margin: 12px auto 0;
}
#stamina-label {
  display: flex; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  letter-spacing: 2px; margin-bottom: 4px;
}
#status-text { color: #7dffd0; transition: color 0.2s; }
#stamina-num { color: #b8a8e8; }
#stamina-track {
  height: 14px; background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
  overflow: hidden;
}
#stamina-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #3be0c0, #7dffd0);
  border-radius: 8px; transition: width 0.06s linear;
  box-shadow: 0 0 12px rgba(125,255,208,0.6);
}
#stamina-fill.sprinting { background: linear-gradient(90deg,#ff5c3c,#ff9a3c); box-shadow: 0 0 12px rgba(255,120,60,0.7); }
#stamina-fill.exhausted { background: #ff3b5c; animation: flash 0.4s infinite; }
@keyframes flash { 50% { opacity: 0.35; } }

/* ---- Vignette ---- */
#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 4;
  opacity: 0; transition: opacity 0.15s;
  box-shadow: inset 0 0 200px 60px rgba(255,20,60,0.6);
}

/* ---- Overlays ---- */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
  background: radial-gradient(circle at center, rgba(35,17,68,0.85), rgba(10,5,24,0.95));
  backdrop-filter: blur(3px);
}
.title {
  font-weight: 800; font-size: clamp(48px, 12vw, 110px);
  letter-spacing: -2px; line-height: 0.9;
  animation: pop 0.5s ease;
}
.title span { color: #7dffd0; text-shadow: 0 0 30px rgba(125,255,208,0.7); }
.title.win { color: #7dffd0; text-shadow: 0 0 30px rgba(125,255,208,0.7); }
.title.lose { color: #ff3b5c; text-shadow: 0 0 30px rgba(255,59,92,0.7); }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

.tagline {
  font-weight: 200; font-size: clamp(15px, 3.5vw, 20px);
  margin-top: 16px; max-width: 480px; color: #c7b6ff;
}
.btn-row { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; justify-content: center; }
.gem-btn {
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800;
  font-size: 17px; letter-spacing: 0.5px;
  padding: 14px 28px; border: none; border-radius: 14px;
  cursor: pointer; color: #0a0518;
  background: linear-gradient(135deg,#7dffd0,#3be0c0);
  box-shadow: 0 6px 24px rgba(125,255,208,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.gem-btn:hover { transform: translateY(-3px) scale(1.03); }
.gem-btn.killer { background: linear-gradient(135deg,#ff6b81,#ff3b5c); color: #fff; box-shadow: 0 6px 24px rgba(255,59,92,0.4); }

.legend {
  margin-top: 40px; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: #b8a8e8; line-height: 1.9; max-width: 460px;
}
.legend strong { color: #ffd84f; letter-spacing: 2px; font-size: 13px; }
.key {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px; padding: 2px 7px; color: #fff;
}
.best {
  margin-top: 26px; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: #7dffd0; letter-spacing: 1px;
}

/* ---- Footer ---- */
footer {
  position: absolute; bottom: 6px; right: 12px; z-index: 20;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
footer a { color: rgba(199,182,255,0.6); text-decoration: none; }
footer a:hover { color: #7dffd0; }

/* ---- Touch controls ---- */
#touch { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
#joy {
  position: absolute; bottom: 40px; left: 30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.15);
  pointer-events: auto; touch-action: none;
}
#joy-nub {
  position: absolute; top: 50%; left: 50%; margin: -26px 0 0 -26px;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg,#7dffd0,#3be0c0);
  box-shadow: 0 0 16px rgba(125,255,208,0.6);
}
#sprint-btn {
  position: absolute; bottom: 55px; right: 30px;
  width: 90px; height: 90px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg,#ff6b81,#ff3b5c); color: #fff;
  border: 2px solid rgba(255,255,255,0.25);
  pointer-events: auto; touch-action: none; letter-spacing: 1px;
}
#sprint-btn.on { transform: scale(0.92); box-shadow: 0 0 20px rgba(255,59,92,0.7); }