:root {
  --rep-color: #00aa00;
  --rep-active-color: #ffcc00;

  --time-color: #0077cc;   /* couleur des boutons de temps */
  --stop-color: #ff0000;   /* couleur du bouton STOP */
}

/* --------------------------------------------------
   RESET & BASE
-------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

body {
  background: #111;
  color: #fff;
  overflow: hidden;
}

/* --------------------------------------------------
   HEADER
-------------------------------------------------- */
header {
  background: #222;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.4rem;
  margin: 0;
}

/* Hamburger */
.hamburger {
  width: 30px;
  height: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.hamburger span {
  height: 4px;
  background: #fff;
  border-radius: 2px;
}

/* Menu mobile */
.mobile-menu {
  position: fixed;        /* ← pour être cliquable partout */
  top: 55px;
  right: 15px;
  background: #222;
  border-radius: 8px;
  padding: 10px;
  display: none;
  z-index: 1000;
}

.mobile-menu button {
  width: 100%;
  padding: 10px;
  border: none;
  background: #0077cc;
  color: white;
  border-radius: 6px;
  font-size: 16px;
  margin-bottom: 8px;
}

/* --------------------------------------------------
   SCREENS
-------------------------------------------------- */
.screen {
  display: none;
  padding: 1rem;
  height: calc(100dvh - 60px);  /* ← dvh pour mobile */
  overflow-y: auto;
}

#screen-settings {
  overflow-y: auto;
}

.screen.active {
  display: block;
}

/* --------------------------------------------------
   REPS — 12% hauteur
-------------------------------------------------- */
.reps-container {
  height: 12vh;
  width: calc(100% - 4px);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rep-btn {
  flex: 1;
  margin: 0 1px;
  height: 100%;
  border: none;
  border-radius: 8px;
  font-size: 2.2vh;
  font-weight: bold;
  background: var(--rep-color);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.1s;
}

.rep-btn.active {
  background: var(--rep-active-color);
  color: #000;
}

/* --------------------------------------------------
   TIMERS — 88% hauteur restante
-------------------------------------------------- */
.timers-grid {
  height: calc(88vh - 12vh);
  width: calc(100% - 4px);
  margin: 2px auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.timer-row {
  display: flex;
  justify-content: space-between;
  height: calc((100% - 4px) / 3);
  margin-bottom: 2px;
}

.timer-btn {
  flex: 1;
  margin: 0 1px;
  border: 0;                 /* ← correction de O */
  border-radius: 8px;
  font-size: 3vh;
  font-weight: bold;
  color: #fff;
  background-color: var(--time-color);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --------------------------------------------------
   TIMER SCREEN
-------------------------------------------------- */
#timer-display {
  font-size: 8rem;
  text-align: center;
  margin-top: 14vh;
  margin-bottom: 42dvh;      /* espace pour STOP */
}

/* STOP avec marge 2px autour, 2/5 écran */
#stop-btn {
  position: fixed;
  bottom: 2px;               /* marge bas */
  left: 2px;                 /* marge gauche */
  width: calc(100% - 4px);   /* marge gauche + droite */
  height: calc(40dvh - 4px); /* 2/5 de l'écran - marges */
  padding: 1px;              /* padding interne */
  font-size: 6rem;
  border: none;
  background: var(--stop-color);
  color: #fff;
  border-radius: 8px;
  z-index: 4000;
}

/* --------------------------------------------------
   SETTINGS
-------------------------------------------------- */
#screen-settings label {
  display: block;
  margin: 0.5rem 0;
}

.settings-time-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-row {
  background: #222;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.time-edit-btn {
  padding: 8px 14px;
  background: #0077cc;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.settings-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

button {
  touch-action: manipulation;
}

/* --------------------------------------------------
   POPUP MISE À JOUR
-------------------------------------------------- */
.update-popup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.update-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  color: #000;
}

/* --------------------------------------------------
   POPUP CADRAN
-------------------------------------------------- */
.time-popup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.time-popup-content {
  background: white;
  width: 80%;
  max-width: 400px;
  padding: 20px;
  border-radius: 20px;
  text-align: center;
  color: #000;
}

#time-canvas {
  width: 100%;
  height: auto;
}

.time-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
}

/* --------------------------------------------------
   MODE SOMBRE (toggle)
-------------------------------------------------- */
body.dark {
  background: #000;
  color: #ddd;
}

body.dark header {
  background: #111;
}

body.dark .rep-btn {
  background: #004400;
}

body.dark .rep-btn.active {
  background: #ffaa00;
}

body.dark .timer-btn {
  background: #005599;
}

body.dark .setting-row {
  background: #111;
}

body.dark .mobile-menu {
  background: #111;
}

body.dark .time-popup-content,
body.dark .update-content {
  background: #111;
  color: #fff;
}
