@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: block;
}

:root {
  --fond: #07021a;
  --cyan: #2ef9ff;
  --rose: #ff2bd6;
  --jaune: #ffe23d;
  --vert: #39ff6a;
  --rouge: #ff3b5c;
  --texte: #f6f2ff;
  --gris: #7d70a8;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
  color: var(--texte);
  font-family: "Press Start 2P", "Courier New", monospace;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body { position: fixed; inset: 0; }

canvas#jeu {
  position: fixed;
  left: 0;
  top: 0;
  display: block;
  touch-action: none;
  outline: none;
  image-rendering: auto;
}

#chargement {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--cyan);
  letter-spacing: 2px;
}
#chargement[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(4, 1, 14, 0.72);
  z-index: 10;
}
.modal[hidden] { display: none; }

.boite {
  width: min(460px, 100%);
  max-height: calc(100% - 8px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 22px 18px;
  background: linear-gradient(180deg, #160845 0%, #0a0322 100%);
  border: 2px solid var(--rose);
  border-radius: 14px;
  box-shadow: 0 0 24px rgba(255, 43, 214, 0.55), inset 0 0 18px rgba(46, 249, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.boite h2 {
  margin: 0 0 6px;
  font-size: min(26px, calc((100vw - 70px) / 17));
  white-space: nowrap;
  font-weight: normal;
  color: var(--jaune);
  text-shadow: 0 0 10px var(--rose), 3px 3px 0 #3b0a52;
}
.boite h3 { margin: 6px 0 0; font-size: 12px; font-weight: normal; color: var(--rose); }

button {
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--texte);
  background: rgba(46, 249, 255, 0.08);
  border: 2px solid var(--cyan);
  border-radius: 10px;
  padding: 13px 12px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
}
button:hover, button:focus-visible {
  outline: none;
  background: rgba(46, 249, 255, 0.2);
  box-shadow: 0 0 14px var(--cyan);
}
button:active { transform: scale(0.97); }
button.b-vert { border-color: var(--vert); background: rgba(57, 255, 106, 0.1); }
button.b-vert:hover, button.b-vert:focus-visible { background: rgba(57, 255, 106, 0.22); box-shadow: 0 0 14px var(--vert); }
button:disabled { opacity: 0.5; cursor: default; }

.ligne { display: flex; gap: 10px; }
.ligne button { flex: 1; }

.stats { display: grid; gap: 8px; font-size: 11px; }
.stats div { display: flex; justify-content: space-between; gap: 10px; color: var(--gris); }
.stats b { font-weight: normal; color: var(--texte); text-align: right; }
.stats div:first-child b { color: var(--jaune); font-size: 14px; }

form { display: flex; flex-direction: column; gap: 10px; margin: 0; }
label { font-size: 11px; color: var(--cyan); }
input {
  font: inherit;
  font-size: 16px;
  text-align: center;
  text-transform: uppercase;
  color: var(--jaune);
  background: #05011a;
  border: 2px solid var(--rose);
  border-radius: 10px;
  padding: 12px 8px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
input:focus { box-shadow: 0 0 14px var(--rose); }

.msg { min-height: 1em; margin: 0; font-size: 10px; line-height: 1.6; color: var(--jaune); }

ol#fin-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 11px; }
ol#fin-liste li { display: flex; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 6px; }
ol#fin-liste li:nth-child(1) { color: #ff3b5c; }
ol#fin-liste li:nth-child(2) { color: #ff9a2e; }
ol#fin-liste li:nth-child(3) { color: #ffe23d; }
ol#fin-liste li.moi { background: rgba(255, 43, 214, 0.22); outline: 1px solid var(--rose); animation: clign 0.8s steps(2) infinite; }
ol#fin-liste .rang { width: 2.6em; text-align: left; }
ol#fin-liste .nom { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol#fin-liste .pts { text-align: right; }

.astuce { margin: 4px 0 0; font-size: 8px; line-height: 1.9; color: var(--gris); }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center; font-size: 12px; }

@keyframes clign { 50% { background: rgba(255, 43, 214, 0.05); } }

@media (max-height: 520px) {
  .boite { padding: 12px 14px; gap: 8px; }
  .boite h2 { margin: 0; }
  button { padding: 9px 10px; }
  input { padding: 8px; }
  .stats { grid-template-columns: 1fr 1fr; column-gap: 18px; gap: 5px; font-size: 9px; }
  .stats div:first-child b { font-size: 11px; }
}

@media (pointer: coarse) {
  .astuce { display: none; }
}
