/* Style « Glace » : une colonne centrée, cartes blanches posées sur la glace.
   Marquages de patinoire : bleu = domicile, rouge = extérieur, ligne rouge centrale sous l'en-tête. */
:root {
  --ice: #eef3f8;
  --board: #ffffff;
  --frost: #e4ebf3;
  --line: #d6dee8;
  --ink: #0f1a26;
  --muted: #5a6b7d;
  --blue: #1f4fd1;
  --blue-soft: #e1e8fb;
  --red: #cf2a3a;
  --red-soft: #fbe4e6;
  --draw: #a3b0bd;
  --good: #12804b;
  --good-soft: #dcf2e6;
  --bad: #b42318;
  --bad-soft: #fbe3e0;
  --gold: #b7870f;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px #0f1a260d, 0 6px 18px #0f1a260a;
  --display: "Saira Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
  --tabbar: 0px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ice: #091019; --board: #101a26; --frost: #172434; --line: #243447; --ink: #e6edf5; --muted: #8fa0b4;
    --blue: #6f95ff; --blue-soft: #172a4f; --red: #ff6372; --red-soft: #3a1820; --draw: #4f6074;
    --good: #43d08a; --good-soft: #0f2a1d; --bad: #ff7d6e; --bad-soft: #35150f; --gold: #f2c14e;
    --on-accent: #091019; --shadow: 0 1px 2px #0006, 0 8px 24px #0005; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ice: #091019; --board: #101a26; --frost: #172434; --line: #243447; --ink: #e6edf5; --muted: #8fa0b4;
  --blue: #6f95ff; --blue-soft: #172a4f; --red: #ff6372; --red-soft: #3a1820; --draw: #4f6074;
  --good: #43d08a; --good-soft: #0f2a1d; --bad: #ff7d6e; --bad-soft: #35150f; --gold: #f2c14e;
  --on-accent: #091019; --shadow: 0 1px 2px #0006, 0 8px 24px #0005; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--ice); color: var(--ink); font: 15px/1.5 var(--body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 20; background: var(--board); }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.12; text-wrap: balance; font-family: var(--display); font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: .01em; }
h2 { font-size: 1.3rem; text-transform: uppercase; letter-spacing: .03em; }
h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0; }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.tiny { font-size: .72rem; }
.num, table, .pct { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link { color: var(--blue); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ---------- En-tête et onglets ---------- */
.topbar { background: var(--board); border-bottom: 3px solid var(--red); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; }
.topbar-in { display: flex; align-items: center; gap: 18px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 1.4rem var(--display); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; }
.topnav { display: flex; gap: 2px; }
.topnav a { padding: 7px 11px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.topnav a:hover { color: var(--ink); }
.topnav a.active { background: var(--blue-soft); color: var(--blue); }
.searchbox { margin-left: auto; position: relative; }
.searchbox input {
  width: 220px; padding: 8px 12px 8px 34px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--frost); color: var(--ink); font: inherit; font-size: .9rem;
}
.searchbox svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); }
.updated { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.tabbar { display: none; }
main { padding-block: 22px 40px; min-height: 70vh; }
footer { padding-bottom: calc(28px + var(--tabbar)); color: var(--muted); font-size: .78rem; }

@media (max-width: 760px) {
  :root { --tabbar: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .topnav, .searchbox, .updated { display: none; }
  .topbar-in { height: 52px; justify-content: center; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0; z-index: 10;
    background: var(--board); border-top: 1px solid var(--line);
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; font-size: .68rem; font-weight: 600; color: var(--muted); padding: 4px 0; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--blue); }
  main { padding-bottom: calc(24px + var(--tabbar)); }
}

/* ---------- Cartes et sections ---------- */
.card { background: var(--board); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sec { margin-top: 26px; }
.sec > .sec-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tile { background: var(--frost); border-radius: 10px; padding: 10px 12px; }
.tile b { display: block; font: 700 1.55rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.tile span { font-size: .74rem; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; background: var(--blue); color: var(--on-accent); font-weight: 600; border: 0; cursor: pointer; font: inherit; }
.btn.ghost { background: var(--board); color: var(--ink); border: 1px solid var(--line); }
.btn.sm { padding: 6px 10px; font-size: .85rem; }
.seg { display: inline-flex; background: var(--frost); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 .85rem var(--body); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--board); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Logos, photos, pastilles ---------- */
.logo { width: 32px; height: 32px; object-fit: contain; flex: none; display: inline-block; vertical-align: middle; }
.logo.sm { width: 22px; height: 22px; }
.logo.lg { width: 76px; height: 76px; }
.logo.xl { width: 110px; height: 110px; }
.tm { flex: none; display: inline-grid; place-items: center; width: 34px; height: 24px; border-radius: 5px; background: var(--tb); color: var(--tf); font: 700 .78rem/1 var(--display); }
.face { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--frost); border: 1px solid var(--line); display: inline-grid; place-items: center; font: 700 .8rem var(--display); color: var(--muted); overflow: hidden; }
.face.sm { width: 28px; height: 28px; font-size: .7rem; }
.face.lg { width: 96px; height: 96px; font-size: 1.6rem; border-width: 3px; }
.pills { display: inline-flex; gap: 3px; }
.pill { width: 20px; height: 20px; border-radius: 5px; display: inline-grid; place-items: center; font: 700 .66rem/1 var(--body); color: #fff; }
.pill.V { background: #1f9d5a; } .pill.D { background: #c23140; } .pill.P { background: #6b7789; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: #fdf0d5; color: #8a5a00; }
.badge.neutral { background: var(--frost); color: var(--muted); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .who { flex: 1; min-width: 0; display: grid; }
.list .who b { font-weight: 600; }
.list a.who:hover b { color: var(--blue); }
.rank { width: 18px; color: var(--muted); font-size: .8rem; text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.pct { font-weight: 700; min-width: 44px; text-align: right; }
.big-pct { font: 700 1.25rem var(--display); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Barres de probabilité ---------- */
.bar3 { display: flex; height: 9px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--frost); }
.bar3 span { display: block; height: 100%; }
.bar3 .a { background: var(--red); } .bar3 .d { background: var(--draw); } .bar3 .h { background: var(--blue); }
.barlbl { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pbar { display: block; height: 7px; border-radius: 4px; background: var(--frost); overflow: hidden; min-width: 50px; }
.pbar span { display: block; height: 100%; width: var(--w); background: var(--blue); border-radius: 4px; animation: grow .7s ease-out both; }
.pbar.red span { background: var(--red); }
@keyframes grow { from { width: 0; } }

/* ---------- Cartes de match ---------- */
.games { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.game { display: grid; gap: 10px; transition: transform .15s, border-color .15s; }
.game:hover { border-color: var(--blue); transform: translateY(-2px); }
.game .gh { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--muted); gap: 8px; }
.trow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.trow .nm { font-weight: 600; line-height: 1.2; }
.trow .nm small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; margin-top: 2px; }
.trow .sc { font: 700 1.7rem/1 var(--display); font-variant-numeric: tabular-nums; }
.trow .pr { font: 700 1.15rem var(--display); font-variant-numeric: tabular-nums; }
.trow.lost .nm, .trow.lost .sc { color: var(--muted); }
.game .foot { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.game .foot b { color: var(--ink); }
.countdown { font-weight: 700; color: var(--blue); }

/* ---------- Héros (accueil, match, équipe, joueur) ---------- */
.hero {
  position: relative; overflow: hidden; background: var(--board); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
  background-image:
    linear-gradient(90deg, transparent calc(50% - 1.5px), color-mix(in srgb, var(--red) 22%, transparent) calc(50% - 1.5px), color-mix(in srgb, var(--red) 22%, transparent) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    linear-gradient(90deg, transparent calc(30% - 3px), color-mix(in srgb, var(--blue) 12%, transparent) calc(30% - 3px), color-mix(in srgb, var(--blue) 12%, transparent) calc(30% + 3px), transparent calc(30% + 3px)),
    linear-gradient(90deg, transparent calc(70% - 3px), color-mix(in srgb, var(--blue) 12%, transparent) calc(70% - 3px), color-mix(in srgb, var(--blue) 12%, transparent) calc(70% + 3px), transparent calc(70% + 3px));
}
.hero::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; translate: -50% -50%; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--blue) 14%, transparent); pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.match-hero { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; text-align: center; }
.match-hero .side { display: grid; justify-items: center; gap: 6px; }
.match-hero .side b { font: 700 1.3rem/1.1 var(--display); }
.match-hero .score { font: 700 3.4rem/1 var(--display); font-variant-numeric: tabular-nums; }
.match-hero .when { font-weight: 600; }
.team-hero { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; text-align: left; }
.team-hero.player { grid-template-columns: auto 1fr auto; }

/* ---------- Jauge 1-N-2 ---------- */
.gauge { position: relative; width: 168px; height: 168px; margin: 0 auto; }
.gauge svg { width: 100%; height: 100%; rotate: -90deg; }
.gauge circle { fill: none; stroke-width: 5.5; }
.gauge .arc { stroke-linecap: butt; animation: arc 1s ease-out both; }
@keyframes arc { from { stroke-dasharray: 0 999; } }
.gauge .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge .center b { font: 700 2.1rem/1 var(--display); font-variant-numeric: tabular-nums; }
.gauge .center span { font-size: .72rem; color: var(--muted); }
.gauge.sm { width: 64px; height: 64px; }
.gauge.sm circle { stroke-width: 7; }
.gauge.sm .center b { font-size: .95rem; }
.legend { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- Tableaux ---------- */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
th { font-size: .7rem; color: var(--muted); font-weight: 600; border-top: 0; letter-spacing: .05em; text-transform: uppercase; }
th:first-child, td:first-child { text-align: left; }
td.l, th.l { text-align: left; }
td:first-child { white-space: normal; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--blue); }
tr.hit td { background: var(--good-soft); }
tr.link-row { cursor: pointer; }
tr.link-row:hover td { background: var(--frost); }
.pcell { width: 34%; }
.cmp { table-layout: fixed; }
.cmp td { white-space: normal; overflow-wrap: anywhere; }
.cmp .pills { flex-wrap: wrap; }
.cmp td:nth-child(2) { text-align: center; color: var(--muted); font-size: .78rem; }
.cmp td:first-child { text-align: left; width: 38%; }
.cmp td:last-child { text-align: right; width: 38%; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.who-cell b { font-weight: 600; }
.who-cell .rank { width: 34px; }
.who-cell a:hover b { color: var(--blue); }
.sep td { background: var(--frost); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cut td { border-top: 2px dashed var(--red); }

/* ---------- Grille des scores ---------- */
.heat { border-collapse: separate; border-spacing: 3px; width: auto; margin: 0 auto; }
.heat td, .heat th { border: 0; padding: 0; text-align: center; }
.heat td { width: 42px; height: 34px; border-radius: 6px; font-size: .72rem; font-weight: 600; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--blue) calc(var(--p) * 1%), var(--frost)); color: var(--ink); }
.heat td.hot { color: var(--on-accent); }
.heat th { font-size: .72rem; color: var(--muted); padding: 0 4px; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 11px var(--body); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .gf { stroke: var(--blue); fill: none; stroke-width: 2.5; }
.chart .ga { stroke: var(--red); fill: none; stroke-width: 2.5; }
.chart .gf-area { fill: color-mix(in srgb, var(--blue) 14%, transparent); }
.chart .dot-gf { fill: var(--blue); } .chart .dot-ga { fill: var(--red); }
.chart .barp { fill: var(--blue); } .chart .barg { fill: var(--gold); }
.chart.radar { max-width: 380px; margin: 0 auto; }
.radar polygon.web { fill: none; stroke: var(--line); }
.radar line { stroke: var(--line); }
.radar polygon.val { fill: color-mix(in srgb, var(--blue) 26%, transparent); stroke: var(--blue); stroke-width: 2; animation: pop .8s ease-out both; transform-origin: center; }
.radar text { fill: var(--muted); font: 600 11px var(--body); }
@keyframes pop { from { transform: scale(.2); opacity: 0; } }

/* ---------- Patinoire (carte des tirs) ---------- */
.rink { width: 100%; height: auto; display: block; }
.rink .ice-bg { fill: var(--board); stroke: var(--ink); stroke-width: .6; }
.rink .red-line { stroke: var(--red); stroke-width: 1; }
.rink .blue-line { stroke: var(--blue); stroke-width: 1.4; }
.rink .goal-line { stroke: var(--red); stroke-width: .5; }
.rink .crease { fill: color-mix(in srgb, var(--blue) 25%, transparent); stroke: var(--red); stroke-width: .4; }
.rink .circle { fill: none; stroke: var(--red); stroke-width: .5; }
.rink .spot { fill: var(--red); }
.rink .shot { stroke-width: .6; }
.rink .shot.h { fill: color-mix(in srgb, var(--blue) 55%, transparent); stroke: var(--blue); }
.rink .shot.a { fill: color-mix(in srgb, var(--red) 55%, transparent); stroke: var(--red); }
.rink .shot.miss { fill: none; }
.rink .goal-mark { stroke: var(--ink); stroke-width: .8; }
.rink .goal-mark.h { fill: var(--blue); } .rink .goal-mark.a { fill: var(--red); }
.rink .lbl { font: 700 6px var(--display); fill: var(--muted); text-anchor: middle; letter-spacing: .05em; }

/* ---------- Déroulé ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 58px auto 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.timeline li.period { display: block; border-top: 0; padding: 12px 0 2px; font: 700 .78rem var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.timeline .t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .82rem; }
.timeline .sc { font: 700 1rem var(--display); font-variant-numeric: tabular-nums; }

/* ---------- Divers ---------- */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 14px; scrollbar-width: thin; }
.chip { flex: none; padding: 6px 10px; border-radius: 9px; background: var(--board); border: 1px solid var(--line); text-align: center; font-size: .76rem; line-height: 1.2; min-width: 62px; color: var(--muted); }
.chip b { display: block; font: 700 1.25rem/1.1 var(--display); color: var(--ink); }
.chip.active { background: var(--blue); border-color: var(--blue); color: var(--on-accent); }
.chip.active b { color: var(--on-accent); }
.chip.today:not(.active) { border-color: var(--blue); }
.chip.empty { opacity: .5; }
.daynav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.daynav .title { flex: 1; min-width: 200px; }
.daynav h1 { text-transform: capitalize; }
.note { background: var(--blue-soft); border-radius: 10px; padding: 10px 12px; font-size: .84rem; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.search-big { width: 100%; padding: 14px 16px 14px 44px; font: inherit; font-size: 1.05rem; border-radius: 12px; border: 1px solid var(--line); background: var(--board); color: var(--ink); box-shadow: var(--shadow); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 15px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--muted); }
.goalie-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.last5 td { padding: 5px 6px; font-size: .8rem; }
.skeleton { height: 120px; border-radius: 12px; background: linear-gradient(90deg, var(--frost), var(--board), var(--frost)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Animations d'apparition ---------- */
.reveal > * { animation: rise .45s ease-out both; }
.reveal > *:nth-child(2) { animation-delay: .05s; }
.reveal > *:nth-child(3) { animation-delay: .1s; }
.reveal > *:nth-child(4) { animation-delay: .15s; }
.reveal > *:nth-child(5) { animation-delay: .2s; }
.reveal > *:nth-child(n+6) { animation-delay: .25s; }
@keyframes rise { from { opacity: .001; transform: translateY(8px); } }

@media (max-width: 600px) {
  .match-hero { grid-template-columns: 1fr 1fr; }
  .match-hero .mid { grid-column: 1 / -1; order: 3; }
  .match-hero .score { font-size: 2.6rem; }
  .logo.lg { width: 60px; height: 60px; }
  .logo.xl { width: 80px; height: 80px; }
  .team-hero.player { grid-template-columns: auto 1fr; }
  .team-hero.player > :last-child { grid-column: 1 / -1; }
  .heat td { width: 34px; height: 30px; font-size: .64rem; }
  .timeline li { grid-template-columns: 48px auto 1fr; }
  .timeline li > :last-child { grid-column: 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
