/* ==========================================================================
   La Ligue à Dudule — feuille de style
   Mobile-first. Ambiance "boulodrome de Provence" : terre battue, acier,
   crème et bleu nuit.
   ========================================================================== */

:root {
  /* Couleurs */
  --bg: #FBF7F0;
  --bg-2: #F1E7D6;
  --surface: #FFFFFF;
  --surface-2: #FAF5EC;
  --ink: #20303F;
  --ink-soft: #586472;
  --muted: #93887A;
  --line: #ECE3D4;
  --line-strong: #DFD3BE;

  --terra: #C85A38;
  --terra-d: #A8431F;
  --terra-soft: #FBE7DD;
  --olive: #5E7C52;
  --olive-d: #455E3B;
  --olive-soft: #E9F0E2;
  --blue: #2E5A7A;

  --gold: #E0A93B;
  --silver: #9FA8B6;
  --bronze: #C2824E;

  --win: #2E9E5B;
  --win-soft: #E3F4E9;
  --loss: #CF4B3C;
  --loss-soft: #FBE6E3;
  --warn: #E0A93B;

  /* Rayons & ombres */
  --r: 20px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, .06), 0 2px 8px rgba(60, 40, 20, .05);
  --shadow: 0 6px 20px rgba(70, 45, 25, .10), 0 2px 6px rgba(70, 45, 25, .06);
  --shadow-lg: 0 18px 50px rgba(60, 40, 20, .22);

  --maxw: 480px;
  --nav-h: 72px;

  --ease: cubic-bezier(.22, 1, .36, 1);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ----------------------------------------------------------------- Reset */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #FFF4E2 0%, rgba(255,244,226,0) 60%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select { font: inherit; color: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

::selection { background: var(--terra-soft); }

/* Taille par défaut des icônes (surchargée selon le contexte). */
.ic { width: 18px; height: 18px; flex: 0 0 auto; }

/* ----------------------------------------------------------------- App shell */
#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100%;
  position: relative;
}
@media (min-width: 540px) {
  body { padding: 0; }
  #app {
    box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(60,40,20,.14);
    background: var(--bg);
    min-height: 100dvh;
  }
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: linear-gradient(180deg, rgba(251,247,240,.96), rgba(251,247,240,.82));
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
/* .brand prend toute la place dispo (flex:1) pour afficher le nom EN ENTIER ;
   en ligne c'est un <button> (clic → « Mes ligues »), d'où le reset bouton. */
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto;
  background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; }
.topbar button.brand { cursor: pointer; }
.topbar button.brand:active { transform: scale(.985); }
.topbar .brand .logo { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 0; box-shadow: none; }
.topbar .brand .titles { min-width: 0; }
/* Nom de ligue : typo légèrement réduite + jusqu'à 2 lignes (plus de troncature « … »). */
.topbar .brand .club { font-weight: 800; font-size: 14px; letter-spacing: -.2px; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topbar .brand .sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 0; }
.topbar .me { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); }
.topbar .me .me-name { font-size: 12px; font-weight: 700; max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* zone défilante */
.view {
  padding: 16px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px);
  min-height: 60vh;
}
.view-pad-lg { padding-top: 8px; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin: 22px 4px 10px;
}
.section-title:first-child { margin-top: 6px; }
.section-title .count { margin-left: auto; background: var(--bg-2); color: var(--ink-soft); border-radius: 999px; padding: 1px 9px; font-size: 12px; letter-spacing: 0; }

/* ----------------------------------------------------------------- Bottom nav */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: var(--maxw); z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.98));
  backdrop-filter: blur(12px) saturate(1.3);
  border-top: 1px solid var(--line);
}
.nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .01em;
  position: relative; transition: color .2s;
}
.nav button .ic { width: 24px; height: 24px; }
.nav button.active { color: var(--terra); }
.nav button.active .ic { transform: translateY(-1px); }
.nav .badge {
  position: absolute; top: 8px; right: 50%; margin-right: -22px;
  background: var(--terra); color: #fff; font-size: 10px; font-weight: 800;
  min-width: 17px; height: 17px; border-radius: 999px; display: grid; place-items: center;
  padding: 0 4px; box-shadow: 0 2px 6px rgba(200,90,56,.5); border: 2px solid #fff;
}
.nav .fab-slot { position: relative; }
.nav .fab {
  position: absolute; left: 50%; top: -22px; transform: translateX(-50%);
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(120% 120% at 30% 25%, #E2754F, var(--terra) 55%, var(--terra-d));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 22px rgba(200,90,56,.45), inset 0 2px 0 rgba(255,255,255,.3);
  border: 3px solid var(--bg);
  transition: transform .2s var(--ease);
}
.nav .fab:active { transform: translateX(-50%) scale(.94); }
.nav .fab .ic { width: 30px; height: 30px; }
.nav .fab-label { position: absolute; bottom: 9px; left: 0; right: 0; text-align: center; font-size: 10.5px; font-weight: 700; color: var(--terra); }

/* ----------------------------------------------------------------- Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card.pad { padding: 16px; }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 8px; }

/* ----------------------------------------------------------------- Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 14px; font-weight: 800; font-size: 15px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm); transition: transform .12s var(--ease), filter .2s, background .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; }
.btn.lg { padding: 16px 20px; font-size: 16px; border-radius: 16px; }
.btn.sm { padding: 9px 13px; font-size: 13.5px; border-radius: 11px; }
.btn-primary { background: linear-gradient(180deg, #D9683F, var(--terra)); color: #fff; border-color: var(--terra-d); box-shadow: 0 8px 18px rgba(200,90,56,.30); }
.btn-primary:disabled { background: var(--terra); }
.btn-olive { background: linear-gradient(180deg, #6C8C5E, var(--olive)); color: #fff; border-color: var(--olive-d); box-shadow: 0 8px 18px rgba(94,124,82,.28); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-soft); }
.btn-soft { background: var(--terra-soft); color: var(--terra-d); border-color: transparent; box-shadow: none; }
.btn-win { background: linear-gradient(180deg,#37A865,var(--win)); color:#fff; border-color:#268049; box-shadow:0 8px 18px rgba(46,158,91,.28); }
.btn-danger-ghost { background: transparent; color: var(--loss); border-color: transparent; box-shadow: none; }
.btn .ic { width: 19px; height: 19px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ----------------------------------------------------------------- Avatars */
.av {
  --s: 44px;
  width: var(--s); height: var(--s); border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  font-weight: 800; color: #fff; letter-spacing: .02em;
  box-shadow: inset 0 2px 4px rgba(255,255,255,.35), inset 0 -3px 6px rgba(0,0,0,.18), var(--shadow-sm);
  position: relative; overflow: hidden;
  font-size: calc(var(--s) * .38);
}
.av::after { content:""; position:absolute; inset:0; background: radial-gradient(60% 50% at 32% 26%, rgba(255,255,255,.45), rgba(255,255,255,0) 60%); }
.av.ring { box-shadow: inset 0 2px 4px rgba(255,255,255,.35), inset 0 -3px 6px rgba(0,0,0,.18), 0 0 0 3px var(--surface), 0 0 0 5px var(--terra); }
.av-photo { background: var(--line-strong); }
.av-photo::after { display: none; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit { position: relative; display: inline-block; background: none; border: none; padding: 0; cursor: pointer; }
.avatar-edit:active { transform: scale(.96); }
.avatar-edit .cam { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--terra); display: grid; place-items: center; font-size: 14px; border: 2px solid var(--surface); box-shadow: var(--shadow-sm); }
details > summary { cursor: pointer; font-weight: 800; font-size: 13px; color: var(--terra-d); padding: 6px 0; list-style: none; user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 4px; }

/* ----------------------------------------------------------------- Chips / pills */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-soft);
  transition: transform .12s var(--ease), background .2s, color .2s, border-color .2s;
  user-select: none;
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on-terra { background: var(--terra); color: #fff; border-color: var(--terra-d); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chip-row.scroll::-webkit-scrollbar { display: none; }

.pill { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:800; padding:3px 9px; border-radius:999px; letter-spacing:.02em; }
.pill-pending { background: var(--terra-soft); color: var(--terra-d); }
.pill-valid { background: var(--win-soft); color: #1f7a44; }
.pill-disputed { background: var(--loss-soft); color: var(--loss); }
.pill-prov { background: #EEF1F5; color: #5B6573; }
.pill-fanny { background: #2a2a33; color:#FFD27a; }

/* ----------------------------------------------------------------- Forme (5 derniers) */
.form-dots { display: inline-flex; gap: 4px; }
.form-dots i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; background: var(--line-strong); }
.form-dots i.w { background: var(--win); }
.form-dots i.l { background: var(--loss); }

/* ----------------------------------------------------------------- Classement */
.season-banner { background: var(--olive-soft); color: var(--olive-d); border-radius: var(--r-md); padding: 9px 14px; font-size: 13px; font-weight: 700; text-align: center; margin-bottom: 12px; }
.season-banner.ended { background: linear-gradient(180deg,#FFF0D6,#FBE2B4); color: #7a5a00; }

.podium { display: grid; grid-template-columns: 1fr 1.18fr 1fr; align-items: end; gap: 10px; margin: 6px 2px 18px; }
.podium .pod { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 6px 10px; text-align: center; box-shadow: var(--shadow-sm); position: relative; }
.podium .pod .medal { position:absolute; top:-12px; left:50%; transform:translateX(-50%); width:26px; height:26px; border-radius:50%; display:grid; place-items:center; font-size:13px; font-weight:900; color:#5a3d00; box-shadow: var(--shadow-sm); }
.podium .pod.p1 { padding-top: 18px; }
.podium .pod.p1 .medal { background: var(--gold); }
.podium .pod.p2 .medal { background: var(--silver); }
.podium .pod.p3 .medal { background: var(--bronze); }
.podium .pod .av { margin: 4px auto 6px; }
.podium .pod .nm { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .pod .elo { font-size: 15px; font-weight: 900; color: var(--terra-d); }
.podium .pod .base { margin: 8px -6px -10px; border-radius: 0 0 var(--r-md) var(--r-md); }
.podium .pod.p1 .base { height: 30px; background: linear-gradient(180deg,#F2CD6E,#E0A93B); }
.podium .pod.p2 .base { height: 22px; background: linear-gradient(180deg,#C2CAD6,#9FA8B6); }
.podium .pod.p3 .base { height: 16px; background: linear-gradient(180deg,#D6A270,#C2824E); }

.rank-list { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); transition: background .15s; }
.rank-row:last-child { border-bottom: none; }
.rank-row:active { background: var(--surface-2); }
.rank-row .pos { width: 30px; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; }
.rank-row .pos .n { font-weight: 900; font-size: 16px; }
.rank-row .pos .mv { font-size: 9px; font-weight: 800; line-height: 1; margin-top: 1px; }
.mv.up { color: var(--win); } .mv.down { color: var(--loss); } .mv.eq { color: var(--muted); }
.rank-row .who { flex: 1; min-width: 0; }
.rank-row .who .nm { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display:flex; align-items:center; gap:6px; }
.rank-row .who .meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.rank-row .elo { text-align: right; flex: 0 0 auto; }
.rank-row .elo .v { font-weight: 900; font-size: 18px; letter-spacing: -.5px; }
.rank-row .elo .lab { font-size: 9.5px; color: var(--muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* ----------------------------------------------------------------- Stats grid */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 14px; box-shadow: var(--shadow-sm); }
.stat .v { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 700; margin-top: 1px; }
.stat .v small { font-size: 13px; color: var(--ink-soft); font-weight: 800; }

.superlatives .row { display:flex; align-items:center; gap:12px; padding:11px 14px; border-bottom:1px solid var(--line); }
.superlatives .row:last-child { border-bottom:none; }
.superlatives .emoji { font-size:20px; width:26px; text-align:center; }
.superlatives .lab { font-size:12px; color:var(--muted); font-weight:700; }
.superlatives .nm { font-weight:800; }
.superlatives .val { margin-left:auto; font-weight:900; color:var(--terra-d); }

/* ----------------------------------------------------------------- Match cards */
.match { padding: 14px; }
.match .mhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.match .mhead .fmt { font-size: 11.5px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.match .mhead .time { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight:600; }
.match .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.match .team { display: flex; flex-direction: column; gap: 6px; }
.match .team.b { align-items: flex-end; text-align: right; }
.match .team .pl { display: flex; align-items: center; gap: 7px; min-width: 0; }
.match .team.b .pl { flex-direction: row-reverse; }
.match .team .pl .nm { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.match .team .pl .dl { font-size: 11px; font-weight: 800; }
.dl.pos { color: var(--win); } .dl.neg { color: var(--loss); }
.match .score { text-align: center; padding: 0 4px; }
.match .score .sc { font-size: 26px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.match .score .sc .a, .match .score .sc .b { transition: color .2s; }
.match .score .win-a .a { color: var(--win); } .match .score .win-b .b { color: var(--win); }
.match .score .vs { font-size: 11px; color: var(--muted); font-weight: 800; margin-top: 3px; }
.match .mcomment { margin-top: 9px; font-size: 13px; font-style: italic; color: var(--ink-soft); background: var(--surface-2); border-left: 3px solid var(--terra); border-radius: 0 8px 8px 0; padding: 7px 11px; }
.match .mcomment.val { border-left-color: var(--olive); }
.match .mcomment.dispute { border-left-color: var(--loss); background: var(--loss-soft); }
.match .mcomment b { color: var(--ink); font-style: normal; font-weight: 800; margin-right: 4px; }
.reactions { display: flex; gap: 8px; margin-top: 11px; }
.react { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 800; color: var(--ink-soft); transition: transform .12s var(--ease); }
.react:active { transform: scale(.9); }
.react.on { background: var(--terra-soft); border-color: var(--terra); color: var(--terra-d); }
.react span { font-variant-numeric: tabular-nums; }
.match .mfoot { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.match .mfoot .by { font-size: 11.5px; color: var(--muted); }
.winner-arrow { color: var(--win); }

/* --- Cartes parties compactes & dépliables --- */
.match.collapsible { padding: 0; overflow: hidden; }
.msum { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: none; border: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.msum:active { background: var(--surface-2); }
.msum-fmt { font-size: 17px; flex: none; line-height: 1; }
.msum-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.msum-team { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; font-weight: 700; }
.msum-team.r { align-items: flex-end; text-align: right; }
.msum-team.win { color: var(--win); }
.msum-team .pn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Typo & interligne resserrés quand l'équipe grandit (1/2/3 joueurs). */
.msum.sz-1 .pn { font-size: 13.5px; line-height: 1.3; }
.msum.sz-2 .pn { font-size: 12px; line-height: 1.18; }
.msum.sz-3 .pn { font-size: 10.5px; line-height: 1.12; }
.msum-sc { flex: none; font-weight: 900; font-variant-numeric: tabular-nums; font-size: 15px; display: inline-flex; gap: 3px; align-items: baseline; }
.msum-sc i { color: var(--muted); font-style: normal; font-weight: 600; }
.msum-sc b.win { color: var(--win); }
.msum-side { flex: none; display: flex; align-items: center; gap: 7px; }
.msum-side .pill { padding: 2px 8px; font-size: 10.5px; }
.msum-when { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tag.fanny { font-size: 13px; }
.chev { display: inline-flex; color: var(--muted); transition: transform .2s var(--ease); }
.match.collapsible.open .chev { transform: rotate(90deg); }
.mdetails { display: none; padding: 2px 13px 13px; }
.match.collapsible.open .mdetails { display: block; }
@media (max-width: 360px) { .msum-when { display: none; } }

/* ----------------------------------------------------------------- Inputs */
.field { display: block; }
.field .lab { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); margin: 0 2px 7px; }
.input {
  width: 100%; padding: 14px 15px; border-radius: 14px; background: var(--surface);
  border: 1.5px solid var(--line-strong); font-size: 16px; font-weight: 600; transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--terra); box-shadow: 0 0 0 4px var(--terra-soft); }
.input::placeholder { color: var(--muted); font-weight: 500; }

/* sélecteur de format en grandes cartes */
.fmt-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.fmt-card { background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-md); padding: 16px 8px; text-align: center; transition: transform .12s var(--ease), border-color .2s, background .2s; box-shadow: var(--shadow-sm); }
.fmt-card:active { transform: scale(.96); }
.fmt-card.on { border-color: var(--terra); background: var(--terra-soft); }
.fmt-card .big { font-size: 26px; font-weight: 900; color: var(--terra-d); }
.fmt-card .t { font-size: 12.5px; font-weight: 800; margin-top: 2px; }
.fmt-card .d { font-size: 10.5px; color: var(--muted); }

/* sélection de joueurs */
.pick { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface); transition: border-color .2s, background .2s; }
.pick.on-a { border-color: var(--terra); background: var(--terra-soft); }
.pick.on-b { border-color: var(--blue); background: #E6F0F6; }
.pick .nm { font-weight: 700; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pick .side { font-size: 11px; font-weight: 900; padding: 3px 8px; border-radius: 999px; }
.pick .side.a { background: var(--terra); color:#fff; }
.pick .side.b { background: var(--blue); color:#fff; }

.teamcol h4 { font-size:12px; font-weight:900; letter-spacing:.05em; text-transform:uppercase; margin: 0 2px 8px; display:flex; align-items:center; gap:6px; }
.teamcol .dot { width:10px; height:10px; border-radius:50%; }
.teamcol.a .dot { background: var(--terra); } .teamcol.b .dot { background: var(--blue); }

/* stepper de score */
.scorebox { display:grid; grid-template-columns: 1fr auto 1fr; gap:10px; align-items:center; }
.scorehalf { text-align:center; padding:14px 8px; border-radius: var(--r-md); border:1.5px solid var(--line-strong); background: var(--surface); }
.scorehalf.winner { border-color: var(--win); background: var(--win-soft); }
.scorehalf .lbl { font-size:11px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.scorehalf .num { font-size:40px; font-weight:900; letter-spacing:-2px; line-height:1.1; }
.scorehalf .crown { font-size:14px; }
.stepper { display:inline-flex; align-items:center; gap:8px; margin-top:6px; }
.stepper button { width:34px; height:34px; border-radius:50%; background: var(--surface-2); border:1px solid var(--line-strong); font-size:20px; font-weight:800; display:grid; place-items:center; }
.stepper button:active { transform: scale(.9); }
.stepbtn { width:52px; height:52px; border-radius:50%; background: var(--surface); border:1.5px solid var(--line-strong); font-size:26px; font-weight:800; display:grid; place-items:center; box-shadow: var(--shadow-sm); color: var(--terra-d); }
.stepbtn:active { transform: scale(.9); }
.swap-btn { width:42px; height:42px; border-radius:50%; background: var(--surface); border:1px solid var(--line-strong); display:grid; place-items:center; box-shadow:var(--shadow-sm); }

/* ----------------------------------------------------------------- Badges (succès) */
.badges { display:grid; grid-template-columns: repeat(4,1fr); gap:10px; }
.badge-it { text-align:center; }
.badge-it .ic { width:54px; height:54px; margin:0 auto 5px; border-radius:16px; display:grid; place-items:center; font-size:26px; background: var(--surface); border:1px solid var(--line); box-shadow: var(--shadow-sm); }
.badge-it.earned .ic { background: linear-gradient(180deg,#FFF0D6,#FBE2B4); border-color:#F0CE84; }
.badge-it.locked { opacity:.45; filter: grayscale(.7); }
.badge-it .nm { font-size:10px; font-weight:800; line-height:1.15; }

/* ----------------------------------------------------------------- Chart */
.chart { width:100%; height:150px; }
.chart .area { fill: rgba(200,90,56,.12); }
.chart .line { fill:none; stroke: var(--terra); stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; }
.chart .grid { stroke: var(--line); stroke-width:1; }
.chart .dot { fill: var(--terra); }
.chart .axis-lbl { fill: var(--muted); font-size:9px; font-weight:700; }

/* ----------------------------------------------------------------- H2H */
.h2h .row { display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--line); }
.h2h .row:last-child { border-bottom:none; }
.h2h .nm { font-weight:700; flex:1; }
.h2h .rec { font-weight:900; font-variant-numeric: tabular-nums; }
.h2h .rec .w { color: var(--win); } .h2h .rec .l { color: var(--loss); }
.h2h .bar { width:64px; height:6px; border-radius:999px; background: var(--loss-soft); overflow:hidden; }
.h2h .bar i { display:block; height:100%; background: var(--win); }

/* ----------------------------------------------------------------- Empty state */
.empty { text-align:center; padding: 40px 24px; color: var(--muted); }
.empty .em { font-size: 44px; margin-bottom: 10px; }
.empty .em-art { line-height: 0; margin-bottom: 14px; }
.empty .t { font-weight: 800; color: var(--ink-soft); font-size: 16px; }
.empty .d { font-size: 13.5px; margin-top: 4px; }

/* ----------------------------------------------------------------- Toast */
#toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: var(--maxw); width: max-content; max-width: calc(100% - 8px);
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  animation: toast-in .35s var(--ease);
}
.toast.out { animation: toast-out .3s var(--ease) forwards; }
.toast .em { font-size: 18px; }
.toast.good { background: #1f7a44; } .toast.bad { background: var(--loss); } .toast.terra { background: var(--terra-d); }
@keyframes toast-in { from { transform: translateY(16px) scale(.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(16px) scale(.96); opacity: 0; } }

/* ----------------------------------------------------------------- Dialog / sheet */
#dialog-host:empty { display:none; }
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(30,20,10,.45); backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@media (min-width:540px){ .scrim { align-items:center; } }
@keyframes fade { from { opacity:0; } }
.sheet {
  position: relative;
  width: 100%; max-width: var(--maxw); background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 20px); box-shadow: var(--shadow-lg);
  animation: sheet-up .32s var(--ease); max-height: 88vh; overflow-y: auto;
}
@media (min-width:540px){ .sheet { border-radius: 24px; margin-bottom: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 4px auto 14px; }
.sheet h3 { font-size: 19px; font-weight: 900; letter-spacing: -.3px; margin: 0 2px 4px; }
.sheet .sub { color: var(--ink-soft); font-size: 14px; margin: 0 2px 16px; }
/* Croix de fermeture optionnelle (openSheet closable:true). */
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
  font-size: 14px; font-weight: 800; line-height: 1;
}
.sheet-close:active { transform: scale(.94); }

.list-pick { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.list-pick button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.list-pick button:last-child { border-bottom: none; }
.list-pick button:active { background: var(--surface-2); }
.list-pick .nm { font-weight: 700; flex: 1; }
.list-pick .chk { color: var(--terra); }

/* ----------------------------------------------------------------- Onboarding */
.onb { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 24px) 22px calc(env(safe-area-inset-bottom) + 24px); }
.onb .hero { text-align: center; margin: 18px 0 26px; }
.onb .hero img { width: 96px; height: 96px; margin: 0 auto 14px; border-radius: 26px; box-shadow: var(--shadow); }
.onb .hero h1 { font-size: 30px; font-weight: 900; letter-spacing: -.6px; line-height: 1.05; }
.onb .hero h1 .accent { color: var(--terra); }
.onb .hero p { color: var(--ink-soft); margin-top: 8px; font-size: 15px; }
/* Logo complet (mascotte + typo) : remplace l'icône carrée + le titre texte.
   Le PNG a déjà son contour blanc → pas de coins arrondis ni d'ombre. */
.onb .hero img.hero-logo {
  width: auto; height: auto; max-width: 200px; max-height: 240px;
  margin: 0 auto 4px; border-radius: 0; box-shadow: none;
}
.onb .grow { flex: 1; }
.steps { display:flex; gap:6px; justify-content:center; margin-bottom: 18px; }
.steps i { width: 26px; height: 5px; border-radius: 999px; background: var(--line-strong); }
.steps i.on { background: var(--terra); }
.player-chips { display:flex; flex-wrap:wrap; gap:8px; }
.player-chips .pc { display:inline-flex; align-items:center; gap:7px; padding:7px 8px 7px 8px; border-radius:999px; background:var(--surface); border:1px solid var(--line-strong); box-shadow:var(--shadow-sm); }
.player-chips .pc .x { width:18px; height:18px; border-radius:50%; background:var(--bg-2); display:grid; place-items:center; font-size:12px; color:var(--muted); }
.add-row { display:flex; gap:8px; }
.add-row .input { flex:1; }

/* ----------------------------------------------------------------- Divers */
.center { text-align: center; }
.muted { color: var(--muted); }
.soft { color: var(--ink-soft); }
.tnum { font-variant-numeric: tabular-nums; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; }
.notice { background: var(--terra-soft); color: var(--terra-d); border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; font-weight: 600; display:flex; gap:10px; align-items:flex-start; }
.notice .em { font-size: 16px; }
.divider { height:1px; background: var(--line); margin: 18px 0; }
.row-link { display:flex; align-items:center; gap:12px; padding:14px; width:100%; text-align:left; border-bottom:1px solid var(--line); }
.row-link:last-child { border-bottom:none; }
.row-link:active { background: var(--surface-2); }
.row-link .ic { width:20px; height:20px; color: var(--ink-soft); }
.row-link .t { font-weight:700; flex:1; }
.row-link .r { color: var(--muted); font-size:13px; }
.row-link.danger .t, .row-link.danger .ic { color: var(--loss); }

.fade-in { animation: fadein .35s var(--ease); }
@keyframes fadein { from { opacity:0; transform: translateY(6px); } }

.big-elo { font-size:46px; font-weight:900; letter-spacing:-2px; line-height:1; }
.peak { font-size:12px; color:var(--muted); font-weight:700; }

/* ── Cloche de notifications (topbar) ── */
.topbar .bell { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink-soft); margin-right: 8px; }
.topbar .bell .ic { width: 20px; height: 20px; }
.topbar .bell:active { background: var(--surface-2); }
.topbar .bell .badge { position: absolute; top: -4px; right: -4px; background: var(--terra); color: #fff; font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--surface); }

/* ── Note de délai sur les cartes de parties (compte à rebours) ── */
.match .mmeta { margin-top: 9px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); background: var(--surface-2); border-radius: 8px; padding: 7px 11px; }

/* ── Réglages : interrupteurs de notifications ── */
.notif-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-row:last-child { border-bottom: none; }
.notif-row .txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-row .txt b { font-weight: 700; font-size: 14px; }
.notif-row .txt small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.notif-row input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--terra); }

/* ── Feed de notifications ── */
.notif-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 14px; }
.notif-item .ni-emoji { font-size: 22px; flex: 0 0 auto; }
.notif-item .ni-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-item .ni-title { font-weight: 800; font-size: 14px; }
.notif-item .ni-body { font-size: 13px; color: var(--ink-soft); line-height: 1.35; }
.notif-item .ni-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-item .ic { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.notif-item .ni-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--terra); flex: 0 0 auto; }
.notif-item.unread { background: var(--terra-soft); }

/* ----------------------------------------------------------------- Vidéo "Fanny" */
.fanny-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(40,28,16,.82), rgba(15,10,6,.94));
  backdrop-filter: blur(6px);
  animation: fanny-in .28s var(--ease);
}
.fanny-overlay.out { animation: fanny-out .24s var(--ease) forwards; }
@keyframes fanny-in { from { opacity: 0; } }
@keyframes fanny-out { to { opacity: 0; } }

.fanny-video {
  width: 100%; max-width: 440px; max-height: 64vh;
  border-radius: var(--r); background: #000;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.06);
  object-fit: contain;
}

.fanny-cap { text-align: center; color: #fff; animation: fanny-pop .5s var(--ease) both; }
.fanny-skull { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.fanny-title {
  font-size: 34px; font-weight: 900; letter-spacing: 1px; margin-top: 4px;
  color: var(--gold); text-shadow: 0 2px 14px rgba(224,169,59,.5);
}
.fanny-sub { font-size: 14px; color: rgba(255,255,255,.82); margin-top: 2px; }
@keyframes fanny-pop { from { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.08); } }

.fanny-skip {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 16px;
  border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700;
  color: #fff; background: rgba(255,255,255,.16); border-radius: 999px;
  padding: 8px 14px; backdrop-filter: blur(4px);
}
.fanny-skip:active { transform: scale(.96); }

.fanny-unmute {
  border: 0; cursor: pointer; font: inherit; font-size: 14px; font-weight: 800;
  color: #20303F; background: var(--gold); border-radius: 999px;
  padding: 10px 18px; box-shadow: var(--shadow);
}
.fanny-unmute:active { transform: scale(.96); }

/* ---------- Vidéo d'intro (animation du logo, plein écran, à chaque ouverture) ---------- */
.intro-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  animation: fanny-in .28s var(--ease);
}
.intro-overlay.out { animation: fanny-out .3s var(--ease) forwards; }
.intro-video {
  width: 100%; height: 100%;
  object-fit: cover;          /* vrai plein écran vertical (logo centré → marge sûre) */
  background: #000;
  opacity: 0;                 /* caché tant que la 1re image n'est pas peinte (sinon placeholder noir + bouton play) */
  transition: opacity .18s ease;
}
.intro-video.is-playing { opacity: 1; }
.intro-skip {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 16px;
  border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700;
  color: #fff; background: rgba(255,255,255,.16); border-radius: 999px;
  padding: 8px 14px; backdrop-filter: blur(4px);
}
.intro-skip:active { transform: scale(.96); }
.intro-unmute {
  position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%; transform: translateX(-50%);
  border: 0; cursor: pointer; font: inherit; font-size: 14px; font-weight: 800;
  color: #20303F; background: var(--gold); border-radius: 999px;
  padding: 10px 18px; box-shadow: var(--shadow);
}
.intro-unmute:active { transform: translateX(-50%) scale(.96); }
