/* RaptorsFR — thème sombre par défaut (usage le soir, sur téléphone), clair si le système le demande */
:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --line: #2c2c2a;
  --axis: #383835;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --accent: #e0284f;          /* rouge Raptors */
  --series-1: #3987e5;        /* bleu */
  --series-2: #d95926;        /* orange */
  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --bad: #d03b3b;
  --seq-0: #1a1a19;
  --div-cool: #3987e5;
  --div-warm: #d95926;
  --fav: #1baf7a;           /* matchup favorable pour l'attaquant */
  --hard: #d95926;          /* matchup difficile */
  --radius: 10px;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f9f9f7;
    --surface: #fcfcfb;
    --surface-2: #f0efec;
    --line: #e1e0d9;
    --axis: #c3c2b7;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #6b6a66;
    --accent: #c8102e;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --div-cool: #2a78d6;
    --div-warm: #eb6834;
    --fav: #1baf7a;
    --hard: #eb6834;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------- en-tête ---------- */
header.top {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.bar { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 800; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.brand b { color: var(--accent); }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav.tabs a {
  text-decoration: none; color: var(--ink-2); padding: 6px 11px; border-radius: 999px; white-space: nowrap; font-weight: 600;
}
nav.tabs a.on { background: var(--surface-2); color: var(--ink); }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.me img { width: 26px; height: 26px; border-radius: 50%; }
.search { position: relative; max-width: 1100px; margin: 0 auto; padding: 0 16px 10px; }
.search input {
  width: 100%; padding: 10px 12px 10px 36px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23898781' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") 12px 50% no-repeat;
  color: var(--ink); font-size: 16px;
}
.results {
  position: absolute; left: 16px; right: 16px; top: 46px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; display: none; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.results a { display: flex; justify-content: space-between; padding: 10px 12px; text-decoration: none; }
.results a:hover, .results a.sel { background: var(--surface-2); }
.results small { color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
h1 { font-size: 24px; margin: 4px 0 2px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- cartes / tuiles ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin: 14px 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-size: 26px; font-weight: 700; margin-top: 2px; }
.tile .d { color: var(--ink-2); font-size: 13px; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty b { color: var(--ink); font-size: 18px; display: block; margin-bottom: 6px; }

/* ---------- tableaux ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
     position: sticky; top: 0; background: var(--surface); cursor: default; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--ink); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tr.us td { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 700; }
td a { text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.show-sm { display: none; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; background: var(--surface-2);
        color: var(--ink-2); white-space: nowrap; }
.lock { color: var(--warn); white-space: nowrap; font-size: 12px; }

/* fourchette de projection */
.range { position: relative; height: 8px; width: 110px; background: var(--surface-2); border-radius: 4px; display: inline-block; vertical-align: middle; }
.range i { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--series-1) 45%, transparent); border-radius: 4px; }
.range b { position: absolute; top: -3px; width: 3px; height: 14px; background: var(--series-1); border-radius: 2px; }

/* heatmap défense : divergent bleu (dure) ↔ orange (généreuse), texte toujours en encre */
.heat td.c { text-align: center; font-variant-numeric: tabular-nums; min-width: 88px; }
.heat td.c span { display: block; font-size: 11px; color: var(--ink-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; }

/* grille des picks */
.picks td.cell { text-align: center; min-width: 58px; font-variant-numeric: tabular-nums; }
.picks td.cell small { display: block; color: var(--ink-2); font-size: 11px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star { color: var(--warn); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.segmented a { padding: 5px 12px; text-decoration: none; color: var(--ink-2); font-size: 13px; }
.segmented a.on { background: var(--surface-2); color: var(--ink); font-weight: 700; }

.chartbox { position: relative; height: 280px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.legend button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
.legend button.on { border-color: var(--series-1); color: var(--ink); }
.legend .sw { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

.games { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.game { flex: 0 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 8px 12px; font-weight: 700; }
.game small { display: block; color: var(--muted); font-weight: 400; }

.absent { padding: 10px 0; border-bottom: 1px solid var(--line); }
.absent:last-child { border-bottom: 0; }
.absent .who { font-weight: 700; }
.absent .ben { color: var(--ink-2); font-size: 14px; margin-top: 3px; }

.login { max-width: 420px; margin: 12vh auto; text-align: center; }
.btn { display: inline-flex; align-items: center; gap: 10px; background: #5865f2; color: #fff; padding: 12px 20px;
       border-radius: var(--radius); text-decoration: none; font-weight: 700; }
.err { color: var(--bad); margin-top: 14px; }

@media (max-width: 640px) {
  body { font-size: 14px; }
  .bar { flex-wrap: wrap; row-gap: 6px; }
  nav.tabs { order: 3; flex-basis: 100%; }
  nav.tabs a { padding: 5px 9px; font-size: 14px; }
  .me { margin-left: auto; }
  .me span { display: none; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  div.show-sm { display: block; margin-top: 2px; }
  th, td { padding: 7px 8px; }
  .tile .v { font-size: 22px; }
}

/* matchs du soir */
.mcard { margin-bottom: 16px; }
.mhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mhead b { font-size: 18px; }
.sides { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.side h3 { font-size: 14px; margin: 0 0 6px; color: var(--ink-2); font-weight: 600; }
.side h3 strong { color: var(--ink); }
.mx td, .mx th { padding: 6px 6px; }
.mx td.r { text-align: center; font-variant-numeric: tabular-nums; width: 64px; font-weight: 700; }
.mx td.r span { display: block; font-size: 11px; font-weight: 400; color: var(--ink-2); }
.mx td.who { font-size: 13px; color: var(--ink-2); }
.mx td.who a { color: var(--ink); font-weight: 600; }
.pos { font-weight: 800; width: 34px; }
.keyline { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 8px 0 14px; }
.sw2 { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
@media (max-width: 760px) { .sides { grid-template-columns: 1fr; } }

.note { font-size: 13px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line);
        border-radius: 8px; padding: 8px 12px; margin: 0 0 14px; }
.note.warm { border-left-color: var(--warn); }
.segmented + .segmented { margin-left: 8px; }
@media (max-width: 640px) { .segmented { margin: 0 0 6px; } .segmented + .segmented { margin-left: 0; } }

.tag { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 12px; background: var(--surface-2);
       color: var(--ink-2); white-space: nowrap; margin: 1px 0; cursor: help; }
.five { font-size: 13px; color: var(--ink-2); margin: 0 0 8px; line-height: 1.7; }
.five b { color: var(--ink); }
.five .ok { color: var(--good); }
