/* ═══════════════════════════════════════════════════════════════
   Ardoise — compteur de fléchettes
   Palette & typo reprises de la-mire.pro
   Mobile first : l'écran de jeu tient dans une hauteur d'écran.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Marque la-mire.pro — identique dans les deux thèmes ────── */
  --ink:        #15120D;
  --ink-soft:   #211C14;
  --cream:      #F3EAD6;
  --cream-fg:   #F6EFD9;
  --board:      #EFE4C6;
  --green:      #1C7A47;
  --red:        #C0272D;

  /* ── Thème clair (par défaut) ───────────────────────────────── */
  --bg:            #F4EBD7;
  --bg-glow:       #FCF8EC;
  --surface:       #FBF5E6;
  --surface-2:     #FFFCF2;
  --surface-3:     #F1E7D0;

  --fg:            var(--ink);
  --fg-muted:      rgba(21, 18, 13, 0.68);
  --fg-faint:      rgba(21, 18, 13, 0.52);

  --line:          rgba(21, 18, 13, 0.18);
  --line-strong:   rgba(21, 18, 13, 0.38);
  --line-soft:     rgba(21, 18, 13, 0.09);

  --sunken:        rgba(21, 18, 13, 0.04);   /* panneau en creux    */
  --sunken-2:      rgba(21, 18, 13, 0.07);   /* creux plus marqué   */
  --field:         #FFFDF7;                  /* fond de champ       */
  --field-focus:   #FFFFFF;
  --hover:         rgba(21, 18, 13, 0.06);

  --fill:          var(--ink);               /* aplat contrasté     */
  --fill-fg:       var(--cream-fg);          /* texte sur l'aplat   */
  --ring-fill:     rgba(21, 18, 13, 0.35);

  --chip:          rgba(21, 18, 13, 0.06);   /* fléchette saisie    */
  --chip-line:     rgba(21, 18, 13, 0.34);
  --chip-hover:    rgba(21, 18, 13, 0.12);

  --green-hud:     #15703F;                  /* vert lisible sur le fond */
  --red-bright:    #BC2027;
  --green-tint:    rgba(28, 122, 71, 0.12);
  --red-tint:      rgba(192, 39, 45, 0.10);
  --green-tint-2:  rgba(28, 122, 71, 0.17);
  --red-tint-2:    rgba(192, 39, 45, 0.14);
  --red-soft:      rgba(188, 32, 39, 0.45);
  --red-wash:      rgba(188, 32, 39, 0.10);
  --ring-red:      rgba(188, 32, 39, 0.40);

  --on-accent:     #FFF8E7;                  /* texte sur aplat rouge */
  --hud-fg:        var(--cream-fg);          /* texte sur aplat vert  */

  --locked-line:   rgba(166, 116, 12, 0.55);
  --locked-bg:     rgba(21, 18, 13, 0.05);
  --backdrop:      rgba(21, 18, 13, 0.42);
  --scroll-thumb:  rgba(21, 18, 13, 0.22);
  --op-off:        0.45;                     /* opacité des touches désactivées */

  --shadow-card:   0 14px 34px rgba(21, 18, 13, 0.10);
  --shadow-modal:  0 20px 46px rgba(21, 18, 13, 0.20);
  --shadow-banner: 0 10px 26px rgba(21, 18, 13, 0.24);

  /* ── Relief : lumière venant du haut ─────────────────────────── */
  --hi:            rgba(255, 255, 255, 0.85);   /* arête éclairée */
  --raise:                                      /* objet posé sur la table */
    inset 0 1px 0 var(--hi),
    0 1px 1px rgba(21, 18, 13, 0.06),
    0 3px 6px -2px rgba(21, 18, 13, 0.08),
    0 18px 36px -18px rgba(21, 18, 13, 0.28);
  --raise-sm:
    inset 0 1px 0 var(--hi),
    0 1px 1px rgba(21, 18, 13, 0.08),
    0 4px 10px -4px rgba(21, 18, 13, 0.18);
  --well:                                       /* creusé dans la surface */
    inset 0 2px 5px rgba(21, 18, 13, 0.09),
    inset 0 0 0 1px rgba(21, 18, 13, 0.03),
    0 1px 0 var(--hi);
  --edge:          #D6C8A6;                     /* tranche d'une touche */
  --edge-dark:     #B8A780;
  --key-top:       linear-gradient(180deg, #FFFEF9 0%, #F7EFDC 100%);
  --key:           inset 0 1px 0 #FFFFFF, 0 3px 0 var(--edge), 0 4px 0 var(--edge-dark), 0 7px 10px -4px rgba(21, 18, 13, 0.30);
  --key-press:     inset 0 1px 0 #FFFFFF, 0 1px 0 var(--edge), 0 1px 0 var(--edge-dark), 0 2px 3px -1px rgba(21, 18, 13, 0.25);
  --red-edge:      #861A1F;
  --ink-edge:      #000000;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .08 0 0 0 0 .07 0 0 0 0 .05 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");

  /* ── Ardoise : les chiffres qui comptent ─────────────────────── */
  --slate-hi:      #3A4245;
  --slate:         #2B3134;
  --slate-lo:      #1F2426;
  --chalk:         #F3EEDF;
  --chalk-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 -.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");

  --font-display: 'Clash Display', ui-sans-serif, system-ui, sans-serif;
  --font-text:    'General Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    'Chakra Petch', ui-monospace, SFMono-Regular, Menlo, monospace;

  --gap: 10px;
  --r: 12px;
  --r-lg: 18px;
}

/* ── Thème sombre — ajouter data-theme="dark" sur <html> ─────── */
[data-theme="dark"] {
  --bg:            #15120D;
  --bg-glow:       #241E15;
  --surface:       #191510;
  --surface-2:     #221C15;
  --surface-3:     #2C241A;

  --fg:            var(--cream-fg);
  --fg-muted:      rgba(246, 239, 217, 0.62);
  --fg-faint:      rgba(246, 239, 217, 0.38);

  --line:          rgba(246, 239, 217, 0.14);
  --line-strong:   rgba(246, 239, 217, 0.30);
  --line-soft:     rgba(246, 239, 217, 0.07);

  --sunken:        rgba(0, 0, 0, 0.24);
  --sunken-2:      rgba(0, 0, 0, 0.30);
  --field:         rgba(0, 0, 0, 0.30);
  --field-focus:   rgba(0, 0, 0, 0.45);
  --hover:         rgba(246, 239, 217, 0.08);

  --fill:          var(--cream);
  --fill-fg:       var(--ink);
  --ring-fill:     rgba(243, 234, 214, 0.50);

  --chip:          rgba(246, 239, 217, 0.08);
  --chip-line:     rgba(246, 239, 217, 0.35);
  --chip-hover:    rgba(246, 239, 217, 0.16);

  --green-hud:     #3FB374;
  --red-bright:    #D8322F;
  --green-tint:    rgba(63, 179, 116, 0.10);
  --red-tint:      rgba(216, 50, 47, 0.10);
  --green-tint-2:  rgba(28, 122, 71, 0.22);
  --red-tint-2:    rgba(192, 39, 45, 0.22);
  --red-soft:      rgba(216, 50, 47, 0.50);
  --red-wash:      rgba(216, 50, 47, 0.14);
  --ring-red:      rgba(216, 50, 47, 0.55);

  --on-accent:     #FFFFFF;
  --hud-fg:        var(--ink);

  --locked-line:   rgba(244, 208, 111, 0.40);
  --locked-bg:     rgba(0, 0, 0, 0.34);
  --backdrop:      rgba(10, 8, 5, 0.78);
  --scroll-thumb:  rgba(246, 239, 217, 0.20);
  --op-off:        0.28;

  --shadow-card:   0 20px 50px rgba(0, 0, 0, 0.50);
  --shadow-modal:  0 24px 60px rgba(0, 0, 0, 0.60);
  --shadow-banner: 0 12px 30px rgba(0, 0, 0, 0.55);

  --hi:            rgba(246, 239, 217, 0.07);
  --raise:         inset 0 1px 0 var(--hi), 0 1px 2px rgba(0, 0, 0, 0.5), 0 18px 36px -16px rgba(0, 0, 0, 0.7);
  --raise-sm:      inset 0 1px 0 var(--hi), 0 4px 10px -4px rgba(0, 0, 0, 0.6);
  --well:          inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 1px 0 var(--hi);
  --edge:          #0D0B08;
  --edge-dark:     #000000;
  --key-top:       linear-gradient(180deg, #2E271D 0%, #241E16 100%);
  --key:           inset 0 1px 0 rgba(246, 239, 217, 0.10), 0 3px 0 var(--edge), 0 7px 10px -4px rgba(0, 0, 0, 0.6);
  --key-press:     inset 0 1px 0 rgba(246, 239, 217, 0.10), 0 1px 0 var(--edge);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  padding: var(--gap);
  padding-bottom: max(var(--gap), env(safe-area-inset-bottom));
  padding-top: max(var(--gap), env(safe-area-inset-top));
  background:
    var(--grain),
    radial-gradient(120% 80% at 50% 0%, var(--bg-glow) 0%, var(--bg) 62%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

#app { max-width: 1120px; margin: 0 auto; }

.hidden { display: none !important; }

button { font-family: inherit; touch-action: manipulation; user-select: none; }

::selection { background: var(--green-hud); color: var(--hud-fg); }

/* ─────────────────────────────────────────────────────────────
   Écran de configuration
   ───────────────────────────────────────────────────────────── */

.board {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-soft);
  border-bottom-color: var(--line);
  border-radius: var(--r-lg);
  padding: clamp(16px, 4vw, 30px);
  box-shadow: var(--raise);
  position: relative;
  overflow: clip;   /* pas « hidden » : le bouton de lancement doit rester sticky */
}
.board::before {
  /* liseré cible : vert / rouge / crème */
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 4px;
  background: repeating-linear-gradient(90deg,
    var(--green) 0 22px, var(--cream) 22px 30px,
    var(--red) 30px 52px, var(--ink-soft) 52px 60px);
  opacity: .9;
}

.board-head { text-align: center; margin-bottom: clamp(18px, 4vw, 28px); }
/* logo : le « A » en secteur de cible (partials/_logo.html.twig) */
.logo-mark { display: block; width: 24px; height: 28px; flex: none; color: var(--fg); }
.logo-mark-head { width: 38px; height: 44px; margin: 4px auto 12px; filter: drop-shadow(0 2px 2px rgba(21, 18, 13, 0.18)); }
.logo-mark-login { width: 54px; height: 62px; }
.board-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 9vw, 2.9rem);
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--fg);
}
.board-head .subtitle {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: .7rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--green-hud);
}

#setup-form { display: grid; gap: 16px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  margin: 0;
  background: var(--sunken);
  border-color: var(--line-soft);
  box-shadow: var(--well);
}
legend {
  padding: 0 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.hint { margin: 0 0 12px; color: var(--fg-faint); font-size: .82rem; line-height: 1.4; }

/* segmented */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-btn {
  display: grid; gap: 1px;
  padding: 12px 8px;
  font-size: 1rem; font-weight: 600;
  color: var(--fg-muted);
  background: var(--key-top);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--key);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .06s, box-shadow .06s;
}
.seg-btn:active { transform: translateY(2px); box-shadow: var(--key-press); }
.seg-btn span {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  opacity: .7;
}
.seg-btn.is-active {
  color: var(--fill-fg);
  background: linear-gradient(180deg, #2B251B, var(--ink));
  border-color: var(--ink);
  /* enfoncé et verrouillé, comme un interrupteur */
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 0 var(--ink-edge), 0 2px 4px -1px rgba(21, 18, 13, 0.4);
}

/* équipes */
.teams-setup { display: grid; gap: 14px; }
.team-setup { display: grid; gap: 8px; }
.team-setup h3 {
  margin: 0;
  font-family: var(--font-mono); font-weight: 700;
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.team-setup h3::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none;
}
.t-green h3::before, .bull-row.t-green .bull-name::before { background: var(--green-hud); }
.t-red h3::before,   .bull-row.t-red .bull-name::before   { background: var(--red-bright); }
.t-green h3 { color: var(--green-hud); }
.t-red h3   { color: var(--red-bright); }

input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="tel"], input[type="date"], select {
  width: 100%;
  padding: 13px 12px;
  font-family: inherit; font-size: 1rem;
  color: var(--fg);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 2px 3px rgba(21, 18, 13, 0.07), 0 1px 0 var(--hi);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input::placeholder { color: var(--fg-faint); }
input:focus, select:focus { border-color: var(--green-hud); background-color: var(--field-focus); box-shadow: inset 0 2px 3px rgba(21, 18, 13, 0.06), 0 0 0 3px var(--green-tint-2); }
select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%),
    linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%);
  background-position: right 17px center, right 12px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  background-color: var(--surface-2);
  box-shadow: var(--raise-sm);
}
select option { background: var(--surface-2); color: var(--fg); }

.grid-cfg { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.grid-cfg label {
  display: grid; gap: 6px; align-content: start;
  font-family: var(--font-mono); font-weight: 600;
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-muted);
}

/* bulle */
.bull-grid { display: grid; gap: 10px; }
.bull-row {
  display: grid;
  grid-template-columns: auto 1fr 96px;
  align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  box-shadow: var(--raise-sm);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.bull-row input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.bull-check {
  width: 22px; height: 22px; flex: none;
  border: 2px solid var(--fg-faint);
  border-radius: 50%;
  display: grid; place-items: center;
  transition: border-color .15s;
}
.bull-check::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: currentColor; transform: scale(0); transition: transform .15s;
}
.bull-name { display: flex; align-items: center; gap: 8px; font-weight: 500; overflow-wrap: anywhere; }
.bull-name::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.bull-row.t-green:has(input:checked) { border-color: var(--green-hud); background: var(--green-tint); color: var(--green-hud); }
.bull-row.t-red:has(input:checked)   { border-color: var(--red-bright); background: var(--red-tint); color: var(--red-bright); }
.bull-row:has(input:checked) .bull-check { border-color: currentColor; }
.bull-row:has(input:checked) .bull-check::after { transform: scale(1); }
.bull-dist { text-align: center; font-family: var(--font-mono); font-weight: 600; color: var(--fg); }

/* ─────────────────────────────────────────────────────────────
   Boutons
   ───────────────────────────────────────────────────────────── */

.btn {
  font-size: 1rem; font-weight: 600;
  padding: 13px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--key-top);
  color: var(--fg);
  box-shadow: var(--key);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s, box-shadow .06s, opacity .15s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: var(--key-press); }
.btn:disabled { opacity: var(--op-off); cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #D3353B 0%, var(--red) 55%, #B02228 100%);
  border-color: #A41F25;
  color: var(--on-accent);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 3px 0 var(--red-edge), 0 4px 0 #5E1215, 0 8px 14px -4px rgba(140, 20, 26, 0.45);
}
.btn-primary:active:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 var(--red-edge), 0 1px 0 #5E1215, 0 2px 4px -1px rgba(140, 20, 26, 0.4); }
.btn-primary:disabled { box-shadow: 0 3px 0 var(--red-edge); }
.btn-outline { border-color: var(--line); color: var(--fg-muted); }
.btn-danger  { border-color: var(--red-soft); color: var(--red-bright); }
.btn-block   { width: 100%; padding: 16px; font-size: 1.05rem; }

/* lancement : toujours visible en bas de l'écran, même sous une barre système */
#btn-start {
  position: sticky;
  bottom: max(var(--gap), env(safe-area-inset-bottom));
  z-index: 2;
  box-shadow: 0 -10px 22px var(--bg), inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 3px 0 var(--red-edge), 0 4px 0 #5E1215, var(--shadow-banner);
}
@media (hover: hover) {
  .btn:hover:not(:disabled) { border-color: var(--line-strong); }
  .btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #DC3A40 0%, var(--red-bright) 55%, #B52329 100%); border-color: #A41F25; }
  .btn-danger:hover:not(:disabled) { background: var(--red-wash); border-color: var(--red-bright); }
  .seg-btn:hover { color: var(--fg); }
  .seg-btn.is-active:hover { color: var(--fill-fg); }
}

.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 1.25rem; line-height: 1;
  color: var(--fg-muted);
  background: var(--key-top);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--key);
  cursor: pointer;
  transition: background .15s, color .15s, opacity .15s, transform .06s, box-shadow .06s;
}
.icon-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: var(--key-press); }
.icon-btn:disabled { opacity: var(--op-off); cursor: not-allowed; }
.icon-btn.is-danger { color: var(--red-bright); }
@media (hover: hover) { .icon-btn:hover:not(:disabled) { color: var(--fg); border-color: var(--line-strong); } }

/* ─────────────────────────────────────────────────────────────
   Écran de jeu — grille pleine hauteur
   ───────────────────────────────────────────────────────────── */

/* Hauteur fixe = l'écran. Les touches ont une taille bornée ; la place
   qui reste va aux panneaux de score (l'historique des volées s'allonge). */
#screen-game {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: var(--gap);
  height: calc(100dvh - max(var(--gap), env(safe-area-inset-top)) - max(var(--gap), env(safe-area-inset-bottom)));
}

.game-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.match-info {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-faint);
  line-height: 1.5;
  min-width: 0;
}
.match-info b { color: var(--green-hud); font-weight: 700; }
.match-info .bull-note { display: block; color: var(--fg-faint); text-transform: none; letter-spacing: .04em; opacity: .8; }
.head-actions { display: flex; gap: 8px; flex: none; }

/* tableau des scores */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 4px 4px 6px;   /* le cadre bois déborde du panneau */
  min-height: 0;
}

.team-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 4px;
  padding: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--r);
}
.team-panel::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--line);
}
.team-panel.t0::before { background: var(--green-hud); }
.team-panel.t1::before { background: var(--red-bright); }

/* ─────────────────────────────────────────────────────────────
   Ardoise : panneaux de score, joueurs, chiffres clés.
   Les couleurs sont redéfinies dans le panneau : tout ce qu'il
   contient s'écrit « à la craie » sans règle supplémentaire.
   ───────────────────────────────────────────────────────────── */
.slate, .team-panel, .pcard, .headline {
  --fg:          var(--chalk);
  --fg-muted:    rgba(243, 238, 223, 0.70);
  --fg-faint:    rgba(243, 238, 223, 0.46);
  --line:        rgba(243, 238, 223, 0.18);
  --line-soft:   rgba(243, 238, 223, 0.10);
  --line-strong: rgba(243, 238, 223, 0.36);
  --green-hud:   #62D394;
  --red-bright:  #F47468;
  --green-tint:  rgba(98, 211, 148, 0.14);
  --green-tint-2: rgba(98, 211, 148, 0.26);
  --red-wash:    rgba(244, 116, 104, 0.15);
  --red-soft:    rgba(244, 116, 104, 0.55);
  --fill:        var(--chalk);
  --fill-fg:     var(--slate-lo);
  --hud-fg:      var(--slate-lo);
  --chip:        rgba(243, 238, 223, 0.08);
  --chip-line:   rgba(243, 238, 223, 0.32);
  --scroll-thumb: rgba(243, 238, 223, 0.22);
  --sunken-2:    rgba(0, 0, 0, 0.25);

  color: var(--fg);
  background:
    var(--chalk-grain),
    radial-gradient(130% 80% at 25% -10%, rgba(255, 255, 255, 0.07), transparent 55%),
    radial-gradient(90% 60% at 85% 110%, rgba(243, 238, 223, 0.05), transparent 60%),
    linear-gradient(180deg, var(--slate), var(--slate-lo));
  border: 1px solid #111517;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 3px rgba(0, 0, 0, 0.12),
    0 0 0 3px #7A5A36,                       /* cadre bois */
    0 0 0 4px #4A3520,
    0 2px 0 4px #3A2A19,
    0 16px 26px -10px rgba(21, 18, 13, 0.55);
  transition: box-shadow .2s;
}
/* chiffres à la craie : un léger flou de poussière */
.team-score, .pcard-score, .headline-value, .pcard-number {
  text-shadow: 0 0 1px rgba(243, 238, 223, 0.45), 0 0 14px rgba(243, 238, 223, 0.10);
}
/* au tour de : un trait de craie de la couleur de l'équipe */
.team-panel.t0.is-active, .pcard.is-active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 2px var(--green-hud),
    inset 0 0 28px rgba(98, 211, 148, 0.16),
    0 0 0 3px #7A5A36, 0 0 0 4px #4A3520, 0 2px 0 4px #3A2A19,
    0 16px 26px -10px rgba(21, 18, 13, 0.55);
}
.team-panel.t1.is-active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 2px var(--red-bright),
    inset 0 0 28px rgba(244, 116, 104, 0.16),
    0 0 0 3px #7A5A36, 0 0 0 4px #4A3520, 0 2px 0 4px #3A2A19,
    0 16px 26px -10px rgba(21, 18, 13, 0.55);
}

.team-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; }
.team-name {
  font-weight: 600; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.team-crowns {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-faint); white-space: nowrap; flex: none;
}
.team-crowns b { color: var(--fg); font-weight: 700; font-size: .8rem; }

.team-score {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(3.6rem, 19vw, 5.4rem);
  line-height: 1;
  text-align: center;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.team-panel.t0.is-active .team-score { color: var(--green-hud); }
.team-panel.t1.is-active .team-score { color: var(--red-bright); }
.team-score.is-finish { color: var(--green-hud) !important; }

.team-thrower {
  text-align: center;
  min-height: 1.2em;
  font-size: .8rem; font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.team-panel.is-active .team-thrower { color: var(--fg); }
.team-thrower.is-swappable {
  display: block; width: 100%;
  font-family: inherit;
  background: none; border: 1px dashed var(--line); border-radius: 6px;
  cursor: pointer;
}
.team-thrower.is-swappable span { color: var(--fg-muted); }

.team-turns {
  list-style: none; margin: 6px 0 0; padding: 0;
  min-height: 0; overflow-y: auto;
  border-top: 1px solid var(--line-soft);
  scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent;
  -webkit-overflow-scrolling: touch;
}
.team-turns li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline; gap: 6px;
  padding: 3px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.team-turns .t-darts {
  font-size: .6rem; letter-spacing: .04em;
  color: var(--fg-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.team-turns .t-scored { font-size: .95rem; color: var(--fg); }
.team-turns .t-rest   { font-size: .68rem; color: var(--fg-faint); min-width: 2.8em; text-align: right; }
.team-turns li.is-bust .t-scored { color: var(--red-bright); font-size: .68rem; }
.team-turns li.is-ton  .t-scored { color: var(--green-hud); }
.team-turns li.is-win  .t-scored { color: var(--green-hud); }

.team-stats {
  padding-top: 5px;
  font-family: var(--font-mono); font-weight: 600;
  font-size: .58rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-faint);
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* suggestion de sortie (finish) */
.checkout {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center; gap: 6px;
}
.checkout:empty { display: none; }
.co-label {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-faint);
}
.co-dart {
  font-family: var(--font-mono); font-weight: 700;
  font-size: .92rem; letter-spacing: .02em;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--green-hud);
  background: var(--green-tint);
  border: 1px solid var(--green-tint-2);
}
/* la fléchette qui clôture le leg */
.co-dart.is-final {
  color: var(--hud-fg);
  background: var(--green-hud);
  border-color: var(--green-hud);
}
.co-none { font-size: .74rem; font-style: italic; color: var(--fg-faint); }

/* volée en cours */
.turn-area {
  display: grid; gap: 6px; justify-items: center;
  padding: 8px;
  background: var(--sunken-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--well);
}
.turn-who { font-size: .82rem; color: var(--fg-muted); text-align: center; }
.turn-who b { color: var(--fg); font-weight: 600; }

.darts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 340px; }
.dart-slot {
  height: 46px;
  display: grid; place-items: center;
  padding: 0;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.25rem;
  background: transparent;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  color: var(--fg-faint);
  transition: border-color .12s, background .12s, color .12s, transform .06s;
}
.dart-slot.is-filled {
  border-style: solid;
  border-color: var(--chip-line);
  background: var(--field);
  box-shadow: var(--raise-sm);
  color: var(--fg);
  cursor: pointer;   /* cliquer une fléchette la corrige */
}
.dart-slot.is-filled:active { transform: scale(.95); }
@media (hover: hover) {
  /* :not(.is-editing) sinon le survol écrase le fond de la fléchette sélectionnée */
  .dart-slot.is-filled:not(.is-editing):hover {
    border-color: var(--fill);
    background: var(--chip-hover);
  }
}
/* fléchette en cours de correction */
.dart-slot.is-editing {
  border-style: solid;
  border-color: var(--fill);
  background: var(--fill);
  color: var(--fill-fg);
  animation: editing 1.5s ease-in-out infinite;
}
@keyframes editing {
  0%, 100% { box-shadow: 0 0 0 0 var(--ring-fill); }
  55%      { box-shadow: 0 0 0 7px transparent; }
}
@media (prefers-reduced-motion: reduce) { .dart-slot.is-editing { animation: none; } }
.turn-total {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-muted); min-height: 1.3em;
}
.turn-total b { font-size: 1.05rem; color: var(--fg); }
.turn-total.is-bust, .turn-total.is-bust b { color: var(--red-bright); }
.turn-total.is-win, .turn-total.is-win b { color: var(--green-hud); }

/* volée close : elle attend la validation */
.turn-area.is-locked { border-color: var(--locked-line); background: var(--locked-bg); }
.turn-area.is-locked .dart-slot.is-empty { opacity: .35; }
.turn-area:has(.dart-slot.is-editing) { border-color: var(--fill); }

/* clavier */
.keypad {
  display: grid;
  gap: 10px;
  padding-bottom: 4px;   /* la tranche de la dernière rangée */
}
.mods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mod {
  display: grid; justify-items: center; align-content: center; gap: 0;
  padding: 6px 4px;
  color: var(--fg-muted);
  background: var(--key-top);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--key);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s, transform .06s, box-shadow .06s;
}
.mod:active { transform: translateY(2px); box-shadow: var(--key-press); }
.mod b { font-family: var(--font-mono); font-weight: 700; font-size: 1.25rem; line-height: 1.1; }
.mod span { font-family: var(--font-mono); font-weight: 600; font-size: .55rem; letter-spacing: .16em; text-transform: uppercase; opacity: .75; }
.mod:disabled { opacity: var(--op-off); cursor: not-allowed; }
.mod.is-active {
  color: var(--fill-fg); background: linear-gradient(180deg, #2B251B, var(--ink)); border-color: var(--ink);
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 0 var(--ink-edge);
}
.mod[data-mult="2"].is-active { background: linear-gradient(180deg, #23894F, var(--green-hud)); border-color: #0F5730; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 #0B4626; color: var(--hud-fg); }
.mod[data-mult="3"].is-active { background: linear-gradient(180deg, #D3353B, var(--red)); border-color: #A41F25; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 0 var(--red-edge); color: var(--on-accent); }

.numbers {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: clamp(34px, 6.2dvh, 58px);
  gap: 6px;
}
.specials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.key {
  display: grid; place-items: center;
  padding: 4px;
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(1.05rem, 4.4vw, 1.35rem);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  background: var(--key-top);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--key);
  cursor: pointer;
  transition: background .1s, transform .06s, border-color .1s, box-shadow .06s;
}
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: var(--key-press); background: var(--surface-3); }
.key:disabled { opacity: var(--op-off); cursor: not-allowed; }
@media (hover: hover) { .key:hover:not(:disabled) { border-color: var(--line-strong); } }

.key-special { grid-auto-flow: row; gap: 0; min-height: 50px; }
.key-special b { font-family: var(--font-text); font-weight: 600; font-size: .72rem; letter-spacing: .04em; }
.key-special span { font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem; color: var(--fg-muted); }
.key-special.is-green span { color: var(--green-hud); }
.key-special.is-red span   { color: var(--red-bright); }

/* la volée est prête : le bouton de validation se signale */
.btn-primary.is-ready { animation: ready 1.6s ease-in-out infinite; }
@keyframes ready {
  0%, 100% { box-shadow: 0 0 0 0 var(--ring-red); }
  55%      { box-shadow: 0 0 0 9px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-primary.is-ready { animation: none; box-shadow: 0 0 0 3px var(--ring-red); }
}

.pad-actions { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }

/* saisie du total de la volée */
.total-entry {
  display: none;
  min-width: 140px; height: 46px;
  place-items: center;
  padding: 0 18px;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  background: var(--field);
  border: 1.5px solid var(--chip-line);
  border-radius: 10px;
  box-shadow: var(--raise-sm);
}
.total-entry.is-empty {
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-faint);
  background: transparent;
  border-style: dashed; border-color: var(--line);
}
.turn-area.is-total .darts { display: none; }
.turn-area.is-total .total-entry { display: grid; }

.total-pad {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: clamp(44px, 8.5dvh, 72px);
  gap: 6px;
}
.keypad.is-total .mods,
.keypad.is-total .numbers,
.keypad.is-total .specials { display: none; }
.keypad.is-total .total-pad { display: grid; }
.pad-actions .btn { padding: 14px 10px; font-size: 1rem; }

/* bannière leg / set */
.banner {
  position: fixed;
  left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  max-width: calc(100vw - 24px);
  padding: 12px 22px;
  text-align: center;
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.05rem;
  color: var(--hud-fg);
  background: var(--green-hud);
  border-radius: 999px;
  box-shadow: var(--shadow-banner);
  animation: pop .22s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } }

/* modale */
.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(4px); }
.modal {
  position: relative;
  width: min(440px, 100%);
  padding: 26px 22px 22px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  animation: pop-modal .2s ease-out;
}
@keyframes pop-modal { from { transform: scale(.92); opacity: 0; } }
.modal h2 {
  margin: 0 0 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem;
  color: var(--fg);
}
.modal p { margin: 0 0 20px; color: var(--fg-muted); font-size: .95rem; }
.modal p b { color: var(--green-hud); }
.modal-actions { display: grid; gap: 10px; }
@media (min-width: 400px) { .modal-actions { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }
/* choix compacts (ex. nombre de fléchettes) : toujours côte à côte */
.modal-actions.is-choices { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.modal-actions.is-choices .btn { display: grid; gap: 2px; padding: 12px 6px; }
.modal-actions.is-choices .btn b { font-family: var(--font-mono); font-size: 1.8rem; line-height: 1; }
.modal-actions.is-choices .btn span { font-size: .72rem; font-weight: 500; opacity: .8; }

/* ─────────────────────────────────────────────────────────────
   Tablette / desktop
   ───────────────────────────────────────────────────────────── */

@media (min-width: 560px) {
  :root { --gap: 14px; }
  .teams-setup { grid-template-columns: 1fr 1fr; gap: 18px; }
  .co-dart { font-size: 1rem; padding: 3px 11px; }
  .co-label { font-size: .64rem; }
  .team-turns .t-darts { font-size: .68rem; }
  .team-turns .t-scored { font-size: 1.15rem; }
  .team-stats { font-size: .66rem; }
  .dart-slot { height: 56px; font-size: 1.5rem; }
  .match-info { font-size: .74rem; }
}

@media (min-width: 900px) {
  #screen-game {
    grid-template-columns: 1fr minmax(380px, 440px);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "score turn"
      "score pad";
    column-gap: 18px;
  }
  .game-head { grid-area: head; }
  .scoreboard { grid-area: score; }
  .turn-area { grid-area: turn; align-content: center; }
  .keypad { grid-area: pad; align-content: start; }
  /* les panneaux occupent toute la colonne : l'historique respire */
  .team-panel { padding: 16px; }
  .team-score { font-size: clamp(4rem, 7vw, 6rem); }
  .team-name { font-size: 1.1rem; }
  .team-turns .t-darts { font-size: .72rem; }
  .team-turns .t-scored { font-size: 1.25rem; }
  .team-turns .t-rest { font-size: .8rem; }
  .team-turns li { padding: 5px 2px; }
  .team-stats { font-size: .68rem; }
  /* on borne la taille des touches pour ne pas avoir de pavé géant */
  .numbers { grid-auto-rows: minmax(46px, 76px); gap: 8px; }
  .key { font-size: 1.3rem; }
  .key-special { min-height: 58px; }
  .dart-slot { height: 60px; font-size: 1.6rem; }
  .total-entry { height: 60px; font-size: 2.2rem; }
  .total-pad { grid-auto-rows: minmax(52px, 76px); gap: 8px; }
}

/* écrans courts : on compacte pour rester sur une seule hauteur d'écran */
@media (max-height: 760px) and (max-width: 899px) {
  :root { --gap: 8px; }
  .match-info .bull-note { display: none; }
  .team-panel { padding: 8px; }
  .team-score { font-size: clamp(2.9rem, 16vw, 3.9rem); }
  .team-thrower { min-height: 0; font-size: .74rem; }
  .team-turns { margin-top: 4px; }
  .team-turns li { padding: 2px; }
  .team-stats { padding-top: 3px; font-size: .55rem; }
  .turn-area { padding: 6px; gap: 4px; }
  .turn-who { font-size: .76rem; }
  .checkout { gap: 5px; }
  .co-dart { font-size: .82rem; padding: 1px 7px; }
  .co-label { font-size: .55rem; }
  .dart-slot { height: 40px; font-size: 1.1rem; }
  .total-entry { height: 40px; font-size: 1.5rem; }
  .turn-total { font-size: .64rem; min-height: 1.1em; }
  .mods { gap: 6px; }
  .mod { padding: 3px; }
  .mod b { font-size: 1.05rem; }
  .mod span { font-size: .5rem; }
  .key-special { min-height: 40px; }
  .numbers { grid-auto-rows: clamp(32px, 5.4dvh, 44px); }
  .total-pad { grid-auto-rows: clamp(42px, 7.5dvh, 60px); }
  .key-special b { font-size: .66rem; }
  .key-special span { font-size: .92rem; }
  .pad-actions .btn { padding: 11px 8px; font-size: .95rem; }
  .icon-btn { width: 36px; height: 36px; font-size: 1.1rem; }
}

/* très petits écrans : la liste des volées passe en une ligne */
@media (max-height: 660px) and (max-width: 899px) {
  .team-score { font-size: clamp(2.5rem, 14vw, 3.2rem); }
  .turn-area { padding: 5px; gap: 3px; }
  .dart-slot { height: 36px; font-size: 1rem; }
  .numbers { gap: 5px; }
  .key-special { min-height: 34px; }
  .pad-actions .btn { padding: 9px 8px; }
}

/* téléphone à l'horizontale : scores à gauche, clavier à droite */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1100px) {
  #screen-game {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "head  pad"
      "score pad"
      "turn  pad";
    column-gap: 12px;
  }
  .game-head { grid-area: head; }
  .scoreboard { grid-area: score; }
  .turn-area { grid-area: turn; }
  .keypad { grid-area: pad; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 6px; }
  .keypad.is-total { grid-template-rows: minmax(0, 1fr) auto; }
  .numbers { grid-auto-rows: minmax(28px, 1fr); gap: 5px; }
  .total-pad { grid-auto-rows: minmax(36px, 1fr); }
  .team-score { font-size: clamp(2.2rem, 11dvh, 3.4rem); }
  .turn-who, .turn-total:empty { display: none; }
  .key-special { min-height: 34px; }
  .pad-actions .btn { padding: 8px; }
}

/* ═══════════════════════════════════════════════════════════════
   Application club : navigation, pages, listes, statistiques
   ═══════════════════════════════════════════════════════════════ */

a { color: inherit; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 auto var(--gap);
  max-width: 1120px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.55rem;
  letter-spacing: -.01em;
}
.brand .logo-mark { width: 36px; height: 42px; }
.nav {
  display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto;
  padding: 4px;
  background: var(--sunken-2);
  border-radius: 14px;
  box-shadow: var(--well);
}
.nav a {
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: .9rem; font-weight: 500;
  color: var(--fg-muted);
}
.nav a.is-active {
  color: var(--fill-fg);
  background: linear-gradient(180deg, #2B251B, var(--ink));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 0 var(--ink-edge), 0 3px 6px -2px rgba(21, 18, 13, 0.45);
}
@media (hover: hover) { .nav a:not(.is-active):hover { background: var(--hover); color: var(--fg); } }

.page { display: grid; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1, .page h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 2.3rem); line-height: 1.05; letter-spacing: -.02em;
}
.page-head p { margin: 4px 0 0; color: var(--fg-muted); }
.section-title {
  margin: 0 0 10px;
  font-family: var(--font-mono); font-weight: 600;
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--fg-muted);
}

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-soft);
  border-bottom-color: var(--line);
  border-radius: var(--r-lg);
  padding: clamp(14px, 3vw, 22px);
  box-shadow: var(--raise);
  min-width: 0;
}
.grid-2 { display: grid; gap: 18px; }
.grid-3 { display: grid; gap: 14px; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.flash {
  padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--sunken-2);
}
.flash-error { border-color: var(--red-soft); background: var(--red-wash); color: var(--red-bright); }

/* tuiles de variante (accueil) */
.game-tiles { display: grid; gap: 14px; padding-bottom: 4px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.game-tile {
  position: relative;
  display: grid; gap: 6px; align-content: start;
  padding: 18px;
  min-height: 130px;
  text-decoration: none;
  background: var(--key-top);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--key);
  transition: border-color .15s, transform .06s, box-shadow .06s;
}
.game-tile:active { transform: translateY(2px); box-shadow: var(--key-press); }
@media (hover: hover) { .game-tile:hover { border-color: var(--fill); } }
.game-tile b { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; }
.game-tile span { color: var(--fg-muted); font-size: .88rem; }
.game-tile::after {
  content: "→"; position: absolute; right: 16px; top: 16px;
  font-family: var(--font-mono); color: var(--fg-faint);
}

/* listes */
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { border-bottom: 1px solid var(--line-soft); }
.list li:last-child { border-bottom: 0; }
.list a, .list .row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 10px 2px;
  text-decoration: none;
}
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .sub { grid-column: 1; color: var(--fg-faint); font-size: .82rem; }
.list .side { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-family: var(--font-mono); font-weight: 600; font-size: .8rem; color: var(--fg-muted); }
.empty { color: var(--fg-faint); font-style: italic; margin: 0; }

.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 999px;
  font-family: var(--font-mono); font-weight: 600;
  font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--fg-muted);
}
.badge.is-live { border-color: var(--green-hud); color: var(--green-hud); background: var(--green-tint); }
.badge.is-off  { border-color: var(--red-soft); color: var(--red-bright); }

/* tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; white-space: normal; }
table.data th {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-faint);
}
table.data td { font-variant-numeric: tabular-nums; }
table.data a { font-weight: 600; text-decoration: none; }

/* chiffres clés */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.kpi {
  padding: 12px 14px;
  background: var(--sunken);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--well);
}
.kpi-label {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-faint);
}
.kpi-value {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 1.7rem; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi-value small { font-size: .9rem; color: var(--fg-muted); }
.kpi-sub { font-size: .76rem; color: var(--fg-faint); }

/* barres horizontales (répartition des volées, tranches) */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .85rem; }
.bar-label { font-family: var(--font-mono); font-weight: 600; font-size: .75rem; color: var(--fg-muted); }
.bar-track { height: 12px; border-radius: 999px; background: var(--sunken-2); overflow: hidden; box-shadow: inset 0 1px 2px rgba(21, 18, 13, 0.18); }
.bar-fill { height: 100%; border-radius: 999px; background: var(--fill); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.15); }
.bar-fill.is-good { background: var(--green-hud); }
.bar-fill.is-bad  { background: var(--red-bright); }
.bar-value { text-align: right; font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }

/* constats : points forts / faibles */
.insights { display: grid; gap: 10px; }
.insight {
  display: grid; gap: 4px; align-content: start;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--line-soft);
  border-left-width: 4px;
  border-radius: var(--r);
  background: var(--surface-2);
  box-shadow: var(--raise-sm);
}
.insight.is-weakness { border-left-color: var(--red-bright); }
.insight.is-strength { border-left-color: var(--green-hud); }
.insight.is-info     { border-left-color: var(--fg-faint); }
.insight-kind {
  font-family: var(--font-mono); font-weight: 600;
  font-size: .6rem; letter-spacing: .16em; text-transform: uppercase;
}
.insight.is-weakness .insight-kind { color: var(--red-bright); }
.insight.is-strength .insight-kind { color: var(--green-hud); }
.insight.is-info .insight-kind { color: var(--fg-muted); }
.insight h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.insight p { margin: 0; color: var(--fg-muted); font-size: .9rem; }
.insight .exercise { justify-self: start; margin-top: 4px; padding: 7px 12px; font-size: .85rem; text-decoration: none; }

/* carte des doubles (Bob's 27) */
.doubles-map { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
@media (min-width: 560px) { .doubles-map { grid-template-columns: repeat(11, 1fr); } }
.dbl {
  display: grid; place-items: center; gap: 0;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--sunken);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 3px rgba(21, 18, 13, 0.08);
  font-family: var(--font-mono);
}
.dbl b { font-size: .95rem; }
.dbl span { font-size: .62rem; color: var(--fg-muted); }
.dbl.is-empty { opacity: .45; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--fg-faint); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; }

.chart-box { position: relative; height: 240px; }

.filters {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 3px;
  background: var(--sunken-2);
  border-radius: 999px;
  box-shadow: var(--well);
}
.filters a {
  padding: 6px 11px; border-radius: 999px;
  text-decoration: none;
  font-size: .8rem; color: var(--fg-muted);
}
.filters a.is-active {
  color: var(--fill-fg);
  background: linear-gradient(180deg, #2B251B, var(--ink));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 0 var(--ink-edge), 0 3px 6px -2px rgba(21, 18, 13, 0.45);
}
@media (hover: hover) { .filters a:not(.is-active):hover { color: var(--fg); background: var(--hover); } }

/* vue « L'essentiel » / « Analyse détaillée » */
.view-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.view-tabs {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; gap: 4px;
  background: var(--sunken-2);
  border-radius: 999px;
  box-shadow: var(--well);
}
.view-tabs a {
  padding: 9px 16px; border-radius: 999px;
  text-align: center; text-decoration: none;
  font-weight: 600; font-size: .9rem; color: var(--fg-muted);
  white-space: nowrap;
}
.view-tabs a.is-active {
  color: var(--fill-fg);
  background: linear-gradient(180deg, #2B251B, var(--ink));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 0 var(--ink-edge), 0 3px 6px -2px rgba(21, 18, 13, 0.45);
}
@media (hover: hover) { .view-tabs a:not(.is-active):hover { color: var(--fg); background: var(--hover); } }
.view-hint { margin: 0; display: flex; align-items: center; gap: 8px; }
@media (max-width: 480px) { .view-tabs { display: grid; width: 100%; } }

.headlines { display: grid; gap: 18px; padding: 4px 4px 6px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.headline {
  display: grid; gap: 6px; align-content: start;
  padding: 16px 18px;
  border-radius: var(--r);
}
.headline-label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-weight: 600;
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-muted);
}
.headline-value {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 2.8rem; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.headline-value small { font-size: 1.1rem; color: var(--fg-muted); }
.headline p { margin: 0; color: var(--fg-muted); font-size: .88rem; line-height: 1.4; }
.headline .headline-note { color: var(--fg-faint); font-size: .78rem; }
.tone-badge {
  justify-self: start;
  padding: 3px 9px; border-radius: 999px;
  font-size: .76rem; font-weight: 600;
  border: 1px solid var(--line); color: var(--fg-muted);
}
.tone-badge.is-good { border-color: var(--green-hud); color: var(--green-hud); background: var(--green-tint); }
.tone-badge.is-bad  { border-color: var(--red-soft); color: var(--red-bright); background: var(--red-wash); }
.more-link { margin: 12px 0 0; font-size: .88rem; }
.more-link a { font-weight: 600; }

/* bouton « ? » et bulle d'explication */
.help-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; padding: 0;
  vertical-align: middle;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent; color: var(--fg-muted);
  font: 700 .7rem/1 var(--font-mono); letter-spacing: 0;
  cursor: pointer;
  flex: none;
}
.help-btn::after { content: ""; position: absolute; inset: -10px; }  /* cible tactile élargie */
.kpi-label .help-btn, .section-title .help-btn, .hint .help-btn { margin-left: 4px; }
.help-btn:focus-visible { outline: 2px solid var(--fill); outline-offset: 2px; }
@media (hover: hover) { .help-btn:hover { background: var(--fill); color: var(--fill-fg); border-color: var(--fill); } }
.help-pop {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--fg);
  box-shadow: var(--shadow-modal);
  font-size: .94rem; line-height: 1.5;
  text-transform: none; letter-spacing: normal;
}
.help-pop::backdrop { background: var(--backdrop); }
.help-pop h3 { margin: 0 0 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; }
.help-pop p, .help-pop ul { margin: 0 0 10px; color: var(--fg-muted); }
.help-pop ul { padding-left: 18px; }
.help-pop b { color: var(--fg); }
.help-pop .help-read { padding: 10px 12px; border-radius: var(--r); background: var(--sunken-2); }
.help-pop .btn { margin-top: 4px; }

/* connexion : alternative Google */
.login-alt { display: grid; gap: 12px; margin-top: 18px; }
.login-sep {
  display: flex; align-items: center; gap: 12px; margin: 0;
  color: var(--fg-faint); font-size: .82rem;
}
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.login-note { margin: 0; text-align: center; }
.login-signup { margin-top: 18px; font-size: .92rem; color: var(--fg-muted); }
.login-signup a { font-weight: 600; color: var(--fg); }

/* inscription : messages sous les champs (hors de la casse des libellés) */
.field-error, .field-hint, .field-optional {
  font-family: var(--font-text); font-weight: 500;
  font-size: .8rem; letter-spacing: normal; text-transform: none;
}
.field-error { display: block; color: var(--red-bright); }
.field-hint { display: block; color: var(--fg-faint); }
.field-optional { color: var(--fg-faint); font-size: .72rem; }
input:disabled { color: var(--fg-muted); background: var(--sunken-2); }

.inline-form { display: inline; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-small { padding: 8px 12px; font-size: .88rem; }
.btn-link { display: inline-block; text-decoration: none; }

/* ─────────────────────────────────────────────────────────────
   Configuration d'une partie
   ───────────────────────────────────────────────────────────── */

.setup-form { display: grid; gap: 16px; }
.slot { display: grid; gap: 6px; }
.slot-guest { display: none; }
.slot.is-guest .slot-guest { display: block; }
.players-list { display: grid; gap: 10px; }
.player-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.player-row .order {
  padding-top: 13px; text-align: center;
  font-family: var(--font-mono); font-weight: 700; color: var(--fg-faint);
}
.player-row .number { width: 84px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--green-hud); flex: none; }

/* ─────────────────────────────────────────────────────────────
   Écrans de jeu
   ───────────────────────────────────────────────────────────── */

.back-btn { text-decoration: none; }

/* questions après une volée (fléchettes au double, sortie en combien) */
.modal-actions.is-choices .btn.is-default { border-color: var(--fill); }

/* Random checkout : la cible et la série */
.rc-panel { display: grid; gap: 10px; align-content: start; justify-items: center; text-align: center; }
.rc-target { font-family: var(--font-mono); font-weight: 700; font-size: clamp(4rem, 22vw, 7rem); line-height: 1; color: var(--green-hud); }
.rc-meta { font-family: var(--font-mono); font-weight: 600; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-muted); }
.rc-series { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.rc-dot {
  min-width: 34px; padding: 3px 6px; border-radius: 8px;
  font-family: var(--font-mono); font-weight: 700; font-size: .75rem;
  border: 1px solid var(--line); color: var(--fg-faint);
}
.rc-dot.is-ok   { border-color: var(--green-hud); color: var(--green-hud); background: var(--green-tint); }
.rc-dot.is-ko   { border-color: var(--red-soft); color: var(--red-bright); background: var(--red-wash); }
.rc-dot.is-now  { border-color: var(--fill); color: var(--fg); }

/* Bob's 27 / Killer : pavé de saisie à gros boutons */
.hits-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hits-pad .key { min-height: clamp(64px, 13dvh, 110px); display: grid; gap: 2px; align-content: center; }
.hits-pad .key b { font-size: clamp(1.6rem, 7vw, 2.4rem); }
.hits-pad .key span { font-family: var(--font-text); font-weight: 500; font-size: .72rem; color: var(--fg-muted); }

.players-board { display: grid; gap: 14px; padding: 5px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-content: start; min-height: 0; overflow-y: auto; }
.pcard {
  position: relative;
  display: grid; gap: 2px;
  padding: 10px 12px;
  border-radius: var(--r);
}
.pcard.is-out { opacity: .5; }
.pcard-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-score { font-family: var(--font-mono); font-weight: 700; font-size: 2.2rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.pcard-sub { font-family: var(--font-mono); font-weight: 600; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-faint); }
.pcard.is-active .pcard-score { color: var(--green-hud); }
.pcard-number {
  position: absolute; top: 8px; right: 10px;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem;
  color: var(--fg-muted);
}
.pcard.is-killer .pcard-number { color: var(--red-bright); }
.lives { letter-spacing: .1em; color: var(--red-bright); }
.lives .lost { color: var(--line-strong); }

.bobs-track { display: flex; flex-wrap: wrap; gap: 4px; }
.bobs-track span {
  min-width: 28px; padding: 2px 4px; text-align: center; border-radius: 6px;
  font-family: var(--font-mono); font-weight: 700; font-size: .68rem;
  border: 1px solid var(--line-soft); color: var(--fg-faint);
}
.bobs-track span.h1 { background: var(--green-tint); color: var(--green-hud); border-color: var(--green-tint-2); }
.bobs-track span.h2, .bobs-track span.h3 { background: var(--green-hud); color: var(--hud-fg); border-color: var(--green-hud); }
.bobs-track span.h0 { background: var(--red-wash); color: var(--red-bright); border-color: var(--red-soft); }
.bobs-track span.now { border-color: var(--fill); color: var(--fg); }

.killer-hits { display: flex; gap: 6px; justify-content: center; min-height: 34px; flex-wrap: wrap; }
.killer-hits .chip {
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-weight: 700;
  background: var(--chip); border: 1px solid var(--chip-line);
}
.killer-pad { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.killer-pad .key { min-height: 58px; display: grid; gap: 0; }
.killer-pad .key b { font-size: 1.3rem; }
.killer-pad .key span { font-family: var(--font-text); font-weight: 500; font-size: .7rem; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* écran de jeu des variantes : panneau joueurs + saisie */
.screen-variant {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: var(--gap);
  height: calc(100dvh - max(var(--gap), env(safe-area-inset-top)) - max(var(--gap), env(safe-area-inset-bottom)));
}
@media (min-width: 900px) {
  .screen-variant {
    grid-template-columns: 1fr minmax(380px, 440px);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "head head" "main turn" "main pad";
    column-gap: 18px;
  }
  .screen-variant > .game-head { grid-area: head; }
  .screen-variant > .variant-main { grid-area: main; }
  .screen-variant > .turn-area { grid-area: turn; }
  .screen-variant > .keypad { grid-area: pad; align-content: start; }
}
.variant-main { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 10px; }

@media print { .topbar, .nav, .btn { display: none; } }
