/* ═══════════════════════════════════════════════
   NOUVELLES FONCTIONNALITÉS
   ═══════════════════════════════════════════════ */

/* ── MODE SOMBRE / CLAIR */
body.light-mode {
  --bg: #f0f0f8;
  --card: #ffffff;
  --card2: #e8e8f0;
  --text: #1a1a2e;
  --muted: #666688;
  --border: rgba(0,0,0,0.1);
}
body.light-mode .hdr { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.1); }
body.light-mode .nav { background: rgba(255,255,255,0.95); }
body.light-mode .auth-card, body.light-mode .quiz-card { background: #fff; }

/* ── THÈME TOGGLE */
.theme-toggle {
  display: flex; align-items: center; gap: 10px;
  background: var(--card2); border-radius: 20px; padding: 6px 14px;
  cursor: pointer; font-size: 0.85rem; font-weight: 700; color: var(--text);
  border: 1px solid var(--border); transition: all 0.3s;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ── SÉLECTEUR DE LANGUE */
.lang-selector {
  position: relative; display: inline-block;
}
.lang-btn {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 14px; cursor: pointer;
  font-size: 0.85rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.lang-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px; z-index: 1000;
  display: none; min-width: 150px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.lang-dropdown.show { display: block; }
.lang-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; transition: background 0.2s;
}
.lang-option:hover { background: var(--card2); }
.lang-option.active { color: var(--accent); }

/* ── PARAMÈTRES */
.settings-panel { padding: 16px 0; }
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: var(--card); border-radius: 12px;
  margin-bottom: 10px; border: 1px solid var(--border);
}
.setting-label { font-weight: 700; font-size: 0.9rem; }
.setting-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.toggle-btn {
  background: var(--card2); border: 2px solid var(--border);
  border-radius: 20px; padding: 6px 16px; cursor: pointer;
  font-weight: 800; font-size: 0.8rem; transition: all 0.3s;
}
.toggle-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── TITRES */
.titles-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 4px 0;
}
.title-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; text-align: center;
  cursor: pointer; transition: all 0.2s; position: relative;
}
.title-card.unlocked:hover { border-color: var(--accent); transform: translateY(-2px); }
.title-card.active { border-color: var(--accent); background: rgba(224,64,251,0.1); }
.title-card.locked { opacity: 0.5; cursor: not-allowed; }
.title-icon { font-size: 1.6rem; margin-bottom: 4px; }
.title-name { font-size: 0.75rem; font-weight: 700; line-height: 1.3; }
.title-lock { font-size: 0.7rem; color: var(--accent); margin-top: 4px; }
.title-active-badge {
  position: absolute; top: 6px; right: 6px;
  background: var(--accent); color: #fff;
  font-size: 0.6rem; font-weight: 800; padding: 2px 6px; border-radius: 10px;
}
.prem-tag {
  display: inline-block; font-size: 0.65rem; margin-left: 3px;
  vertical-align: middle;
}

/* ── HISTORIQUE */
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 8px;
}
.hi-left { display: flex; align-items: center; gap: 12px; }
.hi-mode { font-size: 1.4rem; }
.hi-theme { font-weight: 700; font-size: 0.9rem; }
.hi-date { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.hi-right { text-align: right; }
.hi-score { font-weight: 800; font-size: 1rem; }
.hi-pct { font-size: 0.75rem; }

/* ── CARTE DE JOUEUR */
.player-card-wrap { text-align: center; padding: 10px 0; }
#player-card-canvas { border-radius: 16px; max-width: 100%; box-shadow: 0 10px 40px rgba(224,64,251,0.3); }
.card-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.card-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; cursor: pointer;
  font-weight: 700; font-size: 0.85rem; transition: all 0.2s;
}
.card-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── SAISON */
.season-header {
  background: linear-gradient(135deg, rgba(224,64,251,0.15), rgba(255,107,53,0.15));
  border: 1px solid rgba(224,64,251,0.3); border-radius: 16px;
  padding: 20px; text-align: center; margin-bottom: 16px;
}
.season-name { font-family: 'Bangers', cursive; font-size: 1.5rem; letter-spacing: 3px; color: var(--accent); }
.season-timer { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.season-myrank { font-weight: 800; color: var(--gold); margin-top: 8px; }
.season-rewards { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.sr-title { font-weight: 800; font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.reward-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.reward-row:last-child { border-bottom: none; }
.reward-xp { color: var(--gold); font-weight: 800; }
.season-board { background: var(--card); border-radius: 12px; padding: 14px; }
.sb-title { font-weight: 800; font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.season-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; font-size: 0.85rem; }
.season-row.mine { background: rgba(224,64,251,0.1); }
.sr-rank { width: 36px; font-weight: 800; }
.sr-avatar { font-size: 1.1rem; }
.sr-pseudo { flex: 1; font-weight: 700; }
.sr-score { font-weight: 800; color: var(--gold); }

/* ── MODE RAPIDITÉ */
#s-rapid {
  min-height: 100vh; padding: 16px;
  background: var(--bg);
}
.rapid-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding: 12px 16px;
  background: var(--card); border-radius: 14px;
}
.rapid-q { font-weight: 800; font-size: 1.1rem; text-align: center; padding: 20px; margin-bottom: 16px; }
.rapid-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rapid-btn {
  background: var(--card); border: 2px solid var(--border);
  border-radius: 12px; padding: 16px 10px; cursor: pointer;
  font-weight: 700; font-size: 0.9rem; text-align: center;
  transition: all 0.15s; color: var(--text);
}
.rapid-btn:hover { border-color: var(--accent); transform: scale(1.02); }
.rapid-btn.correct { background: rgba(76,175,80,0.2); border-color: #4CAF50; color: #4CAF50; }
.rapid-btn.wrong { background: rgba(244,67,54,0.2); border-color: #f44336; color: #f44336; }

/* ── DUEL */
#s-duel-lobby, #s-duel-game {
  min-height: 100vh; padding: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.duel-vs { display: flex; align-items: center; gap: 20px; margin: 20px 0; }
.duel-player { text-align: center; }
.duel-avatar { font-size: 3rem; }
.duel-pseudo { font-weight: 800; font-size: 1rem; margin-top: 4px; }
.vs-badge {
  font-family: 'Bangers', cursive; font-size: 2rem;
  color: var(--accent); letter-spacing: 3px;
}
.room-code-display {
  font-family: 'Bangers', cursive; font-size: 2rem; letter-spacing: 6px;
  color: var(--accent); background: var(--card);
  border: 2px solid var(--accent); border-radius: 12px;
  padding: 10px 24px; margin: 10px 0;
}
.duel-scores { display: flex; gap: 30px; margin-bottom: 16px; }
.duel-score-box { text-align: center; }
.duel-score-num { font-family: 'Bangers', cursive; font-size: 2.5rem; color: var(--accent); }

/* ── PARTAGE RÉSULTATS */
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.share-btn {
  border: none; border-radius: 20px; padding: 8px 16px;
  font-weight: 800; font-size: 0.8rem; cursor: pointer; transition: all 0.2s;
}
.share-btn:hover { transform: translateY(-2px); }
.share-ig { background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045); color: #fff; }
.share-tw { background: #000; color: #fff; }
.share-tt { background: #010101; color: #fff; border: 1px solid #69C9D0; }
.share-wa { background: #25D366; color: #fff; }

/* ── PREMIUM GATE */
.premium-gate {
  text-align: center; padding: 40px 20px;
  background: var(--card); border-radius: 20px;
  border: 1px solid rgba(224,64,251,0.2);
}
.pg-title { font-family: 'Bangers', cursive; font-size: 1.8rem; letter-spacing: 3px; color: var(--accent); margin: 10px 0; }
.pg-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; line-height: 1.6; }

/* ── TOURNOI */
.bracket-coming { text-align: center; padding: 30px; }
.room-code-display { margin: 20px auto; display: inline-block; }

/* ── MODE CARDS PREMIUM */
.mode-card.premium-mode {
  border-color: rgba(255,217,61,0.3);
}
.mode-card.premium-mode:hover {
  border-color: #ffd93d;
  box-shadow: 0 0 20px rgba(255,217,61,0.15);
}

/* ── THEME NAMES MAP */
.empty-state {
  text-align: center; padding: 30px;
  color: var(--muted); font-size: 0.9rem;
}

/* ── LIGHT MODE — COMPLET */
body.light-mode {
  --bg: #f4f4fb;
  --card: #ffffff;
  --card2: #ebebf5;
  --border: rgba(100,100,180,0.15);
  --text: #1a1a2e;
  --muted: #7070a0;
}
body.light-mode::before { opacity: 0.3; }
body.light-mode::after { opacity: 0.15; }
body.light-mode .mode-card { background: #fff; border-color: rgba(100,100,180,0.15); color: #1a1a2e; }
body.light-mode .mode-card:hover, body.light-mode .mode-card.sel { background: rgba(224,64,251,0.07); }
body.light-mode .mc-desc { color: #7070a0; }
body.light-mode .th-btn { background: #f0f0fa; border-color: rgba(100,100,180,0.15); color: #1a1a2e; }
body.light-mode .th-btn.sel { background: rgba(224,64,251,0.12); }
body.light-mode .ans { background: #f0f0fa; border-color: rgba(100,100,180,0.15); color: #1a1a2e; }
body.light-mode .qcard { background: #fff; border-color: rgba(100,100,180,0.15); }
body.light-mode .nav { background: rgba(255,255,255,0.97); }
body.light-mode .hdr { background: rgba(255,255,255,0.97); }
body.light-mode .card { background: #fff; border-color: rgba(100,100,180,0.15); }
body.light-mode .pill { background: #ebebf5; border-color: rgba(100,100,180,0.15); color: #1a1a2e; }
body.light-mode .auth-card { background: #fff; }
body.light-mode .auth-input { background: #f0f0fa; border-color: rgba(100,100,180,0.2); color: #1a1a2e; }
body.light-mode #s-loading { background: #f4f4fb; }
body.light-mode .load-title { color: #e040fb; }
body.light-mode .history-item, body.light-mode .title-card, body.light-mode .setting-row { background: #fff; border-color: rgba(100,100,180,0.15); }
body.light-mode .rapid-btn { background: #f0f0fa; border-color: rgba(100,100,180,0.15); color: #1a1a2e; }

/* ── LOADING SCREEN AMELIORE */
#s-loading {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}
.load-title {
  font-family: 'Bangers', cursive;
  font-size: 2.5rem;
  letter-spacing: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent2), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.spin {
  font-size: 3rem;
  display: inline-block;
  animation: spin 0.6s linear infinite;
  margin-bottom: 16px;
}
.load-sub {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  min-height: 48px;
  max-width: 300px;
  line-height: 1.5;
  margin-bottom: 24px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.anecdote-text { color: var(--accent); }
.load-bar-w {
  width: 100%;
  max-width: 300px;
  background: var(--card2);
  border-radius: 20px;
  height: 10px;
  overflow: hidden;
  margin-top: 8px;
}
.load-bar {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--gold));
  width: 2%;
  transition: width 0.5s ease;
}

/* ── ANECDOTE TEXTE (chargement) */
.anecdote-text {
  color: var(--accent);
  font-style: italic;
}

/* ── MODE CARD GRID - 2 colonnes sur mobile */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

/* ── SOCIAL - add-friend-row */
.add-friend-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.add-friend-input {
  flex: 1;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}
.btn-add-friend {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
