@font-face { font-family: "Orbitron"; src: url("../fonts/orbitron-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Orbitron"; src: url("../fonts/orbitron-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Orbitron"; src: url("../fonts/orbitron-900.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "PressStart"; src: url("../fonts/press-start-2p.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --fond: #05020f;
  --cyan: #3ff0ff;
  --rose: #ff4fd8;
  --or: #ffd34d;
  --texte: #e9f1ff;
  --doux: #9fb0d8;
  --verre: rgba(10, 8, 34, 0.9);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
  color: var(--texte);
  font-family: "Orbitron", "Trebuchet MS", system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body { position: fixed; inset: 0; }

#jeu {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: none;
}
body.menu-actif #jeu { cursor: default; }

[hidden] { display: none !important; }

/* ---------- Écrans ---------- */
.ecran {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(3, 1, 12, 0.55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  z-index: 10;
  animation: apparition .25s ease-out;
}
.ecran.transparent { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }

@keyframes apparition { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }

.boite {
  width: min(420px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 22px 22px 20px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0) 40%),
    var(--verre);
  border: 1px solid rgba(160, 200, 255, 0.28);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.6),
    0 0 40px rgba(63, 240, 255, 0.18),
    0 20px 60px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.2);
  text-align: center;
}
.boite.large { width: min(640px, 100%); }
.defile { overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

h2 {
  margin: 0 0 6px;
  font-weight: 900;
  font-size: clamp(22px, 5vmin, 34px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 0%, #9fe9ff 45%, #2b4bb0 52%, #ff86e0 58%, #ffd98a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.8)) drop-shadow(0 0 14px rgba(63,240,255,0.35));
}
h3 { margin: 10px 0 4px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }

.info { margin: 0; font-family: system-ui, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; color: var(--doux); }
.petit-texte { font-size: 12.5px; }
.info b.or { color: var(--or); }
.info b.argent { color: #dfe6f5; }
.info b.rouge { color: #ff6a6a; }

.score-final { margin: 0; font-size: 18px; color: var(--doux); }
.score-final b { color: #fff; font-size: 26px; text-shadow: 0 0 12px rgba(63,240,255,0.7); }

/* ---------- Boutons ---------- */
button {
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--texte);
  padding: 11px 16px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(160, 200, 255, 0.35);
  background: linear-gradient(180deg, rgba(90, 110, 190, 0.45), rgba(30, 30, 80, 0.55));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 0 rgba(0,0,0,0.45);
  cursor: pointer;
  transition: transform .08s, box-shadow .15s, background .15s;
  touch-action: manipulation;
}
button:hover { background: linear-gradient(180deg, rgba(110, 140, 230, 0.6), rgba(40, 40, 110, 0.65)); }
button:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 0 rgba(0,0,0,0.45); }
button:focus { outline: none; }
button:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(63,240,255,0.65), 0 0 22px rgba(63,240,255,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
}
button b { color: var(--cyan); }

button.gros {
  font-size: 19px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 14px 18px;
  border: 1px solid rgba(255, 180, 240, 0.6);
  background: linear-gradient(180deg, #ff6fe0 0%, #b02cff 48%, #5a12c9 52%, #8b3dff 100%);
  text-shadow: 0 2px 0 rgba(0,0,0,0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 5px 0 #2a0661, 0 0 24px rgba(255,79,216,0.45);
}
button.gros:hover { filter: brightness(1.12); }
button.gros:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 30px rgba(255,79,216,0.9), inset 0 1px 0 rgba(255,255,255,0.55); }

button.petit { font-size: 12.5px; padding: 8px 10px; min-height: 40px; font-weight: 500; }

/* ---------- Titre ---------- */
.entete { display: flex; flex-direction: column; align-items: center; }
#titre { justify-content: flex-start; padding-top: max(4vh, env(safe-area-inset-top)); gap: 0.6vh; }

.logo {
  margin: 0;
  line-height: 0.92;
  font-weight: 900;
  font-size: clamp(38px, min(13vw, 13vh), 120px);
  letter-spacing: 0.04em;
  text-align: center;
  font-style: italic;
  transform: skewX(-6deg);
}
.logo span {
  display: block;
  background: linear-gradient(180deg, #ffffff 0%, #c9f4ff 22%, #4fc8ff 46%, #13206b 50%, #ff3fb4 53%, #ff9ad8 70%, #ffe7a8 100%);
  background-size: 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.35);
  filter: drop-shadow(0 3px 0 #0b0630) drop-shadow(0 6px 0 rgba(0,0,0,0.6)) drop-shadow(0 0 24px rgba(63,240,255,0.45));
  animation: lueur 3.2s ease-in-out infinite;
}
.logo span + span { font-size: 0.82em; animation-delay: -1.6s; }
@keyframes lueur {
  0%, 100% { filter: drop-shadow(0 3px 0 #0b0630) drop-shadow(0 6px 0 rgba(0,0,0,0.6)) drop-shadow(0 0 18px rgba(63,240,255,0.35)); }
  50% { filter: drop-shadow(0 3px 0 #0b0630) drop-shadow(0 6px 0 rgba(0,0,0,0.6)) drop-shadow(0 0 34px rgba(255,79,216,0.6)); }
}

.sous-titre {
  margin: 0.6vh 0 1.8vh;
  font-family: "PressStart", monospace;
  font-size: clamp(9px, 1.9vmin, 14px);
  color: #ffe58a;
  text-shadow: 0 2px 0 #000, 0 0 10px rgba(255, 210, 80, 0.6);
  letter-spacing: 0.08em;
  text-align: center;
}

.menu {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(6, 4, 26, 0.62);
  border: 1px solid rgba(160, 200, 255, 0.18);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.selecteur { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.selecteur .fleche { padding: 0; font-size: 14px; }
.niveau-depart { font-size: 13.5px; font-weight: 500; }
.options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }

/* Écrans bas (téléphone à l'horizontale) */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  #titre { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; align-content: center; gap: 2vw; padding-top: max(8px, env(safe-area-inset-top)); }
  #titre .entete { display: flex; flex-direction: column; align-items: center; }
  .logo { font-size: clamp(30px, 11vh, 70px); }
  .menu { gap: 6px; padding: 10px; }
  button { min-height: 38px; padding: 7px 12px; }
  button.gros { padding: 9px 14px; font-size: 16px; }
  .boite { padding: 14px; gap: 7px; }
  .sous-titre { margin-bottom: 0; }
}

/* ---------- Fin / Scores ---------- */
#fin-saisie { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
#fin-saisie label { font-size: 13px; color: var(--or); text-shadow: 0 0 10px rgba(255,211,77,0.5); }
#nom {
  font: 900 22px "Orbitron", sans-serif;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #fff;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--cyan);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 18px rgba(63,240,255,0.35) inset;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
}
#fin-boutons { display: flex; flex-direction: column; gap: 8px; }

.tableau { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: rang; }
.tableau li {
  counter-increment: rang;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  font-size: 14px;
}
.tableau li::before { content: counter(rang); font-weight: 900; color: var(--doux); }
.tableau li:nth-child(1) { background: linear-gradient(90deg, rgba(255,211,77,0.3), rgba(255,211,77,0.05)); }
.tableau li:nth-child(1)::before { color: var(--or); }
.tableau li:nth-child(2)::before { color: #dfe6f5; }
.tableau li:nth-child(3)::before { color: #e0955a; }
.tableau li.nouveau { outline: 1px solid var(--cyan); box-shadow: 0 0 14px rgba(63,240,255,0.5); }
.tableau .nom { text-align: left; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tableau .pts { font-weight: 900; color: #fff; }
.tableau .niv { display: block; font-size: 10px; font-weight: 500; color: var(--doux); }
.tableau .vide { grid-template-columns: 1fr; color: var(--doux); text-align: center; font-family: system-ui, sans-serif; }
.tableau .vide::before { content: none; }

.onglets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.onglet { font-size: 13px; padding: 8px 10px; min-height: 40px; opacity: 0.7; }
.onglet.actif {
  opacity: 1;
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(63,240,255,0.35), rgba(30,60,120,0.55));
  box-shadow: 0 0 16px rgba(63,240,255,0.35), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ---------- Aide ---------- */
.commandes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; text-align: left; }
.commandes > div { background: rgba(255,255,255,0.05); border-radius: 10px; padding: 6px 10px 10px; }
.commandes p { margin: 0; font-family: system-ui, "Segoe UI", sans-serif; font-size: 13px; line-height: 1.6; color: var(--doux); }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 5px;
  font: 700 11px "Orbitron", sans-serif;
  color: #fff;
  text-align: center;
  background: linear-gradient(180deg, #4a5378, #262b45);
  border: 1px solid #7180b3;
  box-shadow: 0 2px 0 #11131f;
}
.capsules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px; text-align: left; }
.capsules li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,0.04); }
.capsules canvas { flex: none; width: 56px; height: 26px; }
.capsules b { display: block; font-size: 13px; }
.capsules span { display: block; font-family: system-ui, "Segoe UI", sans-serif; font-size: 12.5px; color: var(--doux); }

/* ---------- Bouton pause flottant ---------- */
.flottant {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 5;
  width: 46px;
  height: 46px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(20, 18, 60, 0.55);
  border: 1px solid rgba(160, 200, 255, 0.35);
  box-shadow: 0 0 14px rgba(63,240,255,0.25);
  opacity: 0.8;
}
.flottant svg { width: 20px; height: 20px; fill: #dff6ff; }
