@font-face { font-family: 'Bungee'; src: url('./fonts/bungee.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lilita One'; src: url('./fonts/lilita-one.woff2') format('woff2'); font-display: swap; }

:root {
  --fond: #07021a;
  --rose: #ff2bd6;
  --cyan: #20e8ff;
  --jaune: #ffd23f;
  --violet: #7a3cff;
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fond);
  color: #fff;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Lilita One', 'Trebuchet MS', system-ui, sans-serif;
  letter-spacing: .2px;
}
body { position: fixed; inset: 0; }

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

/* sert à lire les marges de sécurité (encoches) depuis le JS */
#safe { position: fixed; inset: 0; pointer-events: none; visibility: hidden;
  padding: var(--st) var(--sr) var(--sb) var(--sl); }

/* ---------- boutons ronds en haut à droite ---------- */
#hud-boutons {
  position: fixed; z-index: 30;
  top: calc(8px + var(--st)); right: calc(8px + var(--sr));
  display: flex; gap: 8px;
}
.rond {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(20,5,50,.55);
  color: #fff; font: 18px/1 'Bungee', sans-serif;
  display: grid; place-items: center; cursor: pointer; padding: 0;
  backdrop-filter: blur(3px);
}
.rond:active { transform: scale(.92); }
.rond.coupe { opacity: .55; text-decoration: line-through; }
.cache { display: none !important; }

/* ---------- écrans ---------- */
.ecran {
  position: fixed; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  padding: calc(10px + var(--st)) calc(10px + var(--sr)) calc(10px + var(--sb)) calc(10px + var(--sl));
  background: radial-gradient(ellipse at center, rgba(7,2,26,.25) 0%, rgba(7,2,26,.78) 100%);
}
.ecran.visible { display: flex; animation: apparait .25s ease-out; }
@keyframes apparait { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

.carte {
  width: min(540px, 100%);
  max-height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: linear-gradient(160deg, rgba(46,12,100,.9), rgba(14,4,40,.94));
  border: 2px solid rgba(255,43,214,.65);
  border-radius: 24px;
  box-shadow: 0 0 34px rgba(255,43,214,.35), inset 0 0 40px rgba(32,232,255,.07);
  padding: 22px 22px 16px;
  text-align: center;
}
.carte.titre { background: linear-gradient(160deg, rgba(46,12,100,.72), rgba(14,4,40,.82)); }

h1, h2, h3 { font-family: 'Bungee', 'Impact', sans-serif; font-weight: 400; margin: 4px 0 10px; }
h2 { font-size: 26px; color: var(--jaune); text-shadow: 0 3px 0 #5a1a8a, 0 0 14px rgba(255,210,63,.45); }
h3 { font-size: 17px; color: var(--cyan); margin-top: 16px; }

.logo {
  font-size: clamp(44px, 13vw, 88px); line-height: 1; margin: 2px 0 2px;
  background: linear-gradient(180deg, #fffbc2 0%, #ffd23f 32%, #ff6a3d 55%, #ff2bd6 75%, #8a4dff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 5px 0 #2a0650) drop-shadow(0 0 20px rgba(255,43,214,.55));
  animation: respire 2.6s ease-in-out infinite;
}
@keyframes respire { 0%,100% { transform: scale(1) rotate(-1deg); } 50% { transform: scale(1.04) rotate(1deg); } }
.accroche { margin: 2px 0 16px; font-size: 19px; color: #ffd6f7; }

.btn {
  display: block; width: 100%; margin: 10px 0; padding: 13px 16px;
  font: 400 20px/1.1 'Bungee', 'Impact', sans-serif;
  color: #1a0433;
  background: linear-gradient(180deg, #fff27a, #ffb627);
  border: none; border-radius: 15px;
  box-shadow: 0 5px 0 #b3610a, 0 0 20px rgba(255,210,63,.35);
  cursor: pointer;
  transition: transform .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b3610a; }
.btn small { font-size: 12px; opacity: .7; margin-left: 6px; }
.btn.secondaire { color: #04122e; background: linear-gradient(180deg, #8af7ff, #22b4ff); box-shadow: 0 5px 0 #0a5b9e, 0 0 20px rgba(32,232,255,.3); }
.btn.secondaire:active { box-shadow: 0 2px 0 #0a5b9e; }
.btn.discret { color: #fff; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.28); box-shadow: none; font-size: 15px; padding: 11px 10px; }
.btn.mini { width: auto; margin: 0; padding: 10px 14px; font-size: 15px; }
.btn:focus-visible, .rond:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ligne-btn { display: flex; gap: 10px; }
.ligne-btn .btn { margin-top: 2px; }

.record { min-height: 1.2em; margin: 8px 0 2px; color: var(--jaune); font-size: 16px; }
.credit { margin: 6px 0 0; font-size: 12px; opacity: .55; }
.petit { margin: 4px 0; font-size: 15px; color: #e8dcff; }

/* aide */
.aide { text-align: left; width: min(620px, 100%); }
.aide h2, .aide .btn { text-align: center; }
.regle p { margin: 8px 0; font-size: 16px; line-height: 1.35; color: #f3eaff; }
.regle b { color: var(--jaune); font-weight: 400; }
.bonus-liste { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 4px; font-size: 15px; }
.bonus-liste span { display: inline-flex; align-items: center; gap: 6px; }
.pastille { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 11px;
  font: 400 12px/1 'Bungee', sans-serif; font-style: normal; color: #fff; box-shadow: 0 0 10px currentColor; }
.pastille.b { background: #2f7dff; color: #fff; }
.pastille.t3 { background: #ff2bd6; }
.pastille.tu { background: #ff8a1f; }
.pastille.an { background: #1fcf6a; }
.pastille.vi { background: #ff3d5a; }
.commandes { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.commandes th { text-align: left; vertical-align: top; padding: 6px 10px 6px 0; color: var(--cyan); font-weight: 400; white-space: nowrap; }
.commandes td { padding: 6px 0; color: #f3eaff; line-height: 1.3; }
.commandes tr + tr { border-top: 1px solid rgba(255,255,255,.1); }

/* scores */
.liste-scores { list-style: none; padding: 0; margin: 10px 0; text-align: left; counter-reset: none; }
.liste-scores li { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 10px; font-size: 17px; }
.liste-scores li:nth-child(odd) { background: rgba(255,255,255,.05); }
.liste-scores li.moi { background: rgba(255,210,63,.22); outline: 1px solid rgba(255,210,63,.6); }
.liste-scores .rang { font-family: 'Bungee', sans-serif; width: 2.2em; color: var(--rose); }
.liste-scores .nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste-scores .pts { font-family: 'Bungee', sans-serif; color: var(--jaune); }
.liste-scores li.vide { justify-content: center; opacity: .7; }

/* fin */
.titre-fin { font-size: 38px; color: var(--rose); text-shadow: 0 4px 0 #3a0a5e, 0 0 18px rgba(255,43,214,.6); }
.gros-score { font: 400 44px/1 'Bungee', sans-serif; color: var(--jaune); margin: 6px 0; text-shadow: 0 0 18px rgba(255,210,63,.5); }
#form-score label { display: block; font-size: 15px; margin: 12px 0 6px; color: #e8dcff; }
.ligne-saisie { display: flex; gap: 8px; }
#pseudo {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 2px solid rgba(32,232,255,.6);
  background: rgba(0,0,0,.35); color: #fff; font: 400 18px 'Lilita One', sans-serif;
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
}
#pseudo:focus { outline: none; border-color: var(--jaune); box-shadow: 0 0 12px rgba(255,210,63,.5); }
.statut { min-height: 1.3em; margin: 8px 0 0; font-size: 15px; color: var(--cyan); }
.statut.erreur { color: #ff8aa0; }

.btn:disabled { opacity: .45; filter: grayscale(.7); cursor: default; box-shadow: none; transform: none; }

/* salon multijoueur */
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.place {
  border: 2px dashed rgba(255,255,255,.25); border-radius: 14px; padding: 10px 8px; min-height: 66px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 14px; color: #cfc2ee;
}
.place.pris { border-style: solid; color: #fff; box-shadow: 0 0 14px var(--c); border-color: var(--c); background: rgba(255,255,255,.06); }
.place .qui { font: 400 16px/1 'Bungee', sans-serif; color: var(--c); }
.astuce b { color: var(--jaune); font-weight: 400; }

/* petits écrans en paysage (téléphone couché) */
@media (max-height: 520px) {
  .carte { padding: 12px 16px 10px; border-radius: 18px; }
  .logo { font-size: clamp(36px, 9vh, 60px); }
  .accroche { margin-bottom: 8px; font-size: 16px; }
  .btn { padding: 10px 12px; margin: 7px 0; font-size: 17px; }
  .btn.discret { font-size: 13px; padding: 8px; }
  h2 { font-size: 21px; margin-bottom: 6px; }
  .gros-score { font-size: 34px; }
  .titre.carte .btn:not(.discret) { display: inline-block; width: calc(50% - 6px); margin: 4px 2px; }
}
