/* =====================================================================
   TOP FLOP — design « Vestiaire » (C)
   Toutes les couleurs, polices, rayons et espacements sont définis ici.
   Textes ≥ 4.5:1 sur leurs fonds, en clair comme en sombre.
   ===================================================================== */
:root {
  /* Base neutre « pierre » */
  --bg: #f1f0ee;
  --surface: #ffffff;
  --surface-2: #e8e6e3;
  --line: #dad8d4;
  --text: #17161a;
  --muted: #5e5c64;
  /* Un seul accent : violet */
  --accent: #7b3fe4;
  --accent-ink: #ffffff;
  --accent-text: #6a2fd6;
  --accent-soft: #eee6fd;
  /* TOP / FLOP (toujours avec ▲ / ▼) */
  --top: #0f8457;
  --top-ink: #ffffff;
  --top-soft: #ddf1e6;
  --top-text: #0b6e48;
  --flop: #d63b45;
  --flop-ink: #ffffff;
  --flop-soft: #fbe3e4;
  --flop-text: #b32c36;
  /* Présences (jamais vert TOP ni rouge FLOP) */
  --present: var(--accent);
  --present-ink: var(--accent-ink);
  --present-soft: var(--accent-soft);
  --present-text: var(--accent-text);
  --maybe: #e8a91c;
  --maybe-ink: #2b1d00;
  --maybe-soft: #fbefd5;
  --maybe-text: #7a5000;
  --absent: #6d6b73;
  --absent-ink: #ffffff;
  --absent-soft: #e8e6e3;
  --absent-text: #55535b;
  /* Avatars par défaut : monochromes */
  --avatar: #e3ddf3;
  --avatar-ink: #3a2370;
  /* Effets */
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(20, 10, 40, .07);
  --card-border: 0 0 0 0 transparent;
  --scrim: rgba(18, 17, 21, .5);
  --dock-fade: rgba(241, 240, 238, 0);
  /* Polices (2 familles) */
  --font-display: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Rayons */
  --r-lg: 24px;
  --r: 18px;
  --r-sm: 14px;
  --r-pill: 999px;
  /* Espacements */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 28px;
  --tap: 48px;
  --btn-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121115;
    --surface: #1c1b20;
    --surface-2: #26252b;
    --line: #323138;
    --text: #f2f0f5;
    --muted: #a7a4af;
    --accent: #a784ff;
    --accent-ink: #17093a;
    --accent-text: #b79bff;
    --accent-soft: #2c2245;
    --top: #3fd38f;
    --top-ink: #04160d;
    --top-soft: #13302a;
    --top-text: #5edfa3;
    --flop: #ff6470;
    --flop-ink: #1f0508;
    --flop-soft: #3b1820;
    --flop-text: #ff8c95;
    --maybe: #f6c453;
    --maybe-ink: #2b1d00;
    --maybe-soft: #3a2f10;
    --maybe-text: #f6c453;
    --absent: #a7a4af;
    --absent-ink: #121115;
    --absent-soft: #26252b;
    --absent-text: #b9b6c0;
    --avatar: #302a42;
    --avatar-ink: #e9e1ff;
    --shadow: 0 0 0 0 transparent;
    --card-border: 0 0 0 1px #323138;
    --scrim: rgba(0, 0, 0, .6);
    --dock-fade: rgba(18, 17, 21, 0);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
img { display: block; }
svg { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, .title, .display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.08;
  margin: 0;
}
h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }
.stack > * + * { margin-top: var(--s3); }
.stack-lg > * + * { margin-top: var(--s5); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
/* Les textes longs (noms, titres) passent à la ligne : rien n'est coupé. */
.ellipsis { min-width: 0; overflow-wrap: break-word; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Barre du haut : retour toujours en haut à gauche ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); color: var(--text);
  padding: calc(var(--safe-top) + 6px) max(6px, env(safe-area-inset-right)) 6px max(6px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 2px;
  min-height: calc(var(--safe-top) + 62px);
}
.bar .title { flex: 1; min-width: 0; padding: 0 8px; }
.bar .title.with-back { padding-left: 2px; }
.bar .title b { display: block; font-size: 22px; font-weight: 800; overflow-wrap: break-word; }
.bar .title small { display: block; font-family: var(--font); font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-top: 1px; overflow-wrap: break-word; }
.icon-btn {
  width: var(--tap); height: var(--tap);
  display: inline-grid; place-items: center;
  border: 0; background: transparent; color: inherit;
  border-radius: var(--r-pill); text-decoration: none; flex: none;
  transition: background .15s, transform .1s;
}
.icon-btn:active { background: var(--surface-2); transform: scale(.94); }
.icon-btn svg { width: 24px; height: 24px; }
.bar .sport-ico { width: 22px; height: 22px; color: var(--muted); flex: none; margin-left: 6px; }
.bar .sport-ico svg { width: 22px; height: 22px; }

.page {
  padding: var(--s2) max(16px, env(safe-area-inset-right)) var(--s6) max(16px, env(safe-area-inset-left));
  max-width: 640px; margin: 0 auto;
}

/* ---------- Bas d'écran : action principale à portée de pouce ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 18px max(16px, env(safe-area-inset-right)) calc(14px + var(--safe-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, var(--dock-fade), var(--bg) 26%);
  pointer-events: none;
}
.dock > div { max-width: 608px; margin: 0 auto; display: grid; gap: 10px; pointer-events: auto; }
body.has-dock .credit { padding-bottom: calc(var(--dock-h, 96px) + 18px + var(--safe-bottom)); }

/* ---------- Cartes & listes ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow), var(--card-border);
  padding: var(--s4);
}
.card-link { display: block; color: inherit; text-decoration: none; transition: transform .12s ease; }
.card-link:active { transform: scale(.98); }
.label {
  font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: var(--s6) 4px var(--s3);
}
.label:first-child { margin-top: var(--s2); }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.rows { padding: 4px 0; }
.rows > * { padding-left: var(--s4); padding-right: var(--s4); }
.rows > * + * { border-top: 1px solid var(--line); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--btn-h); padding: 0 22px; width: 100%;
  border-radius: var(--r-pill); border: 0;
  font-weight: 700; font-size: 17px; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  transition: transform .1s ease, filter .15s, opacity .15s;
  position: relative;
}
.btn:active { transform: scale(.97); filter: brightness(.94); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.busy { pointer-events: none; color: transparent; }
.btn.busy::after {
  content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid currentColor; border-color: var(--accent-ink) transparent var(--accent-ink) transparent;
  animation: spin .7s linear infinite;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.soft { background: var(--surface-2); color: var(--text); }
.btn.soft.busy::after, .btn.ghost.busy::after { border-color: var(--text) transparent var(--text) transparent; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: var(--flop-soft); color: var(--flop-text); }
.btn.flop { background: var(--flop); color: var(--flop-ink); }
.btn.small { min-height: var(--tap); font-size: 16px; padding: 0 16px; width: auto; }
.btn.link { background: none; color: var(--accent-text); min-height: var(--tap); width: auto; padding: 0 8px; }
.btn.link.danger-text { color: var(--flop-text); }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
.btn-row.wrap { flex-wrap: wrap; }
.btn-row.wrap > .btn { flex: 1 1 auto; }
.links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; margin-top: var(--s4); }

/* ---------- Formulaires ---------- */
.field { display: block; }
.field > span, .field-label { display: block; font-weight: 700; font-size: 16px; margin: 0 4px 8px; }
.input {
  width: 100%; min-height: var(--btn-h); padding: 12px 16px;
  border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: var(--surface); font-size: 17px; outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 15px; color: var(--muted); margin: 8px 4px 0; }
/* Précision en gris à côté d'un libellé (même ligne si possible). */
.field-hint { display: inline-block; font-size: 15px; font-weight: 400; color: var(--muted); }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.chip {
  min-height: 76px; border-radius: var(--r); border: 0; background: var(--surface);
  box-shadow: var(--shadow), var(--card-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 15px; font-weight: 600; padding: 8px 4px; transition: transform .1s;
}
.chip:active { transform: scale(.96); }
.chip svg { width: 24px; height: 24px; color: var(--muted); }
.chip[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.chip[aria-pressed="true"] svg { color: var(--accent-text); }

.seg { display: flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 4px; gap: 4px; }
.seg > * {
  flex: 1; min-height: var(--tap); border: 0; border-radius: var(--r-pill); background: transparent;
  font-weight: 700; font-size: 16px; color: var(--muted); display: grid; place-items: center;
  text-decoration: none; transition: background .15s, color .15s;
}
.seg > [aria-pressed="true"], .seg > [aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg.big > * { font-family: var(--font-display); font-size: 20px; font-weight: 800; }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); font-size: 24px; font-weight: 700; transition: transform .1s; }
.stepper button:active { transform: scale(.92); }
.stepper output { min-width: 56px; text-align: center; font-family: var(--font-display); font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }

.switch-row { display: flex; align-items: center; gap: 12px; min-height: var(--tap); }

/* ---------- Avatars ---------- */
.av {
  --size: 44px;
  width: var(--size); height: var(--size); border-radius: 50%;
  object-fit: cover; flex: none; display: inline-grid; place-items: center;
  background: var(--avatar); color: var(--avatar-ink);
  font-family: var(--font-display); font-weight: 800; font-size: calc(var(--size) * .38); letter-spacing: .01em;
}
.av-xs { --size: 28px; }
.av-sm { --size: 40px; }
.av-lg { --size: 56px; }
.av-xl { --size: 96px; }
.av-xxl { --size: 120px; }

.photo-pick { display: flex; align-items: center; gap: 14px; }
.photo-pick .ph {
  width: 72px; height: 72px; border-radius: 50%; border: 2px dashed var(--line);
  display: grid; place-items: center; overflow: hidden; background: var(--surface); flex: none; padding: 0;
  transition: transform .1s;
}
.photo-pick .ph:active { transform: scale(.94); }
.photo-pick .ph svg { width: 28px; height: 28px; color: var(--muted); }
.photo-pick .ph img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Logo ---------- */
.brand { padding: calc(var(--safe-top) + 18px) 20px 6px; max-width: 640px; margin: 0 auto; }
.logo { font-family: var(--font-display); font-weight: 800; font-size: 34px; letter-spacing: -.04em; line-height: 1; display: inline-flex; align-items: center; gap: 1px; }
.logo .dot { color: var(--accent-text); }
.logo .marks { margin-left: 8px; display: inline-grid; gap: 2px; font-size: 13px; line-height: 1; }
.logo .marks .t { color: var(--top); }
.logo .marks .f { color: var(--flop); }

/* ---------- Badges & pastilles ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px;
  padding: 0 11px; border-radius: var(--r-pill); font-size: 14px; font-weight: 700;
  background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.badge.soft { background: var(--accent-soft); color: var(--accent-text); }
.badge.top { background: var(--top-soft); color: var(--top-text); }
.badge.flop { background: var(--flop-soft); color: var(--flop-text); }
.badge.grey { background: var(--surface-2); color: var(--muted); }
.badge .countdown { font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.chev { color: var(--muted); width: 20px; height: 20px; flex: none; }

/* ---------- Accueil ---------- */
.todo .kick { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--muted); min-width: 0; }
.todo .kick svg { width: 18px; height: 18px; flex: none; }
.todo .kick span { min-width: 0; overflow-wrap: break-word; }
.todo .head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.todo .head h3 { font-size: 24px; min-width: 0; overflow-wrap: break-word; }
.todo .big-clock { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent-text); flex: none; }
.todo.urgent { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.todo .done { display: flex; align-items: center; gap: 8px; min-height: 52px; font-weight: 700; color: var(--accent-text); }
.todo .done svg { width: 20px; height: 20px; }
.team { display: flex; align-items: center; gap: 14px; padding-top: 14px; padding-bottom: 14px; color: inherit; text-decoration: none; transition: background .15s; }
.team:active { background: var(--surface-2); }
.team .ico { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.team .ico svg { width: 24px; height: 24px; }
.team b { display: block; font-size: 17px; overflow-wrap: break-word; }
.team small { color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rows > a:first-child { border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
.rows > a:last-child { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }

.empty { text-align: center; padding: 36px 16px 8px; }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.empty .ico svg { width: 28px; height: 28px; }
.empty p { margin: 6px 0 18px; color: var(--muted); }

/* ---------- Bandeaux ---------- */
.banner { border-radius: var(--r); padding: 12px 14px; background: var(--accent-soft); color: var(--text); font-size: 15px; font-weight: 500; }
.banner.warn { background: var(--maybe-soft); color: var(--text); }
.banner a { font-weight: 700; }

/* ---------- Groupe ---------- */
.match-card .top-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.match-card .top-line > .badge, .match-card .top-line > .pchip { flex: none; }
.match-card h3 { font-size: 20px; overflow-wrap: break-word; padding-top: 2px; }
.match-card .meta { font-size: 15px; color: var(--muted); margin-top: 3px; }
.match-card .res { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.match-card.todo-card { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }

.countdown { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }
.countdown.urgent { color: var(--flop-text); }
@media (prefers-reduced-motion: no-preference) {
  .countdown.urgent { animation: tick 1s steps(1) infinite; }
  @keyframes tick { 50% { opacity: .5; } }
}

/* Anneau du chrono de vote */
.ring { position: relative; width: 68px; height: 68px; flex: none; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring .arc { stroke: var(--accent); transition: stroke-dashoffset .25s linear, stroke .3s; }
.ring.urgent .arc { stroke: var(--flop); }
.ring .countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; }
@media (prefers-reduced-motion: no-preference) {
  .ring.urgent { animation: throb 1s ease-in-out infinite; }
  @keyframes throb { 50% { transform: scale(1.07); } }
}

/* ---------- Grille de joueurs ---------- */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.ptile {
  position: relative; border: 0; background: var(--surface); box-shadow: var(--shadow), var(--card-border);
  border-radius: var(--r-lg); padding: 14px 4px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; min-height: 116px; text-align: center; line-height: 1.15;
  transition: transform .12s ease, box-shadow .15s, background .15s, opacity .15s;
}
.ptile:active { transform: scale(.94); }
.ptile .name { max-width: 100%; padding: 0 6px; overflow-wrap: break-word; }
.ptile .check {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; color: var(--accent-ink);
}
.ptile .check svg { width: 15px; height: 15px; opacity: 0; }
.ptile[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.ptile[aria-pressed="true"] .check { background: var(--accent); }
.ptile[aria-pressed="true"] .check svg { opacity: 1; }
.ptile.off { opacity: .5; }
.ptile.off .av { filter: grayscale(1); }
.ptile[data-pick="top"] { box-shadow: inset 0 0 0 2.5px var(--top); background: var(--top-soft); }
.ptile[data-pick="flop"] { box-shadow: inset 0 0 0 2.5px var(--flop); background: var(--flop-soft); }
.ptile .tag {
  position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px;
}
.ptile .tag.top { background: var(--top); color: var(--top-ink); }
.ptile .tag.flop { background: var(--flop); color: var(--flop-ink); }
@media (prefers-reduced-motion: no-preference) {
  .ptile[data-pick] { animation: picked .28s cubic-bezier(.2, 1.4, .4, 1); }
  @keyframes picked { 40% { transform: scale(.92); } }
}

/* ---------- Vote ---------- */
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.steps span { height: 5px; border-radius: 3px; background: var(--line); transition: background .25s; }
.steps .on-top { background: var(--top); }
.steps .on-flop { background: var(--flop); }
.question { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 14px; }
.question h2 { font-size: 30px; }
.question em { font-style: normal; }
.question em.top { color: var(--top-text); }
.question em.flop { color: var(--flop-text); }
.ballot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot {
  display: flex; align-items: center; gap: 8px; min-height: 52px; border-radius: var(--r-sm); padding: 6px 10px;
  font-weight: 700; font-size: 16px; background: var(--surface); border: 1.5px dashed var(--line); color: var(--muted); min-width: 0;
  transition: transform .1s, background .15s;
}
.slot:active { transform: scale(.97); }
.slot .nm { color: var(--text); min-width: 0; overflow-wrap: break-word; line-height: 1.15; }
.slot.top.filled { border: 0; background: var(--top-soft); color: var(--top-text); }
.slot.flop.filled { border: 0; background: var(--flop-soft); color: var(--flop-text); }
.slot.top.next { border-color: var(--top); color: var(--top-text); }
.slot.flop.next { border-color: var(--flop); color: var(--flop-text); }
.share-row { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; margin-bottom: 14px; }
.share-row .grow { font-size: 15px; font-weight: 600; }

.status-hero { text-align: center; padding: 26px 16px 20px; }
.status-hero .ico { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.status-hero .ico svg { width: 30px; height: 30px; }
.status-hero p { margin: 8px 0 0; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.pick-line { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); }
.pick-line.top { background: var(--top-soft); }
.pick-line.flop { background: var(--flop-soft); }
.pick-line .k { font-weight: 800; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.pick-line.top .k { color: var(--top-text); }
.pick-line.flop .k { color: var(--flop-text); }
.pick-line b { font-size: 17px; }

/* ---------- Tableau de bord ---------- */
.tally { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.tally h3 { font-size: 18px; margin-bottom: 6px; }
.tally .top h3 { color: var(--top-text); }
.tally .flop h3 { color: var(--flop-text); }
.tally-row { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-top: 8px; }
.tally-row .n { font-family: var(--font-display); font-size: 20px; font-weight: 800; min-width: 18px; text-align: right; }
.bar-mini { height: 6px; border-radius: 9px; margin-top: 4px; }
.top .bar-mini { background: var(--top); }
.flop .bar-mini { background: var(--flop); }
.vote-line { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.vote-line .picks { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

/* ---------- Présences ---------- */
.presence-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.presence-pick button {
  min-height: 56px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; font-size: 16px; padding: 6px 4px; line-height: 1.1; text-align: center;
  transition: transform .1s ease, background .15s, border-color .15s, color .15s;
}
.presence-pick button:active { transform: scale(.95); }
.presence-pick .ico { font-size: 16px; font-weight: 800; }
.presence-pick .present[aria-pressed="true"] { background: var(--present); border-color: var(--present); color: var(--present-ink); }
.presence-pick .maybe[aria-pressed="true"] { background: var(--maybe); border-color: var(--maybe); color: var(--maybe-ink); }
.presence-pick .absent[aria-pressed="true"] { background: var(--absent); border-color: var(--absent); color: var(--absent-ink); }
.pcounts { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; white-space: nowrap; padding: 0 11px; border-radius: var(--r-pill); font-size: 14px; font-weight: 700; }
.pchip b { font-weight: 800; }
.pchip.present { background: var(--present-soft); color: var(--present-text); }
.pchip.maybe { background: var(--maybe-soft); color: var(--maybe-text); }
.pchip.absent { background: var(--absent-soft); color: var(--absent-text); }
.pchip.none { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.pchip-btn { border: 0; background: none; padding: 0 0 0 6px; min-height: var(--tap); flex: none; display: grid; place-items: center; }
.pchip-btn .pchip.none { box-shadow: inset 0 0 0 1.5px var(--muted); color: var(--text); }
.member-row { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; min-height: 60px; }
.member-row .sub { font-size: 14px; color: var(--muted); }

/* ---------- Résultats ---------- */
.reveal-top { text-align: center; padding: 24px 16px 22px; overflow: hidden; }
.reveal-top .kicker, .reveal-flop .kicker { font-weight: 800; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; }
.reveal-top .kicker { color: var(--top-text); }
.reveal-top .who { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 22px; margin-top: 16px; }
.reveal-top .who > div { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.reveal-top .av { box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px var(--top); }
.reveal-top .nm { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1.02; letter-spacing: -.025em; overflow-wrap: break-word; }
.reveal-top .who.many .nm { font-size: 26px; }
.reveal-top .votes { font-weight: 700; color: var(--muted); margin-top: -4px; }
.reveal-flop { margin-top: 10px; padding: 14px 16px; }
.reveal-flop .kicker { color: var(--flop-text); font-size: 13px; }
.reveal-flop .line { display: flex; align-items: center; gap: 14px; }
.reveal-flop .line + .line { margin-top: 10px; }
.reveal-flop .av { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--flop); }
.reveal-flop .nm { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1.05; letter-spacing: -.02em; overflow-wrap: break-word; }
.reveal-flop .v { margin-left: auto; font-weight: 700; color: var(--muted); font-size: 15px; white-space: nowrap; }
.suspense { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--muted); padding: 56px 0; text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .anim-pop .av { animation: popin .7s cubic-bezier(.2, 1.3, .4, 1) .1s both; }
  .anim-pop .nm, .anim-pop .votes { animation: rise .5s ease-out .4s both; }
  .anim-rise { animation: rise .5s ease-out both; }
  .anim-pulse { animation: pulse 1s ease-in-out infinite; }
  @keyframes popin { from { transform: scale(.4); opacity: 0; } }
  @keyframes rise { from { transform: translateY(14px); opacity: 0; } }
  @keyframes pulse { 50% { opacity: .45; } }
}

/* ---------- Classement ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: end; gap: 8px; margin: 18px 0 14px; }
.podium .spot { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.podium .nm { font-weight: 700; font-size: 15px; max-width: 100%; overflow-wrap: break-word; text-align: center; line-height: 1.2; }
.podium .block {
  width: 100%; border-radius: var(--r-sm) var(--r-sm) 6px 6px; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; padding-top: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums;
}
.podium .block small { font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.podium .p1 .block { height: 108px; background: var(--accent); color: var(--accent-ink); }
.podium .p1 .block small { color: inherit; opacity: .85; }
.podium .p2 .block { height: 80px; }
.podium .p3 .block { height: 62px; }
.podium .p1 .av { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent); }
.rank-row { display: flex; align-items: center; gap: 12px; padding-top: 11px; padding-bottom: 11px; }
.rank-row .r { width: 24px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.rank-row .who b { display: block; font-size: 16px; overflow-wrap: break-word; line-height: 1.25; }
.rank-row .who b span { font-weight: 500; color: var(--muted); }
.rank-row .tf { display: flex; flex-wrap: wrap; column-gap: 10px; font-size: 14px; font-weight: 600; margin-top: 1px; }
.rank-row .tf > span { white-space: nowrap; }
.rank-row .tf .t { color: var(--top-text); }
.rank-row .tf .f { color: var(--flop-text); }
.rank-row .tf .m { color: var(--muted); font-weight: 500; }
.rank-row .pts { font-family: var(--font-display); font-weight: 800; font-size: 26px; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.rank-row.me { background: var(--accent-soft); }
.rank-row.idle { color: var(--muted); }

/* ---------- Réglages ---------- */
.link-box { font-size: 15px; word-break: break-all; background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; color: var(--muted); }

/* ---------- Crédit ---------- */
.credit { text-align: center; font-size: 13px; color: var(--muted); padding: 10px 16px calc(18px + var(--safe-bottom)); }
.credit a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; display: inline-block; padding: 8px 0; }

/* ---------- Toast & feuilles ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translate(-50%, 30px);
  background: var(--text); color: var(--bg); padding: 10px 10px 10px 18px; border-radius: var(--r);
  font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 12px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
  width: max-content; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast:not(:has(button)) { padding-right: 18px; }
#toast button { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); flex: none; }
body.has-dock #toast { bottom: calc(var(--dock-h, 96px) + 16px + var(--safe-bottom)); }
.sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 520px; border-radius: 28px 28px 0 0;
  padding: 22px 16px calc(16px + var(--safe-bottom)); max-height: 94vh; overflow-y: auto;
}
@media (min-width: 560px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 28px; } }
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: up .24s ease-out; }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }
}

/* ---------- Image de partage ---------- */
.share-preview { display: grid; place-items: center; }
.share-preview canvas { width: min(62vw, 236px); height: auto; aspect-ratio: 9 / 16; border-radius: 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); background: var(--surface-2); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); font-weight: 700; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .knob { width: 52px; height: 32px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.toggle .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.toggle input:checked + .knob { background: var(--accent); }
.toggle input:checked + .knob::after { transform: translateX(20px); }
.toggle input:focus-visible + .knob { outline: 3px solid var(--accent); outline-offset: 2px; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); margin: 48px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ---------- Ajouts phase 3 ---------- */
/* « Voter » = violet ; « Réponds ! » = encre (couleurs différentes). */
.badge.ink { background: var(--text); color: var(--bg); }
.todo.reply, .match-card.todo-card.reply { box-shadow: 0 0 0 2px var(--text), var(--shadow); }
.team small .badge { min-height: 24px; font-size: 13px; padding: 0 9px; }
.btn.ghost.danger-text { color: var(--flop-text); min-height: var(--tap); }

.card-link.choice { display: flex; align-items: center; gap: 14px; padding: 18px 16px; }
.ring .countdown { font-size: 18px; letter-spacing: -.02em; }

/* Petits écrans : le détail des votes et le décompte restent lisibles. */
.vote-line { flex-wrap: wrap; }
.vote-line > .grow { flex: 1 1 110px; }
.vote-line .picks { margin-left: auto; }
.tally > div { min-width: 0; }
@media (max-width: 359px) {
  .tally { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 359px) {
  .ptile { font-size: 14px; }
  .ptile .name { padding: 0 2px; }
}
.reveal-top .who.duo { flex-wrap: nowrap; gap: 12px; }
.reveal-top .who.duo > div { flex: 1 1 0; }
.reveal-top .who.duo .nm { font-size: 28px; }
