/* ==========================================================================
   Coquille bid.
   - Zone de jeu : gauche 70 % (PC ≥ 900 px) / haut 60 % (mobile). Univers clair.
   - Volet du classement : droite 30 % / bas 40 %, défile, SANS montant.
   - Fenêtre « + » : plein écran, glisse du bas, montants + enchères.
   N'utilise que les variables de tokens.css (jamais redéfinies ici).
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow: hidden; /* seules les zones défilent, jamais la page */
  overscroll-behavior: none;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Grille principale — CONTRAT §2
   ========================================================================== */

.app {
  display: grid;
  grid-template-rows: minmax(0, 60fr) minmax(0, 40fr);
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

@media (min-width: 900px) {
  .app {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 70fr) minmax(0, 30fr);
  }
}

/* Téléphone, catalogue à l'écran : la zone de jeu se contente de la hauteur de ses cartes
   (~392 px sur un écran de 390 px de large) et les enchères prennent tout le reste — moitié
   haute contre un peu moins de la moitié basse, au lieu des 60/40 habituels. Dès qu'un jeu
   s'ouvre, `markView('game')` retire l'attribut et la grille reprend ses proportions.
   Le pourcentage se mesure sur la hauteur réelle de `.app` (100dvh) : sur un téléphone court,
   la zone de jeu se contente de ce qu'elle a et le catalogue défile. */
@media (max-width: 899px) {
  .app[data-game-view="catalog"] { grid-template-rows: min(56%, 412px) minmax(0, 1fr); }
}

/* ==========================================================================
   Zone de jeu : ciel lumineux et pastels, distinct du site
   ========================================================================== */

.game-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  color: var(--ink);
  background:
    radial-gradient(34% 26% at 18% 20%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 70%),
    radial-gradient(26% 18% at 80% 14%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%),
    radial-gradient(55% 45% at 6% 100%, var(--pastel-pink), rgba(255, 196, 222, 0) 70%),
    radial-gradient(50% 45% at 98% 96%, var(--pastel-mint), rgba(182, 242, 211, 0) 70%),
    radial-gradient(45% 38% at 55% 108%, var(--pastel-sun), rgba(255, 240, 184, 0) 70%),
    radial-gradient(40% 40% at 100% 40%, var(--pastel-lilac), rgba(216, 203, 255, 0) 70%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sky-low) 72%, var(--sky-horizon) 100%);
}

@media (min-width: 900px) {
  .game-pane { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left); }
}

.game-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Le jeu remplit la zone ; il gère lui-même son HUD (CONTRAT §3). */
.game-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Bouton jeux : coin haut-gauche, dans les 64 × 64 px réservés */
.games-btn {
  position: absolute;
  z-index: 10;
  top: calc(env(safe-area-inset-top) + 10px);
  left: calc(env(safe-area-inset-left) + 10px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(27, 33, 64, 0.12);
  border-radius: 14px;
  box-shadow: 0 8px 20px -8px rgba(27, 33, 64, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), background-color 160ms var(--ease);
}
.games-btn:hover { background: #ffffff; transform: translateY(-1px); box-shadow: 0 12px 24px -10px rgba(27, 33, 64, 0.5); }
.games-btn:active { transform: scale(0.95); }
.games-btn:focus-visible { outline: 3px solid var(--pop-blue); outline-offset: 2px; }

/* États de la zone de jeu (chargement, erreur) */
.game-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 72px 24px 24px; /* laisse libre le coin du bouton jeux */
  overflow: auto;
  text-align: center;
  color: var(--ink);
}
.game-state-title { font-size: 18px; font-weight: 800; letter-spacing: -0.015em; }
.game-state--error .game-state-title { font-size: 20px; }
.game-state-text { max-width: 38ch; font-size: 14.5px; color: var(--ink-2); }
.game-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }

.loader { overflow: visible; }
.loader-dot {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: hop 1000ms var(--ease) infinite;
}
.loader-dot--pink { fill: var(--pop-pink); }
.loader-dot--sun { fill: var(--pop-sun); animation-delay: 140ms; }
.loader-dot--blue { fill: var(--pop-blue); animation-delay: 280ms; }
.loader-shadow {
  fill: rgba(27, 33, 64, 0.16);
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: hop-shadow 1000ms var(--ease) infinite;
}
.loader-shadow:nth-child(2) { animation-delay: 140ms; }
.loader-shadow:nth-child(3) { animation-delay: 280ms; }

.game-state-art { margin-bottom: 2px; overflow: visible; }
.art-cloud { fill: #ffffff; stroke: rgba(63, 125, 255, 0.35); stroke-width: 2; filter: drop-shadow(0 10px 14px rgba(27, 33, 64, 0.18)); }
.art-mark { fill: var(--pop-pink); }

/* Catalogue d'arrivée : une carte par jeu, chacune lançant sa partie au clic.
   Rien ne démarre tout seul (CONTRAT §3). */
.game-catalog {
  position: absolute;
  inset: 0;
  /* 10px en haut : la même ligne que le bouton jeux, qui tient le coin (64 × 64 px). */
  padding: 10px 0 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  -webkit-overflow-scrolling: touch;
}
.game-catalog-inner { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 22px; }
/* Le titre occupe la hauteur du bouton jeux et démarre juste après lui : 44 + 12 d'écart. */
.game-catalog-title {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0 22px 0 66px;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

/* Ordinateur : 5 cartes par ligne, puis retour à la ligne. La coupure se fait d'elle-même quand
   la fenêtre rétrécit (4, 3, 2 colonnes) jusqu'au rang unique du téléphone. */
.game-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.game-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0; /* la couverture touche les bords de la carte */
  overflow: hidden;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(27, 33, 64, 0.12);
  border-radius: 18px;
  box-shadow: 0 16px 34px -22px rgba(10, 20, 60, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease),
    border-color 180ms var(--ease), background-color 180ms var(--ease);
}
.game-card:hover {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--pop-blue) 55%, transparent);
  transform: translateY(-3px);
  box-shadow: 0 22px 44px -22px rgba(10, 20, 60, 0.6);
}
.game-card:active { transform: translateY(-1px) scale(0.99); }
.game-card:focus-visible { outline: 3px solid var(--pop-blue); outline-offset: 3px; }

/* Couverture carrée, pleine largeur. Aplat pastel et icône du jeu dessous : ils restent visibles
   tant que l'image n'est pas là, et pour toujours si le jeu n'a pas de fichier de couverture. */
.game-card-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: linear-gradient(135deg, var(--pastel-sun), var(--pastel-pink) 55%, var(--pastel-lilac));
}
.game-cards li:nth-child(2n) .game-card-cover { background: linear-gradient(135deg, var(--pastel-mint), var(--sky-mid) 60%, var(--pastel-lilac)); }
.game-cards li:nth-child(3n) .game-card-cover { background: linear-gradient(135deg, var(--pastel-lilac), var(--pastel-pink) 60%, var(--pastel-sun)); }
.game-card-glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12%;
  color: var(--ink);
}
.game-card-glyph > svg { display: block; width: 76px; height: 76px; }
.game-card-shot {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* le carré de la carte décide du cadrage, jamais l'inverse */
}

.game-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px 15px;
}
.game-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.game-card-name { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.game-card-badge {
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
  white-space: nowrap;
  background: var(--pop-blue);
  border-radius: 999px;
}

/* Nombre de joueurs : le pied de carte, toujours à la même hauteur d'une carte à l'autre. */
.game-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  border-top: 1px solid rgba(27, 33, 64, 0.08);
}
.game-card-meta svg { flex: none; opacity: 0.75; }

.game-card.is-broken .game-card-cover { background: linear-gradient(135deg, #ffe4d6, #ffd1dc); }
.game-card.is-broken .game-card-glyph { color: #c2410c; }

@media (max-width: 560px) {
  .game-catalog { padding: 10px 0 18px; }
  .game-catalog-inner { padding: 0 14px; }
  .game-catalog-title { margin: 0 14px 0 60px; min-height: 42px; }
  /* Téléphone : une seule rangée, que l'on fait glisser du doigt. La carte suivante dépasse
     toujours un peu : c'est elle qui montre qu'il y en a d'autres. */
  .game-cards {
    display: flex;
    gap: 12px;
    margin: 10px 0 0;
    padding: 4px 0 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .game-cards > li { flex: 0 0 clamp(148px, 54vw, 208px); scroll-snap-align: start; }
  .game-card { min-height: 0; }
  .game-card-body { gap: 8px; padding: 12px 13px 13px; }
  .game-card-glyph > svg { width: 60px; height: 60px; }
}

.light-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid rgba(27, 33, 64, 0.14);
  border-radius: 999px;
  box-shadow: 0 8px 18px -10px rgba(27, 33, 64, 0.45);
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease), background-color 150ms var(--ease);
}
.light-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -10px rgba(27, 33, 64, 0.5); }
.light-btn:active { transform: scale(0.97); }
.light-btn:focus-visible { outline: 3px solid var(--pop-blue); outline-offset: 2px; }
.light-btn--primary { color: #ffffff; background: var(--pop-blue); border-color: transparent; }
.light-btn--primary:hover { background: #2f6cf0; }

/* ==========================================================================
   Volet du classement (sombre, identité du site) — aucun montant
   ========================================================================== */

.bids-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
  padding-bottom: calc(env(safe-area-inset-bottom) + 88px); /* place pour le bouton « + » */
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
  container: bids / inline-size;
}

@media (min-width: 900px) {
  .bids-pane { padding-left: 0; border-top: 0; border-left: 1px solid var(--line-soft); }
}

/* Verrouillage du défilement de fond pendant une fenêtre ouverte */
html.has-modal .bids-pane { overflow-y: hidden; }

.bids-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid var(--line-soft);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}

.brand { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
}
#brand-name::after {
  content: "";
  display: inline-block;
  width: 0.2em;
  height: 0.2em;
  margin-left: 0.05em;
  background: var(--red);
  border-radius: 1px;
}
.brand-tagline {
  margin-top: 4px;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}
@media (max-width: 899px) {
  .brand-tagline { display: none; }
}

/* Onglets de période */
.seg {
  display: inline-flex;
  flex: none;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}
.seg-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 999px;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { color: var(--bg); background: var(--text); }

.net-warning {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 10px 14px 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--line));
  border-radius: var(--radius);
}

.link-btn {
  padding: 0;
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: 0;
}
.link-btn:hover { color: var(--red-text); }

.bids-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 12px 14px 0;
}

@container bids (min-width: 520px) {
  .bids-head { padding: 12px 20px; }
  .bids-body { padding: 16px 20px 0; gap: 24px; }
  .net-warning { margin: 12px 20px 0; }
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-head .section-title { margin-bottom: 0; }
.section-title {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.head-meta { font-size: 12px; color: var(--muted-2); white-space: nowrap; }

/* ---------- Podium (volet) ---------- */

.podium {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@container bids (min-width: 360px) {
  .podium { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .podium-card[data-rank="1"] { grid-column: 1 / -1; }
}

@container bids (min-width: 700px) {
  .podium { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); align-items: end; gap: 12px; }
  .podium-card[data-rank="1"] { grid-column: auto; order: 2; min-height: 196px; }
  .podium-card[data-rank="2"] { order: 1; min-height: 172px; }
  .podium-card[data-rank="3"] { order: 3; min-height: 160px; }
}

.podium-card,
.sx-card {
  --medal: var(--gold);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--medal) 13%, var(--surface)) 0%, var(--surface) 75%);
  border: 1px solid color-mix(in srgb, var(--medal) 34%, var(--line-soft));
  border-top: 3px solid var(--medal);
  border-radius: 12px;
}
.podium-card[data-rank="2"], .sx-card[data-rank="2"] { --medal: var(--silver); }
.podium-card[data-rank="3"], .sx-card[data-rank="3"] { --medal: var(--bronze); }
.podium-card[data-rank="1"], .sx-card[data-rank="1"] {
  padding: 14px;
  box-shadow: 0 20px 50px -30px color-mix(in srgb, var(--gold) 70%, transparent);
}
.podium-card[data-rank="1"] .item-name,
.sx-card[data-rank="1"] .item-name { font-size: 18px; }

.pc-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-medal {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--bg);
  background: var(--medal);
  border-radius: 50%;
}
.pc-place {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--medal);
  white-space: nowrap;
}
.pc-head .chip { margin-left: auto; }
.pc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin-top: auto;
}

/* « Prendre sa place » : ouvre la fenêtre « + » sur ce rang */
.aim-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  background: color-mix(in srgb, var(--red) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 55%, transparent);
  border-radius: 999px;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 150ms var(--ease);
}
.aim-chip:hover { background: var(--red); border-color: var(--red); }
.aim-chip:active { transform: scale(0.97); }

/* ---------- Éléments communs ---------- */

.item-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.item-link[href]:hover .item-name { text-decoration: underline; text-underline-offset: 3px; }
.item-link:not([href]) { cursor: default; }

.item-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.item-name {
  flex: 0 0 auto; /* le nom passe avant le domaine, qui s'efface en premier */
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-host {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-clicks {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

.chip {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--surface-2);
  border-radius: 999px;
}

/* ---------- Liste des suivants (volet) ---------- */

.rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }

.row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-areas: "rank main" "rank meta";
  align-items: center;
  gap: 4px 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 200ms var(--ease);
}
.row:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }

.row-rank {
  grid-area: rank;
  align-self: start;
  padding-top: 1px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted-2);
  text-align: right;
}
.row .item-link { grid-area: main; }
.row-meta { grid-area: meta; display: flex; align-items: center; gap: 8px; min-width: 0; }

@container bids (min-width: 440px) {
  .row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas: "rank main meta";
    gap: 10px 14px;
    padding: 11px 6px;
  }
  .row-rank { align-self: center; padding-top: 0; }
  .row-meta { flex-direction: column; align-items: flex-end; gap: 4px; }
}

/* ---------- Activité (volet) ---------- */

.feed {
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.feed-title { display: flex; align-items: center; gap: 8px; }
.live-dot {
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 60%, transparent);
  animation: live 2s ease-out infinite;
}
.feed-list { margin: 0; padding: 0; list-style: none; }
.feed-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  border-top: 1px solid var(--line-soft);
}
.feed-item:first-child { border-top: 0; }
.feed-item.is-new { animation: slide-in 500ms var(--ease); }
.feed-text { min-width: 0; overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.feed-text strong { font-weight: 600; color: var(--text); }
.feed-time { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }
.feed-empty { font-size: 13px; color: var(--muted-2); }

/* ---------- Mises en évidence ---------- */

.is-highlight {
  animation: highlight 2800ms var(--ease);
  outline: 2px solid color-mix(in srgb, var(--good) 70%, transparent);
  outline-offset: -2px;
}
.is-bumped .pc-medal,
.is-bumped .row-rank,
.is-bumped .sx-amount { animation: bump 1400ms var(--ease); }

/* ---------- Squelettes et états ---------- */

.is-skeleton { pointer-events: none; }
.sk {
  display: block;
  height: 12px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 45%, var(--surface) 90%);
  background-size: 220% 100%;
  border-radius: 4px;
  animation: shimmer 1.4s ease-in-out infinite;
}
.podium-card.is-skeleton,
.sx-card.is-skeleton { min-height: 118px; background: var(--surface); border-color: var(--line-soft); border-top-color: var(--line); box-shadow: none; }
.sx-card.is-skeleton { min-height: 180px; }
.sk-medal { width: 26px; height: 26px; border-radius: 50%; }
.sk-w90 { width: 90%; }
.sk-w70 { width: 70%; height: 16px; }
.sk-w60 { width: 60%; }
.sk-w40 { width: 40%; }
.sk-amount { width: 45%; height: 24px; margin-top: auto; }
.sk-field { width: 100%; height: 44px; border-radius: var(--radius); }
.sk-rank { grid-area: rank; width: 18px; justify-self: end; }
.sk-stack { grid-area: main; display: flex; flex-direction: column; gap: 6px; }
.sk-amount-sm { grid-area: amount; width: 64px; height: 18px; justify-self: end; }

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 16px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.state-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 2px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 50%;
}
.state-icon--gold { color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
.state-icon--red { color: var(--red-text); background: color-mix(in srgb, var(--red) 14%, var(--surface)); }
.state-title { max-width: 30ch; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.state-text { max-width: 42ch; font-size: 14px; color: var(--muted); }
.state .btn { margin-top: 6px; }

@media (max-width: 899px) {
  .bids-pane .state { padding: 18px 14px; gap: 6px; }
  .bids-pane .state-icon { width: 42px; height: 42px; }
}

/* ==========================================================================
   Boutons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 150ms var(--ease), opacity 150ms;
}
.btn:active:not([disabled]) { transform: scale(0.98); }
.btn--primary { color: #ffffff; background: var(--red); }
.btn--primary:hover:not([disabled]) { background: var(--red-2); }
.btn--secondary { background: var(--surface-2); border-color: var(--line); }
.btn--secondary:hover:not([disabled]) { border-color: var(--muted-2); }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; min-height: 52px; font-size: 16px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.is-loading { opacity: 1; cursor: progress; }
.btn.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.btn-amount { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.btn-amount:not(:empty)::before { content: "·"; margin-right: 8px; opacity: 0.6; }

.icon-btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  transition: color 150ms var(--ease), border-color 150ms var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line); }

/* ==========================================================================
   Bouton flottant « + »
   ========================================================================== */

.help-fab {
  position: fixed;
  z-index: 30;
  right: calc(env(safe-area-inset-right) + 16px);
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  color: #ffffff;
  background: var(--red);
  border: 0;
  border-radius: 50%;
  box-shadow:
    0 12px 30px -8px color-mix(in srgb, var(--red) 75%, transparent),
    0 2px 6px rgba(0, 0, 0, 0.6);
  transition: transform 180ms var(--ease), background-color 180ms var(--ease);
}
.help-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--red);
  border-radius: inherit;
  animation: ring 2.8s var(--ease) infinite;
  pointer-events: none;
}
.help-fab:hover { background: var(--red-2); transform: translateY(-2px) scale(1.04); }
.help-fab:active { transform: scale(0.96); }
.help-fab:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.has-modal .help-fab::after { animation: none; opacity: 0; }

/* ==========================================================================
   Toasts
   ========================================================================== */

.toasts {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 90px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(calc(100vw - 24px), 440px);
  transform: translateX(-50%);
  pointer-events: none;
}
@media (min-width: 900px) {
  /* Centré sous la zone de jeu (les jeux parlent par ctx.toast) */
  .toasts { left: 35%; bottom: calc(env(safe-area-inset-bottom) + 24px); }
  .has-modal .toasts { left: 50%; }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  overflow-wrap: anywhere;
}
.toast.is-in { opacity: 1; transform: none; }
.toast-icon { margin-top: 1px; color: var(--muted); }
.toast--good { border-left-color: var(--good); }
.toast--good .toast-icon { color: var(--good); }
.toast--bad { border-left-color: var(--red); }
.toast--bad .toast-icon { color: var(--red-text); }
.toast--quiet { color: var(--muted); background: var(--surface); }

/* ==========================================================================
   Couches modales
   ========================================================================== */

.layer { position: fixed; inset: 0; z-index: 50; }

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 30, 0.45);
  opacity: 0;
  transition: opacity 260ms var(--ease);
}
.layer.is-open .backdrop { opacity: 1; }

/* ==========================================================================
   Fenêtre « + » — plein écran, glisse du bas vers le haut
   ========================================================================== */

.sheet-layer { z-index: 60; }

.sheet {
  --pad-x: 16px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  transform: translate3d(0, 100%, 0);
  transition: transform 460ms var(--ease-sheet);
  outline: none;
}
.sheet-layer.is-open .sheet { transform: none; }

.sx-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 12px) 10px calc(env(safe-area-inset-left) + 16px);
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.sx-titles { min-width: 0; }
.sx-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.sx-brand {
  font-size: 0.9em;
  letter-spacing: -0.06em;
  color: var(--muted-2);
}
.sx-brand::after {
  content: "";
  display: inline-block;
  width: 0.2em;
  height: 0.2em;
  margin-left: 0.05em;
  background: var(--red);
  border-radius: 1px;
}
.sx-sub {
  margin-top: 3px;
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sx-close { width: 44px; height: 44px; }

@media (min-width: 900px) {
  .sheet { --pad-x: 24px; }
  .sx-head { padding: calc(env(safe-area-inset-top) + 14px) 20px 14px 28px; }
  .sx-title { font-size: 25px; }
}

/* Bandeau : paiement pas encore activé */
.pay-banner {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 10px calc(env(safe-area-inset-right) + 16px) 10px calc(env(safe-area-inset-left) + 16px);
  background: color-mix(in srgb, var(--gold) 15%, var(--bg-2));
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
}
.pay-banner-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--bg);
  background: var(--gold);
  border-radius: 50%;
}
.pay-banner-body { flex: 1 1 auto; min-width: 0; }
.pay-banner-title { font-size: 14.5px; font-weight: 800; color: var(--text); }
.pay-banner-text { font-size: 13px; color: var(--muted); }
@media (min-width: 900px) {
  .pay-banner { padding: 12px 28px; }
}

.sx-h {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.015em;
}
.sx-lead { margin-top: 3px; font-size: 13.5px; color: var(--muted); }

/* .sx-col .state : voir sheet.css */

/* Podium avec montants */
.sx-podium-wrap { margin-bottom: 22px; }
.sx-podium {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@container sxboard (min-width: 440px) {
  .sx-podium { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sx-card[data-rank="1"] { grid-column: 1 / -1; }
}
@container sxboard (min-width: 820px) {
  .sx-podium { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); align-items: end; }
  .sx-card[data-rank="1"] { grid-column: auto; order: 2; }
  .sx-card[data-rank="2"] { order: 1; }
  .sx-card[data-rank="3"] { order: 3; }
}

.sx-card { gap: 10px; padding: 14px; }
.sx-money { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; }
.sx-money-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
}
.sx-amount {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--medal, var(--text));
  white-space: nowrap;
}
.sx-card[data-rank="1"] .sx-amount { font-size: 28px; }
.sx-card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }

.aim-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
.aim-btn:hover { color: var(--text); text-decoration-color: currentColor; }

/* Champ de surenchère sur chaque produit */
.rebid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px 8px;
}
.rebid .field-msg { grid-column: 1 / -1; }
.money-field { position: relative; display: flex; align-items: center; min-width: 0; }
.money-input {
  width: 100%;
  min-height: 44px;
  padding: 0 30px 0 12px;
  font-family: var(--mono);
  font-size: 16px; /* 16 px : évite le zoom automatique d'iOS */
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.money-input:hover { border-color: var(--muted-2); }
.money-input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 35%, transparent); }
.money-input[aria-invalid="true"] { border-color: var(--red-2); }
.money-unit {
  position: absolute;
  right: 11px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted-2);
  pointer-events: none;
}
.btn--pay { min-height: 44px; padding: 0 16px; }

.field-msg { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.field-msg:empty { display: none; }
.field-msg.is-error { color: var(--red-text); }
.field-msg.is-hint { color: var(--good); }

/* Liste complète avec montants */
.sx-rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.sx-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  grid-template-areas:
    "rank main amount"
    "rank form form";
  align-items: start;
  gap: 10px 12px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.sx-row .row-rank { grid-area: rank; padding-top: 2px; }
.sx-row .sk-stack { grid-area: main; }
.sx-row-main { grid-area: main; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sx-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.sx-row-amount { grid-area: amount; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.sx-row-amount .sx-amount { font-size: 17px; color: var(--text); }
.sx-row .rebid { grid-area: form; }

@container sxboard (min-width: 700px) {
  .sx-row {
    grid-template-columns: 36px minmax(0, 1fr) 110px minmax(230px, 260px);
    grid-template-areas: "rank main amount form";
    align-items: center;
    gap: 8px 16px;
    padding: 14px 6px;
  }
  .sx-row .row-rank { padding-top: 0; }
}

/* Formulaire « Ajouter mon produit » */
.aim-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px 10px;
  margin-top: 14px;
  padding: 10px 12px;
  font-size: 13.5px;
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--red) 40%, var(--line));
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.aim-note-icon { padding-top: 1px; color: var(--red-text); }
.aim-note .link-btn { grid-column: 2; justify-self: start; font-size: 13px; }

.add-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { display: flex; align-items: baseline; gap: 8px; padding: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.field-opt { font-size: 11.5px; font-weight: 500; color: var(--muted-2); }

.input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.input::placeholder { color: var(--muted-2); }
.input:hover { border-color: var(--muted-2); }
.input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 35%, transparent); }
.input[aria-invalid="true"] { border-color: var(--red-2); }
.select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.select option { color: var(--text); background: var(--surface); }

.amount-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.stepper {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  height: 62px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
}
.stepper:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 35%, transparent); }
.stepper:has(.stepper-input[aria-invalid="true"]) { border-color: var(--red-2); }
.stepper-btn {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: var(--surface-2);
  border: 0;
  transition: background-color 120ms var(--ease);
}
.stepper-btn:hover { background: var(--line); }
.stepper-btn:focus-visible { outline-offset: -3px; }
.stepper-field { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
.stepper-input {
  width: 100%;
  height: 100%;
  padding: 0 34px 0 12px;
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text);
  background: transparent;
  border: 0;
}
.stepper-input:focus { outline: none; }
.stepper-unit {
  position: absolute;
  right: 14px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--red-text);
  pointer-events: none;
}

.shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 52px;
  padding: 6px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
.shortcut:hover { color: var(--text); border-color: var(--line); }
.sc-label { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sc-amount { max-width: 100%; overflow: hidden; font-family: var(--mono); font-size: 13.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.shortcut--gold .sc-label { color: var(--gold); }
.shortcut.is-met { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.shortcut.is-met .sc-amount { color: var(--good); }

/* Rang projeté en direct */
.projection {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  min-height: 56px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--line);
  border-radius: var(--radius);
}
.projection-label { flex-basis: 100%; font-size: 12.5px; }
.projection-rank strong { font-family: var(--mono); font-size: 26px; font-weight: 800; color: var(--text); }
.projection-of { font-family: var(--mono); font-size: 13px; color: var(--muted-2); }
.projection-next { flex-basis: 100%; font-size: 13px; }
.projection-scope { flex-basis: 100%; font-size: 11.5px; color: var(--muted-2); }
.projection.is-ok { border-left-color: var(--good); }
.projection.is-podium { border-left-color: var(--silver); }
.projection.is-podium .projection-rank strong { color: var(--silver); }
.projection.is-gold {
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--gold) 45%, var(--line-soft));
  border-left-color: var(--gold);
}
.projection.is-gold .projection-rank strong { color: var(--gold); }
.projection.is-bad { align-items: center; color: var(--red-text); border-left-color: var(--red); }
.projection.is-muted { align-items: center; color: var(--muted-2); }

/* Pied collant : l'action reste visible pendant la saisie */
.form-foot {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 calc(-1 * var(--pad-x));
  padding: 14px var(--pad-x) 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-2) 0%, transparent), var(--bg-2) 22%);
}
.foot-note { font-size: 12.5px; color: var(--muted-2); text-align: center; }

/* Activité avec montants */
.sx-feed-list { margin: 12px 0 0; padding: 0; list-style: none; }
.sx-feed-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  font-size: 13.5px;
  border-top: 1px solid var(--line-soft);
}
.sx-feed-item:first-child { border-top: 0; }
.sx-feed-item.is-new { animation: slide-in 500ms var(--ease); }
.sx-feed-amount {
  min-width: 62px;
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--red-text);
  white-space: nowrap;
}
.sx-feed-text { min-width: 0; overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.sx-feed-text strong { font-weight: 600; color: var(--text); }
.sx-feed-rank { font-family: var(--mono); }
.sx-feed-time { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }
.sx-feed .feed-empty { margin-top: 10px; }

/* Comment ça marche */
.rules { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.rule {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.rule-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 50%;
}
.rule:first-child .rule-num { color: var(--bg); background: var(--gold); }
.rule-title { margin-bottom: 2px; font-size: 14.5px; font-weight: 700; }
.rule-text { font-size: 13.5px; color: var(--muted); }

/* ==========================================================================
   Popup jeux — univers clair, comme la zone de jeu
   ========================================================================== */

.games-layer { z-index: 55; }

.games-panel {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 62px);
  left: calc(env(safe-area-inset-left) + 10px);
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - env(safe-area-inset-top) - 76px);
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
  border: 1px solid rgba(27, 33, 64, 0.08);
  border-radius: 18px;
  box-shadow: 0 30px 70px -24px rgba(10, 20, 60, 0.6);
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top left;
  transition: opacity 220ms var(--ease), transform 260ms var(--ease);
  outline: none;
}
.games-layer.is-open .games-panel { opacity: 1; transform: none; }
.games-panel :focus-visible { outline-color: var(--pop-blue); }

.games-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.games-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.games-sub { margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.games-panel .icon-btn { color: var(--ink-2); background: #ffffff; border-color: rgba(27, 33, 64, 0.12); }
.games-panel .icon-btn:hover { color: var(--ink); border-color: rgba(27, 33, 64, 0.3); }

.games-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.game-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid rgba(27, 33, 64, 0.1);
  border-radius: 14px;
  box-shadow: 0 6px 16px -12px rgba(27, 33, 64, 0.5);
  transition: border-color 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
}
.game-item:hover { border-color: color-mix(in srgb, var(--pop-blue) 50%, transparent); transform: translateY(-1px); }
.game-item[aria-current="true"] {
  border-color: var(--pop-blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pop-blue) 25%, transparent);
}
.game-item-icon {
  position: relative; /* la couverture se pose par-dessus l'icône du module */
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 9px;
  overflow: hidden; /* la couverture épouse les coins arrondis de la vignette */
  color: var(--ink);
  background: linear-gradient(135deg, var(--pastel-sun), var(--pastel-pink) 55%, var(--pastel-lilac));
  border-radius: 12px;
}
.games-list li:nth-child(2n) .game-item-icon { background: linear-gradient(135deg, var(--pastel-mint), var(--sky-mid) 60%, var(--pastel-lilac)); }
.game-item-glyph { display: grid; place-items: center; width: 100%; height: 100%; }
.game-item-icon svg { display: block; width: 100%; height: 100%; }
/* Couverture carrée du jeu : elle remplit la vignette jusqu'aux bords. */
.game-item-shot {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.game-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.game-item-name { font-size: 15.5px; font-weight: 800; overflow-wrap: anywhere; }
.game-item-tag { font-size: 13px; color: var(--ink-2); }
.game-item-badge {
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
  white-space: nowrap;
  background: var(--pop-blue);
  border-radius: 999px;
}
.game-item.is-loading .game-item-tag { opacity: 0.7; }
.game-item.is-broken .game-item-icon { color: #c2410c; background: linear-gradient(135deg, #ffe4d6, #ffd1dc); }

/* « Tous les jeux » : retour au catalogue, en tête de liste quand une partie tourne. */
.game-item--back {
  grid-template-columns: 52px minmax(0, 1fr);
  min-height: 62px;
  background: #f2f7ff;
  border-style: dashed;
}
.game-item--back .game-item-icon { background: linear-gradient(135deg, #ffffff, #e6f0ff); }
.game-item--back .game-item-name { font-size: 15px; }
.game-item--back .game-item-tag { font-size: 12.5px; }

.noscript { padding: 24px; color: var(--muted); }

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes highlight {
  0% { background-color: color-mix(in srgb, var(--good) 28%, transparent); }
  100% { background-color: transparent; }
}
@keyframes bump {
  0% { color: var(--good); transform: translateY(-2px); }
  100% { transform: none; }
}
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes live {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}
@keyframes ring {
  0% { opacity: 0.7; transform: scale(1); }
  60%, 100% { opacity: 0; transform: scale(1.45); }
}
@keyframes hop {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  45% { transform: translateY(-14px) rotate(45deg); }
  70% { transform: translateY(0) rotate(90deg); }
}
@keyframes hop-shadow {
  0%, 100% { transform: scale(1); opacity: 1; }
  45% { transform: scale(0.6); opacity: 0.5; }
  70% { transform: scale(1); opacity: 1; }
}
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .help-fab::after, .live-dot, .sk, .loader-shadow { animation: none !important; }
  /* Chargement : signal doux et immobile plutôt que des sauts */
  .loader-dot { animation: pulse-soft 1.6s ease-in-out infinite !important; }
}
