/* TYPING OF THE DEV — habillage CRT phosphore */

@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/vt323-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/vt323-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0;
}

:root {
  --green: #39d0ff;
  --green-dim: #1a5f7a;       /* décor uniquement (contraste insuffisant pour du petit texte) */
  --green-dim-text: #3a9fc4;  /* même teinte, contraste AA pour le petit texte */
  --amber: #ffb000;
  --red: #ff3b3b;
  --bg: #04080c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  cursor: none; /* stand : tout au clavier */
}

/* ------------------------------------------------ cadre CRT */
.crt-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(ellipse at center, #07141e 0%, #04080c 75%);
}

#game-container {
  position: absolute;
  inset: 0;
}
#game-container canvas {
  border-radius: 18px;
  box-shadow:
    inset 0 0 120px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(57, 208, 255, 0.10);
}

/* scanlines */
.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.22) 2px 4px
  );
}

/* masque RGB subtil */
.crt-rgb {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
  opacity: 0.35;
  background: repeating-linear-gradient(
    to right,
    rgba(255, 0, 60, 0.05) 0 1px,
    rgba(0, 255, 120, 0.05) 1px 2px,
    rgba(0, 80, 255, 0.05) 2px 3px
  );
}

.crt-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  background: radial-gradient(ellipse at center,
    transparent 58%, rgba(0, 0, 0, 0.42) 100%);
}

.crt-flicker {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 13;
  background: rgba(150, 220, 255, 0.025);
  animation: flicker 0.12s infinite;
}
@keyframes flicker {
  0%   { opacity: 0.9; }
  50%  { opacity: 0.6; }
  100% { opacity: 0.85; }
}

/* ------------------------------------------------ formulaire fin de partie */
#save-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: flex-end; /* à droite : les stats de la partie restent visibles à gauche */
  padding-right: 6vw;
  background: transparent;
  pointer-events: none;
  cursor: auto;
}
#save-overlay.visible { display: flex; }

#save-form {
  pointer-events: auto;
  width: min(580px, 46vw);
  padding: 30px 36px;
  background: rgba(4, 10, 18, 0.97);
  border: 2px solid var(--green-dim);
  border-radius: 10px;
  box-shadow: 0 0 50px rgba(57, 208, 255, 0.18), inset 0 0 30px rgba(0, 0, 0, 0.6);
  font-family: 'VT323', monospace;
  color: var(--green);
}
#save-form h2 {
  font-size: 38px;
  font-weight: 400;
  color: var(--amber);
  margin-bottom: 22px;
  animation: cursor-blink 1.1s steps(1) infinite;
}
@keyframes cursor-blink { 50% { opacity: 0.55; } }

#save-form .row {
  display: flex;
  gap: 16px;
}
#save-form .row > div { flex: 1; min-width: 0; }

#save-form label {
  display: block;
  font-size: 24px;
  margin: 14px 0 4px;
  color: var(--green);
}
#save-form .opt { color: var(--green-dim-text); font-size: 20px; }

#save-form input[type="text"],
#save-form input[type="email"],
#save-form input[type="tel"] {
  width: 100%;
  padding: 10px 14px;
  font-family: 'VT323', monospace;
  font-size: 28px;
  color: var(--amber);
  background: #04080c;
  border: 1px solid var(--green-dim);
  border-radius: 4px;
  outline: none;
  caret-color: var(--green);
}
#save-form input:focus { border-color: var(--green); box-shadow: 0 0 12px rgba(57, 208, 255, 0.3); }

#save-form .consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  font-size: 19px;
  color: var(--green-dim-text);
  line-height: 1.25;
}
#save-form .consent input {
  width: 22px; height: 22px;
  accent-color: #39d0ff;
  flex-shrink: 0;
  margin-top: 2px;
}

.form-actions {
  display: flex;
  gap: 18px;
  margin-top: 28px;
}
.form-actions button {
  font-family: 'VT323', monospace;
  font-size: 28px;
  padding: 8px 22px;
  background: transparent;
  border: 1px solid var(--green);
  border-radius: 4px;
  color: var(--green);
  cursor: pointer;
}
.form-actions button[type="submit"] {
  background: var(--green);
  color: #03140a;
}
.form-actions button:hover { box-shadow: 0 0 16px rgba(57, 208, 255, 0.5); }
#btn-skip { border-color: var(--green-dim); color: var(--green-dim-text); }

/* focus clavier visible sur les boutons (les inputs ont déjà leur style :focus) */
.form-actions button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  box-shadow: 0 0 16px rgba(57, 208, 255, 0.5);
}

/* ------------------------------------------------ animations réduites */
@media (prefers-reduced-motion: reduce) {
  .crt-flicker { display: none; }
  .crt-rgb { opacity: 0.2; }
  #save-form h2 { animation: none; }
}
