/* SmartGains - app perso de suivi muscu */

:root {
  --bg: #0e1116;
  --surface: #171b22;
  --surface2: #1f242c;
  --line: #2a3038;
  --line2: #242a32;
  --ink: #e9ecf1;
  --ink2: #a7b0bb;
  --muted: #8b95a3;
  --dim: #5d6775;
  --faint: #363d46;
  --accent: #4ec9c1;
  --accent-soft: rgba(78, 201, 193, 0.1);
  --amber: #e0a458;
  --amber-soft: rgba(224, 164, 88, 0.1);
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', 'Trebuchet MS', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

a { color: var(--accent); text-decoration: none; }

button, input, select {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  font-size: inherit;
}

button { cursor: pointer; }

#app {
  padding: calc(env(safe-area-inset-top) + 20px) 20px
           calc(env(safe-area-inset-bottom) + 96px) 20px;
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- typographie ---------- */

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  color: var(--muted);
  text-transform: uppercase;
}

h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.6px; margin: 4px 0 0; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }

/* ---------- blocs ---------- */

.stack { display: flex; flex-direction: column; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-14 { gap: 14px; } .gap-18 { gap: 18px; } .gap-22 { gap: 22px; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.grow { flex-grow: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.card-tight { padding: 14px 16px; border-radius: 12px; }

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.badge-amber { background: var(--amber-soft); color: var(--amber); }

.chip {
  background: #181d24;
  border: 1px solid #262c34;
  border-radius: 7px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink2);
}

.btn {
  height: 52px;
  border-radius: 12px;
  background: var(--accent);
  color: #0e1116;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
}

.btn-ghost {
  background: var(--surface2);
  color: var(--ink2);
  font-weight: 600;
}

.btn-sm { height: 46px; font-size: 14px; }
.btn-line { background: none; border: 1px solid var(--line); color: var(--ink2); }
.btn:active { opacity: 0.85; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- navigation ---------- */

nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #12161c;
  border-top: 1px solid #1e232a;
  display: flex;
  padding: 0 4px calc(env(safe-area-inset-bottom));
  z-index: 40;
}

nav button {
  flex-grow: 1;
  height: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--dim);
}

nav button.on { color: var(--accent); }
nav svg { width: 22px; height: 22px; }

/* ---------- semaine ---------- */

.week { display: flex; gap: 8px; }

.day {
  flex-grow: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.day .d { font-size: 10px; font-weight: 600; letter-spacing: 0.8px; color: var(--dim); }
.day .c { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--muted); }
.day .m { height: 15px; display: flex; align-items: center; }
.day.done .c { color: var(--accent); }
.day.today { background: var(--accent-soft); border-color: var(--accent); }
.day.today .d { color: var(--accent); }
.day.today .c { color: var(--ink); }
.day.missed .c { color: var(--amber); }

/* ---------- séries ---------- */

.serie {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 12px;
  min-height: 56px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.serie.done { }
.serie.active { background: var(--accent-soft); border-color: var(--accent); }
.serie.todo { background: #13171d; border-style: dashed; }
.serie .lab { font-size: 14px; color: var(--ink2); }
.serie.todo .lab { color: #6d7783; }
.serie .val { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.serie.todo .val { color: #6d7783; font-weight: 500; }

.tick {
  width: 24px; height: 24px;
  border-radius: 12px;
  border: 1.8px solid var(--faint);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.tick.on { background: var(--accent); border-color: var(--accent); }

/* ---------- saisie ---------- */

.num {
  background: #0e1116;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 46px;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
}
.num:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.field { display: flex; flex-direction: column; gap: 6px; flex-grow: 1; min-width: 0; }
.field label { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--dim); text-transform: uppercase; }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 42px; height: 46px;
  background: var(--surface2);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink2);
  flex-shrink: 0;
}

/* ---------- minuteur ---------- */

#rest {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface2);
  border-top: 1px solid #2e353f;
  border-radius: 22px 22px 0 0;
  padding: 14px 20px calc(env(safe-area-inset-bottom) + 20px);
  z-index: 60;
  max-width: 560px;
  margin: 0 auto;
  display: none;
}
#rest.on { display: block; }

/* fin de repos : bandeau clair qui pulse, visible sans le son */
#rest.fini {
  background: var(--accent);
  border-top-color: var(--accent);
  color: #0e1116;
  animation: pulse 1.1s ease-in-out infinite;
}
#rest.fini .handle { background: rgba(14, 17, 22, 0.35); }
#rest.fini .bang {
  width: 54px; height: 54px;
  border-radius: 27px;
  background: rgba(14, 17, 22, 0.14);
  display: flex; align-items: center; justify-content: center;
  padding-left: 4px;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(0.82); }
}
#rest .handle { width: 40px; height: 4px; border-radius: 2px; background: #3a4149; margin: 0 auto 14px; }
#rest .btn-ghost { background: #2b333d; color: #cdd4dd; }
.ring { position: relative; width: 116px; height: 116px; flex-shrink: 0; }
.ring .t {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -1px;
}

/* ---------- calendrier ---------- */

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .hd { text-align: center; font-size: 10px; font-weight: 600; color: var(--dim); }
.cal .hd.we { color: var(--faint); }

.cell {
  height: 48px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #14181e;
}
.cell.empty, .cell.we { background: none; }
.cell .n { font-size: 13px; color: var(--ink2); }
.cell.we .n, .cell.empty .n { color: var(--faint); }
.cell .c { font-family: var(--mono); font-size: 9px; color: var(--dim); }
.cell.done .c { color: var(--accent); }
.cell.missed { background: var(--amber-soft); border: 1px solid #6b5230; }
.cell.missed .c { color: var(--amber); }
.cell.today { background: var(--accent); }
.cell.today .n { color: #0e1116; font-weight: 700; }
.cell.today .c { color: #0e1116; font-weight: 600; }

/* ---------- divers ---------- */

/* ---------- aperçu vidéo ---------- */

.vid {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  background: #14181e;
  border: 1px solid var(--line2);
  aspect-ratio: 16 / 9;
  max-width: 100%;
}
.vid img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.92; }
.vid .ph {
  width: 100%; height: 100%;
  background: linear-gradient(160deg, #1b212a, #14181e);
}
.vid .pl {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  border-radius: 28px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  padding-left: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}
.vid .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 12px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #e9ecf1;
  background: linear-gradient(to top, rgba(8, 10, 14, 0.92), rgba(8, 10, 14, 0));
  line-height: 1.35;
}
.vid .cap .approx {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--amber);
  color: #14181e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}

.hr { height: 1px; background: var(--line2); }

.note {
  background: #14181e;
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink2);
}

.warn {
  background: var(--amber-soft);
  border: 1px solid #6b5230;
  border-radius: 12px;
  padding: 14px;
}

.progress { display: flex; gap: 5px; }
.progress i { flex-grow: 1; height: 3px; border-radius: 2px; background: #222830; }
.progress i.on { background: var(--accent); }

.toast {
  position: fixed;
  left: 20px; right: 20px;
  bottom: calc(env(safe-area-inset-bottom) + 86px);
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  z-index: 80;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.sheet-back {
  position: fixed; inset: 0;
  background: rgba(6, 8, 11, 0.72);
  z-index: 70;
  display: flex;
  align-items: flex-end;
}
.sheet {
  background: var(--surface2);
  border-radius: 22px 22px 0 0;
  padding: 20px 20px calc(env(safe-area-inset-bottom) + 20px);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  max-height: 88vh;
  overflow-y: auto;
}

.list-row {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
}

.tabs { display: flex; gap: 6px; }
.tabs button {
  flex-grow: 1;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
