:root {
  /* Police mono : réservée aux valeurs numériques qui changent (minuteurs,
     prix, compteurs, PV/ATK, probabilités) et aux journaux techniques.
     Employée pour une quarantaine de rôles elle ne signalait plus rien
     (audit P3-04) ; le texte courant reste en Space Grotesk. */
  --accent: #8ab4ff;
  --text: #cfd4e0;
  --text-strong: #ffffff;
  --text-secondary: #8a91a3;
  --text-tertiary: #8a91a3; /* était #6d7488 (4,3:1, échec AA) — audit design F-03 */
  --text-disabled: #767d8f; /* était #5c6376 (3,4:1) — remonté à 4,5:1 pile, F-03 */
  --text-disabled-2: var(--text-disabled); /* était un 2e gris à 2,7:1 ; fusionné, F-03 */
  --danger: #ff6b6b;
  --focus: #fff;
  /* Sélection / état actif d'un contrôle : neutre élevé. L'accent est
     réservé à l'action principale et à la position de navigation — il
     désignait huit choses à la fois et ne disait plus « ici » (audit P3-06). */
  --selected-bg: rgba(255,255,255,.12);
  --selected-ring: rgba(255,255,255,.40);

  /* Échelle de rareté : gris → vert → bleu → violet → ambre, chroma
     croissant. Ne réutilise aucune couleur employée ailleurs (--accent,
     --text, le point du wordmark) — c'était le problème d'origine
     (audit design F-01/F-02). */
  --rarity-commun: oklch(.76 .012 265);
  --rarity-peu_commun: oklch(.76 .13 155);
  --rarity-rare: oklch(.71 .13 235);
  --rarity-epique: oklch(.68 .21 310);
  --rarity-legendaire: oklch(.74 .19 50);
  --currency: #ffd873;
  --success: oklch(.72 .16 175); /* teinte volontairement différente de --rarity-peu_commun (F-06) */

  /* Échelle typographique : six crans (audit P3-03) au lieu de vingt et une
     tailles littérales, demi-pixels compris. Une taille écrite en dur en
     dehors de ces variables est un oubli. Les clamp() fluides (titres
     d'accueil) restent hors échelle. */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 32px;

  /* Surfaces (deux niveaux d'élévation au-dessus du fond) et filets : huit
     alphas quasi identiques (.02 à .06) étaient répétés en dur (audit P3-05). */
  --surface-1: rgba(255,255,255,.03);
  --surface-2: rgba(255,255,255,.05);
  --surface-3: #12161d;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.10);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--text);
  background-color: #08090c;
  background-image:
    radial-gradient(900px 520px at 50% -8%, rgba(120,160,255,.10), transparent 68%),
    radial-gradient(820px 480px at 50% 104%, rgba(102,192,244,.07), transparent 70%);
  background-attachment: fixed;
}

a { color: var(--text); text-decoration: none; }

.hidden { display: none !important; }

/* Anneau de focus clavier explicite (audit design F-30) : l'anneau bleu
   par défaut du navigateur disparaît sur les boutons en --accent, et
   aucune règle :focus-visible n'existait sinon. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Sur un aplat clair (accent) l'anneau blanc seul se perd : un filet sombre
   dans l'écart entre le bord et l'anneau le détache. */
.btn-primary:focus-visible, .side-nav-item.active:focus-visible {
  box-shadow: 0 0 0 2px #0b0d13;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }

/* --- Mono utility links --- */
.mono-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  transition: color .15s ease;
}
.mono-link:hover { color: #fff; }

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.icon-link i { font-size: var(--fs-xs); }

/* --- Wordmark --- */
.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
}
.wordmark .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px 2px color-mix(in oklab, var(--accent) 55%, transparent);
  flex-shrink: 0;
}
.wordmark span:last-child {
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -.01em;
  color: #fff;
}

/* --- En-tête de page (audit design F-08) : titre + métrique clé,
   identique sur les 6 pages qui n'avaient ni H1 ni H2 (Caisses a déjà sa
   propre ligne de statut, servant de référence, non dupliquée ici). --- */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}
.page-header-meta {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* --- Login view : accueil publique. Deux colonnes sur ordinateur (présentation
   à gauche, formulaire à droite) pour que tout tienne dans l'écran sans
   défiler ; une seule colonne, formulaire en 3e, sur petit écran. --- */
.login-view {
  min-height: 100vh;
  padding: clamp(24px, 5vh, 56px) 32px;
  display: flex;
  align-items: center;
}

@keyframes omRise { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }

.landing {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-areas:
    "brand    auth"
    "hero     auth"
    "features auth"
    "rarity   auth";
  grid-template-rows: auto auto auto auto;
  column-gap: clamp(32px, 6vw, 88px);
  align-items: start;
  text-align: left;
  animation: omRise .5s ease both;
}

.landing-wordmark { grid-area: brand; margin-bottom: clamp(20px, 5vh, 48px); }

/* Le bloc prend la largeur du titre ; la description se cale dessus (largeur 0 +
   min-width 100 % : elle ne peut pas élargir le bloc), donc même bord droit. */
.landing-hero { grid-area: hero; width: fit-content; max-width: 100%; }
.landing-hero h1 {
  font-weight: 600;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.08;
  letter-spacing: -.03em;
  text-wrap: balance; /* pas de mot orphelin sur la dernière ligne */
  margin: 0 0 16px;
  color: #fff;
}
.landing-hero .subtext {
  margin: 0 0 clamp(20px, 4vh, 36px);
  width: 0;
  min-width: 100%;
  text-wrap: pretty;
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text-secondary);
}

.login-card {
  grid-area: auth;
  align-self: center;
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  border-radius: 20px;
  text-align: left;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 0 1px rgba(138,180,255,.06), 0 30px 70px rgba(0,0,0,.4);
}
.login-card h2 {
  margin: 0 0 22px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #fff;
}

.landing-features {
  grid-area: features;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 clamp(18px, 4vh, 36px);
}
.feature-card {
  padding: 18px 16px;
  border-radius: 16px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  text-align: left;
}
.feature-card i {
  display: inline-flex;
  font-size: var(--fs-lg);
  color: var(--text);
  margin-bottom: 10px;
}
.feature-card strong { display: block; color: #fff; font-size: var(--fs-md); font-weight: 600; margin-bottom: 6px; }
.feature-card p { margin: 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--text-secondary); }

/* Pleine largeur de la colonne : même bord droit que les trois cartes. */
.rarity-spectrum-block { grid-area: rarity; width: 100%; }
.rarity-spectrum-block > .mono-note { margin: 0 0 12px; text-align: left; }
.rarity-spectrum {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}
.rarity-seg-commun { background: var(--rarity-commun); }
.rarity-seg-peu_commun { background: var(--rarity-peu_commun); }
.rarity-seg-rare { background: var(--rarity-rare); }
.rarity-seg-epique { background: var(--rarity-epique); }
.rarity-seg-legendaire { background: var(--rarity-legendaire); }
.rarity-spectrum-legend {
  display: flex;
  justify-content: space-between; /* les pastilles couvrent toute la barre */
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

/* Petit écran : une colonne centrée, dans l'ordre marque, accroche,
   formulaire, puis le détail — la page peut défiler. */
@media (max-width: 900px) {
  .login-view { display: block; padding: 48px 22px 64px; }
  .landing {
    max-width: 640px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "hero" "auth" "features" "rarity";
    justify-items: center;
    text-align: center;
  }
  .landing-wordmark { margin-bottom: 40px; }
  .landing-hero { width: auto; }
  .landing-hero .subtext { width: auto; max-width: 460px; margin: 0 auto 36px; }
  .login-card { align-self: start; }
  .landing-features { width: 100%; margin: 56px 0 36px; }
  .rarity-spectrum-block > .mono-note { text-align: center; }
  .rarity-spectrum-legend { justify-content: center; }
}
@media (max-width: 640px) {
  .landing-features { grid-template-columns: 1fr; }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}
.auth-form input {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-md);
  padding: 13px 16px;
  border-radius: 10px;
}
.auth-form input::placeholder { color: var(--text-disabled); }
.auth-form .btn-lg { width: 100%; }
.auth-error {
  margin: 0;
  min-height: 16px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--danger);
}
.auth-toggle a {
  color: var(--accent);
  text-decoration: none;
}
.auth-toggle a:hover { text-decoration: underline; }

.mono-note {
  margin: 18px 0 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-disabled);
}

/* --- App view : sidebar + contenu --- */
.app-view {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: 232px;
  flex: 0 0 232px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 18px;
  background: var(--surface-1);
  border-right: 1px solid var(--line);
}

.sidebar-wordmark { padding: 0 6px; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-md);
  font-weight: 500;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .16s ease, color .16s ease;
}
.side-nav-item i { font-size: var(--fs-md); width: 18px; text-align: center; }
.nav-more-btn { display: none; }
.side-nav-item:hover { background: rgba(255,255,255,.045); color: #fff; }
.side-nav-item.active {
  background: color-mix(in oklab, var(--accent) 16%, transparent);
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 55%, transparent);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 6px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #04121e;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: var(--fs-xs);
}
.user-avatar img, .profile-avatar img, .row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- En-tête de la page profil : avatar (éditable) + pseudo + collection --- */
.profile-header { display: flex; align-items: center; gap: 20px; }
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #04121e;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: var(--fs-xl);
}
.profile-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #08090c;
  background: var(--accent);
  color: #04121e;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: filter .15s ease;
}
.profile-avatar-edit:hover, .profile-avatar-edit:focus-visible { filter: brightness(1.12); }
.profile-header-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.profile-name {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-header-meta {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.user-name {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-area {
  flex: 1 1 auto;
  min-width: 0;
}

.content {
  max-width: 1080px;
  margin: 0 auto;
  /* Marges et intervalles suivent la hauteur de la fenêtre (vh) : sur un
     écran bas, les pages Caisses et Collection tiennent sans défiler. */
  --pad-top: clamp(14px, 3vh, 44px);
  --pad-bottom: clamp(20px, 4vh, 44px);
  padding: var(--pad-top) clamp(16px, 4vw, 40px) var(--pad-bottom);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.2vh, 26px);
  overflow-x: hidden;
}

.page-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vw, 26px);
}

@media (max-width: 760px) {
  .app-view { flex-direction: column; }
  /* En-tête : marque + monnaie/compte. La navigation passe dans une barre
     fixe en bas (audit P2-12) : quatre entrées avec libellé sous l'icône, le
     reste derrière « Plus » — neuf icônes seules ne se devinaient pas. */
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    width: 100%;
    flex: 0 0 auto; /* la base desktop (232px) devenait une hauteur en colonne */
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 10px 14px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    background: #0b0d13;
  }
  .sidebar-footer { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }

  .side-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #0b0d13;
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .side-nav-item {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    text-align: center;
  }
  .side-nav-item > span:not(.nav-badge) { font-size: var(--fs-xs); }
  .side-nav-item .nav-badge { position: absolute; top: 6px; left: calc(50% + 8px); }
  .nav-secondary { display: none; }
  /* « Plus » ouvert : les entrées secondaires forment une rangée au-dessus. */
  .side-nav.more-open .nav-secondary { display: flex; grid-row: 1; }
  .side-nav.more-open > :not(.nav-secondary) { grid-row: 2; }
  .side-nav.more-open .nav-secondary.hidden { display: none; }
  .nav-more-btn { display: flex; }
  /* En-tête compact : pseudo et « déconnexion » restent lisibles pour un
     lecteur d'écran mais ne doivent pas faire déborder la ligne. */
  .sidebar-footer { gap: 10px; }
  .sidebar-user .user-name,
  .logout-link span:not(.fi) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .main-area { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast-region { bottom: calc(84px + env(safe-area-inset-bottom)); right: 12px; }
}

.case-status-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.case-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: #fff;
}
.case-status i { color: var(--text-secondary); }
.case-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}
.collection-progress {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}
.collection-progress span:first-child {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-md);
  font-weight: 600;
  color: #fff;
}

.album-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.modal-card .album-search {
  flex: 0 0 auto;
}
.album-search {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--text-secondary);
}
.album-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-md);
}
.album-search input::placeholder { color: var(--text-disabled); }
.album-search:focus-within { box-shadow: 0 0 0 2px var(--focus); }

.album-select {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-md);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.album-select option { background: #12161d; color: #fff; }

/* Bascule Tout / Possédés de l'album. */
.scope-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.scope-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.scope-btn:hover { color: #fff; }
.scope-btn.active { background: rgba(255,255,255,.12); color: #fff; }


.album-rarity-filters { gap: 7px; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.album-item {
  position: relative;
  aspect-ratio: 920 / 430;
  border-radius: 10px;
  overflow: hidden;
  background: #101318;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s ease;
}
.album-item:not(.locked):hover { transform: scale(1.03); }
.album-item .album-name {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
}
.album-item .album-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(8,9,12,.85));
}
.album-item .album-count {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  padding: 2px 6px;
  border-radius: 999px;
}
.album-item .album-rarity-dot {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(8,9,12,.65), 0 0 6px 1px currentColor;
}
.album-rarity-dot.rarity-commun { background: var(--rarity-commun); color: var(--rarity-commun); }
.album-rarity-dot.rarity-peu_commun { background: var(--rarity-peu_commun); color: var(--rarity-peu_commun); }
.album-rarity-dot.rarity-rare { background: var(--rarity-rare); color: var(--rarity-rare); }
.album-rarity-dot.rarity-epique { background: var(--rarity-epique); color: var(--rarity-epique); }
.album-rarity-dot.rarity-legendaire { background: var(--rarity-legendaire); color: var(--rarity-legendaire); }

.album-item.locked {
  background: #0b0e12;
}
.album-item.locked .gamecard-art {
  filter: grayscale(1) brightness(0.25) blur(1px);
}
.album-item.locked .album-name { color: rgba(255,255,255,.35); }

.rarity-badge, .badge-alert, .badge-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap; /* à 12 px « PEU COMMUN » passait sur deux lignes dans l'historique */
  flex-shrink: 0;
}
/* Sanction (ex : joueur banni) — distincte de la rareté (audit design
   F-04/F-18) : réutilisait --rarity-legendaire, la couleur la plus
   désirable du jeu comme étiquette de sanction. */
.badge-alert { background: color-mix(in oklab, var(--danger) 20%, transparent); color: var(--danger); }
/* Statut neutre (ex : "nouveau") — contour, pas une pastille pleine,
   pour ne jamais se confondre avec un badge de rareté à côté (F-18) :
   avant, "nouveau" et la rareté tirée avaient la même forme pleine, et
   se confondaient carrément en couleur pour un tirage "rare". */
.badge-status { background: transparent; color: var(--text-secondary); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }

.rarity-commun { background: color-mix(in oklab, var(--rarity-commun) 14%, transparent); color: var(--rarity-commun); }
.rarity-peu_commun { background: color-mix(in oklab, var(--rarity-peu_commun) 18%, transparent); color: var(--rarity-peu_commun); }
.rarity-rare { background: color-mix(in oklab, var(--rarity-rare) 20%, transparent); color: var(--rarity-rare); }
.rarity-epique { background: color-mix(in oklab, var(--rarity-epique) 22%, transparent); color: var(--rarity-epique); }
.rarity-legendaire { background: color-mix(in oklab, var(--rarity-legendaire) 22%, transparent); color: var(--rarity-legendaire); }

.status-text {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  padding: 40px 0;
  text-align: center;
}
.status-text.hidden { display: none !important; }

.section-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 15px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-sm);
  font-weight: 500;
  border: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
/* Coloré dans sa propre couleur de rareté quand actif (jamais en accent
   générique) : la barre de filtres devient aussi la légende du système
   de rareté (audit design F-21). Neutre par défaut (voir isFiltering
   dans collection.ts/market.ts) tant qu'aucun filtre réel n'est posé. */
.tag-chip.active.tag-chip-commun { background: color-mix(in oklab, var(--rarity-commun) 16%, transparent); color: var(--rarity-commun); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rarity-commun) 55%, transparent); }
.tag-chip.active.tag-chip-peu_commun { background: color-mix(in oklab, var(--rarity-peu_commun) 16%, transparent); color: var(--rarity-peu_commun); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rarity-peu_commun) 55%, transparent); }
.tag-chip.active.tag-chip-rare { background: color-mix(in oklab, var(--rarity-rare) 16%, transparent); color: var(--rarity-rare); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rarity-rare) 55%, transparent); }
.tag-chip.active.tag-chip-epique { background: color-mix(in oklab, var(--rarity-epique) 16%, transparent); color: var(--rarity-epique); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rarity-epique) 55%, transparent); }
.tag-chip.active.tag-chip-legendaire { background: color-mix(in oklab, var(--rarity-legendaire) 16%, transparent); color: var(--rarity-legendaire); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rarity-legendaire) 55%, transparent); }

/* --- Stage / reel --- */
@keyframes omNudge {
  0%, 100% { transform: translate3d(0,0,0); }
  22% { transform: translate3d(0,-4px,0); }
  55% { transform: translate3d(0,2px,0); }
}

.stage {
  position: relative;
  border-radius: 24px;
  padding: clamp(10px, 1.4vw, 14px);
  background: var(--surface-1);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.stage.won {
  box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 60px color-mix(in oklab, var(--won-tone, #fff) 14%, transparent);
  animation: omNudge .5s cubic-bezier(.3,1.4,.4,1) both;
}

.reel-viewport {
  position: relative;
  height: clamp(120px, min(21vw, 22vh), 200px);
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface-1);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
}

.track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  gap: 10px;
  will-change: transform;
}

.tile {
  position: relative;
  flex: 0 0 clamp(126px, 17vw, 186px);
  width: clamp(126px, 17vw, 186px);
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #101318;
  border: 1px solid var(--line);
}

.tile .art {
  position: absolute;
  inset: -16px;
  display: block;
  object-fit: cover;
  width: calc(100% + 32px);
  height: calc(100% + 32px);
  filter: blur(10px) saturate(1.1);
}

.tile .scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,9,12,.1) 30%, rgba(8,9,12,.82));
}

.tile .tile-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse 95% 80% at 50% 108%, var(--glow-color), transparent 68%);
}
.tile-glow-commun { --glow-color: color-mix(in oklab, var(--rarity-commun) 35%, transparent); }
.tile-glow-peu_commun { --glow-color: color-mix(in oklab, var(--rarity-peu_commun) 55%, transparent); }
.tile-glow-rare { --glow-color: color-mix(in oklab, var(--rarity-rare) 70%, transparent); }
.tile-glow-epique { --glow-color: color-mix(in oklab, var(--rarity-epique) 85%, transparent); }
.tile-glow-legendaire { --glow-color: var(--rarity-legendaire); }

.tile.tile-rarity-commun { border-color: color-mix(in oklab, var(--rarity-commun) 45%, transparent); box-shadow: 0 0 14px -2px color-mix(in oklab, var(--rarity-commun) 40%, transparent); }
.tile.tile-rarity-peu_commun { border-color: color-mix(in oklab, var(--rarity-peu_commun) 55%, transparent); box-shadow: 0 0 18px -1px color-mix(in oklab, var(--rarity-peu_commun) 55%, transparent); }
.tile.tile-rarity-rare { border-color: color-mix(in oklab, var(--rarity-rare) 60%, transparent); box-shadow: 0 0 21px -1px color-mix(in oklab, var(--rarity-rare) 62%, transparent); }
.tile.tile-rarity-epique { border-color: color-mix(in oklab, var(--rarity-epique) 65%, transparent); box-shadow: 0 0 25px 0 color-mix(in oklab, var(--rarity-epique) 70%, transparent); }
.tile.tile-rarity-legendaire { border-color: color-mix(in oklab, var(--rarity-legendaire) 70%, transparent); box-shadow: 0 0 28px 1px color-mix(in oklab, var(--rarity-legendaire) 78%, transparent); }

/* ===== Carte de jeu : traitement flou+logo partagé (audit design F-17).
   Le reel (.tile) et le marché/la modale gardent leurs règles existantes
   (déjà flou+logo) ; ces classes servent aux contextes qui affichaient
   une jaquette nette+nom (album, profil, admin) pour rendre le même
   jeu reconnaissable d'un écran à l'autre. Container : garde sa propre
   classe pour position/overflow/background, ajoute juste .gamecard-{xs,sm}. */
.gamecard-art {
  position: absolute;
  display: block;
  object-fit: cover;
}
.gamecard-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,9,12,.1) 30%, rgba(8,9,12,.82));
}
.gamecard-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.85));
}
.gamecard-name-fallback {
  position: absolute;
  inset: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #fff;
}

.gamecard-sm { border-radius: 10px; }
.gamecard-sm .gamecard-art { inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); filter: blur(7px) saturate(1.1); }
.gamecard-sm .gamecard-logo { max-width: 74%; max-height: 58%; }

.gamecard-xs { border-radius: 8px; }
.gamecard-xs .gamecard-art { inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); filter: blur(4px) saturate(1.1); }
.gamecard-xs .gamecard-logo { max-width: 70%; max-height: 60%; }
.gamecard-xs .gamecard-name-fallback { display: none; } /* pas la place à cette taille */

/* Liseré de rareté : variante d'état légère pour les tailles sm/xs (le
   reel garde son propre halo, plus marqué, via .tile-rarity-*). */
.gamecard-rarity-commun { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--rarity-commun) 45%, transparent); }
.gamecard-rarity-peu_commun { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--rarity-peu_commun) 55%, transparent); }
.gamecard-rarity-rare { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--rarity-rare) 60%, transparent); }
.gamecard-rarity-epique { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--rarity-epique) 65%, transparent); }
.gamecard-rarity-legendaire { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--rarity-legendaire) 70%, transparent); }

.tile .logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 78%;
  max-height: 58%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.85));
}

.tile .name-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-align: center;
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: #fff;
}

.tile .tile-tag {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.45);
}

@keyframes omBreathe { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }

.marker {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1.5px;
  margin-left: -.75px;
  z-index: 6;
  pointer-events: none;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.9) 14%, rgba(255,255,255,.9) 86%, transparent);
  box-shadow: 0 0 22px 2px rgba(255,255,255,.3);
  opacity: 1;
  transition: opacity .25s ease;
}
.marker.spinning { animation: omBreathe 1.1s ease-in-out infinite; }
/* Le trait central reste visible une fois le tirage terminé. */

@keyframes omFrame {
  0% { opacity: 0; transform: scale(1.18); }
  60% { opacity: 1; transform: scale(.985); }
  100% { opacity: 1; transform: scale(1); }
}

.winner-frame {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: clamp(126px, 17vw, 186px);
  margin-left: calc(clamp(126px, 17vw, 186px) / -2);
  z-index: 8;
  pointer-events: none;
  border-radius: 14px;
  opacity: 0;
}
.winner-frame.show {
  opacity: 1;
  box-shadow: inset 0 0 0 1.5px var(--won-tone, #fff), 0 0 44px color-mix(in oklab, var(--won-tone, #fff) 40%, transparent);
  animation: omFrame .55s cubic-bezier(.2,1.3,.35,1) both;
}

.sparks {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
}

@keyframes omSpark {
  0% { opacity: .9; transform: translate3d(0,0,0) scale(1); }
  100% { opacity: 0; transform: translate3d(var(--dx), var(--dy), 0) scale(.25); }
}

@keyframes omFlash { 0% { opacity: 0; } 10% { opacity: .85; } 100% { opacity: 0; } }

.flash {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  border-radius: 20px;
  opacity: 0;
}
.flash.show {
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.75), color-mix(in oklab, var(--accent) 26%, transparent) 42%, transparent 70%);
  animation: omFlash .8s ease-out both;
}

/* Boutons (audit P3-01) : une base .btn, deux axes — variante et taille —
   au lieu de sept définitions complètes (spin-btn, admin-action,
   achievement-claim-btn, market-bid-btn, pagination-btn, duration-btn) qui
   se recopiaient avec quatre hauteurs et trois familles de couleurs.
     variante : .btn-primary (accent : l'action principale de l'écran, une
                seule), .btn-secondary, .btn-danger, .btn-option (choix dans
                un groupe, .active = sélectionné)
     taille   : .btn-sm 32px (utilitaire), .btn-md 40px (accent secondaire),
                .btn-lg 48px (action principale d'un écran)
   Les puces de filtre .tag-chip restent un composant à part : ce sont des
   filtres colorés par rareté, pas des actions. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, box-shadow .2s ease, transform .15s ease, opacity .16s ease, filter .16s ease;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: var(--fs-sm); }
.btn-md { flex: 0 0 auto; min-height: 40px; padding: 0 16px; font-size: var(--fs-sm); }
.btn-lg {
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  min-height: 48px;
  padding: 0 34px;
  font-size: var(--fs-lg);
  letter-spacing: -.01em;
}
.btn-primary {
  background: var(--accent);
  color: #04121e;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-lg.btn-primary { box-shadow: 0 10px 34px color-mix(in oklab, var(--accent) 26%, transparent); }
.btn-secondary { background: var(--surface-2); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.btn-danger { background: rgba(255,107,107,.14); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(255,107,107,.24); }
.btn-option { background: var(--surface-2); color: var(--text-secondary); }
.btn-option:hover:not(:disabled) { color: #fff; }

/* --- Ligne de statut : le stock remplace le compteur X/10 --- */
.case-status-unit { font-weight: 500; color: var(--text-secondary); }

/* --- Ligne de résultat : hauteur fixe, sinon la scène grandit à l'arrivée
   du nom (.result-text.won passe à clamp(22px,3.4vw,32px)) --- */
.result-bar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 22px 10px 2px;
  height: 35px;
  box-sizing: content-box;
}

/* « Passer l'animation » : dans la barre de résultat, à droite, visible
   seulement pendant le défilement (un clic sur le défilement ou Échap font
   pareil). */
.skip-btn { margin-left: auto; align-self: center; flex-shrink: 0; position: relative; display: inline-flex; align-items: center; }
.skip-label { display: inline-flex; align-items: center; gap: 6px; }
.skip-btn i { display: flex; align-items: center; justify-content: center; line-height: 1; font-size: var(--fs-md); }
/* Réservé aux VIP : texte grisé et flouté, cadenas par-dessus (comme « Tout ouvrir »).
   Le bouton reste cliquable : il mène à la fenêtre VIP. */
.skip-btn .skip-lock { display: none; }
.skip-btn.locked { cursor: pointer; }
.skip-btn.locked .skip-label { opacity: .4; filter: blur(1.5px); }
.skip-btn.locked .skip-lock {
  display: flex;
  position: absolute;
  inset: 0;
  color: #fff;
  font-size: var(--fs-lg);
}
.reel-viewport.skippable { cursor: pointer; }

/* Les boutons vont à droite ; la rangée passe à la ligne sur petit écran. */
#vipBonusBtn { margin-left: auto; }
#vipBonusBtn.hidden { display: none; }
.open-all-btn { margin-left: 0; }
#vipBonusBtn.hidden + .open-all-btn { margin-left: auto; }
.open-all-btn.hidden { display: none; }
/* « Tout ouvrir » réservé aux VIP : bouton grisé, cadenas par-dessus. Reste
   cliquable (mène à la fenêtre VIP), donc pas de :disabled. */
.open-all-btn.locked { position: relative; cursor: pointer; }
.open-all-btn.locked .open-all-label { opacity: .4; filter: blur(1.5px); } /* texte flouté : le cadenas ressort */
.open-all-btn.locked .open-all-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--fs-lg);
}

/* Résultats de « Tout ouvrir ». */
/* .modal-card (défini plus bas, même spécificité) impose max-width: 380px. */
.modal-card.open-all-card { max-width: 460px; }
.open-all-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}
.open-all-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--surface-2);
}
.open-all-thumb {
  position: relative;
  width: 64px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.open-all-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.open-all-name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Inventaire --- */
.inventory-section { display: flex; flex-direction: column; gap: 12px; }
.inventory-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.inventory-hint {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* nowrap explicite — la rangée ne doit jamais se casser en deux lignes.
   space-between : les emplacements gardent une largeur fixe (86px) mais la
   rangée s'étire pour caler son bord droit sur celui des autres sections
   (stage, historique) au lieu de rester plus courte qu'elles. */
.inventory { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 10px; }
.inventory.dimmed .crate-slot { opacity: .3; }

.crate-slot {
  position: relative;
  flex: 0 0 86px;
  width: 86px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 9px;
  background: var(--surface-1);
  border: 1px dashed rgba(255,255,255,.09);
  cursor: default;
  transition: transform .16s ease, box-shadow .2s ease, opacity .2s ease;
}
.crate-slot.filled {
  background: #12161d;
  border: 1px solid var(--line-strong);
  cursor: pointer;
}
.crate-slot.filled:hover, .crate-slot.filled:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(0,0,0,.35),
              inset 0 0 0 1px var(--selected-ring);
}
.crate-slot .slot-timer {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}
.crate-slot.filling { animation: omSlotFill .42s cubic-bezier(.2,1.2,.35,1) both; }

/* --- Vignette coffre : 5 div, aucune image. Les tailles dérivent de
   --crate-w, donc le même markup sert à 52px (emplacement) et au
   centre de la scène (scale 1.9 via transform). --- */
.crate {
  position: relative;
  width: var(--crate-w, 52px);
  height: calc(var(--crate-w, 52px) * .7);
  transform-origin: bottom center;
}
.crate-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--crate-w) * .483);
  border-radius: calc(var(--crate-w) * .07);
  background: linear-gradient(180deg, #191e27, #0d1016);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.crate-strap {
  position: absolute;
  bottom: 0;
  width: calc(var(--crate-w) * .066);
  height: calc(var(--crate-w) * .483);
  background: var(--surface-2);
}
.crate-strap-l { left: calc(var(--crate-w) * .23); }
.crate-strap-r { right: calc(var(--crate-w) * .23); }
.crate-seam {
  position: absolute;
  left: calc(var(--crate-w) * .05);
  right: calc(var(--crate-w) * .05);
  bottom: calc(var(--crate-w) * .469);
  height: calc(var(--crate-w) * .02);
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 calc(var(--crate-w) * .12) 2px color-mix(in oklab, var(--accent) 70%, transparent);
  opacity: .45;
}
.crate-lid {
  position: absolute;
  top: 0;
  left: calc(var(--crate-w) * -.027);
  right: calc(var(--crate-w) * -.027);
  height: calc(var(--crate-w) * .21);
  border-radius: calc(var(--crate-w) * .07) calc(var(--crate-w) * .07) 3px 3px;
  background: linear-gradient(180deg, #1d232e, #12161d);
  border: 1px solid var(--line-strong);
  transform-origin: bottom center;
}

/* --- Prélude : calque au-dessus du track, sous le marker --- */
.prelude {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background:
    radial-gradient(520px 240px at 50% 118%, color-mix(in oklab, var(--accent) 12%, transparent), transparent 70%),
    rgba(11,13,19,.94);
}
.prelude.active { display: flex; }
.prelude-caption {
  position: absolute;
  left: 0; right: 0;
  bottom: 22px;
  text-align: center;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  letter-spacing: .02em;
  color: var(--text-tertiary);
  transition: opacity .2s ease;
}

/* --- Le coffre en vol : clone en position:fixed sur <body> --- */
.crate-flying {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  --crate-w: 52px;
  transition: transform .42s cubic-bezier(.3,.9,.3,1);
}
/* paliers de tension : la même secousse, trois vitesses */
.crate-flying.tension-1 { animation: omCrateShake 1.25s ease-in-out infinite; }
.crate-flying.tension-2 { animation: omCrateShake .85s ease-in-out infinite; }
.crate-flying.tension-3 { animation: omCrateShake .55s ease-in-out infinite; }
.crate-flying.tension-1 .crate-lid { animation: omLidTense 1.25s ease-in-out infinite; }
.crate-flying.tension-2 .crate-lid { animation: omLidTense .85s ease-in-out infinite; }
.crate-flying.tension-3 .crate-lid { animation: omLidTense .55s ease-in-out infinite; }
.crate-flying.tension-1 .crate-seam { animation: omSeamPulse 1.25s ease-in-out infinite; }
.crate-flying.tension-2 .crate-seam { animation: omSeamPulse .85s ease-in-out infinite; }
.crate-flying.tension-3 .crate-seam { animation: omSeamPulse .55s ease-in-out infinite; }

.crate-flying.bursting { animation: none; }
.crate-flying.bursting .crate-lid { animation: omCrateBurst .32s cubic-bezier(.3,1.2,.4,1) forwards; }
.crate-flying.bursting .crate-seam { animation: none; opacity: 1; }
.crate-flying.bursting .crate-body,
.crate-flying.bursting .crate-strap { animation: omCrateDrop .32s ease-in forwards; }

/* --- Keyframes --- */
@keyframes omSlotFill {
  0% { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* La secousse s'ajoute au transform de vol : le clone garde son
   translate/scale dans une variable CSS posée en JS (--fly). */
@keyframes omCrateShake {
  0%, 100% { transform: var(--fly) translate3d(0,0,0) rotate(0deg); }
  12% { transform: var(--fly) translate3d(-2px,0,0) rotate(-.7deg); }
  24% { transform: var(--fly) translate3d(2px,-1px,0) rotate(.6deg); }
  36% { transform: var(--fly) translate3d(-1px,1px,0) rotate(-.4deg); }
  48% { transform: var(--fly) translate3d(1px,0,0) rotate(.3deg); }
  60% { transform: var(--fly) translate3d(0,-2px,0) rotate(0deg); }
}
@keyframes omLidTense {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  55% { transform: translateY(-4px) rotate(-1.2deg); }
  75% { transform: translateY(-1px) rotate(.4deg); }
}
@keyframes omSeamPulse {
  0%, 100% { opacity: .35; filter: blur(1px); }
  55% { opacity: 1; filter: blur(0); }
}
@keyframes omCrateBurst {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  45% { transform: translateY(-14px) rotate(-9deg); opacity: 1; }
  100% { transform: translateY(-70px) rotate(-26deg); opacity: 0; }
}
@keyframes omCrateDrop {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(16px) scale(.94); opacity: 0; }
}

@media (max-width: 1280px) {
  .inventory { flex-wrap: wrap; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .crate-flying, .crate-flying .crate-lid { animation: none !important; }
  .crate-flying { transition: none; }
}

.result-label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.result-text {
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-text.idle {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-disabled);
}
.result-text.spinning {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-disabled);
}
.result-text.won {
  font-size: clamp(22px, 3.4vw, 32px);
  color: #fff;
  text-shadow: 0 0 34px color-mix(in oklab, var(--won-tone, #fff) 32%, transparent);
  animation: omRise .45s ease both;
}

/* --- History --- */
.history-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
  max-height: 296px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px 9px 9px;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  transition: background .15s ease;
}
.history-item:hover { background: rgba(255,255,255,.055); }

.history-item .history-thumb {
  flex: 0 0 auto;
  width: 58px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #101318;
}
.history-item .history-thumb img {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  object-fit: cover;
  filter: blur(5px);
}

.history-item .history-thumb .history-logo {
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.9));
}

.history-item .history-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: #eceef4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item .history-time {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-disabled);
}

.history-empty {
  padding: 22px 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-disabled-2);
}

/* --- Admin --- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
/* La barre de rareté (réutilise .rarity-spectrum-block de la landing,
   audit design F-14) occupe toute la largeur de la grille de stats. */
.admin-stats .admin-rarity-spectrum { grid-column: 1 / -1; max-width: none; }
.admin-rarity-spectrum .rarity-spectrum-legend { justify-content: flex-start; }
.admin-stat-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.admin-stat-card .value {
  font-size: var(--fs-xl);
  font-weight: 600;
  color: #fff;
}
.admin-stat-card .label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: 4px;
}

.panel {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-log {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
  background: rgba(0,0,0,.3);
  border-radius: 8px;
  padding: 10px 12px;
}
.admin-log:empty { display: none; }

.admin-search { flex: none; width: 100%; max-width: 340px; }

.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-1);
  border: 1px solid var(--line);
}
@media (max-width: 700px) {
  .row { flex-wrap: wrap; }
  .row .row-main { flex-basis: 100%; }
}
.row-thumb {
  position: relative;
  width: 46px;
  height: 27px;
  flex-shrink: 0;
  overflow: hidden;
  background: #101318;
}
.row-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #04121e;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: var(--fs-xs);
}
.row .row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row .row-title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .row-sub {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-disabled);
}
.row select {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-sm);
  padding: 5px 8px;
  border-radius: 10px;
}

.admin-amount-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.admin-amount-input {
  width: 96px;
  min-height: 32px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-sm);
  padding: 0 8px;
  border-radius: 10px;
  text-align: center;
}
.admin-amount-input::placeholder { color: var(--text-disabled); }
.admin-amount-input::-webkit-outer-spin-button,
.admin-amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}
.pagination-btn { border: 1px solid var(--line); padding: 0; min-width: 40px; font-family: 'JetBrains Mono', monospace; font-size: var(--fs-md); }
.pagination-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}
/* Numéro de page saisissable. */
.pagination-input {
  box-sizing: content-box;
  padding: 5px 4px;
  text-align: center;
  font: inherit;
  color: #fff;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pagination-input::-webkit-outer-spin-button,
.pagination-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pagination-input:hover { border-color: rgba(255,255,255,.2); }
.pagination-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- Profil : vitrine / liste de souhaits --- */
/* 4 emplacements (8 pour un VIP) : toujours des lignes pleines, 4 colonnes
   dès que la section le permet, sinon 2 (2 × 2, ou 4 × 2 en VIP). */
.profile-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.profile-slots-panel { container-type: inline-size; container-name: pslots; }
@container pslots (min-width: 480px) {
  .profile-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.profile-slot {
  position: relative;
  aspect-ratio: 920 / 430;
  border-radius: 10px;
  overflow: hidden;
  background: #101318;
  border: 1px dashed rgba(255,255,255,.14);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, border-color .16s ease;
}
.profile-slot:hover { transform: scale(1.02); border-color: rgba(255,255,255,.3); }
.profile-slot.empty { color: var(--text-disabled); font-size: var(--fs-xl); }
.profile-slot-name {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}
.profile-slot-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.profile-slot-remove:hover { background: rgba(255,107,107,.5); }
.profile-picker-list { max-height: 320px; overflow-y: auto; }
#playerCollectionList { max-height: 400px; overflow-y: auto; }

/* --- Succès --- */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.achievement-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
}
/* Pas d'opacity globale : elle cassait le contraste du texte verrouillé
   (≈3:1). L'état verrouillé passe par des couleurs explicites sur
   chaque enfant à la place (audit design F-24). */
.achievement-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  background: var(--surface-2);
  color: var(--text);
}
.achievement-icon i {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.achievement-card.locked .achievement-icon {
  background: var(--surface-2);
  color: var(--text-disabled);
}
.achievement-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; } /* pousse le tag « réclamé » / le bouton contre le bord droit */
.achievement-name { font-size: var(--fs-sm); font-weight: 600; color: #fff; }
.achievement-card.locked .achievement-name { color: var(--text-secondary); }
.achievement-desc { font-size: var(--fs-xs); color: var(--text-secondary); }
.achievement-card.locked .achievement-desc { color: var(--text-disabled); }
.achievement-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.achievement-progress-track {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.achievement-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}
.achievement-progress-count {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.achievement-claimed-tag {
  flex-shrink: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-disabled);
  white-space: nowrap;
}

/* --- Paramètres --- */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  color: var(--text);
  font-size: var(--fs-sm);
}
@media (max-width: 600px) {
  .settings-row { flex-wrap: wrap; }
  .settings-row > span:not(.toggle-switch) { flex-basis: 100%; }
  /* Ligne d'interrupteur : libellé à gauche, interrupteur à droite. */
  label.settings-row { flex-wrap: nowrap; }
  label.settings-row > span:not(.toggle-switch) { flex-basis: auto; }
  .settings-row > button { width: 100%; }
}
/* --- Sous-réglages (tic de défilement, un son par rareté) : en retrait,
   un cran plus discrets que l'interrupteur général qu'ils affinent. --- */
.settings-row-sub {
  padding: 8px 0 8px 18px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.settings-row-sub .rarity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}
/* Petit texte d'explication sous un réglage (ou sous le titre d'une section). */
.settings-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-desc { font-size: var(--fs-xs); color: var(--text-tertiary); line-height: 1.45; }
p.settings-desc { margin: 0 0 6px; max-width: 560px; }
p.settings-group-desc { margin-top: 10px; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--focus); outline-offset: 2px; }
label.settings-row { cursor: pointer; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  cursor: pointer;
  transition: background .16s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform .16s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.danger-zone {
  border: 1px solid rgba(255,107,107,.25);
  border-radius: 12px;
  padding: 16px;
  background: rgba(255,107,107,.04);
}
.danger-zone .section-label { color: var(--danger); }
.danger-zone .settings-row span { color: var(--text-secondary); max-width: 420px; }

/* --- Toasts (remplacent alert()) --- */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  cursor: pointer;
  padding: 11px 14px;
  border-radius: 12px;
  background: #1a1f28;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), 0 12px 32px rgba(0,0,0,.5);
  color: #fff;
  font-size: var(--fs-sm);
  line-height: 1.4;
  animation: omToastIn .22s cubic-bezier(.2,1,.3,1) both;
}
.toast-error { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--danger) 60%, transparent), 0 12px 32px rgba(0,0,0,.5); }
.toast-success { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--success) 60%, transparent), 0 12px 32px rgba(0,0,0,.5); }
@keyframes omToastIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

/* --- Marché : état de mon enchère --- */
.market-bid-state {
  align-self: flex-start;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  padding: 2px 9px;
  border-radius: 999px;
}
.market-bid-state.leading { background: color-mix(in oklab, var(--success) 18%, transparent); color: var(--success); }
.market-bid-state.outbid { background: color-mix(in oklab, var(--danger) 16%, transparent); color: var(--danger); }

/* --- Modale de confirmation --- */
.modal-card.confirm-card { max-width: 420px; }
.confirm-message { margin: 0; font-size: var(--fs-md); line-height: 1.5; color: var(--text-secondary); }
.confirm-typed { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); color: var(--text-secondary); }
.confirm-typed input {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: #fff;
  padding: 9px 12px;
  font-size: var(--fs-md);
}
.confirm-typed input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* --- État vide avec action --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 4px;
}
.empty-state p { margin: 0; font-size: var(--fs-sm); color: var(--text-secondary); }

/* --- Amis --- */
.friend-request-form { display: flex; gap: 10px; flex-wrap: wrap; }
.friend-request-form input {
  flex: 1 1 240px;
  min-height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-md);
  padding: 0 12px;
  border-radius: 10px;
}
.friend-request-form input::placeholder { color: var(--text-disabled); }
.friend-request-form input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.friend-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
}
.friend-card-header { display: flex; align-items: center; gap: 12px; }
.friend-card-avatar { width: 40px; height: 40px; font-size: var(--fs-sm); }
/* .row-main/-title/-sub sont scopées à ".row" en descendant
   direct (voir plus haut) : .friend-card-header n'a pas cette classe,
   d'où ces règles dédiées (sinon nom+compteur s'affichent collés). */
.friend-card-header .row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.friend-card-header .row-title { font-size: var(--fs-sm); font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-card-header .row-sub { font-family: 'Space Grotesk', system-ui, sans-serif; font-size: var(--fs-xs); color: var(--text-disabled); }
.friend-card-showcase { display: flex; gap: 6px; }
.friend-card-showcase-slot {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 920 / 430;
  border-radius: 6px;
  background: #101318;
  border: 1px dashed rgba(255,255,255,.1);
}
.friend-card-actions { display: flex; gap: 8px; }
.friend-card-actions .btn { flex: 1 1 0; }

.friend-leaderboard-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  min-width: 28px;
  flex-shrink: 0;
}
.friend-leaderboard-me {
  border-color: var(--selected-ring);
  background: var(--surface-2);
}

.friend-collection-card { max-width: 760px; max-height: 82vh; overflow-y: auto; }

.nav-badge {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

/* --- Duels --- */
.duel-online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-disabled);
  flex-shrink: 0;
}
.duel-online-dot.online { background: var(--success); box-shadow: 0 0 6px 1px color-mix(in oklab, var(--success) 60%, transparent); }

.duels-queue-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.duels-queue-status {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.duels-stats-row {
  display: flex;
  gap: 24px;
  font-family: 'JetBrains Mono', monospace;
}
.duels-stats-row .value { font-size: var(--fs-xl); font-weight: 600; color: #fff; }
.duels-stats-row .label { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: 2px; }

.duel-team-picker-list { max-height: 320px; overflow-y: auto; }
.duel-team-picker-list .row { cursor: pointer; transition: background .12s ease, box-shadow .12s ease; }
.duel-team-picker-list .row.selected {
  background: var(--selected-bg);
  box-shadow: inset 0 0 0 1px var(--selected-ring);
}

/* --- Duels : modale de combat --- */
/* .modal-card.duel-battle-card (spécificité 2 classes) pour l'emporter sur
   .modal-card { max-width: 380px } malgré son ordre plus tardif dans la feuille. */
.modal-card.duel-battle-card { max-width: 920px; position: relative; overflow: hidden; }

.duel-battle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Le conteneur défile (overflow-y) et rogne donc aussi les côtés : marge pour
     que le cadre doré des avatars VIP ne soit pas coupé. */
  padding: 6px 8px 0;
}
.duel-battle-side .vip-frame {
  box-shadow: 0 0 0 2px #12161d, 0 0 0 4px var(--currency);
}
.duel-battle-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.duel-battle-side-right { flex-direction: row-reverse; }
.duel-battle-side .friend-card-avatar { width: 38px; height: 38px; font-size: var(--fs-xs); }
.duel-battle-name {
  font-size: var(--fs-md);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.duel-battle-round-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  letter-spacing: .08em;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* --- Arène : toi | centre | adversaire --- */
.duel-battle-arena {
  display: grid;
  grid-template-columns: 1fr 250px 1fr;
  gap: 18px;
  align-items: start;
  padding: 6px 0 2px;
}
.duel-battle-sidecol {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

/* --- Portrait : la carte active --- */
.duel-portrait { position: relative; width: 200px; }
.duel-portrait-inner {
  position: relative;
  border-radius: 12px;
  padding: 8px;
  background: var(--surface-1);
  box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--rarity, var(--accent)) 60%, transparent),
              0 12px 30px rgba(0,0,0,.45);
  animation: omBreathe2 3.4s ease-in-out infinite;
}
/* décalage pour éviter le battement synchrone des deux camps */
#duelBattleOpponentSide .duel-portrait-inner { animation-delay: .7s; }
/* pendant TA décision, plus rien ne bouge */
.duel-battle-arena.deciding .duel-portrait-inner { animation-play-state: paused; }

.duel-portrait .duel-card-media {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 108px;
  border-radius: 8px;
}
.duel-portrait-name {
  padding: 6px 8px 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.duel-portrait-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 2px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
}
.duel-portrait-hp { color: var(--text-secondary); }
.duel-portrait-atk { color: var(--rarity, var(--accent)); }

.duel-portrait-hp-track {
  height: 7px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255,255,255,.1);
  margin: 7px 0 0;
}
.duel-hp-fill {
  height: 100%;
  background: var(--success);
  transition: width .32s cubic-bezier(.3,.9,.3,1);
}
.duel-hp-fill.low { background: var(--danger); }

/* voile rouge d'impact */
.duel-portrait-tint {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 45%, color-mix(in oklab, var(--danger) 55%, transparent), transparent 72%);
}
.duel-portrait-tint.hit { animation: omHitTint .5s ease-out; }
.duel-portrait-inner.hit { animation: omHitShake .42s cubic-bezier(.36,.07,.19,.97); }
.duel-portrait-inner.ko { animation: omKo .52s cubic-bezier(.4,.1,.7,.9) forwards; }
.duel-portrait-inner.promote { animation: omPromote .48s cubic-bezier(.2,1.15,.35,1) both; }

/* calque des nombres flottants : hors du flux, ne décale jamais rien */
.duel-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.duel-dmg {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, 0);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: var(--fs-2xl);
  color: #fff;
  text-shadow: 0 0 18px color-mix(in oklab, var(--danger) 80%, transparent), 0 2px 8px rgba(0,0,0,.8);
  animation: omDmgFloat .9s cubic-bezier(.25,.8,.3,1) forwards;
}
.duel-dmg-ring {
  position: absolute;
  left: 50%;
  top: 34%;
  width: 70px;
  height: 70px;
  margin: -35px 0 0 -35px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--danger) 70%, transparent);
  animation: omRing .5s ease-out forwards;
}

/* --- Banc : les deux réservistes --- */
.duel-bench { display: flex; gap: 8px; }
.duel-card {
  position: relative;
  width: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: #101318;
  padding: 3px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rarity, var(--accent)) 40%, transparent);
  transition: opacity .2s ease, filter .2s ease;
}
.duel-card.duel-card-dead { opacity: .22; filter: grayscale(1); }
.duel-card .duel-card-media { width: 100%; height: 34px; border-radius: 6px; }
.duel-card-hp-track {
  height: 5px;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  overflow: hidden;
  margin: 4px 3px 3px;
}

/* --- Centre : axe, plaques, verdict --- */
.duel-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 6px;
}
.duel-axis-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.duel-axis-chip.reveal, .duel-battle-axis.reveal {
  animation: omAxisIn .34s cubic-bezier(.2,1.1,.35,1) both;
}
.duel-plates {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.duel-plates-vs {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-disabled);
}
.duel-plate {
  flex: 1 1 0;
  min-width: 0;
  height: 46px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-disabled);
}
.duel-plate.revealed {
  color: #fff;
  animation: omPlateFlip .26s cubic-bezier(.2,1.1,.35,1) both;
}
.duel-plate.plate-win { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--success) 70%, transparent); }
.duel-plate.plate-lose { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--danger) 70%, transparent); }

.duel-verdict {
  min-height: 18px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  letter-spacing: .04em;
  color: var(--text-disabled);
  text-align: center;
  white-space: nowrap;
}
.duel-verdict.waiting { animation: omSuspense 1.6s ease-in-out infinite; }
.duel-verdict.ok { color: var(--success); animation: omVerdict .3s cubic-bezier(.2,1.2,.35,1) both; }
.duel-verdict.bad { color: var(--danger); animation: omVerdict .3s cubic-bezier(.2,1.2,.35,1) both; }

/* --- Bloc de manche --- */
.duel-battle-round {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.duel-battle-axis { font-size: var(--fs-md); font-weight: 600; color: #fff; text-align: center; }
.duel-battle-turn-hint {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.duel-think { display: inline-flex; gap: 3px; margin-left: 2px; }
.duel-think span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: omThink 1.1s ease-in-out infinite;
}
.duel-think span:nth-child(2) { animation-delay: .16s; }
.duel-think span:nth-child(3) { animation-delay: .32s; }

.duel-battle-guess-buttons { display: flex; gap: 10px; }
.duel-battle-guess-buttons .btn {
  min-width: 112px;
  min-height: 44px;
  transition: background .14s ease, box-shadow .14s ease, transform .14s ease, opacity .14s ease;
}
.duel-battle-guess-buttons .btn.picked {
  background: var(--selected-bg);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7);
  transform: translateY(-1px);
}
.duel-battle-guess-buttons .btn.unpicked { opacity: .35; }

/* Compte à rebours du tour : gros, dans la zone vide sous « plus ou moins ? ». */
.duel-battle-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-height: 32px;
  margin-top: 6px;
}
.duel-battle-timer.urgent { color: var(--danger); animation: omTimerUrgent 1s ease-in-out infinite; }
@keyframes omTimerUrgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* --- Journal --- */
.duel-battle-log {
  max-height: 96px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.duel-battle-log .log-ok { color: var(--success); }
.duel-battle-log .log-bad { color: var(--danger); }

/* --- Fin de match : calque plein cadre --- */
.duel-over {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8,9,12,.82);
  animation: omOverIn .28s ease both;
}
.duel-over.hidden { display: none; }
.duel-over-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(560px 300px at 50% 50%, color-mix(in oklab, var(--over-tone, var(--accent)) 22%, transparent), transparent 70%);
  animation: omGlowPulse 2.6s ease-in-out infinite;
}
.duel-over-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.duel-over-confetti span {
  position: absolute;
  top: -10px;
  border-radius: 1px;
  opacity: 0;
  animation: omConfetti 2s cubic-bezier(.3,.5,.5,1) forwards;
}
.duel-over-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: omOverText .42s cubic-bezier(.2,1.15,.35,1) both;
}
.duel-over-kicker {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--success);
}
.duel-over.lost .duel-over-kicker { color: var(--danger); }
.duel-over-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -.02em;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 40px color-mix(in oklab, var(--over-tone, var(--accent)) 40%, transparent);
}
.duel-over-reward {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--currency);
  text-shadow: 0 0 24px color-mix(in oklab, var(--currency) 45%, transparent);
  animation: omOverText .5s cubic-bezier(.2,1.2,.35,1) .3s both;
}
.duel-over-sub {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  text-align: center;
  max-width: 420px;
}

/* --- Keyframes --- */
@keyframes omDmgFloat {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(.7); }
  18%  { opacity: 1; transform: translate(-50%, -2px) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -52px) scale(1); }
}
@keyframes omRing {
  0%   { opacity: .8; transform: scale(.6); }
  100% { opacity: 0; transform: scale(1.9); }
}
@keyframes omHitShake {
  0%, 100% { transform: translate3d(0,0,0); }
  15% { transform: translate3d(-7px,2px,0) rotate(-1.2deg); }
  32% { transform: translate3d(6px,-2px,0) rotate(1deg); }
  52% { transform: translate3d(-4px,1px,0) rotate(-.6deg); }
  72% { transform: translate3d(3px,0,0) rotate(.3deg); }
}
@keyframes omHitTint {
  0% { opacity: 0; }
  12% { opacity: .85; }
  100% { opacity: 0; }
}
@keyframes omKo {
  0%   { transform: none; opacity: 1; filter: grayscale(0); }
  22%  { transform: translateY(-8px) scale(1.03); filter: grayscale(.4); }
  100% { transform: translateY(34px) scale(.86) rotate(-4deg); opacity: .14; filter: grayscale(1); }
}
@keyframes omPromote {
  0%   { opacity: 0; transform: translateY(26px) scale(.92); }
  62%  { opacity: 1; transform: translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: none; }
}
@keyframes omAxisIn {
  0%   { opacity: 0; transform: translateY(-10px) scale(.94); }
  100% { opacity: 1; transform: none; }
}
@keyframes omPlateFlip {
  0%   { transform: rotateX(-90deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes omVerdict {
  0%   { opacity: 0; transform: scale(.8); }
  22%  { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes omSuspense {
  0%, 100% { opacity: .28; letter-spacing: .28em; }
  50%      { opacity: .85; letter-spacing: .4em; }
}
@keyframes omBreathe2 {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
@keyframes omThink {
  0%, 80%, 100% { opacity: .2; transform: translateY(0); }
  40%           { opacity: 1; transform: translateY(-3px); }
}
@keyframes omOverIn {
  0%   { opacity: 0; backdrop-filter: blur(0); }
  100% { opacity: 1; backdrop-filter: blur(3px); }
}
@keyframes omOverText {
  0%   { opacity: 0; transform: translateY(14px) scale(.94); }
  100% { opacity: 1; transform: none; }
}
@keyframes omGlowPulse {
  0%, 100% { opacity: .25; transform: scale(.96); }
  50%      { opacity: .7; transform: scale(1.04); }
}
@keyframes omConfetti {
  0%   { opacity: 0; transform: translate3d(0,-30px,0) rotate(0); }
  12%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--cx), 340px, 0) rotate(var(--cr)); }
}

@media (max-width: 900px) {
  .duel-battle-arena { grid-template-columns: 1fr; }
  .duel-portrait { width: 100%; max-width: 220px; }
  .duel-center { order: 2; }
  #duelBattleOpponentSide { order: 3; }
}
/* Coupé, pas ralenti — comme le reste de l'app. */
@media (prefers-reduced-motion: reduce) {
  .duel-battle-card *, .duel-battle-card {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Devise --- */
.sidebar-currency {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--currency);
}
.sidebar-currency i { color: var(--currency); }

/* --- Marche --- */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.market-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #101318;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.market-card .market-art-wrap {
  position: relative;
  aspect-ratio: 920 / 430;
  overflow: hidden;
}
.market-card .market-art-wrap img.bg {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  object-fit: cover;
  filter: blur(8px) saturate(1.1);
}
.market-card .market-art-wrap img.logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 78%;
  max-height: 62%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.85));
}
.market-card .market-art-wrap .rarity-badge {
  position: absolute;
  top: 8px;
  left: 8px;
}
.market-card .market-timer {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  padding: 3px 8px;
  border-radius: 999px;
}

.market-card .market-info {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.market-card .market-name {
  font-size: var(--fs-md);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-card .market-bid-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}
.market-card .market-bid-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--currency);
}
.market-card .market-bid-form {
  display: flex;
  gap: 6px;
}
.market-card .market-bid-form input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-sm);
  padding: 0 10px;
  border-radius: 10px;
}
.market-card .market-seller {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-disabled);
}

/* --- Modales --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4,5,7,.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: #12161d;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.modal-card h3 {
  margin: 0;
  font-size: var(--fs-lg);
  color: #fff;
}
/* Espace pour le bouton de fermeture, maintenant dans la carte plutôt que
   flottant à l'extérieur (audit design F-20). Seulement les titres juste
   sous le bouton (enfant direct) : #gdName est ailleurs dans une colonne
   étroite, ce padding le ferait inutilement déborder. */
.modal-card > h3 {
  padding-right: 56px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  background: #1c222b;
  border: 1px solid var(--line-strong);
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
/* --- En-tête Caisses + modale d'explications --- */
.cases-title-block { display: flex; flex-direction: column; gap: 6px; }
.cases-info-link { align-self: flex-start; }

.cases-info-card { max-width: 560px; max-height: 82vh; overflow-y: auto; }
.cases-info-block { display: flex; flex-direction: column; gap: 8px; }
.cases-info-block h4 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #fff;
}
.cases-info-block p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}
.cases-info-sublabel {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}
.cases-info-rarity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cases-info-rarity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-xs);
  color: var(--text);
}
.cases-info-rarity-list .mono-note-value {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}

.modal-close:hover { background: #262d38; color: #fff; }
.modal-close i {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-game-art {
  position: relative;
  aspect-ratio: 920 / 430;
  border-radius: 12px;
  overflow: hidden;
  background: #0b0e12;
}
.modal-game-art img:first-child {
  position: absolute;
  inset: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  object-fit: cover;
  filter: blur(9px) saturate(1.1);
}
.modal-game-art img#gdLogo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 78%;
  max-height: 60%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.85));
}
.modal-name-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-align: center;
  color: #fff;
  font-weight: 600;
  font-size: var(--fs-lg);
}

.modal-card-wide { max-width: 640px; }

.modal-game-detail {
  display: flex;
  gap: 20px;
}
.modal-game-media {
  flex: 0 0 42%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.modal-game-media h3 {
  margin: 0;
  font-size: var(--fs-lg);
  color: #fff;
}
.modal-game-stats {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  /* Le bouton fermer (44 px, en haut à droite de la carte) recouvrait la
     valeur de la première ligne. */
  padding-top: 40px;
}
.modal-stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.modal-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: #fff;
  text-align: right;
  white-space: nowrap;
}
.modal-steam-link { margin-top: 2px; }

@media (max-width: 560px) {
  .modal-game-detail { flex-direction: column; }
  .modal-game-media { flex: none; }
  .modal-game-stats { padding-top: 0; }
}

.listing-market-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.listing-market-stats .stat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.listing-market-stats .stat-value {
  font-family: 'JetBrains Mono', monospace;
  color: var(--currency);
  font-weight: 600;
}
.listing-market-stats .stat-sales {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-disabled);
}
.listing-market-stats.empty {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: var(--fs-xs);
  color: var(--text-disabled-2);
  text-align: center;
}

.listing-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.listing-field input {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-md);
  padding: 10px 12px;
  border-radius: 10px;
}

.duration-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn-option.active {
  background: var(--selected-bg);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--selected-ring);
}

.listing-error {
  font-size: var(--fs-xs);
  color: var(--danger);
}

/* Cibles tactiles < 44px sous mobile (audit design F-31) : desktop garde
   la taille compacte "sm" (32px) définie plus haut. Placé en fin de
   fichier pour gagner le conflit de cascade à spécificité égale contre
   ces mêmes règles "sm" déclarées avant. */
@media (max-width: 760px) {
  .btn, .tag-chip {
    min-height: 44px;
  }
}

/* Enchère ouverte par un lien (#market/<id>) : brève mise en évidence. */
.market-card-linked { animation: omLinkedPulse 1.1s ease-out 2; }
@keyframes omLinkedPulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  40% { box-shadow: 0 0 0 3px var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .market-card-linked { animation: none; box-shadow: 0 0 0 3px var(--accent); }
}

/* Modale de combat : le contenu défile dans la carte (le calque de fin,
   lui, reste plein cadre) et le bloc de réponse reste collé en bas —
   Plus/Moins ne doivent jamais sortir de l'écran pendant que le
   minuteur tourne (audit P2-10). */
.modal-card.duel-battle-card { max-height: 92vh; }
.duel-battle-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
@media (max-width: 900px) {
  .duel-battle-round {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #12161d;
  }
}

/* Lien d'évitement : hors écran, visible dès qu'il prend le focus (Tab). */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #08090c;
  font-size: var(--fs-md);
  font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
#mainContent:focus { outline: none; }

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

/* P3-08 : réglage « réduire les animations ». Le flash plein cadre, les
   étincelles, la secousse de scène et toute animation CSS restante sont
   neutralisés ; le défilement du reel (piloté en JS) et les confettis sont
   coupés côté TypeScript (motion.ts). Durée quasi nulle plutôt que
   « animation: none » pour que les états finaux (résultat affiché) restent
   appliqués. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .flash.show { animation: none; opacity: 0; }
  .sparks span { display: none; }
}

/* --- Actions sous le résultat d'un tirage (audit P2-16) --- */
/* Hauteur réservée : les boutons apparaissent sans pousser le stock. */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  padding: 10px 10px 0;
  box-sizing: content-box;
}

/* --- Bande de statistiques du profil (audit P2-14) --- */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.stat-tile-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.stat-tile-value {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-tile-value.mono {
  font-family: 'JetBrains Mono', monospace;
}
.stat-tile-sub {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rarity-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  margin-top: 4px;
}
.rarity-bar > span { display: block; height: 100%; }
.rarity-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.rarity-bar-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

/* --- Objectifs de collection (audit P3-15) --- */
.goals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 6 cartes : 2 rangées de 3 */
  gap: 10px;
}
.goal {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.goal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.goal-name { color: var(--goal-tone, var(--text)); font-weight: 600; white-space: nowrap; }
.goal-count { font-family: 'JetBrains Mono', monospace; color: #fff; white-space: nowrap; }
.goal-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--goal-tone, var(--accent));
}
.goal-next {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.goal.done .goal-next { color: var(--success); }
@media (max-width: 720px) {
  .goals {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 158px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

/* Montant en pièces dans un bouton : même teinte que le solde. */
.coin-amount {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: var(--currency);
  font-family: 'JetBrains Mono', monospace;
}

/* --- VIP --- */
.vip-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe08a, #f0a92e);
  color: #1a1300;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.3;
  vertical-align: middle;
}
/* Cadre doré autour de l'avatar des abonnés. */
.vip-frame {
  box-shadow: 0 0 0 2px #0b0d13, 0 0 0 4px var(--currency), 0 0 14px rgba(255, 216, 115, .35);
}
.profile-avatar.vip-frame {
  box-shadow: 0 0 0 3px #0b0d13, 0 0 0 6px var(--currency), 0 0 24px rgba(255, 216, 115, .45);
}
.vip-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, var(--currency) 45%, transparent);
  background: color-mix(in oklab, var(--currency) 10%, transparent);
  color: var(--currency);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.vip-nav-btn { white-space: nowrap; }
/* En-tête mobile : « Devenir VIP » se réduit à « VIP » (place comptée). */
@media (max-width: 760px) {
  .vip-nav-btn { padding: 6px 10px; }
  .vip-nav-btn:not(.active) #vipNavLabel { font-size: 0; }
  .vip-nav-btn:not(.active) #vipNavLabel::after { content: 'VIP'; font-size: var(--fs-sm); }
}
.vip-nav-btn:hover { background: color-mix(in oklab, var(--currency) 18%, transparent); }
.vip-nav-btn.active { background: linear-gradient(135deg, #ffe08a, #f0a92e); color: #1a1300; border-color: transparent; }
.modal-card.vip-card { max-width: 440px; }
.vip-status { color: var(--text-secondary); font-size: var(--fs-sm); }
.vip-status.active { color: var(--currency); }
.vip-perks {
  list-style: none;
  margin: 14px 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--fs-sm);
  color: var(--text);
}
.vip-perks li { padding-left: 22px; position: relative; }
.vip-perks li::before { content: '✦'; position: absolute; left: 0; color: var(--currency); }
.section-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

/* Précision plus petite après le libellé d'un bouton (ex. heure de dispo). */
.btn-note {
  margin-left: 6px;
  font-size: var(--fs-xs);
  opacity: .7;
}

/* Page Caisses sur ordinateur : exactement la hauteur de la fenêtre. L'historique
   prend la place qui reste (défilement interne), donc aucun défilement de la page
   quelle que soit la hauteur — sous 690 px de contenu, la page défile normalement. */
@media (min-width: 761px) {
  #casesPanel {
    height: calc(100vh - var(--pad-top) - var(--pad-bottom));
    min-height: 690px;
  }
  #casesPanel .history-section {
    flex: 1 1 0;
    min-height: 130px;
    display: flex;
    flex-direction: column;
  }
  #casesPanel .history-list {
    flex: 1 1 0;
    min-height: 64px;
    max-height: none;
  }
}

/* Page Profil sur ordinateur : emplacements plus plats (et avatar plus petit) quand
   la fenêtre est basse, pour que vitrine + souhaits tiennent sans défiler, même
   avec les 2 rangées d'un VIP. */
@media (min-width: 761px) and (max-height: 1000px) {
  .profile-slot { aspect-ratio: 920 / 360; }
  .profile-avatar { width: 68px; height: 68px; }
}
@media (min-width: 761px) and (max-height: 900px) {
  .profile-slot { aspect-ratio: 920 / 300; }
}
@media (min-width: 761px) and (max-height: 800px) {
  .profile-slot { aspect-ratio: 920 / 230; }
  .profile-avatar { width: 56px; height: 56px; }
}

/* --- Mini-jeux : salle permanente --- */
.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .room-layout { grid-template-columns: minmax(0, 1fr); }
}
.room-round-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* La question de la manche : un vrai titre, lisible d'un coup d'œil. */
.room-question {
  margin: 4px 0 0;
  text-align: center;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: #fff;
  text-wrap: balance;
}
.room-answered { font-size: var(--fs-xs); color: var(--text-secondary); white-space: nowrap; }
.room-timer {
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.room-timer.urgent { color: var(--danger); }
.room-progress { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.room-progress-fill { height: 100%; background: var(--accent); transition: width .3s linear; }
.room-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: 200px;
  justify-content: center;
}
.room-game-wrap { min-width: 0; width: min(300px, 100%); display: flex; flex-direction: column; gap: 8px; }
.room-game { position: relative; overflow: hidden; aspect-ratio: 920 / 430; border-radius: 12px; background: #101318; }
.room-game .gamecard-logo { max-width: 70%; max-height: 60%; }
.room-game-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-answer { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(340px, 100%); }
.room-answer-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: #fff;
}
.room-slider { width: 100%; accent-color: var(--accent); }
.room-price-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-xl);
  color: var(--text-secondary);
}
.room-price-input {
  width: 8ch;
  padding: 10px 0;
  text-align: right;
  font: inherit;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
  background: transparent;
  border: none;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.room-price-input::-webkit-outer-spin-button,
.room-price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.room-price-field:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.room-submit { min-width: 160px; }
.room-choices { display: flex; gap: 12px; width: 100%; min-width: 0; justify-content: center; }
.room-choice {
  flex: 1 1 0;
  min-width: 0; /* un nom long ne doit pas élargir la carte (il est tronqué) */
  max-width: 260px;
  padding: 8px;
  border-radius: 14px;
  background: var(--surface-1);
  border: 2px solid var(--line);
  cursor: pointer;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.room-choice:hover:not(:disabled) { border-color: var(--line-strong); transform: translateY(-2px); }
.room-choice.selected { border-color: var(--accent); }
.room-choice:disabled { cursor: default; opacity: .6; }
.room-choice .room-game-wrap { width: 100%; }
.room-choice-result { cursor: default; text-align: center; }
.room-choice-result.correct { border-color: var(--success); }
.room-choice-result.yours:not(.correct) { border-color: var(--danger); }
.room-choice-value { margin-top: 8px; font-family: 'JetBrains Mono', monospace; font-size: var(--fs-lg); color: #fff; }
.room-feedback { min-height: 18px; font-size: var(--fs-xs); color: var(--text-secondary); text-align: center; }
.room-reveal-head { display: flex; gap: 28px; align-items: center; justify-content: center; flex-wrap: wrap; }
.room-correct { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.room-correct-label { font-size: var(--fs-xs); color: var(--text-secondary); }
.room-correct-value { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-2xl); font-weight: 600; color: var(--success); }
.room-mine { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: var(--fs-sm); color: var(--text); }
.room-score { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xl); font-weight: 600; color: #fff; }
.room-reward { color: var(--currency); font-family: 'JetBrains Mono', monospace; }
.room-reward .coin-amount { margin-left: 0; }
.room-podium { list-style: none; margin: 0; padding: 0; width: min(420px, 100%); display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); }
.room-podium li { display: flex; align-items: baseline; gap: 10px; color: var(--text); }
.room-podium li > :first-child { flex: 1 1 auto; min-width: 0; }
.room-podium-guess {
  min-width: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
.room-podium-title { color: var(--text-secondary); margin-bottom: 2px; }
.room-podium-pts { font-family: 'JetBrains Mono', monospace; color: #fff; }
.room-board-list { display: flex; flex-direction: column; gap: 4px; }
.room-board-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface-1);
  font-size: var(--fs-sm);
}
.room-board-row.me { box-shadow: inset 0 0 0 1px var(--accent); }
.room-board-rank { font-family: 'JetBrains Mono', monospace; color: var(--text-secondary); }
.room-board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.room-board-pts { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs); color: var(--text); }
.room-board-empty { margin: 0; font-size: var(--fs-xs); color: var(--text-secondary); }
.room-board-you { font-size: var(--fs-xs); color: var(--text-secondary); }
/* Réponse validée : la saisie est figée. */
.room-stage.locked .room-slider,
.room-stage.locked .room-price-field { opacity: .6; }
.room-breakdown { font-size: var(--fs-xs); color: var(--text-secondary); }
.room-podium-time { flex-shrink: 0; font-family: 'JetBrains Mono', monospace; color: var(--text-secondary); }

/* --- Bandeau de déploiement --- */
.deploy-banner {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  max-width: min(560px, calc(100vw - 24px));
  padding: 10px 16px;
  border-radius: 999px;
  background: #1a1f28;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--currency) 60%, transparent), 0 12px 32px rgba(0,0,0,.5);
  color: #fff;
  font-size: var(--fs-sm);
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}
