/* ============ RAQ — design system ============ */
/* Charte de marque : RAQ Black #000000, RAQ Graphite #111111,
   RAQ White #f8f8f8, RAQ Gold #ba9b6c. Répartition visée : 70 % noir et
   graphite, 25 % blanc, 5 % or.

   L'or ne décore pas : il ne paraît que là où il y a quelque chose à
   gagner, à mesurer ou à célébrer. Les actions courantes — bouton
   principal, onglet actif, anneau de focus — passent au blanc, qui est
   l'accent « travail ». C'est cette rareté qui fait l'effet.

   Exception assumée : les couleurs d'équipe. Deux camps doivent se
   distinguer d'un coup d'œil à trois mètres, et aucune paire monochrome
   ne tient sur un tableau de score. Blanc froid contre or chaud — même
   luminosité perçue, températures opposées, donc deux pairs. Sur l'écran
   de match, l'or identifie donc un camp ; la règle « l'or récompense »
   vit dans les stats, les records et le profil.

   Toute couleur de marque passe par une variable : une valeur écrite en
   dur dans le corps de la feuille échappe au thème clair sans que rien ne
   le signale. */

:root {
  --bg: #000000;
  --bg-2: rgba(255, 255, 255, .04);
  --card: rgba(255, 255, 255, .045);
  --card-2: rgba(255, 255, 255, .085);
  --line: rgba(255, 255, 255, .13);
  --text: #f8f8f8;
  --muted: #8f8b84;
  /* L'accent « action » est blanc : il porte les CTA, l'onglet actif et
     l'anneau de focus, qui sont les surfaces les plus fréquentes de l'app. */
  --accent: #f8f8f8;
  --accent-2: #ba9b6c;
  --grad-cta: linear-gradient(135deg, #ffffff, #ded9d1);
  --on-cta: #0a0a0a;
  --on-cta-soft: rgba(10, 10, 10, .68);
  --on-accent: #0a0a0a;
  --on-accent-soft: rgba(10, 10, 10, .6);
  --cta-glow: rgba(248, 248, 248, .22);
  --warn: #d9a441;
  --gold: #ba9b6c;
  --team-a: #ffffff;
  --team-b: #ba9b6c;
  /* Encre lisible posée sur une couleur d'équipe. Elle s'inverse avec le
     thème : les couleurs d'équipe sont claires sur fond noir, sombres sur
     fond clair. */
  --on-team: #0a0a0a;
  --bg-grad: linear-gradient(170deg, #000000 0%, #0a0a0a 55%, #050505 100%);
  --court-grad: linear-gradient(160deg, #000000, #0b0b0b);
  --sheet: #111111;
  --sheet-edge: linear-gradient(150deg, rgba(186, 155, 108, .75), rgba(186, 155, 108, .12) 45%, rgba(248, 248, 248, .3));
  --sheet-edge-tip: linear-gradient(120deg, rgba(186, 155, 108, .7), rgba(248, 248, 248, .25));
  --badge-grad: linear-gradient(135deg, #d8bd8f, #ba9b6c);
  --badge-ink: #0a0a0a;
  --badge-glow: rgba(186, 155, 108, .55);
  --font-display: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  --bg: #f5f4f2;
  --bg-2: rgba(17, 17, 17, .04);
  --card: rgba(17, 17, 17, .038);
  --card-2: rgba(17, 17, 17, .075);
  --line: rgba(17, 17, 17, .13);
  --text: #111111;
  --muted: #5f5c56;
  --accent: #111111;
  --accent-2: #806539;
  --grad-cta: linear-gradient(135deg, #111111, #2c2c2c);
  --on-cta: #f8f8f8;
  --on-cta-soft: rgba(248, 248, 248, .72);
  --on-accent: #f8f8f8;
  --on-accent-soft: rgba(248, 248, 248, .68);
  --cta-glow: rgba(17, 17, 17, .3);
  --warn: #8a5a12;
  --gold: #806539;
  --team-a: #1a1a1a;
  --team-b: #806539;
  --on-team: #f8f8f8;
  --bg-grad: linear-gradient(160deg, #faf9f7 0%, #f3f1ed 55%, #f6f4f0 100%);
  --court-grad: linear-gradient(160deg, #faf9f7, #f1efea);
  --sheet: #ffffff;
  --sheet-edge: linear-gradient(150deg, rgba(128, 101, 57, .6), rgba(128, 101, 57, .14) 45%, rgba(17, 17, 17, .22));
  --sheet-edge-tip: linear-gradient(120deg, rgba(128, 101, 57, .6), rgba(17, 17, 17, .2));
  --badge-grad: linear-gradient(135deg, #a8874f, #806539);
  --badge-ink: #fbf8f2;
  --badge-glow: rgba(128, 101, 57, .4);
}

/* Le badge de point de jeu prend la couleur du camp qui le porte.
   La charte réserve l'or à « ce qu'il y a à gagner », et ce badge en est
   l'exemple même — sauf qu'ici l'or identifie déjà un camp. Un badge doré
   fixe serait juste sous le camp doré et menteur sous l'autre : on lirait
   « point de jeu pour Lucas » alors qu'il est pour Alex.
   `--tc` est posé par `half()` et `team-card` sur la zone de chaque camp.
   En mode arbitre le badge vit dans le bandeau central, hors de toute zone
   de camp : il retombe alors sur l'or, et aucune position ne le dément.
   Les états d'escalade (point décisif, balle de match) gardent leur rouge —
   c'est de l'urgence, pas de l'identité. */
.point-badge:not(.golden):not(.match) {
  background: var(--tc, var(--gold));
  color: var(--on-team);
  box-shadow: 0 0 22px -4px color-mix(in srgb, var(--tc, var(--gold)) 55%, transparent);
}

/* ---------- typographie de marque (auto-hébergée : l'app doit rester
   utilisable hors-ligne, un chargement Google Fonts échouerait) ----------
   Outfit  : géométrique, pour les titres et la marque.
   Inter   : humaniste lisible, pour le corps de texte et les scores.
   Fichiers variables : une seule ressource couvre toutes les graisses. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/inter-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/inter-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: 'Outfit';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('fonts/outfit-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('fonts/outfit-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;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-feature-settings: 'cv05' 1; /* Inter : 'l' à empattement, moins confondu avec '1' */
  background: var(--bg-grad) fixed, var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
:root[data-theme="light"] body { background: var(--bg-grad) fixed, var(--bg); }

/* filigrane : lignes de terrain de badminton */
.overlay::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 40"><g fill="none" stroke="white" stroke-width=".6"><rect x="3" y="3" width="58" height="34" rx="1"/><line x1="3" y1="20" x2="61" y2="20"/><line x1="32" y1="3" x2="32" y2="37"/><line x1="10" y1="3" x2="10" y2="37"/><line x1="54" y1="3" x2="54" y2="37"/><line x1="3" y1="7" x2="61" y2="7"/><line x1="3" y1="33" x2="61" y2="33"/></g></svg>');
  background-size: 420px auto; background-position: center 20%; background-repeat: no-repeat;
  opacity: .05;
}
:root[data-theme="light"] .overlay::after {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 40"><g fill="none" stroke="%230a2540" stroke-width=".6"><rect x="3" y="3" width="58" height="34" rx="1"/><line x1="3" y1="20" x2="61" y2="20"/><line x1="32" y1="3" x2="32" y2="37"/><line x1="10" y1="3" x2="10" y2="37"/><line x1="54" y1="3" x2="54" y2="37"/><line x1="3" y1="7" x2="61" y2="7"/><line x1="3" y1="33" x2="61" y2="33"/></g></svg>');
  opacity: .06;
}
.overlay { position: relative; }
.overlay > * { position: relative; z-index: 1; }

/* les écrans apparaissent en fondu */
.screen { animation: screen-in .28s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }

.hidden { display: none !important; }

/* Poser `display` sur un élément défait l'attribut `hidden`, dont la valeur
   par défaut n'est qu'une règle de la feuille du navigateur. Le badge de
   connexion (`display: inline-flex`) s'affichait ainsi vide pour qui n'a pas
   de compte. Une règle globale plutôt qu'un correctif par composant : le
   piège se retendra au prochain `[hidden]`. */
[hidden] { display: none !important; }

/* accessibilité : masqué visuellement, toujours lu par les lecteurs d'écran */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* focus clavier : visible partout, y compris sur les zones de score (des
   <div role="button">, sans style de focus natif). */
.btn:focus-visible, .team-card:focus-visible, .half:focus-visible, .chip:focus-visible,
.mode-card:focus-within, .segmented label:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.screen {
  min-height: 100dvh;
  padding: calc(12px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* Titres et éléments de marque en géométrique (charte : « headings ») ;
   tout le reste, dont les scores, reste en Inter pour la lisibilité des
   chiffres (chasse tabulaire). */
h1, h2, h3, .match-title, .mode-name, .winner-name, .brand-name, .menu-title, legend {
  font-family: var(--font-display);
  letter-spacing: .01em;
}

/* ---------- pictogrammes d'interface ---------- */

/* Tracés au trait (js/icons.js). Dimensionnés en em : une icône suit la
   taille de police de son contexte, et `currentColor` sa couleur — un
   bouton grisé, actif ou accentué emmène son icône avec lui. */
.ui-icon {
  width: 1.2em; height: 1.2em;
  flex: none; display: inline-block; vertical-align: -.18em;
}

/* ---------- boutons ---------- */

.btn {
  font: inherit;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09);
  transition: transform .06s ease, filter .15s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.95); filter: brightness(1.2); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn-primary {
  background: var(--grad-cta); border-color: transparent; color: var(--on-cta);
  box-shadow: 0 8px 24px -8px var(--cta-glow);
}
.btn-big { width: 100%; padding: 18px; font-size: 19px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-small { padding: 8px 14px; font-size: 14px; }
.btn-icon {
  width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center;
  font-size: 20px; border-radius: 50%;
  flex: none;
}
.btn-icon .ui-icon { width: 21px; height: 21px; vertical-align: 0; }
/* Icône en tête de libellé : le texte reste l'ancre, l'icône l'accompagne. */
.btn:not(.btn-icon) .ui-icon { margin-right: .5em; }
.menu-list .btn .ui-icon, .btn-icon .ui-icon { margin-right: 0; }
.btn-danger { background: #7f1d1d; border-color: #b91c1c; color: #fff; }

/* ---------- topbar ---------- */

.topbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.topbar h2 { font-size: 20px; flex: 1; }

/* ---------- accueil ---------- */

/* Écran de travail, pas de page d'accueil vitrine : la marque se fait
   discrète en en-tête, l'action utile et l'activité récente occupent la
   place. Alignement à gauche, comme le reste de l'app. */
.screen-home { gap: 28px; }

/* Premier lancement : le choix hors-ligne / connecté. Centré, aéré, une
   seule décision à l'écran. Réutilise les `.cta` de l'accueil. */
.screen-welcome { justify-content: center; }
.welcome-inner {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 22px; max-width: 420px; width: 100%; margin: auto;
}
.welcome-brand { align-self: center; }
.welcome-brand .brand-name { font-size: 24px; }
.welcome-pitch {
  text-align: center; font-size: 16px; line-height: 1.5; color: var(--muted);
  margin: 0 4px;
}
.welcome-actions { display: flex; flex-direction: column; gap: 12px; }
.welcome-foot { text-align: center; font-size: 12.5px; color: var(--muted); opacity: .8; margin: 4px 0 0; }

.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: none; }
.brand-name {
  font-family: var(--font-display); font-size: 19px; font-weight: 800;
  letter-spacing: .22em; white-space: nowrap;
  /* L'espacement ajoute un blanc après la dernière lettre : on le reprend
     pour que le mot reste optiquement calé sur la marque. */
  margin-right: -.22em;
}
.theme-toggle { width: 38px; height: 38px; background: var(--bg-2); flex: none; }
.theme-toggle .ui-icon { width: 18px; height: 18px; }

/* Actions : une seule mise en avant, les autres au même gabarit mais
   neutres — l'œil n'a qu'un point d'entrée à la fois. */
.home-actions { display: flex; flex-direction: column; gap: 10px; }
.cta {
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 3px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
  touch-action: manipulation; transition: transform .06s ease, border-color .15s ease;
}
.cta:active { transform: scale(.99); }
.cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cta-label { font-size: 17px; font-weight: 700; }
.cta-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.cta-primary {
  background: var(--grad-cta); border-color: transparent; color: var(--on-cta);
  box-shadow: 0 8px 24px -10px var(--cta-glow);
}
.cta-primary .cta-sub { color: var(--on-cta-soft); }

/* Activité récente : ce qui fait qu'un écran d'accueil informe au lieu
   de simplement lancer. */
.home-recent { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}
.link-btn {
  font: inherit; font-size: 13px; font-weight: 650; color: var(--accent);
  background: none; border: 0; padding: 2px 0; cursor: pointer;
}
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.recent-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.recent-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--line);
}
.recent-list li:last-child .recent-row { border-bottom: 0; }
.recent-row .sport-icon { width: 17px; height: 17px; color: var(--muted); }
.recent-names { min-width: 0; font-size: 14.5px; font-weight: 650; overflow-wrap: anywhere; }
.recent-names .lost { color: var(--muted); font-weight: 600; }
.recent-names small { font-size: 12px; font-weight: 500; color: var(--muted); }
.recent-meta { display: flex; align-items: baseline; gap: 10px; }
.recent-score { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.recent-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.recent-empty { color: var(--muted); font-size: 13.5px; line-height: 1.5; padding: 4px 0; }

.home-foot { margin-top: auto; color: var(--muted); font-size: 12px; opacity: .8; }
.home-foot #app-version { font-family: ui-monospace, monospace; opacity: .7; }

/* Icônes de sport (charte) : dimensionnées sur la taille de texte courante
   et colorées par currentColor, elles suivent donc chaque contexte. */
.sport-icon { width: 1.15em; height: 1.15em; flex: none; display: block; }

/* ---------- formulaire ---------- */

#setup-form { display: flex; flex-direction: column; gap: 22px; padding-bottom: 30px; }
fieldset { border: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }

.advanced {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); overflow: hidden;
}
.advanced summary {
  list-style: none; cursor: pointer; padding: 16px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; color: var(--text);
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.advanced summary::after {
  content: "▾"; margin-left: auto; color: var(--muted); transition: transform .2s ease;
}
.advanced[open] summary::after { transform: rotate(180deg); }
.advanced > fieldset { padding: 0 18px 20px; }
.advanced > fieldset:first-of-type { padding-top: 4px; }

.mode-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mode-card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 10px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.mode-card input { position: absolute; opacity: 0; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--card-2); }
.mode-icon { display: block; color: var(--muted); }
.mode-icon .ui-icon { width: 26px; height: 26px; vertical-align: 0; stroke-width: 1.6; }
.mode-card:has(input:checked) .mode-icon { color: var(--accent); }
.mode-name { font-weight: 700; font-size: 15px; }
.mode-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; gap: 4px; }
/* sélecteur de sport : 6 options, trop pour une seule rangée en portrait */
.sport-seg { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
/* min-width: 0 empêche un libellé long (ex. « Tennis de table ») de forcer
   sa colonne de grille au-delà de sa part équitable (1fr) — sans quoi
   l'ellipsis de .segmented span ne s'applique jamais. */
.segmented label { position: relative; min-width: 0; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 11px 6px; border-radius: calc(var(--radius) - 5px);
  font-weight: 650; font-size: 15px; cursor: pointer; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.segmented span small { font-size: 11px; color: var(--muted); font-weight: 500; }
.segmented input:checked + span { background: var(--accent); color: var(--on-accent); }
.segmented input:checked + span small { color: var(--on-accent-soft); }
.sport-seg span { white-space: normal; font-size: 12.5px; line-height: 1.2; padding: 8px 4px; gap: 3px; }
.sport-seg .sport-icon { width: 22px; height: 22px; }

.team-inputs { display: flex; gap: 8px; align-items: center; }
.team-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.dot-a { background: var(--team-a); }
.dot-b { background: var(--team-b); }

input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"] {
  font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; width: 100%; min-width: 0; font-size: 16px;
  -webkit-appearance: none; appearance: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.custom-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--card); border-radius: var(--radius); padding: 14px; }
.custom-rules label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.custom-rules label.check { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.custom-rules input[type="number"] { padding: 9px 10px; }

.recent-players { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px;
  padding: 7px 14px; cursor: pointer;
}
.chip:active { background: var(--card-2); }

.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.big-check { font-size: 17px; font-weight: 600; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* ============ écran match ============ */

.screen-match { padding: 0; max-width: none; }

.match-root { min-height: 100dvh; display: flex; flex-direction: column; }

.match-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.match-topbar .spacer { flex: 1; }
.match-title { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.match-topbar .score-call { white-space: nowrap; }

.games-dots { display: flex; gap: 5px; align-items: center; }
.games-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.mini-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 2px 7px; font-size: 12.5px; font-weight: 750;
  font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap;
}
.mini-chip .a { color: var(--team-a); }
.mini-chip .b { color: var(--team-b); }

/* ---------- mode arbitre (portrait) ---------- */

.umpire { gap: 10px; padding: 0 12px calc(12px + var(--safe-b)); }
.umpire-row { flex: 1; display: flex; gap: 10px; min-height: 0; }
.umpire .team-card {
  flex: 1; position: relative; min-width: 0;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 24px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px 14px 12px; cursor: pointer; overflow: hidden;
  /* Pas de backdrop-filter ici, contrairement aux autres surfaces vitrées :
     `render()` remplace tout le DOM de l'écran à chaque point, ce qui
     recréerait deux couches de flou plein écran par appui. Et derrière ces
     cartes il n'y a que le dégradé fixe du body — flouter un dégradé lisse
     ne change rien à l'œil. On garde le liseré et l'ombre, qui, eux, se
     voient. */
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 8px 32px -12px rgba(0,0,0,.4);
  transition: transform .07s ease;
}
.umpire .team-card:active { transform: scale(.985); }
.umpire .team-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 7px;
  background: var(--tc);
}
.umpire .team-card.serving { border-color: var(--tc); box-shadow: 0 0 34px -6px var(--tc), inset 0 0 60px -46px var(--tc); }
.umpire .team-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.umpire .team-name { font-size: clamp(16px, 4.6vw, 24px); font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.umpire .team-side { color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* ---------- double : position des partenaires (carré gauche/droite) ---------- */

.pos-row { display: flex; gap: 6px; }
.pos-chip {
  font-size: 11.5px; font-weight: 650; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 8px; display: inline-flex; align-items: center; gap: 4px;
  overflow-wrap: anywhere;
}
.pos-chip small { font-size: 9px; opacity: .75; font-weight: 800; letter-spacing: .02em; }
.pos-chip .shuttle { display: inline-flex; align-items: center; animation: pulse 1.6s ease-in-out infinite; }
.pos-chip.active {
  color: var(--text); border-color: var(--tc);
  background: color-mix(in srgb, var(--tc) 18%, transparent);
  box-shadow: 0 0 12px -4px var(--tc);
}
.split .pos-row { gap: 1vmin; }
.split .pos-chip { font-size: clamp(10.5px, 2.1vmin, 15px); padding: .5vmin 1.4vmin; border-radius: 7px; }
.umpire .score {
  /* remonté et agrandi : en scoring, le pouce/doigt qui tape recouvre le
     bas de la carte — le score doit rester visible pendant le tap. */
  flex: 1; display: grid; place-items: start center; padding-top: 4px;
  font-size: clamp(84px, 34vw, 190px); font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--tc);
  text-shadow: 0 0 34px color-mix(in srgb, var(--tc) 45%, transparent);
}

/* le chiffre rebondit quand le camp marque */
.score.bump, .zone-score.bump { animation: bump .45s cubic-bezier(.2, 2.2, .4, 1); }
@keyframes bump { 30% { transform: scale(1.16); } }
.serve-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px;
  padding: 4px 10px; font-size: 12.5px; font-weight: 650; color: var(--text);
  width: fit-content;
}
.serve-badge .shuttle { color: var(--accent); display: inline-flex; align-items: center; animation: pulse 1.6s ease-in-out infinite; }

/* Tennis : jeux gagnés dans le set en cours, sous le score de points. */
.set-games {
  display: block; text-align: center; font-weight: 700;
  font-size: clamp(13px, 2.6vmin, 20px); color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.umpire .mid-strip {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 54px;
}
.score-call { font-size: 15px; color: var(--muted); font-weight: 600; }
.recent-form { font-variant-numeric: tabular-nums; text-align: center; }
.recent-form b { font-weight: 800; }
.recent-form b.a { color: var(--team-a); }
.recent-form b.b { color: var(--team-b); }

.point-badge {
  border-radius: 99px; padding: 5px 13px; font-size: 13px; font-weight: 800;
  background: var(--badge-grad); color: var(--badge-ink); letter-spacing: .03em;
  animation: pulse 1.1s ease-in-out infinite;
  box-shadow: 0 0 22px -4px var(--badge-glow);
}
.point-badge.golden { background: linear-gradient(135deg, #fbbf24, #f97316); box-shadow: 0 0 26px -4px rgba(251, 146, 60, .7); }
.point-badge.match { background: linear-gradient(135deg, #fb7185, #ef4444); color: #2b0404; box-shadow: 0 0 26px -4px rgba(248, 113, 113, .7); }
@keyframes pulse { 50% { transform: scale(1.07); opacity: .85; } }

.match-bottombar {
  display: flex; gap: 10px; padding: 8px 12px calc(10px + var(--safe-b));
}
.match-bottombar .btn { flex: 1; }

/* ---------- modes observateur & auto (paysage) ---------- */

.split { flex-direction: row; position: relative; overflow: hidden; }
.split.vertical { flex-direction: column; }
.split .half {
  flex: 1; position: relative; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2vmin; padding: 4vmin; overflow: hidden;
  background:
    radial-gradient(120% 100% at var(--glow-pos, 50% 100%), color-mix(in srgb, var(--tc) 22%, transparent), transparent 72%),
    var(--court-grad);
}
:root[data-theme="light"] .split .half {
  background:
    radial-gradient(120% 100% at var(--glow-pos, 50% 100%), color-mix(in srgb, var(--tc) 26%, transparent), transparent 72%),
    var(--court-grad);
}
.split .half.left { --glow-pos: 0% 100%; border-right: 1px solid var(--line); }
.split .half.right { --glow-pos: 100% 100%; }
.split .half.top { --glow-pos: 50% 0%; border-bottom: 1px solid var(--line); }
.split .half.bottom { --glow-pos: 50% 100%; }
.split .half:active .zone-score { transform: scale(.97); }

.zone-names { font-size: clamp(14px, 3.2vmin, 26px); font-weight: 700; color: var(--text); text-align: center; max-width: 90%; overflow-wrap: anywhere; }
.zone-score {
  font-weight: 800; line-height: .95; color: var(--tc);
  font-variant-numeric: tabular-nums;
  transition: transform .08s ease;
  text-shadow: 0 0 6vmin color-mix(in srgb, var(--tc) 45%, transparent);
}
/* remonté vers le haut de chaque moitié et agrandi : en scoring, le doigt
   qui tape recouvre le centre/bas de la zone — le score doit rester visible
   pendant le tap (comme en mode arbitre). Portrait uniquement : en paysage
   la hauteur est déjà comptée au pixel près (cf. media query plus bas), pas
   de place pour remonter davantage le contenu. */
@media (orientation: portrait) {
  .observer .half { justify-content: flex-start; padding-top: 6vmin; }
}
.observer .zone-score { font-size: clamp(90px, min(46vw, 36vh), 420px); }

/* auto-scoring : téléphone posé/monté sur un poteau, lu à distance par les
   joueurs eux-mêmes (pas tenu en main) — le score doit dominer l'écran
   comme sur un tableau d'affichage, nom et service réduits au minimum. */
/* le score « bondit » (scale 1.16) à chaque point : marge minimale garantie
   pour qu'il ne chevauche pas le nom au-dessus pendant l'animation. */
.auto .half { padding: 1.2vh 2.5vmin; gap: max(1vh, 18px); }
.auto .zone-names { font-size: clamp(11px, 1.8vh, 15px); }
.auto .zone-score { font-size: clamp(130px, min(80vh, 34vw), 400px); }

/* le mode observateur (haut/bas) est pensé pour le portrait : en paysage,
   chaque moitié n'a plus que la largeur de l'écran en hauteur — resserrer
   pour éviter que les deux moitiés se chevauchent (score, chips, topbar). */
@media (orientation: landscape) {
  .observer .half { padding: 1.5vh 4vmin; gap: 0.8vh; }
  .observer .zone-score { font-size: clamp(34px, 24vh, 240px); }
  .observer .zone-names { font-size: clamp(12px, 2.6vh, 22px); }
  .observer .pos-row { display: none; } /* plus assez de hauteur pour les positions */
}
.auto .zone-names { color: var(--muted); }

/* Icône de service : plantée dans un angle de l'écran, du côté du camp
   qui sert, environ un tiers débordant hors de l'écran (.split porte
   overflow:hidden pour que ce débord soit bien rogné à son bord, pas
   juste scrollable). Opacité réduite pour rester lisible malgré sa
   grande taille : le score doit primer. z-index au-dessus du reste
   pour rester au premier plan ; pointer-events:none pour ne pas gêner
   le tap sur la moitié. */
.serve-edge-icon {
  position: absolute; z-index: 3; pointer-events: none;
  color: var(--tc); display: block; opacity: .45;
}
.serve-edge-icon svg {
  display: block; width: clamp(110px, 28vmin, 220px); height: clamp(110px, 28vmin, 220px);
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .45));
}
/* haut/bas (observateur, vertical) : angle droit de la moitié qui sert. */
.serve-edge-icon.pos-top { top: 0; right: 0; transform: translate(33%, -33%); }
.serve-edge-icon.pos-bottom { bottom: 0; right: 0; transform: translate(33%, 33%); }
/* gauche/droite (auto/tableau) : angle bas de la moitié qui sert. */
.serve-edge-icon.pos-left { bottom: 0; left: 0; transform: translate(-33%, 33%); }
.serve-edge-icon.pos-right { bottom: 0; right: 0; transform: translate(33%, 33%); }

.split .center-col {
  position: absolute; inset: 0; margin: auto;
  width: min(30vmin, 180px); height: fit-content;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none; z-index: 2;
}
.split .center-col > * { pointer-events: auto; }

.split .match-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  justify-content: center; pointer-events: none;
}
.split .match-topbar .btn { pointer-events: auto; }

.split .bottom-center {
  position: absolute; bottom: calc(8px + var(--safe-b)); left: 0; right: 0; z-index: 2;
  display: flex; justify-content: center; gap: 10px; pointer-events: none;
}
.split .bottom-center .btn { pointer-events: auto; background: color-mix(in srgb, var(--card) 80%, transparent); backdrop-filter: blur(6px); }

.tap-flash { position: absolute; inset: 0; background: var(--tc); opacity: 0; pointer-events: none; }
.half.flash .tap-flash { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .22; } 100% { opacity: 0; } }

.half.locked { cursor: default; }

.plus-pop {
  position: absolute; top: 18%; left: 50%; transform: translateX(-50%);
  font-size: clamp(30px, 9vmin, 64px); font-weight: 800; color: var(--tc);
  opacity: 0; pointer-events: none;
}
.half.flash .plus-pop { animation: pop 0.7s ease-out; }
@keyframes pop { 0% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 -30px; } }

/* ---------- overlay (pauses, fin de jeu, menu) ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay-card {
  background: linear-gradient(var(--sheet), var(--sheet)) padding-box,
    var(--sheet-edge) border-box;
  border: 1.5px solid transparent; border-radius: 26px;
  padding: 28px 24px; width: min(440px, 94vw); max-height: 90dvh; overflow: auto;
  display: flex; flex-direction: column; gap: 18px; text-align: center;
  box-shadow: 0 24px 70px -18px #000;
  animation: card-in .25s cubic-bezier(.2, 1.4, .4, 1);
}
:root[data-theme="light"] .overlay-card { box-shadow: 0 24px 60px -18px rgba(20, 28, 62, .28); }
@keyframes card-in { from { opacity: 0; transform: scale(.92) translateY(14px); } }
.overlay-card h3 { font-size: 24px; }
.overlay-card .sub { color: var(--muted); font-size: 15px; }
.countdown { font-size: 58px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); line-height: 1; }
.countdown.over { color: var(--warn); }

/* anneau de pause : cercle SVG qui se vide */
.ring-wrap { position: relative; width: 190px; height: 190px; margin: 0 auto; display: grid; place-items: center; }
.ring-wrap .countdown { position: relative; z-index: 1; font-size: 46px; }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: url(#ring-grad); stroke: var(--accent); transition: stroke-dashoffset .25s linear; filter: drop-shadow(0 0 8px var(--cta-glow)); }
.ring-wrap.over .fill { stroke: var(--warn); }
.swap-ends-icon { color: var(--accent); }
.swap-ends-icon .ui-icon { width: 44px; height: 44px; vertical-align: 0; }

.games-summary { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.game-chip {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 12px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px;
}
.game-chip b.a { color: var(--team-a); }
.game-chip b.b { color: var(--team-b); }

.winner-name { font-size: 30px; font-weight: 800; color: var(--accent); overflow-wrap: anywhere; }
.trophy { color: var(--accent); }
.trophy .ui-icon { width: 54px; height: 54px; vertical-align: 0; stroke-width: 1.5; }
.h2h { font-size: 13.5px; font-weight: 700; color: var(--muted); background: var(--bg-2); border-radius: 99px; padding: 6px 14px; align-self: center; }

.menu-list { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.menu-list .btn { width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; }
.menu-title { font-size: 18px; font-weight: 750; text-align: left; }
.remote-help { color: var(--muted); font-size: 13px; line-height: 1.5; text-align: left; background: var(--bg-2); border-radius: 12px; padding: 10px 12px; }

/* ---------- correction manuelle du score ---------- */

.edit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.edit-row .edit-name { font-weight: 700; color: var(--tc); overflow-wrap: anywhere; text-align: left; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .btn-icon { font-size: 26px; background: var(--bg-2); }
.edit-val { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 58px; color: var(--tc); }

/* ---------- statistiques de fin de match ---------- */

.stats-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-duration { font-weight: 700; font-size: 15px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.stat-duration small { color: var(--muted); font-weight: 600; }
.stat-row { display: grid; grid-template-columns: 1fr 44px 16px 44px; align-items: center; font-size: 14px; }
.stat-row .sl { text-align: left; color: var(--muted); font-weight: 600; }
.stat-row .sa { color: var(--team-a); font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-row .sx { color: var(--muted); }
.stat-row .sb { color: var(--team-b); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- tableau spectateur ---------- */

.split.board .half { cursor: default; }

/* ---------- bulles d'aide (coach-marks) ---------- */

.tip-banner {
  position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%);
  z-index: 40; width: min(92vw, 360px);
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(var(--sheet), var(--sheet)) padding-box,
    var(--sheet-edge-tip) border-box;
  border: 1.5px solid transparent; border-radius: 18px;
  padding: 14px 12px 12px 16px;
  box-shadow: 0 14px 40px -14px #000;
  animation: card-in .25s cubic-bezier(.2, 1.4, .4, 1);
  cursor: pointer; touch-action: manipulation;
}
:root[data-theme="light"] .tip-banner { box-shadow: 0 14px 36px -14px rgba(20, 28, 62, .3); }
.tip-banner .tip-row { display: flex; align-items: center; gap: 10px; }
.tip-banner .tip-foot { justify-content: space-between; }
.tip-dots { display: flex; gap: 4px; flex: none; }
.tip-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); display: block; }
.tip-dots i.on { background: var(--accent); }
.tip-text { font-size: 14.5px; font-weight: 650; line-height: 1.4; flex: 1; }
.tip-banner .tip-close {
  width: 40px; height: 40px; font-size: 15px; background: var(--bg-2); color: var(--muted); flex: none;
}
.tip-banner #tip-next-btn {
  padding: 9px 18px; font-size: 14px; font-weight: 700;
  background: var(--grad-cta); border-color: transparent; color: var(--on-cta);
}

/* ---------- bannière de mise à jour ---------- */

.update-banner {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  padding: 10px 12px 10px 20px; font-weight: 650; font-size: 14.5px;
  box-shadow: 0 12px 40px -10px #000;
}
:root[data-theme="light"] .update-banner { box-shadow: 0 12px 32px -10px rgba(20, 28, 62, .3); }

/* ---------- historique ---------- */

.history-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
/* Le pictogramme de recherche vit à côté du champ, pas dans son
   placeholder : il reste visible une fois la saisie commencée. */
.search-field { position: relative; display: flex; }
.search-field .ui-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted); pointer-events: none;
}
.search-field .history-search { font-size: 15px; padding: 11px 14px 11px 38px; }

.history-standings { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.history-standings:empty { margin: 0; }
.standing-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  padding: 6px 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.standing-chip b { color: var(--text); font-weight: 700; }
.history-export { width: 100%; }
.history-backup { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.import-status { color: var(--muted); font-size: 13px; text-align: center; margin-top: 4px; }

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.history-item .hi-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.history-item .hi-names { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.history-item .hi-names .win { color: var(--accent); }
.history-item .hi-score { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; font-weight: 650; }
.history-item .hi-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-empty { color: var(--muted); text-align: center; padding: 60px 20px; }

/* confettis de victoire */
.confetti-canvas { position: fixed; inset: 0; z-index: 70; pointer-events: none; }

/* trophée qui rebondit */
.trophy { animation: trophy-in .7s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes trophy-in { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.25) rotate(6deg); } }

/* accessibilité : couper les animations si demandé */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* portrait : suggérer le paysage pour les modes plein terrain */
.rotate-hint {
  position: absolute; inset: auto 0 30% 0; z-index: 3; text-align: center;
  color: var(--muted); font-size: 14px; font-weight: 600; pointer-events: none;
}
@media (orientation: landscape) { .rotate-hint { display: none; } }

/* pendant : mode observateur retourné en paysage — hors normal flow pour ne
   pas ajouter de hauteur au-dessus du contenu déjà resserré. */
.rotate-hint-portrait {
  position: fixed; top: calc(36px + var(--safe-t)); left: 0; right: 0; z-index: 3;
  text-align: center; color: var(--muted); font-size: 11px; font-weight: 600; pointer-events: none;
}
@media (orientation: portrait) { .rotate-hint-portrait { display: none; } }

/* ---------- navigation à onglets ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 6px 4px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; padding: 7px 2px; border: 0; border-radius: 12px;
  background: none; color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 650; letter-spacing: .01em;
}
.tab-icon { display: block; line-height: 1; }
.tab-icon .ui-icon { width: 22px; height: 22px; vertical-align: 0; }
.tab.active { color: var(--accent); }
.tab:focus-visible, .tab-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Bouton central : l'action première de l'app, surélevée au-dessus de la barre. */
.tab-fab {
  justify-self: center; align-self: center;
  width: 56px; height: 56px; margin-top: -22px; border: 0; border-radius: 50%;
  background: var(--grad-cta); color: var(--on-cta);
  display: grid; place-items: center; line-height: 1; cursor: pointer;
  box-shadow: 0 8px 22px -6px var(--cta-glow);
}
.tab-fab .ui-icon { width: 26px; height: 26px; stroke-width: 2.4; vertical-align: 0; }
.tab-fab:active { transform: scale(.94); }

/* Les écrans à onglets défilent au-dessus de la barre : sans cette réserve
   la barre masquerait leurs derniers éléments. */
.screen-home, .screen-history, .screen-panel {
  padding-bottom: calc(84px + var(--safe-b));
}

/* ---------- écrans Stats / Profil / Défis ---------- */

.screen-panel { gap: 4px; }
.panel-title {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  margin: 22px 0 10px; color: var(--text);
}
.panel-foot { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 14px; }

.panel-empty {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 20px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  line-height: 1.55; margin-top: 12px;
}
.panel-empty-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text); }
.panel-empty-note { font-size: 12.5px; opacity: .85; }
.panel-empty .btn { margin-top: 6px; }

/* tuiles de synthèse */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 14px; display: flex; flex-direction: column; gap: 4px;
}
.stat-value {
  font-size: 30px; font-weight: 800; line-height: 1; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-tile.accent .stat-value { color: var(--accent); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }

/* constats « coach » */
.insight-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.insight-list li {
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 12px;
  padding: 12px 14px; font-size: 14px; line-height: 1.5;
}
/* Le liseré porte le verdict : ce qui va bien, ce qui coûte des matchs, ce
   qui est simplement à savoir. La couleur suffit, sans étiquette.
   Sélecteur qualifié par `li` : sans ça, `.insight-list li` ci-dessus reste
   plus spécifique et le liseré garde la couleur d'accent. */
.insight-list li.insight-down { border-left-color: var(--team-b); }
.insight-list li.insight-neutral { border-left-color: var(--line); }

/* listes sport / adversaires */
.row-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px;
}
.row-main { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.row-sub { grid-column: 1; font-size: 12px; color: var(--muted); }
.row-val {
  grid-row: 1 / span 2; grid-column: 2; align-self: center;
  font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent);
}

/* ---------- carte « 360 ID » ---------- */

/* Le RAQ ID est l'endroit du produit où la règle de la charte s'applique le
   plus littéralement : un niveau, c'est quelque chose qui se mesure, donc
   c'est de l'or. Le reste de la carte reste blanc et gris. */
.id-card {
  position: relative; overflow: hidden; margin-top: 12px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--gold) 14%, transparent), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 4px;
}
.id-label { font-size: 10.5px; font-weight: 800; letter-spacing: .16em; color: var(--gold); }
.id-name {
  font-family: var(--font-display); font-size: 27px; font-weight: 750;
  line-height: 1.15; overflow-wrap: anywhere;
}
.id-score { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.id-score-value {
  font-size: 52px; font-weight: 800; line-height: 1; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.id-score-unit { font-size: 15px; font-weight: 700; color: var(--muted); }
.id-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.id-meta b { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
/* Série en cours : la seule statistique de la carte qui puisse être une
   mauvaise nouvelle, d'où les deux tons. */
.id-streak {
  align-self: flex-start; margin-top: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg-2);
}
.id-streak.up { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.id-streak.down { color: var(--muted); }
.id-share { margin-top: 16px; align-self: flex-start; }
.id-share[disabled] { opacity: .55; }

/* niveau par sport */
.level-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.level-row { display: grid; grid-template-columns: minmax(0, 6.5em) 1fr auto; gap: 10px; align-items: center; }
.level-name { font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
.level-bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.level-bar i { display: block; height: 100%; border-radius: 99px; background: var(--gold); }
.level-val { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

/* saisie du nom du joueur */
.owner-form { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.owner-form label { font-size: 13px; font-weight: 650; color: var(--muted); }
.owner-row { display: flex; gap: 8px; }
.owner-row input { flex: 1; min-width: 0; }
.owner-help { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---------- tournois locaux (poules) ---------- */

.row-tap { cursor: pointer; }
.row-tap:active { transform: scale(.99); }
.row-tap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tourney-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tourney-form label { font-size: 13px; font-weight: 650; color: var(--muted); margin-top: 6px; }
.tourney-form select {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.tourney-players { display: flex; flex-direction: column; gap: 6px; }
.tourney-error { color: var(--team-b); font-size: 13px; font-weight: 650; }
.tourney-delete { margin-top: 26px; align-self: flex-start; color: var(--muted); }

.champion {
  margin-top: 12px; padding: 14px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--gold) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  font-size: 15px;
}

/* classement de poule */
.standings-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.standings-table th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; padding: 0 6px 8px;
}
.standings-table td { padding: 10px 6px; border-top: 1px solid var(--line); }
.standings-table .rank { color: var(--muted); font-weight: 700; width: 1.6em; }
.standings-table .who { font-weight: 700; overflow-wrap: anywhere; }
.standings-table .win { font-weight: 800; color: var(--accent); }
.standings-table tbody tr:first-child .who { color: var(--accent); }

/* rencontres */
.round-label {
  margin: 18px 0 6px; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.match-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.match-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 10px 9px 14px;
}
.match-row .mr-players { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.match-row.done .mr-players { color: var(--muted); }
.match-row .mr-players b { font-weight: 650; }
.match-row .mr-players b.won { color: var(--text); font-weight: 800; }
.match-row .mr-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.match-row .btn-small { padding: 8px 14px; font-size: 14px; }

/* ---------- compte & synchronisation ---------- */

.account-box {
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.account-box .panel-title { margin-top: 0; }
.account-email { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.account-msg {
  font-size: 13px; line-height: 1.5; color: var(--text);
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px;
}
.account-box .owner-row { margin-top: 4px; }

/* page de confidentialité : lisible, dans la même charte que l'app */
.legal { max-width: 42rem; }
.legal-lead { font-size: 15.5px; line-height: 1.6; }
.legal-list { list-style: disc; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; line-height: 1.55; }
.legal p { font-size: 14.5px; line-height: 1.6; }
.legal-todo { color: var(--team-b); font-weight: 650; }
.legal-link { color: var(--muted); }

/* suppression de compte : discrète au repos, explicite une fois armée */
.danger-link { align-self: flex-start; color: var(--muted); text-decoration: underline; }
.danger-zone {
  margin-top: 4px; padding: 12px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--team-b);
  display: flex; flex-direction: column; gap: 10px;
}

/* proposition de déclarer le dernier match à un ami */
.declare-card {
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 14px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.declare-line { font-size: 14.5px; line-height: 1.45; }
.declare-line small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.declare-actions { display: flex; gap: 8px; }

/* matchs pas encore remontés : information, pas alerte */
.sync-pending {
  font-size: 13px; font-weight: 650; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.sync-pending::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); flex: none;
}

/* amis */
.friends-sub { margin: 14px 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.friend-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.friend-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px;
}
.friend-name { font-weight: 650; font-size: 14px; overflow-wrap: anywhere; }
.friend-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.friend-actions .btn-small { padding: 7px 12px; font-size: 13px; }
.friend-pending { font-size: 12.5px; color: var(--muted); font-weight: 650; }

/* `.account-box` sépare deux sections par un filet supérieur : en tête
   d'écran il n'y a rien à séparer, et le filet flotte tout seul. */
#defis-body > .account-box:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* Défis : nom et score déclaré au-dessus, actions en dessous. Les deux sur
   une même ligne écrasent le score sur trois lignes en 390 px de large. */
.challenge-row { flex-direction: column; align-items: stretch; gap: 10px; }
.challenge-row .friend-actions { justify-content: flex-end; }
.challenge-line { display: flex; flex-direction: column; gap: 2px; font-weight: 650; font-size: 14px; min-width: 0; }
.challenge-line small { font-weight: 600; font-size: 12px; color: var(--muted); }

/* aide sous un groupe de champs (rôle du scoreur…) */
.field-help { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 8px; }

/* palier d'arbitrage */
.ref-tier {
  margin-top: 12px; padding: 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.ref-tier-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ref-tier-label { font-family: var(--font-display); font-size: 20px; font-weight: 750; color: var(--accent); }
.ref-tier-count { font-size: 13px; font-weight: 650; color: var(--muted); }
.ref-tier .owner-help { margin: 0; }

/* Icône accolée à un titre ou à un intitulé d'alerte. */
.head-icon { margin-right: .35em; color: var(--accent); }
.title-icon { width: 15px; height: 15px; margin-left: 4px; opacity: .8; }
.sub.warn .ui-icon { color: #f59e0b; margin-right: .3em; }
.stat-duration .ui-icon { color: var(--muted); margin-right: .35em; }
/* Coche du mode actif : poussée en fin de ligne dans le menu. */
.mode-check { margin-left: auto; }
.champion .ui-icon { color: var(--accent); margin-right: .3em; }

/* ---------- identité déclarée & recherche de joueurs ---------- */
.identity-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.identity-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.identity-row label {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  font-size: 12.5px; font-weight: 650; color: var(--muted);
}
.identity-form select {
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; width: 100%; min-width: 0;
  -webkit-appearance: none; appearance: none;
}
.identity-form .btn { align-self: flex-start; }

/* Liste de suggestions : elle suit le champ dans le flux plutôt que de le
   survoler en absolu — un menu flottant se retrouve sous le clavier virtuel
   dès que le champ est bas dans la page. */
.friend-results {
  list-style: none; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--bg-2);
}
.friend-results li + li { border-top: 1px solid var(--line); }
.friend-result {
  width: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font: inherit; font-size: 14.5px; font-weight: 600; color: var(--text);
  text-align: left; background: none; border: 0; cursor: pointer;
  padding: 12px 14px; touch-action: manipulation;
}
.friend-result:active { background: var(--card-2); }
.friend-result-handle { color: var(--muted); font-weight: 600; }
.friend-result-empty { padding: 12px 14px; font-size: 14px; color: var(--muted); }

/* ---------- badge de connexion (accueil) ---------- */
.account-badge {
  display: inline-flex; align-items: center; gap: 7px;
  align-self: flex-start; margin-top: -6px; margin-bottom: 4px;
  font: inherit; font-size: 12.5px; font-weight: 650; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  padding: 6px 12px 6px 10px; cursor: pointer; touch-action: manipulation;
  max-width: 100%;
}
.account-badge-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--gold); box-shadow: 0 0 6px var(--gold);
}
.account-badge-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Salutation (connecté) ou invitation à se connecter (sinon), sous le badge.
   Visible dès l'accueil, mais discrète : l'app fonctionne entièrement sans
   compte, ceci reste une invitation, jamais un barrage. */
.home-greeting {
  margin: -2px 0 2px; font-size: 15px; font-weight: 650; color: var(--text);
}
.home-login-cta {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  width: 100%; margin-bottom: 2px;
  font: inherit; text-align: left; cursor: pointer; touch-action: manipulation;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 14px;
}
.home-login-cta:active { transform: scale(.99); }
.home-login-cta-title { font-size: 14.5px; font-weight: 700; color: var(--gold); }
.home-login-cta-sub { font-size: 12.5px; color: var(--muted); }

/* Annonces d'équipe, sous l'invitation à se connecter. Non bloquantes,
   refermables une à une. Le conteneur `#home-announce` n'a ni bordure ni
   marge propre : vide, il est invisible. */
.home-announce-stack { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.home-announce-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-left: 2px solid var(--gold); border-radius: 12px; padding: 9px 12px;
}
.home-announce-msg { margin: 0; flex: 1; font-size: 13px; line-height: 1.45; color: var(--text); }
.home-announce-x {
  flex: none; font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
  background: none; border: 0; color: var(--muted); padding: 0 2px; margin-top: -1px;
}
.home-announce-x:active { color: var(--text); }

/* Le formulaire de création de groupe est le seul `.owner-row` à trois
   éléments (nom, type, bouton) : sur un petit écran, input + select + bouton
   ne tiennent pas sur une ligne sans rogner l'un des trois. Il passe seul en
   grille souple ; les autres `.owner-row` (pseudo, ami) restent à deux
   éléments et n'ont jamais eu besoin de ça. */
#group-form { flex-wrap: wrap; }
#group-form input { flex: 1 1 140px; }
#group-form select {
  flex: 1 1 120px; min-width: 0;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; -webkit-appearance: none; appearance: none;
}
#group-form .btn { flex: 1 1 100%; }

/* ---------- club officiel ---------- */
.club-current {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-top: 10px; font-size: 14px; font-weight: 650;
}
.club-current-city { color: var(--muted); font-weight: 500; }
.club-create { color: var(--gold); font-weight: 700; }

/* ---------- groupes ---------- */
.group-row { flex-wrap: wrap; align-items: flex-start; }
.group-kind {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-top: 2px;
}
.group-detail {
  flex-basis: 100%; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
}
.group-invite { margin-top: 10px; }
.group-invite select {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 10px; flex: 1; min-width: 0; -webkit-appearance: none; appearance: none;
}

/* ---------- remplir une poule depuis un groupe ---------- */
.tourney-from-group { display: flex; flex-direction: column; gap: 6px; }
.tourney-from-group select {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  width: 100%; -webkit-appearance: none; appearance: none;
}
.club-search-row { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- connexion par e-mail et mot de passe ---------- */
.auth-tabs { margin-top: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.auth-form .btn { align-self: stretch; }

/* ---------- choix de la voix d'annonce ---------- */
/* `.menu-list .btn` impose `width: 100%` à tous les boutons du menu, ce qui
   est juste pour une liste verticale — mais ici le bouton partage sa ligne
   avec le sélecteur, qu'il écrasait à 26 px. Il reprend donc sa largeur
   naturelle, et seul le sélecteur s'étire. */
.voice-row { display: flex; gap: 8px; align-items: center; }
.voice-row .btn { width: auto; flex: none; }
.voice-row select {
  flex: 1; min-width: 0;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; -webkit-appearance: none; appearance: none;
}
