/* Timer Be Efficace : base graphique commune (Inter locale, mode clair/sombre, boutons pilule)
   et couleurs haute visibilité par phase (préparation ambre, effort corail-orange, repos cyan). */
@font-face { font-family: Inter; font-style: normal; font-weight: 300 800; font-display: swap; src: url(fonts/inter-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Inter; font-style: normal; font-weight: 300 800; font-display: swap; src: url(fonts/inter-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  --fond: #fff;
  --surface: #fff;
  --encre: #1a1a1a;
  --sur-encre: #fff;
  --gris: #666;
  --filet: #e6e6e6;
  --doux: #f4f4f4;
  --bandeau: rgba(255, 255, 255, .94);
  --ombre: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .05);
  --gouttiere: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --degrade: linear-gradient(100deg, #f97316, #ef4444);
  --accent: #f97316;
  --accent-doux: rgba(249, 115, 22, .12);
  --accent-encre: #c2410c;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #111;
  --surface: #1a1a1b;
  --encre: #f2f2f2;
  --sur-encre: #111;
  --gris: #a3a3a3;
  --filet: #2c2c2e;
  --doux: #232325;
  --bandeau: rgba(17, 17, 17, .9);
  --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  --accent: #fb923c;
  --accent-doux: rgba(251, 146, 60, .16);
  --accent-encre: #fdba74;
}

/* Couleurs dynamiques selon la phase */
.scene[data-phase="prep"] {
  --accent: #f59e0b;
  --accent-doux: rgba(245, 158, 11, .16);
  --accent-encre: #b45309;
}
:root[data-theme="dark"] .scene[data-phase="prep"] {
  --accent: #fbbf24;
  --accent-doux: rgba(251, 191, 36, .18);
  --accent-encre: #fde68a;
}

.scene[data-phase="effort"] {
  --accent: #f97316;
  --accent-doux: rgba(249, 115, 22, .16);
  --accent-encre: #c2410c;
}
:root[data-theme="dark"] .scene[data-phase="effort"] {
  --accent: #fb923c;
  --accent-doux: rgba(251, 146, 60, .2);
  --accent-encre: #fed7aa;
}

.scene[data-phase="repos"] {
  --accent: #0ea5e9;
  --accent-doux: rgba(14, 165, 233, .15);
  --accent-encre: #0369a1;
}
:root[data-theme="dark"] .scene[data-phase="repos"] {
  --accent: #22d3ee;
  --accent-doux: rgba(34, 211, 238, .18);
  --accent-encre: #a5f3fc;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--encre);
  font: 400 16px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background: var(--fond);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--encre); outline-offset: 3px; }

.degrade { background: var(--degrade); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Bandeau */
.bandeau {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px var(--gouttiere);
  background: var(--bandeau);
  border-bottom: 1px solid var(--filet);
}
.bandeau-droite { display: flex; align-items: center; gap: 10px; }
.marque { font-size: 1.05rem; font-weight: 800; letter-spacing: -.04em; text-transform: uppercase; line-height: 1; }
.marque-sep { color: var(--gris); font-weight: 500; }

.bouton-outil,
.bouton-theme {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border-radius: 999px;
  border: 1px solid var(--filet);
  background: var(--surface);
  color: var(--encre);
  transition: border-color .2s, background-color .2s;
}
.bouton-outil:hover,
.bouton-theme:hover { border-color: var(--encre); }
.bouton-theme .icone-soleil, :root[data-theme="dark"] .bouton-theme .icone-lune { display: none; }
:root[data-theme="dark"] .bouton-theme .icone-soleil { display: block; }

.bouton-outil[aria-pressed="true"] .icone-son-off { display: none; }
.bouton-outil[aria-pressed="false"] .icone-son-on { display: none; }
.bouton-outil[aria-pressed="false"] { color: var(--gris); }

/* Scène principale centrée pour tenir sur un écran mobile sans scroller */
.scene {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(14px, 3vh, 28px) var(--gouttiere) calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 2.2vh, 22px);
  background: radial-gradient(520px 360px at 50% 35%, var(--accent-doux), transparent 72%);
  transition: background .35s var(--ease);
}

.infos-haut {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.badge-phase {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: var(--accent-doux);
  color: var(--accent-encre);
  border: 1px solid var(--accent);
}

.meta-droite {
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.tour-pilule {
  font-size: .78rem;
  font-weight: 700;
  color: var(--encre);
  background: var(--doux);
  border: 1px solid var(--filet);
  padding: 5px 11px;
  border-radius: 999px;
}

.temps-total {
  font-size: .88rem;
  font-weight: 600;
  color: var(--gris);
}

/* Cadran circulaire */
.cadran-bloc {
  display: grid;
  place-items: center;
  width: 100%;
}

.cadran-conteneur {
  position: relative;
  width: min(74vw, 310px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.cadran-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.cadran-fond {
  fill: none;
  stroke: var(--filet);
  stroke-width: 14;
}

.cadran-progres {
  fill: none;
  stroke: var(--accent);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke .3s var(--ease);
}

.cadran-centre {
  position: absolute;
  inset: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  pointer-events: none;
}

.compteur {
  font-size: clamp(4.2rem, 18vw, 6.2rem);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: .95;
  font-variant-numeric: tabular-nums;
}

.consigne {
  font-size: clamp(.95rem, 3.4vw, 1.15rem);
  font-weight: 700;
  color: var(--accent-encre);
}

.prochain {
  font-size: .78rem;
  font-weight: 500;
  color: var(--gris);
}

/* Barre de séquence */
.sequence {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--gris);
}

.etape {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--doux);
  border: 1px solid var(--filet);
  font-variant-numeric: tabular-nums;
  transition: background-color .25s, color .25s, border-color .25s;
}

.scene[data-phase="prep"] .etape[data-step="prep"],
.scene[data-phase="effort"] .etape[data-step="effort"],
.scene[data-phase="repos"] .etape[data-step="repos"] {
  background: var(--accent-doux);
  color: var(--accent-encre);
  border-color: var(--accent);
}

.etape-fleche,
.etape-boucle {
  font-weight: 700;
  color: var(--gris);
}

/* Boutons d'action */
.controles {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-principal {
  width: 100%;
  min-height: 58px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #111;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  box-shadow: var(--ombre);
  transition: transform .15s var(--ease), opacity .2s, background-color .25s;
}

.scene[data-phase="idle"] .btn-principal {
  background: var(--encre);
  color: var(--sur-encre);
}

.btn-principal:active { transform: scale(.985); }

.controles-secondaires {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-secondaire {
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid var(--filet);
  background: var(--surface);
  color: var(--encre);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: border-color .2s, opacity .2s;
}

.btn-secondaire:hover:not(:disabled) { border-color: var(--encre); }
.btn-secondaire:disabled { opacity: .4; cursor: not-allowed; }

/* Réglages repliables */
.reglages {
  width: 100%;
  border: 1px solid var(--filet);
  border-radius: 14px;
  background: var(--surface);
  padding: 10px 14px;
}

.reglages-titre {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gris);
}
.reglages-titre::-webkit-details-marker { display: none; }
.reglages-titre::after { content: "+"; font-size: 1rem; font-weight: 700; }
.reglages[open] .reglages-titre::after { content: "−"; }

.reglages-corps {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.champ {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--gris);
}

.champ input {
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--filet);
  background: var(--doux);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.btn-defaut {
  grid-column: 1 / -1;
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--filet);
  background: var(--doux);
  font-size: .74rem;
  font-weight: 700;
}
.btn-defaut:hover { border-color: var(--encre); }

@media (max-width: 420px) {
  .reglages-corps { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .scene, .cadran-progres, .btn-principal, .etape { transition: none; }
}
