/* ════════════════════════════════════════════════════════
   VARIABLES & RESET
════════════════════════════════════════════════════════ */
:root {
  --bg-dark: #0d0d1a;
  --bg-card: #1a1a2e;
  --bg-card2: #16213e;
  --accent: #e94560;
  --accent2: #0f3460;
  --accent3: #f5a623;
  --neon-blue: #00d4ff;
  --neon-green: #39ff14;
  --neon-red: #ff073a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --text-muted: #606080;
  --heart-color: #ff4757;
  --shadow-neon: 0 0 20px rgba(233, 69, 96, 0.5);
  --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 16px;
  --radius-sm: 8px;
  --transition: 0.3s ease;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport height (notch/barre nav mobile) */
  overflow-x: hidden;
  overscroll-behavior: none; /* bloque le pull-to-refresh */
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(15,52,96,0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(233,69,96,0.15) 0%, transparent 50%);
}

/* ════════════════════════════════════════════════════════
   SCREENS
════════════════════════════════════════════════════════ */
.screen { display: none; min-height: 100vh; animation: fadeIn 0.35s ease; }
.screen.active { display: flex; flex-direction: column; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Animation d'entrée staggerée pour les enfants du menu-scroll */
@keyframes menuItemIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.menu-scroll > * {
  animation: menuItemIn 0.45s ease both;
}
.menu-scroll > *:nth-child(1) { animation-delay: 0.04s; }
.menu-scroll > *:nth-child(2) { animation-delay: 0.12s; }
.menu-scroll > *:nth-child(3) { animation-delay: 0.20s; }

/* ════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  min-height: 44px; /* zone tactile minimale */
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #c0392b);
  color: #fff; box-shadow: 0 4px 15px rgba(233,69,96,0.4);
}
.btn-primary:not(:disabled):hover {
  background: linear-gradient(135deg, #ff6b7a, var(--accent));
  box-shadow: 0 6px 25px rgba(233,69,96,0.6); transform: translateY(-2px);
}
.btn-secondary {
  background: rgba(255,255,255,0.08); color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.btn-large  { padding: 16px 28px; font-size: 1.05rem; border-radius: var(--radius); }
.btn-sm     { padding: 7px 14px; font-size: 0.85rem; }
.btn-validate {
  background: linear-gradient(135deg, var(--neon-green), #00cc00);
  color: #000; font-size: 1.2rem; font-weight: 800;
  padding: 12px 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  min-width: 52px; box-shadow: 0 0 15px rgba(57,255,20,0.3);
}
.btn-validate:hover { box-shadow: 0 0 25px rgba(57,255,20,0.6); transform: none; }

/* ════════════════════════════════════════════════════════
   LOGO
════════════════════════════════════════════════════════ */
.logo { text-align: center; padding: 20px 0 10px; }
.bomb-icon {
  font-size: 4rem; display: block;
  animation: bombFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255,150,0,0.6));
}
@keyframes bombFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}
.logo h1 {
  font-size: 3rem; font-weight: 900;
  background: linear-gradient(135deg, #fff 30%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -1px; line-height: 1; margin-top: 8px;
}
.subtitle { color: var(--text-secondary); margin-top: 6px; font-size: 1rem; }

/* ════════════════════════════════════════════════════════
   MENU SCREEN
════════════════════════════════════════════════════════ */
#screen-menu {
  position: relative; overflow: hidden;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Orbes d'arrière-plan ── */
.menu-bg-anim {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0;
}
.menu-orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.45;
}
.menu-orb-red {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(233,69,96,0.85), transparent 70%);
  top: -140px; right: -140px;
  animation: orbDrift 9s ease-in-out infinite alternate;
}
.menu-orb-blue {
  width: 580px; height: 580px;
  background: radial-gradient(circle, rgba(15,52,96,0.95), transparent 70%);
  bottom: -180px; left: -180px;
  animation: orbDrift 13s ease-in-out infinite alternate-reverse;
}
.menu-orb-amber {
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(245,166,35,0.6), transparent 70%);
  top: 40%; left: 55%;
  animation: orbDrift 11s ease-in-out infinite alternate;
  animation-delay: -4s;
}
@keyframes orbDrift {
  0%   { transform: translate(0, 0)      scale(1); }
  100% { transform: translate(40px, 50px) scale(1.15); }
}

/* Grille de points subtile */
.menu-dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.045) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
}

/* ── Wrapper scrollable centré ── */
.menu-scroll {
  position: relative; z-index: 1;
  width: 100%; max-width: 520px;
  /* Remplit toute la hauteur du parent flex, puis scrolle en interne */
  align-self: stretch;
  padding: 40px 20px 52px;
  display: flex; flex-direction: column; gap: 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Centrage horizontal du contenu quand l'écran est large */
  margin-left: auto; margin-right: auto;
}

/* ── Hero logo ── */
.menu-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 0 4px;
}
.menu-bomb-wrap { flex-shrink: 0; }
.menu-bomb-wrap .bomb-icon {
  font-size: 3.8rem; display: block;
  animation: bombFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(255,140,0,0.8));
}
.menu-title-block h1 {
  font-size: clamp(2rem, 7vw, 2.8rem); font-weight: 900;
  background: linear-gradient(135deg, #fff 30%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  letter-spacing: -1px; line-height: 1.05;
}
.menu-title-block .subtitle {
  color: var(--text-secondary); font-size: 0.88rem; margin-top: 5px;
}

/* ── Carte principale ── */
.menu-card {
  background: rgba(26,26,46,0.9); border-radius: var(--radius); padding: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow-card), inset 0 0.5px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  display: flex; flex-direction: column; gap: 18px;
}

/* ── Profil ── */
.profile-section { display: flex; align-items: center; gap: 14px; }
.profile-avatar-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0;
}
.profile-avatar-picker {
  font-size: 2.4rem; width: 58px; height: 58px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition); user-select: none;
}
.profile-avatar-picker:hover {
  border-color: var(--neon-blue); box-shadow: 0 0 18px rgba(0,212,255,0.35);
  background: rgba(0,212,255,0.08);
}
.profile-avatar-hint {
  font-size: 0.62rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.profile-name-field {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
}
.field-label {
  font-size: 0.7rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.profile-name-input {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary); font-family: var(--font); font-size: 1.1rem;
  font-weight: 700; padding: 10px 14px; border-radius: var(--radius-sm); outline: none;
  transition: border-color var(--transition);
}
.profile-name-input:focus { border-color: var(--neon-blue); box-shadow: 0 0 0 3px rgba(0,212,255,0.1); }

/* Avatar grid */
.avatar-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px;
}
.avatar-grid.hidden { display: none; }
.avatar-option {
  font-size: 1.5rem; aspect-ratio: 1; border-radius: 50%;
  background: rgba(255,255,255,0.05); border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
}
.avatar-option:hover, .avatar-option.selected {
  border-color: var(--neon-blue); background: rgba(0,212,255,0.1);
}

/* ── Diviseur section ── */
.menu-divider {
  display: flex; align-items: center; gap: 10px;
}
.menu-divider span:first-child,
.menu-divider span:last-child {
  flex: 1; height: 1px; background: rgba(255,255,255,0.08);
}
.menu-divider-label {
  font-size: 0.66rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.5px;
  white-space: nowrap;
  /* override generic span rules */
  flex: unset !important; height: unset !important; background: none !important;
}

/* ── Actions ── */
.menu-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── CTA principal : Créer ── */
.btn-menu-create {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 18px 22px;
  background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
  border: none; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  box-shadow: 0 4px 22px rgba(233,69,96,0.45);
  position: relative; overflow: hidden;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
/* Overlay gradient fixe */
.btn-menu-create::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.14), transparent 55%);
  pointer-events: none;
}
/* Effet shimmer animé */
.btn-menu-create::before {
  content: ''; position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: skewX(-15deg);
  animation: shimmerSlide 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmerSlide {
  0%   { left: -100%; }
  40%  { left: 150%; }
  100% { left: 150%; }
}
.btn-menu-create:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(233,69,96,0.65);
}
.btn-menu-create:active { transform: scale(0.98); box-shadow: 0 2px 12px rgba(233,69,96,0.4); }
.menu-create-icon { font-size: 1.9rem; flex-shrink: 0; position: relative; z-index: 1; }
.menu-create-text  { flex: 1; text-align: left; position: relative; z-index: 1; }
.menu-create-text strong { display: block; font-size: 1rem; font-weight: 800; color: #fff; }
.menu-create-text small  { display: block; font-size: 0.76rem; color: rgba(255,255,255,0.65); margin-top: 3px; }
.menu-create-arrow {
  font-size: 1.3rem; color: rgba(255,255,255,0.7);
  position: relative; z-index: 1; transition: transform var(--transition);
}
.btn-menu-create:hover .menu-create-arrow { transform: translateX(5px); }

/* ── Rangées de cartes 2×2 ── */
.menu-actions-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

/* Cartes actions */
.btn-menu-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 16px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  color: var(--text-primary); min-height: 92px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  position: relative; overflow: hidden;
}
.btn-menu-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent);
  pointer-events: none;
}
.btn-menu-card:hover {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0,212,255,0.15);
}
.btn-menu-card:active { transform: scale(0.96); }
.btn-menu-card--ghost {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.07);
}
.btn-menu-card--ghost:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
  box-shadow: none;
}
.menu-card-icon  { font-size: 1.6rem; display: block; }
.btn-menu-card strong { font-size: 0.88rem; font-weight: 700; display: block; }
.btn-menu-card small  { font-size: 0.7rem; color: var(--text-secondary); display: block; font-weight: 400; }

/* Firebase warning */
.firebase-warning {
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: rgba(245,166,35,0.12); border: 1px solid rgba(245,166,35,0.3);
  font-size: 0.85rem; color: var(--accent3); text-align: center;
}
.firebase-warning a { color: var(--neon-blue); }
.firebase-warning.hidden { display: none; }

/* ════════════════════════════════════════════════════════
   SUBSCREEN (create / join / public / local / lobby)
════════════════════════════════════════════════════════ */
.subscreen-container {
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 20px;
}
.lobby-container { max-width: 900px; }

.subscreen-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0;
}
.subscreen-header h2 { font-size: 1.3rem; font-weight: 800; }
.btn-back { }

/* ════════════════════════════════════════════════════════
   SETUP CARD (shared)
════════════════════════════════════════════════════════ */
.setup-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 24px;
  border: 1px solid rgba(255,255,255,0.07); box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 24px;
}
.setup-section h3 {
  font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 14px;
}
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.setting-item { display: flex; flex-direction: column; gap: 8px; }
.setting-item-full { grid-column: 1 / -1; }
.setting-item label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }

select {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary); font-family: var(--font); font-size: 0.95rem;
  padding: 10px 36px 10px 14px; border-radius: var(--radius-sm); cursor: pointer;
  outline: none; transition: border-color var(--transition);
  -webkit-appearance: none; 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 d='M1 1l5 5 5-5' stroke='%23a0a0c0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select:hover, select:focus { border-color: var(--accent); }
select option { background: #1a1a2e; }

/* Toggle */
.toggle-label { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.95rem; user-select: none; }
.toggle-label input[type="checkbox"] { display: none; }
.toggle-slider {
  width: 44px; height: 24px; background: rgba(255,255,255,0.1);
  border-radius: 12px; position: relative; transition: background var(--transition); flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: transform var(--transition);
}
.toggle-label input:checked + .toggle-slider { background: var(--accent); }
.toggle-label input:checked + .toggle-slider::after { transform: translateX(20px); }

/* Players list (local) */
.players-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.player-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04); border-radius: var(--radius-sm);
  padding: 10px 14px; border: 1px solid rgba(255,255,255,0.06);
  transition: border-color var(--transition);
}
.player-row:focus-within { border-color: var(--accent); }
.player-avatar { font-size: 1.4rem; width: 36px; text-align: center; flex-shrink: 0; }
.player-name-input {
  flex: 1; background: transparent; border: none; color: var(--text-primary);
  font-family: var(--font); font-size: 1rem; font-weight: 600; outline: none;
}
.player-name-input::placeholder { color: var(--text-muted); font-weight: 400; }
.btn-remove-player {
  background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; padding: 4px 8px; border-radius: 50%;
  transition: all var(--transition); line-height: 1;
}
.btn-remove-player:hover { color: var(--accent); background: rgba(233,69,96,0.1); }
.player-actions { display: flex; gap: 8px; }

/* Error / hint */
.error-banner {
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: rgba(255,7,58,0.12); border: 1px solid rgba(255,7,58,0.3);
  color: #ff6b8a; font-size: 0.9rem;
}
.error-banner.hidden { display: none; }
.hint-text { font-size: 0.85rem; color: var(--text-muted); text-align: center; }

/* ════════════════════════════════════════════════════════
   JOIN SCREEN
════════════════════════════════════════════════════════ */
.code-input-wrapper { display: flex; justify-content: center; margin: 8px 0; }
.code-input {
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.15);
  color: var(--text-primary); font-family: var(--font); font-size: 2rem;
  font-weight: 900; padding: 16px 24px; border-radius: var(--radius);
  outline: none; text-align: center; letter-spacing: 4px; width: 100%;
  max-width: 300px; text-transform: uppercase; transition: border-color var(--transition);
}
.code-input:focus { border-color: var(--neon-blue); box-shadow: 0 0 20px rgba(0,212,255,0.2); }

/* ════════════════════════════════════════════════════════
   PUBLIC ROOMS
════════════════════════════════════════════════════════ */
.public-rooms-list { display: flex; flex-direction: column; gap: 10px; }
.rooms-loading { text-align: center; color: var(--text-muted); padding: 40px; }
.rooms-empty { text-align: center; color: var(--text-muted); padding: 40px; font-size: 1.1rem; }
.room-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border-radius: var(--radius);
  padding: 16px 18px; border: 1px solid rgba(255,255,255,0.07);
  transition: all var(--transition); cursor: pointer;
}
.room-row:hover { border-color: var(--neon-blue); background: rgba(0,212,255,0.05); }
.room-row-info { flex: 1; min-width: 0; }
.room-row-host { font-weight: 700; font-size: 1rem; }
.room-row-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 3px; }
.room-row-players { font-size: 1.3rem; font-weight: 800; color: var(--neon-blue); }
.room-row-join { flex-shrink: 0; }

/* ════════════════════════════════════════════════════════
   LOBBY
════════════════════════════════════════════════════════ */
.room-code-display {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg-card); border-radius: var(--radius); padding: 20px;
  border: 1px solid rgba(255,255,255,0.07); text-align: center;
}
.room-code-label { font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }
.room-code-box { display: flex; align-items: center; gap: 10px; }
.room-code-value {
  font-size: 2.4rem; font-weight: 900; color: var(--neon-blue);
  text-shadow: 0 0 20px rgba(0,212,255,0.5); letter-spacing: 4px; font-family: monospace;
}
.room-code-hint { font-size: 0.8rem; color: var(--text-muted); }

.lobby-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.lobby-players-section h3,
.lobby-chat h3 {
  font-size: 0.85rem; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
}
.lobby-players-list { display: flex; flex-direction: column; gap: 8px; }
.lobby-player-avatar { font-size: 1.4rem; }
.lobby-player-name { flex: 1; font-weight: 600; }
.lobby-player-badge {
  font-size: 0.7rem; font-weight: 800; padding: 2px 8px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-host { background: rgba(245,166,35,0.2); color: var(--accent3); border: 1px solid rgba(245,166,35,0.3); }
.badge-you  { background: rgba(0,212,255,0.15); color: var(--neon-blue); border: 1px solid rgba(0,212,255,0.3); }
.lobby-player-online { width: 8px; height: 8px; border-radius: 50%; background: var(--neon-green); }
.lobby-player-online.offline { background: #555; }

.lobby-chat { display: flex; flex-direction: column; height: 280px; }
.chat-messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  padding: 8px; background: rgba(0,0,0,0.2); border-radius: var(--radius-sm);
  margin-bottom: 8px; min-height: 0;
}
.chat-message { font-size: 0.85rem; }
.chat-message-author { font-weight: 700; color: var(--neon-blue); margin-right: 6px; }
.chat-message-text { color: var(--text-secondary); }
.chat-message.system { color: var(--text-muted); font-style: italic; font-size: 0.8rem; text-align: center; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary); font-family: var(--font); font-size: 0.9rem;
  padding: 8px 12px; border-radius: var(--radius-sm); outline: none;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--neon-blue); }

.lobby-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.waiting-msg { text-align: center; color: var(--text-secondary); padding: 16px; font-size: 1rem; }
.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════
   GAME SCREEN
════════════════════════════════════════════════════════ */
#screen-game { display: none; flex-direction: column; }
#screen-game.active { display: flex; }
.game-layout {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  overflow: hidden;
}

/* ── Header ── */
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(10px); position: relative; z-index: 100;
  flex-shrink: 0;
}
.logo-small { font-size: 1.1rem; font-weight: 800; opacity: 0.8; }
.room-badge {
  background: rgba(0,212,255,0.15); border: 1px solid rgba(0,212,255,0.3);
  color: var(--neon-blue); font-size: 0.75rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; margin-left: 8px; font-family: monospace;
}
.header-left { display: flex; align-items: center; }

/* ── Body: jeu + chat ── */
.game-body {
  display: flex; flex: 1; min-height: 0; overflow: hidden;
}

/* ── Centre : panels + bombe ── */
.game-center {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}

.game-main {
  display: grid; grid-template-columns: 220px 1fr 220px;
  flex: 1; gap: 0; min-height: 0;
}
.players-panel {
  padding: 16px 12px; display: flex; flex-direction: column;
  gap: 10px; overflow-y: auto; background: rgba(0,0,0,0.15);
}
.players-panel.left  { border-right: 1px solid rgba(255,255,255,0.05); }
.players-panel.right { border-left:  1px solid rgba(255,255,255,0.05); }
.players-panel-mobile { display: none; }

/* ════════════════════════════════════════════════════════
   CHAT PANEL JEUX (desktop: sidebar / mobile: overlay)
════════════════════════════════════════════════════════ */
.game-chat-panel {
  /* Desktop: sidebar permanente */
  width: 280px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgba(0,0,0,0.22);
  border-left: 1px solid rgba(255,255,255,0.07);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
/* Masqué par défaut (mode local, ou si online pas encore démarré) */
.game-layout:not(.game-has-chat) .game-chat-panel { display: none; }

.game-chat-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  flex-shrink: 0;
}
.chat-panel-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 0.9rem; color: var(--text-primary);
}
.chat-panel-icon { font-size: 1rem; }
/* Fermer visible seulement en mobile */
#btn-game-chat-close { display: none; }

.game-chat-messages {
  flex: 1; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 6px;
  min-height: 0;
}
.game-chat-input-row {
  padding: 10px; border-top: 1px solid rgba(255,255,255,0.07);
  display: flex; gap: 8px; flex-shrink: 0;
}

/* Badge non-lus (mobile toggle button) */
.chat-unread-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-size: 0.65rem; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 8px;
  padding: 0 4px; margin-left: 2px;
}
.chat-unread-count.hidden { display: none; }

.player-card {
  background: var(--bg-card); border-radius: var(--radius-sm); padding: 12px;
  border: 2px solid transparent; transition: all 0.3s ease; position: relative; overflow: hidden;
}
.player-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.03));
}
.player-card.active {
  border-color: var(--neon-blue);
  box-shadow: 0 0 20px rgba(0,212,255,0.25), inset 0 0 20px rgba(0,212,255,0.05);
}
.player-card.eliminated { opacity: 0.35; filter: grayscale(80%); }
.player-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.player-card-avatar { font-size: 1.3rem; }
.player-card-name {
  font-size: 0.9rem; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.player-card-you { font-size: 0.65rem; color: var(--neon-blue); font-weight: 800; }
.player-lives { display: flex; gap: 4px; flex-wrap: wrap; }
.heart { font-size: 1rem; transition: all 0.3s ease; display: inline-block; }
.heart.lost { filter: grayscale(1); opacity: 0.3; transform: scale(0.8); }
.heart.losing { animation: heartLose 0.5s ease forwards; }
@keyframes heartLose {
  0% { transform: scale(1.3); filter: none; }
  50% { transform: scale(0.5) rotate(20deg); color: var(--accent); }
  100% { transform: scale(0.8); filter: grayscale(1); opacity: 0.3; }
}
.active-badge {
  position: absolute; top: -1px; right: -1px;
  background: var(--neon-blue); color: #000; font-size: 0.6rem; font-weight: 800;
  padding: 2px 8px; border-radius: 0 var(--radius-sm) 0 var(--radius-sm);
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* Bomb */
.bomb-area { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 20px; }
.bomb-wrapper { position: relative; display: flex; align-items: center; justify-content: center; }
.bomb { position: relative; width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; animation: bombPulse 1s ease-in-out infinite; }
@keyframes bombPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.bomb.ticking-fast { animation: bombPulseFast 0.3s ease-in-out infinite; }
@keyframes bombPulseFast { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.bomb-body {
  width: 90px; height: 90px;
  background: radial-gradient(circle at 35% 35%, #555, #111);
  border-radius: 50%; position: relative;
  box-shadow: 0 8px 30px rgba(0,0,0,0.8), inset 0 2px 4px rgba(255,255,255,0.1);
}
.bomb-highlight { position: absolute; top: 14px; left: 20px; width: 22px; height: 14px; background: radial-gradient(ellipse, rgba(255,255,255,0.25), transparent); border-radius: 50%; }
.bomb-fuse { position: absolute; top: -22px; right: 20px; width: 4px; height: 28px; background: repeating-linear-gradient(180deg, #8B6914 0, #8B6914 4px, #5a4209 4px, #5a4209 8px); border-radius: 2px; transform-origin: bottom center; animation: fuseWiggle 0.5s ease-in-out infinite alternate; }
@keyframes fuseWiggle { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.fuse-fire { position: absolute; top: -24px; left: 50%; transform: translateX(-50%); font-size: 1.2rem; animation: fireDance 0.3s ease-in-out infinite alternate; }
@keyframes fireDance { from { transform: translateX(-50%) scale(0.85) rotate(-5deg); } to { transform: translateX(-50%) scale(1.15) rotate(5deg); } }
.bomb-timer { position: absolute; font-size: 1.8rem; font-weight: 900; color: #fff; text-shadow: 0 0 10px rgba(255,255,255,0.5); z-index: 2; font-variant-numeric: tabular-nums; transition: color 0.3s; }
.bomb-timer.warning { color: var(--accent3); text-shadow: 0 0 15px rgba(245,166,35,0.8); }
.bomb-timer.danger  { color: var(--neon-red); text-shadow: 0 0 20px rgba(255,7,58,0.9); }
.explosion { position: absolute; font-size: 6rem; animation: explodeAnim 0.6s ease-out forwards; z-index: 10; }
.explosion.hidden { display: none; }
@keyframes explodeAnim { 0% { transform: scale(0.2) rotate(0deg); opacity: 1; } 50% { transform: scale(1.8) rotate(20deg); opacity: 1; } 100% { transform: scale(2.5) rotate(-10deg); opacity: 0; } }

/* Input area */
.input-area { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 400px; }
.active-player-name { font-size: 0.95rem; font-weight: 700; color: var(--neon-blue); text-transform: uppercase; letter-spacing: 1px; }
.my-turn-badge {
  font-size: 0.8rem; font-weight: 700; color: var(--neon-green);
  background: rgba(57,255,20,0.1); border: 1px solid rgba(57,255,20,0.3);
  padding: 4px 14px; border-radius: 20px; animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.input-wrapper {
  display: flex; width: 100%; border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1); transition: border-color var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.input-wrapper:focus-within { border-color: var(--neon-blue); box-shadow: 0 0 20px rgba(0,212,255,0.2); }
.input-wrapper.error   { border-color: var(--neon-red); animation: shake 0.4s ease; }
.input-wrapper.success { border-color: var(--neon-green); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.word-input { flex: 1; background: rgba(255,255,255,0.05); border: none; color: var(--text-primary); font-family: var(--font); font-size: 1.2rem; font-weight: 600; padding: 14px 16px; outline: none; letter-spacing: 1px; }
.word-input::placeholder { color: var(--text-muted); font-weight: 400; font-size: 1rem; }
.word-input:disabled { opacity: 0.4; cursor: not-allowed; }
.feedback-msg { font-size: 0.9rem; font-weight: 600; min-height: 22px; transition: all 0.3s ease; text-align: center; }
.feedback-msg.error    { color: var(--neon-red); }
.feedback-msg.success  { color: var(--neon-green); }
.feedback-msg.info     { color: var(--accent3); }
.feedback-msg.checking { color: var(--accent2, #f0c040); animation: pulse-opacity 0.8s ease-in-out infinite; }
@keyframes pulse-opacity { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* Syllabe */
.syllable-display { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.syllable-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.syllable {
  font-size: 1.6rem; font-weight: 900; color: var(--neon-blue);
  text-shadow: 0 0 20px var(--neon-blue), 0 0 40px rgba(0,212,255,0.3);
  letter-spacing: 3px; text-transform: uppercase; transition: all 0.3s ease;
}
.syllable.new-syllable { animation: syllableIn 0.5s ease; }
@keyframes syllableIn {
  0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(3deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ─── Barre progression alphabet ─── */
.alphabet-track {
  position: relative;
  height: 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  margin-top: 6px;
  overflow: hidden;
}
.alphabet-track-fill {
  height: 100%;
  background: linear-gradient(90deg, #39ff14, #00d4ff);
  border-radius: 8px;
  transition: width 0.4s ease;
}
.alphabet-track-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* ─── Animation bonus A→Z ─── */
@keyframes alphabet-bonus-glow {
  0%   { box-shadow: 0 0 0px #ffcc00; transform: scale(1); }
  40%  { box-shadow: 0 0 24px #ffcc00, 0 0 48px #39ff14; transform: scale(1.06); }
  100% { box-shadow: 0 0 0px #ffcc00; transform: scale(1); }
}
.player-card.alphabet-bonus {
  animation: alphabet-bonus-glow 1.5s ease-out forwards;
}


/* ════════════════════════════════════════════════════════
   END SCREEN
════════════════════════════════════════════════════════ */
#screen-end { align-items: center; justify-content: center; padding: 20px; }
.end-container { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100vh; }
.end-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 40px 32px;
  max-width: 580px; width: 100%; text-align: center;
  border: 1px solid rgba(255,255,255,0.08); box-shadow: var(--shadow-card);
  position: relative; z-index: 2; animation: slideUp 0.5s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.end-trophy-wrap {
  position: relative; display: inline-block; margin-bottom: 4px;
}
.end-trophy { font-size: 4rem; animation: trophySpin 1s ease 0.3s both; display: block; }
@keyframes trophySpin { 0% { transform: scale(0) rotate(-180deg); opacity: 0; } 60% { transform: scale(1.3) rotate(20deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.end-trophy-glow {
  position: absolute; inset: -12px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,166,35,0.25), transparent 70%);
  animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse { 0%,100% { opacity: 0.6; transform: scale(1); } 50% { opacity: 1; transform: scale(1.15); } }

.end-title { font-size: 2rem; font-weight: 900; background: linear-gradient(135deg, #fff, var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 20px; }
.winner-display { background: linear-gradient(135deg, rgba(233,69,96,0.15), rgba(15,52,96,0.3)); border: 1px solid rgba(233,69,96,0.3); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.winner-emoji { font-size: 2.5rem; animation: bounce 1s ease infinite alternate; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-8px); } }
.winner-name { font-size: 2rem; font-weight: 900; color: var(--accent3); }
.winner-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

.end-scoreboard-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); margin-bottom: 10px;
}

.scoreboard { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; text-align: left; }
.score-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.04); border-radius: var(--radius-sm);
  padding: 12px 14px; border: 1px solid rgba(255,255,255,0.06);
  transition: border-color var(--transition);
}
.score-row:first-child {
  background: rgba(245,166,35,0.08); border-color: rgba(245,166,35,0.25);
}
.score-rank { font-size: 1.2rem; width: 30px; text-align: center; flex-shrink: 0; }
.score-avatar { font-size: 1.3rem; flex-shrink: 0; }
.score-name { flex: 1; font-weight: 600; }
.score-lives { display: flex; gap: 3px; flex-shrink: 0; }
.score-words {
  font-size: 0.75rem; color: var(--text-muted);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  padding: 2px 8px; border-radius: 12px; flex-shrink: 0; white-space: nowrap;
}
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Confetti */
.confetti-container { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.confetti-piece { position: absolute; width: 10px; height: 10px; top: -20px; border-radius: 2px; animation: confettiFall linear both; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

/* ════════════════════════════════════════════════════════
   GAME PREVIEW (écran création)
════════════════════════════════════════════════════════ */
.game-preview {
  background: rgba(0,212,255,0.04); border: 1px solid rgba(0,212,255,0.15);
  border-radius: var(--radius); padding: 16px 18px;
}
.game-preview-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--neon-blue); margin-bottom: 12px;
}
.game-preview-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.game-preview-item {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.preview-icon { font-size: 1.3rem; flex-shrink: 0; }
.game-preview-item div strong { display: block; font-size: 0.85rem; font-weight: 700; }
.game-preview-item div small { font-size: 0.72rem; color: var(--text-secondary); }

/* Toggle sous-label */
.toggle-sublabel { font-size: 0.72rem; color: var(--text-muted); margin-left: 2px; }

/* ════════════════════════════════════════════════════════
   LOBBY — améliorations
════════════════════════════════════════════════════════ */
/* Badge de statut plus visible */
.lobby-player-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04); border-radius: var(--radius-sm);
  padding: 11px 14px; border: 1px solid rgba(255,255,255,0.06);
  transition: border-color var(--transition), background var(--transition);
}
.lobby-player-row.is-host { border-color: rgba(245,166,35,0.4); background: rgba(245,166,35,0.04); }

/* Settings display amélioré */
.lobby-settings {
  background: rgba(255,255,255,0.03); border-radius: var(--radius-sm);
  padding: 14px 16px; border: 1px solid rgba(255,255,255,0.06);
  font-size: 0.85rem; color: var(--text-secondary); margin-top: 12px;
}
.lobby-settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.lobby-settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.lobby-settings-val { color: var(--text-primary); font-weight: 600; }

/* ════════════════════════════════════════════════════════
   LOADING OVERLAY
════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(13,13,26,0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; z-index: 999; backdrop-filter: blur(8px);
}
.loading-spinner { font-size: 3rem; animation: bombFloat 1s ease-in-out infinite; }
.loading-text { font-size: 1.1rem; color: var(--text-secondary); }

/* ════════════════════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE — Mobile first
════════════════════════════════════════════════════════ */

/* ── Petit bureau / grande tablette (≤ 1100px) ────────── */
@media (max-width: 1100px) {
  .game-main { grid-template-columns: 180px 1fr 180px; }
  .player-card-name { font-size: 0.82rem; }
  .game-chat-panel { width: 250px; }
}

/* ── Tablette (≤ 900px) ──────────────────────────────── */
@media (max-width: 900px) {
  /* Jeu : masquer les panels latéraux, afficher panel mobile */
  .game-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .players-panel.left, .players-panel.right { display: none; }
  .players-panel-mobile {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.25);
    flex-shrink: 0;
  }
  .players-panel-mobile::-webkit-scrollbar { display: none; }
  .players-panel-mobile .player-card { min-width: 140px; flex-shrink: 0; }

  /* ── Chat panel → overlay plein écran côté droit ── */
  .game-chat-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(300px, 88vw);
    z-index: 200;
    transform: translateX(110%);
    background: var(--bg-card);
    border-left: 1px solid rgba(255,255,255,0.1);
    box-shadow: -6px 0 30px rgba(0,0,0,0.6);
    border-radius: var(--radius) 0 0 var(--radius);
  }
  /* Quand ouvert en mobile */
  .game-layout.game-has-chat .game-chat-panel { transform: translateX(110%); }
  .game-layout.game-has-chat .game-chat-panel.chat-panel-open { transform: translateX(0); }

  /* Afficher le bouton toggle + bouton fermer */
  #btn-game-chat-close { display: inline-flex; }
  .game-layout.game-has-chat #btn-game-chat-toggle { display: inline-flex !important; }

  /* Lobby : colonne unique */
  .lobby-body { grid-template-columns: 1fr; }
  .lobby-chat { height: 220px; }
  .lobby-container { max-width: 600px; }

  /* Subscreen */
  .subscreen-container { max-width: 100%; }
}

/* ── Desktop (> 900px) : chat panel toujours visible, toggle caché ── */
@media (min-width: 901px) {
  .game-chat-panel { transform: none !important; }
  #btn-game-chat-toggle { display: none !important; }
  #btn-game-chat-close  { display: none !important; }
}

/* ── Mobile (≤ 640px) ────────────────────────────────── */
@media (max-width: 640px) {
  /* ── Globals ──────────────────────────────── */
  html { font-size: 15px; }

  /* Empêche le zoom automatique iOS sur focus input (font-size < 16px) */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* ── Menu ────────────────────────────────── */
  .menu-scroll { padding: 24px 14px 40px; gap: 16px; }
  .menu-hero { gap: 12px; }
  .menu-bomb-wrap .bomb-icon { font-size: 2.8rem; }
  .menu-title-block h1 { font-size: clamp(1.7rem, 7vw, 2.2rem); }
  .menu-title-block .subtitle { font-size: 0.8rem; }
  .menu-card { padding: 16px 14px; gap: 14px; }
  .profile-avatar-picker { width: 48px; height: 48px; font-size: 1.9rem; }
  .profile-name-input { font-size: 1rem; padding: 10px 12px; }
  .avatar-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .avatar-option { font-size: 1.3rem; }
  .btn-menu-create { padding: 15px 16px; gap: 12px; }
  .menu-create-icon { font-size: 1.5rem; }
  .menu-create-text strong { font-size: 0.93rem; }
  .menu-create-text small  { font-size: 0.72rem; }
  .menu-card-icon { font-size: 1.4rem; }
  .btn-menu-card { min-height: 80px; padding: 13px 8px; }
  .btn-menu-card strong { font-size: 0.82rem; }
  .btn-menu-card small  { font-size: 0.65rem; }

  /* ── Subscreens ──────────────────────────── */
  .subscreen-container { padding: 12px 10px 24px; gap: 12px; }
  .subscreen-header { padding: 2px 0; }
  .subscreen-header h2 { font-size: 1.1rem; }
  .setup-card { padding: 16px 14px; gap: 18px; border-radius: var(--radius); }
  .settings-grid { grid-template-columns: 1fr; }
  .game-preview-grid { grid-template-columns: 1fr; }

  /* ── Code d'invitation ───────────────────── */
  .code-input {
    font-size: 1.7rem;
    letter-spacing: 3px;
    padding: 14px 16px;
    max-width: 100%;
  }

  /* ── Parties publiques ───────────────────── */
  .room-row { padding: 12px; gap: 10px; flex-wrap: wrap; }
  .room-row-info { flex: 1 1 100%; }
  .room-row-players { font-size: 1.1rem; }
  .room-row-join .btn { width: 100%; }

  /* ── Lobby ───────────────────────────────── */
  .room-code-display { padding: 14px; }
  .room-code-value { font-size: clamp(1.5rem, 7vw, 2rem); letter-spacing: 2px; }
  .lobby-chat { height: 180px; }
  .lobby-player-row { padding: 8px 10px; }
  .lobby-player-avatar { font-size: 1.2rem; }

  /* ── Jeu : header ────────────────────────── */
  .game-header { padding: 7px 10px; gap: 6px; min-height: 48px; }
  .logo-small { display: none; }
  .room-badge { display: none; }
  .syllable-label { display: none; }
  .syllable { font-size: clamp(1.2rem, 5vw, 1.6rem); letter-spacing: 2px; }
  .header-right { gap: 4px; }
  .header-right .btn { padding: 7px 10px; font-size: 0.82rem; min-height: 38px; }

  /* ── Jeu : bombe ─────────────────────────── */
  .bomb-area { padding: 8px 16px; gap: 12px; }
  .bomb { width: 96px; height: 96px; }
  .bomb-body { width: 72px; height: 72px; }
  .bomb-fuse { height: 22px; top: -18px; }
  .fuse-fire { font-size: 1rem; top: -20px; }
  .bomb-timer { font-size: 1.5rem; }
  .explosion { font-size: 4rem; }

  /* ── Jeu : saisie ────────────────────────── */
  .input-area {
    max-width: 100%;
    width: 100%;
    padding: 0 10px;
    gap: 6px;
  }
  .active-player-name { font-size: 0.82rem; letter-spacing: 0.5px; }
  .my-turn-badge { font-size: 0.75rem; padding: 3px 10px; }
  .word-input { font-size: 1.1rem; padding: 14px 12px; }
  .btn-validate {
    min-width: 56px;
    font-size: 1.3rem;
    padding: 14px 14px;
  }
  .feedback-msg { font-size: 0.82rem; min-height: 18px; }

  /* ── Jeu : panel mobile ──────────────────── */
  .players-panel-mobile { padding: 8px 10px; gap: 7px; }
  .players-panel-mobile .player-card { min-width: 120px; padding: 9px; }
  .player-card-avatar { font-size: 1.1rem; }
  .player-card-name { font-size: 0.78rem; }
  .heart { font-size: 0.85rem; }
  .alphabet-track { height: 12px; margin-top: 5px; }
  .alphabet-track-label { font-size: 0.58rem; }
  .active-badge { font-size: 0.55rem; padding: 1px 6px; }

  /* ── Chat panel mobile : pleine hauteur ──── */
  .game-chat-panel {
    width: 100% !important;
    border-radius: 0;
  }

  /* ── Fin de partie ───────────────────────── */
  #screen-end { padding: 12px; }
  .end-card { padding: 22px 16px; border-radius: var(--radius); }
  .end-trophy { font-size: 2.8rem; }
  .end-title { font-size: clamp(1.3rem, 5vw, 1.8rem); margin-bottom: 14px; }
  .winner-display { padding: 14px; margin-bottom: 16px; }
  .winner-emoji { font-size: 2rem; }
  .winner-name { font-size: clamp(1.2rem, 5vw, 1.7rem); }
  .winner-subtitle { font-size: 0.85rem; }
  .score-row { padding: 8px 10px; gap: 8px; }
  .score-rank { font-size: 1rem; width: 24px; }
  .score-avatar { font-size: 1.1rem; }
  .score-name { font-size: 0.9rem; }
  .score-words { display: none; }
  .end-actions { flex-direction: column; gap: 8px; }
  .end-actions .btn { width: 100%; justify-content: center; }
  .scoreboard { margin-bottom: 18px; }
}

/* ── Petit mobile (≤ 420px) ──────────────────────────── */
@media (max-width: 420px) {
  html { font-size: 14px; }

  .logo h1 { font-size: 1.8rem; }
  .bomb-icon { font-size: 2.4rem; }
  .avatar-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }

  .bomb { width: 82px; height: 82px; }
  .bomb-body { width: 62px; height: 62px; }
  .bomb-timer { font-size: 1.3rem; }

  .players-panel-mobile .player-card { min-width: 106px; }

  .room-code-value { font-size: 1.4rem; }
  .code-input { font-size: 1.4rem; letter-spacing: 2px; }

  .word-input { padding: 13px 10px; }
  .btn-validate { min-width: 50px; font-size: 1.2rem; padding: 13px 12px; }
}

/* ── Paysage mobile (hauteur réduite) ────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .game-header { padding: 5px 12px; min-height: 40px; }
  .syllable { font-size: 1.1rem; }
  .bomb { width: 72px; height: 72px; }
  .bomb-body { width: 54px; height: 54px; }
  .bomb-timer { font-size: 1.2rem; }
  .bomb-area { padding: 6px; gap: 8px; }
  .word-input { padding: 10px 12px; }
  .players-panel-mobile { padding: 6px 10px; }
  .players-panel-mobile .player-card { min-width: 100px; padding: 6px 8px; }
  .my-turn-badge { display: none; }
  .active-player-name { font-size: 0.78rem; }
}

/* ── iPhone SE / très petits écrans (≤ 375px) ────────── */
@media (max-width: 375px) {
  .menu-card { padding: 14px 12px; }
  .profile-avatar-picker { width: 42px; height: 42px; font-size: 1.6rem; }
  .menu-card-icon { font-size: 1.2rem; }
  .btn-menu-card { min-height: 72px; }
  .menu-actions-row { gap: 8px; }
  .room-code-value { font-size: 1.3rem; letter-spacing: 1px; }
  .players-panel-mobile .player-card { min-width: 94px; }
}

/* ── Support safe-area (notch iPhone X+) ────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .menu-scroll {
    padding-top:    max(40px, env(safe-area-inset-top));
    padding-bottom: max(52px, calc(env(safe-area-inset-bottom) + 20px));
  }
  .game-layout {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .players-panel-mobile {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .game-chat-panel {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ════════════════════════════════════════════════════════
   ÉCRAN PROFIL
════════════════════════════════════════════════════════ */
#screen-profile {
  align-items: center;
  background-image:
    radial-gradient(ellipse at 10% 20%, rgba(0,212,255,0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(233,69,96,0.08) 0%, transparent 50%);
}

.profile-screen-wrap {
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 20px 16px 60px;
  display: flex; flex-direction: column; gap: 18px;
}

.profile-screen-header { flex-shrink: 0; }

/* ── Carte héros ── */
.prof-hero-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius); padding: 24px;
  display: flex; align-items: flex-start; gap: 20px;
  box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
}
.prof-hero-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--neon-blue), var(--accent), var(--accent3));
}

/* Avatar : photo + badge emoji */
.prof-hero-avatar-wrap { position: relative; flex-shrink: 0; }
.prof-photo {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 3px solid rgba(255,255,255,0.15);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
}
.prof-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.prof-emoji-badge {
  position: absolute; bottom: -4px; right: -4px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-dark); border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; line-height: 1;
}

/* Infos héros */
.prof-hero-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.prof-hero-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prof-hero-name {
  font-size: 1.5rem; font-weight: 900; line-height: 1.1;
  background: linear-gradient(135deg, #fff 30%, var(--neon-blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.prof-hero-rank {
  background: linear-gradient(135deg, var(--accent3), #d97706);
  color: #000; font-weight: 800; font-size: 0.75rem;
  padding: 3px 10px; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(245,166,35,0.3);
}
.prof-hero-bio {
  font-size: 0.88rem; color: var(--text-secondary);
  font-style: italic; line-height: 1.4;
}
.prof-hero-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.prof-provider-badge { }
.prof-since { font-size: 0.72rem; color: var(--text-muted); }

/* ── Sections ── */
.prof-section {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius); padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.prof-section-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-secondary);
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Stat cards ── */
.prof-stat-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 12px;
}
.prof-stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-align: center; transition: border-color var(--transition);
}
.prof-stat-card:hover { border-color: rgba(255,255,255,0.15); }
.prof-stat-accent { border-color: rgba(233,69,96,0.35); background: rgba(233,69,96,0.07); }
.prof-stat-icon  { font-size: 1.2rem; }
.prof-stat-value { font-size: 1.5rem; font-weight: 900; color: var(--text-primary); line-height: 1; }
.prof-stat-label { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Barre winrate */
.prof-winrate-row { display: flex; align-items: center; gap: 10px; }
.prof-winrate-track {
  flex: 1; height: 8px; background: rgba(255,255,255,0.07);
  border-radius: 4px; overflow: hidden;
}
.prof-winrate-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent3));
  border-radius: 4px; transition: width 1.2s ease; min-width: 2px;
}
.prof-winrate-label { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }

/* ── Records ── */
.prof-records-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.prof-record-item {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.prof-record-icon { font-size: 1.4rem; flex-shrink: 0; }
.prof-record-value { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.prof-best-word { font-size: 0.82rem; font-style: italic; color: var(--neon-blue); }
.prof-record-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Achievements ── */
.prof-achiev-count {
  font-size: 0.7rem; font-weight: 700;
  background: rgba(0,212,255,0.15); color: var(--neon-blue);
  padding: 2px 8px; border-radius: 12px;
  text-transform: none; letter-spacing: 0;
}
.prof-achievements-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.prof-achievement {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: all var(--transition); position: relative;
  text-align: center;
}
.prof-achievement.unlocked {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
}
.prof-achievement.unlocked:hover {
  border-color: rgba(0,212,255,0.4);
  background: rgba(0,212,255,0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,212,255,0.15);
}
.prof-achievement.locked {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.04);
  opacity: 0.45;
}
.prof-achievement.locked:hover { opacity: 0.65; }
.prof-ach-icon  { font-size: 1.6rem; }
.prof-ach-label { font-size: 0.62rem; color: var(--text-secondary); line-height: 1.2; font-weight: 600; }

/* Tooltip achievement */
.prof-ach-tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: #1e1e3a; border: 1px solid rgba(0,212,255,0.3);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 0.78rem; line-height: 1.4;
  white-space: nowrap; z-index: 50;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  pointer-events: none;
  animation: fadeIn 0.15s ease;
}

/* ── Historique récent dans profil ── */
.prof-history-list { display: flex; flex-direction: column; gap: 6px; }

/* ── Gestion du compte ── */
.prof-account-section { }
.prof-account-actions { display: flex; flex-direction: column; gap: 8px; }
.prof-account-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08) !important;
  background: rgba(255,255,255,0.04) !important;
  cursor: pointer; transition: all var(--transition);
  text-align: left; width: 100%; color: var(--text-primary);
}
.prof-account-btn > span:first-child { font-size: 1.3rem; flex-shrink: 0; }
.prof-account-btn > div { flex: 1; }
.prof-account-btn > div strong { display: block; font-size: 0.9rem; font-weight: 700; }
.prof-account-btn > div small  { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.prof-account-arrow { font-size: 1.2rem; color: var(--text-muted); flex-shrink: 0; }
.prof-account-btn:hover {
  border-color: rgba(255,255,255,0.2) !important;
  background: rgba(255,255,255,0.08) !important;
}
.prof-danger-btn { }
.prof-danger-btn:hover {
  border-color: rgba(255,7,58,0.4) !important;
  background: rgba(255,7,58,0.08) !important;
}
.prof-danger-btn > div strong { color: #ff6b7a; }

/* Bouton Mon Profil dans le menu */
.btn-menu-card--profile {
  flex-direction: row !important;
  justify-content: flex-start !important;
  padding: 14px 18px !important;
  gap: 12px !important;
  min-height: unset !important;
  background: rgba(0,212,255,0.06) !important;
  border-color: rgba(0,212,255,0.2) !important;
}
.btn-menu-card--profile:hover {
  background: rgba(0,212,255,0.12) !important;
  border-color: rgba(0,212,255,0.45) !important;
}
.btn-menu-card--profile .menu-card-icon { font-size: 1.3rem !important; }
.btn-menu-card--profile strong { font-size: 0.9rem !important; }
.btn-menu-card--profile small  { font-size: 0.74rem !important; }

/* ════════════════════════════════════════════════════════
   MODALES (édition profil + confirmation suppression)
════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none !important; }

.modal-box {
  background: var(--bg-card2);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; gap: 18px;
  animation: slideUp 0.25s ease;
  position: relative;
}
.modal-box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--neon-blue), var(--accent));
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-box--danger::before {
  background: linear-gradient(90deg, var(--neon-red), var(--accent));
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 800; }

/* Aperçu avatar modale */
.modal-avatar-preview {
  display: flex; align-items: center; justify-content: center;
  gap: 0; position: relative; width: 72px; height: 72px; margin: 0 auto;
}
.modal-avatar-photo {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.12);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.modal-avatar-photo img { width: 100%; height: 100%; object-fit: cover; }
.modal-avatar-emoji {
  position: absolute; bottom: -4px; right: -4px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-dark); border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}

/* Grille avatar dans modale */
.modal-avatar-grid { grid-template-columns: repeat(8, 1fr); }

.modal-field { display: flex; flex-direction: column; gap: 8px; }

/* Textarea bio */
.modal-bio-textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary); font-family: var(--font); font-size: 0.95rem;
  padding: 10px 14px; border-radius: var(--radius-sm); outline: none;
  resize: vertical; min-height: 60px; transition: border-color var(--transition);
  line-height: 1.5;
}
.modal-bio-textarea:focus { border-color: var(--neon-blue); box-shadow: 0 0 0 3px rgba(0,212,255,0.1); }
.modal-bio-textarea::placeholder { color: var(--text-muted); }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Modale danger */
.modal-danger-body { display: flex; flex-direction: column; gap: 12px; }
.modal-danger-body p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }
.modal-danger-body ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.modal-danger-body li { font-size: 0.85rem; color: var(--text-secondary); padding-left: 4px; }
.modal-danger-body strong { color: var(--text-primary); }
.modal-delete-input {
  background: rgba(255,7,58,0.07); border: 1px solid rgba(255,7,58,0.3);
  color: var(--text-primary); font-family: var(--font); font-size: 1rem;
  font-weight: 700; padding: 10px 14px; border-radius: var(--radius-sm);
  outline: none; width: 100%; text-align: center; letter-spacing: 2px;
  transition: border-color var(--transition);
}
.modal-delete-input:focus { border-color: var(--neon-red); box-shadow: 0 0 0 3px rgba(255,7,58,0.12); }

/* Bouton danger */
.btn-danger {
  background: linear-gradient(135deg, #ff073a, #c0392b);
  color: #fff; border: none;
  box-shadow: 0 4px 15px rgba(255,7,58,0.35);
}
.btn-danger:not(:disabled):hover { background: linear-gradient(135deg, #ff3355, #e74c3c); }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE — PROFIL & MODALES
════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .prof-hero-card  { flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 18px; }
  .prof-hero-info  { align-items: center; }
  .prof-hero-name-row { justify-content: center; }
  .prof-hero-meta  { justify-content: center; }
  .prof-photo      { width: 68px; height: 68px; }

  .prof-stat-cards { grid-template-columns: repeat(2, 1fr); }
  .prof-stat-value { font-size: 1.3rem; }

  .prof-records-grid { grid-template-columns: 1fr; }

  .prof-achievements-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
  .prof-ach-icon  { font-size: 1.3rem; }
  .prof-ach-tooltip { white-space: normal; min-width: 160px; font-size: 0.72rem; }

  .modal-box { padding: 18px; gap: 14px; }
  .modal-avatar-grid { grid-template-columns: repeat(6, 1fr); }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  .prof-account-btn { padding: 12px 14px; }
}

@media (max-width: 420px) {
  .prof-achievements-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
  .prof-stat-value { font-size: 1.1rem; }
  .prof-hero-name  { font-size: 1.2rem; }
}

/* ════════════════════════════════════════════════════════
   AUTHENTIFICATION
════════════════════════════════════════════════════════ */
.auth-section {
  margin: 4px 0 0;
}

/* --- Invité --- */
.auth-guest { text-align: center; }
.auth-hint {
  font-size: 0.78rem; color: var(--text-muted);
  margin-bottom: 10px;
}
.auth-buttons {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.btn-auth {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.2s; white-space: nowrap;
}
.btn-auth svg { flex-shrink: 0; }
.btn-google {
  background: #fff; color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.btn-google:hover { background: #f0f0f0; transform: translateY(-1px); }
.btn-discord {
  background: #5865F2; color: #fff;
  box-shadow: 0 2px 8px rgba(88,101,242,0.4);
}
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); }

/* --- Connecté --- */
.auth-user {}
.auth-profile-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.auth-avatar-wrap {
  width: 38px; height: 38px; border-radius: 50%;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1); font-size: 1.3rem; flex-shrink: 0;
}
.auth-avatar-wrap img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.auth-info { flex: 1; min-width: 0; }
.auth-display-name {
  font-weight: 700; font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auth-stats-line { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.btn-xs {
  padding: 4px 8px; font-size: 0.75rem;
  background: rgba(255,255,255,0.07); border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer; transition: background 0.2s;
}
.btn-xs:hover { background: rgba(255,255,255,0.15); }

.auth-error {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(233,69,96,0.15); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); font-size: 0.8rem; color: #ff8095;
  white-space: pre-wrap; word-break: break-word;
}

/* ════════════════════════════════════════════════════════
   CLASSEMENT
════════════════════════════════════════════════════════ */

/* Conteneur principal */
.lb-container {
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex; flex-direction: column; gap: 16px;
}

/* ── Stats personnelles ── */
.lb-my-stats {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden;
}
.lb-my-stats::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--neon-blue), var(--accent3));
}

.lb-my-header {
  display: flex; align-items: center; gap: 12px;
}
.lb-my-avatar {
  width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08); font-size: 1.6rem; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.12);
}
.lb-my-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.lb-my-info { flex: 1; min-width: 0; }
.lb-my-name { font-weight: 800; font-size: 1.05rem; margin-bottom: 4px; }
.lb-my-provider { font-size: 0.72rem; color: var(--text-muted); }
.lb-provider-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
}
.lb-provider-google  { background: rgba(66,133,244,0.15); color: #6ea8ff; }
.lb-provider-discord { background: rgba(88,101,242,0.15); color: #a5abff; }

.lb-my-rank-badge {
  background: linear-gradient(135deg, var(--accent3), #d97706);
  color: #000; font-weight: 800; font-size: 0.78rem;
  padding: 5px 12px; border-radius: 20px; white-space: nowrap;
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(245,166,35,0.3);
}

/* Cartes stat */
.lb-stat-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.lb-stat-card {
  background: rgba(255,255,255,0.04); border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; transition: border-color var(--transition);
}
.lb-stat-card:hover { border-color: rgba(255,255,255,0.15); }
.lb-stat-card--accent {
  border-color: rgba(233,69,96,0.35);
  background: rgba(233,69,96,0.07);
}
.lb-stat-icon  { font-size: 1.15rem; line-height: 1; }
.lb-stat-value {
  font-size: 1.45rem; font-weight: 900;
  color: var(--text-primary); line-height: 1;
}
.lb-stat-label {
  font-size: 0.62rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
}

/* Barre winrate */
.lb-winrate-bar-wrap {
  display: flex; align-items: center; gap: 10px;
}
.lb-winrate-bar-track {
  flex: 1; height: 8px; background: rgba(255,255,255,0.07);
  border-radius: 4px; overflow: hidden;
}
.lb-winrate-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  border-radius: 4px; transition: width 1s ease;
  min-width: 2px;
}
.lb-winrate-label {
  font-size: 0.76rem; color: var(--text-secondary);
  white-space: nowrap; flex-shrink: 0;
}

/* Badges séries */
.lb-streak-badges {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.lb-streak-badge {
  font-size: 0.76rem; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  white-space: nowrap;
}
.lb-streak-fire  { background: rgba(233,69,96,0.18); color: #ff6b7a;      border: 1px solid rgba(233,69,96,0.3); }
.lb-streak-gold  { background: rgba(245,166,35,0.18); color: var(--accent3); border: 1px solid rgba(245,166,35,0.3); }
.lb-streak-blue  { background: rgba(0,212,255,0.12);  color: var(--neon-blue); border: 1px solid rgba(0,212,255,0.2); }

/* ── Onglets ── */
.lb-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius); overflow: hidden;
}
.lb-tab {
  flex: 1; padding: 9px 10px;
  background: transparent; border: none;
  color: var(--text-secondary);
  font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.lb-tab:hover:not(.lb-tab--active) { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.lb-tab--active {
  background: rgba(255,255,255,0.11); color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Panels ── */
.lb-panel { }
.lb-panel--hidden { display: none; }

/* ── Liste classement ── */
.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }

.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.lb-row:hover { background: rgba(255,255,255,0.08); transform: translateX(2px); }

/* Podium */
.lb-podium-1 { background: rgba(255,215,0,0.06); border-color: rgba(255,215,0,0.22); }
.lb-podium-2 { background: rgba(192,192,192,0.05); border-color: rgba(192,192,192,0.2); }
.lb-podium-3 { background: rgba(205,127,50,0.06); border-color: rgba(205,127,50,0.2); }

.lb-row.is-me {
  border-color: rgba(0,212,255,0.5);
  background: rgba(0,212,255,0.08);
  box-shadow: 0 0 12px rgba(0,212,255,0.08);
}

.lb-rank {
  font-size: 1.2rem; min-width: 32px; text-align: center; flex-shrink: 0;
}
.lb-rank-num {
  display: inline-block; font-size: 0.85rem; font-weight: 800;
  color: var(--text-muted); min-width: 20px; text-align: center;
}
.lb-avatar {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08); font-size: 1.15rem; flex-shrink: 0;
}
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }

.lb-name-col { flex: 1; min-width: 0; }
.lb-name {
  font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-you-badge {
  font-size: 0.62rem; font-weight: 800; color: var(--neon-blue);
  background: rgba(0,212,255,0.15); border: 1px solid rgba(0,212,255,0.3);
  padding: 1px 6px; border-radius: 10px; flex-shrink: 0;
}
.lb-name-sub {
  font-size: 0.7rem; color: var(--text-muted);
  margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.lb-row-streak {
  font-size: 0.68rem; background: rgba(245,166,35,0.15);
  color: var(--accent3); padding: 1px 5px; border-radius: 8px;
  flex-shrink: 0;
}
/* Mini barre winrate dans chaque ligne */
.lb-winrate-mini-track {
  height: 3px; background: rgba(255,255,255,0.07);
  border-radius: 2px; overflow: hidden; margin-top: 4px;
}
.lb-winrate-mini-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  border-radius: 2px;
}

.lb-stats-col { text-align: right; flex-shrink: 0; }
.lb-wins       { font-size: 1rem; font-weight: 800; color: #ff8095; }
.lb-detail     { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.lb-detail-words { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }

.lb-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* ── Résumé historique ── */
.lb-history-summary {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 2px 0;
}
.lb-history-summary span {
  font-size: 0.76rem; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  color: var(--text-secondary);
}

/* ── Historique ── */
.history-list { display: flex; flex-direction: column; gap: 6px; }

.hist-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  transition: background 0.15s;
}
.hist-row:hover { background: rgba(255,255,255,0.06); }
.hist-row--win  {
  border-color: rgba(57,255,20,0.15);
  background: rgba(57,255,20,0.04);
}
.hist-row--loss {
  border-color: rgba(255,7,58,0.12);
  background: rgba(255,7,58,0.03);
}

.hist-result-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; flex-shrink: 0; width: 48px;
}
.hist-result-icon { font-size: 1.4rem; line-height: 1; }
.hist-result-label {
  font-size: 0.58rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.hist-label--win  { color: var(--neon-green); }
.hist-label--loss { color: var(--neon-red); opacity: 0.7; }

.hist-info { flex: 1; min-width: 0; }
.hist-date-line  {
  font-size: 0.78rem; color: var(--text-muted);
  margin-bottom: 4px;
  cursor: default;
}
.hist-stats-line {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.hist-stat {
  font-size: 0.78rem; color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  padding: 2px 7px; border-radius: 8px;
}

/* Bouton "Charger plus" */
.lb-load-more-wrap { display: flex; justify-content: center; padding: 8px 0 4px; }
.lb-load-more      { font-size: 0.82rem; opacity: 0.8; }
.lb-load-more:hover { opacity: 1; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .lb-stat-cards { grid-template-columns: repeat(2, 1fr); }
  .lb-stat-value { font-size: 1.2rem; }
  .lb-stats-col  { display: none; }   /* masquer stats col sur très petits écrans */
  .lb-row { padding: 10px 10px; gap: 8px; }
  .lb-my-stats { padding: 16px 14px; }
  .hist-stat   { font-size: 0.72rem; padding: 2px 6px; }
}
@media (max-width: 360px) {
  .lb-streak-badges { gap: 6px; }
  .lb-streak-badge  { font-size: 0.7rem; padding: 3px 8px; }
}


