:root {
  --bg-dark: #090910;
  --primary: #8e44ad;
  --accent: #ff007f;
  --accent-blue: #00d2ff;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --text-muted: #8f9ba8;
  --success: #2ecc71;
  --error: #ff007f;
  --bg-dark: #090910;
  --gold-gradient: linear-gradient(135deg, #f1c40f, #f39c12);

  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Hauteur de sécurité pour mobile */
  --vh: 100vh;
}

/* --- RESET & GLOBAL --- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  /* Enlève le flash gris sur mobile */
}

/* --- FIX 1 : GLOBAL & IPHONE --- */
html {
  background-color: var(--bg-dark);
  /* Remplit tout l'écran */
  height: 100%;
  overflow: hidden;
  /* Bloque le rebond élastique de la page */
}

body {
  background-color: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-body);
  margin: 0;
  padding: 0;

  /* Force la hauteur exacte de l'écran mobile */
  width: 100%;
  height: 100%;
  height: 100dvh;

  /* Gère les encoches (Notch) de l'iPhone */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);

  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* FOND ANIMÉ */
.background-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s infinite alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: var(--primary);
  animation-duration: 25s;
}

.blob-2 {
  bottom: -10%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: var(--accent);
  animation-duration: 30s;
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 40%;
  width: 300px;
  height: 300px;
  background: var(--accent-blue);
  animation-duration: 35s;
  animation-delay: -10s;
  opacity: 0.2;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(30px, 50px) scale(1.1);
  }
}

/* --- HEADER --- */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Padding fluide : minimum 5px, idéal 1vh, max 20px */
  padding: clamp(5px, 1vh, 20px) 20px 0 20px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 100;
}

.logo-area {
  font-family: var(--font-heading);
  /* Taille de police fluide : s'adapte entre 1.4rem et 2rem selon la largeur */
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fff 30%, #a29bfe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(142, 68, 173, 0.4));
  animation: glow 4s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    filter: drop-shadow(0 0 10px rgba(142, 68, 173, 0.2));
  }

  to {
    filter: drop-shadow(0 0 20px rgba(142, 68, 173, 0.6));
  }
}

/* MENU DÉROULANT */
.custom-dropdown {
  position: relative;
  width: min(100%, 280px);
  /* Ne dépasse jamais 280px mais s'adapte en dessous */
  font-family: var(--font-body);
  z-index: 500;
  margin-bottom: 5px;
}

.dropdown-selected {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 10px 15px;
  color: white;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-selected:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 210, 255, 0.2);
}

.arrow {
  font-size: 0.8rem;
  color: var(--accent-blue);
  transition: transform 0.4s;
  margin-left: 10px;
}

.custom-dropdown.open .arrow {
  transform: rotate(180deg);
}

.dropdown-options {
  position: absolute;
  top: 120%;
  left: 0;
  width: 100%;
  background: #12121a;
  border: 1px solid var(--accent-blue);
  border-radius: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  padding: 5px;
  box-sizing: border-box;
}

.custom-dropdown.open .dropdown-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.option {
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.2s;
  color: var(--text-muted);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.option.active {
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-blue);
  box-shadow: inset 4px 0 0 var(--accent-blue);
}

/* CONTROLES HEADER */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#score-board {
  display: flex;
  gap: 8px;
}

.stat-pill {
  background: rgba(20, 20, 30, 0.6);
  border: 1px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

/* --- MAIN (LAYOUT PRINCIPAL) --- */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  /* Empêche le débordement global */
}

/* CARTE EN VERRE (Responsive + Scroll interne) */
.glass-panel {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);

  width: min(100%, 600px);
  /* Max 600px, sinon 100% */
  max-height: 100%;
  /* Ne dépasse jamais l'écran */

  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(15px, 3vh, 30px);

  overflow-y: auto;
  /* IMPORTANT : Scroll si le contenu (clavier) dépasse */
  scrollbar-width: none;
  position: relative;
}

.glass-panel::-webkit-scrollbar {
  display: none;
}

h2 {
  font-family: var(--font-heading);
  text-align: center;
  margin-top: 0;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  margin-bottom: 10px;
  background: linear-gradient(to right, #fff, #ccc);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ZONES DE JEU */
.indices-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 16px;
  margin: 10px 0;
  border: 1px solid var(--glass-border);
  min-height: 80px;
  /* Réduit pour les petits écrans */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.game-image-container {
  width: 100%;
  height: clamp(150px, 30vh, 250px);
  /* Hauteur fluide */
  overflow: hidden;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.game-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.5s ease;
}

.indice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: clamp(0.8rem, 2.5vw, 0.95rem);
  /* Texte fluide */
  line-height: 1.3;
  animation: slideIn 0.5s ease backwards;
}

.indice-item strong {
  color: var(--accent-blue);
  white-space: nowrap;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* INPUTS & BOUTONS */
.input-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  margin-top: auto;
}

.input-wrapper {
  display: flex;
  gap: 8px;
  position: relative;
}

input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  padding: 12px 15px;
  border-radius: 14px;
  color: white;
  font-family: var(--font-body);
  font-size: 16px;
  /* IMPÉRATIF : 16px min pour éviter le zoom auto sur iOS */
  outline: none;
  transition: all 0.3s;
  min-width: 0;
  /* Empêche l'input de casser le flex */
}

input:focus {
  background: rgba(0, 0, 0, 0.5);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(142, 68, 173, 0.3);
}

button {
  border: none;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  transition: all 0.3s;
  -webkit-tap-highlight-color: transparent;
}

.btn-glow {
  background: linear-gradient(135deg, var(--primary), #a29bfe);
  color: white;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 0.95rem;
  box-shadow: 0 5px 15px rgba(142, 68, 173, 0.3);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(142, 68, 173, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.btn-icon.active {
  color: var(--error);
  background: rgba(255, 0, 127, 0.1);
}

/* SUGGESTIONS */
.suggestions-list-embedded {
  width: 100%;
  background: transparent;
  max-height: 140px;
  overflow-y: auto;
  display: none;
  margin-top: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-blue) rgba(255, 255, 255, 0.1);
}

.suggestions-list-embedded:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.suggestion-item {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  color: white;
  text-align: left;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

.suggestion-item:hover {
  background: var(--primary);
  transform: translateX(5px);
}

/* --- ACCUEIL (HOME) --- */
.view-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: fadeInView 0.5s ease;
  overflow: hidden;
}

@keyframes fadeInView {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.home-panel {
  align-items: center;
  text-align: center;
  max-width: 900px;
  width: 100%;
  height: 100%;
  /* Prend toute la hauteur disponible */

  /* IMPORTANT : On remplace 'margin: auto' par 'margin: 0 auto' */
  margin: 0 auto;

  /* On ajoute beaucoup d'espace en haut pour la barre d'outils et le titre */
  padding: 20px;
  padding-top: 100px;
  padding-bottom: 40px;

  /* Scroll fluide */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.home-title {
  /* Doit correspondre visuellement au logo d'intro */
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin: 0 0 5px 0;
  background: linear-gradient(135deg, #fff 30%, #a29bfe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Transition pour l'apparition douce à la fin */
  transition: opacity 0.3s;
}

/* Classe utilitaire pour cacher le vrai titre pendant l'intro */
.invisible {
  opacity: 0;
}

.home-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: var(--text-muted);
  margin-bottom: 30px;
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  /* Grille intelligente */
  gap: 15px;
  width: 100%;
  justify-items: center;
  padding-bottom: 20px;
}

.mode-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 300px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.mode-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  transform: translateY(-5px);
}

.mode-icon {
  font-size: 2.5rem;
  margin-bottom: 5px;
}

.mode-card h3 {
  margin: 0;
  color: white;
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

.mode-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 15px;
  flex-grow: 1;
}

.btn-glow.small {
  width: 100%;
  padding: 8px;
  font-size: 0.9rem;
}

.daily-card {
  border-color: var(--success);
  background: linear-gradient(145deg, rgba(46, 204, 113, 0.1), rgba(0, 0, 0, 0));
}

.btn-gold {
  background: var(--gold-gradient);
  box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

/* TOAST & MODAL */
#toast-container {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  width: 90%;
  max-width: 350px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(20, 20, 30, 0.95);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-left: 4px solid white;
  color: white;
  animation: slideDown 0.4s;
  pointer-events: auto;
  font-size: 0.9rem;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--error);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(15px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  background: #151520;
  padding: 30px;
  border-radius: 30px;
  text-align: center;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--glass-border);
  animation: zoomIn 0.5s;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-poster img {
  max-width: 100%;
  max-height: 35vh;
  border-radius: 12px;
  transform: rotate(-2deg);
  margin: 15px 0;
}

footer {
  text-align: center;
  padding: 10px;
  font-size: 0.75rem;
  opacity: 0.5;
  flex-shrink: 0;
}

/* SKELETON */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: loadingPulse 1.5s infinite;
  border-radius: 8px;
  margin-bottom: 8px;
}

@keyframes loadingPulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 16px;
  width: 100%;
}

.skeleton-image {
  width: 100%;
  height: 180px;
  border-radius: 12px;
}

/* --- QUERIES POUR APPAREILS RARES --- */

/* 1. ÉCRANS TRÈS ÉTROITS (Galaxy Fold fermé, vieux iPhone 5/SE) */
@media (max-width: 380px) {
  .home-title {
    font-size: 2rem;
  }

  .logo-area {
    font-size: 1.4rem;
  }

  .glass-panel {
    padding: 15px;
  }

  .btn-glow,
  input {
    font-size: 0.85rem;
    padding: 10px;
  }

  .mode-card {
    padding: 15px;
  }

  .mode-icon {
    font-size: 2rem;
  }
}

/* 2. MODE PAYSAGE SUR MOBILE (Hauteur faible, clavier ouvert) */
@media (max-height: 500px) and (orientation: landscape) {
  header {
    flex-direction: row;
    gap: 20px;
    padding: 5px 20px;
  }

  /* Header horizontal */
  .logo-area {
    font-size: 1.2rem;
  }

  #score-board,
  .custom-dropdown,
  #btn-sound {
    transform: scale(0.9);
  }

  .glass-panel {
    padding: 10px;
    justify-content: flex-start;
  }

  h2 {
    display: none;
  }

  /* On cache le titre du jeu pour gagner de la place */
  .game-image-container {
    height: 120px;
    width: 200px;
    margin: 0 auto;
  }

  /* Image petite */
  .indices-box {
    padding: 5px;
    min-height: auto;
  }

  .indice-item {
    margin-bottom: 4px;
    font-size: 0.8rem;
  }

  .background-blobs {
    display: none;
  }

  /* Optimisation perfs */
}

/* --- NOUVEAU STYLES V2 --- */

/* Bouton Paramètres (flottant en haut à droite de l'accueil) */
.settings-trigger {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Carte Time Attack */
.time-card {
  border-color: #00d2ff;
  background: linear-gradient(145deg, rgba(0, 210, 255, 0.1), rgba(0, 0, 0, 0));
}

.btn-time {
  background: linear-gradient(135deg, #00d2ff, #2980b9);
  box-shadow: 0 5px 15px rgba(41, 128, 185, 0.4);
}

/* Timer Badge (En jeu) */
.timer-badge {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  background: rgba(255, 0, 0, 0.2);
  border: 2px solid #e74c3c;
  padding: 5px 15px;
  border-radius: 50px;
  animation: pulseTimer 1s infinite alternate;
}

@keyframes pulseTimer {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.05);
  }
}

/* Inputs Paramètres */
.settings-group {
  margin-bottom: 20px;
  text-align: left;
}

.settings-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.glass-select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: #090910;
  color: white;
  border: 1px solid var(--glass-border);
  font-size: 1rem;
  outline: none;
}

/* Header Ajustement */
.header-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: 100%;
}

/* --- PROFIL & STATS --- */
.profile-content {
  text-align: left;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-circle {
  width: 60px;
  height: 60px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  box-shadow: 0 0 20px rgba(142, 68, 173, 0.4);
}

/* Barre d'XP */
.xp-container {
  width: 200px;
  margin-top: 5px;
}

.xp-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 5px;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f1c40f, #2ecc71);
  width: 0%;
  transition: width 0.5s ease;
}

/* Grille de Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Responsive Profil */
@media (max-width: 400px) {
  .xp-container {
    width: 100%;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-header div {
    width: 100%;
  }

  #profile-rank {
    text-align: center !important;
  }
}

/* La barre des boutons (Profil / Paramètres) */
.home-toolbar {
  position: absolute;
  top: env(safe-area-inset-top);
  left: 0;
  width: 100%;
  padding: 15px 20px 0 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  z-index: 500;
  pointer-events: none;
}

.home-toolbar button {
  pointer-events: auto;
}

.btn-icon-glass {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(5px);
}

.btn-icon-glass:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--accent-blue);
}

/* --- FIX : ÉCRAN DE CHARGEMENT --- */
#intro-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;

  /* État initial : visible */
  opacity: 1;
  visibility: visible;
  transition: opacity 1s ease-out, visibility 1s;
}

/* État final : invisible */
#intro-splash.fade-out {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  /* Permet de cliquer à travers si ça bug */
}

#intro-logo {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 5rem);
  margin: 0;
  background: linear-gradient(135deg, #fff 30%, #a29bfe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(142, 68, 173, 0.7));
}

/* Réactive le clic sur les boutons */

/* Style des boutons ronds */
.btn-icon-glass {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(5px);
}

.btn-icon-glass:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--accent-blue);
}

.btn-icon-glass svg {
  pointer-events: none;
  /* Le clic traverse l'icône */
}

/* Correction Mobile : On s'assure que le titre a de la place */
@media (max-width: 600px) {
  .home-toolbar {
    padding: 10px 15px 5px 15px;
  }

  /* On enlève l'ancien positionnement absolute s'il traîne encore */
  .settings-trigger {
    position: static !important;
  }
}

/* L'ÉCRAN DE CHARGEMENT */
#intro-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  /* Fond opaque au début */
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Transition sur le fond pour révéler le site en dessous */
  transition: background-color 0.8s ease-in-out, visibility 0s linear 2s;
}

/* Étape 1 : Le fond devient transparent */
#intro-splash.transparent-bg {
  background-color: transparent;
  pointer-events: none;
}

/* Étape 2 : Le logo bouge vers le haut */
#intro-logo {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 5rem);
  margin: 0;
  /* Même dégradé que le titre final */
  background: linear-gradient(135deg, #fff 30%, #a29bfe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(142, 68, 173, 0.7));
  transform-origin: center center;
  will-change: transform;
}

#intro-logo.animate-move {
  /* Animation de 1 seconde vers le haut */
  animation: moveLogoToHeader 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Ajustement précis de la position finale */
@keyframes moveLogoToHeader {
  0% {
    transform: scale(1) translateY(0);
  }

  100% {
    /* On réduit la taille et on remonte vers l'emplacement du titre */
    transform: scale(0.6) translateY(-38vh);
    opacity: 0;
    /* Disparaît doucement à la toute fin */
  }
}

/* Classe pour cacher le vrai titre au début */
.invisible {
  opacity: 0;
  transition: opacity 0.5s;
}

/* Ajustez ces valeurs si le logo ne tombe pas pile poil */
@keyframes moveLogoToHeader {
  0% {
    transform: scale(1) translateY(0);
  }

  100% {
    /* On réduit la taille (0.6) et on remonte (-35vh est une bonne moyenne mobile) */
    transform: scale(0.6) translateY(-38vh);
    opacity: 0;
    /* Disparait à la toute fin pour laisser place au vrai titre */
  }
}

@keyframes moveLogoToTop {
  0% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }

  80% {
    opacity: 1;
  }

  100% {
    transform: scale(0.5) translateY(-40vh);
    opacity: 0;
  }
}