:root {
  --bg: #f3f5fa; --surface: #ffffff; --surface-2: #eef1f7; --text: #0f172a; --muted: #5b6477; --border: #dfe3ec;
  --accent: #4338ca; --accent-soft: #e0e7ff; --good: #047857; --good-soft: #d1fae5; --mid: #a16207; --mid-soft: #fef3c7;
  --bad: #b91c1c; --bad-soft: #fee2e2; --star: #f59e0b; --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 18px rgba(15,23,42,.06);
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0a0f1d; --surface: #121a2b; --surface-2: #1a2438; --text: #e8edf6; --muted: #98a3ba; --border: #253049;
    --accent: #8f97ff; --accent-soft: #232a52; --good: #34d399; --good-soft: #0d2e25; --mid: #fbbf24; --mid-soft: #33290f;
    --bad: #f87171; --bad-soft: #3a1717; --star: #fbbf24; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* En-tête */
header.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); padding: 10px 0 8px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.updated { font-size: 12px; color: var(--muted); text-align: right; }
.updated .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 5px; }
.updated .dot.busy { background: var(--mid); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.gw-select { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.gw-select::-webkit-scrollbar { display: none; }
.gw-chip { flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 6px 12px;
  text-align: left; line-height: 1.2; }
.gw-chip b { display: block; font-size: 14px; }
.gw-chip span { font-size: 11.5px; color: var(--muted); }
.gw-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.gw-chip[aria-pressed="true"] b { color: var(--accent); }

/* Navigation basse */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom); }
nav.tabs .inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--nav-h); }
nav.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
nav.tabs button .ico { font-size: 20px; line-height: 1; }
nav.tabs button[aria-current="page"] { color: var(--accent); }

/* Contrôles */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 8px; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 3px; background: var(--surface-2); border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 7px 12px; font-weight: 650; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 650; }
.select { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 6px 8px; font-size: 13px; }
.search { flex: 1 1 180px; min-width: 0; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; }
.btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 8px 14px; font-weight: 650; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; width: 34px; height: 34px; display: inline-grid; place-items: center; }
.add-btn { border: 0; background: var(--accent); color: #fff; border-radius: 9px; width: 34px; height: 34px; font-size: 20px; line-height: 1; }
.add-btn[disabled] { background: var(--surface-2); color: var(--muted); }

/* Étoiles */
.stars { display: inline-flex; gap: 1px; vertical-align: -2px; }
.stars svg { width: 13px; height: 13px; }

/* Tableau */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { position: sticky; top: 0; background: var(--surface); text-align: right; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
table.grid th.sorted { color: var(--accent); }
table.grid td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--surface-2); }
.pname { font-weight: 650; white-space: normal; line-height: 1.25; }
.psub { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.team { font-weight: 700; color: var(--text); }
.badge { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
.badge.games { background: var(--accent-soft); color: var(--accent); }
.badge.risk { background: var(--bad-soft); color: var(--bad); }
.badge.mine { background: var(--good-soft); color: var(--good); }
.badge.cap { background: var(--star); color: #fff; }
.proj { font-weight: 800; font-size: 15.5px; }
.val { font-weight: 750; }
.val.good { color: var(--good); } .val.mid { color: var(--mid); } .val.neutral { color: var(--muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 12px; flex-wrap: wrap; }
.pager button { min-width: 36px; height: 36px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
@media (max-width: 560px) { .hide-sm { display: none; } table.grid td, table.grid th { padding: 9px 6px; } }

/* Fiche joueur (panneau bas) */
.sheet-bg { position: fixed; inset: 0; background: rgba(2,6,23,.45); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 20px 20px 0 0;
  max-height: 86vh; overflow-y: auto; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet .inner { max-width: 640px; margin: 0 auto; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 10px; }
.sheet h2 { margin: 0; font-size: 19px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 8px; text-align: center; }
.kpi b { display: block; font-size: 18px; }
.kpi span { font-size: 11px; color: var(--muted); }
.explain { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.analysis { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; }
.analysis li { padding-left: 22px; position: relative; font-size: 14px; }
.analysis li::before { content: "›"; position: absolute; left: 6px; color: var(--accent); font-weight: 800; }
table.games { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.games th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--border); font-size: 12px; }
table.games td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
table.games .n { text-align: right; font-variant-numeric: tabular-nums; }

/* 5 Majeur */
.five-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .five-grid { grid-template-columns: 1fr 1fr; } }
.five h3 { margin: 0; font-size: 17px; }
.five header { padding: 14px 14px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.five .total { font-size: 13px; color: var(--muted); }
.five .total b { font-size: 18px; color: var(--text); }
.five-player { padding: 10px 14px; border-top: 1px solid var(--border); }
.five-player .head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.five-player ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
.five-player li { margin: 2px 0; }
.five footer { padding: 12px 14px; border-top: 1px solid var(--border); }
.intro { font-size: 13.5px; color: var(--muted); margin: 0 2px 4px; }

/* Team builder */
.builder { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .builder { grid-template-columns: 380px 1fr; } .lineup { position: sticky; top: 130px; } }
.lineup { padding: 12px; }
.lineup .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.slot { display: grid; grid-template-columns: 34px 1fr auto 30px; gap: 10px; align-items: center; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--surface); }
.slot.empty { display: block; text-align: center; color: var(--muted); border-style: dashed; background: transparent; padding: 14px; }
.cap-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); font-weight: 800; font-size: 13px; }
.cap-btn[aria-pressed="true"] { background: var(--star); border-color: var(--star); color: #fff; }
.budget { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 4px 0 10px; }
.budget div { background: var(--surface-2); border-radius: 10px; padding: 6px; text-align: center; }
.budget b { display: block; font-size: 16px; }
.budget span { font-size: 11px; color: var(--muted); }
.over { color: var(--bad) !important; }
.suggest-head { padding: 12px 12px 0; }
.suggest-row { display: grid; grid-template-columns: 1fr auto auto 34px; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); }
.team-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; }
.notice { font-size: 13px; color: var(--muted); }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.okmsg { background: var(--good-soft); color: var(--good); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.account { padding: 16px; display: grid; gap: 12px; max-width: 560px; }
.account input { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; width: 100%; }

/* ===== V1.1 : pastilles d'équipes, maillots, LIVE, terrain ===== */
.tchip { display: inline-block; border-radius: 6px; padding: 1px 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; line-height: 1.5; }
.jersey { flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.gw-chip .live { color: #dc2626; font-weight: 800; font-size: 12px; margin-left: 4px; }
.gw-chip .rel { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 4px; }
.live-dot { color: #dc2626; font-size: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.mine-toggle { margin-top: 8px; }
.show-sm { display: none; }
@media (max-width: 560px) { .show-sm { display: inline-flex; } }
.val.bad { color: var(--bad); }
.seg.big button { padding: 9px 16px; font-size: 14.5px; }
.seg.big small { font-weight: 600; color: var(--muted); margin-left: 3px; }
.sheet-head { display: flex; gap: 12px; align-items: center; }
.analysis li { padding-left: 0; }
.analysis li::before { content: none; }
.analysis li.neg { color: var(--text); }

/* Disposition : terrain à gauche, récapitulatif à droite (vertical sur mobile) */
.layout { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .layout { grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); } }
.side { display: grid; gap: 14px; }

.court { position: relative; border-radius: 18px; overflow: visible; background: linear-gradient(180deg, #e7c08f, #d9a86f);
  border: 3px solid #b9844a; aspect-ratio: 1 / 1.05; min-height: 380px; }
@media (prefers-color-scheme: dark) { .court { background: linear-gradient(180deg, #5b4126, #4a341e); border-color: #7a5732; } }
.court-lines { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 15px; }
.court-lines .paint { position: absolute; left: 50%; top: 0; width: 34%; height: 38%; transform: translateX(-50%);
  border: 3px solid rgba(255,255,255,.75); border-top: 0; background: rgba(180, 60, 40, .18); }
.court-lines .arc { position: absolute; left: 50%; top: -38%; width: 88%; height: 100%; transform: translateX(-50%);
  border: 3px solid rgba(255,255,255,.75); border-radius: 50%; }
.court-lines .circle { position: absolute; left: 50%; bottom: -14%; width: 30%; aspect-ratio: 1; transform: translateX(-50%);
  border: 3px solid rgba(255,255,255,.75); border-radius: 50%; }
.court-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 10px; gap: 6px; }
.spot { display: flex; align-items: center; justify-content: center; }
.spot.s0 { grid-column: 1 / 4; grid-row: 1; } .spot.s1 { grid-column: 4 / 7; grid-row: 1; }
.spot.s2 { grid-column: 2 / 6; grid-row: 2; }
.spot.s3 { grid-column: 1 / 4; grid-row: 3; } .spot.s4 { grid-column: 4 / 7; grid-row: 3; }
.cp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cp-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border-radius: 14px; padding: 8px 10px; min-width: 112px; box-shadow: var(--shadow); }
.cp-card.ghost { opacity: .75; border: 2px dashed var(--border); background: color-mix(in srgb, var(--surface) 60%, transparent); cursor: default; }
.cp-name { font-weight: 750; font-size: 13.5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-proj { font-weight: 800; font-size: 15px; }
.cp-proj .val { font-size: 12px; font-weight: 700; }
.cp-meta { display: flex; gap: 4px; align-items: center; }
.cap-badge { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--star); color: #fff;
  font-weight: 800; font-size: 12px; display: grid; place-items: center; box-shadow: var(--shadow); }
.cp-ctrl { display: flex; gap: 6px; }
.cp-ctrl .cap-btn, .cp-ctrl .icon-btn { width: 30px; height: 30px; }
.pop { display: none; }
@media (hover: hover) and (min-width: 900px) {
  .cp:hover .pop { display: block; position: absolute; z-index: 15; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.18);
    font-size: 13px; text-align: left; }
  .cp .pop .analysis li { font-size: 13px; }
}
.recap { padding: 14px; display: grid; gap: 10px; }
.recap-total { display: grid; text-align: center; }
.recap-total span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.recap-total b { font-size: 34px; font-weight: 850; letter-spacing: -.02em; }
.recap-total small { color: var(--muted); font-size: 12px; }
.recap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.recap-grid div { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; }
.recap-grid b { display: block; font-size: 16px; }
.recap-grid span { font-size: 11px; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest-head { padding: 12px 12px 0; display: grid; gap: 4px; }

.half-star { position: relative; display: inline-flex; }
.half-star .half-fill { position: absolute; left: 0; top: 0; width: 50%; overflow: hidden; display: inline-flex; }
.half-star .half-fill svg { flex: none; }

/* V1.2 : encart promesse, récapitulatif détaillé, pastilles adverses sur le terrain */
.promise { background: var(--accent-soft); border-radius: 12px; padding: 9px 12px; font-size: 13.5px; margin: 2px 0 12px; line-height: 1.4; }
.recap-list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.recap-list td { padding: 6px 2px; border-top: 1px solid var(--border); }
.recap-list td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cap-badge.inline { position: static; display: inline-grid; width: 18px; height: 18px; font-size: 10px; vertical-align: 1px; box-shadow: none; }
.cp-opps { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }

/* V1.2 : comptes, onboarding */
.center { text-align: center; }
a.btn { display: block; text-decoration: none; }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font-size: 13.5px; text-decoration: underline; }
.account-wrap { display: grid; gap: 12px; margin-top: 12px; max-width: 560px; }
.account h2 { margin: 0; font-size: 18px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; margin-bottom: calc(-1 * var(--nav-h)); }
.auth-card { width: 100%; max-width: 400px; padding: 22px; display: grid; gap: 14px; }
.auth-brand { text-align: center; display: grid; justify-items: center; gap: 4px; }
.auth-brand img { border-radius: 14px; }
.auth-brand h1 { margin: 6px 0 0; font-size: 24px; }
.auth-brand p { margin: 0; font-size: 13.5px; }
.seg.block { display: grid; grid-template-columns: 1fr 1fr; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 4px; font-size: 13.5px; font-weight: 600; }
.auth-form input, .onb-input { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 11px 12px; font-size: 16px; width: 100%; }
.onb-bg { position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 23, .55); display: grid; place-items: center; padding: 16px; }
.onb { position: relative; width: 100%; max-width: 420px; padding: 26px 22px 18px; display: grid; gap: 14px; text-align: center; }
.onb-skip { position: absolute; top: 10px; right: 12px; border: 0; background: none; color: var(--muted); font-weight: 600; }
.onb-ico { font-size: 44px; }
.onb-slide h2 { margin: 6px 0; font-size: 20px; }
.onb-slide p { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.onb-dots { display: flex; justify-content: center; gap: 6px; }
.onb-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.onb-dots span.on { background: var(--accent); width: 18px; border-radius: 4px; }
.onb-actions { display: flex; justify-content: center; gap: 8px; }

.brand h1.logo { display: inline-flex; align-items: center; gap: 8px; }
.brand h1.logo img { border-radius: 7px; }
