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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0b1e3a;
  font-family: 'Courier New', monospace;
  user-select: none;
}

#game { display: block; cursor: default; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

#score-panel {
  position: absolute; top: 12px; left: 14px;
  background: rgba(6,15,32,.75); border: 2px solid #2fbf5f;
  border-radius: 8px; padding: 10px 16px;
  color: #fff; font-weight: bold; font-size: 15px; line-height: 1.7;
  text-shadow: 1px 1px 0 #000;
}
#terr { color: #7affea; }
#best { color: #ffd23a; }
#kills { color: #ff7ad9; }

#lb-panel {
  position: absolute; top: 12px; right: 14px;
  background: rgba(6,15,32,.75); border: 2px solid #e63329;
  border-radius: 8px; padding: 10px 14px; min-width: 210px;
}
#lb-panel h3 {
  color: #ffd23a; font-size: 14px; text-align: center;
  margin-bottom: 6px; letter-spacing: 1px;
}
#lb { list-style: none; }
#lb li {
  display: flex; align-items: center; gap: 7px;
  padding: 2.5px 6px; font-size: 13px; font-weight: bold;
  color: #dfe9ff; border-radius: 4px;
}
#lb li.me { background: rgba(47,191,95,.3); }
#lb li .dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
#lb li .sc { margin-left: auto; color: #ffd23a; }
#lb li .best-mini { color: #8fa3c8; font-size: 10px; margin-left: 5px; }
#lb li .bot-tag { color: #8fa3c8; font-size: 10px; }

#toasts {
  position: absolute; top: 90px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.toast {
  background: rgba(6,15,32,.85); border: 1px solid #ffd23a;
  color: #ffd23a; font-weight: bold; font-size: 15px;
  padding: 6px 18px; border-radius: 20px;
  animation: toastIn .25s ease-out, toastOut .5s ease-in 2.5s forwards;
  text-shadow: 1px 1px 0 #000;
}
@keyframes toastIn { from { transform: scale(.6); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-14px); opacity: 0; } }

#hint {
  position: absolute; bottom: 10px; left: 14px;
  color: rgba(255,255,255,.55); font-size: 12px; text-shadow: 1px 1px 0 #000;
}

/* ---------- Overlay élimination ---------- */
#death-overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(6,10,20,.55);
}
#death-text {
  font-size: 84px; font-weight: bold; color: #e63329; letter-spacing: 6px;
  text-shadow: 4px 4px 0 #000;
  animation: pop .3s ease-out;
}
#death-sub { font-size: 20px; color: #ffb3b3; margin-top: 8px; text-shadow: 2px 2px 0 #000; }
#death-count { font-size: 26px; color: #fff; margin-top: 26px; font-weight: bold; text-shadow: 2px 2px 0 #000; }
@keyframes pop { from { transform: scale(2); opacity: 0; } }

/* ---------- Inscription ---------- */
#join-screen {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #14325e 0%, #081426 70%);
  color: #eee; text-align: center; padding: 20px;
}
#join-screen h1 {
  font-size: 60px; letter-spacing: 3px; color: #e63329;
  text-shadow: 3px 3px 0 #000, 0 0 30px rgba(230,51,41,.5);
}
#join-screen h1 span { color: #2fbf5f; }
#join-screen .sub { margin: 14px 0 24px; color: #b8c9e6; font-size: 15px; line-height: 1.6; }

#join-form { display: flex; flex-direction: column; gap: 10px; width: 320px; }
#join-form input {
  font-family: inherit; font-size: 17px; font-weight: bold;
  padding: 12px 16px; text-align: center;
  background: rgba(255,255,255,.08); color: #ffd23a;
  border: 2px solid #2fbf5f; border-radius: 6px; outline: none;
}
#join-form input:focus { border-color: #ffd23a; }
#email { font-size: 14px !important; }
#play-btn {
  font-family: inherit; font-size: 20px; font-weight: bold;
  padding: 12px; cursor: pointer;
  background: #e63329; color: #fff;
  border: none; border-radius: 6px;
}
#play-btn:hover { background: #ff4a3f; }
#play-btn:disabled { background: #555; cursor: wait; }

/* ---------- Sélecteur d'avatar ---------- */
#avatar-picker {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; padding: 10px;
}
#avatar-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 13px; font-weight: bold; color: #c9d6ec;
}
#avatar-row label { white-space: nowrap; }
#avatar-style {
  flex: 1; font-family: inherit; font-size: 13px; font-weight: bold;
  background: #14325e; color: #ffd23a; border: 1px solid #2fbf5f;
  border-radius: 4px; padding: 5px 8px; outline: none; cursor: pointer;
}
#avatar-shuffle {
  font-size: 18px; background: #2fbf5f; border: none; border-radius: 4px;
  padding: 5px 10px; cursor: pointer;
}
#avatar-shuffle:hover { background: #4ddb7f; }
#avatar-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
#avatar-grid img {
  width: 100%; aspect-ratio: 1; border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 3px solid transparent; cursor: pointer;
  transition: transform .1s;
}
#avatar-grid img:hover { transform: scale(1.08); }
#avatar-grid img.sel { border-color: #ffd23a; background: rgba(255,210,58,.15); }
.credit { margin-top: 6px; font-size: 10px; color: #8fa3c8; text-align: right; }
.credit a { color: #8fa3c8; }

.privacy { margin-top: 14px; font-size: 12px; color: #8fa3c8; line-height: 1.6; }

#join-screen .controls {
  margin-top: 20px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  padding: 14px 26px; border-radius: 8px; line-height: 1.8; font-size: 13px;
  color: #c9d6ec; max-width: 480px;
}
#join-screen .controls b { color: #ffd23a; }
#join-error { margin-top: 14px; color: #ff5b5b; font-weight: bold; min-height: 20px; }
