/* Kuzushi. Couleurs reprises du thème de l'appli Android (ui/Theme.kt), clair et sombre selon le téléphone. */
@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(/polices/poppins_regular.ttf); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/polices/poppins_medium.ttf); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url(/polices/poppins_semibold.ttf); }

:root {
  --primaire: #2F5FD0; --sur-primaire: #fff; --cont-primaire: #DCE6FF; --sur-cont-primaire: #0A1E4D;
  --secondaire: #0B7A4B; --cont-secondaire: #C5F2DA; --sur-cont-secondaire: #00301B;
  --tertiaire: #8A5A00; --cont-tertiaire: #FFE1B0; --sur-cont-tertiaire: #2C1A00;
  --erreur: #BA1A1A;
  --fond: #F3F5F9; --texte: #151922; --texte-2: #5A6272;
  --surface-1: #fff; --surface-2: #fff; --surface-3: #E1E5EE; --bord: #DADFE8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primaire: #5B93FF; --sur-primaire: #06122B; --cont-primaire: #1E3566; --sur-cont-primaire: #D6E4FF;
    --secondaire: #5FE3A1; --cont-secondaire: #12402B; --sur-cont-secondaire: #B9F6D6;
    --tertiaire: #FFB547; --cont-tertiaire: #3F2D0C; --sur-cont-tertiaire: #FFDDAE;
    --erreur: #FFB4AB;
    --fond: #161A24; --texte: #F2F4F8; --texte-2: #9AA3B5;
    --surface-1: #1D222E; --surface-2: #232938; --surface-3: #2D3445; --bord: #2B3242;
  }
}

* { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent; /* pas de flash gris au toucher : chaque bouton a son :active */
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none; /* pas de « tirer pour rafraîchir » en pleine séance */
}
body {
  margin: 0; min-height: 100dvh; background: var(--fond); color: var(--texte);
  font: 400 16px/1.45 Poppins, system-ui, sans-serif;
}
main { max-width: 560px; margin: 0 auto; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; }
html { scroll-padding-bottom: calc(200px + env(safe-area-inset-bottom, 0px)); } /* un champ actif n'est jamais caché sous la barre d'action */
.chargement, .discret { color: var(--texte-2); }
.pile { display: flex; flex-direction: column; gap: 16px; }
.ligne { display: flex; gap: 10px; align-items: center; }
.ligne > .grandit { flex: 1; min-width: 0; }
.etiquette { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--primaire); }
.carte { background: var(--surface-2); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.pastille { border-radius: 12px; padding: 10px 14px; background: var(--cont-tertiaire); color: var(--sur-cont-tertiaire); }
.pastille.bleue { white-space: nowrap; background: var(--cont-primaire); color: var(--sur-cont-primaire); display: inline-block; padding: 4px 12px; font-weight: 500; }

/* Boutons : gros, retour au toucher immédiat, texte non sélectionnable. */
button, .bouton, summary, label.bouton {
  font: inherit; color: inherit; border: 0; background: none; cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform 100ms ease-out, background-color 100ms;
}
button:active, .bouton:active { transform: scale(.97); }
button:disabled { opacity: .45; }
.principal {
  width: 100%; min-height: 64px; border-radius: 32px; background: var(--primaire); color: var(--sur-primaire);
  font-size: 20px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.contour { min-height: 56px; border-radius: 28px; border: 1.5px solid var(--bord); padding: 0 16px; font-weight: 500; }
.tonal { min-height: 60px; border-radius: 30px; background: var(--surface-3); font-weight: 600; font-size: 18px; }
.texte { min-height: 48px; width: 100%; color: var(--texte-2); }
.danger { color: var(--erreur); }
.lien { color: var(--primaire); font-weight: 500; min-height: 48px; padding: 0 8px; }
.icone { min-width: 48px; min-height: 48px; font-size: 24px; border-radius: 24px; }
.rangee { display: flex; gap: 10px; }
.rangee > * { flex: 1; min-width: 0; }
input, select, textarea { font: inherit; font-size: 16px; color: inherit; } /* 16 px : pas de zoom sur le champ */

/* Accueil */
.titre-semaine { display: flex; align-items: baseline; gap: 6px; }
.titre-semaine strong { font-size: 36px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.date-debut { font-size: 14px; white-space: nowrap; }
.barre-semaines { display: flex; gap: 4px; }
.barre-semaines span { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); }
.barre-semaines span.faite { background: var(--primaire); }
.barre-semaines span.courante { background: var(--tertiaire); }
.tuile {
  min-height: 104px; border-radius: 20px; padding: 14px 16px; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
}
.tuile.faite { background: var(--cont-secondaire); color: var(--sur-cont-secondaire); }
.tuile strong { font-size: 18px; font-weight: 600; }
.tuile .petit { font-size: 14px; opacity: .8; }
.date-debut { position: relative; }
.date-debut input { position: absolute; inset: 0; opacity: 0; width: 100%; }
details.phase summary { list-style: none; min-height: 48px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
details.phase summary::after, details.consignes summary::after { content: "▾"; color: var(--texte-2); }
details[open].phase summary::after, details[open].consignes summary::after { content: "▴"; }
details.phase dl { margin: 0; display: grid; gap: 8px; }
details.phase dt { font-weight: 600; color: var(--primaire); font-size: 14px; }
details.phase dd { margin: 0; }

/* Séance */
.barre-haute { display: flex; align-items: center; gap: 4px; margin: 0 -8px 8px; }
.barre-haute .grandit { flex: 1; min-width: 0; }
.barre-haute .nom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chrono { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.avance { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.avance span { display: block; height: 100%; background: var(--primaire); }
.bandeau-plan { width: 100%; min-height: 48px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 15px; }
.seance { padding-bottom: 200px; } /* place pour la barre d'action fixe */
.illustration { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--surface-3); }
.illustration.compacte { aspect-ratio: 2.4; }
.illustration img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.illustration img + img { animation: fondu 3s infinite; }
@keyframes fondu { 0%, 40% { opacity: 0; } 50%, 90% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .illustration img + img { animation: none; opacity: 0; } }
.nom-exo { font-size: 24px; line-height: 1.25; font-weight: 600; text-align: center; }
.centre { text-align: center; }
.cible { font-size: 22px; font-weight: 500; text-align: center; }
.points { display: flex; justify-content: center; gap: 6px; }
.points span { width: 10px; height: 10px; border-radius: 5px; background: var(--surface-3); }
.points span.fait { background: var(--primaire); }
.puces { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior: contain; padding-bottom: 2px; }
.puce { min-height: 44px; border-radius: 12px; border: 1.5px solid var(--bord); padding: 0 14px; white-space: nowrap; }
.puce[aria-pressed="true"] { background: var(--cont-primaire); color: var(--sur-cont-primaire); border-color: transparent; font-weight: 600; }
details.consignes { background: var(--surface-1); border-radius: 16px; padding: 4px 16px 12px; }
details.consignes summary { list-style: none; min-height: 44px; display: flex; justify-content: space-between; align-items: center; color: var(--primaire); font-weight: 600; font-size: 14px; }
details.consignes:not([open]) .apercu { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
details.consignes h3 { font-size: 14px; color: var(--primaire); margin-top: 10px; }
.saisie { background: var(--surface-2); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pas { display: grid; grid-template-columns: 1fr 64px minmax(96px, auto) 64px; align-items: center; gap: 8px; }
.pas .libelle { color: var(--texte-2); font-weight: 500; }
.pas .valeur { font-size: 24px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.pas button.moins, .pas button.plus { height: 64px; border-radius: 32px; background: var(--surface-3); font-size: 28px; font-weight: 500; }
.pas button.valeur { min-height: 64px; text-decoration: underline dotted; text-underline-offset: 6px; }

/* Minuteur : lisible à deux mètres */
.minuteur { display: flex; flex-direction: column; align-items: center; gap: 16px; --c: var(--secondaire); }
.minuteur.maintien { --c: var(--primaire); }
.minuteur.neutre { --c: var(--texte-2); }
.minuteur.cote { --c: var(--tertiaire); }
.minuteur.fin-proche { --c: var(--tertiaire); }
.anneau { position: relative; width: min(300px, 80vw); aspect-ratio: 1; }
.anneau svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.anneau circle { fill: none; stroke-width: 10; }
.anneau .piste { stroke: var(--surface-3); }
.anneau .reste { stroke: var(--c); stroke-linecap: round; }
.anneau .milieu { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.anneau .mot { font-weight: 600; color: var(--c); font-size: 18px; }
.anneau .valeur { font-size: clamp(72px, 26vw, 104px); line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.minuteur.fin-proche .valeur { color: var(--tertiaire); }
.anneau .detail { font-size: 20px; font-weight: 500; }
.minuteur .rangee { width: 100%; }

.barre-action {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--fond);
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -1px 0 var(--bord);
}
.barre-action > div { max-width: 528px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.rpe { display: flex; gap: 6px; }
.rpe button { flex: 1; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--bord); font-weight: 600; }
.rpe button[aria-pressed="true"] { background: var(--cont-primaire); color: var(--sur-cont-primaire); border-color: transparent; }
.petit-titre { font-size: 13px; color: var(--texte-2); font-weight: 500; }

.stats { display: flex; gap: 10px; }
.stats div { flex: 1; background: var(--surface-2); border-radius: 16px; padding: 12px; text-align: center; }
.stats strong { display: block; font-size: 22px; font-weight: 600; }
.ressenti { display: flex; gap: 10px; }
.ressenti button { width: 56px; height: 56px; border-radius: 28px; background: var(--surface-2); font-size: 20px; font-weight: 600; }
.ressenti button[aria-pressed="true"] { background: var(--primaire); color: var(--sur-primaire); }
textarea { width: 100%; min-height: 80px; border-radius: 12px; border: 1.5px solid var(--bord); background: var(--surface-1); padding: 12px; }

/* Plan et dialogues (élément <dialog> natif) */
dialog {
  border: 0; border-radius: 24px; padding: 20px; background: var(--surface-2); color: var(--texte);
  width: min(520px, calc(100vw - 32px)); max-height: 85dvh; overscroll-behavior: contain;
}
dialog::backdrop { background: rgb(0 0 0 / .5); overflow: hidden; overscroll-behavior: contain; } /* la page ne défile pas sous le dialogue */
dialog h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
dialog .rangee { margin-top: 16px; }
dialog input { width: 100%; min-height: 56px; border-radius: 12px; border: 1.5px solid var(--bord); background: var(--surface-1); padding: 0 14px; font-size: 24px; }
.plan-bloc { font-size: 13px; font-weight: 600; color: var(--primaire); margin-top: 12px; text-transform: uppercase; }
.plan-exo { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 8px; text-align: left; border-bottom: 1px solid var(--bord); }
.plan-exo .grandit { flex: 1; }
.plan-exo small { display: block; color: var(--texte-2); }
.plan-exo.fini { color: var(--texte-2); }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 528px; margin: 0 auto;
  background: var(--texte); color: var(--fond); border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: center;
}
.toast button { color: var(--fond); font-weight: 600; min-height: 44px; }

@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) { filter: brightness(1.06); }
}
