@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url(vendor/fonts/barlow-condensed-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url(vendor/fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url(vendor/fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(vendor/fonts/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url(vendor/fonts/barlow-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url(vendor/fonts/barlow-latin-600-normal.woff2) format('woff2'); }

:root {
  --ink: #1A1D21;
  --ink-2: #5E6772;
  --paper: #FFFFFF;
  --floor: #EEF1F4;
  --line: #D8DDE3;
  --bonus: #F5A300;
  --live: #E0322F;
  --oncourt: #1E9E57;
  --court-floor: #D9A66B;
  --court-paint: #C98C4F;
  --court-line: #FFFFFF;
  --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --text: 'Barlow', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #EEF1F4; --ink-2: #9AA4AF; --paper: #171A1E; --floor: #0F1215; --line: #2C3238;
    --court-floor: #9C7448; --court-paint: #8A6036; --court-line: #F1E7DA;
  }
}
:root[data-theme="dark"] { --ink: #EEF1F4; --ink-2: #9AA4AF; --paper: #171A1E; --floor: #0F1215; --line: #2C3238; --court-floor: #9C7448; --court-paint: #8A6036; --court-line: #F1E7DA; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--floor); color: var(--ink); font: 400 16px/1.45 var(--text); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--bonus); outline-offset: 2px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }

/* En-tête du match */
.meta { padding: 14px 0 10px; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.meta h1 { margin: 0; font: 600 1.05rem/1.2 var(--cond); letter-spacing: .01em; }
.meta p { margin: 0; color: var(--ink-2); font-size: .85rem; }
.link { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.link i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); }
.link.on i { background: var(--live); animation: beat 2s ease-in-out infinite; }
@keyframes beat { 50% { opacity: .35; } }

/* Tableau de marque : l'élément fort de la page */
.board { display: grid; grid-template-columns: 1fr auto 1fr; border-radius: 6px; overflow: hidden; background: var(--paper); box-shadow: 0 1px 0 var(--line); }
.side { padding: 14px 14px 12px; display: flex; flex-direction: column; min-width: 0; background: var(--team); color: var(--team-ink); }
.side.b { text-align: right; align-items: flex-end; }
.side .name { font: 600 clamp(1rem, 4.2vw, 1.35rem)/1.05 var(--cond); overflow-wrap: anywhere; min-height: 2.1em; }
.side .score { font: 700 clamp(4.2rem, 21vw, 7.5rem)/.9 var(--cond); font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.02em; }
.side .score.bump { animation: bump .7s ease-out; }
@keyframes bump { 0% { transform: scale(1.12); } 100% { transform: none; } }
.mid { padding: 14px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 6.4rem; background: var(--paper); }
.mid .clock { font: 600 clamp(1.9rem, 8vw, 2.6rem)/1 var(--cond); font-variant-numeric: tabular-nums; }
.mid .clock.stopped { color: var(--ink-2); }
.mid .per { font: 600 1rem/1.1 var(--cond); }
.mid .state { font-size: .75rem; color: var(--ink-2); text-align: center; }

/* Fautes d'équipe & temps-morts */
.tally { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 10px 2px 4px; }
.tally > div:last-child { text-align: right; }
.row { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-2); margin: 4px 0; }
.tally > div:last-child .row { justify-content: flex-end; }
.pips { display: inline-flex; gap: 4px; }
.pip { width: 11px; height: 11px; border-radius: 2px; border: 1.5px solid var(--ink-2); }
.pip.full { background: var(--ink); border-color: var(--ink); }
.bonus .pip.full { background: var(--bonus); border-color: var(--bonus); }
.tag { font: 600 .72rem/1 var(--text); padding: 3px 6px; border-radius: 3px; background: var(--bonus); color: #1A1D21; }
.to .pip { border-radius: 50%; }

/* Onglets */
.tabs { display: flex; gap: 4px; margin: 18px 0 0; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 10px 12px; cursor: pointer; font: 600 1.05rem var(--cond); color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }
.panel { background: var(--paper); border-radius: 0 0 6px 6px; }
.panel[hidden] { display: none; }

/* Fil du match */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 3.4rem 1fr auto; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.feed li:last-child { border-bottom: 0; }
.feed li.empty { display: block; }
.feed .t { font: 500 .9rem var(--cond); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.feed .what { display: flex; gap: 8px; align-items: center; min-width: 0; }
.feed .chip { flex: none; width: 6px; align-self: stretch; border-radius: 2px; background: var(--team); }
.feed .txt { min-width: 0; }
.feed .s { font: 600 1rem var(--cond); font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed li.score .txt { font-weight: 600; }
.feed li.foul .txt, .feed li.sub .txt { color: var(--ink-2); }
.feed li.period { background: var(--floor); }
.feed li.period .txt, .feed li.timeout .txt { font: 600 .95rem var(--cond); }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); }

/* Feuille de stats */
.box { padding: 6px 0 10px; }
.box h3 { margin: 0; padding: 12px 14px 6px; font: 600 1.1rem var(--cond); display: flex; align-items: center; gap: 8px; }
.box h3 i { width: 12px; height: 12px; border-radius: 2px; background: var(--team); box-shadow: 0 0 0 1px var(--line); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 8px; text-align: right; white-space: nowrap; }
th { font: 500 .78rem var(--text); color: var(--ink-2); border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line); font-size: .92rem; }
th:first-child, td:first-child { text-align: right; width: 2.6rem; padding-left: 14px; color: var(--ink-2); }
th:nth-child(2), td:nth-child(2) { text-align: left; width: 100%; }
td.pts { font-weight: 600; }
tr.on td:nth-child(2)::after { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--oncourt); margin-left: 6px; vertical-align: middle; }
tr.f4 td.f { color: var(--bonus); font-weight: 600; }
tr.out td { color: var(--ink-2); text-decoration: line-through; }
.legend { padding: 8px 14px 4px; font-size: .78rem; color: var(--ink-2); }
.coach { padding: 8px 14px 0; font-size: .85rem; color: var(--ink-2); }

/* Par période */
.periods td:first-child, .periods th:first-child { text-align: left; width: auto; color: var(--ink); }
.periods th:first-child { color: var(--ink-2); }
.periods td.tot { font-weight: 700; }

.waiting { margin-top: 40px; text-align: center; }
.waiting h2 { font: 600 1.6rem var(--cond); margin: 0 0 6px; }
.waiting p { color: var(--ink-2); margin: 0; }

@media (prefers-reduced-motion: reduce) { .side .score.bump, .link.on i { animation: none; } }

/* Fin de match sur le tableau */
.side.lost { filter: saturate(.35); opacity: .78; }

/* Terrain */
.court { position: relative; margin-top: 10px; border-radius: 6px; overflow: hidden; background: var(--court-floor); line-height: 0; }
.court svg { display: block; width: 100%; height: auto; }
.court.dim svg { filter: saturate(.55) brightness(.92); }
.banner { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); max-width: calc(100% - 24px);
  line-height: 1.2; font: 600 clamp(.95rem, 3.6vw, 1.15rem)/1.2 var(--cond); padding: 7px 12px 7px 14px; border-radius: 4px;
  background: #fff; color: #1A1D21; box-shadow: inset 5px 0 0 var(--team), 0 2px 10px rgba(0,0,0,.25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner.in { animation: slideup .35s ease-out; }
@keyframes slideup { from { transform: translate(-50%, 14px); opacity: 0; } }
.phase { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 16px; text-align: center; line-height: 1.25; background: rgba(20, 22, 26, .52); color: #fff; }
.phase strong { font: 700 clamp(1.6rem, 7vw, 2.6rem)/1 var(--cond); }
.phase span { font-size: clamp(.9rem, 3.4vw, 1.05rem); max-width: 34ch; }

/* Les 5 sur le terrain */
.oncourt { margin-top: 14px; }
.oncourt h2 { font: 600 1.15rem var(--cond); margin: 0 0 8px; }
.five { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-five { background: var(--paper); border-radius: 6px; overflow: hidden; min-width: 0; }
.team-five h3 { margin: 0; padding: 7px 10px; font: 600 1rem/1.2 var(--cond); background: var(--team); color: var(--team-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-five ul { list-style: none; margin: 0; padding: 2px 0; }
.team-five li { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr) auto; grid-template-areas: "num name pts" "num fouls fouls"; column-gap: 8px; row-gap: 2px; padding: 7px 10px; border-bottom: 1px solid var(--line); align-items: center; }
.team-five li:last-child { border-bottom: 0; }
.team-five .num { grid-area: num; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; background: var(--team); color: var(--team-ink); font: 700 .95rem var(--cond); }
.team-five .pn { grid-area: name; font-weight: 500; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-five .pp { grid-area: pts; font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.team-five .pp b { font: 700 1.15rem var(--cond); color: var(--ink); }
.team-five .pf { grid-area: fouls; }
.pf-pips .pip { width: 9px; height: 9px; }
.team-five li.warn .pf-pips .pip.full { background: var(--live); border-color: var(--live); }
.team-five li.none { display: block; color: var(--ink-2); font-size: .88rem; }
.muted { color: var(--ink-2); margin: 0; }
@media (min-width: 640px) {
  .team-five li { grid-template-columns: 2rem minmax(0, 1fr) auto auto; grid-template-areas: "num name fouls pts"; }
  .team-five .pp { min-width: 3.6rem; text-align: right; }
}
@media (max-width: 340px) { .five { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .banner.in { animation: none; } }

.phase[hidden], .banner[hidden] { display: none; }
.tally .row { flex-wrap: wrap; row-gap: 3px; }
.tally .lbl { white-space: nowrap; }
.five-legend { padding: 8px 2px 0; }
.court .phase, .court .banner { z-index: 2; }
.court { aspect-ratio: 30 / 17; min-height: 120px; }
.court svg { width: 100%; height: 100%; }
.court-error { position: absolute; inset: auto 0 0 0; margin: 0; padding: 8px 12px; line-height: 1.3; font-size: .85rem; color: #1A1D21; background: rgba(255,255,255,.85); }
.foot { margin: 18px 0 0; text-align: center; font-size: .75rem; color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .court-svg .court-floor { fill: #9C7448; }
  :root:not([data-theme="light"]) .court-svg .court-paint { fill: #8A6036; }
  :root:not([data-theme="light"]) .court-svg .court-line { stroke: #F1E7DA; }
}
