/* Coinx — thème « néon sombre » repris du logo : fond quasi noir, accents orange → rouge, lueurs douces. */
:root { --flame: #ff6a00; --hot: #ff2b00; --ink: #07090f; --card: #12151f; --line: #242a3b; }

html { -webkit-tap-highlight-color: transparent; }
body {
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(255, 106, 0, .14), transparent 60%),
    radial-gradient(600px 400px at 100% 110%, rgba(255, 43, 0, .08), transparent 60%),
    var(--ink);
  overscroll-behavior-y: none;
}
/* Contenu : réserve la place des icônes fixes (haut 4,5 rem ; bas 8,5 rem). Sans navigation (connexion) : marges réduites. */
#app { padding-top: calc(4.75rem + env(safe-area-inset-top)); padding-bottom: calc(9rem + env(safe-area-inset-bottom)); }
body.no-nav #app { padding-top: calc(1.5rem + env(safe-area-inset-top)); padding-bottom: 2.5rem; }
.font-display { font-family: 'Orbitron', 'Inter', system-ui, sans-serif; letter-spacing: .02em; }
.text-glow { text-shadow: 0 0 18px rgba(255, 106, 0, .55); }

/* Cartes */
.card {
  background: linear-gradient(180deg, #151a29, #0e111b);
  border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.neon { border-color: rgba(255, 106, 0, .35); box-shadow: 0 0 28px rgba(255, 80, 40, .14), 0 12px 30px rgba(0, 0, 0, .45); }
.stat { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .6rem; border-radius: .8rem; background: #0b0e16; border: 1px solid var(--line); }
.avatar {
  flex: none; width: 3.5rem; height: 3.5rem; border-radius: 999px; display: grid; place-items: center;
  font-family: 'Orbitron', sans-serif; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--flame), var(--hot)); box-shadow: 0 0 22px rgba(255, 80, 40, .45);
}

/* Boutons */
.btn {
  display: block; width: 100%; padding: .95rem 1rem; border-radius: .95rem;
  font-weight: 700; text-align: center; transition: transform .08s, opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-primary { background: linear-gradient(90deg, var(--flame), var(--hot)); color: #fff; box-shadow: 0 0 24px rgba(255, 80, 40, .35); }
.btn-primary:hover { box-shadow: 0 0 34px rgba(255, 80, 40, .55); }
.btn-ghost { border: 1px solid var(--line); color: #d4d4d8; background: rgba(255, 255, 255, .02); }
.btn-danger { background: #2a0b0b; color: #ffaaa0; border: 1px solid #7a231d; }

.input {
  width: 100%; padding: .85rem 1rem; border-radius: .8rem; font-size: 1rem;
  background: #0b0e16; border: 1px solid var(--line); color: #f4f4f5;
}
.input:focus { outline: none; border-color: var(--flame); box-shadow: 0 0 0 3px rgba(255, 106, 0, .2); }

/* Emplacements du lobby */
.slot {
  display: flex; flex-direction: column; justify-content: center; gap: .1rem; width: 100%;
  min-height: 4.25rem; padding: .6rem .8rem; border-radius: .9rem; text-align: left;
  background: var(--card); border: 1px solid var(--line);
}
.slot-me, .slot.slot-me, .slot.slot-me:hover {
  border: 2px solid var(--flame);
  background: linear-gradient(135deg, rgba(255, 106, 0, .24), rgba(255, 43, 0, .1)), var(--card);
  box-shadow: 0 0 22px rgba(255, 106, 0, .48), inset 0 0 12px rgba(255, 106, 0, .18);
}
.slot-me.slot-me-b, .slot.slot-me.slot-me-b {
  border-color: #38bdf8;
  background: linear-gradient(135deg, rgba(56, 189, 248, .24), rgba(14, 165, 233, .1)), var(--card);
  box-shadow: 0 0 22px rgba(56, 189, 248, .48), inset 0 0 12px rgba(56, 189, 248, .18);
}
.team-me {
  border-radius: 1rem;
  padding: .45rem;
  margin: -.45rem;
  border: 1px solid rgba(255, 106, 0, .38);
  background: linear-gradient(180deg, rgba(255, 106, 0, .09), rgba(255, 43, 0, .03));
  box-shadow: 0 0 24px rgba(255, 80, 40, .12);
}
.team-me-b {
  border-color: rgba(56, 189, 248, .38);
  background: linear-gradient(180deg, rgba(56, 189, 248, .09), rgba(14, 165, 233, .03));
  box-shadow: 0 0 24px rgba(56, 189, 248, .12);
}
.slot-empty { border-style: dashed; color: #71717a; align-items: center; font-weight: 600; }
button.slot-empty:active { border-color: var(--flame); color: var(--flame); }

.chip { font-size: .72rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }

/* Pop-up */
.modal { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: 1.25rem; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 4, 8, .72); backdrop-filter: blur(6px); animation: fade .18s ease-out; }
.modal-card {
  position: relative; width: 100%; max-width: 22rem; padding: 1.4rem; border-radius: 1.1rem;
  max-height: calc(100dvh - 2.5rem); overflow-y: auto;
  background: #12151f; border: 1px solid rgba(255, 106, 0, .3); box-shadow: 0 0 40px rgba(255, 80, 40, .2);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } }

/* Notifications */
#toast {
  position: fixed; left: 50%; bottom: calc(8.5rem + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 60;
  max-width: 90vw; padding: .7rem 1rem; border-radius: .8rem; font-size: .9rem;
  background: #1d2130; border: 1px solid var(--hot); opacity: 0; pointer-events: none; transition: .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Social / ligues */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .25rem; padding: .25rem; border-radius: .95rem; background: #0b0e16; border: 1px solid var(--line); }
.seg button { position: relative; padding: .6rem .2rem; border-radius: .72rem; font-size: .8rem; font-weight: 600; color: #a1a1aa; transition: color .2s, background .2s; }
.seg button.on { color: #fff; background: linear-gradient(90deg, rgba(255, 106, 0, .24), rgba(255, 43, 0, .18)); box-shadow: inset 0 0 0 1px rgba(255, 106, 0, .45); }
.dot { position: absolute; top: .1rem; right: .25rem; min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: 999px; display: grid; place-items: center; background: var(--hot); color: #fff; font-size: .65rem; font-weight: 800; box-shadow: 0 0 10px rgba(255, 43, 0, .7); }
.btn-sm { display: inline-block; width: auto; padding: .5rem .85rem; font-size: .8rem; border-radius: .7rem; }
.qr { position: relative; background: #fff; border-radius: 1rem; padding: .75rem; width: min(68vw, 15rem); margin: 0 auto; box-shadow: 0 0 34px rgba(255, 106, 0, .3); }
.qr svg, .qr img.qr-img { width: 100%; height: auto; display: block; }
.qr-mascot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 25%;
  height: 25%;
  border-radius: 9999px;
  background-color: #0b0e16;
  background-image: url('/img/mascot-base.jpg');
  background-size: cover;
  background-position: center;
  border: 2px solid var(--flame);
  box-shadow: 0 0 14px rgba(255, 106, 0, .75);
  pointer-events: none;
}
.qr-mascot.qr-mascot-friend {
  background-image: url('/img/mascot-friend.webp'), url('/img/mascot-friend.jpg');
  box-shadow: 0 0 14px rgba(255, 106, 0, .85);
}
.qr-mascot.qr-mascot-league {
  background-image: url('/img/mascot-league.webp'), url('/img/mascot-league.jpg');
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, .85);
}
.qr-mascot.qr-mascot-table,
.qr-mascot.qr-mascot-ephemeral {
  background-image: url('/img/mascot-base.jpg');
}
.qr-mascot.qr-mascot-table {
  border-color: var(--flame);
}
.qr-mascot.qr-mascot-ephemeral {
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, .9);
}
.pick { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .8rem; border-radius: .8rem; text-align: left; border: 1px solid var(--line); background: #0b0e16; transition: border-color .2s, box-shadow .2s; }
.pick.on { border-color: var(--flame); box-shadow: 0 0 14px rgba(255, 106, 0, .3); }
.row { display: flex; align-items: center; gap: .75rem; }
.avatar-sm { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 999px; display: grid; place-items: center; font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: .8rem; color: #fff; background: linear-gradient(135deg, var(--flame), var(--hot)); }

/* Navigation icônes : état actif (le survol est géré en Tailwind sur les <img>) */
.navbar.hidden { display: none; }
.nav-btn img { opacity: .8; }
.nav-btn.active img { opacity: 1; transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(255, 106, 0, .9)); }
.nav-btn:focus-visible { outline: 2px solid var(--flame); outline-offset: 4px; }
/* Logo : PNG transparent avec halo néon intégré (le contenu n'occupe que ~57 % de l'image : marges négatives pour ne pas perdre de place) */
.logo-img { display: block; width: min(15rem, 70vw); height: auto; aspect-ratio: 1; margin-top: -1.25rem; margin-bottom: -1.5rem; pointer-events: none; }
.logo-img.home-logo { width: min(17.25rem, 78vw); margin-top: -1.6rem; margin-bottom: -1.85rem; }

/* Bouton Scan central : plus gros, halo permanent légèrement pulsé (désactivé si « réduire les animations ») */
.nav-scan img { filter: drop-shadow(0 0 10px rgba(255, 43, 0, .65)); animation: scanGlow 2.8s ease-in-out infinite alternate; }
@keyframes scanGlow { to { filter: drop-shadow(0 0 20px rgba(255, 106, 0, .95)); } }

/* Boutons « néon » avec icône (Accueil) : même univers que la navigation */
.btn-icon { display: flex; align-items: center; justify-content: center; gap: .8rem; }
.btn-icon img { width: 2rem; height: 2rem; object-fit: contain; filter: drop-shadow(0 0 6px rgba(255, 43, 0, .7)); transition: transform .2s; }
.btn-icon:hover img { transform: scale(1.12); }
.btn-neon { background: linear-gradient(180deg, #151a29, #0b0e16); border: 1px solid rgba(255, 106, 0, .55); color: #fff;
  box-shadow: 0 0 22px rgba(255, 80, 40, .22), inset 0 0 18px rgba(255, 43, 0, .08); }
.btn-neon:hover { border-color: var(--flame); box-shadow: 0 0 30px rgba(255, 80, 40, .4), inset 0 0 18px rgba(255, 43, 0, .14); }

/* Accueil compact : logo plus petit pour tenir sans défilement */
.logo-img.logo-lg { width: min(18rem, 86vw); }

/* Saisie de l'école avec suggestions */
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; margin-top: .35rem; padding: .3rem; border-radius: .9rem; background: #12151f;
  border: 1px solid rgba(255, 106, 0, .35); box-shadow: 0 14px 30px rgba(0, 0, 0, .55); }
.ac-item { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; text-align: left; padding: .65rem .75rem; border-radius: .65rem; color: #e4e4e7; }
.ac-item[aria-selected="true"] { background: linear-gradient(90deg, rgba(255, 106, 0, .22), rgba(255, 43, 0, .16)); color: #fff; }
.ac-item kbd { font-size: .65rem; padding: .1rem .4rem; border-radius: .35rem; border: 1px solid var(--line); color: #a1a1aa; }
.input.is-valid { border-color: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .15); }

/* Planche de QR imprimable (page Admin) */
#print-sheet { display: none; }
@media print {
  body.printing > *:not(#print-sheet) { display: none !important; }
  body.printing { background: #fff !important; }
  #print-sheet { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 10mm; padding: 10mm; color: #000; font-family: Inter, Arial, sans-serif; }
  #print-sheet figure { break-inside: avoid; margin: 0; text-align: center; border: 1px dashed #999; border-radius: 4mm; padding: 8mm; }
  #print-sheet .qrp svg { width: 70mm; height: 70mm; }
  #print-sheet figcaption { margin-top: 4mm; font-size: 14pt; font-weight: 700; }
  #print-sheet figcaption span { font-weight: 400; color: #444; font-size: 11pt; }
  #print-sheet figcaption small { display: block; margin-top: 1mm; font-weight: 400; font-size: 8pt; color: #666; word-break: break-all; }
}


/* CoinX v10 — finition visuelle gaming / e-sport */
:root {
  color-scheme: dark;
  --surface-glass: rgba(17, 21, 33, .78);
  --line-soft: rgba(148, 163, 184, .14);
  --glow-orange: rgba(255, 106, 0, .22);
}
html { scroll-behavior: smooth; scrollbar-color: #63351f #090b12; }
body { min-height: 100vh; }
::selection { color: #fff; background: rgba(255, 106, 0, .42); }

/* Relief discret et réponse au survol des cartes interactives */
a.card, button.card, .card[role="button"] {
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}
a.card::before, button.card::before, .card[role="button"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--flame), var(--hot), transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
a.card:hover, button.card:hover, .card[role="button"]:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 106, 0, .48);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .38), 0 0 22px rgba(255, 80, 40, .09);
}
a.card:hover::before, button.card:hover::before, .card[role="button"]:hover::before { opacity: 1; }
a.card:active, button.card:active, .card[role="button"]:active { transform: scale(.985); }

/* Navigation mobile : icônes dans des pastilles en verre */
.nav-btn {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .09);
  background: linear-gradient(145deg, rgba(25, 29, 43, .84), rgba(8, 10, 17, .72));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.nav-btn img { transition: opacity .2s ease, transform .2s ease, filter .2s ease; }
.nav-btn:hover, .nav-btn.active {
  border-color: rgba(255, 106, 0, .58);
  background: linear-gradient(145deg, rgba(255, 106, 0, .16), rgba(18, 20, 31, .88));
  box-shadow: 0 0 22px rgba(255, 80, 40, .17), 0 8px 24px rgba(0, 0, 0, .38);
}
.nav-btn:active { transform: scale(.94); }
.nav-btn.active img { filter: drop-shadow(0 0 9px rgba(255, 106, 0, .85)); }
.nav-scan {
  border: 1px solid rgba(255, 106, 0, .55);
  background: radial-gradient(circle at 50% 35%, rgba(255, 106, 0, .2), rgba(12, 14, 22, .9) 70%);
  box-shadow: 0 0 30px rgba(255, 80, 40, .2), 0 12px 28px rgba(0, 0, 0, .5);
}
.nav-scan.active { box-shadow: 0 0 34px rgba(255, 80, 40, .38), 0 12px 28px rgba(0, 0, 0, .5); }

/* Contrôles plus cohérents, lisibles au clavier et sur écran tactile */
.btn { cursor: pointer; }
.btn:focus-visible, .pick:focus-visible, .slot:focus-visible, .seg button:focus-visible,
.input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid rgba(255, 145, 66, .95);
  outline-offset: 3px;
}
.input, select.input, textarea.input {
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.input:hover { border-color: rgba(255, 106, 0, .32); }
.input::placeholder { color: #71717a; }
.btn-ghost:hover { border-color: rgba(255, 106, 0, .42); background: rgba(255, 106, 0, .06); }
.btn-danger:hover { border-color: #ef4730; box-shadow: 0 0 18px rgba(239, 71, 48, .13); }
.slot, .pick { transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.slot:hover, .pick:hover { border-color: rgba(255, 106, 0, .4); }

/* Petites finitions : séparation, superposition et accessibilité */
#toast { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.modal-card { border-color: rgba(255, 106, 0, .38); }
@media (min-width: 640px) {
  #app { padding-left: 1.5rem; padding-right: 1.5rem; }
  .card { border-radius: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a.card:hover, button.card:hover, .card[role="button"]:hover { transform: none; }
}

/* CoinX v11 — accueil signature : animation unique, sobre et non intrusive. */
@keyframes coinx-home-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes coinx-elo-glow {
  from { text-shadow: 0 0 10px rgba(255, 106, 0, .22); }
  to { text-shadow: 0 0 21px rgba(255, 106, 0, .48); }
}
.home-logo { animation: coinx-home-reveal .48s ease-out both; }
.home-profile { animation: coinx-home-reveal .48s .07s ease-out both; }
.home-elo-card { animation: coinx-home-reveal .52s .14s ease-out both; }
.home-elo-value { animation: coinx-elo-glow 1.5s .45s ease-in-out both; }
@media (prefers-reduced-motion: reduce) {
  .home-logo, .home-profile, .home-elo-card, .home-elo-value { animation: none; }
}

/* Scan mobile : la page tient dans le viewport, sans rebond ni défilement inutile.
   Sur petits écrans / clavier ouvert, seul le contenu central peut défiler. */
body.scan-page { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
body.scan-page #app {
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(4.25rem + env(safe-area-inset-top));
  padding-bottom: calc(7rem + env(safe-area-inset-bottom));
  scrollbar-width: none;
}
body.scan-page #app::-webkit-scrollbar { display: none; }
body.scan-page #reader { min-height: 0; height: clamp(180px, 34dvh, 300px); }
body.scan-page #reader video { max-height: 100%; object-fit: cover; }
@media (max-height: 740px) {
  body.scan-page #app { padding-top: calc(3.85rem + env(safe-area-inset-top)); padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
  body.scan-page #reader { height: clamp(160px, 28dvh, 230px); }
  body.scan-page #manual { margin-top: .65rem; padding: .75rem; }
  body.scan-page #msg { margin-top: .5rem; }
}

/* CoinX v13 — espace de sécurité au bas du scanner (iPhone mini compris).
   Le bouton Scan est fixe et mesure 6rem : le formulaire ne doit jamais passer dessous. */
body.scan-page #app {
  box-sizing: border-box;
  padding-bottom: calc(10rem + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom));
}
@media (max-height: 740px) {
  body.scan-page #app {
    padding-bottom: calc(10rem + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom));
  }
}

/* Page Règles : masquer l'indicateur de défilement sans bloquer le scroll. */
body.rules-page { scrollbar-width: none; }
body.rules-page::-webkit-scrollbar { display: none; }
body.rules-page #app { scrollbar-width: none; }
body.rules-page #app::-webkit-scrollbar { display: none; }
