:root {
  --neon-cyan: #4df1ff;
  --neon-orange: #ff8a1e;
  --bg-black: #04060a;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-black);
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
}

#game-canvas {
  position: fixed;
  inset: 0;
  display: block;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  z-index: 5;
  pointer-events: none;
}

#timer {
  font-variant-numeric: tabular-nums;
  min-width: 3.5em;
}

#cooldown-bar {
  flex: 1;
  max-width: 200px;
  height: 8px;
  border: 1px solid var(--neon-cyan);
  background: rgba(77, 241, 255, 0.08);
}

#cooldown-fill {
  height: 100%;
  width: 100%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: width 0.1s linear;
}

#join-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  /* Volontairement translucide : l'arène/le fond animé qui tourne déjà
   * derrière (voir main.js) transparaît légèrement, pour ne pas avoir
   * un écran d'accueil qui flotte sur un vide plat. */
  background: radial-gradient(circle at center, rgba(10, 20, 32, 0.55) 0%, rgba(4, 6, 10, 0.94) 75%);
  color: var(--neon-cyan);
  text-align: center;
}

#join-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#join-hero h1 {
  font-family: 'Consolas', 'SF Mono', 'Cascadia Code', monospace;
  font-size: 2.6rem;
  letter-spacing: 0.22em;
  text-shadow: 0 0 18px var(--neon-cyan), 0 0 42px rgba(77, 241, 255, 0.35);
  margin: 0;
}

#join-hero .tagline {
  margin: 0;
  color: #8fd0e0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

#join-screen .hint {
  color: #7fb8c4;
  font-size: 0.8rem;
  margin: 0;
}

#global-match-counter {
  opacity: 0.75;
}

#kofi-link {
  margin-top: 4px;
  color: #7fb8c4;
  font-size: 0.78rem;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease;
}

#kofi-link:hover {
  opacity: 1;
  color: var(--neon-orange);
}

/* Panneau central façon terminal, avec des coins renforcés pour un look
 * HUD plutôt qu'un simple cadre plein. */
#join-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 36px 44px;
  background: rgba(6, 14, 22, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(77, 241, 255, 0.3);
  box-shadow: 0 0 40px rgba(77, 241, 255, 0.08), inset 0 0 30px rgba(77, 241, 255, 0.03);
}

#join-panel::before,
#join-panel::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--neon-cyan);
  filter: drop-shadow(0 0 4px rgba(77, 241, 255, 0.6));
}

#join-panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

#join-panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

#name-input,
#join-button {
  width: 260px;
}

#name-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  padding: 12px 16px;
  font-size: 1rem;
  text-align: center;
  outline: none;
  font-family: inherit;
  letter-spacing: 0.03em;
  transition: box-shadow 0.2s ease;
}

#name-input::placeholder {
  color: rgba(77, 241, 255, 0.4);
}

#name-input:focus {
  box-shadow: 0 0 14px rgba(77, 241, 255, 0.4);
}

#join-button {
  background: rgba(255, 138, 30, 0.08);
  border: 2px solid var(--neon-orange);
  color: var(--neon-orange);
  text-shadow: 0 0 8px var(--neon-orange);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

#join-button:hover {
  background: rgba(255, 138, 30, 0.22);
  box-shadow: 0 0 22px rgba(255, 138, 30, 0.3);
}

#join-panel-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid rgba(77, 241, 255, 0.15);
}

/* Liste des commandes utiles, à la place d'un texte d'aide sur une
 * seule ligne : plus lisible, et couvre WASD/ZQSD sans avoir besoin
 * d'un sélecteur (les deux marchent déjà, quel que soit le clavier). */
#controls-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.control-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.8rem;
}

.control-label {
  color: #7fb8c4;
  letter-spacing: 0.05em;
}

.control-keys {
  color: var(--neon-cyan);
  letter-spacing: 0.03em;
}

#rules-button {
  background: transparent;
  border: none;
  color: #7fb8c4;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

#rules-button:hover {
  color: var(--neon-cyan);
}

#rules-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 10, 0.75);
}

#rules-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px 36px;
  background: rgba(6, 14, 22, 0.92);
  border: 1px solid rgba(77, 241, 255, 0.3);
  box-shadow: 0 0 40px rgba(77, 241, 255, 0.08), inset 0 0 30px rgba(77, 241, 255, 0.03);
}

#rules-title {
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan);
}

#rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #d6f3f7;
}

#rules-list li {
  padding-left: 18px;
  position: relative;
}

#rules-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--neon-orange);
}

#rules-close-button {
  background: transparent;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

#rules-close-button:hover {
  background: rgba(77, 241, 255, 0.15);
  box-shadow: 0 0 22px rgba(77, 241, 255, 0.3);
}

.hidden {
  display: none !important;
}

#round-banner {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 10, 0.55);
}

#round-banner-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: round-banner-pop 0.25s ease-out;
}

#round-banner-text {
  font-size: 2.2rem;
  letter-spacing: 0.1em;
  text-align: center;
  text-shadow: 0 0 20px currentColor;
}

#round-banner-actions {
  display: flex;
  gap: 14px;
}

#rematch-button {
  background: transparent;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  padding: 10px 28px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease;
}

#rematch-button:hover {
  background: rgba(77, 241, 255, 0.15);
}

#home-button {
  background: transparent;
  border: 2px solid #7fb8c4;
  color: #7fb8c4;
  padding: 10px 28px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease;
}

#home-button:hover {
  background: rgba(127, 184, 196, 0.15);
}

#round-banner-text.team-blue {
  color: var(--neon-cyan);
}

#round-banner-text.team-orange {
  color: var(--neon-orange);
}

@keyframes round-banner-pop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Bandeau latéral persistant (accueil ET en jeu) : les 100 meilleures
 * séries de la saison. Ancré à droite. pointer-events: none pour ne
 * JAMAIS intercepter les clics/la visée (souris capturée sur
 * #game-canvas, qui continue derrière) — au prix de ne pas pouvoir
 * défiler à la souris : seules les entrées qui tiennent dans la
 * hauteur visible s'affichent (déjà triées par meilleure série). */
#leaderboard-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  width: 210px;
  overflow-y: hidden;
  pointer-events: none;
  padding: 18px 14px;
  background: linear-gradient(to left, rgba(4, 6, 10, 0.8), rgba(4, 6, 10, 0.5) 85%, transparent);
  border-left: 1px solid rgba(77, 241, 255, 0.25);
}

#all-time-record {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 138, 30, 0.3);
  text-align: center;
}

#all-time-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--neon-orange);
  text-shadow: 0 0 8px rgba(255, 138, 30, 0.5);
}

#all-time-value {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #ffcf9e;
}

#leaderboard-title {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  text-align: center;
}

#leaderboard-subtitle {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: #7fb8c4;
  text-align: center;
  margin-bottom: 10px;
}

#leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
}

#leaderboard-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  color: var(--neon-cyan);
  border-bottom: 1px solid rgba(77, 241, 255, 0.08);
}

#leaderboard-list .leaderboard-empty {
  justify-content: center;
  color: #7fb8c4;
  border-bottom: none;
}

/* Le trône revient au 1er du classement — la marque du jeu — dans sa
 * propre carte au-dessus de la liste (qui reprend donc à partir du
 * rang 2), avec son nom posé directement sur le siège. */
#throne-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 207, 92, 0.25);
}

.throne-visual {
  position: relative;
  width: 100px;
  height: 90px;
}

.throne-svg {
  filter: drop-shadow(0 0 6px rgba(255, 207, 92, 0.5));
}

/* Nom du joueur posé sur le coussin du siège ; rétréci dynamiquement
 * (voir shrinkToFit dans main.js) pour tenir sur une seule ligne quel
 * que soit le pseudo, avec ellipsis en tout dernier recours. */
.throne-name {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 60%;
  text-align: center;
  color: #2a1806;
  font-weight: 700;
  font-family: 'Consolas', 'SF Mono', 'Cascadia Code', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

.throne-streak {
  color: #ffcf5c;
  font-size: 0.78rem;
  margin-top: 4px;
  text-shadow: 0 0 6px rgba(255, 207, 92, 0.4);
}

#self-rank {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(77, 241, 255, 0.15);
  font-size: 0.78rem;
  color: var(--neon-cyan);
  text-align: center;
}

#validate-streak-button {
  background: transparent;
  border: 2px solid var(--neon-orange);
  color: var(--neon-orange);
  text-shadow: 0 0 8px var(--neon-orange);
  padding: 10px 24px;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s ease;
}

#validate-streak-button:hover {
  background: rgba(255, 138, 30, 0.15);
}

#validate-streak-button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Décompte de 3s avant le début effectif d'un combat : les joueurs
 * sont figés côté serveur pendant ce temps (voir GameRoom._tick). */
#countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#countdown-value {
  font-family: 'Consolas', 'SF Mono', 'Cascadia Code', monospace;
  font-size: 8rem;
  color: var(--neon-orange);
  text-shadow: 0 0 30px var(--neon-orange), 0 0 60px rgba(255, 138, 30, 0.5);
  animation: countdown-pulse 1s ease-out;
}

@keyframes countdown-pulse {
  from {
    transform: scale(1.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#waiting-screen {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 10, 0.55);
}

#waiting-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

#waiting-text {
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan);
}

#bot-button {
  background: transparent;
  border: 2px solid var(--neon-orange);
  color: var(--neon-orange);
  text-shadow: 0 0 8px var(--neon-orange);
  padding: 10px 24px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease;
}

#bot-button:hover {
  background: rgba(255, 138, 30, 0.15);
}
