@font-face {
  font-family: 'Press Start 2P';
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/press-start-2p@5.3.0/files/press-start-2p-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Monoton';
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/monoton@5.3.0/files/monoton-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}

:root {
  --fond: #07040f;
  --rose: #ff2bd6;
  --cyan: #2be7ff;
  --menthe: #3dffc0;
  --jaune: #fff36b;
  --texte: #f4ecff;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--pixel);
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body { position: fixed; inset: 0; }

#ecran {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Effet écran cathodique */
#crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0.16) 3px),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
}

/* Boutons ronds (son, plein écran, pause) */
#boutons {
  position: fixed;
  z-index: 20;
  display: flex;
  gap: 8px;
}
#boutons.colonne { flex-direction: column; }
.rond {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(43, 231, 255, 0.6);
  background: rgba(10, 6, 30, 0.7);
  color: var(--cyan);
  font-size: 15px;
  font-family: system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(43, 231, 255, 0.35);
  display: grid;
  place-items: center;
  padding: 0;
}
.rond:hover { background: rgba(43, 231, 255, 0.18); }
.rond:active { transform: scale(0.92); }
.rond.coupe { color: #777; border-color: #555; box-shadow: none; }

/* Pavé de glissement tactile : on glisse le doigt dans la direction voulue */
#pave {
  position: fixed;
  z-index: 15;
  width: 200px;
  height: 200px;
  touch-action: none;
  border-radius: 22px;
  border: 2px solid rgba(255, 43, 214, 0.55);
  background:
    repeating-linear-gradient(0deg, rgba(43, 231, 255, 0.06) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(43, 231, 255, 0.06) 0 1px, transparent 1px 28px),
    radial-gradient(ellipse at center, rgba(43, 231, 255, 0.10), rgba(30, 8, 40, 0.6) 75%);
  box-shadow: 0 0 16px rgba(255, 43, 214, 0.35), inset 0 0 26px rgba(255, 43, 214, 0.18);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#pave.touche {
  border-color: rgba(43, 231, 255, 0.85);
  box-shadow: 0 0 22px rgba(43, 231, 255, 0.45), inset 0 0 30px rgba(43, 231, 255, 0.2);
}
#pave .fleche {
  position: absolute;
  font-family: system-ui, sans-serif;
  font-size: clamp(16px, 5vw, 28px);
  line-height: 1;
  color: rgba(255, 200, 245, 0.4);
  text-shadow: 0 0 8px rgba(255, 43, 214, 0.6);
  transition: color 0.12s, scale 0.12s;
  pointer-events: none;
}
#pave .fleche.actif { color: #fff; text-shadow: 0 0 6px #fff, 0 0 18px #ff2bd6; scale: 1.4; }
#pave .haut { top: 10px; left: 50%; translate: -50% 0; }
#pave .bas { bottom: 10px; left: 50%; translate: -50% 0; }
#pave .gauche { left: 12px; top: 50%; translate: 0 -50%; }
#pave .droite { right: 12px; top: 50%; translate: 0 -50%; }
#pave .legende {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  font-size: 9px;
  line-height: 1.8;
  letter-spacing: 0.2em;
  text-align: center;
  color: rgba(203, 189, 230, 0.5);
  pointer-events: none;
  transition: opacity 0.2s;
}
#pave.touche .legende { opacity: 0; }
#pave .doigt {
  position: absolute;
  left: 0;
  top: 0;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 12%, rgba(43, 231, 255, 0.55) 30%, rgba(43, 231, 255, 0) 70%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#pave.touche .doigt { opacity: 1; }

.cache { display: none !important; }

/* Panneaux (accueil, pause, fin) */
.panneau {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at center, rgba(12, 4, 30, 0.72), rgba(4, 2, 12, 0.9));
  touch-action: pan-y;
}
.defile {
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  width: min(960px, 100%);
  text-align: center;
  padding: 8px;
  scrollbar-width: thin;
}
.defile.court { width: min(520px, 100%); }

.enseigne {
  font-family: 'Monoton', var(--pixel);
  font-weight: 400;
  margin: 0 0 6px;
  font-size: clamp(34px, 9vw, 92px);
  line-height: 1;
  letter-spacing: 0.04em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.25em;
}
.enseigne .e1 {
  color: #ffe6fb;
  text-shadow: 0 0 4px #fff, 0 0 12px var(--rose), 0 0 26px var(--rose), 0 0 48px var(--rose);
  animation: gresille 5s infinite;
}
.enseigne .e2 {
  color: #e6fdff;
  text-shadow: 0 0 4px #fff, 0 0 12px var(--cyan), 0 0 26px var(--cyan), 0 0 48px var(--cyan);
  animation: gresille 7s infinite 1.3s;
}
@keyframes gresille {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.35; }
}
.accroche {
  font-size: clamp(9px, 1.6vw, 13px);
  line-height: 1.7;
  color: #d9c8ff;
  margin: 4px auto 14px;
  max-width: 640px;
}
.colonnes {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  align-items: start;
  text-align: left;
}
#casting {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  border: 2px solid rgba(255, 43, 214, 0.35);
  border-radius: 14px;
  background: rgba(20, 6, 34, 0.55);
  box-shadow: inset 0 0 20px rgba(255, 43, 214, 0.12);
}
#casting li { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
#casting canvas { width: 48px; height: 48px; flex: none; }
#casting b { display: block; font-size: 12px; margin-bottom: 5px; letter-spacing: 0.08em; }
#casting span { font-size: 9px; line-height: 1.5; color: #cbbde6; }
.c-croq { color: var(--menthe); text-shadow: 0 0 8px var(--menthe); }
.c-0 { color: #ff2e63; text-shadow: 0 0 8px #ff2e63; }
.c-1 { color: #c77dff; text-shadow: 0 0 8px #c77dff; }
.c-2 { color: #a6ff00; text-shadow: 0 0 8px #a6ff00; }
.c-3 { color: #ffc300; text-shadow: 0 0 8px #ffc300; }

.droite-accueil { text-align: center; }

button.gros, button.moyen, button.petit {
  font-family: var(--pixel);
  cursor: pointer;
  border-radius: 12px;
  color: #fff;
}
button.gros {
  font-size: clamp(16px, 3vw, 24px);
  padding: 16px 34px;
  border: 3px solid var(--menthe);
  background: linear-gradient(180deg, rgba(61, 255, 192, 0.3), rgba(61, 255, 192, 0.08));
  text-shadow: 0 0 8px var(--menthe);
  box-shadow: 0 0 18px rgba(61, 255, 192, 0.55), inset 0 0 14px rgba(61, 255, 192, 0.3);
  animation: respire 1.6s ease-in-out infinite;
  margin: 6px 6px 12px;
}
@keyframes respire {
  50% { box-shadow: 0 0 30px rgba(61, 255, 192, 0.85), inset 0 0 18px rgba(61, 255, 192, 0.45); }
}
button.gros:active, button.moyen:active, button.petit:active { transform: scale(0.96); }
button.moyen {
  font-size: 14px;
  padding: 10px 16px;
  border: 2px solid var(--cyan);
  background: rgba(43, 231, 255, 0.15);
  box-shadow: 0 0 10px rgba(43, 231, 255, 0.4);
}
button.petit {
  font-size: 10px;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
  margin: 6px;
}
.aide { font-size: 9px; line-height: 1.8; color: #bfb0dd; margin: 0 0 12px; }
body.tactile .pour-clavier { display: none; }
body:not(.tactile) .pour-tactile { display: none; }

.tableau {
  border: 2px solid rgba(43, 231, 255, 0.35);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(4, 16, 30, 0.55);
  box-shadow: inset 0 0 20px rgba(43, 231, 255, 0.12);
}
.tableau h2 { font-size: 11px; margin: 2px 0 10px; color: var(--jaune); text-shadow: 0 0 8px rgba(255, 243, 107, 0.7); }
ol.top {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  font-size: 10px;
  line-height: 2;
  max-width: 360px;
  text-align: left;
}
ol.top li { display: flex; gap: 10px; }
ol.top .rang { width: 2.5em; color: var(--rose); }
ol.top .nom { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
ol.top .pts { color: var(--menthe); }
ol.top li.moi { background: rgba(255, 243, 107, 0.15); border-radius: 6px; }
ol.top li.vide { color: #8a7fa8; justify-content: center; }

.titre-neon {
  font-size: clamp(18px, 4.5vw, 30px);
  color: #ffe6fb;
  text-shadow: 0 0 6px #fff, 0 0 14px var(--rose), 0 0 30px var(--rose);
  margin: 6px 0 18px;
  line-height: 1.4;
}
.gros-score { font-size: clamp(14px, 3vw, 20px); color: var(--menthe); text-shadow: 0 0 10px var(--menthe); margin: 0 0 16px; }
#formScore label { display: block; font-size: 9px; color: #cbbde6; margin-bottom: 8px; line-height: 1.6; }
.ligne { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
#pseudo {
  font-family: var(--pixel);
  font-size: 14px;
  padding: 10px 12px;
  width: min(260px, 60vw);
  border-radius: 10px;
  border: 2px solid var(--rose);
  background: rgba(20, 6, 34, 0.85);
  color: #fff;
  outline: none;
  box-shadow: 0 0 10px rgba(255, 43, 214, 0.4);
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}
#pseudo:focus { box-shadow: 0 0 18px rgba(255, 43, 214, 0.8); }
.msg { font-size: 10px; line-height: 1.7; color: var(--jaune); min-height: 1em; margin: 12px 0; }

@media (max-width: 700px) {
  .colonnes { grid-template-columns: 1fr; }
  #casting { order: 2; }
  .droite-accueil { order: 1; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .enseigne { font-size: clamp(26px, 7vh, 48px); }
  .accroche { margin-bottom: 8px; }
  #casting li { padding: 2px 0; }
  #casting canvas { width: 34px; height: 34px; }
  #casting span { font-size: 8px; }
  button.gros { padding: 10px 24px; margin-bottom: 8px; }
  ol.top { line-height: 1.7; }
}
