/* GUIDAGE COACH — étape 13a (25/09/2026). Noir et or (variables --tr-* de l'app, replis inclus).
   Orange uniquement pour les 10 dernières secondes d'un effort. Rien de décoratif. */
:root {
  --cg-fond: #0B0B0C;
  --cg-or: var(--tr-or, var(--th-a2, #D4A04A));
  --cg-or-vif: var(--tr-or-vif, var(--th-a1, #F2C46B));
  --cg-or-bas: var(--tr-or-bas, var(--th-a3, #A8702A));
  --cg-sur-or: var(--tr-sur-or, #1A1206);
  --cg-texte: #F4F1EA;
  --cg-doux: #B9B3A7;          /* 9:1 sur le fond */
  --cg-ligne: rgba(255, 255, 255, .10);
  --cg-alerte: #FF9A4D;        /* seul écart à l'or : les 10 dernières secondes */
  --cg-courbe: cubic-bezier(.2, .7, .2, 1);
}
html.cg-ouvert, html.cg-ouvert body { overflow: hidden; }
.cg {
  position: fixed; inset: 0; z-index: 10000;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  background: radial-gradient(120% 60% at 50% 0%, #1A1712 0%, var(--cg-fond) 62%);
  color: var(--cg-texte);
  font-family: var(--tr-police, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  animation: cg-arrive 220ms var(--cg-courbe) both;
}
.cg[data-etat="pret"] { grid-template-rows: auto minmax(0, 1fr) auto auto; }
@keyframes cg-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.cg [hidden] { display: none !important; }

.cg-tete { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 8px; padding: 8px 12px 0; }
.cg-rond {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--cg-ligne); cursor: pointer; padding: 0;
  background: rgba(255,255,255,.05); color: var(--cg-texte); display: grid; place-items: center;
  transition: transform 80ms ease-out, background-color 80ms ease-out; touch-action: manipulation;
}
.cg-rond:active { transform: scale(.93); background: rgba(255,255,255,.12); }
.cg-voix[aria-pressed="true"] { color: var(--cg-or-vif); border-color: rgba(var(--th-a2-rgb, 212, 160, 74),.5); }
.cg-voix[aria-pressed="false"] { color: var(--cg-doux); }
.cg-parle .cg-voix[aria-pressed="true"] { background: rgba(var(--th-a2-rgb, 212, 160, 74),.2); }
.cg-titre { min-width: 0; text-align: center; line-height: 1.2; }
.cg-titre b { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-voix-etat { display: block; font-size: 12px; color: var(--cg-doux); margin-top: 2px; }

/* Avant de commencer */
.cg-pret { overflow-y: auto; padding: 12px 20px 8px; display: grid; align-content: start; gap: 14px; }
.cg-pret-format { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cg-texte); }
.cg-groupe-nom { display: block; color: var(--cg-doux); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.cg-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.cg-puce {
  min-height: 44px; min-width: 50px; padding: 0 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.04); color: var(--cg-texte);
  font: 600 15px/1 var(--tr-police, system-ui, sans-serif); font-variant-numeric: tabular-nums;
  transition: background-color 80ms ease-out, border-color 80ms ease-out, transform 80ms ease-out; touch-action: manipulation;
}
.cg-puce:active { transform: scale(.96); }
.cg-puce[aria-checked="true"] { background: rgba(var(--th-a2-rgb, 212, 160, 74),.2); border-color: var(--cg-or); color: var(--cg-or-vif); }
.cg-puce-voix { min-width: 96px; }
.cg-note { margin: 0; color: var(--cg-doux); font-size: 13px; line-height: 1.4; }

/* Minuteur */
.cg-minuteur { display: grid; justify-items: center; padding: 4px 16px 0; }
.cg-cadran { position: relative; width: min(64vw, 32vh, 280px); aspect-ratio: 1; }
.cg-anneau { width: 100%; height: 100%; transform: rotate(-90deg); }
.cg-creux { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 10; }
.cg-plein { fill: none; stroke: var(--cg-or); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 200ms linear, stroke 200ms ease-out; }
.cg[data-phase="repos"] .cg-plein { stroke: var(--cg-or-bas); }
.cg[data-phase="preparation"] .cg-plein { stroke: var(--cg-or-vif); }
.cg.cg-alerte .cg-plein { stroke: var(--cg-alerte); }
.cg-dedans { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.cg-chiffre { font-size: clamp(60px, 19vw, 100px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cg.cg-alerte .cg-chiffre { color: var(--cg-alerte); }
.cg-phase { margin-top: 6px; font-size: 14px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--cg-or-vif); }
.cg[data-phase="repos"] .cg-phase { color: var(--cg-doux); }
.cg-serie { margin: 8px 0 0; font-size: 15px; color: var(--cg-doux); font-variant-numeric: tabular-nums; }

/* Ce que dit le coach */
.cg-coach { padding: 10px 20px 4px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cg-etiquette { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--cg-or); min-height: 1.2em; }
.cg-consigne {
  margin: 0; font-size: clamp(19px, 5.4vw, 24px); font-weight: 650; line-height: 1.28;
  min-height: calc(1.28em * 2);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.cg-consigne.cg-ecrit { color: var(--cg-doux); }
.cg-annonce { margin: 10px 0 0; font-size: clamp(17px, 4.6vw, 20px); font-weight: 700; color: var(--cg-or-vif); min-height: 1.3em; line-height: 1.3; }
.cg-entre { animation: cg-entre 180ms var(--cg-courbe) both; }
@keyframes cg-entre { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Commandes au pouce */
.cg-bas { display: grid; grid-template-columns: 1fr 1.7fr; gap: 10px; padding: 8px 16px 4px; }
.cg[data-etat="pret"] .cg-bas { grid-template-columns: 1fr; }
.cg-principal, .cg-second {
  min-height: 64px; border-radius: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 18px/1 var(--tr-police, system-ui, -apple-system, sans-serif); padding: 0 12px;
  transition: transform 80ms ease-out, background-color 80ms ease-out; touch-action: manipulation;
}
.cg-principal { border: 0; background: var(--cg-or); color: var(--cg-sur-or); }
.cg-principal:active { transform: scale(.97); background: var(--cg-or-vif); }
.cg-principal:disabled { opacity: .75; cursor: progress; }
.cg-second { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.05); color: var(--cg-texte); }
.cg-second:active { transform: scale(.97); background: rgba(255,255,255,.12); }
.cg-principal:focus-visible, .cg-second:focus-visible, .cg-rond:focus-visible, .cg-puce:focus-visible { outline: 3px solid var(--cg-or-vif); outline-offset: 3px; }
.cg.cg-en-pause .cg-chiffre { opacity: .55; }
.cg.cg-en-pause .cg-phase::after { content: " · en pause"; }
.cg-mention { margin: 0; padding: 2px 16px calc(8px + env(safe-area-inset-bottom)); text-align: center; font-size: 11px; color: var(--cg-doux); letter-spacing: .02em; }

/* Fin */
.cg-fin {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px; text-align: center;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); background: var(--cg-fond);
  animation: cg-arrive 220ms var(--cg-courbe) both;
}
.cg-fin-titre { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.2; max-width: 20ch; }
.cg-fin-constat { margin: 0 0 18px; color: var(--cg-doux); font-size: 17px; }
.cg-fin-actions { display: grid; gap: 10px; width: min(100%, 360px); }

@media (prefers-reduced-motion: reduce) {
  .cg, .cg-fin, .cg-entre { animation: none !important; }
  .cg-plein { transition: none; }
  .cg-puce, .cg-rond, .cg-principal, .cg-second { transition: none; }
  .cg-puce:active, .cg-rond:active, .cg-principal:active, .cg-second:active { transform: none; }
}
@media (max-height: 640px) {
  .cg-cadran { width: min(56vw, 30vh, 210px); }
  .cg-principal, .cg-second { min-height: 56px; }
  .cg-consigne { font-size: 18px; }
}
@media (min-width: 760px) {
  .cg { justify-content: center; grid-template-columns: min(560px, 100%); }
}
