:root {
  --fg: #fff;
  --bg: rgba(20, 20, 40, 0.72);
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #8fd3ff;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  color: var(--fg);
}

canvas {
  display: block;
}

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

.pill {
  background: var(--bg);
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: bold;
}

#bar {
  width: 160px;
  height: 14px;
  background: #0006;
  border-radius: 8px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}

.b2 {
  width: 120px;
  height: 14px;
  background: #0006;
  border-radius: 8px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}
#tf {
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, #ffd23f, #e63946);
}
#fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #ffd23f, #ff3d7f);
}

#slogan {
  position: fixed;
  top: 30%;
  width: 100%;
  text-align: center;
  font-size: clamp(22px, 5vw, 48px);
  font-weight: 900;
  text-shadow: 3px 3px 0 #e63946;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

#cross {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  border-radius: 50%;
  border: 2px solid #fff;
  pointer-events: none;
}

#start {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 70, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  cursor: pointer;
}

#start h1 {
  font-size: clamp(30px, 7vw, 64px);
  margin: 0 0 10px;
  text-shadow: 4px 4px 0 #e63946;
}

#start p {
  max-width: 520px;
  line-height: 1.5;
  font-size: 18px;
}

/* Barre d'armes */
#hotbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  pointer-events: none;
  z-index: 4;
}
.slot {
  position: relative;
  overflow: hidden;
  width: 92px;
  padding: 8px 6px 6px;
  border-radius: 12px;
  background: var(--bg);
  border: 3px solid transparent;
  text-align: center;
  font-weight: bold;
  transition: transform 0.15s, border-color 0.15s;
}
.slot .key {
  position: absolute;
  left: 6px;
  top: 4px;
  font-size: 13px;
  opacity: 0.8;
}
.slot .ico {
  display: block;
  font-size: 28px;
  line-height: 1.2;
}
.slot .nm {
  display: block;
  font-size: 12px;
}
.slot.active {
  border-color: #ffd23f;
  transform: translateY(-6px) scale(1.08);
}
.slot.locked {
  opacity: 0.55;
}
.slot.locked .nm {
  font-weight: normal;
  font-size: 11px;
}
.cdf {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: rgba(0, 0, 0, 0.55);
}

/* Bandeau de déblocage */
#unlock {
  position: fixed;
  left: 50%;
  top: 16%;
  transform: translate(-50%, -20px);
  background: rgba(20, 20, 40, 0.85);
  border: 3px solid #ffd23f;
  border-radius: 16px;
  padding: 12px 22px;
  text-align: center;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 7;
}
#unlock.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#unlock .big {
  font-size: clamp(20px, 4vw, 34px);
  font-weight: 900;
  text-shadow: 2px 2px 0 #e63946;
  margin-bottom: 4px;
}

/* Munitions dans la barre d'armes */
.slot .am {
  position: absolute;
  right: 6px;
  top: 4px;
  font-size: 13px;
  color: #ffd23f;
}
.slot .am.empty {
  color: #ff5a5a;
}

/* Alerte (renforts) */
#unlock.alert {
  border-color: #ff3b3b;
}
#unlock.alert .big {
  text-shadow: 2px 2px 0 #1d3557;
}

/* Invite d'action contextuelle (F) */
#prompt {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 130px);
  transform: translateX(-50%);
  background: rgba(20, 20, 40, 0.85);
  border: 2px solid #fff;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 18px;
  font-weight: bold;
  pointer-events: none;
  z-index: 7;
  white-space: nowrap;
  animation: pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pulse {
  to {
    transform: translateX(-50%) scale(1.08);
  }
}
