/* ─────────────────────────────────────────────────────────────────────────────
   Le téléphone est posé au sol : tout se lit à distance de bras, en biais.
   Chrono dominant, contraste fort, aucune cible tactile sous 48 px.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --fond: #0b1220;
  --fond-2: #161f33;
  --trait: #2a3550;
  --texte: #f2f6ff;
  --atone: #8ea0c0;
  --accent: #35e0a1;
  --effort: #35e0a1;
  --recup: #7aa2ff;
  --prepa: #ffc857;
  --alerte: #ff8f6b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Toute règle auteur `display:` bat le `[hidden]` de la feuille du navigateur.
   Sans ça, un `display: flex` rend un élément masqué visible en permanence. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--fond);
  color: var(--texte);
  font: 400 16px/1.35 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* tue le zoom au double-tap : le tap est notre geste de pause */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ── Écrans ───────────────────────────────────────────────────────────────── */

.ecran {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}

.ecran.actif {
  display: flex;
}

.ecran.defilable {
  overflow-y: auto;
  justify-content: flex-start;
}

.pile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.pile.bas {
  margin-top: auto;
  width: 100%;
}

h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.sous-titre,
.note {
  color: var(--atone);
  font-size: 0.95rem;
}

#ecran-accueil .pile:first-child,
#ecran-fin .pile:first-child {
  margin-top: auto;
}

.coche {
  font-size: 5rem;
  line-height: 1;
  color: var(--accent);
}

/* ── Boutons ──────────────────────────────────────────────────────────────── */

.bouton {
  min-height: 56px;
  min-width: 56px;
  padding: 14px 20px;
  border: 1px solid var(--trait);
  border-radius: 14px;
  background: var(--fond-2);
  color: var(--texte);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.bouton:active {
  transform: scale(0.98);
}

.bouton.primaire {
  width: 100%;
  border: none;
  background: var(--accent);
  color: #06231a;
  font-size: 1.15rem;
}

.bouton.discret {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--atone);
  font-weight: 500;
}

.bouton.geant {
  /* on ne vise pas un bouton avec un téléphone posé par terre */
  min-height: 26vh;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bouton.secondaire {
  flex: 1;
  font-size: 0.95rem;
}

/* ── Transition ───────────────────────────────────────────────────────────── */

#ecran-transition .pile {
  margin-top: auto;
  margin-bottom: auto;
}

.trans-position {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.trans-icone {
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
}

.trans-position strong {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.trans-detail {
  font-size: 1.2rem;
  color: var(--atone);
}

.filet {
  width: 64px;
  border: none;
  border-top: 2px solid var(--trait);
  margin: 8px 0;
}

.trans-rang {
  color: var(--atone);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
}

.trans-nom {
  font-size: 1.7rem;
  font-weight: 700;
}

.trans-consigne {
  font-size: 1.1rem;
  color: var(--texte);
  max-width: 22ch;
}

.trans-objectif {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.trans-note {
  font-size: 0.95rem;
  color: var(--prepa);
}

/* ── Séance ───────────────────────────────────────────────────────────────── */

.barre {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: var(--atone);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.barre #s-exo {
  color: var(--texte);
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#zone-tap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  /* c'est le bouton pause : toute la surface */
  cursor: pointer;
  user-select: none;
}

.phase {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--atone);
}

#zone-tap[data-phase='effort'] .phase {
  color: var(--effort);
}

#zone-tap[data-phase='recup'] .phase {
  color: var(--recup);
}

#zone-tap[data-phase='prepa'] .phase {
  color: var(--prepa);
}

.chrono {
  /* l'élément dominant de l'écran, lisible du sol */
  font-size: clamp(7rem, 46vw, 16rem);
  font-weight: 800;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

#zone-tap[data-phase='effort'] .chrono {
  color: var(--effort);
}

#zone-tap[data-phase='recup'] .chrono {
  color: var(--recup);
}

#zone-tap[data-phase='prepa'] .chrono {
  color: var(--prepa);
}

.consigne {
  color: var(--atone);
  font-size: 1rem;
  text-align: center;
  max-width: 24ch;
}

.points {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  max-width: 90%;
}

.point {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--trait);
}

.point.faite {
  background: var(--accent);
}

.point.courante {
  background: var(--texte);
  transform: scale(1.35);
}

.reps {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.voile {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(11, 18, 32, 0.92);
}

.voile-titre {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.voile-aide {
  color: var(--atone);
}

.barre-bas {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.tempo {
  display: flex;
  gap: 4px;
}

.tempo-btn {
  padding: 14px 10px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.tempo-btn.actif {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Réglages ─────────────────────────────────────────────────────────────── */

#ecran-reglages {
  gap: 16px;
}

.reglage {
  border-top: 1px solid var(--trait);
  padding: 14px 0 4px;
}

.reglage h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.reglage .lignes {
  display: flex;
  gap: 12px;
}

.champ {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.champ span {
  color: var(--atone);
  font-size: 0.85rem;
}

.champ input {
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--trait);
  border-radius: 12px;
  background: var(--fond-2);
  color: var(--texte);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.champ input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.champ input.invalide {
  border-color: var(--alerte);
}

.version {
  color: var(--atone);
  font-size: 0.8rem;
  text-align: center;
}

/* Avertissement non bloquant, au-dessus de l'écran courant quel qu'il soit. */
.avert {
  position: fixed;
  z-index: 10;
  top: calc(8px + env(safe-area-inset-top));
  left: 8px;
  right: 8px;
  border: 1px solid var(--alerte);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--fond-2);
  color: var(--alerte);
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
}

code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.9em;
  color: var(--texte);
}

/* Paysage : on récupère de la place en réduisant le chrono. */
@media (orientation: landscape) {
  .chrono {
    font-size: clamp(4rem, 22vh, 9rem);
  }

  .bouton.geant {
    min-height: 20vh;
  }
}
