/*
  La page d'une séance officielle — /entrainements/seance/<id>.

  Aucune couleur en dur : tout vient de tokens.css. Seul le dessin du court y
  échappe, et il est produit par court-preview.js, pas par cette feuille.
*/

.seance-shell { width: min(1000px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 80px; }
.seance-etat { color: var(--ink-soft); font-size: 13px; padding: 60px 0; text-align: center; }

/* -- L'en-tête -------------------------------------------------------------- */

.seance-tete { padding: 30px 32px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.seance-tete h1 { margin: 8px 0 10px; font-size: clamp(26px, 4vw, 40px); line-height: 1.1; letter-spacing: -1.2px; }
.seance-tete > p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.seance-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.seance-meta span { padding: 6px 11px; border-radius: 100px; background: var(--bg); color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.seance-meta span:empty { display: none; }

.seance-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 20px; }
.seance-niveaux { display: inline-flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--bg); }
.seance-niveaux button {
  padding: 8px 13px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-soft); font-size: 12px; font-weight: 700; cursor: pointer;
}
.seance-niveaux button:hover { color: var(--ink); }
.seance-niveaux button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(38, 48, 31, .12); }

.seance-copier {
  padding: 11px 16px; border: 1.5px solid var(--ink); border-radius: 100px;
  background: var(--mustard); color: var(--ink);
  font-size: 12px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow-pop);
}
.seance-copier:disabled { opacity: .6; cursor: default; }
.seance-mot { margin: 10px 0 0; color: var(--sage); font-size: 12px; font-weight: 700; }
.seance-mot:empty { display: none; }
.seance-mot a { color: var(--sage); }

/* -- Les phases ------------------------------------------------------------- */

.seance-phases { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.phase { padding: 22px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }

.phase-tete { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; }
.phase-numero {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px;
  background: var(--sage-soft); color: var(--sage); font-size: 13px; font-weight: 800;
}
.phase-genre { color: var(--ink-soft); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.phase-tete h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.4px; }
.phase-duree { padding: 6px 11px; border-radius: 100px; background: var(--mustard-soft); color: var(--ink); font-size: 12px; font-weight: 800; }

/* Le schéma à droite du texte, et dessous quand la place manque. */
.phase-corps { display: grid; grid-template-columns: 1fr 190px; gap: 20px; margin-top: 16px; align-items: start; }
.phase-texte p { margin: 0; font-size: 13px; line-height: 1.6; }
.phase-legende { margin-top: 8px !important; color: var(--ink-soft); font-size: 12px; font-style: italic; }

.phase-schema { margin: 0; display: grid; gap: 7px; }
.phase-schema svg { width: 190px; height: 292px; border: 3px solid var(--line); border-radius: 10px; background: var(--bg); }
.phase-schema3d { width: 190px; height: 292px; border: 3px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.phase-schema3d canvas { display: block; }
.phase-schema figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.phase-schema button {
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 100px;
  background: var(--card); color: var(--sage); font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.phase-schema button:hover { border-color: var(--sage); background: var(--sage-soft); }

@media (max-width: 780px) {
  .phase-corps { grid-template-columns: 1fr; }
  .phase-schema { justify-items: center; }
  .seance-actions { flex-direction: column; align-items: stretch; }
  .seance-copier { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  /* La lecture reste possible : c'est un geste demandé, pas une animation
     décorative. Seules les transitions d'interface sont coupées, par style.css. */
  .phase-schema button::after { content: ''; }
}

/* -- Le lecteur de séance ---------------------------------------------------- */
/* Écrit pour un téléphone posé contre le mur, à deux mètres : le chronomètre
   est énorme, les commandes sont larges et en bas, à portée de pouce. */
.lecteur {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--ink);
  display: grid; grid-template-rows: auto auto 1fr auto;
}
.lecteur::backdrop { background: var(--bg); }
.lecteur.en-pause .lecteur-temps { opacity: .4; }

.lecteur-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 10px; }
.lecteur-genre { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.lecteur-tete strong { font-size: 18px; line-height: 1.25; }
.lecteur-tete button { width: 40px; height: 40px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--ink); font-size: 15px; cursor: pointer; }

/* Une case par phase : on voit d'un coup où on en est. */
.lecteur-jauge { display: flex; gap: 4px; padding: 0 20px 12px; }
.lecteur-jauge span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.lecteur-jauge span.faite { background: var(--sage); }
.lecteur-jauge span.courante { background: var(--mustard); }

.lecteur-corps { overflow: auto; padding: 0 20px; display: grid; gap: 14px; align-content: start; justify-items: center; }
.lecteur-chrono { text-align: center; }
.lecteur-temps { display: block; font-size: clamp(64px, 22vw, 130px); font-weight: 800; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
/* Le dépassement se voit sans faire sursauter : une couleur, pas une alarme. */
.lecteur-temps.depasse { color: var(--terracotta); }
.lecteur-chrono small { color: var(--ink-soft); font-size: 12px; }

.lecteur-schema { margin: 0; cursor: pointer; }
.lecteur-schema svg { width: min(210px, 55vw); height: auto; aspect-ratio: 130 / 200; border: 3px solid var(--line); border-radius: 10px; background: var(--card); }
.lecteur-schema3d { width: min(210px, 55vw); aspect-ratio: 130 / 200; border: 3px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.lecteur-schema3d canvas { display: block; width: 100%; height: 100%; }
.lecteur-consignes { margin: 0 0 20px; max-width: 60ch; font-size: 14px; line-height: 1.65; text-align: center; }

.lecteur-commandes { display: grid; grid-template-columns: 72px 1fr 1.4fr; gap: 8px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card); }
.lecteur-commandes button { min-height: 58px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--ink); font-size: 15px; font-weight: 800; cursor: pointer; }
.lecteur-commandes button:disabled { opacity: .35; }
.lecteur-pause { background: var(--card) !important; }
.lecteur-suivant { border-color: var(--ink) !important; background: var(--sage) !important; color: #fff !important; }

.lecteur-bilan { grid-row: 2 / -1; overflow: auto; padding: 20px; display: grid; gap: 16px; align-content: start; max-width: 560px; width: 100%; margin: 0 auto; }
.lecteur-bilan h2 { margin: 0; font-size: 24px; }
.lecteur-bilan p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.lecteur-bilan label { display: grid; gap: 7px; font-size: 12px; font-weight: 800; }
.lecteur-bilan label span { color: var(--ink-soft); font-weight: 500; }
.lecteur-bilan input[type=range] { width: 100%; accent-color: var(--sage); }
.lecteur-bilan output { color: var(--sage); font-size: 13px; font-weight: 800; }
.lecteur-bilan textarea { padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-size: 13px; }
.lecteur-bilan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lecteur-bilan-actions button { min-height: 50px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.lecteur-enregistrer { border-color: var(--ink) !important; background: var(--mustard) !important; }
.lecteur-mot { min-height: 16px; color: var(--sage); font-size: 12px !important; }

/* Le bouton qui lance tout, sur la page de séance. */
.seance-commencer { padding: 13px 20px; border: 1.5px solid var(--ink); border-radius: 100px; background: var(--sage); color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow-pop); }
.seance-historique { margin: 12px 0 0 !important; color: var(--ink-soft); font-size: 12px !important; }
.seance-historique:empty { display: none; }

@media (min-width: 780px) {
  /* `margin: auto` : c'est ce qui centre une <dialog> modale. Le `margin: 0`
     de la règle de base (plein écran sur téléphone) la collait à gauche. */
  .lecteur { width: min(720px, 100vw); height: min(860px, 100dvh); margin: auto; border-radius: 22px; border: 1px solid var(--line); }
  .lecteur::backdrop { background: rgba(10, 12, 8, .7); }
}

/* Grand écran — une télé au club, une tablette à l'horizontale : on présente
   à un groupe, pas à soi. Le court à gauche, en grand ; le chrono et les
   consignes à droite, lisibles depuis le fond de la salle. */
@media (min-width: 1100px) {
  .lecteur { width: min(1180px, 96vw); height: min(900px, 96dvh); }
  .lecteur-corps {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas: "schema chrono" "schema consignes";
    align-content: center; align-items: center; column-gap: 36px;
  }
  .lecteur-corps:has(.lecteur-schema[hidden]) { grid-template-columns: 1fr; grid-template-areas: "chrono" "consignes"; }
  .lecteur-chrono { grid-area: chrono; }
  .lecteur-schema { grid-area: schema; justify-self: center; }
  .lecteur-consignes { grid-area: consignes; align-self: start; font-size: 17px; text-align: left; }
  .lecteur-schema svg, .lecteur-schema3d { width: min(400px, 36vw); }
  .court-volume .lecteur-corps .lecteur-schema svg, .court-volume .lecteur-corps .lecteur-schema3d { width: min(560px, 46vw); }
}
.seance-boutons { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 780px) { .seance-boutons { width: 100%; } .seance-boutons button { flex: 1 1 100%; } }

/* Le court en volume est presque carré ; à plat il est en hauteur. Voir la
   note dans workshop.css : la classe vient de court-vue.js, et la préférence
   vaut pour tout le site. */
.court-volume .phase-schema svg, .court-volume .phase-schema3d { width: 276px; height: 233px; }
.court-volume .lecteur-schema svg, .court-volume .lecteur-schema3d { width: min(320px, 88vw); aspect-ratio: 1.183; }

/* Le schéma se tourne au glissé : le curseur doit le dire, sinon personne
   n'essaie. */
.court-volume .phase-schema svg, .court-volume .lecteur-schema svg { cursor: grab; touch-action: none; }
.phase-schema svg.court-tourne, .lecteur-schema svg.court-tourne { cursor: grabbing; }

/* Les séances d'un entraîneur (voir /groupes) : consignes en lignes, et le
   lien « Modifier » prend la forme du bouton qu'il remplace. */
.seance-mine .phase-texte p[data-consignes],
.seance-mine .lecteur-consignes { white-space: pre-line; }
.seance-mine .lecteur-consignes { text-align: left; }
a.seance-copier { display: inline-flex; align-items: center; text-decoration: none; }
