/* Swish — styles. Affiche art déco bleu nuit et or (style n° 5, choix du porteur, 20 oct. 2026) : cadres, boutons et
   icônes peints par Codex (img/), étirés en 9 parties (coins à gradins gardés, centre uni où le jeu écrit). La découpe prend TOUT l'ornement du coin
   (46 / 44 / 40 px mesurés) : coupé, il était étiré le long des bords et faisait des traînées floues (S9, 20 oct.) ;
   le dessin peut déborder sur le rembourrage (border-image-width > border-width) sans changer la mise en page ; une seule
   couleur vive, l'orange du ballon, pour l'action principale. Police : Josefin Sans (OFL, polices/).
   Téléphone d'abord : chaque écran tient dans 740 × 360 (paysage). */
@font-face { font-family: 'Josefin'; src: url(polices/josefin-sans-400.woff2) format('woff2'); font-weight: 400; font-display: block; }
@font-face { font-family: 'Josefin'; src: url(polices/josefin-sans-600.woff2) format('woff2'); font-weight: 600; font-display: block; }
@font-face { font-family: 'Josefin'; src: url(polices/josefin-sans-700.woff2) format('woff2'); font-weight: 700; font-display: block; }
:root {
  --nuit: #0b2a4a;
  --nuit-claire: #163d63;
  --nuit-voile: rgba(6, 22, 40, .72);
  --or: #f0bd4f;
  --or-pale: #f7dc95;
  --creme: #f6ecd6;
  --vif: #f2701f;
  --texte-clair: #f6ecd6;
  --police: 'Josefin', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { font-family: var(--police); color: var(--texte-clair); -webkit-tap-highlight-color: transparent; user-select: none; touch-action: none; }
[hidden] { display: none !important; }
img { pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
h2, h3 { font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

/* La scène et le fond des menus : l'illustration, voilée côté menu (à gauche). */
#jeu { position: fixed; inset: 0; z-index: 1; visibility: hidden; }
body.en-partie #jeu { visibility: visible; }
#fond-menus { position: fixed; inset: 0; z-index: 2; background: var(--nuit); }
#fond-menus .illustration { position: absolute; inset: 0; background: url(img/illustration.webp) 70% center / cover no-repeat; }
#fond-menus .voile { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,22,40,.82) 0%, rgba(6,22,40,.45) 50%, rgba(6,22,40,.2) 100%); }
body.en-partie #fond-menus { display: none; }

/* Premier écran : l'affiche entière, le titre dans le ciel calme, « Jouer » en bas. */
#titre { position: fixed; inset: 0; z-index: 31; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 7vh 16px 8vh; background: var(--nuit); }
#titre .illustration { position: absolute; inset: 0; background: url(img/illustration.webp) 70% center / cover no-repeat; }
#titre .titre-jeu { position: relative; width: min(64vw, 520px); max-height: 40vh; object-fit: contain; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
#titre .bas { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#telechargement { font-size: 13px; display: flex; gap: 8px; align-items: center; }

/* Boutons peints (9 parties). */
.bouton-vif, .bouton-filet { border: 17px solid transparent; border-image: url(img/bouton-vif.webp) 44 fill / 24px stretch; padding: 4px 14px; min-height: 52px; font-weight: 700; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 0 rgba(120,40,0,.45); }
.bouton-filet { border-image-source: url(img/bouton-filet.webp); color: var(--or-pale); text-shadow: none; font-weight: 600; font-size: 15px; min-height: 48px; }
.bouton-vif.grand { font-size: 24px; padding: 6px 46px; border-width: 20px; border-image-width: 28px; }
.bouton-vif.petit, .bouton-filet.petit { font-size: 13px; padding: 0 8px; min-height: 40px; border-width: 13px; border-image-width: 18px; }
.appuye { transform: translateY(2px) scale(.98); filter: brightness(.9); }
.lien-texte { text-decoration: underline; font-size: 13px; opacity: .8; padding: 6px; color: var(--or-pale); }
.rond { width: 52px; height: 52px; padding: 0; border: 12px solid transparent; border-image: url(img/cadre-carre.webp) 26 fill / 12px stretch; display: grid; place-items: center; }
.rond .ic { width: 24px; height: 24px; }
.bouton-app { padding: 12px 22px; border-radius: 4px; color: #fff; font-weight: 700; min-height: 48px; }
.bouton-app.whatsapp { background: #25d366; }
.bouton-app.telegram { background: #2aa3e0; }
.ic { width: 28px; height: 28px; object-fit: contain; flex: none; }

/* Panneaux : le cadre doré à gradins, fond bleu nuit. */
.panneau { border: 16px solid transparent; border-image: url(img/panneau.webp) 46 fill / 22px stretch; padding: 8px 12px; max-width: 560px; width: 100%; color: var(--creme); }
.panneau h3 { margin: 0 0 8px; font-size: 13px; color: var(--or); }
.panneau.centre { width: min(92vw, 420px); }

/* Écrans de menu. */
.ecran { position: fixed; inset: 0; z-index: 10; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); }
.ecran.voile { z-index: 25; background: rgba(4,16,30,.62); display: flex; align-items: center; justify-content: center; }
.barre-haut { display: flex; align-items: center; gap: 12px; height: 52px; }
.barre-haut h2 { margin: 0; font-size: 20px; color: var(--or-pale); }
.retour { width: 48px; height: 48px; display: grid; place-items: center; }
.contenu { height: calc(100% - 52px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; }
.contenu.deux { flex-direction: row; align-items: stretch; padding: 8px 0 60px; }
.pile { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.ligne-boutons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.regle { font-size: 15px; line-height: 1.4; margin: 4px 0 10px; }
.texte-centre { text-align: center; }
.sous-bouton { font-size: 13px; opacity: .75; margin: 6px 0 0; text-align: center; }

/* Menu : tout au centre (titre, puis les modes et le classement côte à côte, de même hauteur) ; dans les coins,
   seulement ce qui y est collé : réglages en haut à droite, usrati.games en bas à gauche, le chat en bas à droite. */
#menu { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: min(4vh, 18px); padding-bottom: 62px; }
#menu .titre-menu { width: min(34vw, 300px); max-height: 20vh; object-fit: contain; }
.groupe-menu { display: flex; gap: 16px; align-items: stretch; justify-content: center; width: min(86%, 660px); }
#menu .liste { flex: 0 1 380px; display: flex; flex-direction: column; justify-content: center; gap: 10px; min-width: 0; }
.entree { display: flex; align-items: center; gap: 14px; text-align: left; padding: 6px 14px; min-height: 66px; border: 16px solid transparent; border-image: url(img/bouton-filet.webp) 44 fill / 23px stretch; color: var(--creme); background: rgba(6,22,40,.35); background-clip: padding-box; }
.entree.principale { border-image-source: url(img/bouton-vif.webp); color: #fff; background: none; }
.entree .mots { display: flex; flex-direction: column; gap: 2px; }
.entree b { font-size: 19px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.entree small { font-size: 13px; opacity: .9; }
.entree em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--or-pale); }
.entree.principale em { color: #fff3c9; }
#menu .colonne-droite { flex: 0 1 300px; min-width: 0; border: 16px solid transparent; border-image: url(img/panneau.webp) 46 fill / 22px stretch; padding: 4px 10px; overflow-y: auto; touch-action: pan-y; max-height: 52vh; }
#menu .colonne-droite h3 { margin: 2px 0 6px; font-size: 13px; color: var(--or); }
.ligne-ami { display: flex; align-items: center; gap: 10px; height: 44px; border-bottom: 1px solid rgba(240,189,79,.18); }
.ligne-ami em { width: 20px; text-align: right; font-style: normal; color: var(--or); font-weight: 700; }
.ligne-ami b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-ami i { font-style: normal; font-weight: 700; color: var(--or-pale); font-variant-numeric: tabular-nums; }
.ligne-ami.moi b { color: #fff; }
.ami-av { width: 30px; height: 30px; border-radius: 2px; background: var(--nuit-claire) center / cover; flex: none; border: 1px solid rgba(240,189,79,.5); }
.note { font-size: 13px; opacity: .75; line-height: 1.4; }
#menu .reglages { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
#liens-plateforme { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 16px; align-items: center; }
.lien { font-size: 12px; opacity: .8; padding: 6px 0; color: var(--or-pale); text-decoration: underline; letter-spacing: .04em; }

/* Multijoueur. */
#multi .panneau { max-width: 360px; }
#liste-amis { display: flex; flex-direction: column; max-height: 46vh; overflow-y: auto; touch-action: pan-y; }
.ami { display: flex; align-items: center; gap: 10px; min-height: 44px; text-align: left; width: 100%; }
.ami-nom { flex: 1; display: flex; flex-direction: column; }
.ami-nom small { opacity: .65; font-size: 12px; }
.ami.hors-ligne { opacity: .5; }
.ami-inviter { font-weight: 700; color: var(--vif); text-transform: uppercase; font-size: 13px; letter-spacing: .06em; }
.vide { font-size: 13px; opacity: .7; }
#places { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.place { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 112px; padding: 10px; border: 1px solid rgba(240,189,79,.5); }
.place.libre { opacity: .55; border-style: dashed; }
.place .ami-av { width: 44px; height: 44px; }
.place small { font-size: 11px; opacity: .7; }
#carte-invitation { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: 14px; border: 16px solid transparent; border-image: url(img/panneau.webp) 46 fill / 22px stretch; padding: 4px 10px; }
#carte-invitation p { margin: 0 0 8px; }
#carte-invitation .ligne { display: flex; gap: 8px; }

/* Réglages. */
.reglage { display: flex; align-items: center; justify-content: space-between; min-height: 48px; border-bottom: 1px solid rgba(240,189,79,.18); gap: 16px; }
.interrupteur { width: 54px; height: 30px; border-radius: 15px; background: #3a5675; position: relative; transition: background .15s; border: 1px solid rgba(240,189,79,.5); }
.interrupteur i { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--creme); transition: transform .15s; }
.interrupteur[aria-checked="true"] { background: var(--vif); }
.interrupteur[aria-checked="true"] i { transform: translateX(24px); }
.choix { display: flex; gap: 6px; }
.choix button { padding: 7px 12px; border: 1px solid rgba(240,189,79,.6); font-size: 14px; }
.choix button.actif { background: var(--or); color: var(--nuit); }
#r-tuto { margin-top: 12px; width: 100%; }
.version-jeu { margin-top: 10px; font-size: 12px; opacity: .65; display: flex; justify-content: space-between; align-items: center; }

/* En partie : le chrono et le score sur deux plaques dorées, la pause dans son cadre. */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud button { pointer-events: auto; }
.plaque, #chrono, #score, .adverse { border: 13px solid transparent; border-image: url(img/plaque.webp) 40 fill / 20px stretch; }
#chrono { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); display: flex; align-items: baseline; gap: 3px; padding: 0 8px; }
#chrono b { min-width: 2ch; text-align: center; font-size: max(32px, 6.4vh); font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1.1; color: var(--creme); }
#chrono small { font-size: 15px; color: var(--or); }
#chrono.urgent b { color: #ff8a4c; }
#chrono.tic { animation: tic .25s ease-out; }
#chrono.gagne { animation: gagne .45s ease-out; }
@keyframes tic { 50% { transform: scale(1.08); } }
@keyframes gagne { 40% { transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(240,189,79,.9)); } }
#temps-gagne { position: absolute; left: 100%; top: 4px; margin-left: 18px; font-weight: 700; font-size: 22px; color: #fff; opacity: 0; white-space: nowrap; text-shadow: 0 2px 0 var(--nuit); }
#temps-gagne.dore { color: var(--or-pale); }
#temps-gagne.on { animation: monte 1s ease-out; }
@keyframes monte { 0% { opacity: 0; transform: translateY(10px); } 20% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }
#score { position: absolute; top: max(8px, env(safe-area-inset-top)); right: calc(max(12px, env(safe-area-inset-right)) + 62px); display: flex; align-items: baseline; gap: 6px; padding: 0 8px; }
#score b { font-size: max(32px, 6.4vh); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--creme); }
#score small { font-size: 13px; color: var(--or); text-transform: uppercase; letter-spacing: .08em; }
#score.pop { animation: tic .3s ease-out; }
#scores-duel { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.adverse { padding: 0 6px; display: flex; gap: 8px; align-items: baseline; }
.adverse b { font-size: 13px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--or-pale); }
.adverse i { font-style: normal; font-size: 26px; font-weight: 700; color: var(--creme); }
.adverse.fini { opacity: .6; }
#b-pause { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: 56px; height: 56px; border: 0; border-image: none; background: url(img/bouton-carre.webp) center / contain no-repeat; }
#b-pause .ic { display: none; }
#compte { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22vh; font-weight: 700; opacity: 0; color: var(--or-pale); text-shadow: 0 6px 0 var(--nuit); letter-spacing: .06em; }
#compte.on { animation: compte .9s ease-out; }
@keyframes compte { 0% { opacity: 0; transform: scale(1.4); } 25% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#aide { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); margin: 0; background: var(--nuit-voile); border: 1px solid rgba(240,189,79,.5); padding: 8px 16px; font-size: 15px; opacity: 0; transition: opacity .3s; white-space: nowrap; letter-spacing: .03em; }
#aide.on { opacity: 1; }

/* Fin : deux colonnes en paysage. */
.fin-deux { width: min(92vw, 640px) !important; display: flex; gap: 22px; align-items: center; }
.fin-score { flex: 1; text-align: center; }
.fin-score h2 { margin: 0 0 4px; font-size: 18px; color: var(--or); }
.gros-score { display: flex; justify-content: center; align-items: center; gap: 10px; }
.gros-score b { font-size: min(22vh, 120px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--creme); }
.fanion { width: 54px; height: auto; }
.fin-detail { flex: 1; display: flex; flex-direction: column; gap: 14px; }
#stats-fin { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 15px; }
#stats-fin b { text-align: right; color: var(--or-pale); }
#stats-fin .classement { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; padding: 4px 0; }
#stats-fin .classement em { font-style: normal; width: 18px; color: var(--or); }
#stats-fin .classement b { flex: 1; text-align: left; color: var(--creme); }
#stats-fin .classement i { font-style: normal; font-weight: 700; }
#stats-fin .classement.moi b { color: var(--vif); }
#stats-fin .attente { grid-column: 1 / -1; margin: 0; opacity: .75; }

/* Tutoriel : la bulle en haut (le geste part du bas de l'écran, elle ne doit jamais le recouvrir). */
#tuto { position: fixed; z-index: 20; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(540px, calc(100vw - 150px)); border: 16px solid transparent; border-image: url(img/panneau.webp) 46 fill / 22px stretch; padding: 0 6px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
#tuto { transition: opacity .2s ease, transform .2s ease; }
#tuto.efface { opacity: 0; transform: translate(-50%, -110%); pointer-events: none; }
#tuto small { grid-column: 1; font-size: 12px; color: var(--or); }
#tuto p { grid-column: 1; margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
#tuto em { grid-column: 1; font-style: normal; color: #ffb27a; font-size: 14px; }
#tuto em.secoue { animation: secoue .35s; }
@keyframes secoue { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
#tuto button { grid-column: 2; grid-row: 1 / span 3; }
#main-tuto { position: fixed; z-index: 19; left: 16%; bottom: 20%; width: 56px; height: auto; filter: drop-shadow(0 3px 6px rgba(0,0,0,.45)); animation: glisse 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes glisse { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translate(60px, -150px); opacity: 1; } 100% { transform: translate(60px, -150px); opacity: 0; } }

/* Tourner le téléphone. */
#tourner { position: fixed; inset: 0; z-index: 30; background: var(--nuit) url(img/illustration.webp) center / cover; display: none; align-items: center; justify-content: center; text-align: center; padding: 24px; }
#tourner .centre { background: var(--nuit-voile); padding: 20px; }
#tourner img { width: min(60vw, 300px); }

/* Toasts : en bas à gauche, une petite icône selon le genre. */
#toasts { position: fixed; z-index: 45; left: max(14px, env(safe-area-inset-left)); bottom: 52px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; background: rgba(6,22,40,.92); border: 1px solid rgba(240,189,79,.55); padding: 8px 12px; font-size: 14px; max-width: 70vw; animation: toast .25s ease-out; }
.toast i { width: 8px; height: 8px; transform: rotate(45deg); background: var(--or); flex: none; }
.toast.erreur i { background: #ff8a4c; }
.toast.reussite i { background: #8fe0a0; }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }

/* Téléphone en paysage : tout tient sous la barre du haut. */
@media (max-height: 420px) {
  .barre-haut { height: 44px; }
  .contenu { height: calc(100% - 44px); }
  .entree { min-height: 58px; padding: 2px 12px; }
  .entree b { font-size: 17px; }
  #menu .titre-menu { max-height: 18vh; }
}
