h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3rem;
  text-align: center;
  color: white;
  letter-spacing: 2px;
}

body {
  position: relative;
  font-family: 'Segoe UI', sans-serif;
  background-image: none;
  color: white;
  min-height: 100vh;
  margin: 0;
  padding-top: 0;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Fond PC adapté avec filtre sombre intégré */
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

/* ✅ Cartes */
.unit-card {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 12px;
  background: radial-gradient(circle at top left, #2b2b2b, #111);
  border: 3px solid #d4af3700;
  box-shadow:
    0 0 10px rgba(255, 215, 0, 0.6),
    inset 0 0 6px rgba(255, 240, 150, 0.5);
  overflow: hidden;
  transition: all 0.25s ease-in-out;
  text-align: center;
  padding: 3px;
}

.unit-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.unit-card:hover {
  transform: scale(1.07);
  box-shadow:
    0 0 5px rgba(255, 223, 0, 0.8),
    inset 0 0 10px rgba(255, 255, 200, 0.6);
}

.unit-card.selected {
  border: 3px solid #FFD700;
  box-shadow:
    0 0 5px #FFD700,
    inset 0 0 10px rgba(255, 255, 255, 0.6);
  background: linear-gradient(135deg, #3b2f05, #1a1200);
  transform: scale(1.06);
}

.unit-card.ft {
  border: 4px solid transparent; /* On rend la bordure transparente pour laisser voir le dégradé */
  background: 
    linear-gradient(135deg, #3b0f53, #190025) padding-box, /* Fond interne de la carte */
    linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff) border-box; /* Bordure arc-en-ciel */
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
  transform: scale(1.06);
}

/* Super Rainbow (SFT) - Rotation sens horaire */
.unit-card.sft {
  position: relative;
  border: none; /* On enlève la bordure classique */
  background: linear-gradient(135deg, #4d0a2a, #1a000a);
  transform: scale(1.08);
  z-index: 10;
  overflow: hidden; /* Pour couper ce qui dépasse */
}

/* Le pseudo-élément qui crée la bordure tournante */
.unit-card.sft::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000
  );
  animation: rotateRainbow 3s linear infinite;
  z-index: -2;
}

/* Le cache interne pour recréer l'intérieur de la carte */
.unit-card.sft::after {
  content: "";
  position: absolute;
  inset: 4px; /* L'épaisseur de ta bordure */
  background: inherit; /* Reprend le dégradé sombre du parent */
  border-radius: 8px;
  z-index: -1;
}

/* L'animation de rotation à 360° */
@keyframes rotateRainbow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* On booste le glow autour */
.unit-card.sft {
  box-shadow: 0 0 20px rgba(219, 39, 119, 0.8);
}
.spe-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background-color: #000000;
  color: #ffffff;
  font-weight: bold;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  border: 2px solid #fff;
}

.stats-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  height: 22px;
  background-color: #1f2937;
  color: #ffffff;
  font-weight: bold;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  border: 2px solid #fff;
  padding: 0 4px;
  z-index: 10;
}

.level-badge {
  position: absolute;
  bottom: 4px;
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000;
  pointer-events: none;
  z-index: 10;
}

#unit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  justify-items: center;
}

/* ✅ Boutons de mode */
.mode-button {
  background-color: #4b5563;
  color: white;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-manager.active {
  background-color: #059669 !important; /* Emerald Green (Nouveau) */
  border-color: #34d399;
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.5);
  transform: translateY(-2px);
}

.btn-simple.active {
  background-color: #2563eb !important; /* Blue (Ex-Manager) */
  border-color: #60a5fa;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
  transform: translateY(-2px);
}

/* ✅ Gestion du Hover uniquement sur PC pour éviter que la couleur reste sur mobile */
@media (hover: hover) {
  .btn-manager:hover {
    background-color: #059669 !important;
    border-color: #34d399;
    box-shadow: 0 0 10px rgba(5, 150, 105, 0.5);
    transform: translateY(-2px);
  }
  .btn-simple:hover {
    background-color: #2563eb !important;
    border-color: #60a5fa;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
    transform: translateY(-2px);
  }
  .btn-rainbow:hover {
    background-color: #7e22ce !important;
    border-color: #a855f7;
    box-shadow: 0 0 10px rgba(126, 34, 206, 0.5);
    transform: translateY(-2px);
  }
  .btn-srainbow:hover {
    background-color: #db2777 !important;
    border-color: #f472b6;
    box-shadow: 0 0 10px rgba(219, 39, 119, 0.5);
    transform: translateY(-2px);
  }
  .btn-llb:hover {
    background-color: #eab308 !important;
    border-color: #fde047;
    color: #000 !important;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
    transform: translateY(-2px);
  }
}

/* ✅ Reset focus pour éviter que la couleur reste sur mobile après clic */
.mode-button:not(.active):focus {
  background-color: #4b5563 !important;
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.mode-button.active {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* ✅ Filtres Possédé (Extérieurs) */
.filter-owned-button {
  background-color: #1f2937;
  color: white;
  transition: background-color 0.2s, transform 0.2s;
}
.filter-owned-button.all:hover, .filter-owned-button.active.all { background-color: #2563eb !important; }
.filter-owned-button.owned:hover, .filter-owned-button.active.owned { background-color: #16a34a !important; }
.filter-owned-button.not-owned:hover, .filter-owned-button.active.not-owned { background-color: #dc2626 !important; }
.filter-owned-button.active { font-weight: bold; transform: scale(1.02); }

.filter-owned-button:focus,
.filter-attribute-button:focus,
#dropdownFilterMenu button:focus,
#dropdownAttributeMenu button:focus {
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* ✅ Unit cards : désaturées si non possédées */
.unit-card:not(.selected) {
  filter: brightness(0.4) grayscale(60%);
  opacity: 0.7;
  transition: filter 0.2s, opacity 0.2s;
}
.unit-card.selected { filter: none; opacity: 1; }

/* ✅ Barre de progression */
#progressBar {
  height: 100%;
  border-radius: 0; /* Pas d'arrondi pour une connexion fluide avec Luffy */
  transition: width 0.8s ease-in-out;
  /* ⚫ Bras Haki (Busoshoku) : Noir métallique */
  background: linear-gradient(to bottom, #4b5563 0%, #000000 45%, #000000 100%);
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.3), inset 0 -1px 3px rgba(0,0,0,0.5);
}

/* ✅ Dropdowns */
#dropdownFilterBtn, #dropdownAttributeBtn { background-color: #4b5563; color: white; }
#dropdownFilterMenu, #dropdownAttributeMenu {
  background-color: #1f2937;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}
#dropdownFilterMenu button, #dropdownAttributeMenu button {
  background-color: #1f2937;
  text-align: left;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  color: white;
  border: none;
  border-left: 4px solid transparent;
  transition: all 0.2s ease-in-out;
}

/* ✅ COULEURS FILTRES (Survol et Actif) */
#dropdownFilterMenu button:nth-of-type(1):hover, 
#dropdownFilterMenu button.active:nth-of-type(1) { background-color: #2563eb !important; border-left-color: #60a5fa; }
#dropdownFilterMenu button:nth-of-type(2):hover, 
#dropdownFilterMenu button.active:nth-of-type(2) { background-color: #16a34a !important; border-left-color: #4ade80; }
#dropdownFilterMenu button:nth-of-type(3):hover, 
#dropdownFilterMenu button.active:nth-of-type(3) { background-color: #dc2626 !important; border-left-color: #f87171; }

/* ✅ COULEURS AFFINITÉS (Survol et Actif) */
#dropdownAttributeMenu button[data-attribute="STR"]:hover,
#dropdownAttributeMenu button.active[data-attribute="STR"] { background-color: #dc2626 !important; border-left-color: #f87171; }
#dropdownAttributeMenu button[data-attribute="QCK"]:hover,
#dropdownAttributeMenu button.active[data-attribute="QCK"] { background-color: #2563eb !important; border-left-color: #60a5fa; }
#dropdownAttributeMenu button[data-attribute="DEX"]:hover,
#dropdownAttributeMenu button.active[data-attribute="DEX"] { background-color: #16a34a !important; border-left-color: #4ade80; }
#dropdownAttributeMenu button[data-attribute="PSY"]:hover,
#dropdownAttributeMenu button.active[data-attribute="PSY"] { background-color: #ea580c !important; border-left-color: #fb923c; }
#dropdownAttributeMenu button[data-attribute="INT"]:hover,
#dropdownAttributeMenu button.active[data-attribute="INT"] { background-color: #9333ea !important; border-left-color: #c084fc; }

/* Correction spécifique pour "Toutes" */
#dropdownAttributeMenu button[data-attribute="ALL"]:hover,
#dropdownAttributeMenu button[data-attribute="all"]:hover { 
  background-color: #4b5563 !important; 
  border-left-color: #9ca3af !important;
  transform: translateX(4px);
}

/* On s'assure que la classe active prend bien le dessus sur le fond par défaut */
#dropdownAttributeMenu button.active {
  border-left-width: 4px;
  filter: brightness(1.2);
}

#dropdownAttributeMenu button:hover { transform: translateX(4px); }

/* ✅ Bouton Artwork */
#toggleArtworkBtn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #4b5563 !important;
}
#toggleArtworkBtn img { width: 20px; height: 20px; object-fit: contain; }
#toggleArtworkBtn:hover { background-color: #374151; transform: scale(1.05); }
#toggleArtworkBtn.active { background-color: #16a34a !important; color: white; box-shadow: 0 0 0 2px white inset; transform: scale(1.05); }

/* ✅ Mobile */
.slide-down { animation: slideDown 0.3s ease forwards; }
.slide-up { animation: slideUp 0.3s ease forwards; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }
#mobileMenuToggle { display: none; }

@media screen and (max-width: 768px) {
  body { 
    overflow-x: hidden; padding-top: 0;
    background-image: none; /* Retire l'image du flux principal pour éviter l'étirement */
  }

  /* Image fixe sur mobile via le pseudo-élément */
  body::before {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('Fond-Telephone.jpg');
    background-size: cover;
    background-position: center;
  }

  h1 { font-size: 2rem; line-height: 1.2; }
  #mobileMenuToggle { display: block; position: fixed; top: 10px; right: 10px; background-color: #1f2937; color: white; padding: 8px 12px; border-radius: 8px; z-index: 100; }
  #mobileMenuContent.hidden { display: none !important; }

  /* ✅ Force le conteneur Filtres à une hauteur fixe sur mobile pour éviter qu'il bouge */
  #filterContent {
    height: 80vh !important;
    max-height: 80vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    overscroll-behavior: none; /* Empêche le rebond élastique */
  }
}

/* NOUVEAU HEADER */
#main-header {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

#main-header h1 {
  font-size: 2.25rem; /* 36px */
  letter-spacing: 1px;
}

/* Classe pour le logo assorti au header */
.header-logo {
  background-color: transparent;
}

#main-header #progressLabel {
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.header-btn, .header-input {
  background-color: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(71, 85, 105, 1);
  color: #e2e8f0;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
  font-weight: 600;
}
.header-btn:hover {
  background-color: rgba(51, 65, 85, 1);
  border-color: #60a5fa;
}
.header-input::placeholder { color: #94a3b8; }
.header-input:focus {
  outline: none;
  border-color: #60a5fa;
  background-color: rgba(51, 65, 85, 1);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.4);
}

/* ✅ Manager Modal */
#managerModal {
  z-index: 200; /* Au-dessus de tout */
  background-color: rgba(10, 10, 20, 0.8); /* Plus transparent pour voir l'arrière-plan */
}

/* ✅ Fixe le modal Filtres (Header/Footer fixes, Contenu scrollable) */
#filterContent {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.manager-content {
  /* Simplification pour performance PC : suppression des masques complexes */
  background-color: #1f2937;
  background: radial-gradient(circle at top, #2c3e50, #1a242f);
  border: 2px solid #4f46e5;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);

  max-height: 90vh;
  overflow-y: auto;
}

/* Style de la barre de défilement pour Webkit (Chrome, Safari) */
.manager-content::-webkit-scrollbar {
  width: 10px;
}

.manager-content::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
}

.manager-content::-webkit-scrollbar-thumb {
  background-color: #4f46e5; /* Indigo */
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background-color 0.2s;
}

.manager-content::-webkit-scrollbar-thumb:hover {
  background-color: #6d28d9; /* Violet */
}
.manager-tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: #9ca3af;
  transition: all 0.2s;
}

.manager-tab:hover {
  color: white;
  background-color: #374151;
}

.manager-tab.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
  font-weight: bold;
}

.manager-input {
  background-color: #111827;
  border: 1px solid #374151;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  width: 100%;
}

.manager-input:focus {
  outline: none;
  border-color: #60a5fa;
}

/* Masquer les flèches des champs numériques */
.manager-input[type=number]::-webkit-inner-spin-button,
.manager-input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.manager-input[type=number] {
  -moz-appearance: textfield;
}

.manager-label {
  display: block;
  font-size: 0.85rem;
  color: #d1d5db;
  margin-bottom: 2px;
}

/* Animation de vibration (Shake) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

/* ✅ Header Grid Layout pour centrage parfait */
.header-grid-layout {
  display: flex; /* Retour au Flex pour PC comme avant */
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* Ajustement PC : La recherche prend l'espace disponible */
.header-grid-layout > div:nth-child(2) {
  flex: 1;
  display: flex;
  justify-content: center;
}

@media (max-width: 768px) {
  .header-grid-layout {
    display: grid;
    grid-template-columns: auto 1fr; /* Logo à gauche, Actions à droite */
    grid-template-rows: auto auto;
    gap: 0.5rem;
    align-items: center;
  }
  
  /* Logo : Ligne 1, Col 1 */
  .header-grid-layout > div:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }
  
  /* Recherche : Ligne 2, prend toute la largeur */
  .header-grid-layout > div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
  
  /* Actions : Ligne 1, Col 2 (Aligné à droite) */
  .header-grid-layout > div:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    align-items: center;
    justify-self: end;
  }
}

/* ✅ Master Filter Dropdown */
#masterFilterMenu {
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.75rem;
}

/* Style de la barre de défilement pour Webkit (Chrome, Safari) */
#masterFilterMenu::-webkit-scrollbar {
  width: 8px;
}
#masterFilterMenu::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
}
#masterFilterMenu::-webkit-scrollbar-thumb {
  background-color: #4b5563; /* Gray */
  border-radius: 10px;
}

.filter-section-title {
  font-size: 0.8rem;
  font-weight: bold;
  color: #9ca3af;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  margin-top: 0.75rem;
  border-bottom: 1px solid #4b5563;
  padding-bottom: 0.25rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 0.5rem;
}

.filter-icon-btn {
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.375rem;
  padding: 0.5rem;
  transition: all 0.2s ease;
  position: relative;
}
.filter-icon-btn:hover {
  background-color: #374151;
  transform: scale(1.05);
}

/* ✅ Bordure bleue uniquement pour TOUS et QCK au survol */
.filter-icon-btn[data-value="all"]:hover,
.filter-icon-btn[data-value="QCK"]:hover {
  border-color: #60a5fa;
}

.filter-icon-btn:focus {
  outline: none;
}

/* ✅ Modal Backdrop Custom (Moins flou) */
.modal-backdrop-custom {
  background-color: rgba(0, 0, 0, 0.85);
}

/* ✅ Texte Arc-en-ciel (Stats Bateaux) */
.text-rainbow {
  background: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbow 3s linear infinite;
  background-size: 400% 100%;
}

@keyframes rainbow {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* ✅ Bloque le scroll du site quand une modale est ouverte */
body.no-scroll {
  overflow: hidden !important;
}

/* ✅ Scrollbar Personnalisée (Filtres, etc.) */
.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: #4f46e5; /* Indigo pour matcher le thème */
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: #6366f1;
}

/* ✅ Scrollbar Artwork Modal (Horizontal) */
#artworkContainer::-webkit-scrollbar {
  height: 14px;
}

#artworkContainer::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  margin: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#artworkContainer::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}

#artworkContainer::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  border: 3px solid transparent;
  background-clip: content-box;
}
