/* Street Fight — page de jeu (préparation, rue, écran de fin). */

body {
  background: #0d0812;
  color: #f3e9ff;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px 32px;
}

.cache { display: none !important; }
/* L'attribut hidden gagne toujours (les boutons ont un display à eux). */
[hidden] { display: none !important; }

/* Pendant la partie, les blocs latéraux s'effacent, et la barre du compte
   aussi : elle couvrait le score, le chrono et la vie du joueur 2. */
body.sf-en-jeu .bandeau-infos-wrap,
body.sf-en-jeu .bloc-jeux-une-wrap { display: none !important; }
body.sf-dans-la-rue .auth-nav { display: none !important; }

/* ===================== Préparation ===================== */

/* Assez étroit pour laisser la place aux blocs latéraux (Jeux à la une,
   Infos) sur un écran de 1280 px. */
.sf-setup { text-align: center; max-width: 780px; margin: 0 auto; }

.sf-surtitre { margin: 0 0 4px; font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; }
.sf-surtitre a { color: #fb923c; text-decoration: none; }

.sf-setup h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  background: linear-gradient(90deg, #fbbf24, #f97316, #dc2626);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sf-intro { max-width: 720px; margin: 0 auto 18px; color: #d8c9ea; line-height: 1.55; }

.sf-bloc { margin: 0 auto 18px; }
.sf-bloc h2, .sf-aide h2 { font-size: 1.05rem; color: #fcd9b6; margin: 0 0 10px; }

.sf-persos {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.carte-perso, .carte-perso2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  background: #1b1224;
  border: 2px solid #3a2a4a;
  border-radius: 12px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.carte-perso:hover, .carte-perso2:hover { border-color: #7c5a9c; transform: translateY(-2px); }
.carte-perso.choisi, .carte-perso2.choisi { border-color: #f97316; background: #2a1622; }

.perso-portrait {
  width: 96px;
  height: 96px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}
.portrait-martial-hero   { background-image: url(sprites/martial-hero/idle.png);   background-size: 1920px 240px;   background-position: -72px -60px; }
.portrait-martial-hero-2 { background-image: url(sprites/martial-hero-2/idle.png); background-size: 960px 240px;    background-position: -68px -72px; }
.portrait-martial-hero-3 { background-image: url(sprites/martial-hero-3/idle.png); background-size: 2016px 201.6px; background-position: -59px -50px; }
.portrait-wizard         { background-image: url(sprites/wizard/idle.png);         background-size: 1331px 182px;   background-position: -58px -46px; }

.perso-nom { font-weight: 700; color: #fff3e0; }
.perso-style { font-size: 0.8rem; color: #fb923c; text-transform: uppercase; letter-spacing: 0.06em; }
.perso-desc { font-size: 0.82rem; color: #bfaed3; line-height: 1.35; }

.sf-reglages { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.choix-difficulte, .choix-quartier { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.choix-difficulte button, .choix-quartier button {
  padding: 9px 16px;
  background: #1b1224;
  border: 2px solid #3a2a4a;
  border-radius: 999px;
  color: #e9dcf7;
  font: inherit;
  cursor: pointer;
}
.choix-difficulte button.choisi, .choix-quartier button.choisi { border-color: #f97316; background: #f97316; color: #1a0b05; font-weight: 700; }

.sf-note { font-size: 0.82rem; color: #a995c0; margin: 8px 0 0; }

.btn-lancer, .btn-secondaire {
  display: inline-block;
  padding: 13px 28px;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-lancer { background: linear-gradient(135deg, #dc2626, #ea580c); color: #fff; }
.btn-lancer:hover { filter: brightness(1.1); }
.btn-lancer:disabled { opacity: 0.6; cursor: wait; }
.btn-secondaire { background: #2a1d38; color: #f0e4ff; border: 2px solid #4b3864; padding: 10px 18px; font-size: 0.95rem; }
.btn-secondaire:hover { border-color: #f97316; }

.message-partie { min-height: 0; margin: 8px 0; color: #ffd9a0; display: none; }
.message-partie.visible { display: block; }
.message-partie.erreur { color: #ff8a8a; }

.sf-aide {
  max-width: 780px;
  margin: 26px auto 0;
  padding: 18px 22px;
  text-align: left;
  background: #160e1f;
  border: 1px solid #2f2240;
  border-radius: 14px;
}
.sf-aide ul { margin: 0; padding-left: 20px; line-height: 1.6; color: #dacbea; }
.sf-aide h2 + ul { margin-bottom: 4px; }
.sf-touches { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 0.92rem; }
.sf-touches th, .sf-touches td { padding: 7px 8px; border-bottom: 1px solid #2f2240; text-align: left; }
.sf-touches th { color: #fcd9b6; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border: 1px solid #5b4775;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #241833;
  font: inherit;
  font-size: 0.85em;
  text-align: center;
}

/* ===================== Rue ===================== */

.sf-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.sf-zone:fullscreen { justify-content: center; border-radius: 0; width: 100vw; height: 100vh; }

#rue { display: block; outline: none; image-rendering: pixelated; touch-action: none; }

.sf-barre { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 0; width: 100%; background: #0d0812; }
#btn-arret.a-confirmer { border-color: #f97316; background: #7c2d12; }

/* Messages par-dessus la rue (confirmation d'arrêt, partenaire parti, départ). */
.sf-bandeau-jeu {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  max-width: 90%; margin: 0; padding: 8px 14px; border-radius: 10px;
  background: rgba(15, 8, 24, 0.9); border: 1px solid #f97316; color: #ffe8c8;
  font-weight: 700; text-align: center; z-index: 4; display: none; pointer-events: none;
}
.sf-bandeau-jeu.visible { display: block; }
.sf-astuce-portrait { display: none; }
.btn-icone {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid #4b3864;
  background: #2a1d38;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}
.etat-reseau { color: #4ade80; font-size: 1.3rem; }
.etat-reseau.hors-ligne { color: #f87171; }

/* ===================== Écrans par-dessus la rue ===================== */

.sf-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(8, 3, 14, 0.78);
  z-index: 5;
}
.sf-overlay.visible { display: flex; }

.sf-carte {
  position: relative;
  width: min(560px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 22px 18px;
  background: #1a1024;
  border: 2px solid #f97316;
  border-radius: 16px;
  text-align: center;
}
.sf-carte h2 { margin: 0 0 6px; color: #fde68a; font-size: 1.6rem; }
.sf-carte p { margin: 4px 0; color: #e6d8f5; }
.sf-fermer {
  position: absolute;
  top: 6px;
  right: 10px;
  border: none;
  background: none;
  color: #e6d8f5;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.fin-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 14px 0 8px; }
.fin-stats.provisoire { opacity: 0.55; }
.stat-bloc {
  min-width: 92px;
  padding: 8px 10px;
  background: #251733;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.stat-valeur { font-size: 1.3rem; font-weight: 800; color: #fff3d6; }
.stat-label { font-size: 0.75rem; color: #b9a6cf; }

.overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }

/* Note de chaque quartier libéré, écart au record, compte à créer. */
.fin-notes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0; }
.note-q { padding: 3px 8px; border-radius: 8px; background: #251733; font-size: 0.85rem; }
.note-q b { font-size: 1rem; }
.note-S b { color: #ffd700; } .note-A b { color: #7dffb0; } .note-B b { color: #8ecbff; } .note-C b { color: #d0c4ff; }
.fin-record { color: #fcd9b6; font-size: 0.92rem; }
.fin-record:empty, .fin-notes:empty { display: none; }
.fin-compte { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 10px 0 4px; }
.fin-compte[hidden] { display: none; }

/* Défi du jour, à deux en ligne */
.sf-date-defi { color: #fb923c; margin: -4px 0 10px; text-transform: capitalize; }
.sf-defi-annonce { font-size: 1.1rem; margin: 0 0 14px; }
.defi-etat { margin: 10px auto 14px; max-width: 640px; line-height: 1.55; }
.defi-compte { max-width: 640px; margin: 16px auto; line-height: 1.55; }
.sf-classement-jour { max-width: 780px; margin: 26px auto 0; padding: 16px 18px; background: rgba(148, 163, 184, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.sf-classement-jour h2 { text-align: center; color: #fcd9b6; margin: 0 0 10px; font-size: 1.2rem; }
.classement-lien, .classement-invite { text-align: center; font-size: 0.9rem; }
.classement-lien a, .sf-note a, .sf-intro a, .defi-compte a { color: #fb923c; }
.sf-rejoindre { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.sf-rejoindre input, .sf-lien-invitation input {
  padding: 10px 12px; border-radius: 10px; border: 2px solid #4b3864; background: #1b1224; color: #fff; font: inherit;
}
.sf-rejoindre input { width: 9em; text-transform: uppercase; letter-spacing: 0.2em; text-align: center; }
.sf-lien-invitation { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.sf-lien-invitation input { width: min(420px, 100%); }
.sf-attente { padding: 14px; border: 1px dashed #f97316; border-radius: 14px; }

/* ===================== Tactile ===================== */

.sf-tactile { display: none; }

@media (pointer: coarse) {
  .sf-tactile {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
  }
  .sf-pad {
    position: absolute;
    left: 14px;
    bottom: 14px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    pointer-events: auto;
    touch-action: none;
    /* Discrète au repos : on voit la rue (et les ennemis qui arrivent de dos) au travers. */
    opacity: 0.5;
    transition: opacity 0.15s;
  }
  .sf-pad.actif { opacity: 0.95; }
  /* Sans clavier, « (Échap) » n'a pas de sens. */
  .sf-touche-clavier { display: none; }
  .sf-pad-manche {
    position: absolute;
    left: 38px;
    top: 38px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
  }
  .sf-boutons {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: grid;
    grid-template-columns: 66px 66px;
    gap: 10px;
    pointer-events: auto;
  }
  .sf-boutons button {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    touch-action: none;
  }
  .b-poing { background: rgba(220, 38, 38, 0.55); }
  .b-pied { background: rgba(234, 88, 12, 0.55); }
  .b-saut { background: rgba(37, 99, 235, 0.5); }
  .b-furie { background: rgba(147, 51, 234, 0.55); }
  .sf-boutons button.appuye { filter: brightness(1.6); }
  body[data-mode="duo"] .sf-tactile { display: none; }
}

/* Téléphone en paysage : la rue prend toute la hauteur, la barre se range en
   colonne sur le bord droit, au-dessus des boutons. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  #app { padding-top: 4px; padding-bottom: 4px; }
  body.sf-dans-la-rue #app { padding-left: 4px; padding-right: 4px; }
  .sf-zone .sf-barre {
    position: absolute; right: 6px; top: 28%; width: auto; flex-direction: column; gap: 6px; padding: 0;
    background: none; z-index: 4;
  }
  .sf-zone .sf-barre .btn-secondaire { padding: 6px 10px; font-size: 0.8rem; background: rgba(42, 29, 56, 0.85); }
  .sf-zone .sf-barre .btn-icone { width: 36px; height: 36px; font-size: 1rem; background: rgba(42, 29, 56, 0.85); }
}

/* Téléphone en portrait : les commandes passent SOUS la rue (elles la
   couvraient entièrement), avec une astuce pour tourner l'écran. */
@media (pointer: coarse) and (orientation: portrait) {
  body.sf-dans-la-rue #app { padding-left: 6px; padding-right: 6px; }
  .sf-zone .sf-tactile { position: relative; inset: auto; width: 100%; height: 170px; pointer-events: none; }
  .sf-zone .sf-pad { left: 18px; bottom: 22px; opacity: 0.8; }
  .sf-zone .sf-boutons { right: 16px; bottom: 12px; }
  .sf-astuce-portrait { display: block; text-align: center; font-size: 0.85rem; color: #bfaed3; margin: 8px 0 0; }
  body[data-mode="duo"] .sf-astuce-portrait { display: none; }
}

@media (max-width: 760px) {
  #app { padding: 12px 24px 24px; }
  .sf-persos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perso-desc { display: none; }
}
