@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Barlow+Condensed:wght@700;800&display=swap');

:root, [data-theme="craie"] {
  --bg: #FFFFFF; --sf: #F2F2F0; --fg: #0A0A0A; --mu: #5E5E5E; --ac: #0A0A0A; --on: #FFFFFF; --ln: #E3E3E0; --hi: #0A0A0A; --ok: #1F7A3A;
  --df: 'Inter', system-ui, sans-serif; --dw: 800; --tt: none; --ls: -0.02em; --r: 20px; --rs: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root, [data-theme="craie"] {
    --bg: #0A0A0A; --sf: #1A1A1A; --fg: #FFFFFF; --mu: #A3A3A3; --ac: #FFFFFF; --on: #0A0A0A; --ln: #2A2A2A; --hi: #FFFFFF; --ok: #6BD68A;
    color-scheme: dark;
  }
}
[data-theme="fonte"] {
  --bg: #0B0B0B; --sf: #191919; --fg: #F4F4F4; --mu: #A6A6A6; --ac: #D4FF3A; --on: #0B0B0B; --ln: #2B2B2B; --hi: #D4FF3A; --ok: #D4FF3A;
  --df: 'Barlow Condensed', 'Inter', sans-serif; --dw: 800; --tt: uppercase; --ls: 0.01em; --r: 6px; --rs: 4px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: 'Inter', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--hi); }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: calc(env(safe-area-inset-top) + 18px) 18px calc(env(safe-area-inset-bottom) + 96px); }
.page.run { padding-bottom: calc(env(safe-area-inset-bottom) + 20px); }

.h1 { margin: 0; font-family: var(--df); font-weight: var(--dw); font-size: 34px; line-height: 1.05; letter-spacing: var(--ls); text-transform: var(--tt); }
.h2 { margin: 0; font-family: var(--df); font-weight: var(--dw); font-size: 20px; text-transform: var(--tt); }
.big { font-family: var(--df); font-weight: var(--dw); text-transform: var(--tt); }
.muted { color: var(--mu); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }

.card { background: var(--sf); border-radius: var(--r); padding: 14px 16px; }
.card.hero { background: var(--ac); color: var(--on); }
.card.hero .muted { color: inherit; opacity: 0.85; }
.card.line { background: transparent; border: 1px solid var(--ln); }
.label { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.coach { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.coach .label { color: var(--hi); flex: none; padding-top: 2px; font-size: 11px; }

.btn { height: 52px; border-radius: var(--rs); border: none; background: var(--ac); color: var(--on); font-weight: 800; font-size: 16px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.block { width: 100%; }
.btn.inv { background: var(--on); color: var(--ac); }
.btn.ghost { background: transparent; color: var(--fg); border: 1.5px solid var(--fg); }
.btn.soft { background: var(--sf); color: var(--fg); }
.btn.sm { height: 40px; font-size: 14px; padding: 0 14px; }
.btn:disabled { opacity: 0.4; }
.link { border: none; background: none; padding: 0; color: var(--hi); font-weight: 700; font-size: 14px; text-decoration: none; }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--ln); background: none; border-left: 0; border-right: 0; border-top: 0; padding: 0; text-align: left; width: 100%; }
.li b { font-size: 16px; }

.chip { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--ln); color: var(--mu); white-space: nowrap; }
.chip.on { border-color: var(--hi); color: var(--hi); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--sf); padding: 4px; border-radius: var(--rs); }
.seg button { height: 38px; border: none; border-radius: var(--rs); background: transparent; color: var(--mu); font-weight: 700; font-size: 13px; }
.seg button.on { background: var(--bg); color: var(--fg); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--mu); }
.field input, .field select, .field textarea { height: 48px; border-radius: var(--rs); border: 1.5px solid var(--ln); background: var(--bg); color: var(--fg); padding: 0 12px; font-size: 16px; font-weight: 500; }
.field textarea { height: 90px; padding: 10px 12px; }

.stepper { background: var(--sf); border-radius: var(--r); padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stepper .ctl { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.stepper button { width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--bg); color: var(--fg); font-size: 24px; font-weight: 700; }
.stepper .val { font-family: var(--df); font-weight: var(--dw); font-size: 30px; min-width: 52px; text-align: center; }

.rir { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rir button { height: 44px; border-radius: var(--rs); border: 1.5px solid var(--ln); background: transparent; font-weight: 800; font-size: 15px; }
.rir button.on { background: var(--hi); border-color: var(--hi); color: var(--bg); }

.progress { height: 6px; border-radius: 3px; background: var(--sf); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--hi); }

.sets { display: flex; gap: 8px; flex-wrap: wrap; }
.setpill { font-size: 13px; font-weight: 700; padding: 7px 11px; border-radius: 99px; background: var(--sf); border: 1.5px solid transparent; }
.setpill.cur { border-color: var(--hi); }
.setpill.done { background: var(--hi); color: var(--bg); }

.timer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 16px); width: min(444px, calc(100% - 36px)); background: var(--ac); color: var(--on); border-radius: var(--r); padding: 14px 16px; display: flex; align-items: center; gap: 12px; z-index: 20; box-shadow: 0 8px 30px rgba(0,0,0,0.25); }
.timer .t { font-family: var(--df); font-weight: var(--dw); font-size: 40px; font-variant-numeric: tabular-nums; flex: 1; }
.timer button { height: 40px; border-radius: var(--rs); border: 1.5px solid var(--on); background: transparent; color: var(--on); font-weight: 800; padding: 0 12px; }

.chrono { text-align: center; padding: 20px 0; }
.chrono .t { font-family: var(--df); font-weight: var(--dw); font-size: 72px; font-variant-numeric: tabular-nums; line-height: 1; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--ln); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
nav.tabs .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); height: 62px; }
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--mu); font-size: 11px; font-weight: 600; }
nav.tabs a.on { color: var(--hi); font-weight: 800; }

.logo { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--fg); display: flex; align-items: center; justify-content: center; color: var(--fg); background: var(--bg); }
.avatar { width: 40px; height: 40px; border-radius: 20px; border: none; background: var(--sf); color: var(--fg); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; text-decoration: none; }

.toast { position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 700; font-size: 14px; z-index: 50; max-width: calc(100% - 36px); text-align: center; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet .box { background: var(--bg); width: 100%; max-width: 480px; border-radius: var(--r) var(--r) 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px); max-height: 85dvh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.ss-tag { font-size: 11px; font-weight: 800; color: var(--hi); border: 1.5px solid var(--hi); border-radius: 6px; padding: 1px 6px; }
/* Démo animée : deux photos en fondu */
.anim { position: relative; display: block; width: 100%; border: none; padding: 0; border-radius: var(--r); overflow: hidden; background: #fff; flex: none; }
.anim img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.anim img.b { animation: gbswap 2.4s ease-in-out infinite; }
@keyframes gbswap { 0%, 35% { opacity: 0; } 50%, 85% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .anim img.b { animation: none; opacity: 0; } }
svg.chart { width: 100%; height: 140px; display: block; }

@media print {
  nav.tabs, .noprint { display: none !important; }
  .page { padding: 20px; }
}
