/*
 * GamesCore : identité « cœur de jeu ».
 * Vu de dessus, le cœur d'un réacteur est une grille d'hexagones, comme un plateau de jeu : au centre le cœur
 * (bleu Tcherenkov), autour les places des joueurs (couleurs de pions). Unbounded pour les titres, Figtree pour le texte.
 * Contrastes vérifiés (WCAG AA) dans les deux thèmes.
 */
@font-face { font-family: 'Unbounded'; src: url("/assets/fonts/unbounded.22f9b928aa39.woff2") format('woff2'); font-weight: 400 800; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url("/assets/fonts/figtree.4ba7d3d09669.woff2") format('woff2'); font-weight: 400 700; font-display: swap; }
:root {
  color-scheme: light;
  --font-display: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --font-text: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Neutres froids, légèrement teintés de bleu (l'eau du réacteur). */
  --bg: #F3F5F9; --card: #FFFFFF; --fg: #141B2B; --muted: #566079; --line: #DCE2EC;
  /* Le cœur : bleu Tcherenkov. --accent est sa version lisible en texte. */
  --core: #14A6E6; --glow: rgb(63 211 255 / .35); --accent: #0A6FBA; --accent-fg: #FFFFFF;
  /* Places des joueurs (pions) et place libre. */
  --p1: #E34948; --p2: #EDA100; --p3: #1BAF7A; --p4: #7A5CF0; --seat: #C9D2E3; --fuel: #FFFFFF;
  --on: #12805A; --off: #9A6200; --err: #C0352B; --ok: #12805A;
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0B111D; --card: #141C2B; --fg: #E7ECF5; --muted: #9AA6BD; --line: #263147;
  --core: #3FD3FF; --glow: rgb(63 211 255 / .28); --accent: #3FD3FF; --accent-fg: #04121C; --seat: #3A4660; --fuel: #EFFBFF;
  --on: #3ECF8E; --off: #E0A33A; --err: #FF7B6E; --ok: #3ECF8E;
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B111D; --card: #141C2B; --fg: #E7ECF5; --muted: #9AA6BD; --line: #263147;
  --core: #3FD3FF; --glow: rgb(63 211 255 / .28); --accent: #3FD3FF; --accent-fg: #04121C; --seat: #3A4660; --fuel: #EFFBFF;
  --on: #3ECF8E; --off: #E0A33A; --err: #FF7B6E; --ok: #3ECF8E;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.55 var(--font-text); background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand, .tile-value, .board .rank, .board .score { font-family: var(--font-display); }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.01em; }
a { color: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 1000px; margin: 0 auto; padding: 16px; }
.top nav { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--fg); text-decoration: none; font-size: 1.05rem; letter-spacing: -0.02em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { color: var(--accent); font-weight: 700; }
main { max-width: 1000px; margin: 0 auto; padding: 16px 16px 64px; }
h1 { margin: 16px 0 6px; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; line-height: 1.15; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: .9rem; font-weight: 600; margin: 8px 0 0; }
.lead { margin: 0 0 32px; color: var(--muted); }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.games { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.games h3 { margin: 0; font-size: 1.1rem; }
.games p { margin: 6px 0 0; }
.tag { font-size: .75rem; font-weight: 600; margin-left: 6px; display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.tag::before { content: ''; width: 8px; height: 9px; clip-path: var(--hex); background: currentColor; }
.tag.on::before { box-shadow: 0 0 0 3px var(--glow); animation: core-pulse 2.4s ease-in-out infinite; }
@keyframes core-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .tag.on::before { animation: none; } }
.on { color: var(--on); } .off { color: var(--off); }
footer { margin-top: 40px; font-size: .85rem; color: var(--muted); }
.narrow { max-width: 420px; margin: 0 auto; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
input, textarea, select { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
button, .button { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px; padding: 9px 14px;
  background: var(--accent); color: var(--accent-fg); text-decoration: none; text-align: center; }
button.secondary { background: transparent; color: var(--fg); border: 1px solid var(--line); }
button.danger { background: var(--err); color: #fff; }
button.link { background: none; color: var(--accent); padding: 0 4px; font-weight: 500; }
button:disabled { opacity: .6; cursor: wait; }
.error { color: var(--err); margin: 0; }
.ok { color: var(--ok); margin: 0; }
.notice { border: 1px solid var(--off); color: var(--off); border-radius: 8px; padding: 10px 12px; }
.danger h2 { color: var(--err); }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plain li { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.identity { display: flex; gap: 12px; align-items: center; }
.identity img { border-radius: 50%; object-fit: cover; }
.file input { font-weight: 400; }
.secret { font-size: 1.4rem; letter-spacing: .15em; text-align: center; background: var(--bg); padding: 8px; border-radius: 6px; }
.small { font-size: .85rem; }
.users { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.users > li { border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
.users > li:first-child { border-top: 0; }
.users .who { display: flex; flex-direction: column; min-width: 200px; }
.users .actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.users select { padding: 6px 8px; }
.users button { padding: 6px 10px; font-size: .9rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; margin-left: 6px; border: 1px solid currentColor; vertical-align: middle; }
.badge.err { color: var(--err); } .badge.warn { color: var(--off); } .badge.info { color: var(--accent); }
.audit li { display: block; font-size: .9rem; }
.podium { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; }
.stats li { display: block; }
.stats .modes { font-size: .9rem; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 500; }
label.check input { margin-top: 4px; }
button small { display: block; font-weight: 400; opacity: .85; margin-top: 2px; }
#device-step button { text-align: left; }
.qr { width: 220px; height: 220px; max-width: 100%; background: #fff; border-radius: 8px; padding: 8px; align-self: center; }
.plain li:has(.meta) { align-items: flex-start; }
.plain .meta { display: flex; flex-direction: column; font-size: .9rem; }

/* --- Portail (phase 4) ------------------------------------------------------------ */
.top { flex-wrap: wrap; }
.top nav { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
.top nav a { text-decoration: none; }
.top nav a.me { font-weight: 600; }
.stack-s { display: flex; flex-direction: column; gap: 6px; }
.row.wrap { flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; align-items: center; }
h2.big { font-size: 1.4rem; margin: 0; }
.columns { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .columns.manage { grid-template-columns: 260px minmax(0, 1fr); } }
.columns h2 { margin: 0; }
.games { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.game-card { display: flex; flex-direction: column; gap: 10px; padding: 0; overflow: hidden; }
.game-card > .stack-s { padding: 0 16px 16px; }
.thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg); border-radius: 10px 10px 0 0; }
.thumb.placeholder { display: grid; place-items: center; font-size: 3rem; font-weight: 700; color: var(--muted); }
.game-head { display: grid; gap: 16px 24px; grid-template-columns: minmax(0, 1fr); margin-bottom: 24px; align-items: center; }
@media (min-width: 700px) { .game-head { grid-template-columns: 320px minmax(0, 1fr); } }
.game-head .thumb { border-radius: 10px; }
.game-head h1, .player-head h1 { margin: 0; }
.game-head .lead, .player-head .lead { margin: 0; }
.player-head { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; }
.avatar.placeholder { display: inline-grid; place-items: center; background: var(--line); color: var(--fg); font-weight: 700; font-size: .8rem; }
.player-head .avatar.placeholder { font-size: 2rem; }
a.player { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 600; }
a.player:hover span { text-decoration: underline; }
.people li { justify-content: flex-start; flex-wrap: wrap; gap: 4px 8px; }
.feed li { display: block; line-height: 1.7; }
.feed .when, .board .when { margin-left: 6px; }
.board { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.board li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.board li:first-child { border-top: 0; }
.board .rank { width: 2ch; text-align: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.board li:nth-child(-n+3) .rank { color: var(--fg); }
.board .score { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.board .detail { flex-basis: 100%; padding-left: calc(2ch + 10px); }
.board.compact li { padding: 4px 0; border: 0; }
.cards { display: grid; gap: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { background: transparent; color: var(--fg); border: 1px solid var(--line); padding: 6px 12px; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 24px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: .85rem; color: var(--muted); }
.tile-value { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.nav-list a { text-decoration: none; color: var(--fg); }
.nav-list a.active { font-weight: 700; color: var(--accent); }
.nav-list li { justify-content: flex-start; flex-wrap: wrap; gap: 0 4px; }
.token { font-size: .95rem; letter-spacing: 0; text-align: left; word-break: break-all; }
.table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.columns > .stack, .columns > aside { min-width: 0; }
.card + .card { margin-top: 0; }

/* Graphique : une série, couleur validée (clair / sombre), grille discrète, texte en encre neutre. */
.viz-root { --series-1: #2a78d6; --grid: #e7e9ee; margin-bottom: 24px; }
@media (prefers-color-scheme: dark) { .viz-root { --series-1: #3987e5; --grid: #2b313c; } }
.chart { position: relative; width: 100%; min-height: 60px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .value { fill: var(--fg); font-size: 11px; font-weight: 600; }
.chart .bar { fill: var(--series-1); }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit:focus-visible { stroke: var(--fg); stroke-width: 1; }
.tooltip { position: absolute; width: 140px; pointer-events: none; background: var(--card); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: .85rem; display: flex; flex-direction: column; box-shadow: 0 4px 16px rgb(0 0 0 / .12); }

.cards > li, .plain li.card { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
.when { white-space: nowrap; }
.stack-s > button, .stack > button { align-self: flex-start; }
.plain.modes li { display: block; }
.notif-game { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.notif-game label { flex: 1 1 140px; font-weight: 400; font-size: .9rem; }
.lfg-list li.lfg { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.lfg-list li.lfg:first-child { border-top: 0; }
.lfg-list .quote { font-style: italic; margin-top: 2px; }
.lfg-list .button { padding: 6px 12px; font-size: .9rem; }

/* --- Identité : motif hexagonal ------------------------------------------------------- */
:focus-visible { outline: 2px solid var(--core); outline-offset: 2px; }
.avatar { border-radius: 0; clip-path: var(--hex); }
.avatar.placeholder { background: var(--seat); color: var(--fg); }
.board li:nth-child(-n+3) .rank { display: inline-grid; place-items: center; width: 28px; height: 32px; clip-path: var(--hex);
  background: var(--core); color: var(--accent-fg); text-align: center; font-size: .8rem; }
.board li:nth-child(2) .rank { background: var(--p2); color: #141B2B; }
.board li:nth-child(3) .rank { background: var(--p1); color: #fff; }
.board .rank { font-size: .85rem; }
.tile-value { font-weight: 600; letter-spacing: -0.02em; }
.tile { position: relative; overflow: hidden; }
.thumb.placeholder { font-family: var(--font-display); background: radial-gradient(circle at 50% 50%, var(--glow), transparent 60%), var(--bg); color: var(--core); }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* Accueil : le cœur et ses places, sur une grille hexagonale discrète. */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px 32px; align-items: center; padding-block: 12px 28px; margin-bottom: 8px; }
@media (min-width: 760px) { .hero { grid-template-columns: minmax(0, 1fr) auto; } }
.hero::before { content: ''; position: absolute; inset: -16px -16px 0; z-index: -1; background: var(--line); pointer-events: none;
  /* Grille hexagonale (le plateau et le cœur), qui s'efface vers le bas. */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48.5' viewBox='0 0 28 48.5'%3E%3Cpath d='M14 0 L28 8.08 L28 24.25 L14 32.33 L0 24.25 L0 8.08 Z M0 40.42 L14 48.5 M28 40.42 L14 48.5 M14 32.33 L14 48.5' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") repeat, linear-gradient(#000, transparent 85%); -webkit-mask-composite: source-in;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48.5' viewBox='0 0 28 48.5'%3E%3Cpath d='M14 0 L28 8.08 L28 24.25 L14 32.33 L0 24.25 L0 8.08 Z M0 40.42 L14 48.5 M28 40.42 L14 48.5 M14 32.33 L14 48.5' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") repeat, linear-gradient(#000, transparent 85%); mask-composite: intersect; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); margin: 0; }
.hero h1 b { color: var(--accent); }
.hero .lead { margin: 10px 0 0; max-width: 46ch; font-size: 1.08rem; }
.hero .live-line { margin-top: 14px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.hero .hero-mark { width: clamp(120px, 22vw, 190px); height: auto; justify-self: center; }
.hero-mark .m-core { filter: drop-shadow(0 0 10px var(--glow)); }
@media (prefers-reduced-motion: no-preference) {
  .hero-mark .m-core { animation: core-breathe 4s ease-in-out infinite; transform-origin: 50% 50%; transform-box: fill-box; }
  @keyframes core-breathe { 50% { filter: drop-shadow(0 0 18px var(--glow)); } }
}

/* Couleurs du logo, reprises des jetons (le logo suit le thème). */
.m-p1 { fill: var(--p1); } .m-p2 { fill: var(--p2); } .m-p3 { fill: var(--p3); } .m-p4 { fill: var(--p4); }
.m-seat { fill: var(--seat); } .m-core { fill: var(--core); } .m-fuel { fill: var(--fuel); }
.thumb-link { display: block; border-radius: inherit; }
.thumb-link .thumb { transition: filter .15s; }
.thumb-link:hover .thumb { filter: brightness(1.08); }

/* Tuiles repliables du profil (grand écran) */
.card.collapsible { position: relative; }
.card.collapsed { max-height: var(--fold, 360px); overflow: hidden; padding-bottom: 56px; }
.card.collapsed::after { content: ""; position: absolute; inset: auto 0 0 0; height: 96px; border-radius: 0 0 12px 12px; background: linear-gradient(to bottom, transparent, var(--card) 60%); pointer-events: none; }
.card > .collapse-toggle { align-self: center; }
.card.collapsed > .collapse-toggle { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 1; }
