/* =========================================================
   LEVEL UP — Design
   Thème sombre "néon" : noir profond, vert lime (course),
   cyan (marche), violet (XP / niveau), orange (série).
   ========================================================= */

:root {
  --bg: #07070c;
  --card: rgba(255, 255, 255, 0.045);
  --card-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f8;
  --muted: #8d8da6;
  --lime: #c6ff3d;      /* course / action principale */
  --cyan: #22d3ee;      /* marche */
  --violet: #8b5cf6;    /* XP / niveaux */
  --orange: #ff8a3d;    /* série / feu */
  --pink: #ff4d8d;      /* musculation */
  --gold: #f5c542;      /* quêtes principales (touche Fantasy) */
  --radius: 22px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100dvh; overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.bg-glow {
  position: fixed; inset: -20% -20% auto -20%; height: 70vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 50% at 20% 30%, rgba(139, 92, 246, .28), transparent 70%),
    radial-gradient(35% 45% at 85% 10%, rgba(34, 211, 238, .18), transparent 70%),
    radial-gradient(30% 40% at 60% 60%, rgba(198, 255, 61, .08), transparent 70%);
  filter: blur(20px);
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 12px;
  max-width: 560px; margin: 0 auto;
  background: linear-gradient(var(--bg) 60%, transparent);
}
.brand { white-space: nowrap; font-family: var(--display); font-weight: 700; letter-spacing: .12em; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.brand small { color: var(--muted); font-weight: 500; letter-spacing: .1em; font-size: 10px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.top-xp { white-space: nowrap; display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 99px; background: var(--card); border: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.top-xp .lv { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--violet), var(--cyan)); font-size: 11px; font-weight: 700; }
.top-xp .mini { width: 54px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.1); overflow: hidden; }
.top-xp .mini i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); }

/* ---------- Mise en page ---------- */
main { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 0 16px calc(110px + var(--safe-b)); }
.view { display: none; animation: fadeUp .35s ease both; }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

h1 { font-family: var(--display); font-size: 28px; line-height: 1.1; margin: 6px 0 4px; letter-spacing: -.02em; }
h2 { font-family: var(--display); font-size: 17px; margin: 0; letter-spacing: -.01em; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.quote { color: var(--muted); font-size: 14px; margin: 0 0 18px; font-style: italic; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 2px 10px; }
.grad-text { background: linear-gradient(90deg, var(--lime), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 12px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.card.glow { position: relative; overflow: hidden; }
.card.glow::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(139,92,246,.7), rgba(34,211,238,.25) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ---------- Carte héros (niveau + anneau XP) ---------- */
.hero-card { display: flex; gap: 18px; align-items: center; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: rgba(255,255,255,.08); }
.ring .prog { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); filter: drop-shadow(0 0 6px rgba(139,92,246,.6)); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .center b { font-family: var(--display); font-size: 34px; line-height: 1; display: block; }
.ring .center span { font-size: 10px; letter-spacing: .14em; color: var(--muted); }
.hero-info { flex: 1; min-width: 0; }
.hero-info .title { font-family: var(--display); font-size: 24px; font-weight: 700; margin: 2px 0 8px; }
.xp-num { font-family: var(--display); font-weight: 700; color: var(--lime); }

.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.bar.lime i { background: linear-gradient(90deg, #8fdc1b, var(--lime)); box-shadow: 0 0 12px rgba(198,255,61,.5); }
.bar.thick { height: 12px; }

/* ---------- Tuiles de stats ---------- */
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 14px 12px; }
.tile .v { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.tile .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile .ic { font-size: 18px; margin-bottom: 6px; }
.tile.accent .v { color: var(--lime); }

/* ---------- Progression poids avec jalons ---------- */
.milestones { position: relative; margin-top: 10px; }
.milestones .marks { position: relative; height: 18px; margin-top: 6px; }
.milestones .marks span { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.milestones .marks span.hit { color: var(--lime); font-weight: 700; }

/* ---------- Quête hebdo / série ---------- */
.pips { display: flex; gap: 8px; }
.pip { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.06); border: 1px dashed rgba(255,255,255,.18); font-size: 16px; }
.pip.on { background: linear-gradient(135deg, var(--lime), #8fdc1b); border: 0; color: #0b0b12; box-shadow: 0 0 16px rgba(198,255,61,.45); font-weight: 800; }
.flame { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 72px; padding: 8px; border-radius: 16px; background: rgba(255,138,61,.1); border: 1px solid rgba(255,138,61,.25); }
.flame b { font-family: var(--display); font-size: 24px; color: var(--orange); line-height: 1; }
.flame span { font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.badge-xp { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 99px; background: rgba(139,92,246,.18); color: #c4b5fd; white-space: nowrap; }
.badge-xp.lime { background: rgba(198,255,61,.14); color: var(--lime); }

/* ---------- Séance du programme ---------- */
.session-card { background: linear-gradient(160deg, rgba(198,255,61,.10), rgba(34,211,238,.05) 50%, var(--card)); border-color: rgba(198,255,61,.22); }
.session-desc { font-family: var(--display); font-size: 20px; font-weight: 700; margin: 6px 0 12px; }
.segbar { display: flex; gap: 3px; height: 14px; margin: 8px 0 6px; }
.segbar i { border-radius: 4px; }
.segbar .walk { background: var(--cyan); opacity: .55; }
.segbar .run { background: var(--lime); box-shadow: 0 0 8px rgba(198,255,61,.4); }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; transition: transform .12s ease, filter .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--lime); color: #0b0b12; box-shadow: 0 6px 24px rgba(198,255,61,.25); }
.btn.ghost { background: var(--card-2); border: 1px solid var(--border); }
.btn.danger { background: rgba(255,77,141,.12); color: var(--pink); border: 1px solid rgba(255,77,141,.3); }
.btn.block { width: 100%; }
.btns { display: flex; gap: 10px; margin-top: 14px; }
.btns .btn { flex: 1; }

.coach { display: flex; gap: 12px; align-items: flex-start; }
.coach .avatar { width: 40px; height: 40px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: linear-gradient(135deg, rgba(139,92,246,.35), rgba(34,211,238,.25)); }
.coach p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; }

/* ---------- Programme (timeline) ---------- */
.timeline { display: grid; gap: 6px; }
.tl-row { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; font-size: 13px; }
.tl-row.current { background: rgba(198,255,61,.08); border: 1px solid rgba(198,255,61,.25); }
.tl-row.done { opacity: .55; }
.tl-row b { font-family: var(--display); }
.tl-dots { display: flex; gap: 4px; }
.tl-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.12); }
.tl-dots i.on { background: var(--lime); }
.tl-dots i.now { background: transparent; border: 2px solid var(--lime); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick button { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 14px 8px; text-align: center; font-size: 13px; font-weight: 600; }
.quick button span { display: block; font-size: 24px; margin-bottom: 4px; }

.history { display: grid; gap: 8px; }
.h-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); }
.h-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; flex: none; }
.h-ic.run { background: rgba(198,255,61,.14); }
.h-ic.walk { background: rgba(34,211,238,.14); }
.h-ic.strength { background: rgba(255,77,141,.14); }
.h-main { flex: 1; min-width: 0; }
.h-main b { font-size: 14px; }
.h-main div { font-size: 12px; color: var(--muted); }
.h-del { color: var(--muted); padding: 6px; font-size: 18px; line-height: 1; }
.empty { text-align: center; color: var(--muted); padding: 24px 10px; font-size: 14px; }

/* ---------- Personnage ---------- */
.avatar-card { text-align: center; padding: 26px 18px; }
.emblem { width: 120px; height: 120px; margin: 0 auto 12px; border-radius: 34px; display: grid; place-items: center; font-family: var(--display); font-size: 48px; font-weight: 700; position: relative;
  background: linear-gradient(135deg, var(--violet), var(--cyan)); box-shadow: 0 0 40px rgba(139,92,246,.45), inset 0 0 0 3px rgba(255,255,255,.15); }
.emblem small { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); font-size: 10px; letter-spacing: .14em; padding: 4px 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); font-family: var(--font); white-space: nowrap; }
.attr { margin-bottom: 12px; }
.attr .row { font-size: 13px; margin-bottom: 6px; }
.attr .row b { margin-left: auto; font-family: var(--display); }
.levels { display: grid; gap: 6px; }
.lv-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; font-size: 14px; }
.lv-row .n { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: rgba(255,255,255,.06); }
.lv-row.reached .n { background: linear-gradient(135deg, var(--violet), var(--cyan)); }
.lv-row.current { background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.35); }
.lv-row .xp { margin-left: auto; color: var(--muted); font-size: 12px; }
.lv-row.locked { opacity: .45; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bdg { text-align: center; padding: 14px 6px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); }
.bdg .i { font-size: 30px; margin-bottom: 6px; }
.bdg b { display: block; font-size: 12px; }
.bdg div:last-child { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.bdg.locked .i { filter: grayscale(1); opacity: .3; }
.bdg.locked b { color: var(--muted); }
.bdg.unlocked { border-color: rgba(198,255,61,.3); background: linear-gradient(160deg, rgba(198,255,61,.09), var(--card)); }
table.rewards { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rewards td { padding: 9px 0; border-bottom: 1px solid var(--border); }
table.rewards tr:last-child td { border: 0; }
table.rewards td:last-child { text-align: right; font-weight: 700; color: var(--lime); font-family: var(--display); }

/* ---------- Graphiques ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(18px, 1fr)); gap: 5px; }
.heat i { aspect-ratio: 1; border-radius: 5px; background: rgba(255,255,255,.06); }
.heat i.l1 { background: rgba(198,255,61,.25); }
.heat i.l2 { background: rgba(198,255,61,.55); }
.heat i.l3 { background: var(--lime); box-shadow: 0 0 8px rgba(198,255,61,.5); }
.heat i.now { outline: 2px solid var(--cyan); outline-offset: 1px; }
.heat i.future { background: rgba(255,255,255,.025); }

/* ---------- Formulaires ---------- */
label.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
label.f input, label.f select { display: block; width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; min-height: 48px; margin-top: 6px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--border); font-size: 16px; outline: none; }
label.f input:focus { border-color: var(--lime); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 6px 0 14px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 11px 6px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--border); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg label span { display: block; font-size: 20px; margin-bottom: 2px; }
.seg input:checked + label { background: rgba(198,255,61,.14); border-color: var(--lime); color: var(--lime); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--lime); }

/* ---------- FAB + onglets ---------- */
.fab {
  position: fixed; z-index: 30; right: max(18px, calc(50% - 262px)); bottom: calc(88px + var(--safe-b));
  width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center;
  background: var(--lime); color: #0b0b12; box-shadow: 0 10px 30px rgba(198,255,61,.35);
}
.fab:active { transform: scale(.94); }
.tabbar {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b));
  width: min(528px, calc(100% - 24px)); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px; border-radius: 24px; background: rgba(18, 18, 28, .82); border: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 6px; border-radius: 18px; color: var(--muted); font-size: 10px; font-weight: 600; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.active { color: var(--text); background: rgba(255,255,255,.07); }
.tabbar button.active svg { stroke: var(--lime); }

/* ---------- Modale (feuille du bas) ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: none; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
.modal.open { display: flex; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: #12121b; border: 1px solid var(--border); border-bottom: 0; border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); animation: sheetUp .3s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.2); margin: 0 auto 14px; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Notifications XP ---------- */
.toasts { position: fixed; z-index: 70; top: calc(64px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(380px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(22,22,34,.95); border: 1px solid rgba(198,255,61,.35); box-shadow: 0 12px 30px rgba(0,0,0,.5); animation: toastIn .4s cubic-bezier(.2,1.4,.4,1) both; }
.toast.out { animation: toastOut .3s ease forwards; }
.toast b { font-family: var(--display); color: var(--lime); font-size: 18px; white-space: nowrap; }
.toast.badge { border-color: rgba(139,92,246,.5); }
.toast.badge b { color: #c4b5fd; font-size: 14px; }
.toast span { font-size: 13px; color: var(--muted); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- Écran "LEVEL UP" ---------- */
.levelup { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; text-align: center; background: radial-gradient(circle at 50% 45%, #2b1b5c, #07070c 65%); overflow: hidden; }
.levelup.open { display: grid; }
.levelup .lu-box { animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; padding: 20px; }
.levelup .lu-tag { font-family: var(--display); letter-spacing: .3em; font-size: 14px; color: var(--lime); }
.levelup .lu-n { font-family: var(--display); font-size: 120px; font-weight: 700; line-height: 1; margin: 6px 0; background: linear-gradient(180deg, #fff, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(139,92,246,.7)); }
.levelup .lu-title { font-family: var(--display); font-size: 30px; font-weight: 700; }
.confetti { position: absolute; top: -20px; width: 8px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Chrono de séance ---------- */
.runner { position: fixed; inset: 0; z-index: 60; display: none; flex-direction: column; padding: calc(24px + env(safe-area-inset-top, 0px)) 22px calc(28px + var(--safe-b)); background: var(--bg); transition: background .5s; }
.runner.open { display: flex; }
.runner.run { background: radial-gradient(circle at 50% 40%, rgba(198,255,61,.22), transparent 70%), var(--bg); }
.runner.walk { background: radial-gradient(circle at 50% 40%, rgba(34,211,238,.2), transparent 70%), var(--bg); }
.runner .r-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.runner .r-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.runner .phase { font-family: var(--display); font-weight: 700; font-size: 44px; letter-spacing: .06em; }
.runner.run .phase { color: var(--lime); }
.runner.walk .phase { color: var(--cyan); }
.runner .time { font-family: var(--display); font-size: 96px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; margin: 10px 0; }
.runner .next { color: var(--muted); font-size: 15px; }
.runner .r-ctrl { display: flex; gap: 10px; margin-top: 18px; }
.runner .r-ctrl .btn { flex: 1; padding: 16px; }

@media (min-width: 700px) {
  h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Premier lancement : création du personnage ---------- */
.onboard {
  position: fixed; inset: 0; z-index: 90; display: none; overflow-y: auto;
  background:
    radial-gradient(60% 40% at 15% 5%, rgba(139,92,246,.35), transparent 70%),
    radial-gradient(50% 40% at 95% 30%, rgba(34,211,238,.18), transparent 70%),
    radial-gradient(50% 30% at 50% 100%, rgba(198,255,61,.08), transparent 70%),
    var(--bg);
}
.onboard.open { display: block; }
.ob { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(30px + var(--safe-b)); }
.ob-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7vh; }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 18px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.12); transition: all .35s ease; }
.ob-dots i.on { width: 32px; background: var(--lime); box-shadow: 0 0 10px rgba(198,255,61,.5); }
.ob-step { display: none; animation: fadeUp .4s ease both; }
.ob-step.active { display: block; }
.ob-step h1 { font-size: 36px; margin: 6px 0 10px; }
.ob-step > p.muted { margin: 0 0 26px; line-height: 1.5; font-size: 15px; }
.ob-hero { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; font-size: 40px; margin-bottom: 24px;
  background: linear-gradient(135deg, var(--lime), var(--cyan)); box-shadow: 0 0 50px rgba(198,255,61,.35); animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; }
.ob-preview { border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; background: var(--card); border: 1px solid var(--border); font-size: 14px; animation: fadeUp .3s ease both; }
.ob-preview:empty { display: none; }
.ob-preview .big { font-family: var(--display); font-size: 26px; font-weight: 700; margin: 2px 0; }
.ob-preview.ok { border-color: rgba(198,255,61,.4); } .ob-preview.ok b { color: var(--lime); }
.ob-preview.warn { border-color: rgba(255,138,61,.5); } .ob-preview.warn b { color: var(--orange); }
.ob-preview.bad { border-color: rgba(255,77,141,.55); } .ob-preview.bad b { color: var(--pink); }
.ob-err { color: var(--pink); font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.btns .btn.back { flex: 0 0 58px; }

/* ---------- Journal : séances modifiables ---------- */
.h-main.editable { cursor: pointer; border-radius: 10px; }
.h-main.editable:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }

/* ---------- Historique des pesées ---------- */
.w-list { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 8px; }
.w-row { display: flex; align-items: center; gap: 6px; }
.w-main { flex: 1; display: grid; grid-template-columns: 1fr auto 56px; gap: 10px; align-items: center; text-align: left; padding: 9px 4px; font-size: 14px; border-radius: 10px; }
.w-main .small { text-align: right; }
.w-main:active { background: rgba(255,255,255,.04); }
.w-more { width: 100%; margin-top: 6px; padding: 10px; border-radius: 12px; color: var(--muted); font-size: 13px; font-weight: 600; background: rgba(255,255,255,.04); }

/* ---------- Bandeau "nouvelle version" ---------- */
.update-bar {
  position: fixed; z-index: 95; left: 50%; transform: translateX(-50%); bottom: calc(160px + var(--safe-b)); /* au-dessus de tous les écrans, création du personnage comprise */
  width: min(520px, calc(100% - 32px)); display: none; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 16px; border-radius: 18px; font-size: 14px; font-weight: 600;
  background: rgba(22,22,34,.96); border: 1px solid rgba(139,92,246,.5); box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.update-bar.open { display: flex; animation: barIn .4s cubic-bezier(.2,1.4,.4,1) both; }
/* L'animation garde le centrage (translateX(-50%)) : sinon, sur iPhone, le bouton sortait de l'écran */
@keyframes barIn { from { opacity: 0; transform: translate(-50%, -14px) scale(.95); } to { opacity: 1; transform: translate(-50%, 0); } }
.update-bar .btn { padding: 9px 14px; font-size: 13px; }

/* ---------- Très petits écrans (iPhone SE, 320 px) ---------- */
@media (max-width: 360px) {
  main { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  label.f input, label.f select { padding: 12px 8px; } /* police gardée à 16 px : en dessous, iOS zoome sur le champ */
  .brand small { display: none; }
  .top-xp .mini { width: 36px; }
  h1 { font-size: 25px; }
  .grid-3 { gap: 6px; }
  .tile { padding: 12px 9px; }
  .tile .v { font-size: 19px; }
  .ring { width: 96px; height: 96px; }
  .ring svg { width: 96px; height: 96px; }
  .hero-card { gap: 12px; }
  .hero-info .title { font-size: 20px; }
  .pip { width: 32px; height: 32px; }
  .flame { min-width: 60px; }
  .runner .time { font-size: 76px; }
  .runner .phase { font-size: 36px; }
  .tabbar button span { font-size: 9px; }
}

/* ---------- Assistant de course (étape 3) ---------- */
.runner .r-top { align-items: center; }
.r-icons { display: flex; gap: 8px; }
.r-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: var(--card-2); border: 1px solid var(--border); }
.r-ico.off { opacity: .55; }
.r-stats { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.r-stats b { color: var(--text); font-family: var(--display); font-variant-numeric: tabular-nums; }
.runner .phase { font-size: clamp(30px, 10.5vw, 44px); }
.runner .time { font-size: clamp(76px, 26vw, 112px); }
.r-hint { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.4; }

/* Compte à rebours : grand chiffre violet qui "bat" chaque seconde */
.runner.countdown { background: radial-gradient(circle at 50% 40%, rgba(139,92,246,.3), transparent 70%), var(--bg); }
.runner.countdown .phase { color: #c4b5fd; }
.runner.countdown .time { font-size: clamp(120px, 42vw, 180px); animation: beat 1s ease-in-out infinite; }
@keyframes beat { 0% { transform: scale(1.08); } 60% { transform: scale(.96); } 100% { transform: scale(1.08); } }

/* 10 dernières secondes d'une phase : le temps passe en orange et pulse */
.runner.warn .time { color: var(--orange); animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .55; } }
.runner.paused .time { opacity: .45; }

/* Bilan de fin de séance */
.runner.open.summary { display: block; overflow-y: auto; background: radial-gradient(circle at 50% 0%, rgba(198,255,61,.14), transparent 60%), var(--bg); }
.sum-box { max-width: 480px; margin: 0 auto; animation: fadeUp .4s ease both; }
.sum-box h1 { margin: 6px 0 6px; }
.sum-box .tile .v { font-size: 20px; }

/* Curseur de volume */
label.f input[type=range] { padding: 0; min-height: 0; height: 28px; border: 0; background: none; -webkit-appearance: auto; appearance: auto; accent-color: var(--lime); }

/* ---------- Statut de la séance dans le bilan (validée / interrompue) ---------- */
.sum-status { padding: 12px 14px; border-radius: 14px; margin: 4px 0 16px; font-size: 14px; line-height: 1.45; background: var(--card); border: 1px solid var(--border); }
.sum-status.ok { border-color: rgba(198,255,61,.45); background: rgba(198,255,61,.07); }
.sum-status.ok b { color: var(--lime); }
.sum-status.ko { border-color: rgba(255,138,61,.45); background: rgba(255,138,61,.07); }
.sum-status.ko b { color: var(--orange); }

/* ---------- Coach adaptatif (étape 4) ---------- */
.coach-card .coach { align-items: flex-start; }
.coach-title { margin: 4px 0 6px; font-size: 18px; }
.coach-card p { margin: 0; font-size: 14px; line-height: 1.5; }
.coach-prop { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.35); }
.coach-prop .btns { margin-top: 10px; }
.coach-prop .btn { padding: 11px 8px; font-size: 13px; }
.coach-insights { list-style: none; padding: 12px 0 0; margin: 14px 0 0; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.coach-insights li { display: flex; gap: 10px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.coach-insights li span:first-child { flex: none; }
.coach-note { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; background: rgba(255,138,61,.08); border: 1px solid rgba(255,138,61,.3); color: #ffc39b; }
.swap-link { display: block; width: 100%; margin-top: 10px; padding: 8px; font-size: 13px; color: var(--muted); text-align: center; border-radius: 10px; }
.swap-link:active { background: rgba(255,255,255,.05); }
.h-ic.coach { background: rgba(139,92,246,.16); }

/* Ressenti sur 4 niveaux : libellés plus compacts */
.seg.feel4 label { padding: 10px 3px; font-size: 12px; line-height: 1.2; }
.seg.feel4 label span { font-size: 19px; margin-bottom: 3px; }

/* ---------- Séance libre (étape 4.5) ---------- */
.quick.two { grid-template-columns: 1fr 1fr; }
.quick.two button { padding: 16px 8px; font-size: 14px; }
.quick.two button span { font-size: 28px; }

/* ---------- Statistiques avancées et progression RPG (étape 5) ---------- */
.tile-sub { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.chip { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.07); color: var(--muted); white-space: nowrap; }
.chip.up { background: rgba(198,255,61,.14); color: var(--lime); }
.cmp-row { display: flex; align-items: center; gap: 6px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row > span:first-child { flex: 1; color: var(--muted); }
.seg-mini { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.seg-btn { padding: 7px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--muted); }
.seg-btn.on { background: rgba(198,255,61,.14); border-color: var(--lime); color: var(--lime); }
.type-row { margin-bottom: 12px; font-size: 14px; }
.type-row:last-child { margin-bottom: 0; }
.type-row .bar { margin: 6px 0 4px; height: 6px; }
.type-row.zero { opacity: .45; }
.rec-row, .ex-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rec-row:last-child, .ex-row:last-of-type { border-bottom: 0; }
.ex-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: rgba(255,255,255,.05); }
.ex-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.rec-v { font-family: var(--display); white-space: nowrap; }
.tag { font-size: 11px; font-weight: 600; }
.tag.measured { color: var(--lime); }
.defi { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.defi + .defi { border-top: 1px solid var(--border); }
.defi-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: rgba(139,92,246,.14); }
.defi-main { flex: 1; min-width: 0; font-size: 14px; }
.defi-main .bar { height: 6px; }
.cat-title { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 2px 8px; font-size: 13px; font-weight: 700; }
.bdg .mini-bar { height: 4px; border-radius: 9px; background: rgba(255,255,255,.08); margin: 8px 6px 0; overflow: hidden; }
.bdg .mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.emblem-reward { position: absolute; top: -10px; right: -10px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; background: var(--bg); border: 1px solid var(--border); box-shadow: 0 0 16px rgba(139,92,246,.4); }
.lv-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.link-btn { color: var(--cyan); font-size: 12px; font-weight: 600; padding: 4px 0; }
.bdg .bdg-d { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.3; }

/* ---------- Choix de la voix du coach ---------- */
.voice-list { display: grid; gap: 6px; }
.voice-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.voice-row.on { border-color: var(--lime); background: rgba(198,255,61,.08); }
.voice-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; }
.voice-pick input { width: 18px; height: 18px; flex: none; accent-color: var(--lime); }
.voice-pick > span { display: flex; flex-direction: column; min-width: 0; font-size: 14px; }
.voice-play { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 15px; color: var(--lime); background: var(--card-2); border: 1px solid var(--border); }
.voice-play:active { transform: scale(.94); }

/* ---------- Héros : journal de quêtes (étape 5.5) ---------- */
.hero-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 14px; padding: 4px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); }
.hero-tab { padding: 10px 4px; border-radius: 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.hero-tab.on { color: var(--text); background: rgba(245,197,66,.12); box-shadow: inset 0 0 0 1px rgba(245,197,66,.45); }
.hero-strip { display: flex; gap: 14px; align-items: center; padding: 14px; }
.hs-emblem { position: relative; width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; font-family: var(--display); font-size: 24px; font-weight: 700; background: linear-gradient(135deg, var(--violet), var(--cyan)); box-shadow: 0 0 18px rgba(139,92,246,.4); }
.hs-emblem span { position: absolute; right: -8px; bottom: -8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--bg); border: 1px solid var(--border); }
.hs-main { flex: 1; min-width: 0; font-size: 14px; }

.quest-card { border-left: 3px solid var(--qc, var(--border)); }
.quest-card.daily { --qc: var(--cyan); }
.quest-card.weekly { --qc: var(--violet); }
.quest-card.main { --qc: var(--gold); background: linear-gradient(160deg, rgba(245,197,66,.08), var(--card) 45%); }
.quest-card.epic { --qc: var(--orange); }
.quest { display: flex; gap: 12px; padding: 10px 0; }
.quest + .quest { border-top: 1px solid var(--border); }
.quest-ic { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: rgba(255,255,255,.05); }
.quest.done .quest-ic { background: rgba(198,255,61,.15); color: var(--lime); font-weight: 800; }
.quest-main { flex: 1; min-width: 0; font-size: 14px; }
.quest-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.quest-xp { font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--gold); }
.quest.daily .quest-xp { color: var(--cyan); }
.quest.weekly .quest-xp { color: #c4b5fd; }
.quest.epic .quest-xp { color: var(--orange); }
.quest-bar { height: 6px; margin: 8px 0 4px; }
.quest.daily .quest-bar i { background: var(--cyan); }
.quest.weekly .quest-bar i { background: linear-gradient(90deg, var(--violet), #c4b5fd); }
.quest.main .quest-bar i { background: linear-gradient(90deg, #c9971c, var(--gold)); }
.quest.epic .quest-bar i { background: linear-gradient(90deg, var(--pink), var(--orange)); }
.quest-done { color: var(--lime); margin-top: 4px; }
.quest-note { margin-top: 6px; color: var(--muted); line-height: 1.4; }
.chapter { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 8px; border-radius: 16px; font-size: 14px; background: var(--card); border: 1px solid var(--border); }
.chapter b { flex: 1; min-width: 0; }
.chapter.done span:first-child { color: var(--gold); font-weight: 800; }
.chapter.locked { opacity: .5; }
.chapter-title { font-family: var(--display); font-size: 22px; margin: 2px 0 2px; color: var(--gold); text-shadow: 0 0 18px rgba(245,197,66,.25); }
.chapter-lore { margin: 0 0 6px; font-style: italic; }
.chapter-reward { margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(245,197,66,.35); font-size: 13px; color: var(--muted); }
.chapter-reward b { color: var(--gold); }

/* ---------- GPS en direct (étape 6.1) ---------- */
.gps-box { margin-top: 18px; width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gps-btn { padding: 12px 18px; font-size: 14px; }
.gps-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); text-align: center; }
.gps-note.err { color: #ffb4cd; }
.gps-ready { display: flex; align-items: center; gap: 12px; }
.gps-chip { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.08); color: var(--muted); white-space: nowrap; }
.gps-chip.bon { background: rgba(198,255,61,.15); color: var(--lime); }
.gps-chip.moyen { background: rgba(255,138,61,.15); color: var(--orange); }
.gps-chip.faible, .gps-chip.perdu { background: rgba(255,77,141,.15); color: var(--pink); }
.gps-panel { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gps-panel > div { padding: 10px 6px; border-radius: 14px; text-align: center; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gps-panel > div b { font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; }
.gps-panel > div b.gps-chip { font-family: var(--font); font-size: 12px; margin-top: 4px; }
.gps-panel > div span { font-size: 11px; color: var(--muted); }
.gps-panel:not(.on) { display: block; }
.gps-off { width: 100%; padding: 12px; border-radius: 14px; font-size: 14px; font-weight: 600; color: var(--cyan); background: var(--card); border: 1px dashed rgba(34,211,238,.4); }

/* Diagnostic GPS (détail des positions reçues) et note d'allure */
.pace-note { margin: 8px 0 0; }
.pace-note:empty { display: none; }
.gps-diag { margin-top: 8px; font-size: 13px; }
.gps-diag summary { cursor: pointer; color: var(--muted, #9aa3b5); }
.gps-diag ul { list-style: none; margin: 6px 0 0; padding: 0; }
.gps-diag li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.gps-diag li b { color: inherit; font-variant-numeric: tabular-nums; }

/* Suivi du poids facultatif (2.9.0) : case de la création du personnage */
.ob-check { margin: 4px 0 14px; }
.ob-weight[hidden] { display: none; }
.ob-dots.two i:last-child { display: none; }
