/* ==========================================================================
   Page de maintenance + mini-jeu de tennis
   --------------------------------------------------------------------------
   Tout ce qui se personnalise est regroupé dans :root ci-dessous.
   Les couleurs du jeu (raquettes, balle, lignes) sont lues par script.js
   directement depuis ces variables : un seul endroit à modifier.
   ========================================================================== */

/* ---------- Typographie : RF Dewi Expanded (6 graisses) ---------- */
@font-face {
  font-family: "RF Dewi Expanded";
  src: url("assets/fonts/RFDewiExpanded-Thin.woff2") format("woff2");
  font-weight: 250;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "RF Dewi Expanded";
  src: url("assets/fonts/RFDewiExpanded-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "RF Dewi Expanded";
  src: url("assets/fonts/RFDewiExpanded-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "RF Dewi Expanded";
  src: url("assets/fonts/RFDewiExpanded-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "RF Dewi Expanded";
  src: url("assets/fonts/RFDewiExpanded-Ultrabold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "RF Dewi Expanded";
  src: url("assets/fonts/RFDewiExpanded-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---------- BACKGROUND (remplacez uniquement cette ligne) ---------- */
  --bg-image: url("assets/background-web.jpg");
  --bg-color: #3a74c2;            /* couleur affichée pendant le chargement de l'image */
  --bg-position: center center;
  --scrim: rgba(10, 18, 54, 0.24); /* voile de lisibilité posé sur l'image (0 = aucun) */

  /* ---------- Interface ---------- */
  --chalk: #ffffff;
  --chalk-2: rgba(255, 255, 255, 0.8);
  --chalk-3: rgba(255, 255, 255, 0.6);
  --ink: #0d1c4f;
  --status: #f6d88f;

  /* Surface du court (verre dépoli teinté marine) */
  --court-surface: rgba(12, 26, 76, 0.30);
  --court-border: rgba(255, 255, 255, 0.24);
  --court-radius: 22px;
  --court-max-width: 1400px;       /* largeur maximale du terrain sur grand écran */

  /* ---------- Couleurs du jeu (hex uniquement, lues par script.js) ---------- */
  --c-line: #ffffff;               /* lignes du court et filet */
  --c-player: #ffffff;             /* cadre de votre raquette */
  --c-player-accent: #ff7382;      /* grip de votre raquette + repères "Vous" */
  --c-ai: #d3f1fb;                 /* cadre de la raquette de l'ordinateur */
  --c-ai-accent: #74d3ee;          /* grip de l'ordinateur + repères "Ordi" */
  --c-ai-bed: #0f2160;             /* tamis (sombre) de l'ordinateur */
  --c-ball: #eaf36d;               /* balle */

  /* ---------- Typo & mouvement ---------- */
  --font: "RF Dewi Expanded", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Calculé par script.js : marge entre le bord de la zone et le terrain */
  --court-inset: 0px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--chalk);
  background: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, p { margin: 0; }

a { color: inherit; }

button { font: inherit; color: inherit; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

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

/* ---------- Fond ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg-color);
  background-image: var(--bg-image);
  background-size: cover;
  background-position: var(--bg-position);
  background-repeat: no-repeat;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

/* ---------- Mise en page ---------- */
.page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  padding:
    max(18px, env(safe-area-inset-top))
    max(clamp(18px, 3.2vw, 44px), env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(clamp(18px, 3.2vw, 44px), env(safe-area-inset-left));
  text-shadow: 0 1px 20px rgba(8, 14, 44, 0.16);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.brand__logo {
  display: block;
  height: clamp(34px, 3vw, 44px);     /* taille du logo */
  width: auto;
  color: var(--chalk);
  overflow: visible;
}

.topbar__link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--chalk-2);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 0.2s, background-size 0.3s var(--ease-out);
}

.topbar__link:hover { color: var(--chalk); background-size: 100% 1px; }

.main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  grid-template-areas:
    "intro"
    "stage"
    "score"
    "help";
  column-gap: 32px;
  padding-top: clamp(12px, 3svh, 48px);
}

/* ---------- Message ---------- */
.intro {
  grid-area: intro;
  text-align: center;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chalk-2);
  margin-bottom: clamp(6px, 1.4svh, 14px);
}

.status__text--mobile { display: none; }

.status__dot {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--status);
}

.status__dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--status);
  opacity: 0;
  animation: status-ping 2.8s var(--ease-out) infinite;
}

.title {
  /* suit la largeur, mais aussi la hauteur : tout doit tenir dans l'écran */
  font-size: clamp(1.9rem, min(0.9rem + 3vw, 6.5svh), 4.25rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  margin: clamp(8px, 1.8svh, 18px) auto 0;
  max-width: 40ch;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
  font-weight: 300;
  line-height: 1.45;
  color: var(--chalk-2);
  text-wrap: pretty;
}

/* ---------- Score ---------- */
.scoreboard {
  grid-area: score;
  --score-size: clamp(2.75rem, min(1rem + 7.4vw, 10svh), 9rem);
  margin-top: clamp(14px, 3svh, 40px);
  text-align: center;
}

/* 3 colonnes : le séparateur reste parfaitement centré quelle que soit
   la largeur des chiffres (la graisse change selon qui mène) */
.scoreboard__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(28px, 6vw, 110px);
}

.scoreboard__side {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.6vw, 44px);
}
.scoreboard__side--player { justify-content: flex-end; }
.scoreboard__side--ai { justify-content: flex-start; }

.scoreboard__num {
  display: inline-block;
  font-size: var(--score-size);
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.scoreboard__num.is-bump { animation: score-bump 0.5s var(--ease-out); }
.scoreboard__num.is-lead { font-weight: 900; }   /* celui qui mène */
.scoreboard__num.is-trail { font-weight: 300; }  /* celui qui est mené */

.scoreboard__divider {
  display: block;
  width: 3px;
  height: calc(var(--score-size) * 1.3);
  border-radius: 2px;
  background: var(--chalk);
}

.scoreboard__name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(0.9375rem, 0.85rem + 0.3vw, 1.125rem);
  font-weight: 400;
  color: var(--chalk-2);
  white-space: nowrap;
}

.scoreboard__name::before {
  content: "";
  width: 14px; height: 3px;
  border-radius: 2px;
  background: var(--c-player-accent);
}

.scoreboard__name--ai { flex-direction: row-reverse; }
.scoreboard__name--ai::before { background: var(--c-ai-accent); }

.scoreboard__meta {
  margin-top: clamp(8px, 1.8svh, 24px);
  font-size: clamp(0.9375rem, 0.85rem + 0.35vw, 1.1875rem);
  font-weight: 600;
  color: var(--chalk);
  transition: color 0.3s;
}

.scoreboard__meta.is-hot { color: var(--status); }
.scoreboard__meta { display: inline-block; }

/* ---------- Scène & court ---------- */
/* La hauteur de la scène est calculée par script.js (layout) : le terrain
   prend la place laissée par les autres blocs, sans jamais faire défiler la page. */
.stage {
  grid-area: stage;
  position: relative;
  width: 100%;
  max-width: var(--court-max-width);
  margin: clamp(14px, 3svh, 48px) auto 0;
  aspect-ratio: 1128 / 541.5;
  /* le terrain + le score (en dessous) tiennent ensemble dans la hauteur de l'écran
     (--score-block est calculé par script.js) */
  max-height: max(400px, calc(100svh - var(--score-block, 300px) - 110px));
}

.court {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 600px;   /* valeurs réelles posées par script.js */
  height: 280px;
  transform: translate(-50%, -50%);
  border-radius: var(--court-radius);
  background: var(--court-surface);
  box-shadow:
    inset 0 0 0 1px var(--court-border),
    0 30px 60px -40px rgba(6, 12, 42, 0.55);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  container-type: size;
  cursor: ns-resize;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out), box-shadow 0.3s;
}

.court.is-ready { opacity: 1; }
.court[data-orientation="portrait"] { cursor: ew-resize; }
.court[data-state="playing"] { cursor: none; }
.court[data-state="over"],
.court[data-state="paused"] { cursor: default; }

.court:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 2px var(--chalk),
    0 30px 60px -40px rgba(6, 12, 42, 0.55);
}

.court__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Overlays d'état ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  transition:
    opacity 0.28s var(--ease-out),
    transform 0.4s var(--ease-out),
    visibility 0s linear 0.28s;
}

.court[data-state="idle"] .overlay--idle,
.court[data-state="paused"] .overlay--pause,
.court[data-state="over"] .overlay--over {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.4s var(--ease-out) 0.08s,
    transform 0.5s var(--ease-out) 0.08s,
    visibility 0s;
}

.overlay__kicker {
  white-space: nowrap;
  font-size: clamp(0.75rem, 2.6cqi, 0.9375rem);
  font-weight: 400;
  color: var(--chalk-2);
  margin-bottom: 8px;
}

.overlay__title {
  font-size: clamp(1.3rem, 6cqi, 2.6rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.overlay__text {
  margin-top: 10px;
  max-width: 30ch;
  font-size: clamp(0.875rem, 2.8cqi, 1rem);
  color: var(--chalk-2);
  text-wrap: balance;
}

.overlay__score {
  margin-top: 12px;
  font-size: clamp(2.2rem, 10cqi, 4rem);
  font-weight: 300;
  line-height: 0.9;
  font-variant-numeric: tabular-nums lining-nums;
}

.court[data-state="idle"] .overlay__kicker::before {
  content: "";
  display: inline-block;
  width: 12px; height: 3px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 2px;
  background: var(--c-player-accent);
}

/* Court vertical étroit : typographie resserrée */
.court[data-orientation="portrait"] .overlay { padding: 16px 12px; }

/* ---------- CTA ---------- */
.cta {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin-top: 22px;
  padding: 0 22px 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition:
    background-color 0.25s var(--ease-out),
    color 0.25s var(--ease-out),
    border-color 0.25s var(--ease-out),
    transform 0.15s var(--ease-out);
}

.cta__icon {
  width: 16px; height: 16px;
  transition: transform 0.5s var(--ease-out);
}

.cta:hover {
  background: var(--chalk);
  border-color: var(--chalk);
  color: var(--ink);
}

.cta:hover .cta__icon { transform: rotate(180deg); }
.cta:active { transform: scale(0.97); }
.cta:focus-visible { outline-offset: 4px; border-radius: 999px; }

/* ---------- Balle de match ---------- */
.matchpoint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 16px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.matchpoint.is-visible {
  visibility: visible;
  animation: matchpoint-in 1.7s var(--ease-out) forwards;
}

.matchpoint__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(0.8125rem, 2.4cqi, 1.125rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--status);
}

.matchpoint__kicker::before {
  content: "";
  width: 14px; height: 3px;
  border-radius: 2px;
  background: var(--status);
}
.matchpoint[data-holder="player"] .matchpoint__kicker::before { background: var(--c-player-accent); }
.matchpoint[data-holder="ai"] .matchpoint__kicker::before { background: var(--c-ai-accent); }

.matchpoint__title {
  font-size: clamp(2rem, 9.5cqi, 7rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-wrap: balance;
  text-shadow: 0 8px 40px rgba(8, 14, 44, 0.35);
}

.court[data-orientation="portrait"] .matchpoint__title { font-size: clamp(1.75rem, 14cqi, 3rem); }

/* Anneau lumineux qui bat au rythme du son (60 bpm : « boum-boum ») */
.court::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px var(--status),
    inset 0 0 60px rgba(246, 216, 143, 0.28);
  opacity: 0;
}

.court.is-matchpoint::after { animation: heartbeat 1s linear infinite; }

/* Le libellé « Balle de match » du score bat aussi */
.scoreboard__meta.is-hot { animation: heartbeat-text 1s linear infinite; }

/* ---------- Toast "point" ---------- */
.toast {
  position: absolute;
  left: 50%;
  top: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(8, 18, 56, 0.5);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px);
}

.toast.is-visible { animation: toast 1.25s var(--ease-out) forwards; }

.toast::before {
  content: "";
  display: inline-block;
  width: 10px; height: 3px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 2px;
  background: var(--toast-accent, var(--chalk));
}

/* ---------- Aide / pied ---------- */
.help {
  grid-area: help;
  display: flex;
  justify-content: center;
  text-align: center;
  padding-top: clamp(10px, 2svh, 18px);
  font-size: 0.8125rem;
  color: var(--chalk-3);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.35em;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 5px;
  font: inherit;
  font-size: 0.92em;
  line-height: 1.45;
  text-align: center;
  color: var(--chalk-2);
}

.help--coarse { display: none; }

@media (pointer: coarse) {
  .help--fine { display: none; }
  .help--coarse { display: inline; }
}

/* ---------- Séquence d'apparition (une seule, au chargement) ---------- */
.topbar, .intro, .scoreboard, .help {
  animation: rise 0.8s var(--ease-out) both;
}
.intro { animation-delay: 0.08s; }
.scoreboard { animation-delay: 0.16s; }
.help { animation-delay: 0.3s; }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Smartphone portrait : TOUT tient dans un seul écran, sans défilement.
   La page fait exactement la hauteur visible (100svh = barres du navigateur
   affichées) ; le terrain prend tout l'espace restant (ligne 1fr de la grille)
   et script.js choisit l'orientation qui donne le plus grand court. */
@media (max-width: 640px) and (orientation: portrait) {
  .page {
    height: 100vh;
    height: 100svh;
    min-height: 0;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .topbar { min-height: 30px; }
  .brand__logo { height: 28px; }
  .topbar__link { font-size: 0.6875rem; }

  /* Lignes à hauteur de contenu ; la hauteur du terrain est calculée par
     script.js à partir de l'espace restant. S'il reste de la place (court
     horizontal sur petit écran), elle est répartie régulièrement. */
  .main {
    flex: 1;
    min-height: 0;
    grid-template-rows: auto auto auto auto;
    align-content: space-evenly;
    row-gap: clamp(8px, 1.6svh, 14px);
    padding-top: 4px;
  }

  .status { margin-bottom: 6px; font-size: 0.6875rem; }
  .lede { margin-top: 0; font-size: 0.8125rem; }
  /* En-tête mobile : « Mise à jour en cours » (style du statut) puis la phrase
     d'accroche ; le titre reste lisible par les lecteurs d'écran seulement. */
  .status__text--desktop { display: none; }
  .status__text--mobile { display: inline; }
  .title {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }

  /* Le terrain remplit la ligne flexible de la grille */
  .stage {
    aspect-ratio: auto;
    width: 100%;
    max-height: none;
    min-height: 0;
    margin: 0;
  }

  /* Score compact sur une ligne : Vous 00 | 00 Roger */
  .scoreboard { --score-size: clamp(2.25rem, 11vw, 3rem); margin-top: 0; }
  .scoreboard__row { column-gap: clamp(12px, 4vw, 20px); }
  .scoreboard__side { gap: clamp(8px, 2.6vw, 12px); }
  .scoreboard__name { font-size: 0.8125rem; gap: 6px; }
  .scoreboard__name::before { width: 10px; }
  .scoreboard__divider { width: 2px; height: calc(var(--score-size) * 1.15); }
  .scoreboard__meta { margin-top: 4px; font-size: 0.75rem; }

  /* Pas de pied de page : l'overlay du terrain explique déjà les contrôles */
  .help { display: none; }

  .court[data-orientation="portrait"] .toast { top: 50%; }

  /* Apparition sans décalage vertical : rien ne dépasse de l'écran, même 1 image */
  .topbar, .intro, .scoreboard, .help { animation-name: fade-in; }
}

/* Terrain très petit (petits téléphones) : on allège les overlays */
@container (max-height: 380px) {
  .overlay__text { display: none; }
  .overlay__score { margin-top: 6px; }
  .cta { margin-top: 14px; min-height: 44px; }
}
@container (max-width: 200px) {
  .overlay__kicker { font-size: 0.6875rem; }
  .overlay__title { font-size: 1.15rem; }
  .matchpoint__title { font-size: 1.6rem !important; }
  .cta { padding: 0 16px; }
}

/* Smartphone paysage : message + score à gauche, court à droite */
@media (orientation: landscape) and (max-height: 540px) {
  .page {
    height: 100vh;
    height: 100svh;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .topbar { min-height: 28px; }
  .brand__logo { height: 26px; }
  .topbar__link { display: none; }

  .main {
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(200px, 28%) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "intro stage"
      "score stage"
      "help  stage";
    column-gap: 20px;
    padding-top: 12px;
  }

  .intro, .scoreboard, .help { margin: 0; }
  .intro { text-align: left; }
  .status { justify-content: flex-start; }
  .status { margin-bottom: 6px; font-size: 0.6875rem; }
  .lede { font-size: 0.8125rem; margin-top: 0; }
  /* En-tête mobile : « Mise à jour en cours » (style du statut) puis la phrase
     d'accroche ; le titre reste lisible par les lecteurs d'écran seulement. */
  .status__text--desktop { display: none; }
  .status__text--mobile { display: inline; }
  .title {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }

  .scoreboard { --score-size: 2.4rem; margin-top: 16px; }
  .scoreboard__row { column-gap: 14px; }
  .scoreboard__side { flex-direction: column; gap: 6px; }
  .scoreboard__side--player .scoreboard__name { order: 2; }
  .scoreboard__name { font-size: 0.6875rem; gap: 6px; }
  .scoreboard__name--ai { flex-direction: row; }
  .scoreboard__meta { margin-top: 10px; font-size: 0.75rem; }

  .help { display: none; }

  .stage {
    aspect-ratio: auto;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    min-height: 0;
  }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes score-bump {
  0%   { opacity: 0; transform: translateY(0.35em); filter: blur(3px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; }
}

@keyframes status-ping {
  0%   { opacity: 0.8; transform: scale(0.6); }
  70%, 100% { opacity: 0; transform: scale(1.5); }
}

@keyframes matchpoint-in {
  0%   { opacity: 0; transform: scale(1.35); filter: blur(10px); }
  14%  { opacity: 1; transform: scale(1); filter: blur(0); }
  22%  { transform: scale(1.04); }
  32%  { transform: scale(1); }
  80%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.96); }
}

@keyframes heartbeat {
  0%   { opacity: 0.95; }
  14%  { opacity: 0.15; }
  30%  { opacity: 0.7; }
  48%  { opacity: 0.05; }
  100% { opacity: 0; }
}

@keyframes heartbeat-text {
  0%, 30%   { transform: scale(1.06); }
  14%, 48%  { transform: scale(1); }
  100%      { transform: scale(1); }
}

@keyframes toast {
  0%   { opacity: 0; transform: translate(-50%, -6px); }
  18%  { opacity: 1; transform: translate(-50%, 0); }
  78%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -4px); }
}

/* ---------- Accessibilité : mouvements réduits ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .status__dot::after { display: none; }
  /* le toast reste lisible : simple apparition sans déplacement */
  .toast.is-visible { animation: none; opacity: 1; transform: translate(-50%, 0); }
  .matchpoint.is-visible { animation: none; opacity: 1; }
  .court.is-matchpoint::after { animation: none; opacity: 0.6; }
}

/* Contraste renforcé si demandé par le système */
@media (prefers-contrast: more) {
  :root {
    --scrim: rgba(8, 14, 44, 0.5);
    --chalk-2: #ffffff;
    --chalk-3: rgba(255, 255, 255, 0.9);
    --court-surface: rgba(8, 18, 56, 0.6);
  }
}
