/* ══════════════════════════════════════════════════════════════
   AMANIC V3 — Design System
   Thème sombre · Accent #00e5a0 · Manrope + JetBrains Mono
   ══════════════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  /* fonds */
  --bg: #0a0a0a;
  --bg-card: #1c1c1e;
  --bg-elev: #1c1c1e;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);

  /* accent */
  --accent: #00e5a0;
  --accent-dim: rgba(0,229,160,0.12);
  --accent-solid: rgba(0,229,160,0.20);
  --accent-text: #06231a;

  /* alertes */
  --danger: #ff8a3d;
  --danger-dim: rgba(255,138,61,0.15);

  /* texte */
  --text: #f2f2f2;
  --text-dim: #b0b0b0;
  --text-tert: #7a7a7a;
  --text-muted: #6f6f6f;

  /* formes */
  --radius: 16px;
  --radius-sm: 6px;
  --radius-pill: 20px;
  --radius-modal: 20px;

  /* espacements */
  --pad-x: 16px;
  --gap-block: 16px;
  --gap-card: 12px;

  /* polices */
  --font: 'Manrope', system-ui, sans-serif;
  --font-display: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* legacy aliases (pour app.js) */
  --lime: var(--accent);
  --lime-dim: var(--accent-dim);
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; overscroll-behavior: none; user-select: none;
  -webkit-user-select: none; touch-action: manipulation;
  letter-spacing: -0.01em;
}
#app { height: 100dvh; display: flex; flex-direction: column; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Typographie ── */
h2, .screen-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }
.dim2 { color: var(--text-tert); }
.label-sm {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-tert); font-weight: 600;
}

/* ── Cartes ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.card-accent { border-color: var(--accent); }
.card-danger  { border-color: var(--danger); }

/* ── Boutons ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 12px; font-weight: 700; font-size: 15px;
  padding: 14px 20px; transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; }

.btn-primary {
  background: var(--accent); color: var(--accent-text); font-weight: 800;
  border: none;
}
.btn-secondary {
  background: rgba(255,255,255,0.08); color: #e8e8e8;
  border: 1px solid var(--border);
}
.btn-big { padding: 20px; font-size: 18px; border-radius: 16px; }
.btn-ghost {
  flex: 1; padding: 12px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-dim);
}

/* legacy alias */
.btn-lime { background: var(--accent); color: var(--accent-text); font-weight: 800; border: none; }

/* ── Chips / Pills ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-card); font-weight: 600; font-size: 13px;
  color: var(--text-dim); transition: all .15s;
}
.chip.on, .chip.active {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}
.chip.accent-solid {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}

/* ── Checkbox ── */
.checkbox {
  width: 22px; height: 22px; border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong); background: transparent;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.checkbox.on {
  background: var(--accent); border-color: var(--accent);
}
.checkbox.on::after {
  content: '✓'; color: var(--accent-text); font-size: 13px; font-weight: 800;
}

/* ── Barre de progression ── */
.progress-bar {
  height: 5px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent); border-radius: 3px;
  transition: width .4s ease-out;
}

/* ── Top bar (fixe) ── */
.top-bar {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--pad-x);
  border-bottom: 1px solid var(--border);
}
.top-bar .date {
  font-family: var(--font-mono); font-size: 16px; font-weight: 600;
  color: var(--text);
}
.top-bar .mode-toggle {
  display: flex; background: var(--bg-card); border-radius: 10px;
  padding: 2px; border: 1px solid var(--border);
}
.top-bar .mode-toggle button {
  padding: 6px 14px; border-radius: 8px; font-size: 13px;
  font-weight: 700; color: var(--text-dim); transition: all .15s;
}
.top-bar .mode-toggle button.active {
  background: var(--accent); color: var(--accent-text);
}
.top-bar .coach-status {
  font-size: 12px; color: var(--accent); font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.top-bar .coach-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* ── KPI strip (scrollable horizontal) ── */
.kpi-strip {
  display: flex; gap: 8px; padding: 10px var(--pad-x);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.kpi-strip::-webkit-scrollbar { display: none; }
.kpi {
  flex-shrink: 0; min-width: 64px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; text-align: center;
  transition: border-color .2s;
}
.kpi .kpi-icon { font-size: 16px; }
.kpi .kpi-val { font-family: var(--font-mono); font-size: 14px; font-weight: 700; margin-top: 2px; }
.kpi .kpi-label { font-size: 10px; color: var(--text-tert); margin-top: 1px; text-transform: uppercase; letter-spacing: 0.3px; }
.kpi.good { border-color: var(--accent); }
.kpi.warn { border-color: var(--danger); }
.kpi.bad  { border-color: var(--danger); background: var(--danger-dim); }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--bg-card); border-top: 1px solid var(--border);
  display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px 4px; border-radius: 10px;
  font-size: 10px; font-weight: 600; color: var(--text-tert);
  text-transform: uppercase; letter-spacing: 0.3px;
  min-height: 44px; justify-content: center;
}
.bottom-nav .nav-item .nav-icon { font-size: 18px; }
.bottom-nav .nav-item.active { color: var(--accent); }
.bottom-nav .nav-item.active .nav-icon { opacity: 1; }
.bottom-nav .nav-item:not(.active) .nav-icon { opacity: 0.5; }

/* ── Screen padding ── */
.screen { flex: 1; overflow-y: auto; padding: 12px var(--pad-x) 120px; display: flex; flex-direction: column; gap: var(--gap-block); }
.screen { animation: fadeIn 200ms ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Home ── */
.home-head { display: flex; justify-content: space-between; align-items: center; }
.home-title { font-size: 18px; font-weight: 800; }

/* Compétition */
.hyrox {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-dim); border: 1px solid var(--accent);
  border-radius: 12px; padding: 10px 14px;
}
.hyrox .n { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--accent); }

/* Stats */
.stat-row { display: flex; gap: 8px; }
.stat { flex: 1; text-align: center; padding: 12px 8px; }
.stat .v { font-family: var(--font-mono); font-size: 22px; font-weight: 800; }
.stat .l { font-size: 11px; color: var(--text-tert); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; }

/* WOD item */
.wod-item { display: flex; align-items: center; gap: 12px; }
.wod-item .grow { flex: 1; }
.wod-item .name { font-weight: 700; font-size: 15px; }
.wod-item .meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; font-family: var(--font-mono); }

/* Star / favori */
.star { color: var(--text-tert); padding: 8px; }
.star.on { color: var(--accent); }
.star.on .ic { fill: var(--accent); }

/* ── WOD Hero ── */
.wod-hero {
  background: var(--bg-card); border: 2px solid var(--accent);
  border-radius: 20px; padding: 20px; text-align: center;
}
.wod-hero .wod-name { font-size: 21px; font-weight: 800; margin-bottom: 4px; }
.wod-hero .wod-meta { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.wod-hero .wod-steps { font-size: 11px; color: var(--text-tert); margin-bottom: 14px; }
.wod-hero .wod-go {
  display: block; width: 100%; padding: 18px; border-radius: 14px;
  background: var(--accent); color: var(--accent-text);
  font-size: 20px; font-weight: 800; border: none; cursor: pointer;
  font-family: var(--font);
}
.wod-hero .wod-go:active { transform: scale(.97); }

.wod-empty {
  text-align: center; padding: 24px;
  background: var(--bg-card); border-radius: 20px;
  border: 1px dashed var(--border-strong);
}
.wod-empty .empty-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.wod-empty .empty-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }

/* ── Week strip ── */
.week-strip { display: flex; gap: 4px; background: var(--bg-card); border-radius: 14px; padding: 10px 8px; border: 1px solid var(--border); }
.week-day { flex: 1; text-align: center; padding: 6px 2px; border-radius: 10px; position: relative; cursor: pointer; }
.week-day.today { background: var(--accent-dim); }
.week-day .day-letter { font-size: 10px; font-weight: 700; color: var(--text-tert); text-transform: uppercase; letter-spacing: 0.3px; }
.week-day.today .day-letter { color: var(--accent); }
.week-day .day-icon { font-size: 18px; margin: 3px 0 1px; }
.week-day .day-label { font-size: 8px; color: var(--text-tert); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-day.rest { opacity: 0.35; }
.week-done { position: absolute; top: -2px; right: 2px; font-size: 9px; color: var(--accent); }

/* ── Objectif ── */
.goal-mini { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.goal-mini .goal-bar { flex: 1; height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.goal-mini .goal-fill { height: 5px; background: var(--accent); border-radius: 3px; transition: width .3s; }
.goal-mini .goal-txt { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ── Ghost row ── */
.ghost-row { display: flex; gap: 8px; }
.ghost-btn { flex: 1; padding: 12px 8px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; color: var(--text-dim); }

/* ── Yesterday ── */
.yesterday-line { text-align: center; font-size: 12px; color: var(--text-dim); padding: 2px 0; }

/* ── Offline badge ── */
.offline-badge { position: fixed; top: 0; left: 0; right: 0; z-index: 2000; background: var(--danger); color: #0a0a0a; text-align: center; padding: 6px; font-size: 12px; font-weight: 700; }

/* ── Section title ── */
.section-title { font-size: 16px; font-weight: 800; margin-top: 4px; }

/* ═══════════════ PLAYER ═══════════════ */
.player { height: 100dvh; display: flex; flex-direction: column; position: relative; }
.player-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.step-pills { display: flex; gap: 6px; padding: 6px 16px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.step-pills::-webkit-scrollbar { display: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; letter-spacing: 0.3px; background: var(--bg-card); color: var(--text-tert); border: 1px solid var(--border); }
.pill.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.pill.done { background: var(--accent); color: var(--accent-text); border-color: var(--accent); opacity: 0.6; }
.pill.skipped { opacity: 0.3; text-decoration: line-through; }
.pill.future { opacity: 0.4; }
.step-counter { font-size: 13px; color: var(--text-dim); font-weight: 600; font-family: var(--font-mono); }

.coach {
  margin: 0 16px; padding: 12px 14px; background: var(--bg-card);
  border-left: 3px solid var(--accent); border-radius: 10px;
  font-size: 14px; font-style: italic; color: var(--text);
}
.player-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 16px; gap: 8px; position: relative; }
.exo-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 24px; font-weight: 800; text-align: center;
  padding: 8px 14px; border-radius: 12px;
}
.exo-name .ic { color: var(--accent); width: 26px; height: 26px; }
.prescription { font-size: 16px; color: var(--text-dim); text-align: center; }
.timer-giant {
  font-family: var(--font-mono); font-weight: 700;
  font-size: min(28vw, 45dvh); line-height: 1; letter-spacing: -2px;
}
.timer-giant.rest { color: var(--text-dim); }
.timer-giant.accent { color: var(--accent); }
.timer-giant.lime { color: var(--accent); } /* legacy */
.round-display { font-size: 18px; color: var(--text-dim); font-family: var(--font-mono); }
.round-display b { color: var(--accent); font-size: 26px; }
.player-controls { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.control-row { display: flex; gap: 10px; }
.control-row .btn { flex: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* tap zone */
.tap-zone { position: absolute; inset: 0; z-index: 0; }
.player-mid > *:not(.tap-zone):not(.tap-flash) { position: relative; z-index: 1; pointer-events: none; }
.player-mid .exo-name { pointer-events: auto; }
.tap-zone-hint { color: var(--text-dim); font-size: 13px; pointer-events: none; }
.tap-flash { position: absolute; inset: 0; background: var(--accent-dim); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 0; }

/* encode (strength) */
.encode { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 340px; }
.encode-row { display: flex; align-items: center; justify-content: space-between; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.encode-row .lbl { font-weight: 600; color: var(--text-dim); }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.stepper .val { font-family: var(--font-mono); font-size: 24px; font-weight: 800; min-width: 56px; text-align: center; }
.sets-dots { display: flex; gap: 8px; justify-content: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border); }
.dot.done { background: var(--accent); border-color: var(--accent); }
.dot.failed { background: var(--danger); border-color: var(--danger); }
.set-recap { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }

/* intro 3-2-1 */
.intro { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; gap: 12px; }
.intro .count { font-family: var(--font-mono); font-size: 40vw; font-weight: 700; color: var(--accent); animation: pulse 1s infinite; }
.intro .next { font-size: 16px; color: var(--text-dim); text-align: center; padding: 0 30px; }
@keyframes pulse { 0% { transform: scale(.8); opacity: .4; } 30% { transform: scale(1); opacity: 1; } }

/* ═══════════════ SHEET / MODALE ═══════════════ */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--bg-card); border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .25s ease-out;
  max-height: 70dvh; overflow-y: auto;
}
.sheet.open { transform: translateY(0); }
.sheet .grip { width: 40px; height: 4px; background: var(--border-strong); border-radius: 2px; margin: 0 auto 16px; }
.sheet h3 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.sheet h4 { color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin: 16px 0 8px; font-weight: 700; }
.sheet li { margin: 6px 0 6px 18px; font-size: 14px; line-height: 1.4; }

/* ── Day modal ── */
.day-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; display: flex; align-items: flex-end; }
.day-modal { width: 100%; background: var(--bg-card); border-radius: 20px 20px 0 0; padding: 20px; max-height: 85vh; overflow-y: auto; }
.day-modal .day-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.day-modal .day-title { font-size: 20px; font-weight: 800; }
.day-modal .day-close { font-size: 24px; cursor: pointer; padding: 4px 8px; color: var(--text-dim); }
.day-modal .day-section { margin-top: 12px; }
.day-modal .day-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-tert); margin-bottom: 6px; font-weight: 600; }
.day-modal label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.day-modal input, .day-modal select {
  width: 100%; padding: 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text); font-size: 14px; margin-bottom: 10px;
  font-family: var(--font);
}

/* ═══════════════ TOAST ═══════════════ */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--accent);
  border-radius: 20px; padding: 10px 20px; display: flex; gap: 14px;
  align-items: center; z-index: 70; font-weight: 600; font-size: 14px;
  animation: toastIn .25s ease-out;
}
.toast button { color: var(--accent); font-weight: 800; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ═══════════════ SUMMARY ═══════════════ */
.summary-hero { text-align: center; padding: 30px 0 10px; }
.summary-hero .big { font-family: var(--font-mono); font-size: 48px; font-weight: 700; color: var(--accent); }
.coach-final { text-align: center; font-style: italic; color: var(--text-dim); padding: 0 20px; font-size: 14px; }

/* ── Alertes / bandeaux ── */
.alert-band {
  background: var(--danger-dim); border: 1px solid var(--danger);
  border-radius: 12px; padding: 10px 14px; font-size: 13px;
  color: var(--danger); font-weight: 600;
}

/* ── Scaling card ── */
.scaling { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.scaling div { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--text-dim); }

/* ── PR tag ── */
.pr-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px;
  background: var(--accent-dim); color: var(--accent);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
