:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dark: #0ea5e9;
  --error: #f87171;
  --success: #4ade80;
  --gold: #fbbf24;
  --border: #334155;
  --nav-bg: rgba(15, 23, 42, 0.92);
  --input-bg: #0f172a;
  --hover-bg: #1e293b;
  --body-grad: linear-gradient(160deg, #0f172a, #1e1b4b);
  --skel: #334155;
  --skel-hi: #3d4f6b;
}

/* ---------- Thème clair ---------- */
[data-theme="light"] {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --input-bg: #f8fafc;
  --hover-bg: #eef2f7;
  --body-grad: linear-gradient(160deg, #f8fafc, #e0f2fe);
  --skel: #e2e8f0;
  --skel-hi: #f1f5f9;
}
[data-theme="light"] .card { box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08); }
[data-theme="light"] .message.error { color: #991b1b; }
[data-theme="light"] .message.success { color: #166534; }
[data-theme="light"] .message.info { color: #075985; }
[data-theme="light"] .star { color: #cbd5e1; }
[data-theme="light"] .settings-menu { box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--body-grad);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* ---------- Barre de navigation ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.7rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 0.4rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  font-weight: 600;
}

.nav-links a:hover { color: var(--text); background: var(--hover-bg); }
.nav-links a.active { color: #082f49; background: var(--accent); }

/* Zone connexion : toujours en haut à droite */
.auth-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.auth-area .user-email {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.btn:hover { border-color: var(--accent); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #082f49;
}

.btn.primary:hover { background: var(--accent-dark); }

/* ---------- Contenu ---------- */
main {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  min-height: 70vh;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  margin-bottom: 1.2rem;
}

.hidden { display: none; }
.small { font-size: 0.8rem; color: var(--muted); }

/* ---------- Page d'accueil ---------- */
.hero {
  text-align: center;
  padding: 3rem 1.5rem;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2.6rem;
  margin: 0 0 0.6rem;
}

.hero h1 .accent { color: var(--accent); }

.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 0 1.6rem; }

.hero-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-actions .btn { padding: 0.75rem 1.6rem; font-size: 1rem; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.feature h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.feature p { color: var(--muted); margin: 0; font-size: 0.92rem; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  padding: 0.9rem 0 0.9rem 3rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #082f49;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Formulaires ---------- */
.form h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.8rem 0 0.3rem;
}
.form input, .form textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}
.form input:focus, .form textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}
.primary {
  width: 100%;
  margin-top: 1.2rem;
  padding: 0.8rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #082f49;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.primary:hover { background: var(--accent-dark); }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #082f49;
  font-weight: 600;
}

.message {
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.message.error { background: rgba(248, 113, 113, 0.12); border: 1px solid var(--error); color: #fecaca; }
.message.success { background: rgba(74, 222, 128, 0.12); border: 1px solid var(--success); color: #bbf7d0; }
.message.info { background: rgba(56, 189, 248, 0.12); border: 1px solid var(--accent); color: #bae6fd; }

/* ---------- Fenêtre modale de connexion ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 420px;
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ---------- Blog ---------- */
.blog-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.blog-header h1 { margin: 0; }

.post-card { cursor: pointer; transition: border-color 0.15s; }
.post-card:hover { border-color: var(--accent); }
.post-card h2 { margin: 0 0 0.4rem; font-size: 1.3rem; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }

.post-meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.7rem; }
.post-excerpt { color: var(--text); margin: 0 0 0.9rem; line-height: 1.5; }

.post-stats {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  flex-wrap: wrap;
}
.post-stats .avg { color: var(--gold); font-weight: 700; }

.post-full p { line-height: 1.65; white-space: pre-wrap; }
.back-link { color: var(--accent); text-decoration: none; font-weight: 600; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { text-decoration: underline; }

/* Réactions */
.reactions { display: flex; gap: 0.6rem; margin: 1.2rem 0; flex-wrap: wrap; }
.reaction {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}
.reaction .count { font-size: 0.85rem; color: var(--muted); }
.reaction.active { border-color: var(--accent); background: rgba(56, 189, 248, 0.15); }
.reaction.active .count { color: var(--accent); }
.reaction:disabled { opacity: 0.55; cursor: not-allowed; }

/* Notes étoiles */
.rating-block { margin: 1.2rem 0; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.rating-block .label { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.5rem; }
.star-row { display: inline-flex; gap: 0.15rem; }
.star {
  background: none;
  border: none;
  font-size: 1.7rem;
  cursor: pointer;
  color: #475569;
  padding: 0 0.1rem;
}
.star.filled { color: var(--gold); }
.star:disabled { cursor: default; }
.rating-summary { color: var(--muted); font-size: 0.88rem; margin-top: 0.4rem; }
.rating-summary strong { color: var(--gold); }

/* Commentaires */
.comments h3 { margin: 0 0 0.8rem; }
.comment {
  border-top: 1px solid var(--border);
  padding: 0.8rem 0;
}
.comment:first-of-type { border-top: none; }
.comment-head { display: flex; gap: 0.6rem; align-items: baseline; margin-bottom: 0.3rem; }
.comment-author { font-weight: 700; font-size: 0.88rem; }
.comment-date { color: var(--muted); font-size: 0.78rem; }
.comment p { margin: 0; line-height: 1.5; }
.empty { color: var(--muted); font-style: italic; }

footer { padding: 1.5rem; text-align: center; }

/* Grille des articles du blog (2 colonnes sur ordinateur) */
.posts-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
.posts-grid .post-card { margin-bottom: 0; }

/* Mise en page d'un article : contenu + barre latérale (ordinateur) */
.post-layout {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1fr;
}
.post-side { display: flex; flex-direction: column; gap: 1.2rem; }
.side-card h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.side-card p { margin: 0.2rem 0; }
.stat-list { list-style: none; padding: 0; margin: 0; }
.stat-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}
.stat-list li:last-child { border-bottom: none; }
.stat-list strong { color: var(--gold); }

/* ---------- Page personnelle ---------- */
.author-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.author-link:hover { text-decoration: underline; }
.profile-head { display: flex; gap: 1.2rem; align-items: center; }
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #0f172a;
  flex-shrink: 0;
}
.profile-info h1 { margin: 0 0 0.3rem; font-size: 1.6rem; }
.profile-info p { margin: 0; }
.profile-posts-title { margin: 1.6rem 0 1rem; font-size: 1.3rem; }

/* ---------- Connexion sociale (Google / Facebook) ---------- */
.oauth-block { margin-top: 1.1rem; }
.oauth-sep {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}
.oauth-sep::before, .oauth-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
}
.oauth-icon {
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ---------- Photos ---------- */
.mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -4px;
  margin-right: 0.35rem;
}
.mini-letter { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-size: 0.62rem; font-weight: 800; }
.post-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 10px;
  margin: 0.4rem 0 0.8rem;
}
.post-image-full {
  max-width: 100%;
  border-radius: 10px;
  margin: 0.8rem 0;
}
.avatar-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-edit { margin-top: 0.6rem; }
.avatar-edit summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.avatar-edit .form { margin-top: 0.6rem; }

/* ---------- Paramètres (langue) ---------- */
.icon-btn { font-size: 1.05rem; padding: 0.45rem 0.55rem; line-height: 1; }
.settings-wrap { position: relative; }
.settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  min-width: 190px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 100;
}
.settings-title {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.5rem 0.35rem;
}
.settings-label { font-size: 0.85rem; color: var(--muted); padding: 0 0.5rem 0.35rem; }
.settings-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}
.settings-item:hover { background: rgba(56, 189, 248, 0.12); }
.settings-item.active { background: rgba(251, 191, 36, 0.15); color: var(--gold); font-weight: 600; }

/* ---------- Améliorations ordinateur ---------- */
@media (min-width: 900px) {
  .hero { padding: 4.5rem 2rem; }
  .hero h1 { font-size: 3.2rem; }
  .hero p { font-size: 1.2rem; }

  .home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    align-items: start;
  }
  .home-grid .card { margin-bottom: 0; }

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

  .posts-grid { grid-template-columns: repeat(2, 1fr); }

  .post-layout {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: start;
  }
  .post-side { position: sticky; top: 90px; }
}

/* ---------- Relooking : animations, squelettes, toasts, fil, badges ---------- */
@media (prefers-reduced-motion: no-preference) {
  main > * { animation: viewFade 0.25s ease; }
  @keyframes viewFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
  .modal-card { animation: modalIn 0.2s ease-out; }
  @keyframes modalIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to { opacity: 1; transform: none; }
  }
  .card { transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
  .post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  }
  .btn, .reaction, .star { transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease; }
  .btn:active { transform: scale(0.97); }
  .reaction:active { transform: scale(1.18); }
  .star:active { transform: scale(1.3); }
}

/* Squelettes de chargement */
.skel {
  background: linear-gradient(90deg, var(--skel) 25%, var(--skel-hi) 50%, var(--skel) 75%);
  background-size: 200% 100%;
  border-radius: 8px;
}
@media (prefers-reduced-motion: no-preference) {
  .skel { animation: shimmer 1.3s infinite; }
  @keyframes shimmer { to { background-position: -200% 0; } }
}
.skel-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skel-title { height: 20px; width: 60%; margin: 0.8rem 0; }
.skel-line { height: 12px; margin: 0.5rem 0; }
.skel-line.short { width: 75%; }

/* Notifications toast */
#toasts {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  max-width: 90vw;
  animation: toastIn 0.25s ease;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
}
.toast.out { opacity: 0; transform: translateY(10px); }

/* Fil social */
.post-head { display: flex; gap: 0.7rem; align-items: center; margin-bottom: 0.5rem; }
.feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.feed-avatar-letter {
  background: linear-gradient(135deg, var(--gold), var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
}
.post-head-info { display: flex; flex-direction: column; }
.post-head-name { font-weight: 700; font-size: 0.92rem; }
.post-head-date { color: var(--muted); font-size: 0.78rem; }
.composer-head { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.8rem; }
.composer-head h2 { margin: 0; font-size: 1.15rem; }

/* Bannière de profil */
.profile-top { padding: 0 1.5rem 1.5rem; overflow: hidden; }
.profile-banner {
  height: 150px;
  margin: 0 -1.5rem 1.2rem;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(120deg, var(--accent-dark), var(--accent));
  background-size: cover;
  background-position: center;
}
.banner-edit { margin-top: 0.6rem; }
.banner-edit summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.banner-edit .form { margin-top: 0.6rem; }

/* Badges de membres */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--gold);
  border: 1px solid rgba(251, 191, 36, 0.4);
  margin-left: 0.4rem;
  vertical-align: 1px;
  white-space: nowrap;
}
.badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.badge-row .badge { margin-left: 0; }

@media (max-width: 560px) {
  .auth-area .user-email { display: none; }
  .hero h1 { font-size: 2rem; }
}

/* ---------- Navigation mobile : 2 lignes, aucun débordement horizontal ---------- */
@media (max-width: 860px) {
  body { overflow-x: hidden; }
  .nav-inner {
    flex-wrap: wrap;
    gap: 0.45rem 0.7rem;
    padding: 0.55rem 0.9rem;
  }
  .brand { order: 1; }
  .auth-area {
    order: 2;
    margin-left: auto;
    gap: 0.45rem;
    flex-wrap: nowrap;
  }
  .auth-area .user-email { display: none; }
  .auth-area .btn { padding: 0.45rem 0.6rem; }
  .settings-wrap { order: 3; }
  .nav-links {
    order: 4;
    flex: 1 1 100%;
    justify-content: space-between;
    gap: 0.25rem;
  }
  .nav-links a { padding: 0.4rem 0.55rem; font-size: 0.95rem; }
  /* Le panneau de notifications devient plein largeur utile, bien cadré */
  .notif-panel {
    position: fixed;
    top: 7rem;
    right: 0.6rem;
    left: 0.6rem;
    width: auto;
  }
}

/* ---------- Pack social : onglets, recherche, notifications, messages ---------- */
.seg-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.seg-tab {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.seg-tab.active { background: var(--accent); border-color: var(--accent); color: #082f49; }

.search-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 1rem;
}
.search-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Boutons icônes avec compteur (notifications, messages) */
.icon-wrap { position: relative; display: inline-flex; }
.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Panneau de notifications */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(340px, 88vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 100;
  padding: 0.5rem;
  max-height: 60vh;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.notif-item:hover { background: rgba(56, 189, 248, 0.12); }
.notif-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.4rem;
  flex-shrink: 0;
}
.notif-item .dot.read { background: transparent; }
.notif-item .when { color: var(--muted); font-size: 0.75rem; }
.notif-actions { padding: 0.3rem 0.5rem; }
.notif-actions button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

/* Actions du propriétaire (modifier / supprimer) */
.owner-actions { display: flex; gap: 0.5rem; margin: 0.8rem 0; flex-wrap: wrap; }
.btn.danger { border-color: var(--error); color: var(--error); }
.btn.danger:hover { background: rgba(248, 113, 113, 0.12); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.comment-actions { display: flex; gap: 0.4rem; margin-top: 0.3rem; }
.comment-actions button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
}
.comment-actions button:hover { color: var(--accent); }
.link-danger:hover { color: var(--error) !important; }

/* Bouton Suivre */
.follow-btn.following { background: rgba(74, 222, 128, 0.15); border-color: var(--success); color: var(--success); }

/* Annuaire des membres */
.member-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.member-card { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; margin-bottom: 0; }
.member-top { display: flex; gap: 0.7rem; align-items: center; }
.member-card .small { margin: 0; }

/* Messagerie */
.convo-item {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.convo-item:first-of-type { border-top: none; }
.convo-item:hover { opacity: 0.85; }
.convo-main { flex: 1; min-width: 0; }
.convo-last {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.convo-unread {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #082f49;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thread-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble {
  max-width: 78%;
  padding: 0.55rem 0.85rem;
  border-radius: 16px;
  background: var(--hover-bg);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-row.mine .msg-bubble { background: var(--accent); color: #082f49; border-bottom-right-radius: 4px; }
.msg-row:not(.mine) .msg-bubble { border-bottom-left-radius: 4px; }
.msg-when { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }
.msg-row.mine .msg-when { text-align: right; }
.msg-form { display: flex; gap: 0.6rem; align-items: flex-end; }
.msg-form textarea {
  flex: 1;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}
.msg-form .primary { width: auto; margin-top: 0; padding: 0.7rem 1.2rem; }

/* ---------- Polissage esthétique 2 ---------- */
.navbar { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.brand {
  color: var(--accent);
}
.btn.primary, .primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
}
.btn.primary:hover, .primary:hover {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
}
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.18), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(251, 191, 36, 0.14), transparent 45%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero h1 .accent {
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}
.reaction.active[data-reaction="like"] { border-color: var(--accent); background: rgba(56, 189, 248, 0.15); }
.reaction.active[data-reaction="star"] { border-color: var(--gold); background: rgba(251, 191, 36, 0.15); }
.reaction.active[data-reaction="star"] .count { color: var(--gold); }
.reaction.active[data-reaction="heart"] { border-color: #f472b6; background: rgba(244, 114, 182, 0.15); }
.reaction.active[data-reaction="heart"] .count { color: #f472b6; }
.post-card .post-image { transition: transform 0.3s ease; }
.post-card:hover .post-image { transform: scale(1.02); }
.seg-tab.active { box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3); }
.badge { box-shadow: 0 2px 8px rgba(251, 191, 36, 0.22); }
footer {
  border-top: 1px solid var(--border);
  background: var(--nav-bg);
  margin-top: 2rem;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 8px; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; }
::selection { background: rgba(56, 189, 248, 0.35); }

/* ---------- Administration ---------- */
.featured-chip { display: inline-block; margin: 0.35rem 0; padding: 0.12rem 0.6rem; border-radius: 999px; background: linear-gradient(135deg, #ffe9a8, #f5b921); color: #6b4e00; font-size: 0.75rem; font-weight: 800; }

.banned-chip { display: inline-block; margin-left: 0.45rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: #d43a2f; color: #fff; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle; }
.report-row { border-top: 1px solid var(--border); padding: 0.65rem 0; }
.admin-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; align-items: center; }
.admin-actions { margin-top: 0.5rem; }

/* ---------- Pastille administrateur ---------- */
.admin-chip { display: inline-block; margin-left: 0.45rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle; }

/* ---------- Médailles des badges (dessinées, paliers métal) ---------- */
.medal {
  --m1: #f4f6f8;
  --m2: #9aa7b4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 52%),
    linear-gradient(145deg, var(--m1), var(--m2));
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.22), inset 0 -3px 6px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(0, 0, 0, 0.35);
  color: #263445;
  flex: none;
}
.medal svg { width: 62%; height: 62%; }
.medal-bronze { --m1: #f3bc85; --m2: #a96a2e; color: #4d2c0d; }
.medal-silver { --m1: #fbfdff; --m2: #93a5b5; color: #2e3d4d; }
.medal-gold { --m1: #ffedb0; --m2: #dfa00c; color: #5c3d05; }
.medal-diamond { --m1: #e3f7ff; --m2: #57b9dd; color: #0c4356; }
.medal-sm { width: 22px; height: 22px; }
.medal-md { width: 34px; height: 34px; }
.medal-lg { width: 76px; height: 76px; }
.badge-ico { display: inline-flex; margin-left: 0.3rem; vertical-align: -5px; }
.badge-more {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--gold);
  border: 1px solid rgba(251, 191, 36, 0.4);
  margin-left: 0.3rem;
  vertical-align: 1px;
}
.badge-row .badge { padding-left: 0.3rem; }
.blog-header h1 .medal { vertical-align: -7px; }

/* ---------- Page Récompenses (badges) ---------- */
.badges-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-top: 1.2rem;
}
.badge-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 0.8rem 0.9rem;
  text-align: center;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.badge-card:hover { transform: translateY(-3px); }
.badge-card.earned {
  border-color: var(--gold);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.18);
}
.badge-card.locked .badge-card-medal {
  filter: grayscale(1);
  opacity: 0.45;
}
.badge-card-medal {
  margin-bottom: 0.5rem;
  line-height: 1;
}
.badge-card-lock svg { width: 16px; height: 16px; display: block; }
.badge-card-name {
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.badge-card-lock {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-size: 0.85rem;
  opacity: 0.6;
}
.progress-wrap {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin: 0.9rem 0 0.4rem;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  transition: width 0.4s ease;
}

/* ---------- Pack 2 (étape A) : tags, tendances, réponses ---------- */
.tag-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.tag-link:hover { text-decoration: underline; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card);
  border: 1px solid var(--gold);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  margin: 0.8rem 0 0;
  font-weight: 600;
}
.tag-chip button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
}
.tag-chip button:hover { color: var(--text); }
.replies {
  margin-left: 1.4rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--border);
}
.comment.reply { margin-top: 0.7rem; }
.reply-form { margin-top: 0.6rem; }
.reaction.active[data-reaction="laugh"] { border-color: #f59e0b; background: rgba(245, 158, 11, 0.15); }
.reaction.active[data-reaction="laugh"] .count { color: #f59e0b; }
.reaction.active[data-reaction="wow"] { border-color: #a78bfa; background: rgba(167, 139, 250, 0.15); }
.reaction.active[data-reaction="wow"] .count { color: #a78bfa; }
.reaction.active[data-reaction="sad"] { border-color: #60a5fa; background: rgba(96, 165, 250, 0.15); }
.reaction.active[data-reaction="sad"] .count { color: #60a5fa; }

/* ---------- Pack 2 (étape B) : sondages, favoris, épingles ---------- */
.poll { margin: 0.8rem 0 0.4rem; display: flex; flex-direction: column; gap: 0.45rem; }
.poll-opt-btn {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  font: inherit;
}
.poll-opt-btn:hover { border-color: var(--accent); }
.poll-opt-btn.mine { border-color: var(--gold); }
.poll-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(56, 189, 248, 0.16);
  z-index: 0;
}
.poll-label, .poll-pct { position: relative; z-index: 1; }
.poll-pct { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.poll-toggle { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; cursor: pointer; }
.form label.poll-toggle { display: flex; }
.poll-toggle input[type="checkbox"] { width: auto; flex: none; margin: 0; padding: 0; }
.confirm-actions { display: flex; gap: 0.8rem; justify-content: flex-end; margin-top: 1.2rem; }
#confirm-text { font-size: 1.05rem; margin: 0.2rem 0 0; }
.poll-opts { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.bm-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.45;
  padding: 0.1rem 0.3rem;
  margin-left: auto;
  filter: grayscale(1);
}
.bm-btn.active { opacity: 1; filter: none; }
.bm-detail.active { border-color: var(--gold); color: var(--gold); }
.post-tools { display: flex; gap: 0.6rem; margin: 0.9rem 0 0.2rem; flex-wrap: wrap; }
.pin-row { margin-top: 0.5rem; }

/* ---------- Pack 2 (étape C) : vérifié, partage, blocage, masquage ---------- */
.verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.72em;
  margin-left: 0.35rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.settings-accent {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.settings-accent input[type="color"] {
  width: 3rem;
  height: 2.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  padding: 0.2rem;
}
.hidden-chip {
  display: inline-block;
  background: rgba(244, 114, 182, 0.12);
  border: 1px solid rgba(244, 114, 182, 0.5);
  color: var(--text);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  margin: 0.4rem 0;
}
