/* Club Bras de fer vosgien · charte provisoire (en attendant le logo du club) : vert sapin, or, fond sombre.
   Pour passer aux couleurs du club, changer seulement les variables --club-* et icons/logo.svg. */
:root {
  --club-1: #1d6b47;        /* vert sapin (couleur principale) */
  --club-1-press: #175a3b;
  --club-1-ink: #5fd39a;
  --club-2: #e3b341;        /* or (podium, records) */
  --bg: #0f1613;
  --surface: #17201c;
  --surface-2: #1f2a25;
  --surface-3: #29362f;
  --line: #2a3530;
  --text: #f4efe6;
  --text-2: #bfc7c1;
  --text-3: #8c968f;
  --G: #9085e9;             /* bras gauche, comme dans l'appli de coaching */
  --D: #3987e5;             /* bras droit */
  --or: #e3b341;
  --argent: #c9d1d6;
  --bronze: #c98a52;
  --danger: #ef7f7a;
  --r-card: 18px;
  --r-ctl: 12px;
  --pad: 16px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.23, 1, .32, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 400 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; min-height: 100dvh; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--club-1-ink); outline-offset: 2px; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#app { max-width: 600px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) var(--pad) calc(var(--nav-h) + var(--safe-b) + 28px); }
body.nonav #app { padding-bottom: 40px; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 12px; min-height: 56px; margin-bottom: 10px; }
.top .logo { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.top h1 { font-size: 26px; font-weight: 760; letter-spacing: -.02em; margin: 0; line-height: 1.1; }
.top .club { color: var(--text-3); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.top .grow { flex: 1; min-width: 0; }
h2 { font-size: 18px; font-weight: 720; margin: 26px 0 10px; letter-spacing: -.01em; }
h2:first-child { margin-top: 6px; }
p { margin: 0 0 10px; }
.dim { color: var(--text-3); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }

/* ---------- cards, lists ---------- */
.card { background: var(--surface); border-radius: var(--r-card); padding: 16px; margin-bottom: 12px; }
.card.flat { background: none; border: 1px dashed var(--line); }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.list { background: var(--surface); border-radius: var(--r-card); overflow: hidden; margin-bottom: 12px; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; border-top: 1px solid var(--line); min-height: 60px; }
.li:first-child { border-top: 0; }
button.li:active { background: var(--surface-2); }
.li .grow { flex: 1; min-width: 0; }
.li .t, .li .s { display: block; }
.li .t { font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li.moi { background: color-mix(in srgb, var(--club-1) 22%, var(--surface)); }
.rang { width: 28px; text-align: center; font-weight: 700; color: var(--text-2); flex: none; }
.val { text-align: right; flex: none; }
.val b { font-size: 18px; font-weight: 740; }
.val .u { font-size: 12px; color: var(--text-3); margin-left: 2px; }
.val .s { font-size: 12px; color: var(--text-3); }
.tag { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.tag.G { background: color-mix(in srgb, var(--G) 22%, transparent); color: #c4bdf7; }
.tag.D { background: color-mix(in srgb, var(--D) 22%, transparent); color: #a9cdf6; }
.tag.attente { background: color-mix(in srgb, var(--or) 22%, transparent); color: var(--or); }
.tag.off { background: var(--surface-3); color: var(--text-3); }

/* ---------- avatars ---------- */
.av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2);
  font-weight: 700; font-size: 15px; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.xl { width: 104px; height: 104px; font-size: 34px; }
.av-edit { position: relative; display: inline-block; cursor: pointer; }
.av-cam { position: absolute; right: 0; bottom: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--club-1); display: grid; place-items: center; border: 3px solid var(--bg); }
.av-cam svg.i { width: 17px; height: 17px; }

/* ---------- controls ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 0 calc(-1 * var(--pad)) 6px; padding-left: var(--pad); padding-right: var(--pad); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 15px; border-radius: 99px; background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 15px; white-space: nowrap; min-height: 40px; }
.chip.on { background: var(--text); color: var(--bg); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface); padding: 4px; border-radius: 14px; margin-bottom: 12px; }
.seg button { padding: 10px 8px; border-radius: 10px; font-weight: 650; color: var(--text-2); min-height: 42px; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.seg button.on.G { background: var(--G); color: #fff; }
.seg button.on.D { background: var(--D); color: #fff; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 6px; font-weight: 560; }
.input, select.input, textarea.input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px 14px; min-height: 48px; font-size: 17px; }
textarea.input { min-height: 90px; resize: vertical; font-size: 16px; }
.input:focus { outline: none; border-color: var(--club-1-ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--club-1); flex: none; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border-radius: 14px; background: var(--club-1); color: #fff; font-weight: 700; font-size: 17px; padding: 0 18px; }
.btn:active { background: var(--club-1-press); transform: scale(.985); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.sec { background: var(--surface-2); color: var(--text); }
.btn.danger { background: none; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.sm { min-height: 40px; font-size: 15px; width: auto; border-radius: 11px; }
.btns { display: flex; gap: 8px; }
.btns .btn { flex: 1; }
.linkish { color: var(--club-1-ink); font-weight: 600; }
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.stepper button { background: var(--surface-2); border-radius: var(--r-ctl); font-size: 22px; font-weight: 600; }
.stepper .input { text-align: center; }

/* ---------- estimate ---------- */
.estim { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 16px; border-radius: var(--r-card);
  background: color-mix(in srgb, var(--club-1) 20%, var(--surface)); margin-bottom: 14px; }
.estim .k { color: var(--text-2); font-size: 14px; font-weight: 600; }
.estim .v { font-size: 32px; font-weight: 780; letter-spacing: -.02em; }
.estim .v small { font-size: 15px; color: var(--text-2); font-weight: 600; margin-left: 3px; }

/* ---------- podium ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 18px 0 16px; }
.pod { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; width: 100%; }
.pod > span { display: block; }
.pod .ring { position: relative; border-radius: 50%; padding: 3px; background: var(--c); margin-bottom: 8px; }
.pod .ring .av { display: grid; width: 64px; height: 64px; font-size: 22px; border: 3px solid var(--bg); }
.pod.p1 .ring .av { width: 84px; height: 84px; font-size: 28px; }
.pod .medal { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--c);
  color: #16120a; font-weight: 800; font-size: 14px; display: grid; place-items: center; border: 2px solid var(--bg); }
.pod .who { font-weight: 680; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 6px; }
.pod .kg { font-weight: 780; font-size: 20px; letter-spacing: -.01em; }
.pod .kg small { font-size: 12px; color: var(--text-3); font-weight: 600; margin-left: 2px; }
.pod .det { font-size: 12px; color: var(--text-3); }
.pod .socle { width: 100%; margin-top: 10px; border-radius: 12px 12px 4px 4px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, var(--surface)), color-mix(in srgb, var(--c) 8%, var(--surface)));
  border-top: 3px solid var(--c); display: grid; place-items: start center; padding-top: 6px; font-weight: 800; font-size: 22px; color: var(--c); }
.pod.p1 { --c: var(--or); } .pod.p1 .socle { height: 92px; }
.pod.p2 { --c: var(--argent); } .pod.p2 .socle { height: 66px; }
.pod.p3 { --c: var(--bronze); } .pod.p3 .socle { height: 48px; }
.pod.vide .ring { background: var(--surface-3); }
.pod.vide .who { color: var(--text-3); font-weight: 500; }
.pod.moi .who::after { content: " · toi"; color: var(--club-1-ink); }
.pod .ring { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .pod .socle { animation: monte .5s var(--ease) both; transform-origin: bottom; }
  .pod.p2 .socle { animation-delay: .06s; } .pod.p3 .socle { animation-delay: .12s; }
  @keyframes monte { from { transform: scaleY(.2); opacity: 0; } }
}

/* ---------- my place ---------- */
.place { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-card); background: var(--surface); margin-bottom: 12px; }
.place b { font-size: 22px; }

/* ---------- welcome ---------- */
.accueil { text-align: center; padding-top: 8vh; }
.accueil .logo { width: 128px; height: 128px; border-radius: 28px; margin-bottom: 18px; }
.accueil h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.02em; }
.accueil p { color: var(--text-2); max-width: 420px; margin: 0 auto 12px; }

/* ---------- nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); z-index: 10; }
.nav[hidden] { display: none; }
.nav .in { display: flex; width: 100%; max-width: 600px; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.nav a.on { color: var(--text); }
.nav a.on svg.i { color: var(--club-1-ink); }
.nav .pastille { position: absolute; margin: -14px 0 0 22px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--or); color: #16120a; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 5px; }

/* ---------- bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.sheet-box { position: absolute; left: 0; right: 0; bottom: 0; max-width: 600px; margin: 0 auto; max-height: 88dvh; overflow-y: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 20px var(--pad) calc(var(--safe-b) + 20px); }
.sheet-box h2 { margin-top: 0; }
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) .sheet-box { animation: up .32s var(--ease); }
  .sheet:not([hidden]) .sheet-bg { animation: fade .2s ease-out; }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }
  @keyframes fade { from { opacity: 0; } }
}

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 99px; font-weight: 650; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); z-index: 30; width: max-content; max-width: min(90vw, 440px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #1a0d0c; }

.vide-msg { text-align: center; color: var(--text-3); padding: 26px 12px; }
.lien { word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; }
.records { display: grid; grid-template-columns: 1fr auto auto; gap: 0 14px; align-items: center; }
.records > * { padding: 10px 0; border-top: 1px solid var(--line); }
.records .h { border-top: 0; font-size: 12px; color: var(--text-3); font-weight: 650; padding: 0 0 6px; }
.records .n { font-weight: 600; }
.records .r { text-align: right; font-weight: 700; }
.chargement { padding: 30vh 0; text-align: center; color: var(--text-3); }

@media (min-width: 900px) {
  #app { max-width: 760px; }
  .podium { max-width: 560px; margin-left: auto; margin-right: auto; }
}
