/* Habillage du jeu : palette reprise des planches du stade. */

:root {
  --bg: #04060a;
  --ink: #f4efe2;
  --dim: #8d97ad;
  --line: #1d2534;
  --panel: #0b1018;
  --blue: #2f7ce0;
  --orange: #f07a25;
  --display: 'Archivo Black', 'Arial Black', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#shell { position: fixed; inset: 0; }
#scene { display: block; width: 100%; height: 100%; }

/* ------------------------------------------------------------- HUD ----- */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity .25s;
}
#shell.menu-open #hud { opacity: 0; }

#scoreboard {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  font-family: var(--display);
  filter: drop-shadow(0 8px 22px #000a);
}
#scoreboard .side {
  min-width: clamp(58px, 6vw, 88px);
  display: grid;
  place-items: center;
  font-size: clamp(22px, 2.4vw, 34px);
  padding: 10px 14px 12px;
  color: #0a0d14;
}
#scoreboard .blue { background: var(--blue); border-radius: 0 0 0 4px; }
#scoreboard .orange { background: var(--orange); border-radius: 0 0 4px 0; }
#scoreboard .middle {
  background: #0c1219f2;
  border-bottom: 2px solid #23304a;
  padding: 10px 22px 8px;
  text-align: center;
  min-width: clamp(110px, 11vw, 160px);
}
/* Meme piege que pour les ecrans : un `display` explicite l'emporte sur la
   regle `[hidden]` du navigateur, il faut donc la redire ici. */
#scoreboard[hidden], #lobby[hidden], #scores[hidden] { display: none; }

/* Tableau des joueurs. Il se tient enfonce, donc il couvre l'ecran sans
   bloquer le jeu qui continue derriere. */
#scores {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 4vh 3vw;
  background: #04060ac8;
  backdrop-filter: blur(3px);
  pointer-events: none;
  font-family: var(--mono);
}
#scores .camp {
  flex: 1 1 0;
  max-width: 560px;
  border-radius: 10px;
  border: 2px solid;
  background: #0b1018e8;
  overflow: hidden;
}
#scores .camp.blue { border-color: var(--blue); }
#scores .camp.orange { border-color: var(--orange); }
#scores .tete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 14px;
  font-weight: 700;
  letter-spacing: .18em;
  font-size: clamp(11px, 1.1vw, 14px);
}
#scores .camp.blue .tete { background: #2f7ce033; color: #cfe2ff; }
#scores .camp.orange .tete { background: #f07a2533; color: #ffddc4; }
#scores .total { font-size: .85em; opacity: .85; }
#scores table { width: 100%; border-collapse: collapse; }
#scores th, #scores td {
  padding: 6px 8px;
  text-align: right;
  font-size: clamp(10px, .95vw, 13px);
}
#scores th {
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--dim);
  border-bottom: 1px solid #1d2836;
}
#scores .nom { text-align: left; font-weight: 700; }
#scores tbody tr:nth-child(even) { background: #ffffff08; }
#scores .vide { text-align: center; color: var(--dim); font-weight: 400; }

#clock { font-size: clamp(20px, 2.2vw, 31px); letter-spacing: .01em; }
#clock.urgent { color: #ff6a55; }
#clock-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--orange);
  margin-top: 2px;
}

/* Salon en ligne : prend la place du tableau de score avant le coup d'envoi. */
#lobby {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: auto;
  filter: drop-shadow(0 8px 22px #000a);
}
#btn-kickoff {
  border-radius: 0 0 6px 6px;
  padding: 14px 30px;
  font-size: 12.5px;
  background: var(--orange);
  border-color: #ffa25a;
  color: #14100a;
  font-weight: 700;
}
#btn-kickoff:disabled {
  background: #0c1219f2;
  border-color: #23304a;
  color: var(--dim);
  font-weight: 400;
  cursor: default;
}
/* Choix du camp : on bascule d'un cote ou de l'autre, sans limite de
   nombre. Le compte au milieu dit ou vont les autres. */
#teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}
#teams .team {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  padding: 7px 14px;
  border-radius: 7px;
  border: 2px solid transparent;
  background: #0b1018cc;
  color: var(--dim);
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
#teams .team.blue:hover, #teams .team.blue.mine { color: #fff; border-color: var(--blue); background: #2f7ce055; }
#teams .team.orange:hover, #teams .team.orange.mine { color: #fff; border-color: var(--orange); background: #f07a2555; }
#teams .team:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* Partie privee : l'equipe complete ne se rejoint plus. */
#teams .team:disabled { opacity: .35; cursor: not-allowed; }
#team-split {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--dim);
  min-width: 56px;
}

#lobby-info {
  margin: 8px 0 0;
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--dim);
  text-shadow: 0 2px 8px #000;
}

/* Liste des salons */
#online-list { display: grid; gap: 7px; margin: 16px 0 4px; max-height: 40vh; overflow-y: auto; }
.salon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #101825;
  border: 1px solid #22304a;
  border-radius: 8px;
}
.salon b { font-family: var(--display); font-size: 17px; letter-spacing: .04em; }
.salon small { display: block; font-size: 9.5px; color: var(--dim); letter-spacing: .1em; margin-top: 3px; }
.salon button { padding: 9px 14px; font-size: 10px; }
.salon.full button { opacity: .4; cursor: default; }

#online-name {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  background: #121a26;
  border: 1px solid #22304a;
  border-radius: 8px;
  padding: 10px 12px;
  width: 170px;
}
#online-name:focus { outline: none; border-color: #3a4f77; }

#message {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-size: clamp(42px, 8vw, 116px);
  letter-spacing: -.02em;
  text-shadow: 0 10px 40px #000c;
  white-space: nowrap;
}
#message.blue { color: var(--blue); }
#message.orange { color: var(--orange); }
#message.warn { color: #ff6a55; font-size: clamp(24px, 3.4vw, 46px); }
#message.count { color: var(--ink); }
#message.pop { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }

@keyframes pop {
  from { transform: translate(-50%, -50%) scale(.55); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#gauge {
  position: absolute;
  right: clamp(16px, 3vw, 48px);
  bottom: clamp(16px, 3vw, 44px);
  width: clamp(112px, 12vw, 168px);
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 26px #000b);
}
#gauge::before {
  content: '';
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, #070b12f2 55%, #070b1200 78%);
}
#gauge svg { position: relative; width: 100%; height: 100%; transform: rotate(-90deg); }
#gauge circle { fill: none; stroke-width: 9; stroke-linecap: round; }
#gauge .track { stroke: #1b2432; }
#boost-arc {
  stroke: var(--orange);
  transition: stroke-dashoffset .09s linear;
}
#boost-arc.full { stroke: #ffc24a; }
#gauge .readout {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1;
}
#gauge .readout strong {
  font-family: var(--display);
  font-size: clamp(24px, 2.7vw, 38px);
}
#gauge .readout small {
  font-size: 8.5px;
  letter-spacing: .26em;
  color: var(--orange);
  margin-top: 5px;
}
#gauge .speed {
  position: absolute;
  right: -6px;
  bottom: -4px;
  background: #0c1219ee;
  border: 1px solid #22304a;
  border-radius: 5px;
  padding: 5px 9px;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
#gauge .speed strong { font-family: var(--display); font-size: 15px; }
#gauge .speed small { font-size: 8px; letter-spacing: .14em; color: var(--dim); }

#sonic {
  position: absolute;
  top: -22px;
  right: 0;
  font-size: 9px;
  letter-spacing: .24em;
  color: #ffc24a;
  animation: blink .5s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: .25; } }

