:root {
  --bg: #0a101d;
  --surface: #111827;
  --surface-2: #182132;
  --surface-3: #212c41;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .12);
  --text: #e9eefa;
  --muted: #8b98b6;
  --faint: #5c6a8a;
  --accent: #4f8cff;
  --live: #ff3b4e;
  --win: #7ee2a0;
  --star: #ffc93c;
  --ffhg: #4f8cff;
  --magnus: #ff7a3c;
  --radius: 16px;
  --sidebar: 232px;
  --tabbar: 62px;
  --safe-b: env(safe-area-inset-bottom);
  --safe-t: env(safe-area-inset-top);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  touch-action: manipulation; /* pas de zoom au double-tap */
  -webkit-text-size-adjust: 100%;
  letter-spacing: -0.006em;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
svg { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }
kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 5px; text-align: center;
  background: var(--surface-3); border: 1px solid var(--line); font: 11px/18px ui-monospace, Menlo, monospace;
}

/* ---------- Coque : barre latérale (PC) / barre d'onglets (mobile) ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--tabbar) + var(--safe-b) + 16px); }

.brand {
  font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); text-decoration: none;
}
.brand-dot { display: inline-block; width: 8px; height: 8px; margin-left: 3px; border-radius: 50%; background: var(--live); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); text-decoration: none; font-size: 11px; font-weight: 600;
}
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar svg { width: 22px; height: 22px; padding: 3px 12px; box-sizing: content-box; border-radius: 999px; transition: background .15s; }
.tabbar a[aria-current="page"] svg { background: rgba(255, 255, 255, .1); }
.tabbar .nav-count { position: absolute; top: 4px; left: calc(50% + 8px); }

.nav-count {
  min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--live); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
}
.nav-count:empty { display: none; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .tabbar, .brand-mobile, .search-toggle, .account-btn { display: none !important; }
  .main { padding-bottom: 40px; }
  .sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
    padding: 22px 14px; border-right: 1px solid var(--line); background: #0c1322;
  }
  .sidebar .brand { padding: 0 10px; }
  .side-nav { display: grid; gap: 2px; }
  .side-nav a, .side-account {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-weight: 600; border: 0; background: none; width: 100%; text-align: left;
  }
  .side-nav a:hover, .side-account:hover { background: var(--surface); color: var(--text); }
  .side-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
  .side-nav .nav-count { margin-left: auto; }
  .side-account { margin-top: auto; border: 1px solid var(--line); }
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.page-title { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Mobile : grand titre de page façon iOS, le logo reste dans la barre latérale sur PC */
.brand-mobile { display: none; }
.topbar.has-back .page-title { font-size: 20px; }

.search {
  display: none; align-items: center; gap: 8px; flex: 1; max-width: 420px;
  padding: 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.search svg { color: var(--faint); width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 10px 0; outline: none; font-size: 16px; }
.search:focus-within { border-color: var(--accent); }
.topbar.searching .search { display: flex; }
.topbar.searching .page-title, .topbar.searching .back-btn { display: none; }

.icon-btn {
  position: relative; display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.account-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.account-dot.ok { background: var(--win); }
.account-dot.warn { background: var(--star); }

@media (min-width: 960px) {
  .topbar { padding: 18px 32px 12px; gap: 16px; }
  .page-title { display: block !important; font-size: 26px; }
  .search { display: flex; }
}

.banner {
  margin: 4px 16px 8px; padding: 10px 12px; border-radius: 10px;
  background: #3a2a0c; color: #ffd48a; font-size: 14px;
}
.banner button { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0; }

/* ---------- Filtres ---------- */
.filters { padding: 2px 0 6px; }
.filters:empty { display: none; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; background: rgba(255, 255, 255, .05);
  height: 32px; padding: 0 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
  transition: background .15s, color .15s;
}
.chip { display: inline-flex; align-items: center; gap: 5px; }
.chip svg { width: 14px; height: 14px; }
.chip:hover { color: var(--text); background: rgba(255, 255, 255, .09); }
a.btn { color: var(--text); text-decoration: none; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chip .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 2px; }
.chip-sep { flex: none; width: 1px; background: var(--line-strong); margin: 7px 2px; }
@media (min-width: 960px) {
  .chips { padding: 4px 32px; flex-wrap: wrap; overflow: visible; }
  .banner { margin: 4px 32px 8px; }
}

/* ---------- Contenu ---------- */
.view { padding: 0 16px; }
@media (min-width: 960px) { .view { padding: 0 32px; } }

.section-title {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 2px 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--faint);
}
.section-title a { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 13px; text-decoration: none; }
.grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1700px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* Carte de match */
.card {
  position: relative; display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: transform .1s ease, border-color .15s, background .15s;
}
.card:hover { border-color: var(--line-strong); background: #141c2c; }
.card:active { transform: scale(.99); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.is-live { border-color: color-mix(in srgb, var(--live) 45%, transparent); }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; min-width: 0; }
.badge {
  padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, .06); color: var(--muted);
  font-weight: 600; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; }
.src::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--src-color, var(--accent)); }
.when { margin-left: auto; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.when.final { color: var(--faint); font-weight: 600; }
.live-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px;
  background: var(--live); color: #fff; font-weight: 800; letter-spacing: .04em; font-size: 11px;
}
.live-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.match-rows { display: grid; gap: 8px; }
.team-line { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 28px; height: 28px; flex: none; object-fit: contain; }
.logo.ph {
  display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .06);
  font-size: 9px; font-weight: 800; color: var(--muted);
}
.team-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-line.fav .team-name { color: var(--star); }
.team-line.loser .team-name, .team-line.loser .score { color: var(--muted); font-weight: 500; }
.score { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; }
.spoiler {
  border: 0; border-radius: 8px; padding: 4px 10px; background: var(--surface-3); color: var(--muted);
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.match-rows.has-spoiler { grid-template-columns: 1fr auto; align-items: center; }
.match-rows.has-spoiler .team-line { grid-column: 1; }
.match-rows.has-spoiler .spoiler { grid-column: 2; grid-row: 1 / span 2; }
.event-title { font-weight: 600; }
.card-remove {
  display: grid; place-items: center; width: 28px; height: 28px; margin: -6px -8px -6px 2px; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: var(--faint);
}
.card-remove:hover { background: var(--surface-3); color: var(--text); }
.card-remove svg { width: 16px; height: 16px; }
.link-btn {
  margin-left: auto; border: 0; background: none; padding: 0; color: var(--accent);
  font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0;
}
.card:has(.progress) { padding-bottom: 22px; }
.progress { position: absolute; left: 16px; right: 16px; bottom: 7px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--live); }

/* Carte résumé */
.clip {
  display: block; width: 100%; padding: 0; text-align: left; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.clip:hover { border-color: #34466c; }
.clip-thumb { position: relative; aspect-ratio: 16 / 9; background: #000 center / cover no-repeat; }
.clip-thumb::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.7));
}
.clip-logos {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 18%;
  background: radial-gradient(circle at center, var(--surface-3), #05080f);
}
.clip-logos .logo { width: 22%; height: auto; aspect-ratio: 1; border-radius: 16px; }
.clip-play {
  position: absolute; left: 12px; bottom: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700;
}
.clip-body { padding: 10px 12px 12px; }
.clip-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-sub { color: var(--muted); font-size: 13px; }

/* Équipes */
.team-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; min-width: 0;
}
.team-card:hover { border-color: #34466c; }
.team-card .logo { width: 40px; height: 40px; }
.team-card .info { flex: 1; min-width: 0; }
.team-card .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-card .next { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star-btn {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: var(--faint);
}
.star-btn:hover { background: var(--surface-2); }
.star-btn[aria-pressed="true"] { color: var(--star); }
.team-filter {
  display: block; width: 100%; max-width: 420px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 16px;
}
.team-filter:focus { border-color: var(--accent); }

.team-hero {
  display: flex; align-items: center; gap: 16px; margin: 8px 0 4px; padding: 18px; border-radius: 18px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface)); border: 1px solid var(--line);
}
.team-hero .logo { width: 64px; height: 64px; border-radius: 14px; }
.team-hero h2 { margin: 0 0 4px; font-size: 22px; }
.team-hero .muted { font-size: 14px; }
.team-hero .star-btn { margin-left: auto; width: 46px; height: 46px; background: var(--surface-3); }
.team-hero .star-btn svg { width: 24px; height: 24px; }
.form-row { display: flex; gap: 5px; margin-top: 8px; }
.form-row span {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; background: var(--surface-3); color: var(--muted);
}
.form-row .w { background: #1f5a37; color: var(--win); }
.form-row .l { background: #5a1f27; color: #ff9aa4; }

/* États */
.empty, .error { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty p { margin: 0 0 14px; }
.error { color: #ff9aa4; }
.skeleton {
  height: 104px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.sentinel { height: 1px; }
.loading-more { text-align: center; color: var(--muted); padding: 18px; font-size: 14px; }

/* ---------- Boutons, champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 9px 13px; font-weight: 600; font-size: 14px;
}
.btn:hover { background: var(--surface-3); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3f7bf0; }
.btn:disabled { opacity: .6; cursor: wait; }
.full { width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Lecteur ---------- */
dialog { border: 0; padding: 0; color: var(--text); }
dialog::backdrop { background: rgba(3, 6, 14, .82); backdrop-filter: blur(4px); }
.player {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0;
  background: var(--bg); overflow: auto;
}
.player-grid { display: flex; flex-direction: column; min-height: 100%; }
.player-stage { position: relative; background: #000; padding-top: calc(var(--safe-t) + 52px); }
.player-stage video { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 75dvh; background: #000; }
.player-close { position: absolute; top: calc(var(--safe-t) + 6px); right: 10px; z-index: 2; background: var(--surface-2); }
.player-msg {
  display: grid; place-items: center; aspect-ratio: 16 / 9; padding: 24px; text-align: center; color: var(--muted);
  background: radial-gradient(circle at center, var(--surface-2), #000);
}
.player-info { padding: 16px 16px calc(var(--safe-b) + 20px); }
.player-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.player-meta { column-gap: 0; }
.player-meta > * + *::before { content: "·"; margin: 0 7px; color: var(--faint); }
.player-meta .venue { display: inline-flex; align-items: center; gap: 3px; flex-basis: 100%; margin-top: 2px; }
.player-meta .venue::before { content: none; }
.player-meta .venue svg { width: 15px; height: 15px; }
.player-title { margin: 8px 0 12px; font-size: 20px; line-height: 1.25; }
.player-teams { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 14px; }
.player-team {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--surface);
  color: var(--text); text-decoration: none;
}
.player-team:hover { background: var(--surface-2); }
.player-team .logo { width: 36px; height: 36px; }
.player-team .team-name { font-weight: 700; }
.player-team .score { font-size: 22px; }
.player-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.player-actions .wide { grid-column: 1 / -1; }
.speed select { border: 0; background: none; font-weight: 700; outline: none; }
.speed select option { background: var(--surface); }
.kbd-hint { display: none; margin-top: 16px; color: var(--faint); font-size: 12px; }

@media (min-width: 960px) {
  .player { width: min(1500px, 96vw); height: fit-content; max-height: 94vh; margin: auto; border-radius: 18px; overflow: hidden; }
  .player-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; }
  .player-stage { padding-top: 0; display: flex; align-items: center; }
  .player-close { background: rgba(0,0,0,.55); }
  .player-stage video, .player-msg { max-height: 94vh; width: 100%; }
  .player-info { max-height: 94vh; overflow: auto; padding: 22px 20px; border-left: 1px solid var(--line); }
  .kbd-hint { display: block; }
  .player-close { top: 12px; }
}

/* ---------- Profils ---------- */
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: var(--avatar, var(--surface-3)); color: #0a101d; font-weight: 800; font-size: 14px;
}
.avatar svg { color: var(--text); width: 20px; height: 20px; }
.avatar-lg { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; }
.account-btn .avatar { width: 30px; height: 30px; }
.side-account-text { display: grid; min-width: 0; line-height: 1.25; }
.side-account-text small { color: var(--faint); font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account-text small:empty { display: none; }

.profile-card {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--line);
}
.profile-card-text { flex: 1; min-width: 0; }
.profile-card-actions { display: grid; gap: 6px; }
.profile-card [data-avatar] { cursor: pointer; }
.profile-card-name { font-weight: 800; font-size: 17px; }
.sync-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--faint); }
.sync-dot.s-ok { background: var(--win); }
.sync-dot.s-syncing { background: var(--accent); }
.sync-dot.s-error { background: var(--live); }

.plan-box { display: grid; gap: 8px; margin-top: 10px; }
.plan {
  padding: 12px 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--star) 35%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--star) 10%, var(--bg)), var(--bg));
}
.plan-name { font-weight: 800; }
.plan-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

.profiles-dlg {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 24px 16px calc(var(--safe-b) + 24px);
  background: var(--bg); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
}
.profiles-dlg[open] { display: flex; }
.profiles-dlg h2 { margin: 0; font-size: 28px; }
.profile-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; max-width: 620px; }
.profile-tile {
  position: relative; display: grid; justify-items: center; gap: 8px; width: 104px; padding: 0; border: 0; background: none;
  color: var(--muted); font-weight: 600;
}
.profile-tile .avatar { width: 92px; height: 92px; border-radius: 22px; font-size: 40px; transition: transform .12s, box-shadow .12s; }
.profile-tile:hover .avatar, .profile-tile:focus-visible .avatar { transform: scale(1.04); box-shadow: 0 0 0 3px var(--text); }
.profile-tile:hover, .profile-tile.current { color: var(--text); }
.profile-tile.add .avatar { background: var(--surface-2); color: var(--muted); border: 2px dashed var(--line); }
.profile-tile .edit-badge {
  position: absolute; top: -6px; right: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--text); color: var(--bg); font-size: 14px;
}
.profiles-dlg.managing .profile-tile:not(.add) .avatar { opacity: .55; }

.avatar.has-photo { background: center / cover no-repeat var(--surface-3); color: transparent; }
.avatar-xl { width: 96px; height: 96px; border-radius: 24px; font-size: 42px; }
.photo-pick { display: flex; align-items: center; gap: 16px; margin: 16px 0; }
.photo-actions { display: grid; gap: 8px; flex: 1; }
.color-row { display: flex; gap: 10px; margin: 4px 0 16px; }
.color-row button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; background: var(--c); }
.color-row button[aria-checked="true"] { border-color: var(--text); }
.btn-danger { margin-top: 10px; background: transparent; border-color: #5a1f27; color: #ff9aa4; }

/* ---------- Feuille Compte ---------- */
.sheet {
  width: min(560px, 100%); max-height: 92dvh; background: var(--surface); border-radius: 18px; overflow: auto;
}
.sheet-head {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-body { padding: 4px 16px 20px; }
.sheet-body h3 { font-size: 15px; margin: 20px 0 8px; }
@media (max-width: 600px) {
  .sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b); }
}
.site-status { display: grid; gap: 8px; margin-top: 12px; }
.site-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
}
.site-row .src { color: var(--text); font-weight: 600; }
.site-row .state { margin-left: auto; font-size: 13px; color: var(--muted); }
.site-row .state.ok { color: var(--win); }
.site-row .state.ko { color: #ff9aa4; }
.site-row button { border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); margin-bottom: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 9px 4px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--surface-2); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.field { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.field input {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--accent); }
.form-error { color: #ff9aa4; font-size: 14px; margin: 4px 0 10px; }
.switch { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; }
.switch input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.switch small { display: block; color: var(--muted); font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 14px); transform: translateX(-50%);
  z-index: 100; padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.4); white-space: nowrap;
}
@media (min-width: 960px) { .toast { bottom: 24px; } }

.ptr {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 8px); z-index: 30; transform: translate(-50%, -80px);
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 18px;
  transition: transform .2s ease, opacity .2s; pointer-events: none; opacity: 0;
}
.ptr.pulling, .ptr.spin { opacity: 1; }
.ptr.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* ---------- Installer l'app ---------- */
.install-sheet { width: min(420px, 100%); text-align: center; }
.install-sheet .sheet-body { padding: 24px 20px 20px; }
.install-sheet h2 { margin: 12px 0 6px; font-size: 20px; }
.install-sheet p { margin: 0 auto; max-width: 320px; line-height: 1.45; }
.install-icon { border-radius: 16px; display: block; margin: 0 auto; }
.install-steps {
  text-align: left; margin: 18px 0 0; padding: 12px 14px 12px 34px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); line-height: 1.6;
}
.install-steps svg { width: 17px; height: 17px; vertical-align: -3px; }
.install-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.install-actions .btn { flex: 1; max-width: 180px; }
.pair-form { display: flex; gap: 10px; align-items: flex-end; }
.pair-form .field { flex: 1; margin: 0; }
.pair-form input { text-transform: uppercase; letter-spacing: .12em; }

.tabbar a span:not(.nav-count) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.toast.clickable { border: 0; cursor: pointer; font: inherit; font-weight: 600; white-space: normal; max-width: min(92vw, 520px); text-align: center; border-radius: 16px; }

/* ---------- Feuille de match ---------- */
.match-sheet { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.sheet-title { margin: 0 0 10px; font-size: 15px; }
.match-sheet .sheet-title + .pre-team, .match-sheet h3.sheet-title:not(:first-child) { margin-top: 14px; }
.period-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.period-table th, .period-table td { padding: 6px 4px; text-align: center; font-size: 13px; }
.period-table thead th { color: var(--faint); font-weight: 600; font-size: 12px; }
.period-table tbody th { text-align: left; font-weight: 700; }
.period-table tbody tr + tr { border-top: 1px solid var(--line); }
.period-table .total { font-weight: 800; font-size: 15px; }
.stars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.stars > .small { flex-basis: 100%; }
.star-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.star-chip .logo { width: 20px; height: 20px; }
.pim { margin-bottom: 8px; }
.timeline { display: grid; gap: 2px; }
.ev-period { margin: 10px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ev {
  display: grid; grid-template-columns: 40px 22px auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; text-align: left;
}
button.ev { cursor: pointer; }
button.ev:hover { background: var(--surface-2); }
.ev > svg { width: 15px; height: 15px; color: var(--faint); }
div.ev { grid-template-columns: 40px 22px auto minmax(0, 1fr) auto; }
.ev .logo { width: 22px; height: 22px; }
.ev-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-icon { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; letter-spacing: .03em; }
.ev-icon.goal { background: color-mix(in srgb, var(--win) 22%, transparent); color: var(--win); }
.ev-icon.pen { background: color-mix(in srgb, var(--star) 18%, transparent); color: var(--star); }
.ev-desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-assist { color: var(--muted); }
.ev-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.ev.is-goal .ev-desc strong { font-weight: 700; }
.sheet-spoiler { display: grid; gap: 8px; justify-items: start; }
.pre-team { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 0; }
.pre-team .logo { width: 28px; height: 28px; }
.pre-team .team-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h { display: flex; gap: 10px; padding: 5px 0; font-size: 13px; }
.player-meta .phase { color: var(--text); font-weight: 600; }

/* ---------- Direct : période et dernier but ---------- */
.live-info { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.live-info .phase { color: var(--live); font-weight: 700; }
.refresh-note { margin-top: 16px; }

/* ---------- Classement ---------- */
.comp-chips { flex-wrap: wrap; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.stand { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.stand th { position: sticky; top: 0; padding: 8px 6px; color: var(--faint); font-size: 12px; font-weight: 600; text-align: center; background: var(--bg); }
.stand td { padding: 8px 6px; text-align: center; border-top: 1px solid var(--line); }
.stand .team { text-align: left; width: 100%; }
.stand td.team a, .player-cell { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; min-width: 0; }
.stand td.team a span, .player-cell > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stand td.team a:hover span { text-decoration: underline; }
.stand .logo { width: 24px; height: 24px; flex: none; }
.stand .rank { color: var(--muted); width: 28px; }
.stand .pts { font-weight: 800; }
.stand tr.fav td { background: color-mix(in srgb, var(--star) 7%, transparent); }
.stand tr.fav .team a { color: var(--star); }
.stand .form .form-row { justify-content: center; }
.legal { margin-top: 24px; max-width: 760px; line-height: 1.5; }
@media (max-width: 700px) {
  .stand .opt { display: none; }
  .stand { font-size: 13px; }
  .stand th, .stand td { padding: 8px 4px; }
}

/* ---------- Page équipe : bilan ---------- */
.team-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 8px; }
.team-stats .stat { display: grid; padding: 10px 14px; border-radius: 12px; background: var(--surface); min-width: 84px; }
.team-stats .stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.team-stats .stat span { font-size: 12px; color: var(--muted); }
.stand .form-row, .pre-team .form-row { margin: 0; }
.form-row .d { background: var(--surface-3); color: var(--muted); }
.comp-picker { display: grid; gap: 10px; margin-top: 4px; }
.comp-select {
  max-width: 100%; justify-self: start; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
.team-groups { margin: 4px 0 12px; }
.team-choices { display: grid; gap: 8px; margin: 4px 0 12px; }
.team-choices .team-groups { margin: 0; }
.team-kinds .chip[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* ---------- Mes équipes ---------- */
.team-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.dir-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dir-tools { display: grid; gap: 10px; margin-bottom: 14px; }
.dir-tools .chips { margin: 0 -16px; padding: 2px 16px; }
@media (min-width: 960px) { .dir-tools .chips { margin: 0; padding: 2px 0; flex-wrap: wrap; } }
.dir-tools .chips[hidden] { display: none; }
.dir-tools .team-filter { max-width: 100%; }
@media (min-width: 960px) { .dir-tools .team-filter { max-width: 420px; } }

/* ---------- Barre de filtres ---------- */
.filter-bar { align-items: center; }
.src-seg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .05); }
.src-seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.src-seg button:hover { color: var(--text); }
.src-seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.src-seg .dot { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.chip.chip-select {
  position: relative; cursor: pointer; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b98b6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-color: rgba(255, 255, 255, .05);
}
.chip.chip-select:hover { background-color: rgba(255, 255, 255, .09); }
.chip.chip-select.active {
  background-color: var(--text); color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230a101d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.chip-select select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.chip-select option { background: var(--surface); color: var(--text); }
@media (max-width: 600px) {
  /* Téléphone : la source sur toute la largeur, puis équipes suivies et catégorie */
  .filter-bar { flex-wrap: wrap; overflow: visible; }
  .filter-bar .src-seg { order: -1; flex: 1 1 100%; }
  .filter-bar .src-seg button { flex: 1; justify-content: center; padding: 0 8px; }
  .filter-bar .chip-select { flex: 1; min-width: 0; }
}
