/* ==========================================================================
   Polices auto-hébergées. Volontairement PAS de <link> vers fonts.googleapis.com :
   une feuille de style tierce bloque le rendu, et si le réseau du visiteur la
   filtre ou la ralentit, la page reste bloquée sur « Chargement… ».
   Ici, aucune dépendance externe.
   ========================================================================== */

/* Big Shoulders Display — latin-ext */
@font-face {
  font-family: 'Big Shoulders Display';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url(fonts/BigShouldersDisplay-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;
}

/* Big Shoulders Display — latin */
@font-face {
  font-family: 'Big Shoulders Display';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url(fonts/BigShouldersDisplay-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;
}

/* Space Grotesk — latin-ext */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/SpaceGrotesk-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;
}

/* Space Grotesk — latin */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/SpaceGrotesk-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;
}

/* ==========================================================================
   Open de Saint Jures — « la page est la table »
   Vue de dessus, dans le sens de la longueur : le hero est le demi-terrain
   adverse (lignes de côté + ligne médiane), le filet sépare les deux camps,
   le reste est la table dans l'ombre.
   Palette tirée du matériel réel : bleu ITTF, craie, balle celluloïd,
   mousse rouge / mousse noire.
   ========================================================================== */

:root {
  /* — palette — */
  --felt-deep: #06232f;   /* la table dans l'ombre — fond de page */
  --felt:      #0b3d54;   /* la surface de jeu — cartes */
  --felt-hi:   #12546f;   /* surface relevée */
  --pip:       #05161e;   /* mousse noire — plaques de score */
  --chalk:     #eef4f6;   /* les lignes blanches — texte */
  --ball:      #ff7a18;   /* balle celluloïd — accent, live, action */
  --rubber:    #e23b4e;   /* mousse rouge — côté B, destructif */
  --let:       #35c08a;   /* validé, qualifié */

  /* — alias conservés : app.js les référence en style inline — */
  --ink: var(--chalk);
  --muted: #7e9aa8;
  --rose: var(--rubber);
  --rose-dark: #c22b3d;
  --green: var(--let);
  --orange: var(--ball);
  --amber: #f0a02c;
  --line: rgba(238, 244, 246, 0.13);
  --bg: var(--felt-deep);
  --card: var(--felt);

  --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);

  /* Rayons volontairement nets : on est sur du matériel de sport,
     pas sur une carte de SaaS. */
  --r: 6px;
  --r-lg: 10px;
  --radius: var(--r-lg);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  font-family: var(--body);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--felt-deep);
  color: var(--chalk);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overscroll-behavior-y: none;
  background-image: radial-gradient(120% 60% at 50% 0%, #0a3348 0%, var(--felt-deep) 70%);
  background-attachment: fixed;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px calc(40px + var(--safe-bottom));
}

:focus-visible {
  outline: 2px solid var(--ball);
  outline-offset: 2px;
  border-radius: 2px;
}

.loading {
  text-align: center;
  padding: 30vh 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ==========================================================================
   Hero — le demi-terrain adverse
   ========================================================================== */
.hero {
  margin: 0 -16px 22px;
  padding: calc(24px + var(--safe-top)) 20px 44px;
  position: relative;
  overflow: hidden;
  color: var(--chalk);
  /* 1. ligne médiane  2. lignes de côté  3. la surface bleue */
  background-image:
    linear-gradient(90deg,
      transparent calc(50% - 0.5px),
      rgba(238, 244, 246, 0.14) calc(50% - 0.5px),
      rgba(238, 244, 246, 0.14) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)),
    linear-gradient(90deg,
      transparent 0 12px,
      rgba(238, 244, 246, 0.24) 12px 14px,
      transparent 14px calc(100% - 14px),
      rgba(238, 244, 246, 0.24) calc(100% - 14px) calc(100% - 12px),
      transparent calc(100% - 12px)),
    linear-gradient(180deg, #0d4762 0%, #093750 100%);
}

/* Le filet : ruban blanc + maille tissée. La frontière entre les deux camps. */
.hero::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 15px;
  background:
    linear-gradient(180deg, rgba(238, 244, 246, 0.92) 0 3px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(238, 244, 246, 0.26) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(0deg, rgba(238, 244, 246, 0.26) 0 1px, transparent 1px 5px),
    rgba(5, 22, 30, 0.5);
}

/* La balle : le service qui ouvre la page. */
.hero::after {
  content: "";
  position: absolute;
  left: -22px;
  bottom: 30px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffd7ab 0%, var(--ball) 62%, #d95f06 100%);
  box-shadow: 0 0 20px rgba(255, 122, 24, 0.55);
  animation:
    serve-x 2.8s cubic-bezier(0.25, 0.5, 0.55, 0.9) 0.25s both,
    serve-y 0.7s cubic-bezier(0.35, 0, 0.7, 1) 0.25s 4 alternate;
}
@keyframes serve-x {
  from { left: -22px; }
  to   { left: calc(100% + 22px); }
}
@keyframes serve-y {
  from { transform: translateY(0) scale(1, 0.92); }
  to   { transform: translateY(-52px) scale(1, 1.04); }
}

.hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hero__eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ball);
}

.hero h1 {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: clamp(40px, 13vw, 62px);
  line-height: 0.86;
  font-weight: 800;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  max-width: 11ch;
  animation: hero-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(14px); clip-path: inset(0 0 100% 0); }
  to   { opacity: 1; transform: translateY(0);    clip-path: inset(0 0 -10% 0); }
}

.hero__meta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  animation: fade 0.5s ease 0.35s both;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(5, 22, 30, 0.34);
  border: 1px solid rgba(238, 244, 246, 0.18);
  padding: 5px 10px;
  border-radius: var(--r);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.hero .icon-btn {
  background: rgba(5, 22, 30, 0.34);
  border: 1px solid rgba(238, 244, 246, 0.18);
  color: var(--chalk);
  box-shadow: none;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ball);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  margin-bottom: 4px;
}
.back-link:active { opacity: 0.6; }

/* La balle qui rebondit : témoin « en direct ». */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffd7ab, var(--ball) 65%);
  animation: dot-bounce 0.9s cubic-bezier(0.35, 0, 0.7, 1) infinite alternate;
}
@keyframes dot-bounce {
  from { transform: translateY(2px) scale(1.1, 0.85); }
  to   { transform: translateY(-4px) scale(0.95, 1.05); }
}

/* ==========================================================================
   Boutons
   ========================================================================== */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  border-radius: var(--r);
  padding: 13px 18px;
  background: var(--ball);
  color: var(--felt-deep);
  text-decoration: none;
  transition: transform 0.1s ease, filter 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(255, 122, 24, 0.28);
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:hover { filter: brightness(1.07); }
.btn--block { width: 100%; }
.btn--lg { padding: 16px 20px; font-size: 15px; }
.btn--ghost {
  background: transparent;
  color: var(--ball);
  box-shadow: none;
  border: 1px solid var(--line);
}
.btn--soft {
  background: rgba(255, 122, 24, 0.14);
  color: var(--ball);
  box-shadow: none;
  border: 1px solid rgba(255, 122, 24, 0.3);
}
.btn--muted {
  background: rgba(238, 244, 246, 0.08);
  color: var(--chalk);
  box-shadow: none;
  border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.45; pointer-events: none; }

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  background: var(--felt);
  color: var(--chalk);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex: none;
}

/* ==========================================================================
   Cartes & titres
   ========================================================================== */
.card {
  background: linear-gradient(180deg, var(--felt) 0%, #0a3648 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card__title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 700;
  margin: 22px 2px 10px;
}

/* ==========================================================================
   Onglets — une ligne à la craie, un trait de balle sous l'actif
   ========================================================================== */
.tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--felt-deep);
}
.tab {
  flex: 1;
  position: relative;
  text-align: center;
  padding: 13px 4px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: transparent;
  transition: color 0.18s ease;
}
.tab::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -1px;
  height: 2px;
  background: var(--ball);
  transform: scaleX(0);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.tab.active { color: var(--chalk); }
.tab.active::after { transform: scaleX(1); }

/* ==========================================================================
   Poules & classements
   ========================================================================== */
.pool-badge {
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid var(--ball);
  color: var(--ball);
  font-family: var(--display);
  font-weight: 900;
  font-size: 17px;
  flex: none;
}

.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.standings th {
  text-align: right;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  padding: 4px 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.standings th.name, .standings td.name { text-align: left; }
.standings td {
  text-align: right;
  padding: 10px 6px;
  border-top: 1px solid var(--line);
}
/* Qualifié : un trait de balle en bord de ligne. */
.standings tr.qualified td:first-child {
  box-shadow: inset 2px 0 0 var(--ball);
}
.standings tr.qualified td {
  background: linear-gradient(90deg, rgba(255, 122, 24, 0.09), transparent 70%);
}
.rankpill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 4px;
  background: rgba(238, 244, 246, 0.09);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 9px;
  font-variant-numeric: tabular-nums;
}
.rankpill.top { background: var(--ball); color: var(--felt-deep); }
.standings td.name { font-weight: 500; }
.standings .pts { font-weight: 700; color: var(--chalk); }

/* ==========================================================================
   Matchs
   ========================================================================== */
.match {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 6px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.match:first-of-type { border-top: 0; }
.match:active {
  background: rgba(238, 244, 246, 0.05);
  transform: scale(0.99);
}
.match__players {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.match__side {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
}
.match__side .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match__side.win .nm { color: var(--chalk); font-weight: 700; }
.match__side.lose .nm { color: var(--muted); }
.match__side .setwin { font-size: 11px; }

.match__score { text-align: right; min-width: 52px; }
/* La plaque de score : mousse noire, chiffres à la craie. */
.score-badge {
  display: inline-block;
  background: var(--pip);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--chalk);
  animation: plate-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes plate-in {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}
.score-badge small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
  letter-spacing: 0.04em;
}
.match__cta {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ball);
  border: 1px solid rgba(255, 122, 24, 0.4);
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.win { background: var(--let); }
.dot.lose { background: rgba(238, 244, 246, 0.18); }
.dot.pending { background: var(--ball); }

/* ==========================================================================
   Tableau final
   ========================================================================== */
.bracket {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.bracket__col {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 10px;
  scroll-snap-align: start;
}
.bracket__round-name {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
  text-align: center;
}
.bmatch {
  background: var(--felt);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.bmatch:active { transform: scale(0.985); }
.bmatch[data-ko]:hover { border-color: rgba(255, 122, 24, 0.45); }
.bmatch__side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 11px;
  font-size: 13px;
  font-weight: 500;
  gap: 8px;
}
.bmatch__side + .bmatch__side { border-top: 1px solid var(--line); }
.bmatch__side.win {
  background: linear-gradient(90deg, rgba(255, 122, 24, 0.12), transparent);
  box-shadow: inset 2px 0 0 var(--ball);
}
.bmatch__side.win .bnm { font-weight: 700; color: var(--chalk); }
.bmatch__side.empty { color: var(--muted); font-style: italic; }
.bnm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bmatch__sc {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ball);
}

/* ==========================================================================
   Champion — le moment
   ========================================================================== */
.champion-banner {
  position: relative;
  margin: 6px 0 16px;
  padding: 26px 20px;
  border-radius: var(--r-lg);
  background: var(--pip);
  border: 1px solid rgba(255, 122, 24, 0.35);
  color: var(--chalk);
  text-align: center;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  box-shadow: 0 0 44px rgba(255, 122, 24, 0.18), var(--shadow-lg);
}
/* Balayage de lumière, une fois. */
.champion-banner::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 122, 24, 0.22), transparent);
  animation: sweep 2.6s cubic-bezier(0.3, 0, 0.2, 1) 0.4s 2 both;
}
@keyframes sweep {
  from { left: -50%; }
  to   { left: 105%; }
}
.champion-banner .who {
  font-family: var(--display);
  font-size: clamp(34px, 11vw, 52px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0.01em;
  margin-top: 8px;
  color: var(--ball);
  text-transform: uppercase;
}

/* ==========================================================================
   Vide
   ========================================================================== */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
  font-size: 14px;
}
.empty .big {
  font-size: 42px;
  margin-bottom: 10px;
  animation: dot-bounce 1.1s cubic-bezier(0.35, 0, 0.7, 1) infinite alternate;
}
.empty h2 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--chalk);
}

/* ==========================================================================
   Formulaires
   ========================================================================== */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.field .hint {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.02em;
}
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
  font-family: var(--body);
  font-size: 16px; /* évite le zoom iOS */
  font-weight: 500;
  background: var(--felt-deep);
  color: var(--chalk);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder { color: rgba(126, 154, 168, 0.6); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ball);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.16);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

.player-input {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.player-input .num {
  width: 22px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.player-input input { flex: 1; }
.player-input .del {
  flex: none;
  width: 40px;
  height: 46px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--rubber);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.player-input .del:active { background: rgba(226, 59, 78, 0.15); }

.seg {
  display: flex;
  gap: 4px;
  background: rgba(5, 22, 30, 0.5);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: var(--r);
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 11px 4px;
  border-radius: 4px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg button.active { background: var(--ball); color: var(--felt-deep); }
.seg button:active { transform: scale(0.97); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  inset: 0;
  background: rgba(238, 244, 246, 0.14);
  border-radius: 999px;
  transition: background 0.2s ease;
}
.switch .track::before {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: var(--chalk);
  border-radius: 50%;
  transition: transform 0.24s cubic-bezier(0.2, 1.3, 0.4, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch input:checked + .track { background: var(--ball); }
.switch input:checked + .track::before { transform: translateX(20px); }

/* ==========================================================================
   Feuille de score
   ========================================================================== */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet[hidden] { display: none; }
.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 12, 18, 0.7);
  backdrop-filter: blur(3px);
  animation: fade 0.22s ease;
}
.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: var(--felt-deep);
  border-top: 1px solid rgba(238, 244, 246, 0.16);
  border-radius: 18px 18px 0 0;
  padding: 8px 18px calc(22px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideup 0.34s cubic-bezier(0.2, 1, 0.3, 1);
  max-height: 92dvh;
  overflow-y: auto;
}
.sheet__grip {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: rgba(238, 244, 246, 0.25);
  margin: 6px auto 16px;
}
.sheet__title {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sheet__sub {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 5px 0 20px;
}

/* Les deux camps : orange contre rouge, comme les deux mousses. */
.set-players {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  gap: 10px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 13px;
}
.set-players .p { text-align: center; }
.set-players .p1 { color: var(--ball); }
.set-players .vs {
  text-align: center;
  color: var(--muted);
  align-self: center;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.set-row {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.set-row .lab {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.set-row input {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  padding: 12px 6px;
  font-variant-numeric: tabular-nums;
}

/* Set verrouillé : le match est déjà joué, ce set n'a pas lieu d'être. */
.set-row.locked { opacity: 0.4; }
.set-row.locked input {
  pointer-events: none;
  border-style: dashed;
  background: transparent;
}
.set-row.locked .lab { text-decoration: line-through; }

.set-note {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  margin: 4px 0 2px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: rgba(53, 192, 138, 0.1);
  border: 1px solid rgba(53, 192, 138, 0.3);
  color: var(--let);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  animation: plate-in 0.25s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.set-note[hidden] { display: none; }

.sheet__actions { display: flex; gap: 10px; margin-top: 16px; }
.add-set { margin: 2px 0 16px; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--pip);
  border: 1px solid rgba(255, 122, 24, 0.4);
  color: var(--chalk);
  padding: 12px 18px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 13.5px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s cubic-bezier(0.2, 1.2, 0.3, 1);
}
@keyframes toast-in {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.toast[hidden] { display: none; }
.toast.err { border-color: var(--rubber); }

/* ==========================================================================
   Liste des tournois
   ========================================================================== */
.tourney-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  border-radius: var(--r);
  transition: background 0.15s ease;
}
.tourney-item:active { background: rgba(238, 244, 246, 0.05); }
.tourney-item + .tourney-item { border-top: 1px solid var(--line); }
.tourney-item .meta { flex: 1; min-width: 0; }
.tourney-item .meta .t { font-weight: 700; font-size: 15px; }
.tourney-item .meta .s {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.status-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  border: 1px solid;
}
.status-pill.pools { color: var(--ball); border-color: rgba(255, 122, 24, 0.4); }
.status-pill.knockout { color: var(--rubber); border-color: rgba(226, 59, 78, 0.45); }
.status-pill.finished { color: var(--let); border-color: rgba(53, 192, 138, 0.45); }

.note {
  background: rgba(255, 122, 24, 0.08);
  border: 1px solid rgba(255, 122, 24, 0.25);
  color: #ffc48f;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.fab-wrap { margin: 18px 0 8px; }

/* ==========================================================================
   Entrée de page — pilotée par #app.anim-in (voir paint() dans app.js).
   La classe est retirée lors des rafraîchissements auto (toutes les 5 s)
   pour que rien ne clignote pendant qu'on regarde le score.
   ========================================================================== */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

#app.anim-in > *:not(.tabs):not(.hero) {
  animation: rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#app.anim-in > *:nth-child(2) { animation-delay: 0.06s; }
#app.anim-in > *:nth-child(3) { animation-delay: 0.12s; }
#app.anim-in > *:nth-child(4) { animation-delay: 0.18s; }
#app.anim-in > *:nth-child(5) { animation-delay: 0.24s; }
#app.anim-in > *:nth-child(6) { animation-delay: 0.3s; }
#app.anim-in > *:nth-child(n + 7) { animation-delay: 0.36s; }

/* ==========================================================================
   Accessibilité — mouvement réduit
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .hero::after { display: none; }
}
