/**
 * DashLobby — Styles principaux
 * Dark mode obligatoire — Mobile-first
 */

/* --- Variables CSS (Design tokens) --- */
:root {
  --color-cyan:       #00D4FF;
  --color-orange:     #FF5C00;
  --color-bg:         #000000;
  --color-text:       #F0F4F8;

  --status-available: #00FF88;
  --status-chat:      #FF8C00;
  --status-ingame:    #FF3B3B;
  --status-offline:   #4A4A5A;

  --font-title: 'Rajdhani', sans-serif;
  --font-body:  'Inter', sans-serif;

  --radius:   8px;
  --spacing:  16px;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Base --- */
html, body {
  height: 100%;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Typographie --- */
h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* --- Layout principal --- */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Statut : animation pulsation (Disponible) --- */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.15); }
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot--available { background: var(--status-available); animation: pulse 1.5s ease-in-out infinite; }
.status-dot--chat      { background: var(--status-chat); }
.status-dot--ingame    { background: var(--status-ingame); }
.status-dot--offline   { background: var(--status-offline); }


/* ============================================================
   Écran de connexion — Étape 4 OAuth
   ============================================================ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing);
  background: radial-gradient(ellipse at 50% 0%, rgba(0,212,255,.08) 0%, transparent 60%),
              var(--color-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

/* Logo */
.login-card .logo {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-text);
  text-transform: uppercase;
}
.login-card .logo span {
  color: var(--color-cyan);
}

/* Tagline */
.login-tagline {
  font-size: .95rem;
  color: rgba(240,244,248,.65);
}
.login-tagline strong {
  color: var(--color-orange);
  font-weight: 600;
}

/* Erreur */
.login-error {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(255,59,59,.12);
  border: 1px solid rgba(255,59,59,.4);
  color: #FF3B3B;
  font-size: .875rem;
}

/* Boutons OAuth */
.login-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s ease, transform .1s ease;
  cursor: pointer;
}
.btn-oauth:active { transform: scale(.98); }

.btn-google {
  background: #ffffff;
  color: #1a1a1a;
}
.btn-google:hover { opacity: .92; }

.btn-apple {
  background: #1c1c1e;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,.12);
}
.btn-apple:hover { opacity: .88; }

.oauth-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Mentions légales */
.login-legal {
  font-size: .75rem;
  color: rgba(240,244,248,.4);
}
.login-legal a {
  color: rgba(240,244,248,.55);
  text-decoration: underline;
}


/* ============================================================
   Avatar DiceBear pixel-art — Étape 6
   ============================================================ */

/*
 * image-rendering: pixelated garantit un rendu net et carré
 * même si le SVG est affiché à une taille différente de sa résolution native.
 */
.avatar {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 2px solid var(--color-cyan);
  image-rendering: pixelated;
  image-rendering: crisp-edges;  /* fallback Firefox */
  background: #0d0d0d;
  flex-shrink: 0;
}

/* Variante grande taille (profil, modal) */
.avatar--lg {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border-width: 2px;
}

/* Variante petite taille (liste joueurs) */
.avatar--sm {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border-width: 1px;
}


/* ============================================================
   Header app — Étape 6
   ============================================================ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--spacing);
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-logo {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
}
.app-logo span {
  color: var(--color-cyan);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-username {
  font-size: .875rem;
  font-weight: 500;
  color: rgba(240,244,248,.8);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ============================================================
   Badge statut header — Étape 8
   Les 4 statuts : available #00FF88 / chat #FF8C00 /
                   ingame #FF3B3B / offline #4A4A5A
   ============================================================ */

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .3s ease, border-color .3s ease, color .3s ease;
}

.status-badge__label {
  /* Masqué sur très petit écran, visible à partir de 360px */
  display: none;
}
@media (min-width: 360px) {
  .status-badge__label { display: inline; }
}

/* ── Variantes couleur des 4 statuts ── */
.status-badge--available {
  background: rgba(0,255,136,.12);
  border-color: rgba(0,255,136,.35);
  color: #00FF88;
}
.status-badge--chat {
  background: rgba(255,140,0,.12);
  border-color: rgba(255,140,0,.35);
  color: #FF8C00;
}
.status-badge--ingame {
  background: rgba(255,59,59,.12);
  border-color: rgba(255,59,59,.35);
  color: #FF3B3B;
}
.status-badge--offline {
  background: rgba(74,74,90,.1);
  border-color: rgba(74,74,90,.3);
  color: #4A4A5A;
}


/* ============================================================
   Menu statut — Étape 8
   Dropdown contextuel accessible depuis le badge statut
   ============================================================ */

.status-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #111;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 6px;
  min-width: 180px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,.6);

  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.status-menu--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.status-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: .875rem;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
}
.status-menu__item:hover { background: rgba(255,255,255,.06); }
.status-menu__item:disabled {
  opacity: .35;
  cursor: default;
}

/* Wrapper relatif autour du badge pour positionner le menu */
.status-badge-wrapper {
  position: relative;
}
.status-badge {
  cursor: pointer;
}
.status-badge[aria-expanded="false"] { cursor: default; }


/* ============================================================
   Écran inactif — Étape 7
   ============================================================ */

.idle-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 48px var(--spacing) 40px;
  text-align: center;
}

.idle-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.idle-icon { font-size: 3rem; line-height: 1; }

.idle-title {
  font-family: var(--font-title);
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 700;
  letter-spacing: .03em;
}

.idle-sub {
  font-size: .95rem;
  color: rgba(240,244,248,.55);
  max-width: 300px;
}

/* Bouton principal "Je suis disponible" */
.btn-available {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  padding: 18px 24px;
  border: none;
  border-radius: 12px;
  background: var(--status-available);
  color: #000;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 0 24px rgba(0,255,136,.25);
}
.btn-available:hover { transform: translateY(-2px); box-shadow: 0 0 36px rgba(0,255,136,.35); }
.btn-available:active { transform: scale(.97); }

.btn-available__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #000;
  opacity: .6;
  animation: pulse 1.5s ease-in-out infinite;
}


/* ============================================================
   Panneau de sélection — Étape 7
   ============================================================ */

.avail-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.avail-panel--open {
  opacity: 1;
  pointer-events: all;
}

.avail-panel__inner {
  width: 100%;
  max-height: 88vh;
  background: #0e0e0e;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255,255,255,.08);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,0,.67,0);
}
.avail-panel--open .avail-panel__inner {
  transform: translateY(0);
}

.avail-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--spacing) 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  background: #0e0e0e;
  z-index: 10;
}

.avail-panel__title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.avail-panel__close {
  background: none;
  border: none;
  color: rgba(240,244,248,.5);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s;
}
.avail-panel__close:hover { color: var(--color-text); }

/* Sections dans le panneau */
.avail-section {
  padding: 16px var(--spacing) 4px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.avail-section:last-of-type { border-bottom: none; }

.avail-label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(240,244,248,.45);
  margin-bottom: 10px;
}

.avail-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: .75rem;
  color: rgba(240,244,248,.3);
}

/* Liste de jeux */
.game-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
}

.game-item {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: .95rem;
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.game-item:hover  { background: rgba(255,255,255,.07); }
.game-item--selected {
  background: rgba(0,212,255,.1);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  font-weight: 600;
}

/* Chips (plateforme, mode, durée) */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
}

.chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(240,244,248,.7);
  font-family: var(--font-body);
  font-size: .875rem;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { background: rgba(255,255,255,.08); }
.chip--selected {
  background: rgba(0,212,255,.15);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  font-weight: 600;
}

.chip-group--duration .chip--duration { flex: 1 1 calc(50% - 4px); text-align: center; }

/* Footer avec bouton de confirmation */
.avail-footer {
  padding: 16px var(--spacing) 8px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, #0e0e0e 30%);
}

.btn-confirm {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 10px;
  background: var(--color-cyan);
  color: #000;
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-confirm:hover   { opacity: .9; }
.btn-confirm:active  { transform: scale(.98); }
.btn-confirm:disabled { opacity: .5; cursor: default; }


/* ============================================================
   Carte de disponibilité active — Étape 7
   ============================================================ */

.active-screen {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px var(--spacing) 32px;
}

.active-card {
  width: 100%;
  max-width: 420px;
  background: rgba(0,255,136,.06);
  border: 1px solid rgba(0,255,136,.25);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.active-card__badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--status-available);
}

.active-card__game {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .03em;
}

.active-card__details {
  font-size: .9rem;
  color: rgba(240,244,248,.6);
}

.active-card__duration {
  font-size: .875rem;
  color: rgba(240,244,248,.5);
}

.active-card__timer {
  font-size: .85rem;
  color: rgba(240,244,248,.4);
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.active-card__timer strong { color: var(--color-orange); }

.btn-cancel {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255,59,59,.3);
  border-radius: var(--radius);
  background: rgba(255,59,59,.08);
  color: #FF3B3B;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-cancel:hover    { background: rgba(255,59,59,.15); }
.btn-cancel:disabled { opacity: .5; cursor: default; }


/* ============================================================
   Toast notifications — Étape 7
   ============================================================ */

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,.1);
  color: var(--color-text);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: .875rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 999;
  pointer-events: none;
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast--error  { border-color: rgba(255,59,59,.4); color: #FF3B3B; }
.toast--success { border-color: rgba(0,255,136,.3); color: var(--status-available); }


/* ============================================================
   Liste des joueurs disponibles — Étape 9
   Polling 3 s — Premium en tête — Chat/InGame grisés
   ============================================================ */

.players-section {
  padding: 0 var(--spacing) calc(env(safe-area-inset-bottom, 0px) + 32px);
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

/* En-tête de section : titre + compteur */
.players-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.players-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(240,244,248,.55);
}

.players-count {
  font-size: .75rem;
  font-weight: 600;
  color: rgba(240,244,248,.3);
}

/* Filtre affiché quand l'utilisateur est disponible */
.players-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--color-cyan);
  font-weight: 500;
}

/* Message vide */
.players-empty {
  text-align: center;
  padding: 32px 0;
  color: rgba(240,244,248,.3);
  font-size: .9rem;
}

/* Grille de cartes */
.players-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Carte joueur ── */
.player-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 0 12px;
  align-items: start;
  padding: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  transition: background .15s, border-color .15s;
}
.player-card:not(.player-card--busy):hover {
  background: rgba(255,255,255,.055);
  border-color: rgba(255,255,255,.12);
}

/* Joueur occupé (chat / ingame) : grisé, non interactif */
.player-card--busy {
  opacity: .45;
  filter: grayscale(.4);
}

/* Badge premium */
.player-card__avatar-wrap {
  position: relative;
}
.player-card__premium {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: var(--color-orange);
  border-radius: 50%;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  line-height: 1;
}

/* Corps de la carte */
.player-card__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-card__name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card__game {
  font-size: .8rem;
  color: rgba(240,244,248,.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card__meta {
  font-size: .75rem;
  color: rgba(240,244,248,.35);
}

.player-card__timer {
  font-size: .7rem;
  color: rgba(240,244,248,.3);
}
.player-card__timer strong { color: var(--color-orange); font-weight: 600; }

/* Colonne droite : statut + bouton */
.player-card__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* Mini badge statut sur la carte */
.player-card__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
}
.player-card__status--available { color: var(--status-available); }
.player-card__status--chat      { color: var(--status-chat);      }
.player-card__status--ingame    { color: var(--status-ingame);    }

/* Bouton demande de match */
.btn-request {
  padding: 7px 12px;
  border: 1px solid rgba(0,212,255,.35);
  border-radius: 8px;
  background: rgba(0,212,255,.08);
  color: var(--color-cyan);
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn-request:hover   { background: rgba(0,212,255,.16); border-color: rgba(0,212,255,.55); }
.btn-request:active  { transform: scale(.97); }
.btn-request:disabled { opacity: .4; cursor: default; }

/* Indicateur de rafraîchissement discret */
.players-refresh-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-cyan);
  margin-left: 6px;
  opacity: 0;
  transition: opacity .2s;
}
.players-refresh-dot--active { opacity: 1; }


/* ============================================================
   Demandes de match — Étape 10
   ============================================================ */

/* ── Overlay plein-écran : demande entrante ── */
.match-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing);

  opacity: 0;
  transform: scale(.96);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.match-overlay--visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

.match-overlay__card {
  width: 100%;
  max-width: 360px;
  background: #111;
  border: 1px solid rgba(0,255,136,.3);
  border-radius: 20px;
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.match-overlay__avatar-wrap {
  position: relative;
  display: inline-flex;
}

/* Anneau pulsant autour de l'avatar */
.match-overlay__pulse {
  position: absolute;
  inset: -7px;
  border-radius: 16px;
  border: 2px solid rgba(0,255,136,.45);
  animation: pulse 1.5s ease-in-out infinite;
  pointer-events: none;
}

.match-overlay__sender {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-overlay__name {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .03em;
}

.match-overlay__label {
  font-size: .9rem;
  color: rgba(240,244,248,.55);
  line-height: 1.5;
}
.match-overlay__label strong { color: var(--color-text); font-weight: 600; }

/* Barre de compte à rebours */
.match-overlay__timer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.match-overlay__timer-label {
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  color: rgba(240,244,248,.4);
}

.match-overlay__timer-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.07);
  border-radius: 2px;
  overflow: hidden;
}

.match-overlay__timer-bar {
  height: 100%;
  background: var(--status-available);
  border-radius: 2px;
  transition: width 1s linear, background-color .5s;
}
.match-overlay__timer-bar--warning { background: var(--color-orange); }
.match-overlay__timer-bar--urgent  { background: var(--status-ingame); }

/* Boutons Accept / Decline */
.match-overlay__actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-accept {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--status-available);
  color: #000;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-accept:hover    { opacity: .9; }
.btn-accept:active   { transform: scale(.97); }
.btn-accept:disabled { opacity: .5; cursor: default; }

.btn-decline {
  flex: 1;
  padding: 14px;
  border: 1px solid rgba(255,59,59,.35);
  border-radius: 10px;
  background: rgba(255,59,59,.08);
  color: var(--status-ingame);
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-decline:hover    { background: rgba(255,59,59,.16); }
.btn-decline:active   { transform: scale(.97); }
.btn-decline:disabled { opacity: .5; cursor: default; }

/* ── Barre demande sortante (sticky sous le header) ── */
.match-outgoing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px var(--spacing);
  background: rgba(0,212,255,.06);
  border-bottom: 1px solid rgba(0,212,255,.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease;
}
.match-outgoing-bar--visible {
  opacity: 1;
  transform: translateY(0);
}

.match-outgoing-bar__text {
  font-size: .875rem;
  color: var(--color-cyan);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-outgoing-bar__text strong { font-weight: 700; }

.match-outgoing-bar__timer {
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: rgba(0,212,255,.6);
  white-space: nowrap;
  flex-shrink: 0;
}

.match-outgoing-bar__cancel {
  padding: 5px 10px;
  border: 1px solid rgba(255,59,59,.3);
  border-radius: 6px;
  background: none;
  color: var(--status-ingame);
  font-family: var(--font-body);
  font-size: .78rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s;
}
.match-outgoing-bar__cancel:hover    { background: rgba(255,59,59,.1); }
.match-outgoing-bar__cancel:disabled { opacity: .4; cursor: default; }

/* ── Écran "Match trouvé" (fallback si chat non chargé) ── */
.match-found-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 60px var(--spacing) 40px;
  text-align: center;
}

.match-found-icon { font-size: 3rem; line-height: 1; }

.match-found-title {
  font-family: var(--font-title);
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 700;
  color: var(--status-chat);
}

.match-found-sub {
  font-size: .95rem;
  color: rgba(240,244,248,.5);
  max-width: 280px;
  line-height: 1.6;
}


/* ============================================================
   Chat éphémère + bouton "Je suis en game" — Étapes 11/13
   ============================================================ */

/*
 * .chat-wrap est en position:fixed pour occuper tout l'espace sous le header.
 * --header-h varie si la barre de demande sortante est visible.
 */
:root { --header-h: 65px; }

.chat-wrap {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  z-index: 10;
}

/* ── Bandeau sticky "Je suis en game" ─────────────────────── */
.ingame-banner {
  flex-shrink: 0;
  background: rgba(255,59,59,.06);
  border-bottom: 1px solid rgba(255,59,59,.18);
  padding: 10px var(--spacing);
  transition: background .3s, border-color .3s;
}

.ingame-banner--success {
  background: rgba(0,255,136,.06);
  border-color: rgba(0,255,136,.2);
}

.ingame-banner__content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ingame-banner__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.ingame-banner__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ingame-banner__text strong {
  font-size: .85rem;
  font-weight: 700;
  color: var(--color-text);
}

.ingame-banner__text span {
  font-size: .72rem;
  color: rgba(240,244,248,.45);
}

.ingame-banner__confirmations {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.ingame-confirm {
  font-size: .72rem;
  font-weight: 600;
  color: rgba(240,244,248,.3);
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  transition: color .25s, background .25s, border-color .25s;
  white-space: nowrap;
}

.ingame-confirm--done {
  color: var(--status-available);
  background: rgba(0,255,136,.1);
  border-color: rgba(0,255,136,.3);
}

/* Bouton de confirmation */
.btn-ingame {
  flex-shrink: 0;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--status-ingame);
  color: #fff;
  font-family: var(--font-title);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
}
.btn-ingame:hover   { opacity: .85; }
.btn-ingame:active  { transform: scale(.97); }
.btn-ingame:disabled { opacity: .45; cursor: default; }

.btn-ingame--confirmed {
  background: rgba(0,255,136,.12);
  color: var(--status-available);
  border: 1px solid rgba(0,255,136,.3);
}

/* ── En-tête partenaire ────────────────────────────────────── */
.chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px var(--spacing);
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.3);
}

.chat-header__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-header__name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header__sub {
  font-size: .7rem;
  color: rgba(240,244,248,.35);
}

.chat-header__timer {
  flex-shrink: 0;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  color: rgba(240,244,248,.3);
  white-space: nowrap;
}

/* ── Zone de messages ──────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px var(--spacing) 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

/* État de chargement initial */
.chat-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(240,244,248,.25);
  font-size: .9rem;
}

/* Bulles */
.chat-msg {
  display: flex;
  max-width: 78%;
}

.chat-msg--mine   { align-self: flex-end; }
.chat-msg--theirs { align-self: flex-start; }

.chat-msg__bubble {
  display: block;
  padding: 9px 14px;
  border-radius: 18px;
  font-size: .9rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-msg--mine   .chat-msg__bubble {
  background: var(--color-cyan);
  color: #000;
  border-bottom-right-radius: 5px;
}

.chat-msg--theirs .chat-msg__bubble {
  background: rgba(255,255,255,.08);
  color: var(--color-text);
  border: 1px solid rgba(255,255,255,.07);
  border-bottom-left-radius: 5px;
}

.chat-msg--flagged .chat-msg__bubble,
.chat-msg--flagged .chat-msg__flagged-label {
  display: block;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(255,59,59,.06);
  border: 1px solid rgba(255,59,59,.18);
  color: rgba(255,100,100,.6);
  font-style: italic;
  font-size: .8rem;
}

/* ── Zone de saisie ────────────────────────────────────────── */
.chat-input-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px var(--spacing) calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: .9rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 110px;
  overflow-y: auto;
  transition: border-color .15s;
}
.chat-input:focus        { border-color: rgba(0,212,255,.45); }
.chat-input::placeholder { color: rgba(240,244,248,.28); }

.btn-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--color-cyan);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-send:hover   { opacity: .85; }
.btn-send:active  { transform: scale(.94); }
.btn-send:disabled { opacity: .35; cursor: default; }


/* ============================================================
   Signalement — Étape 14
   Bouton discret sur les cartes joueurs + panneau bottom-sheet
   ============================================================ */

/* Bouton ⚑ sur les cartes joueurs */
.btn-report-player {
  background: none;
  border: none;
  color: rgba(240,244,248,.18);
  font-size: .8rem;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s, background .15s;
  margin-top: 2px;
  align-self: flex-end;
}
.btn-report-player:hover {
  color: rgba(255,59,59,.7);
  background: rgba(255,59,59,.08);
}

/* Bouton ⚑ dans le chat header */
.btn-report-chat {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(240,244,248,.2);
  font-size: .85rem;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 6px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.btn-report-chat:hover {
  color: rgba(255,59,59,.7);
  background: rgba(255,59,59,.08);
}

/* ── Overlay de signalement (bottom-sheet) ── */
.report-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 600;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

.report-panel--open {
  opacity: 1;
  pointer-events: all;
}

.report-panel__inner {
  width: 100%;
  max-height: 90vh;
  background: #0e0e0e;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255,255,255,.08);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,0,.67,0);
}

.report-panel--open .report-panel__inner {
  transform: translateY(0);
}

.report-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--spacing) 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  background: #0e0e0e;
  z-index: 10;
}

.report-panel__title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--color-text);
}

.report-panel__close {
  background: none;
  border: none;
  color: rgba(240,244,248,.4);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s;
}
.report-panel__close:hover { color: var(--color-text); }

/* Cible du signalement */
.report-panel__target {
  padding: 14px var(--spacing) 0;
  font-size: .9rem;
  color: rgba(240,244,248,.55);
}
.report-panel__target strong { color: var(--color-text); font-weight: 600; }

/* Avertissement anti-abus */
.report-panel__warning {
  margin: 14px var(--spacing) 0;
  padding: 12px 14px;
  background: rgba(255,92,0,.08);
  border: 1px solid rgba(255,92,0,.25);
  border-radius: var(--radius);
  font-size: .8rem;
  color: rgba(255,92,0,.9);
  line-height: 1.5;
}

/* Champs de formulaire */
.report-panel__field {
  padding: 14px var(--spacing) 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-panel__label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(240,244,248,.45);
}

.report-required { color: var(--status-ingame); margin-left: 2px; }
.report-optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: rgba(240,244,248,.3); }

.report-select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: .9rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='rgba(240,244,248,0.4)' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: border-color .15s;
}
.report-select:focus   { border-color: rgba(0,212,255,.45); }
.report-select option  { background: #1a1a1a; color: var(--color-text); }
.report-select.report-select--invalid { border-color: rgba(255,59,59,.5); }

.report-textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: .875rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color .15s;
}
.report-textarea:focus       { border-color: rgba(0,212,255,.4); }
.report-textarea::placeholder { color: rgba(240,244,248,.25); }

.report-char-count {
  align-self: flex-end;
  font-size: .72rem;
  color: rgba(240,244,248,.25);
  font-variant-numeric: tabular-nums;
}

/* Boutons d'action */
.report-panel__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px var(--spacing) 8px;
}

.btn-report-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--color-orange);
  color: #000;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-report-submit:hover   { opacity: .88; }
.btn-report-submit:active  { transform: scale(.98); }
.btn-report-submit:disabled { opacity: .45; cursor: default; }

.btn-report-cancel {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: none;
  color: rgba(240,244,248,.5);
  font-family: var(--font-body);
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-report-cancel:hover { background: rgba(255,255,255,.05); color: var(--color-text); }

/* Note légale */
.report-panel__legal {
  padding: 4px var(--spacing) 16px;
  font-size: .72rem;
  color: rgba(240,244,248,.25);
  text-align: center;
  line-height: 1.5;
}
