:root {
  --bg-1: #101316;
  --bg-2: #1b2127;
  --card: #f8f4ed;
  --card-strong: #fffaf2;
  --text: #15181c;
  --muted: #5e646c;
  --accent: #ff6b00;
  --accent-strong: #e95a00;
  --accent-soft: #ffe6d1;
  --dark-chip: #1e242b;
  --rest: #2b6cb0;
  --warn: #d9480f;
  --border: #e6ded2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 107, 0, 0.22), transparent 35%),
    radial-gradient(circle at 82% 5%, rgba(255, 160, 64, 0.15), transparent 30%),
    linear-gradient(150deg, var(--bg-1), var(--bg-2) 62%, #0f1216);
}

.app {
  max-width: 1140px;
  margin: 20px auto;
  padding: 0 16px 26px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.hero {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 2px;
}

.brand-logo {
  width: min(240px, 72%);
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.card {
  background: linear-gradient(165deg, var(--card) 0%, var(--card-strong) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

h1,
h2 {
  margin: 0 0 10px;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

h1 {
  font-size: 28px;
}

p {
  margin-top: 0;
  color: var(--muted);
}

textarea {
  width: 100%;
  border: 1px solid #d6c9bb;
  border-radius: 12px;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.35;
  background: #fffefc;
}

textarea:focus {
  outline: 2px solid rgba(255, 107, 0, 0.36);
  outline-offset: 1px;
}

.input-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.input-actions button {
  width: 100%;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  letter-spacing: 0.3px;
  cursor: pointer;
  background: linear-gradient(160deg, var(--accent), var(--accent-strong));
  color: #fff;
  transition: transform 0.14s ease, filter 0.14s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-btn {
  background: linear-gradient(160deg, #2d3946, #1f2933);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  font-size: 14px;
  line-height: 1;
}

/* Champ pleine largeur : libellé en petites capitales au-dessus, select en dessous.
   Tout est vertical dans cette carte : elle ne fait que ~350 px sur desktop. */
.field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.field-select {
  width: 100%;
  min-width: 0;
  border: 1px solid #d2c7ba;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  background: #fffdf9;
  color: #2b3138;
}

.field-select:focus {
  outline: 2px solid rgba(255, 107, 0, 0.36);
  outline-offset: 1px;
}

/* Réglages : liste façon « Réglages » système, libellé à gauche, contrôle à droite. */
.settings {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.settings-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 0 2px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.setting-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.setting-hint {
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.voice-picker {
  border: 1px solid #d2c7ba;
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 13px;
  background: #fffdf9;
  color: #2b3138;
}

.voice-picker:disabled {
  opacity: 0.6;
}

.status {
  margin-top: 10px;
  min-height: 20px;
  font-weight: 700;
}

.meta {
  background: linear-gradient(160deg, var(--accent-soft), #fff0df);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  color: #5f2600;
  font-size: 14px;
  border: 1px solid #ffd0a8;
}

ol {
  padding-left: 18px;
  margin: 0;
}

li {
  margin-bottom: 8px;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fff8ef 0%, #fff4e6 100%);
}

.phase {
  background: var(--dark-chip);
  color: #fff;
  border-radius: 100px;
  padding: 7px 15px;
  font-weight: 800;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.phase.rest {
  background: #e7f1ff;
  color: var(--rest);
}

/* Récup active (corde à sauter…) : ce n'est pas du repos, on le distingue du bleu récup. */
.phase.active-rest {
  background: #e6f7ee;
  color: #0f7a4a;
}

/* Transition matériel (élastique <-> corde) : ni effort, ni repos. */
.phase.transition {
  background: #f0ebfa;
  color: #5b3fa8;
}

.phase.prepare {
  background: #fff0e3;
  color: var(--warn);
}

/* Step estimé (distance, répétitions) : durée indicative, pas de décompte. */
.phase.estimated {
  background: #e8f4f0;
  color: #1d6b5a;
}

/* Checkpoint (sortie de la maison…) : le player attend qu'on appuie sur Démarrer. */
.phase.checkpoint {
  background: #fff7cc;
  color: #7a5a00;
}

/* Séance de la bibliothèque : le collage Nolio n'a plus lieu d'être. */
body.library-mode .nolio-input {
  display: none;
}

.countdown {
  font-family: "Arial Black", "Segoe UI", sans-serif;
  font-size: 96px;
  line-height: 0.95;
  font-weight: 900;
  margin: 14px 0;
  color: #101316;
  text-shadow: 0 2px 0 rgba(255, 107, 0, 0.18);
}

.now {
  font-size: 21px;
  font-weight: 800;
  text-align: center;
}

.next {
  margin-top: 7px;
  color: var(--muted);
  text-align: center;
  min-height: 22px;
  font-weight: 600;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.utility-controls {
  margin-top: 10px;
}

.app-version {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #596271;
  text-transform: uppercase;
}

.music-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.music-btn {
  display: inline-block;
  border-radius: 12px;
  padding: 9px 14px;
  font-weight: 800;
  font-size: 13px;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  letter-spacing: 0.3px;
  text-decoration: none;
  background: linear-gradient(160deg, #2d3946, #1f2933);
  color: #fff;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.music-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

.music-tracklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
}

.music-tracklist-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

.music-session-duration {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.music-track {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 7px 0;
}

.music-track:last-child {
  border-bottom: none;
}

.music-track-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.music-track-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-track-artist {
  font-weight: 400;
  color: var(--muted);
}

.music-track-bpm {
  font-size: 11px;
  font-weight: 700;
  color: #7c3d00;
  white-space: nowrap;
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.music-track-links {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.music-btn-sm {
  display: inline-block;
  border-radius: 8px;
  padding: 4px 9px;
  font-weight: 800;
  font-size: 11px;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  letter-spacing: 0.2px;
  text-decoration: none;
  background: linear-gradient(160deg, #2d3946, #1f2933);
  color: #fff;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.music-btn-sm:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
}

.music-hint {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  margin: 0;
}

body.focus-mode .hero,
body.focus-mode .input-card,
body.focus-mode .plan-card,
body.focus-mode .music-card {
  display: none;
}

body.focus-mode .app {
  max-width: 900px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.focus-mode .player-card {
  width: min(900px, 100%);
  min-height: 88vh;
}

@media (max-width: 720px) {
  .app {
    margin-top: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .countdown {
    font-size: 76px;
  }

  .brand-logo {
    width: min(220px, 78%);
  }

}

/* Pause « tabata en musique » : bouton vers le morceau sous la consigne. */
.checkpoint-music {
  margin-top: 12px;
  font-size: 15px;
  padding: 12px 18px;
}

.checkpoint-music[hidden] {
  display: none;
}
