/* ============================================
   SEQUENCE — style.css
   Design : Liquid Glass
   ============================================ */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}
/* ─── LIGHT MODE (défaut) ─── */
:root, [data-theme="light"] {
  /* Surfaces */
  --bg: #f0eeea;
  --bg-gradient-1: rgba(124, 58, 237, 0.05);
  --bg-gradient-2: rgba(155, 35, 53, 0.04);
  --glass: rgba(255, 255, 255, 0.65);
  --glass-hover: rgba(255, 255, 255, 0.80);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-bright: rgba(0, 0, 0, 0.18);
  --glass-inset: rgba(255, 255, 255, 0.90);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.05);

  /* Texte */
  --text: #1a1814;
  --text-muted: rgba(26, 24, 20, 0.55);
  --text-faint: rgba(26, 24, 20, 0.30);

  /* Surfaces secondaires */
  --surface-subtle: rgba(0, 0, 0, 0.04);
  --surface-hover:  rgba(0, 0, 0, 0.07);
  --border-row:     rgba(0, 0, 0, 0.06);

  /* Succès */
  --success-text:   #16a34a;
  --success-bg:     rgba(22, 163, 74, 0.10);
  --success-border: rgba(22, 163, 74, 0.38);

  /* Streak */
  --streak-color: #E8530A;
  --streak-glow:  rgba(232, 83, 10, 0.20);

  /* XP */
  --xp-color: #6D28D9;

  /* Divers */
  --blur:       blur(24px);
  --blur-light: blur(16px);
  --radius:     20px;
  --radius-sm:  12px;
  --transition: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --header-h:   64px;
  --nav-h:      72px;
}

/* ─── DARK MODE ─── */
[data-theme="dark"] {
  --bg: #0a0a0f;
  --bg-gradient-1: rgba(124, 58, 237, 0.08);
  --bg-gradient-2: rgba(155, 35, 53, 0.06);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.10);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-bright: rgba(255, 255, 255, 0.22);
  --glass-inset: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.50);
  --text: #f0efff;
  --text-muted: rgba(240, 239, 255, 0.50);
  --text-faint: rgba(240, 239, 255, 0.25);
  --surface-subtle: rgba(255, 255, 255, 0.05);
  --surface-hover:  rgba(255, 255, 255, 0.09);
  --border-row:     rgba(255, 255, 255, 0.05);
  --success-text:   #86efac;
  --success-bg:     rgba(34, 197, 94, 0.09);
  --success-border: rgba(34, 197, 94, 0.38);
  --streak-color: #FF6B2B;
  --streak-glow:  rgba(255, 107, 43, 0.25);
  --xp-color: #8B5CF6;
}

/* ─── AUTO : suit les préférences système si pas de toggle manuel ─── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0a0f;
    --bg-gradient-1: rgba(124, 58, 237, 0.08);
    --bg-gradient-2: rgba(155, 35, 53, 0.06);
    --glass: rgba(255, 255, 255, 0.06);
    --glass-hover: rgba(255, 255, 255, 0.10);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-border-bright: rgba(255, 255, 255, 0.22);
    --glass-inset: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.50);
    --text: #f0efff;
    --text-muted: rgba(240, 239, 255, 0.50);
    --text-faint: rgba(240, 239, 255, 0.25);
    --surface-subtle: rgba(255, 255, 255, 0.05);
    --surface-hover:  rgba(255, 255, 255, 0.09);
    --border-row:     rgba(255, 255, 255, 0.05);
    --success-text:   #86efac;
    --success-bg:     rgba(34, 197, 94, 0.09);
    --success-border: rgba(34, 197, 94, 0.38);
    --streak-color: #FF6B2B;
    --streak-glow:  rgba(255, 107, 43, 0.25);
    --xp-color: #8B5CF6;
  }
}

/* ---- Body ---- */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 10%, var(--bg-gradient-1) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 85%, var(--bg-gradient-2) 0%, transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---- Utilitaires ---- */
.hidden          { display: none !important; }
.title-syne      { font-family: 'Syne', sans-serif; }

/* ---- Canvas particules ---- */
#particles-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   GLASS CARD — composant réutilisable
   ============================================ */
.glass-card {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--glass-inset);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

/* Exclure le header et la nav du hover lift (éléments fixes) */
.glass-card:hover:not(.app-header):not(.bottom-nav):not(.tree-header) {
  background: var(--glass-hover);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-inset);
}

/* ============================================
   ONBOARDING
   ============================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;     /* ← était center, causait le débordement */
  justify-content: center;
  padding: 24px;
  overflow-y: auto;            /* ← permet le scroll si besoin */
}

.onboarding-container {
  width: 100%;
  max-width: 820px;
  position: relative;
  z-index: 1;
  margin: auto;                /* ← centrage vertical auto quand contenu < viewport */
  padding: 8px 24px;
}




.onboarding-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  animation: fadeSlideUp var(--transition) forwards;
}

.onboarding-title {
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.onboarding-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: -12px;
}

.onboarding-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  opacity: 0.55;
  margin-top: -8px;
}

/* Champ nom */
.input-wrapper {
  width: 100%;
  padding: 4px;
}

.input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 500;
  text-align: center;
  padding: 16px;
  caret-color: var(--xp-color);
}

.input-wrapper input::placeholder { color: var(--text-muted); }

/* Grille sélection familles */
.families-select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);  /* ← 4 colonnes au lieu de 2 */
  gap: 10px;
  width: 100%;
  max-height: none;      /* ← supprimer la limite de hauteur */
  overflow-y: visible;   /* ← plus de scroll interne */
  padding-right: 0;
}
/* 9e card (dernière impaire) → centrée */
.families-select-grid .family-select-card:last-child:nth-child(9n) {
  grid-column: 2 / 4;   /* ← centrée sur les colonnes du milieu */
}

.family-select-card {
  background: var(--glass);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.family-select-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-bright);
}

.family-select-card.selected {
  border-color: var(--family-color, var(--glass-border-bright));
  box-shadow: 0 0 0 1px var(--family-color, transparent),
              0 0 24px rgba(255,255,255,0.04);
}

.family-select-card .fs-icon   { font-size: 1.4rem; display: block; margin-bottom: 5px; }
.family-select-card .fs-name   { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.8rem; display: block; margin-bottom: 4px; }
.family-select-card .fs-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;     /*  max 2 lignes */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Rank reveal */
.rank-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 0;
}

.rank-label-small {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.rank-name-hero {
  font-size: clamp(3.5rem, 14vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text) 0%, rgba(124, 58, 237, 0.75) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rank-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Boutons */
.btn-primary {
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border-bright);
  border-radius: 100px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 48px;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--surface-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled { opacity: 0.25; cursor: not-allowed; }

.btn-primary.btn-glow {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.2);
}

.btn-success {
  width: 100%;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: 100px;
  color: var(--success-text);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 13px 24px;
  transition: transform var(--transition), background var(--transition);
}

.btn-success:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--success-bg) 150%, transparent); }

.btn-ghost {
  width: 100%;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 13px 24px;
  transition: transform var(--transition), border-color var(--transition);
}

.btn-ghost:hover { transform: translateY(-1px); border-color: var(--glass-border-bright); }

/* ============================================
   HEADER
   ============================================ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  margin: 10px 12px 0;
  flex-shrink: 0;
}

.header-brand {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  flex-shrink: 0;
}

.header-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 14px;
  color: var(--streak-color);
  background: var(--streak-glow);
  border: none;
  padding: 4px 12px;
  border-radius: 20px;
  flex-shrink: 0;
  cursor: default;
  transition: box-shadow var(--transition), transform var(--transition);
}

/* Streak actif (≥ 1 jour) */
.header-streak--active {
  font-size: 1rem;
  padding: 6px 14px;
  cursor: pointer;
  animation: streakGlow 2.4s ease-in-out infinite alternate;
}
@keyframes streakGlow {
  from { box-shadow: 0 0 0 0 var(--streak-glow); }
  to   { box-shadow: 0 0 12px 3px var(--streak-glow); }
}

/* Streak zéro : CTA textuel */
.header-streak-cta {
  background: transparent;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--streak-color);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

/* Rang vierge : texte muted italique */
.header-rank-xp--empty {
  font-style: italic;
  font-size: 10px;
  color: var(--text-faint);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-user { text-align: right; }

.header-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  display: block;
}

.header-rank-xp {
  font-size: 11px;
  color: var(--text-muted);
}

.header-rank-xp #header-xp-text { color: var(--xp-color); font-weight: 600; }

/* Theme toggle */
.theme-toggle-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--glass-border-bright);
}

/* ============================================
   LAYOUT APP — 2 pages + navigation
   ============================================ */
#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, var(--bg-gradient-2) 0%, transparent 50%);
}
#app.hidden { display: none !important; }

/* ── Pages ───────────────────────────────── */
.app-page {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.app-page.hidden { display: none !important; }

/* ── Navigation ─────────────────────────── */

/* Mobile : bottom nav */
.app-nav {
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: 10px;
  height: 60px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  border-radius: var(--radius);
}

/* Ajouter de l'espace pour la nav sur mobile */
.app-page { padding-bottom: 82px; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 28px;
  border-radius: 12px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  flex: 1;
}
.nav-item svg   { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-item span  { font-size: 0.65rem; font-weight: 500; letter-spacing: 0.02em; }
.nav-item.active {
  background: var(--surface-subtle);
  color: var(--text);
}
/* Desktop : sidebar gauche */
@media (min-width: 768px) {
  #app {
    display: grid;
    grid-template-columns: 72px 1fr;  /* ← était 80px, doit matcher la sidebar */
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
}

  .app-header { grid-column: 1 / -1; grid-row: 1; }

  .app-nav {
    position: fixed;
    left: 10px;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: auto;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 14px 6px;
    border-radius: var(--radius);
    right: auto;
  }

  .nav-item {
    padding: 10px 6px;
    width: 100%;
    flex: 0 0 auto;
  }
  .nav-item span { font-size: 0.52rem; }

  .app-page {
    grid-column: 2;
    grid-row: 2;
    padding-bottom: 16px;
  }


/* ── Rosace colonne (page Compétences) ───── */
.rosace-column {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 300px;
}

.rosace-column .rosace-svg {
  width: 100%;
  height: 100%;
  max-width: 560px;
  max-height: 560px;
  overflow: visible;
}

/* ── Page Compétences ───────────────────── */
.skills-page-header {
  flex-shrink: 0;
  text-align: center;
  padding: 4px 0 2px;
}
.skills-page-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.rosace-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Sections missions (page Dashboard) ─── */
.missions-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.missions-title { font-size: 1.05rem; font-weight: 800; margin: 0; }
/* alias pour l'ancien .missions-header */
.missions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  padding: 0;
  margin: 24px 0 12px;
}

/* Bouton refresh missions */
.missions-refresh-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
  padding: 0;
}
.missions-refresh-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--glass-border-bright);
}
.missions-refresh-btn svg { width: 14px; height: 14px; }
.missions-refresh-btn.spinning { animation: spinOnce 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Badges de statut ────────────────────── */
.mission-status-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.status-todo {
  background: var(--surface-subtle);
  border-color: var(--glass-border);
  color: var(--text-muted);
}
.status-inprogress {
  background: rgba(232, 83, 10, 0.10);
  border-color: rgba(232, 83, 10, 0.28);
  color: var(--streak-color);
}
.status-done {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}


/* ============================================
   SECTIONS
   ============================================ */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 14px;
}

.section-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.section-date  { font-size: 0.72rem; color: var(--text-muted); }

/* ============================================
   MISSION DU JOUR
   ============================================ */
/* Grille missions — exactement 3 colonnes, 1 ligne visible */
#daily-missions-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}
#daily-missions-container .mission-card:nth-child(n+4) {
  display: none;
}
.missions-column {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 0 0 40px;    /* ← supprimer le 32px horizontal, le padding vient du parent */
  box-sizing: border-box;
}

@media (max-width: 768px) {
  #daily-missions-container {
    grid-template-columns: 1fr;
  }
  #daily-missions-container .mission-card:nth-child(n+4) {
    display: flex;
  }
}

.mission-card {
  background: var(--glass);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--family-color, var(--glass-border));
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-inset);
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.mission-card:hover:not(.dimmed) {
  background: var(--glass-hover);
  transform: translateX(3px);
}

.mission-card.dimmed {
  opacity: 0.22;
  pointer-events: none;
  filter: saturate(0.3);
}

.mission-card.chosen {
  border-color: var(--family-color, var(--glass-border-bright));
  background: var(--glass-hover);
}

/* Ligne famille + badge statut */
.mission-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.mission-card-family {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--family-color, var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

/* Pied de carte : XP + boutons */
.mission-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.mission-card-xp {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--xp-color);
  flex-shrink: 0;
}
.mission-card-footer .mission-card-actions {
  flex: 1;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* États de la carte */
.mission-card--done {
  opacity: 0.5;
  pointer-events: none;
}
.mission-card--done .mission-card-title {
  text-decoration: line-through;
}
.mission-card--inprogress {
  border-left-width: 3px;
  border-left-color: var(--family-color, var(--glass-border));
}

.mission-card-linked {
  font-size: 0.65rem;
  color: var(--family-color, var(--text-muted));
  margin-bottom: 6px;
  opacity: 0.85;
}

.mission-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 5px;
}

.mission-card-desc {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mission-card-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.mission-card-cta {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--family-color, var(--xp-color));
  color: #fff;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}
.mission-card-cta:hover { opacity: 0.86; transform: translateY(-1px); }

.mission-card-cta.cta-validate {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.mission-card-cta.cta-defer {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  font-weight: 500;
  flex: 0 0 auto;
}
.mission-card-cta.cta-defer:hover { border-color: var(--glass-border-bright); }

/* ============================================
   WIDGET MISSION DU JOUR
   ============================================ */
.daily-mission-widget {
  margin: 16px 0 0;     /* ← supprimer le 24px horizontal */
  width: 100%;
  flex-shrink: 0;
  padding: 14px 16px;
  border-left: 4px solid var(--family-color, var(--xp-color));
  box-sizing: border-box;
}
.dmw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.dmw-title { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; }
.dmw-refresh-area { display: flex; align-items: center; gap: 6px; }
.dmw-refresh-count { font-size: 0.63rem; color: var(--text-muted); font-weight: 600; }
.missions-refresh-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* Bouton "Changer" de la Mission du jour : forme pill avec label */
.dmw-refresh-btn {
  border-radius: 100px;
  width: auto;
  height: 28px;
  padding: 0 10px 0 8px;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}
.dmw-refresh-btn .dmw-refresh-label { display: inline; }
.dmw-refresh-btn svg { width: 12px; height: 12px; }

.dmw-mission-card {
  border-left: 3px solid var(--family-color, var(--glass-border));
  padding-left: 10px;
}
.dmw-family {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--family-color, var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 4px;
}
.dmw-mission-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 4px;
}
.dmw-mission-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 10px;
}
.dmw-mission-footer { display: flex; align-items: center; gap: 8px; }
.dmw-xp { font-size: 0.72rem; font-weight: 700; color: var(--xp-color); flex-shrink: 0; }
.dmw-complete-btn { flex: 1; }

.daily-mission-widget.dmw--done {
  background: color-mix(in srgb, var(--success-bg) 55%, var(--glass));
  border-color: var(--success-border);
}
.dmw-done { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.dmw-done-icon { font-size: 1.2rem; }
.dmw-done-text { font-size: 0.82rem; font-weight: 600; color: var(--success-text); }
.dmw-empty { font-size: 0.78rem; color: var(--text-muted); padding: 4px 0; }

/* Bouton partage post-mission */
.share-btn {
  margin-top: 10px;
  width: 100%;
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.share-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Barre de progression vers rang suivant */
.rank-progress-bar {
  margin: 10px 0;
  padding: 10px 16px;
  width: 100%;
  box-sizing: border-box;
  /* Supprimer tout margin horizontal résiduel */
  align-self: stretch;
}
.rpb-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.rpb-next { color: var(--xp-color); }
.progress-track {
  height: 5px;
  background: var(--surface-subtle);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 5px;
}
.progress-fill {
  height: 100%;
  background: var(--xp-color);
  border-radius: 100px;
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 2px;
}
.rpb-caption {
  font-size: 0.62rem;
  color: var(--text-faint);
  display: block;
}

/* Toast clipboard */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 100px;
  z-index: 200;
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
  pointer-events: none;
  white-space: nowrap;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Banner mission complétée */
.completed-banner {
  text-align: center;
  padding: 24px 16px;
  background: var(--glass);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

.completed-banner .banner-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.completed-banner h3 { font-family: 'Syne', sans-serif; font-size: 0.95rem; font-weight: 700; margin-bottom: 5px; color: var(--success-text); }
.completed-banner p  { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* Message d'encouragement inline */
.inline-message {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 11px 14px;
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  margin-bottom: 9px;
}

/* ============================================
   GRILLE FAMILLES
   ============================================ */
.families-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.family-card {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid color-mix(in srgb, var(--family-color, var(--glass-border)) 20%, var(--glass-border));
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 var(--glass-inset),
    0 0 20px color-mix(in srgb, var(--family-color, transparent) 10%, transparent);
}

.family-card:hover { transform: translateY(-3px); border-color: var(--glass-border-bright); background: var(--glass-hover); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-inset); }

.family-card.boss-ready {
  border-color: var(--family-color, var(--glass-border-bright));
  animation: pulseBorder 2.8s ease-in-out infinite;
}

.fc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.fc-icon  { font-size: 1.5rem; }
.fc-level {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-subtle);
  padding: 3px 8px;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
}

.fc-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.9rem; margin-bottom: 3px; color: var(--family-color, var(--text)); }
.fc-xp   { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 10px; }

.progress-track {
  height: 4px;
  background: var(--surface-subtle);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--family-color, var(--xp-color));
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.fc-boss-hint {
  font-size: 0.68rem;
  color: var(--family-color, var(--text));
  font-weight: 600;
  margin-top: 7px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition), transform var(--transition);
}

.fc-boss-hint.visible { opacity: 1; transform: translateY(0); }

/* ============================================
   MODALS — base overlay
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---- Modal matinale ---- */
.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.morning-icon  { font-size: 2.2rem; }
.modal-title   { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-question{ color: var(--text-muted); font-size: 0.85rem; margin-top: -4px; }

.morning-mission-preview {
  width: 100%;
  padding: 14px 16px;
  text-align: left;
}

.morning-mission-preview .mp-title  { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.morning-mission-preview .mp-family { font-size: 0.72rem; color: var(--text-muted); }

.modal-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; }

/* ---- Modal famille ---- */
.family-modal-card {
  width: 100%;
  max-width: 500px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 0;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.family-modal-card::-webkit-scrollbar       { width: 4px; }
.family-modal-card::-webkit-scrollbar-track { background: transparent; }
.family-modal-card::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 100px; }

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 10;
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background var(--transition);
}

.modal-close:hover { background: var(--surface-hover); }
.modal-close svg   { width: 15px; height: 15px; }

/* ---- Modal mission ---- */
.mission-modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px 24px 24px;
  position: relative;
  border-left: 4px solid var(--family-color, var(--xp-color));
  animation: fadeSlideUp 220ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.mm-family {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 6px;
}
.mm-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.2;
  color: var(--text);
}
.mm-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.mm-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 18px;
}
.mm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Badge prérequis */
.mission-prereq-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 3px 10px;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.prereq-icon { font-size: 0.7rem; }
.prereq-name { font-weight: 600; color: var(--text); }

/* Contenu modal famille */
.fm-header {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--glass-border);
}

.fm-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-right: 40px;
}

.fm-icon  { font-size: 2rem; }
.fm-name  { font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.03em; }
.fm-desc  { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }

.fm-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  margin-bottom: 7px;
}

.fm-level-text { font-weight: 600; }
.fm-xp-text    { color: var(--text-muted); }

.fm-progress-track {
  height: 7px;
  background: var(--surface-subtle);
  border-radius: 100px;
  overflow: hidden;
}

.fm-progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.fm-missions { padding: 18px 22px 24px; }

.fm-group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 18px;
}

.fm-group-label:first-child { margin-top: 0; }

/* Ligne de mission dans le modal */
.fm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-row);
}

.fm-row:last-child { border-bottom: none; }

.fm-row.done { opacity: 0.4; }

.fm-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 0.55rem;
  color: transparent;
}

.fm-row.done .fm-check {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.fm-mission-body { flex: 1; min-width: 0; }

.fm-mission-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 3px;
  line-height: 1.3;
}

.fm-row.done .fm-mission-title { text-decoration: line-through; }

.fm-mission-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

.fm-mission-xp {
  font-size: 0.72rem;
  color: var(--family-color, var(--xp-color));
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Card boss dans le modal */
.boss-modal-card {
  margin-top: 14px;
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--family-color, var(--glass-border));
  background: linear-gradient(135deg, var(--surface-subtle) 0%, transparent 100%);
  position: relative;
  overflow: hidden;
}

.boss-modal-card.locked {
  opacity: 0.4;
  filter: blur(0.4px);
}

.boss-modal-card.locked::after {
  content: '🔒';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(0,0,0,0.1);
}

.boss-modal-card.unlocked { animation: pulseBorder 2.8s ease-in-out infinite; }

.boss-tag   { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; color: var(--family-color, var(--text)); margin-bottom: 6px; }
.boss-title { font-family: 'Syne', sans-serif; font-size: 0.95rem; font-weight: 800; margin-bottom: 7px; }
.boss-desc  { font-size: 0.77rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 10px; }
.boss-xp    { font-family: 'Syne', sans-serif; font-size: 0.95rem; font-weight: 700; color: var(--family-color, var(--xp-color)); }

/* ============================================
   PROFIL
   ============================================ */
#profile-content {
  display: flex;
  flex-direction: column;
  padding: 6px 0 8px;
  height: 100%;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.profile-rank {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-top: 2px;
}

.profile-xp-total {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--xp-color);
}

.rosace-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  min-height: clamp(300px, 55vw, 480px);
}

.profile-stats {
  display: flex;
  justify-content: space-around;
  padding: 14px 16px;
  margin-top: 10px;
  flex-shrink: 0;
}

.profile-stat { text-align: center; }

.profile-stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  display: block;
}

.profile-stat-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  display: block;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.families-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.fam-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}

.fam-row .ficon { font-size: 1.1rem; }
.fam-row .fname { font-size: 0.75rem; font-weight: 600; }
.fam-row .flevel{ font-size: 0.65rem; margin-left: auto; }

.soon-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.soon-tag {
  font-size: 0.72rem;
  padding: 4px 11px;
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: var(--text-muted);
}

/* ============================================
   NAVIGATION
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  height: var(--nav-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 22px;
  border-radius: 12px;
  transition: color var(--transition), background var(--transition);
  flex: 1;
}

.nav-item svg   { width: 19px; height: 19px; stroke-width: 1.8; }
.nav-item span  { font-size: 0.62rem; font-weight: 500; letter-spacing: 0.02em; }
.nav-item.active{ color: var(--text); background: var(--surface-subtle); }

/* ============================================
   XP POPUP
   ============================================ */
.xp-popup {
  position: fixed;
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--xp-color);
  pointer-events: none;
  z-index: 200;
  text-shadow: 0 0 24px rgba(124, 58, 237, 0.6);
  animation: xpFloat 1.6s ease-out forwards;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseBorder {
  0%, 100% {
    box-shadow: 0 0 0 1px var(--family-color, transparent), var(--shadow-md);
  }
  50% {
    box-shadow: 0 0 0 2px var(--family-color, transparent), var(--shadow-lg), 0 0 24px color-mix(in srgb, var(--family-color, transparent) 15%, transparent);
  }
}

@keyframes rankGlow {
  from { filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.15)); }
  to   { filter: drop-shadow(0 0 18px rgba(124, 58, 237, 0.45)); }
}

@keyframes xpFloat {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  50%  { opacity: 1; transform: translateX(-50%) translateY(-28px) scale(1.1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-64px) scale(0.9); }
}

/* ============================================
   RESPONSIVE — Desktop (≥ 768px)
   ============================================ */
@media (min-width: 768px) {
  :root { --nav-h: 0px; }

  .bottom-nav { display: none; }

  #app {
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }

  .app-header { grid-column: 2; grid-row: 1; }
  .main-body  { grid-column: 2; grid-row: 2; }

  /* Sidebar desktop */
  .bottom-nav-desktop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: fixed;
  left: 0;           /* ← collée au bord gauche */
  top: 0;
  bottom: 0;         /* ← pleine hauteur */
  width: 72px;       /* ← largeur fixe */
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--glass-border);  /* ← séparation droite */
  padding: 80px 8px 24px;   /* ← espace pour le header */
  z-index: 50;
  box-shadow: var(--shadow-md);
  justify-content: flex-start;
}

/* Ajuster le contenu principal pour ne pas être caché derrière */
@media (min-width: 768px) {
  
  .app-header {
    left: 72px;  /* ← commence après la sidebar */
  }
}

  #main-content {
    grid-column: 2;
    padding-left: 24px;
    padding-right: 24px;
    padding-top: calc(var(--header-h) + 28px);
    max-width: 720px;
    margin: 0 auto;
  }

  .header {
    max-width: 900px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - 48px);
  }

  .mission-card { flex: 1; min-width: 220px; }

  .families-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ============================================
   ÉCRAN ARBRE DE COMPÉTENCES
   ============================================ */
.tree-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 10%, var(--bg-gradient-1) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 85%, var(--bg-gradient-2) 0%, transparent 55%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeSlideUp 280ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tree-header {
  flex-shrink: 0;
  margin: 12px 12px 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: var(--radius);
  border-left: 3px solid var(--family-color, var(--glass-border));
}

.tree-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.tree-back-btn:hover { background: var(--surface-hover); border-color: var(--glass-border-bright); }
.tree-back-btn svg   { width: 14px; height: 14px; }

.tree-family-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.tree-family-icon { font-size: 1.2rem; flex-shrink: 0; }
.tree-family-info-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.tree-family-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--family-color, var(--text));
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-header-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tree-progress-bar {
  flex: 1;
  max-width: 130px;
  height: 3px;
  background: var(--glass-border);
  border-radius: 2px;
  overflow: hidden;
}
.tree-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}
.tree-mission-count {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--family-color, var(--text-muted));
  white-space: nowrap;
  flex-shrink: 0;
}
.tree-family-level {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Conteneur principal : SVG + liste missions côte à côte */
.tree-content-area {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 10px 12px 8px;
  overflow: hidden;
  min-height: 0;
}

.tree-canvas-wrapper {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
}

/* Liste des missions — panneau latéral */
.tree-missions-list {
  width: 240px;
  flex-shrink: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}
.tree-missions-list::-webkit-scrollbar       { width: 3px; }
.tree-missions-list::-webkit-scrollbar-track { background: transparent; }
.tree-missions-list::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 100px; }

/* Sur mobile : colonne (SVG au-dessus, liste en dessous) */
@media (max-width: 767px) {
  .tree-content-area {
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 16px;
  }
  .tree-canvas-wrapper {
    flex: 0 0 auto;
    min-height: 320px;
  }
  .tree-missions-list {
    width: 100%;
    max-height: none;
  }
}

/* Titre section liste */
.tml-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 2px 2px;
}

/* Ligne de mission dans la liste latérale */
.tml-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.tml-row:hover { background: var(--glass-hover); border-color: var(--glass-border-bright); }

.tml-row.tml-done {
  border-left: 3px solid var(--family-color, var(--glass-border));
}

.tml-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 0.6rem;
  color: transparent;
}
.tml-row.tml-done .tml-check {
  background: color-mix(in srgb, var(--family-color, var(--xp-color)) 18%, transparent);
  border-color: var(--family-color, var(--xp-color));
  color: var(--family-color, var(--xp-color));
}

.tml-body { flex: 1; min-width: 0; }
.tml-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
.tml-row.tml-done .tml-title {
  text-decoration: line-through;
  opacity: 0.6;
}
.tml-row.tml-done .tml-xp {
  opacity: 0.35;
  text-decoration: line-through;
}
.tml-xp {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--family-color, var(--xp-color));
  margin-top: 2px;
}

/* Boss row spécial */
.tml-row.tml-boss {
  border: 1px solid color-mix(in srgb, var(--family-color, var(--glass-border)) 50%, var(--glass-border));
}
.tml-boss-tag {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--family-color, var(--text-muted));
}

.tree-svg {
  display: block;
  width: 100%;
  max-width: 700px;
  height: auto;
  overflow: visible;
}

/* Connexions circuit board */
.tree-conn {
  stroke: var(--glass-border-bright);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 0.45;
}
.tree-conn.partial {
  stroke: var(--family-color);
  stroke-dasharray: 6 4;
  stroke-width: 1.5;
  opacity: 0.42;
}
.tree-conn.done {
  stroke: var(--family-color);
  stroke-dasharray: none;
  stroke-width: 3;
  opacity: 0.82;
}

/* Nœuds */
.node-bg {
  fill: var(--bg);  /* fond opaque = masque les lignes derrière */
}

.node-icon        { font-family: 'Inter', sans-serif; }
.node-title-inner {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: var(--text-muted);
}

.tree-node { transition: opacity var(--transition); }
.tree-node.locked { opacity: 0.45; }

/* Nœuds complétés — fill coloré + glow */
.tree-node.completed polygon.node-shape {
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--family-color) 60%, transparent));
}

/* Hover sur nœuds non verrouillés */
/* État de base — nécessaire pour que le mouseout soit animé aussi */
.tree-node polygon.node-shape {
  transition: transform 150ms ease, filter 200ms ease;
}

/* Hover fix SVG : transform-box: fill-box est indispensable */
.tree-node:not(.locked):hover polygon.node-shape {
  transform-box: fill-box;      /* ← clé du fix */
  transform-origin: center;
  transform: scale(1.08);
  transition: transform 150ms ease;
}

/* Boss déverrouillé — même fix pour le pulse */
.tree-node--boss-unlocked polygon.node-shape {
  transform-box: fill-box;
  transform-origin: center;
  animation: bossGlow 2.2s ease-in-out infinite;
}

/* Pulse boss déverrouillé */
@keyframes bossGlow {
  0%, 100% { filter: drop-shadow(0 0 6px var(--family-color)); }
  50%       { filter: drop-shadow(0 0 22px var(--family-color)); }
}
.tree-node--boss-unlocked polygon.node-shape {
  animation: bossGlow 2.2s ease-in-out infinite;
}

/* Panneau de détail mission — slide-up depuis le bas */
.tree-detail-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 24px 40px;
  background: var(--glass-hover);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--glass-border);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.25), inset 0 1px 0 var(--glass-inset);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}
.tree-detail-panel::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--glass-border-bright);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.tree-detail-panel.active {
  transform: translateY(0);
}

.tdp-close {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  font-family: monospace;
  transition: background var(--transition);
  padding: 0;
}
.tdp-close:hover { background: var(--surface-hover); }

.tdp-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  padding-right: 34px;
  color: var(--text);
  line-height: 1.25;
}

.tdp-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.tdp-badge {
  font-size: 0.62rem;
  font-weight: 600;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  padding: 2px 8px;
  color: var(--text-muted);
  background: var(--surface-subtle);
}
.tdp-badge.tdp-xp {
  font-family: 'Syne', sans-serif;
  background: transparent;
}

.tdp-stars .star     { font-size: 0.62rem; color: var(--text-muted); opacity: 0.25; }
.tdp-stars .star.on  { opacity: 1; color: var(--family-color, var(--text)); }

.tdp-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tdp-status { font-size: 0.75rem; font-weight: 600; display: block; }
.tdp-status.done      { color: var(--success-text); }
.tdp-status.locked    { color: var(--text-muted); }
.tdp-status.available { font-weight: 500; opacity: 0.85; }

/* ============================================
   ROSACE PROFIL
   ============================================ */
.rosace-svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 500px;
  max-height: 500px;
  overflow: visible;
}

.rosace-ring {
  fill: none;
  stroke: var(--glass-border);
  stroke-width: 0.5;
  stroke-dasharray: 3 7;
  opacity: 0.5;
}

.rosace-spoke {
  stroke-linecap: round;
  stroke-dasharray: 4 5;
}

.rosace-hex-bg     { stroke: none; }
.rosace-hex-border { fill: none; }

@keyframes hexPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}
.rosace-fam-node:not(.completed) .rosace-hex-bg {
  animation: hexPulse 3s ease-in-out infinite;
}

.rosace-fam-icon  { font-size: 18px; font-family: 'Inter', sans-serif; }
.rosace-fam-name  { font-size: 9px; font-family: 'Syne', sans-serif; font-weight: 700; fill: var(--text-muted); }
.rosace-fam-level { font-size: 8px; font-family: 'Inter', sans-serif; fill: var(--text-faint); }
.rosace-fam-badge { font-size: 8px; font-family: 'Syne', sans-serif; font-weight: 700; }
.rosace-fam-node.completed .rosace-fam-name { fill: var(--family-color); }

/* Centre de la rosace */
.rosace-center-bg {
  fill: var(--glass);
}
.rosace-center-border {
  fill: none;
  stroke: var(--glass-border-bright);
  stroke-width: 2.5;
  stroke-opacity: 1;
}
.rosace-center-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 800;
  fill: var(--text);
  letter-spacing: 0.04em;
}
.rosace-center-label {
  font-family: 'Inter', sans-serif;
  font-size: 8px;
  font-weight: 600;
  fill: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.rosace-center-level {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 900;
  fill: var(--text);
}
/* Meta XP + durée visible dans les cards compactes */
.mission-card-collapsed-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

/* Durée estimée */
.mission-card-duration {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Curseur pointer pour indiquer que c'est cliquable */
.mission-card {
  cursor: pointer;
}
@media (min-width: 1024px) {
  #main-content { max-width: 820px; }
}
@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes confettiFly0 {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(-80px, -120px) scale(0.3); opacity: 0; }
}
@keyframes confettiFly1 {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(20px, -150px) scale(0.3); opacity: 0; }
}
@keyframes confettiFly2 {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(90px, -110px) scale(0.3); opacity: 0; }
}