/* Jeux du Quartier — style commun à l'accueil et aux jeux.
   Identité « affiche de quartier » : papier crème, traits d'encre, ombres nettes décalées.
   Chaque jeu définit seulement ses couleurs de joueurs (--p1, --p2) et ce qui lui est propre. */
/* Polices hébergées sur le site (aucune requête vers Google : l'adresse IP des visiteurs
   ne part pas chez un tiers). Baloo 2 et Nunito, licence SIL OFL 1.1 (voir polices/OFL-*.txt).
   Fichiers variables : une seule police couvre les graisses 600 à 800. Sous-ensembles latin
   (le français) et latin étendu (noms de joueurs) ; le reste passe sur la police du système. */
@font-face{font-family:'Baloo 2';font-style:normal;font-weight:600 800;font-display:swap;
  src:url(polices/baloo2-latin-ext.woff2) format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Baloo 2';font-style:normal;font-weight:600 800;font-display:swap;
  src:url(polices/baloo2-latin.woff2) format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Nunito';font-style:normal;font-weight:600 800;font-display:swap;
  src:url(polices/nunito-latin-ext.woff2) format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Nunito';font-style:normal;font-weight:600 800;font-display:swap;
  src:url(polices/nunito-latin.woff2) format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
:root{
  --paper:#f3ead6;      /* fond */
  --card:#fbf6ea;       /* surfaces */
  --ink:#1f1b16;        /* texte et traits */
  --ink-2:#5a4f42;      /* texte secondaire (contraste > 7:1 sur le papier) */
  --ac:#ffc83d;         /* action principale */
  --focus:#2563eb;
  --err:#b3261e;
  --r:10px;
  --font:'Nunito',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --font-d:'Baloo 2','Nunito',system-ui,sans-serif;
  --p1:#f28c28; --p2:#21a35b;
}
*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%;touch-action:manipulation}
html,body{color:var(--ink);background:var(--paper);font-family:var(--font);-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none}
a{color:inherit}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px;box-shadow:0 0 0 6px #fff}
.hidden{display:none!important}
/* Lu par les lecteurs d'écran, jamais affiché */
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}

/* Icônes SVG (trait) */
.ico{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}

/* ---------- Boutons ---------- */
.primary{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin-top:16px;min-height:52px;
  padding:10px 16px;border:2.5px solid var(--ink);border-radius:var(--r);background:var(--ac);color:var(--ink);
  font-family:var(--font-d);font-weight:800;font-size:20px;line-height:1;box-shadow:3px 3px 0 var(--ink);
  transition:transform .12s ease-out,box-shadow .12s ease-out}
.primary:active{transform:translate(3px,3px);box-shadow:0 0 0 var(--ink)}
.primary:disabled{opacity:.5;cursor:default;transform:none;box-shadow:3px 3px 0 var(--ink)}
.ghost{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;padding:8px 14px;
  border:2px solid var(--ink);border-radius:var(--r);background:var(--card);font-weight:800;font-size:15px;
  box-shadow:2px 2px 0 var(--ink);transition:transform .12s ease-out,box-shadow .12s ease-out,background .15s}
.ghost:active{transform:translate(2px,2px);box-shadow:0 0 0 var(--ink)}
@media (hover:hover){ .primary:hover{filter:brightness(1.05)} .ghost:hover{background:#fff} }
.link{display:block;margin:12px auto 0;min-height:44px;color:var(--ink-2);font-weight:700;font-size:15px;
  text-decoration:underline;text-underline-offset:3px}
.back{display:inline-flex;align-items:center;gap:4px;min-height:44px;margin:-8px 0 4px;color:var(--ink-2);
  text-decoration:none;font-weight:800;font-size:15px}
.back:hover{color:var(--ink)}

/* ---------- Écran de jeu ---------- */
#app{height:100%;display:flex;flex-direction:column;max-width:720px;margin:0 auto;
  padding:max(8px,env(safe-area-inset-top)) 12px max(8px,env(safe-area-inset-bottom))}
.hud{display:grid;grid-template-columns:1fr auto 1fr;gap:8px;align-items:stretch}
.team{--pc:var(--p1);border:2px solid var(--ink);border-radius:var(--r);padding:6px 10px;
  display:flex;flex-direction:column;gap:3px;min-width:0;background:#ebe1cb;border-style:dashed;transition:background .2s,box-shadow .2s}
.team.t1{--pc:var(--p2)}
.team.right{align-items:flex-end;text-align:right}
/* Partie à 3 ou 4 joueurs : une case par joueur, alignées, sans le titre du milieu */
.team.t2{--pc:var(--p3)} .team.t3{--pc:var(--p4)}
.hud.multi{grid-template-columns:repeat(var(--n,4),minmax(0,1fr));gap:6px}
.hud.multi .center{display:none}
.hud.multi .team{padding:5px 7px}
.hud.multi .team.right{align-items:flex-start;text-align:left}
.hud.multi .team.right .tname{justify-content:flex-start}
.hud.multi .team.right .tname .dot{order:-1}
.hud.multi .tname{font-size:15px;gap:5px}
@media (max-width:440px){ .hud.multi{gap:4px} .hud.multi .team{padding:4px 5px} .hud.multi .tname{font-size:13px;gap:4px} .hud.multi .dot{width:10px;height:10px} }
.team.right .tname{align-self:stretch;justify-content:flex-end;max-width:100%}
.team.active{background:var(--card);border-style:solid;box-shadow:4px 4px 0 var(--pc)}
.tname{font-family:var(--font-d);font-weight:700;font-size:17px;line-height:1.2;display:flex;align-items:center;gap:7px;
  white-space:nowrap;overflow:hidden}
.tname>span:not(.dot){overflow:hidden;text-overflow:ellipsis}
.dot{width:13px;height:13px;border-radius:50%;flex:none;border:2px solid var(--ink);background:var(--pc)}
.center{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 4px;text-align:center}
/* Bandeau : hauteur stable (titre + 2 lignes) pour que le terrain ne change pas de taille à chaque tir */
.banner{margin:8px 0 6px;padding:6px 14px;border:2px solid var(--ink);border-radius:var(--r);text-align:center;
  min-height:72px;display:flex;flex-direction:column;justify-content:center;
  font-family:var(--font-d);font-weight:700;font-size:17px;line-height:1.25;background:var(--c,var(--ac));color:var(--ink);
  transition:background .25s}
.banner small{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-family:var(--font);font-weight:700;font-size:13px;line-height:1.35;margin-top:1px}
#stage{flex:1;min-height:0;overflow:hidden;display:flex;align-items:center;justify-content:center;position:relative}
#stage canvas,#stage svg{display:block;touch-action:none;border-radius:var(--r);outline:2.5px solid var(--ink)}
.bar{display:flex;gap:8px;justify-content:center;padding-top:8px;flex-wrap:wrap}

/* Message au centre du terrain */
/* en haut du terrain : il ne cache ni le centre du jeu ni les commandes */
#toast{position:absolute;left:50%;top:12px;transform:translate(-50%,0) scale(.9);opacity:0;pointer-events:none;
  text-align:center;background:var(--card);border:2.5px solid var(--ink);border-radius:var(--r);padding:12px 20px;
  box-shadow:4px 4px 0 var(--ink);transition:opacity .15s ease-out,transform .2s ease-out;width:max-content;max-width:min(86%,360px);overflow-wrap:anywhere}
#toast.show{opacity:1;transform:translate(-50%,0) scale(1)}
#toast h2{font-family:var(--font-d);font-size:clamp(20px,6vw,28px);font-weight:800;line-height:1.1}
#toast p{margin-top:4px;font-size:15px;font-weight:600;line-height:1.4;color:var(--ink-2)}

/* Bandeau « un ami a perdu la connexion » (partie à plusieurs) : il n'arrête pas la partie */
#netNote{position:fixed;left:50%;top:max(8px,env(safe-area-inset-top));transform:translateX(-50%);z-index:9;
  width:max-content;max-width:min(92vw,440px);padding:8px 14px;border:2px solid var(--ink);border-radius:var(--r);
  background:#fff6dc;color:var(--ink);font-weight:800;font-size:14px;line-height:1.35;text-align:center;
  box-shadow:3px 3px 0 var(--ink);pointer-events:none;display:none}
#netNote.show{display:block}

/* ---------- Fenêtres ---------- */
.overlay{position:fixed;inset:0;display:none;align-items:center;justify-content:center;
  background:rgba(31,27,22,.55);z-index:10;padding:16px}
.overlay.show{display:flex}
.card{background:var(--card);border:2.5px solid var(--ink);border-radius:14px;padding:20px;width:100%;max-width:440px;
  max-height:92vh;max-height:92dvh;overflow:auto;box-shadow:6px 6px 0 var(--ink)}
.logo{font-family:var(--font-d);font-size:48px;font-weight:800;text-align:center;line-height:1}
.tag{text-align:center;color:var(--ink-2);font-weight:700;margin:4px 0 10px}
.card h3{font-family:var(--font-d);font-size:18px;font-weight:700;margin:14px 0 6px}
.seg{display:grid;grid-template-columns:repeat(auto-fit,minmax(0,1fr));gap:8px}
.seg button{min-height:50px;padding:8px 6px;border:2px solid var(--ink);border-radius:var(--r);background:#fff;
  font-weight:800;font-size:15px;line-height:1.2;min-width:0;overflow-wrap:anywhere;hyphens:auto;transition:background .15s}
@media (hover:hover){ .seg button:not(.on):hover{background:#fff6dc} }
.seg button small{display:block;font-weight:600;font-size:12px;color:var(--ink-2);margin-top:2px}
.seg button.on{background:var(--ac);box-shadow:inset 0 0 0 2px var(--ink)}
.seg button.on small{color:var(--ink)}
.note-txt{font-size:14px;color:var(--ink-2);margin-top:10px;line-height:1.5}
.end-title{font-family:var(--font-d);font-size:30px;font-weight:800;text-align:center;line-height:1.1}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.row2 .primary,.row2 .ghost{margin-top:16px;min-height:52px;width:100%}
.rules .primary{position:sticky;bottom:-20px;z-index:1}
/* Écran de départ : quand les options dépassent l'écran (Teck-Teck, Billes, Duel sur téléphone),
   le bouton Jouer reste collé en bas de la carte au lieu de disparaître sous le pli. */
#start #play{position:sticky;bottom:-20px;z-index:1}
#start #play::before{content:'';position:absolute;left:-24px;right:-24px;top:-18px;height:16px;pointer-events:none;
  background:linear-gradient(rgba(251,246,234,0),var(--card))}
.rules details{margin-top:12px;border-top:2px dashed rgba(31,27,22,.25);padding-top:8px}
.rules summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:800;font-size:15px}
.rules h2{font-family:var(--font-d);font-size:28px;line-height:1.1;margin-bottom:4px}
.rules h4{margin:14px 0 6px;font-size:16px}
.rules ul{padding-left:20px;line-height:1.5;font-size:15px}
.rules li{margin:4px 0}
.pill{display:inline-block;font-size:12px;font-weight:800;padding:1px 7px;border:1.5px solid var(--ink);border-radius:6px;
  margin-left:6px;vertical-align:middle}
.pill.yours{background:#bfe8c9} .pill.adapt{background:#ffe08a}

/* Formulaires et partie en ligne */
.field{display:block;width:100%;margin-top:4px;min-height:48px;padding:10px 12px;border:2px solid var(--ink);
  border-radius:var(--r);background:#fff;color:var(--ink);font:inherit;font-size:16px;-webkit-user-select:text;user-select:text}
.field:focus{outline:3px solid var(--focus);outline-offset:1px}
.code{font-family:var(--font-d);font-size:40px;font-weight:800;letter-spacing:.14em;text-align:center;margin:6px 0}
.status{text-align:center;margin-top:12px;font-size:15px;font-weight:700;color:var(--ink-2);min-height:1.4em}
.status.err{color:var(--err)}
.status.pulse::before{content:'';display:inline-block;width:9px;height:9px;border-radius:50%;
  background:var(--ink);margin-right:8px;animation:pl 1s infinite}
@keyframes pl{50%{opacity:.2}}
.warn{background:#fff1c7;border:2px solid var(--ink);color:var(--ink);border-radius:var(--r);padding:10px 12px;
  font-size:14px;line-height:1.45;margin-top:12px}

/* Bouton Son : icône seule */
.ghost.snd{padding:8px 10px;min-width:44px}
.ghost.snd .snd-lbl{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.ghost.snd.muted{background:#e6dcc6}

/* Téléphone : la barre de boutons reste sur une ligne */
@media (max-width:520px){ .bar{flex-wrap:nowrap;gap:6px} .bar .ghost:not(.snd){padding:8px 10px;flex:0 1 auto;min-width:0} }
@media (max-width:400px){
  .tname{font-size:14px;gap:5px} .banner{font-size:15px} .logo{font-size:42px}
  .hud{gap:6px} .team{padding:6px 7px} .dot{width:11px;height:11px} .center{max-width:92px;padding:0}
  .bar{gap:5px;flex-wrap:nowrap} .bar .ghost{padding:8px 7px;font-size:13px;gap:4px;flex:0 1 auto}
  .bar .ghost:not(.snd) .ico{display:none}
  #toast{padding:10px 14px}
}
@media (max-width:360px){ .seg{gap:6px} .seg button{padding:8px 4px;font-size:14px} .seg button small{font-size:11px} }

/* Téléphone tenu en paysage : le terrain deviendrait minuscule, on demande de tourner l'écran */
@media (orientation:landscape) and (max-height:500px){
  body:has(#app)::after{content:'Tourne ton téléphone en hauteur pour jouer';position:fixed;inset:0;z-index:100;
    display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;background:var(--paper);
    font-family:var(--font-d);font-weight:800;font-size:24px;line-height:1.2}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
}
@media (max-width:360px){ .overlay{padding:10px} .card{padding:16px} .rules .primary,#start #play{bottom:-16px} }
