/* Myping Livecast - refonte mobile (360 à 430 px en priorité).
   Chargée après style.css : navigation par onglets, docks dans la zone du
   pouce, cibles tactiles de 44 px minimum, hiérarchie resserrée.
   Les règles de DESIGN.md restent la référence (orange = état du match ou
   action principale, noirs chauds, une seule ombre : le scoreboard). */

:root {
  --tap: 44px;
  --tabbar-h: 62px;
  --bottom-ui: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Surfaces du navigateur : sélection, curseur, défilement, chiffres */
::selection { background: var(--orange); color: var(--orange-ink); }
html { scrollbar-color: var(--line) var(--bg); }
input, textarea, select { caret-color: var(--orange-bright); accent-color: var(--orange); }
.bigscore, .teamscore, .day-record, .match-item .score, .sets-history { font-variant-numeric: tabular-nums; }
a { text-underline-offset: 3px; }

.ui-ic { display: block; flex: none; width: 22px; height: 22px; }

/* ---------- Pied de page ---------- */
.footer-nav,
.footer-legal {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px;
  margin: 0 auto 12px; max-width: 560px;
}
.footer-nav a,
.footer-legal a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 12px; border-radius: 10px;
  font-weight: 600;
}
.footer-nav a { font-size: 14.5px; color: var(--ink); }
.footer-nav a:hover, .footer-legal a:hover { color: var(--orange-bright); background: var(--surface); }
.footer-legal a { font-size: 13px; font-weight: 500; }
footer.site .footer-line { margin: 0 auto 4px; max-width: 46ch; font-size: 13px; line-height: 1.5; text-wrap: balance; }
footer.site .footer-copy {
  margin: 10px 0 0; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 600;
}
.footer-flags { margin-bottom: 14px; }
.footer-flags .locale-flags__btn { min-width: var(--tap); min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Barre d'onglets (comptes connectés, mobile) ---------- */
.tabbar { display: none; }
.topbar-back { display: none; }

@media (max-width: 767px) {
  /* En-tête : une seule ligne, 52 px */
  .topbar {
    padding: 8px 0;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    margin-bottom: 14px;
  }
  .topbar .wrap { flex-wrap: nowrap; gap: 10px; row-gap: 0; }
  .logo-img, .logo__svg { height: 36px; }
  .topbar .locale-flags { display: none; }
  .topbar .topbar-text-link { display: none; }
  .topbar .topbar-nav,
  .topbar .topbar-nav-multi {
    display: flex; order: 0; flex: 1 1 auto; width: auto;
    flex-wrap: nowrap; justify-content: flex-end; gap: 8px;
  }
  .topbar .topbar-nav-multi .topbar-link,
  .topbar .topbar-link { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .topbar .topbar-status { align-self: center; }
  .topbar--user .topbar-link { display: none; }
  .topbar--user .topbar-back {
    display: inline-flex; align-items: center; gap: 2px;
    min-height: 40px; padding: 0 12px 0 6px;
    color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600;
    border: 1px solid var(--line); border-radius: 99px;
  }
  .topbar--user .topbar-back .ui-ic { width: 20px; height: 20px; color: var(--muted); }
  /* Les vues de match laissent le haut de l'écran au scoreboard collant */
  body:has(.scoreboard) .topbar { position: static; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch;
    background: var(--bg); border-top: 1px solid var(--line);
    padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + var(--safe-b)) max(6px, env(safe-area-inset-left, 0px));
  }
  .tabbar-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 54px; border-radius: 12px;
    color: var(--muted); text-decoration: none;
    font-size: 12px; font-weight: 600; line-height: 1;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s var(--ease-out), background .15s var(--ease-out);
  }
  .tabbar-item:active { background: var(--surface); }
  .tabbar-item.is-active { color: var(--orange-bright); }
  .tabbar-item.is-active .ui-ic { stroke-width: 2.1; }
  .tabbar-create { color: var(--ink); }
  .tabbar-plus {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 30px; border-radius: 99px;
    background: var(--orange); color: var(--orange-ink);
  }
  .tabbar-plus .ui-ic { width: 20px; height: 20px; stroke-width: 2.4; }
  .tabbar-create:active .tabbar-plus { background: var(--orange-deep); color: var(--ink); }

  body:has(.tabbar) { --bottom-ui: var(--tabbar-h); }
  body:has(.tabbar) .wrap { padding-bottom: calc(var(--tabbar-h) + 28px + var(--safe-b)); }
  body:has(.tabbar) .topbar .wrap { padding-bottom: 0; }
  body:has(.tabbar) .back-to-top { bottom: calc(var(--tabbar-h) + 14px + var(--safe-b)); }
}

.toast { bottom: calc(24px + var(--bottom-ui) + var(--safe-b)); }

/* ---------- Cibles tactiles et champs ---------- */
@media (pointer: coarse), (max-width: 767px) {
  .btn { min-height: 48px; }
  .btn-sm { min-height: var(--tap); }
  .field input:not([type=checkbox]):not([type=radio]):not([type=file]),
  .field select,
  .pf-row input,
  .filter-search { min-height: 48px; }
  .field label { font-size: 13.5px; }
  .chip, .chip-filter, .chips-fold > .chips-fold-toggle { min-height: var(--tap); }
  .link-btn { min-height: var(--tap); padding: 0 2px; font-size: 13.5px; }
  .qr-close, .comment-modal-close { min-width: var(--tap); min-height: var(--tap); padding: 0; top: 4px; right: 4px; }
  .field-inline label.switch { min-height: var(--tap); }
  .field-inline input[type=checkbox] { width: 22px; height: 22px; }
}

@media (max-width: 767px) {
  .card { padding: 18px 16px; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { width: 100%; }
}

/* ---------- Accueil : rejoindre un live avec un code ---------- */
.join-card { scroll-margin-top: 80px; }
.join-card h2 { margin-bottom: 6px; }
.join-row { margin-top: 12px; }
.join-row input {
  min-height: 52px; text-transform: uppercase; letter-spacing: 2px; font-weight: 700;
}
.join-row input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; }
.join-row .btn { flex: none; min-height: 52px; }
.join-error { margin: 12px 0 0; }
.join-error[hidden] { display: none; }

.hero-img picture, .mode-card picture { display: block; }

@media (max-width: 560px) {
  /* Les trois formats : une ligne compacte chacun, plus un écran entier par image */
  .mode-card-static {
    display: grid; grid-template-columns: 104px minmax(0, 1fr); grid-template-rows: auto 1fr;
    align-items: start;
  }
  .mode-card-static picture { grid-row: 1 / 3; height: 100%; }
  .mode-card-static img { width: 104px; height: 100%; min-height: 96px; }
  .mode-card-static .mode-title { padding: 14px 14px 2px; }
  .mode-card-static .mode-desc { padding: 0 14px 14px; }
}

/* ---------- Partage : action secondaire, discrète ---------- */
.share-toggle-btn {
  min-height: 48px; padding: 10px 16px; justify-content: flex-start;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 15px; font-weight: 600;
}
.share-toggle-btn:hover { border-color: var(--orange); background: var(--surface-2); }
.share-toggle-chevron { margin-left: auto; color: var(--muted); }
.share-act { min-height: 48px; }

/* ---------- Console : dock de score ---------- */
.score-dock .ctrl-points { margin-bottom: 10px; }
.btn.btn-point { min-height: 84px; padding: 12px 10px; gap: 2px; }
.btn-point-plus { font-size: 34px; font-weight: 700; line-height: 1; }
.btn.btn-point small {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dock-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.dock-undo { min-width: 0; padding-inline: 10px; color: var(--muted); }
.dock-undo-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-comment { gap: 6px; padding-inline: 16px; }
.dock-comment .ui-ic { width: 20px; height: 20px; color: var(--orange-bright); }
.dock-paused { display: none; margin: 0 0 10px; text-align: center; }
#card-score.score-paused .dock-undo { display: none; }
#card-score.score-paused .dock-row { grid-template-columns: 1fr; }
#card-score.score-paused .dock-paused { display: block; }

@media (max-width: 959px) {
  #card-score.score-dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0;
    background: var(--bg);
    padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + var(--safe-b)) max(12px, env(safe-area-inset-left, 0px));
  }
  body.has-score-dock { --bottom-ui: 168px; }
  body.has-score-dock .wrap-live { padding-bottom: calc(196px + var(--safe-b)); }
  body.has-score-dock.comment-open #card-score.score-dock { display: none; }
}

/* Pause / fin : deux actions côte à côte, hors du chemin du pouce */
.live-ctrl { display: flex; gap: 10px; padding: 12px; margin-top: 18px; }
.live-ctrl .btn { flex: 1 1 0; min-width: 0; font-size: 17px; padding-inline: 12px; }
.live-ctrl .btn-finish { color: #ffb3b3; }

/* Partie en parallèle : repliée tant qu'une partie est commentée */
.nm-head { margin-bottom: 14px; }
.nm-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  min-height: var(--tap); padding: 0; border: 0; background: none; cursor: default;
  font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; color: var(--ink);
}
.nm-toggle .ui-ic { display: none; color: var(--muted); transition: transform .2s var(--ease-out); }
.is-foldable .nm-toggle { cursor: pointer; }
.is-foldable .nm-toggle .ui-ic { display: block; }
.is-foldable.is-unfolded .nm-toggle .ui-ic { transform: rotate(180deg); }
.is-foldable:not(.is-unfolded) .nm-head { margin-bottom: 0; }
.is-foldable:not(.is-unfolded) form { display: none; }

.admin-drawer > summary, .admin-item > summary { min-height: var(--tap); display: flex; align-items: center; }
.admin-item > summary { justify-content: space-between; }
.admin-item > summary::after { content: "▾"; font-size: 12px; color: var(--muted); }
.admin-item[open] > summary::after { content: "▴"; }

/* ---------- Fil : réactions condensées ---------- */
.react-row { align-items: center; }
.react-btn { min-height: 40px; padding: 0 12px; font-size: 14.5px; }
.react-extra { display: none; }
.react-row.is-open .react-extra { display: inline-flex; }
.react-more {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 99px; background: transparent;
  color: var(--muted); cursor: pointer;
  transition: border-color .15s var(--ease-out), color .15s var(--ease-out);
}
.react-more .ui-ic { width: 20px; height: 20px; }
.react-more:hover { border-color: var(--orange); color: var(--orange-bright); }
.react-more[aria-expanded="true"] { border-color: var(--orange-deep); color: var(--orange-bright); background: var(--surface-2); }
.ev .meta { font-size: 12.5px; min-height: 24px; }
.ev-act { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.ev-report { font-size: 13px; }

/* ---------- Feuille modale (signalement, édition d'un message) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); }
.sheet-card {
  position: relative; width: 100%; max-width: 480px;
  max-height: min(92dvh, 720px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(18px + var(--safe-b));
}
.sheet-title {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 24px; font-weight: 600; letter-spacing: .3px; margin: 0 0 14px;
}
.sheet-options { border: 0; display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; padding: 0; min-width: 0; }
.sheet-legend { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; padding: 0; }
.sheet-option {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-size: 15px; line-height: 1.3; cursor: pointer;
}
.sheet-option input { width: 20px; height: 20px; flex: none; accent-color: var(--orange); }
.sheet-option:has(input:checked) { border-color: var(--orange); background: rgba(244, 97, 11, .08); }
.sheet-card textarea { resize: vertical; min-height: 76px; }
.sheet-error[hidden] { display: none; }
.sheet-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin-top: 4px; }
.btn-danger { background: var(--loss); color: #2a0b0b; }
body.sheet-open { overflow: hidden; }
@media (min-width: 480px) {
  .sheet { align-items: center; padding: 18px; }
  .sheet-card { border-radius: 16px; padding-bottom: 20px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet-card { animation: sheet-in .28s var(--ease-out); }
  .sheet-backdrop { animation: sheet-fade .2s var(--ease-out); }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@keyframes sheet-fade { from { opacity: 0; } }

/* ---------- Spectateur : dock de message ---------- */
.fan-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + var(--safe-b)) max(12px, env(safe-area-inset-left, 0px));
}
.fan-dock-inner { max-width: 640px; margin: 0 auto; }
.fan-dock-bar { display: flex; align-items: center; gap: 8px; }
.fan-dock-bar .composer { flex: 1; min-width: 0; }
.fan-dock-bar .composer input { min-height: 48px; border-radius: 99px; padding-inline: 18px; background: var(--surface); }
.fan-dock-bar .btn-icon { border-radius: 50%; }
.fan-dock-bar .btn-icon .ui-ic { width: 22px; height: 22px; }
.fan-dock-toggle {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer;
  transition: border-color .15s var(--ease-out), color .15s var(--ease-out);
}
.fan-dock-toggle .ui-ic { transition: transform .2s var(--ease-out); }
.fan-dock-toggle:hover { border-color: var(--orange); }
.fan-dock-toggle[aria-expanded="true"] { border-color: var(--orange-deep); color: var(--orange-bright); }
.fan-dock-toggle[aria-expanded="true"] .ui-ic { transform: rotate(45deg); }
.fan-dock-panel {
  max-height: min(58dvh, 440px); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 2px 12px;
}
.fan-dock-panel[hidden] { display: none; }
.fan-dock-label { margin: 2px 0 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.fan-dock-panel .chips-fold { margin: 4px 0 0; }
body:has(.fan-dock) { --bottom-ui: 66px; }
body:has(.fan-dock) .wrap-match { padding-bottom: calc(96px + var(--safe-b)); }

.card-matches { margin-top: 0; }
.report-row-text { display: flex; flex-wrap: wrap; gap: 0 16px; justify-content: flex-start; }
.report-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
  padding: 0 2px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--muted);
}
.report-link .ui-ic { width: 16px; height: 16px; }
.report-link:hover { color: #ffb3b3; }

@media (prefers-reduced-motion: reduce) {
  .nm-toggle .ui-ic, .fan-dock-toggle .ui-ic, .tabbar-item { transition: none; }
}

/* ---------- Vues de match : pleine largeur utile sur mobile ---------- */
@media (max-width: 767px) {
  .wrap-live, .wrap-match { max-width: 100%; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .scoreboard { padding: 14px 12px 12px; top: 8px; }
  .scoreboard .event-name { font-size: 13px; letter-spacing: 1.2px; margin-bottom: 8px; text-wrap: balance; }
  .live-header { padding: 12px 14px 10px; }
  .lh-sub { font-size: 12px; letter-spacing: 1px; }
  .player .club { font-size: 12px; }
  .sets-history { font-size: 13px; }
  .court-side-btn small { font-size: 12px; }
  .card-about-live { margin-top: 16px; }
}
@media (max-width: 399px) {
  /* Noms au-dessus, score dessous : le score reste le héros */
  .score-row, .replay-score { align-items: start; }
  .bigscore, .rp-big { font-size: 58px; gap: 8px; margin-top: 2px; }
  .bigscore .sep, .rp-big .rp-sep { font-size: 40px; }
  .player .name, .rp-name { font-size: 16px; }
}
.serve-pick, .court-pick { margin-bottom: 12px; }

/* ---------- Mes lives : parcours de création ---------- */
#mode-cards, #create-card { scroll-margin-top: 68px; }
.create-cancel {
  display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap);
  margin: 10px auto 0; padding: 0 12px 0 6px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 600; color: var(--muted);
}
.create-cancel[hidden] { display: none; }
.create-cancel .ui-ic { width: 20px; height: 20px; }
.create-cancel:hover { color: var(--ink); }
/* Pendant la création, les listes et filtres s'effacent */
body.is-creating .list-filters,
body.is-creating #sec-mine,
body.is-creating #sec-followed,
body.is-creating #sec-archived,
body.is-creating [data-lf-empty] { display: none !important; }
body.is-creating .hero-compact { padding-bottom: 14px; }
body.is-creating-form #create-type-step,
body.is-creating-form #create-type-hint { display: none !important; }

/* Carte dans la carte : la mention de responsabilité redevient un simple bloc */
.card.policy-box {
  background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  padding: 16px 0 0; margin-bottom: 16px;
}
.card.policy-box h2 { font-size: 18px; margin-bottom: 8px; }

@media (max-width: 767px) {
  .hero-compact { padding: 6px 4px 18px; }
  .hero-compact h1 { font-size: clamp(30px, 8.6vw, 40px); }
  .hero-compact .hero-ctas { margin-top: 14px; }

  /* Choix du type : trois lignes compactes, tout tient sur un écran */
  #mode-cards { gap: 10px; margin-bottom: 16px; }
  #mode-cards .mode-card {
    display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto 1fr;
    align-items: start; min-height: 92px;
  }
  #mode-cards .mode-card img { grid-row: 1 / 3; width: 96px; height: 100%; min-height: 92px; }
  #mode-cards .mode-title { padding: 14px 14px 2px; font-size: 20px; }
  #mode-cards .mode-desc { padding: 0 14px 14px; }
  button.mode-card:hover { transform: none; }

  /* Type choisi : les cartes deviennent un sélecteur à trois segments */
  body.is-creating-form #mode-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  body.is-creating-form #mode-cards .mode-card {
    display: flex; align-items: center; justify-content: center; min-height: 48px;
    border-radius: 10px; text-align: center;
  }
  body.is-creating-form #mode-cards .mode-card img,
  body.is-creating-form #mode-cards .mode-desc { display: none; }
  body.is-creating-form #mode-cards .mode-title { padding: 6px 4px; font-size: 15px; line-height: 1.1; letter-spacing: .3px; }
  body.is-creating-form #mode-cards .mode-card.active { background: var(--orange); border-color: var(--orange); box-shadow: none; }
  body.is-creating-form #mode-cards .mode-card.active .mode-title { color: var(--orange-ink); }

  /* Lancer le live : toujours à portée de pouce, au-dessus des onglets */
  #create-btn {
    position: sticky; bottom: calc(var(--bottom-ui) + 10px + var(--safe-b)); z-index: 5;
    box-shadow: 0 0 0 10px var(--surface);
  }
  #create-card { padding-bottom: 26px; }
  .field-hint { font-size: 12.5px; line-height: 1.4; }
}

/* ---------- Mes lives : filtres et cartes de live ---------- */
@media (max-width: 520px) {
  .filter-chips {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    margin-inline: -16px; padding: 2px 16px; scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .filter-chips::-webkit-scrollbar { display: none; }
  .filter-chips .chip { flex: none; white-space: nowrap; scroll-snap-align: start; }
  .live-tags-filter-hint { display: none; }

  .match-list-cols .match-list-head { display: none; }
  .match-list { gap: 10px; }
  .match-list-cols .match-item-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "badge date" "names score" "actions actions";
    gap: 8px 12px; padding: 14px;
    border-radius: var(--radius);
  }
  .match-item-row > .badge-live,
  .match-item-row > .badge-paused,
  .match-item-row > .badge-done { grid-area: badge; justify-self: start; }
  .match-item-row > .live-row-date {
    grid-area: date; flex-direction: row; align-items: baseline; gap: 5px; color: var(--muted);
  }
  .match-item-row .live-row-date-day { font-size: 15px; font-weight: 600; }
  .match-item-row .live-row-date-meta { font-size: 12.5px; }
  .match-item-row > .names { grid-area: names; }
  .match-item-row > .score, .match-item-row > .live-row-score { grid-area: score; align-self: start; }
  .match-item-row .names strong { font-size: 21px; line-height: 1.15; white-space: normal; text-wrap: balance; }
  .match-item-row .names > span { font-size: 13px; }
  .match-item-row .score { font-size: 28px; line-height: 1; }
  .match-list-cols .match-item-row .row-actions {
    grid-area: actions; grid-column: auto; flex-wrap: nowrap; justify-content: flex-start;
    margin-top: 2px;
  }
  .match-item-row .row-actions .btn { order: -1; flex: 1 1 auto; }
  .match-item-row .iconbtn { width: 44px; height: 44px; border-radius: 10px; }
  .live-tags { min-height: 32px; margin-top: 6px; }
  .live-tags .hashtag, .live-tags-hint, .match-item .names .hashtag { font-size: 12.5px; }
  .live-tags-input { font-size: 16px; }
}

/* Options facultatives d'un formulaire : repliées par défaut */
.form-more { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.form-more > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 48px; padding: 0 14px; cursor: pointer; list-style: none;
  font-size: 14.5px; font-weight: 600;
}
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary::after { content: "▾"; font-size: 12px; color: var(--muted); }
.form-more[open] > summary::after { content: "▴"; }
.form-more > summary .muted { font-weight: 500; margin-left: 4px; margin-right: auto; }
.form-more-body { padding: 4px 14px 2px; }
.form-more-body .field input, .form-more-body .field select { background: var(--surface); }

/* Console : service et côtés, deux lignes de réglage sous le score */
.serve-pick-open {
  background: var(--surface); border: 1px solid var(--orange-deep); border-radius: var(--radius); padding: 12px;
}
.serve-pick-open .serve-pick-label { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.court-now-row { min-height: var(--tap); padding: 0 2px; }
.court-now-row .court-now { font-size: 14.5px; color: var(--muted); font-weight: 500; }
.court-now-row .court-now strong { color: var(--ink); }
.court-now-row .serve-now strong { color: var(--orange-bright); }
.court-pick:not(.court-pick-open), .serve-pick:not(.serve-pick-open) { margin-bottom: 4px; }
.court-pick + .serve-pick:not(.serve-pick-open) { margin-bottom: 12px; }

/* Cartes de live : la rangée d'actions occupe toute la largeur */
@media (max-width: 520px) {
  .match-list-cols .match-item-row .row-actions { justify-self: stretch; }
}
footer.site .footer-nav a { color: var(--ink); }
footer.site .footer-nav a:hover { color: var(--orange-bright); }
footer.site .footer-legal a { color: var(--muted); }
footer.site .footer-legal a:hover { color: var(--orange-bright); }

/* ---------- Volets repliables (cartes secondaires) ---------- */
.fold-card > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: var(--tap); cursor: pointer; list-style: none;
}
.fold-card > summary::-webkit-details-marker { display: none; }
.fold-card > summary::after { content: "▾"; font-size: 13px; color: var(--muted); }
.fold-card[open] > summary::after { content: "▴"; }
.fold-card > summary h2 { margin: 0; }
.fold-card[open] > summary { margin-bottom: 12px; }
.fold-card:not([open]) { padding-top: 10px; padding-bottom: 10px; }

/* ---------- Ma liste de joueurs : deux lignes par joueur, édition en place ---------- */
@media (max-width: 767px) {
  .players-layout { gap: 12px; }
  .players-aside .hero-compact p { font-size: 14.5px; }
  .players-aside .card { margin-bottom: 10px; }
}
@container (max-width: 429.98px) {
  .player-row {
    grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
    grid-template-areas:
      "avatar name fav del"
      "rank   club club save";
    gap: 4px 6px; padding: 8px 8px 8px 10px;
  }
  .player-row .pr-avatar { justify-self: center; }
  .player-row-actions { display: contents; }
  .player-row-actions [type=submit] { grid-area: save; }
  .player-row-actions [data-del] { grid-area: del; }
  .player-row .iconbtn { width: 44px; height: 44px; border-color: transparent; background: transparent; }
  .player-row .iconbtn-on { border-color: transparent; }
  .player-row input {
    min-height: 40px; padding: 6px 8px; font-size: 16px;
    border-color: transparent; background: transparent;
  }
  .player-row input[name=name] { font-weight: 600; }
  .player-row .pf-rank, .player-row .pr-club { color: var(--muted); font-size: 16px; }
  .player-row .pf-rank { text-align: center; padding-inline: 2px; }
  .player-row input::placeholder { color: #8f857a; font-weight: 400; }
  .player-row input:hover { border-color: var(--line); }
  .player-row input:focus { border-color: var(--orange); background: var(--bg); color: var(--ink); }
  /* L'enregistrement se signale quand on édite la ligne */
  .player-row-actions [type=submit] { opacity: .45; }
  .player-row:focus-within .player-row-actions [type=submit] { opacity: 1; border-color: var(--orange-deep); background: var(--surface-2); }
}

/* ---------- Ma chaîne / profil ---------- */
.chaine-social-fieldset.form-more-body { border: 0; margin: 0; min-width: 0; }
.card-session .btn { gap: 8px; }
.card-session .ui-ic { width: 20px; height: 20px; }
@media (max-width: 767px) {
  .share-row { flex-wrap: wrap; }
  .share-row input { flex: 1 1 100%; min-height: 48px; }
  .share-row .btn { flex: 1 1 0; }
  .profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .profile-actions .btn { flex: 1 1 auto; }
  #profile-save-btn { width: 100%; }
  #chaine-save-btn {
    width: 100%;
    position: sticky; bottom: calc(var(--bottom-ui) + 10px + var(--safe-b)); z-index: 5;
    box-shadow: 0 0 0 10px var(--surface);
  }
  .check-label { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 15px; }
  .check-label input { width: 22px; height: 22px; accent-color: var(--orange); flex: none; }
}
@media (max-width: 767px) {
  .wrap.wrap-players, .page-players .topbar .wrap { max-width: 100%; }
}
@container (max-width: 429.98px) {
  .player-row {
    grid-template-columns: 44px 36px minmax(0, 1fr) 44px 44px;
    grid-template-areas:
      "avatar name name fav del"
      "rank   rank club club save";
  }
}

/* ---------- Ajustements d'itération ---------- */
.card h2, .section-title, .hero h1 { text-wrap: balance; }

/* Feuille modale : le contenu défile, les actions restent visibles */
.sheet-card { display: flex; flex-direction: column; overflow: hidden; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.sheet-error { margin: 10px 0 0; }
.sheet-actions { flex: none; margin-top: 12px; }
.sheet-options { gap: 4px; margin-bottom: 12px; }
.sheet-option { min-height: 44px; padding: 4px 12px; font-size: 14.5px; }
.sheet-body .field { margin-bottom: 4px; }

/* Volet du dock ouvert : les messages d'aide passent en haut d'écran */
body.fan-panel-open .toast { bottom: auto; top: calc(14px + env(safe-area-inset-top, 0px)); }

/* Console mobile : scoreboard resserré (noms, score, sets) pour laisser
   la place au fil entre le score et le dock */
@media (max-width: 767px) {
  .wrap-live .sb-player-photo { display: none; }
  .wrap-live .score-row {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: none; align-items: center; gap: 8px;
  }
  .wrap-live .score-row > .player:first-of-type,
  .wrap-live .score-row > .player:last-of-type,
  .wrap-live .score-row > .bigscore { grid-area: auto; }
  .wrap-live .bigscore { font-size: 52px; gap: 6px; margin-top: 0; }
  .wrap-live .bigscore .sep { font-size: 34px; }
  .wrap-live .player .name { font-size: 16px; }
  .wrap-live .scoreboard { padding: 10px 10px 10px; }
  .wrap-live .scoreboard .event-name { margin-bottom: 6px; font-size: 12px; }
  .wrap-live .sets-history { margin-top: 6px; }
}

/* Texte de 12 px minimum dans les listes de parties et les étiquettes */
.part-kind, .part-live, .part-tag, .part-detail { font-size: 12px; }
.part-score { font-size: 20px; }
@media (max-width: 520px) {
  .match-item-row .names > span { text-wrap: pretty; }
  .part { padding: 10px 12px; min-height: 52px; }
}

/* Itération 3 : dernières cibles tactiles sous 44 px (écrans tactiles) */
@media (max-width: 767px) {
  .topbar .logo { min-height: 44px; display: inline-flex; align-items: center; }
  .topbar--user .topbar-back, .topbar .topbar-link { min-height: 44px; }
  .match-layout footer.site a, footer.site > a { display: inline-block; padding-block: 12px; }
  .sound-toggle { width: 44px; height: 44px; }
  .ev-act { min-width: 44px; min-height: 44px; }
  .react-more { min-height: 44px; }
  .player-row input { min-height: 44px; }
  .contribution-footer-btn { min-height: 44px; }
  .apps-carousel__link, .apps-carousel__initiative-link { min-height: 44px; display: inline-flex; align-items: center; }
  .contact-direct a { min-height: 44px; }
  .contact-form-panel .form__consent input { width: 24px; height: 24px; margin-top: 0; }
  .contact-form-panel .form__consent a { padding-block: 6px; }
}

/* ---------- Console en paysage : mode scoring ----------
   Téléphone tourné pendant une partie : l'écran ne garde que le score,
   un +1 de chaque côté (comme la table vue par le commentateur) et
   « Commenter ». Les réglages de la rencontre restent en portrait. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body.has-score-dock {
    --ls-side: clamp(128px, 22vw, 220px);
    --ls-gap: 10px;
    overflow: hidden;
    overscroll-behavior: none;
  }
  body.has-score-dock .topbar,
  body.has-score-dock .live-right,
  body.has-score-dock .back-to-top { display: none !important; }
  body.has-score-dock .wrap-live { padding: 0; margin: 0; max-width: none; }

  body.has-score-dock .live-left {
    position: fixed; inset: 0; z-index: 30;
    display: grid;
    grid-template-columns: var(--ls-side) minmax(0, 1fr) var(--ls-side);
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "p1 board p2"
      "p1 setup p2"
      "u1 act   u2";
    column-gap: var(--ls-gap);
    padding:
      max(10px, env(safe-area-inset-top, 0px))
      max(10px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(10px, env(safe-area-inset-left, 0px));
    background: var(--bg);
    touch-action: manipulation;
    overscroll-behavior: none;
  }
  body.has-score-dock .live-left > :not(.scoreboard, .court-pick, .serve-pick, #card-score) { display: none !important; }

  /* Score au centre : il prend toute la hauteur libre */
  body.has-score-dock .live-left > .scoreboard {
    grid-area: board; position: relative; top: auto; margin: 0;
    min-height: 0; overflow: hidden; container: ls-board / size;
    display: flex; flex-direction: column;
    justify-content: center; justify-content: safe center;
    padding: 10px 14px;
  }
  body.has-score-dock .wrap-live .scoreboard .event-name {
    margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  @container ls-board (max-height: 130px) {
    .event-name { display: none !important; }
  }
  body.has-score-dock .wrap-live .score-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "l r" "big big";
    align-items: end; gap: 0 28px;
  }
  /* Service au-dessus du chiffre du serveur, pas au bord du cadre */
  body.has-score-dock .wrap-live .score-row > .player:first-of-type { grid-area: l; text-align: right; }
  body.has-score-dock .wrap-live .score-row > .player:last-of-type { grid-area: r; text-align: left; }
  body.has-score-dock .wrap-live .score-row > .bigscore { grid-area: big; justify-self: center; }
  /* Les noms sont portés par les +1 ; le scoreboard garde le service */
  body.has-score-dock .wrap-live .player { min-height: 18px; }
  body.has-score-dock .wrap-live .player .name,
  body.has-score-dock .wrap-live .player .club,
  body.has-score-dock .wrap-live .sb-player-photo { display: none; }
  body.has-score-dock .wrap-live .serve-indic { margin-top: 0; font-size: 13px; }
  body.has-score-dock .wrap-live .bigscore {
    font-size: clamp(56px, 12vw, 128px);
    font-size: clamp(40px, min(44cqh, 32cqw), 150px);
    gap: .12em; margin: 0; line-height: .95;
  }
  body.has-score-dock .wrap-live .bigscore .sep { font-size: .7em; }
  body.has-score-dock .wrap-live .sets-history { margin-top: 6px; }
  body.has-score-dock .wrap-live .final-banner { margin-top: 8px; padding: 6px 10px; font-size: 16px; }

  /* Dock de score : ses boutons deviennent les cases de la grille.
     position: fixed reste lue par app.js (pas de défilement après un commentaire). */
  body.has-score-dock #card-score.score-dock,
  body.has-score-dock.comment-open #card-score.score-dock { display: contents; position: fixed; }
  body.has-score-dock #card-score:not(.score-paused) .ctrl-points,
  body.has-score-dock #card-score .dock-row { display: contents; }
  body.has-score-dock #btn-p1 { grid-area: p1; }
  body.has-score-dock #btn-p2 { grid-area: p2; }
  body.has-score-dock #btn-undo1 { grid-area: u1; }
  body.has-score-dock #btn-undo2 { grid-area: u2; }
  body.has-score-dock #comment-open { grid-area: act; }

  body.has-score-dock .live-left .btn.btn-point {
    align-self: stretch; height: auto; min-height: 0; margin: 0;
    justify-content: center; gap: 10px; padding: 12px 10px; border-radius: 16px;
    -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  /* Pas de survol « collé » sur le dernier +1 tapé */
  body.has-score-dock .live-left .btn.btn-point:hover:not(:active) {
    background: var(--surface-2); border-color: var(--orange-deep);
  }
  body.has-score-dock .live-left .btn-point-plus { font-size: clamp(40px, 15vh, 64px); }
  body.has-score-dock .live-left .btn.btn-point small {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3;
    white-space: normal; overflow: hidden; overflow-wrap: anywhere; text-wrap: balance;
    font-size: 16px; line-height: 1.15; letter-spacing: .6px;
  }
  body.has-score-dock .live-left .dock-undo,
  body.has-score-dock .live-left .dock-comment {
    min-height: 48px; margin-top: var(--ls-gap);
    -webkit-user-select: none; user-select: none;
  }
  body.has-score-dock .live-left .dock-undo { width: 100%; }
  body.has-score-dock .live-left .dock-comment { justify-self: center; min-width: min(100%, 220px); padding-inline: 24px; }

  /* Réglage en attente (côtés, premier serveur) : sous le score, un seul à la fois */
  body.has-score-dock .live-left > .court-pick,
  body.has-score-dock .live-left > .serve-pick { grid-area: setup; margin: var(--ls-gap) 0 0; }
  body.has-score-dock .live-left > .court-pick:not(.court-pick-open),
  body.has-score-dock .live-left > .serve-pick:not(.serve-pick-open),
  body.has-score-dock .live-left:has(> .court-pick-open) > .serve-pick { display: none !important; }
  body.has-score-dock .court-pick-open,
  body.has-score-dock .serve-pick-open { padding: 10px 12px; }
  body.has-score-dock .court-pick-title { font-size: 16px; margin-bottom: 8px; }
  body.has-score-dock .court-pick-hint,
  body.has-score-dock .court-side-btn small { display: none; }
  body.has-score-dock .court-side-btn {
    min-height: 44px; padding: 6px 10px; font-size: 16px;
    overflow-wrap: anywhere; text-wrap: balance;
  }

  /* Live en pause : plus de +1, le score s'élargit et le message prend leur place */
  body.has-score-dock .live-left:has(#card-score.score-paused) {
    grid-template-areas:
      "board board board"
      "setup setup setup"
      "u1    act   u2";
  }
  body.has-score-dock .live-left:has(#card-score.score-paused) > .court-pick { display: none !important; }
  body.has-score-dock #card-score.score-paused .dock-paused { grid-area: setup; margin: var(--ls-gap) 0 0; }

  body.has-score-dock .toast { top: max(12px, env(safe-area-inset-top, 0px)); bottom: auto; }

  /* Modale de commentaire : le champ passe sous le titre pour rester
     au-dessus du clavier, la carte s'élargit et colle au haut de l'écran */
  .comment-modal {
    align-items: flex-start;
    padding:
      max(8px, env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      8px
      max(12px, env(safe-area-inset-left, 0px));
  }
  .comment-modal-card {
    display: flex; flex-direction: column;
    max-width: 640px; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px);
    padding: 12px 16px 14px; border-radius: 14px;
  }
  .comment-modal-card > * { flex-shrink: 0; }
  .comment-modal-title { order: -2; font-size: 20px; margin-bottom: 8px; }
  .comment-modal-form { order: -1; margin: 0 0 10px; }
  .comment-modal-hint, .comment-modal-cancel { display: none; }
}
