:root {
  --bg: #0f0c1a; --fg: #f5f1ff; --muted: #9b93b8; --card: #1b1730; --line: #2f2850; --accent: #fb923c;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, #2a1d57 0%, var(--bg) 60%) fixed;
  color: var(--fg);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Affichage ---------- */
.board { min-height: 100vh; display: flex; flex-direction: column; padding: 3vmin 4vmin; }
.board h1 {
  margin: 0 0 2.5vmin; text-align: center; font-size: clamp(1.6rem, 5vmin, 3.6rem);
  letter-spacing: .12em; text-transform: uppercase; font-weight: 800;
}
.board h1 span { color: var(--accent); }
.rows { position: relative; display: grid; gap: 1.6vmin; flex: 1; align-content: start; }
.row {
  --c: #888;
  position: relative; display: flex; align-items: center; gap: 3vmin;
  padding: 1.6vmin 3vmin; border-radius: 2vmin; overflow: hidden;
  background: var(--card); border: .35vmin solid var(--line);
  min-height: 9vmin;
}
.row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 1.4vmin; background: var(--c); }
.row.first { border-color: var(--c); box-shadow: 0 0 4vmin -1vmin var(--c); }
.rank { font-size: 4.5vmin; font-weight: 800; width: 7vmin; text-align: center; color: var(--muted); }
.row.first .rank { color: var(--c); }
.name { flex: 1; font-size: 5.5vmin; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { font-size: 8vmin; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 14vmin; text-align: right; }
.score.mystery { color: var(--muted); letter-spacing: .1em; }
.row.bump { animation: bump .7s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 25% { transform: scale(1.04); background: color-mix(in srgb, var(--c) 35%, var(--card)); } 100% { transform: scale(1); } }
.gain {
  position: absolute; right: 22vmin; top: 50%; transform: translateY(-50%);
  font-size: 6vmin; font-weight: 800; color: #4ade80; animation: float 1.6s ease-out forwards; pointer-events: none;
}
.gain.neg { color: #f87171; }
@keyframes float { 0% { opacity: 0; transform: translateY(-20%); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-120%); } }
.status {
  position: fixed; top: 1.2vmin; right: 1.6vmin; font-size: 1.8vmin; color: var(--muted);
  display: flex; align-items: center; gap: .8vmin;
}
.status i { width: 1.2vmin; height: 1.2vmin; border-radius: 50%; background: #4ade80; }
.status.off i { background: #f87171; }

/* ---------- Télécommande ---------- */
.remote { max-width: 760px; margin: 0 auto; padding: 16px 14px 80px; }
.remote h1 { margin: 4px 0 14px; font-size: 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.remote h1 a { font-size: .85rem; color: var(--muted); font-weight: 400; }
.team { --c: #888; background: var(--card); border: 1px solid var(--line); border-left: 8px solid var(--c); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.team .head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.team .tname { font-size: 1.2rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .tscore { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pts button {
  min-height: 56px; border-radius: 10px; border: 1px solid var(--line); background: #262042;
  font-size: 1.3rem; font-weight: 700; touch-action: manipulation;
}
.pts button.plus { background: color-mix(in srgb, var(--c) 55%, #1b1730); border-color: var(--c); }
.pts button.minus { color: #fca5a5; }
.pts button:active { transform: scale(.96); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.btn { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: #262042; min-height: 46px; }
.btn.danger { color: #fca5a5; }
.btn:disabled { opacity: .4; cursor: default; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 14px; }
summary { cursor: pointer; font-weight: 600; }
.edit { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.edit input[type=text] { flex: 1; min-width: 0; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: #120f22; color: var(--fg); font: inherit; }
.edit input[type=color] { width: 44px; height: 40px; padding: 0; border: 0; background: none; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #000c; padding: 10px 16px; border-radius: 10px; max-width: 90vw; }
.login { max-width: 420px; margin: 18vh auto 0; padding: 0 16px; }
.login input { width: 100%; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: #120f22; color: var(--fg); font: inherit; margin: 10px 0; }
.err { color: #fca5a5; min-height: 1.4em; }
