/* ==========================================================================
   VARIABLES GLOBALES (LE COEUR DU THEME)
   ========================================================================== */
:root {
    /* Empêche Chrome/Android d'appliquer son "auto dark mode" sur les images
       (notamment les SVG Twemoji qu'il inverse en négatif). Le mot-clé "only"
       dit au navigateur : ce site gère lui-même son mode sombre, ne touche rien. */
    color-scheme: only dark;

    /* Couleurs d'Accentuation (Hexa pour textes/bordures) */
    --theme-primary: #ffb75e;
    --theme-danger: #f85149;
    --theme-success: #3fb950;
    --theme-warning: #ffb75e;
    
    /* Couleurs RGB */
    --theme-primary-rgb: 255, 183, 94;
    --theme-danger-rgb: 248, 81, 73;
    --theme-success-rgb: 63, 185, 80;

    /* Couleurs de l'Interface */
    --bg-base: #0d1117;
    --bg-surface: #161b22;
    --bg-surface-hover: rgba(255, 255, 255, 0.05);
    --border-subtle: #30363d;

    /* Typographie */
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --text-bright: #ffffff;
    
    /* Paramètres système */
    --glass-bg: rgba(13, 1, 1, 0.7);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-title: 'Orbitron', sans-serif;
}

/* ==========================================================================
   RÉINITIALISATION ET BASES
   ========================================================================== */
* { 
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100vh;
    width: 100%;
    overflow: hidden !important;
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
}

h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 15px;
}

/* --- LE STANDARD DES SÉPARATEURS --- */
.chaos-separator {
    width: 80%;
    height: 1px;
    background: rgba(var(--theme-primary-rgb), 0.2);
    margin: 15px auto;
    position: relative;
    border: none;
}

.chaos-separator::before {
    content: "";
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 4px;
    background: var(--theme-primary);
    border-radius: 2px;
    box-shadow: 
        0 0 5px var(--theme-primary),
        0 0 10px var(--theme-primary),
        0 0 20px rgba(var(--theme-primary-rgb), 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0% { opacity: 0.8; box-shadow: 0 0 10px var(--theme-primary); }
    50% { opacity: 1; box-shadow: 0 0 18px var(--theme-primary); }
    100% { opacity: 0.8; box-shadow: 0 0 10px var(--theme-primary); }
}

/* ==========================================================================
   ÉCRAN D'AUTHENTIFICATION (LOGIN)
   ========================================================================== */
.auth-container {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    z-index: 99999;
    pointer-events: auto;
    background: var(--bg-base);
}

/* ── Panneau gauche : marque ─────────────────────────────────────────────── */

.auth-brand {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 60px 48px;
    background: linear-gradient(145deg, #0a0c14 0%, #12091e 55%, #0d1117 100%);
}

.auth-brand-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.auth-brand-bg::before {
    content: '';
    position: absolute;
    width: 640px;
    height: 640px;
    background: radial-gradient(circle, rgba(155,109,255,.13) 0%, rgba(255,94,138,.06) 45%, transparent 70%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: authBlob1 8s ease-in-out infinite alternate;
}

.auth-brand-bg::after {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(255,94,138,.1) 0%, transparent 70%);
    border-radius: 50%;
    bottom: 12%;
    right: 8%;
    animation: authBlob2 6s ease-in-out infinite alternate-reverse;
}

@keyframes authBlob1 {
    0%   { transform: translate(-50%,-50%) scale(.88); opacity: .6; }
    100% { transform: translate(-50%,-50%) scale(1.12); opacity: 1; }
}

@keyframes authBlob2 {
    0%   { transform: scale(.9); opacity: .4; }
    100% { transform: scale(1.2); opacity: .85; }
}

.auth-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 440px;
    width: 100%;
}

.auth-brand-logo {
    margin-bottom: 0;
}

@keyframes authTitleGlitch {
    0%, 86%, 100% { filter: none; transform: none; }
    87%  { filter: drop-shadow(-2px 0 #ff5e8a) drop-shadow(2px 0 #9b6dff); transform: translateX(2px); }
    88%  { filter: drop-shadow(2px 0 #ff5e8a) drop-shadow(-2px 0 #9b6dff); transform: translateX(-2px); }
    89%  { filter: none; transform: translateX(1px); }
    90%  { filter: drop-shadow(-1px 0 rgba(255,94,138,.45)); transform: none; }
}

.auth-brand-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4.2rem;
    font-weight: 800;
    letter-spacing: .22em;
    background: linear-gradient(90deg, #ff5e8a, #9b6dff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    margin-bottom: 0;
    animation: authTitleGlitch 7s ease-in-out infinite;
}

.auth-brand-tagline {
    font-family: 'Courier New', monospace;
    font-size: .76rem;
    letter-spacing: .1em;
    color: rgba(155,109,255,.65);
    margin: 12px 0 0;
    padding: 0;
    border: none;
    font-style: normal;
    line-height: 1.5;
    text-transform: uppercase;
}

/* ── Lorenz décoratif (auth brand) ───────────────────────────────────────── */

.auth-lorenz-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: .28;
    pointer-events: none;
    z-index: 0;
    filter: drop-shadow(0 0 12px rgba(155,109,255,.3));
}

/* ── Carousel de présentation (ancré en bas du panneau) ─────────────────── */

.auth-brand-carousel {
    position: absolute;
    bottom: 52px;
    left: 48px;
    right: 48px;
    z-index: 2;
}

.auth-brand-carousel::before {
    content: '';
    display: block;
    width: 28px;
    height: 1px;
    background: #d4a843;
    opacity: .7;
    margin-bottom: 12px;
}

.auth-carousel-text {
    font-family: 'Orbitron', sans-serif;
    font-size: .88rem;
    font-weight: 400;
    letter-spacing: .08em;
    color: #d4a843;
    opacity: 0;
    display: inline-block;
}

.auth-carousel-text.carousel-in {
    animation: carouselMaterialize .65s cubic-bezier(.22,1,.36,1) forwards;
}

.auth-carousel-text.carousel-out {
    animation: carouselDust .6s ease-in forwards;
}

@keyframes carouselMaterialize {
    0%   { opacity: 0; transform: translateX(-18px) scale(.93); filter: blur(7px); }
    55%  { opacity: .88; transform: translateX(2px) scale(1.01); filter: blur(.6px); }
    100% { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}

@keyframes carouselDust {
    0%   { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
    22%  { opacity: .78; transform: translateX(6px) scale(1.01); filter: blur(1px); }
    58%  { opacity: .32; transform: translateX(22px) scale(.97); filter: blur(4px); }
    100% { opacity: 0; transform: translateX(44px) scale(.89); filter: blur(9px); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand-title, .auth-lorenz-bg,
    .auth-brand-bg::before, .auth-brand-bg::after,
    .auth-panel::after { animation: none; }
    .auth-carousel-text.carousel-in  { animation: none; opacity: 1; filter: none; transform: none; }
    .auth-carousel-text.carousel-out { animation: none; opacity: 0; }
}

/* ── Panneau droit : terminal CRT ────────────────────────────────────────── */

.auth-panel {
    position: relative;
    flex-shrink: 0;
    width: 420px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #03040a;
    overflow: hidden;
    border-left: 1px solid transparent;
    border-image: linear-gradient(to bottom,
        transparent 0%,
        rgba(155,109,255,.7) 30%,
        rgba(255, 94,138,.5) 70%,
        transparent 100%) 1;
}

/* Vignette intérieure subtile */
.auth-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 45% 38%, rgba(155,109,255,.055) 0%, transparent 62%);
    pointer-events: none;
    z-index: 0;
}

/* Scanlines CRT avec flicker — z-index 10 pour passer au-dessus du cadre */
.auth-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(160,130,255,.09),
        rgba(160,130,255,.09) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 10;
    animation: scanlineFlicker 5s ease-in-out infinite;
}

@keyframes scanlineFlicker {
    0%, 100% { opacity: .55; }
    46%  { opacity: .65; }
    50%  { opacity: .38; }
    51%  { opacity: .72; }
    52%  { opacity: .55; }
    82%  { opacity: .6; }
    84%  { opacity: .3; }
    85%  { opacity: .68; }
}

/* Formulaire flottant dans le chaos */
.auth-box {
    position: relative;
    z-index: 2;
    width: calc(100% - 52px);
    max-width: 348px;
    padding: 40px 36px;
    text-align: center;
    background: rgba(3,4,10,.78);
    border-radius: 16px;
    border: 1px solid rgba(155,109,255,.13);
    box-shadow:
        0 6px 60px rgba(0,0,0,.75),
        inset 0 1px 0 rgba(255,255,255,.04),
        0 0 0 1px rgba(255,255,255,.02);
}

.auth-view-title {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: .06em;
    margin-bottom: 24px;
}

.auth-box input {
    width: 100%;
    margin-bottom: 12px;
    padding: 12px 14px;
    background-color: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 8px;
    color: var(--text-bright);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    font-size: .9rem;
}

.auth-box input::placeholder {
    color: #484f58;
}

.auth-box input:focus {
    border-color: rgba(155,109,255,.65);
    box-shadow: 0 0 0 3px rgba(155,109,255,.1);
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-buttons .cyber-btn:first-child {
    background-color: var(--theme-primary);
    color: var(--bg-base);
    border: none;
    transition: background-color 0.2s, transform 0.1s;
}

.auth-buttons .cyber-btn:first-child:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.auth-buttons .cyber-btn:first-child:active {
    transform: translateY(0);
}

.auth-buttons .btn-alt {
    background-color: var(--bg-surface) !important;
    color: var(--text-main);
    border: 1px solid var(--border-subtle) !important;
}

.auth-footer {
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.auth-footer span {
    color: var(--theme-primary);
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s, filter 0.2s;
}

.auth-footer span:hover {
    filter: brightness(1.2) drop-shadow(0 0 5px var(--theme-primary));
}

/* Sur l'écran auth, pas de thème user actif → on utilise la couleur de marque */
.auth-panel .auth-footer span {
    color: #9b6dff;
}

.auth-panel .auth-footer span:hover {
    filter: brightness(1.2) drop-shadow(0 0 6px rgba(155,109,255,.6));
}

.oauth-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    color: #484f58;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.oauth-separator::before,
.oauth-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #30363d;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-base);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.btn-google:hover {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.18);
    box-shadow: 0 2px 10px rgba(0,0,0,.35);
    color: var(--text-bright);
}

.error-msg {
    color: var(--theme-danger);
    font-size: 0.8rem;
    margin-top: 10px;
    min-height: 1.2em;
}

/* Petit shake d'attention quand l'auth échoue (DA Chaos) */
@keyframes auth-error-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
.auth-error-shake {
    animation: auth-error-shake 0.4s ease;
    font-weight: 600;
}

/* === Modale profil étendue : onglets + listes « en commun » === */
.ext-tab {
    color: #8b949e;
    cursor: pointer;
    font-weight: 600;
    padding-bottom: 10px;
    margin-bottom: -11px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.ext-tab.actif {
    color: #f0f6fc;
    border-bottom-color: var(--theme-primary, #58a6ff);
}
.ext-tab[hidden] { display: none; }

.ext-common-list {
    flex-direction: column;
    gap: 6px;
    max-height: 58vh;
    overflow-y: auto;
}
.ext-common-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}
.ext-common-row:hover { background: rgba(255, 255, 255, 0.06); }
.ext-common-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #0d1117;
}
.ext-common-nom { color: #f0f6fc; font-size: 0.92rem; }
.ext-common-empty { color: #8b949e; text-align: center; padding: 36px 0; }

/* ==========================================================================
   MENU CONTEXTUEL
   ========================================================================== */

.context-menu {
    position: fixed;
    display: none;
    z-index: 10000;
    background: linear-gradient(
        rgba(var(--theme-primary-rgb), 0.1), 
        rgba(var(--theme-primary-rgb), 0.1)
    ), rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    border-radius: 8px;
    width: 180px;
    padding: 5px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.menu-item {
    padding: 10px 15px;
    cursor: pointer;
    color: #fce4e4;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.menu-item:hover {
    background: rgba(var(--theme-primary-rgb), 0.2);
}

.menu-item.delete {
    color: var(--theme-danger);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.menu-item.delete:hover {
    background: rgba(var(--theme-danger-rgb), 0.4);
}

.icon-btn-mini {
    background: none;
    border: none;
    color: var(--chaos-red);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    opacity: 0.5;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-mini:hover {
    opacity: 1;
    transform: rotate(90deg);
    text-shadow: 0 0 8px var(--chaos-red);
}

.alert-box {
    border: 2px solid var(--theme-danger) !important;
    box-shadow: 0 0 30px rgba(var(--theme-danger-rgb), 0.4) !important;
    max-width: 400px;
}

#alert-message {
    color: #fce4e4;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    line-height: 1.6;
}

#vortex-container {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 150px;
    z-index: 1000;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

#vortex-container.active {
    bottom: 20px;
    pointer-events: all;
}

.vortex {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #000 20%, var(--theme-danger) 70%, transparent 100%);
    border-radius: 50%;
    box-shadow: 0 0 30px var(--theme-danger);
    animation: spin-vortex 1s linear infinite;
    position: relative;
}

.vortex-label {
    color: var(--theme-danger);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    margin-top: 10px;
    text-shadow: 0 0 5px #000;
}

@keyframes spin-vortex {
    from { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); opacity: 0.8; }
    to { transform: rotate(360deg) scale(1); }
}

/* ==========================================================================
   SOCIAL
   ========================================================================== */

/* =========================================
   BOUTON ACCUEIL (LE VORTEX DU CHAOS)
========================================= */
.home-chaos-btn {
    background: transparent;
    border: none;
    color: #8b949e;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 8px;
}

.home-chaos-btn #lorenz-canvas {
    width: 44px;
    height: 44px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
}

.home-chaos-btn:hover #lorenz-canvas {
    transform: scale(1.08);
    filter: drop-shadow(0 0 6px var(--theme-primary, #d44dff));
}

.home-chaos-btn.active #lorenz-canvas {
    filter: drop-shadow(0 0 10px var(--theme-primary, #d44dff));
}

@media (prefers-reduced-motion: reduce) {
    .home-chaos-btn #lorenz-canvas { transition: none; }
}

@keyframes slow-vortex-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.view-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#vue-social {
    padding: 20px;
    color: #e6edf3;
    overflow-y: auto;
    height: 100%;
}

.social-trigger {
    position: relative;
}

.sphere-icon.social-trigger {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible;
}

.sphere-icon.social-trigger img {
    width: 50px !important;
    height: 50px !important;
    object-fit: contain;
    filter: invert(1);
    padding: 4px;
    margin: auto;
}

.sphere-icon.social-trigger:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

/* --- LE STYLE DU DRAG & DROP --- */
.sphere-icon.dragging {
    background: rgba(var(--theme-primary-rgb), 0.1) !important;
    border: 2px dashed rgba(var(--theme-primary-rgb), 0.5) !important;
    box-shadow: inset 0 0 15px rgba(var(--theme-primary-rgb), 0.2) !important;
    transform: scale(0.9);
    color: transparent !important;
}

.draggable-sphere {
    cursor: grab;
}

/* Badge de notification sur les sphères — positionné sur .sphere-btn-wrapper */
.sphere-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--theme-danger, #f85149);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    border-radius: 9px;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(248, 81, 73, 0.6);
    z-index: 10;
}

.sphere-notif-badge.sphere-badge-mention {
    background: var(--theme-primary);
    box-shadow: 0 0 8px var(--theme-primary);
}

/* Badge de notification par salon (dans la liste de salons d'une sphère).
   Calqué sur le badge de sphère : pastille rouge = non-lu générique,
   pastille thémée = on t'a mentionné dans ce salon. */
.channel-unread-badge {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    background: var(--theme-danger, #f85149);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    border-radius: 9px;
    line-height: 17px;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(248, 81, 73, 0.6);
    z-index: 5;
}
.channel-unread-badge.channel-badge-mention {
    background: var(--theme-primary);
    box-shadow: 0 0 8px var(--theme-primary);
}
/* Le salon vocal a sa liste de membres dessous → on accroche le badge
   en haut de la ligne du nom, pas centré sur toute la hauteur. */
.channel-item.vocal .channel-unread-badge {
    top: 13px;
    transform: none;
}

/* Mentions @pseudo dans les messages */
.mention {
    border-radius: 3px;
    padding: 1px 5px;
    font-weight: 600;
    cursor: default;
    /* color et background définis en inline style depuis la couleur de l'agent */
}

.mention-self {
    font-weight: 700;
}

.sphere-icon.dragging img {
    opacity: 0 !important;
}

/* ===== Dossiers de sphères ===== */
.sphere-folder-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sphere-icon.folder-icon {
    /* --folder-bg-a/b et --folder-border sont surchargés en JS pour la couleur custom */
    --folder-bg-a: rgba(var(--theme-primary-rgb), 0.18);
    --folder-bg-b: rgba(var(--theme-primary-rgb), 0.04);
    --folder-border: rgba(var(--theme-primary-rgb), 0.5);
    background: linear-gradient(135deg, var(--folder-bg-a), var(--folder-bg-b)) !important;
    border: 1px solid var(--folder-border) !important;
    border-radius: 14px !important;
}

.folder-stack {
    position: relative;
    width: 36px;
    height: 36px;
    pointer-events: none;
}

.folder-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(var(--theme-primary-rgb), 0.3);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    background-size: cover;
    background-position: center;
}
.folder-dot[data-idx="0"] { top: 0; left: 8px; z-index: 3; width: 22px; height: 22px; }
.folder-dot[data-idx="1"] { bottom: 0; left: 0; z-index: 2; }
.folder-dot[data-idx="2"] { bottom: 2px; right: 0; z-index: 1; width: 18px; height: 18px; opacity: 0.7; }

.folder-members {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    max-height: 0;
    padding: 0;
    border-left: 2px solid rgba(var(--theme-primary-rgb), 0.2);
    margin-left: 2px;
    transition: max-height 0.3s ease, padding 0.2s ease;
}
.folder-members.open {
    max-height: 800px;
    padding: 6px 0;
}
.folder-members .sphere-icon {
    width: 40px !important;
    height: 40px !important;
}

/* Proposition de création de dossier */
.sphere-icon.folder-propose {
    border: 2px solid var(--theme-primary) !important;
    box-shadow: 0 0 18px rgba(var(--theme-primary-rgb), 0.75) !important;
    border-radius: 14px !important;
    animation: folder-pulse 0.9s ease-in-out infinite;
}
@keyframes folder-pulse {
    0%, 100% { box-shadow: 0 0 18px rgba(var(--theme-primary-rgb), 0.75); }
    50% { box-shadow: 0 0 30px rgba(var(--theme-primary-rgb), 0.95); transform: scale(1.06); }
}

.folder-propose-label {
    position: fixed;
    background: rgba(13, 17, 23, 0.96);
    border: 1px solid var(--theme-primary);
    color: var(--theme-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 99999;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(var(--theme-primary-rgb), 0.3);
}

/* ===== Menu contextuel dossier : section couleur ===== */
.folder-ctx-color-section {
    padding: 6px 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.folder-ctx-label {
    display: block;
    font-size: 0.75rem;
    color: #8b949e;
    margin-bottom: 6px;
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
}
.folder-color-swatches, .tag-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.25); }
.color-swatch.selected { border-color: #fff; transform: scale(1.15); }

/* ===== Tooltip custom des sphères ===== */
#sphere-tooltip {
    position: fixed;
    z-index: 9998;
    pointer-events: none;
    display: none;
    max-width: 220px;
    background: rgba(8, 12, 20, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 12px rgba(var(--theme-primary-rgb), 0.1);
}
.stt-name {
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--theme-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stt-desc {
    font-size: 0.78rem;
    color: #8b949e;
    line-height: 1.4;
    margin-bottom: 6px;
    word-break: break-word;
}
.stt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.stt-tag {
    font-family: 'Orbitron', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 700;
    color: #0d1117;
    white-space: nowrap;
}

/* ===== Modal gestionnaire de tags ===== */
.tag-manager-box {
    background: linear-gradient(rgba(var(--theme-primary-rgb),0.06), rgba(var(--theme-primary-rgb),0.06)),
                rgba(10, 12, 20, 0.97);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    border-radius: 14px;
    padding: 22px 24px;
    width: min(420px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.tag-add-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(var(--theme-primary-rgb), 0.15);
}
#tag-new-input {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    border-radius: 6px;
    color: #f0f6fc;
    padding: 8px 10px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
#tag-new-input:focus { border-color: var(--theme-primary); box-shadow: 0 0 6px rgba(var(--theme-primary-rgb),0.3); }
.tag-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tag-pill-preview {
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700;
    color: #0d1117;
    flex-shrink: 0;
}
.tag-delete-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.tag-delete-btn:hover { color: #f85149; background: rgba(248,81,73,0.1); }

.sphere-dnd-placeholder {
    height: 60px;
    width: 60px;
    background: rgba(var(--theme-primary-rgb), 0.1);
    border: 2px dashed rgba(var(--theme-primary-rgb), 0.5);
    border-radius: 50%;
    margin-bottom: 15px;
    box-shadow: 0 0 15px rgba(var(--theme-primary-rgb), 0.2);
}

.social-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.social-header {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 1px solid #30363d;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.social-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.social-column h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 15px;
}

.btn-add-friend {
    background: rgba(255, 255, 255, 0.1);
    color: #888;
    border: none;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-friend:hover {
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
    transform: rotate(90deg);
}

.social-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 20px;
}

.social-subtitle-inbox {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 5px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 10px;
    text-align: center;
}

.demande-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.demande-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.btn-action svg {
    width: 20px;
    height: 20px;
    display: block;
}

.btn-action:hover svg {
    stroke: #ffffff !important;
}

.btn-action {
    background: #2b2d31;
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    outline: none;
}

.btn-action.accept:hover { background: #23a559; }
.btn-action.refuse:hover { background: #f23f43; }

.ami-avatar {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 10px;
    font-weight: bold;
    font-size: 0.8rem;
}

.ami-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin: 0 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    transition: background 0.1s;
    cursor: pointer;
}

.ami-card-row:first-child {
    border-top: none;
}

.ami-card-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-top-color: transparent;
}

.ami-card-row:hover + .ami-card-row {
    border-top-color: transparent;
}

.ami-left-side {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ami-name-group {
    display: flex;
    flex-direction: column;
}

.ami-pseudo-text {
    color: #dbdee1;
    font-weight: 500;
}

.ami-status-sub {
    font-size: 0.75rem;
    color: #b5bac1;
}

.ami-actions {
    display: flex;
    gap: 8px;
}

.ami-actions-side {
    display: flex;
    gap: 8px;
}

.action-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2b2d31;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b5bac1;
    transition: color 0.2s, background 0.2s;
}

.action-circle svg {
    width: 20px;
    height: 20px;
}

.action-circle:hover {
    color: #ffffff;
    background: #35373c;
}

.action-circle.more-trigger:hover {
    color: #f23f43;
}

/* Le bouton Inbox */
.request-inbox-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.request-inbox-trigger:hover {
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
}

/* Taille du SVG à l'intérieur */
.icon-inbox {
    width: 24px;
    height: 24px;
}

.badge-notif {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f23f43;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--bg-base);
}

/* Le volet déroulant */
.request-dropdown {
    position: absolute;
    top: 65px;
    left: 20px;
    width: 320px;
    max-height: 400px;
    background: var(--bg-base);
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: fadeInScale 0.2s ease-out;
}

.inbox-header {
    padding: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    border-bottom: 1px solid #30363d;
    letter-spacing: 1px;
}

#container-demandes-attente {
    overflow-y: auto;
    padding: 10px;
}

/* Animation d'apparition */
@keyframes fadeInScale {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   DASHBOARD
   ========================================================================== */

.dashboard-container {
    padding: 40px 20px;
    overflow-y: auto !important;
    flex: 1;
}

#dashboard-accueil {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px;
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.terminal-welcome {
    color: var(--text-main);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
}

.hint-tag {
    color: var(--text-muted);
}

.terminal-hint {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed #30363d;
}

.chat-main-area {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: transparent !important;
    overflow: hidden;
}

.news-item {
    color: var(--text-main);
    margin-bottom: 12px;
    list-style:none;
    font-size: 0.9rem;
}

.tag-tag-stable {
    background: #238636;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight:bold;
    margin-right:8px;
}

.tag-tag-glitch {
    background: #661a1a;
    color: var(--theme-danger);
    border: 1px solid var(--theme-danger);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight:bold;
    margin-right:8px;
}

.tag-tag-nouveau {
    background: rgba(255, 183, 94, 0.1);
    border: 1px solid var(--theme-primary);
    color: var(--theme-primary);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight:bold;
    margin-right:8px;
}

/* La vidéo en plein écran arrière-plan */
#bg-video-chaos {
    position: fixed !important;
    top: 0; left: 0; width: 100vw; height: 100vh;
    object-fit: cover;
    z-index: -2;
    opacity: 0.4;
}

#bg-custom-chaos {
    position: fixed !important;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    opacity: 0.4;
}

.video-overlay {
    position: fixed !important;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle, rgba(var(--theme-primary-rgb), 0.15) 0%, rgba(0, 0, 0, 0.85) 90%) !important;
    z-index: -1;
    pointer-events: none;
}


.dash-header {
    animation: glowPulse 3s infinite alternate;
    position: relative;
    z-index: 2;
    margin-top: 20px;
    text-align: center;
    margin-bottom: 40px;
}

.dash-content {
    position: relative;
    padding-top: 10px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80vh;
    margin-top: -60px;
}

@keyframes glowPulse {
    from { filter: drop-shadow(0 0 5px rgba(var(--theme-primary-rgb), 0.4)); }
    to { filter: drop-shadow(0 0 20px rgba(var(--theme-primary-rgb), 0.8)); }
}


.dash-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2rem;
    background: linear-gradient(90deg, var(--theme-primary), #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(var(--theme-primary-rgb), 0.4));
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 5px;
}

.dash-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 25px;
    width: 100%;
    max-width: 1200px;
    margin: 30px auto 0 auto;
    margin-top: 20px !important;
}

.dash-grid::-webkit-scrollbar { width: 4px; }
.dash-grid::-webkit-scrollbar-track { background: transparent; }
.dash-grid::-webkit-scrollbar-thumb { background: var(--theme-primary); border-radius: 10px; }

.dash-card {
    background: rgba(22, 27, 34, 0.8) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3) !important;
    border-radius: 8px;
    padding: 20px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(255, 183, 94, 0.1); 
    transition: box-shadow 0.3s ease;
}

.dash-card:hover {
    transform: translateY(-5px);
    border-color: var(--theme-primary);
    box-shadow: 0 0 15px rgba(255, 183, 94, 0.2);
}

.card-header {
    font-weight: bold;
    color: #f0f6fc;
    border-bottom: 1px solid #30363d;
    margin-bottom: 20px;
    padding-bottom: 10px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 2px;
}

.stat-value {
    font-size: 24px;
    display: block;
    color: var(--theme-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 8px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 5px;
    position: relative;
}

.dash-card:has(.btn-destruct) .card-header {
    position: relative;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 183, 94, 0.1);
}

.dash-card:has(.btn-destruct) .card-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 30px;
    opacity: 0.7;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="40" viewBox="0 0 400 40" preserveAspectRatio="none"><path d="M0,20 L40,20 L45,5 L55,35 L65,20 L120,20 L125,10 L130,30 L140,20 L210,20 L220,0 L235,40 L250,20 L320,20 L325,10 L335,30 L350,20 L400,20" fill="none" stroke="%23ffb75e" stroke-width="1.5"/></svg>');
    background-size: 100% 30px;
    background-repeat: no-repeat;
    -webkit-mask-image: linear-gradient(to right,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,0) var(--mask-pos, 0%),
        rgba(0,0,0,1) var(--mask-pos, 0%),
        rgba(0,0,0,0) calc(var(--mask-pos, 0%) + 10%)
    );
    mask-image: linear-gradient(to right,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,0) var(--mask-pos, 0%),
        rgba(0,0,0,1) var(--mask-pos, 0%),
        rgba(0,0,0,0) calc(var(--mask-pos, 0%) + 10%)
    );
    -webkit-mask-size: 200% 100%;
    mask-size: 200% 100%;
    animation: radarScan 4s linear infinite;
}

@keyframes radarScan {
    0% { -webkit-mask-position: 150% 0; }
    100% { -webkit-mask-position: -50% 0; }
}

#btn-destruct {
    background: #238636;
    transition: all 0.2s ease;
    text-transform: uppercase;
    border: 1px solid #30363d;
    font-weight: bold;
    position: relative;
    z-index: 2;
}

#btn-destruct:hover {
    background: var(--theme-danger);
    box-shadow: 0 0 20px rgba(248, 81, 73, 0.6);
    transform: scale(1.05) rotate(1deg);
    animation: jitter 0.1s infinite;
}

@keyframes jitter {
    0% { transform: translate(0,0); }
    25% { transform: translate(-1px, 1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, -1px); }
    100% { transform: translate(1px, 1px); }
}

.news-list li {
    color: var(--text-main);
    border-bottom: 1px solid #30363d;
    padding: 10px 0;
}

.news-list li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    font-size: 13px;
}

.news-tag {
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    margin-right: 5px;
}

.news-tag.update {
    background: #238636;
}

.news-tag.chaos {
    background: #8957e5;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

@keyframes shake {
    0% { transform: translate(0,0) scale(1); filter: hue-rotate(0deg); }
    10% { transform: translate(-10px, -10px) scale(1.03); filter: hue-rotate(90deg); }
    20% { transform: translate(10px, 10px) scale(0.97); }
    30% { transform: translate(-15px, 0px) scale(1.08); filter: invert(1); }
    40% { transform: translate(15px, -10px) scale(1); }
    50% { transform: translate(-5px, 15px) scale(1.15); filter: contrast(200%); }
    60% { transform: translate(20px, -20px) scale(0.9); }
    70% { transform: translate(-20px, 10px) scale(1.1); filter: hue-rotate(270deg); }
    80% { transform: translate(10px, 20px) scale(1); }
    90% { transform: translate(-10px, -10px) scale(1.05); }
    100% { transform: translate(0,0) scale(1); filter: hue-rotate(0deg); }
}

@keyframes chaos-opacity {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

.shake-anim {
    animation: shake 0.1s infinite, chaos-opacity 0.1s infinite;
    overflow: hidden;
    background-color: rgba(255, 0, 0, 0.1);
}

@media (max-width: 1000px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   BARRE LATERALE GAUCHE - SPHERES DU CHAOS
   ========================================================================== */

#spheres-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
}

.sphere-btn-wrapper {
    position: relative;
    display: flex;
    flex-shrink: 0;
}

.sphere-icon {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50%;
    background: rgba(22, 27, 34, 0.6) !important;
    border: 1px solid rgba(88, 166, 255, 0.2) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 50% !important;
    overflow: hidden;
    padding: 0;
}

.sphere-icon:hover {
    border-color: var(--theme-danger) !important;
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.4);
    border-radius: 15px;
    background: #30363d;
    transform: scale(1.1);
}

.sphere-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%; 
}

#dynamic-spheres {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    padding-left: 5px;
    padding-right: 5px;
}

/* Le conteneur de la bulle doit être en relatif pour le badge */
.active-contact-bubble {
    position: relative;
    overflow: visible !important;
}

/* Override .sphere-icon background !important via sélecteur plus spécifique */
.active-contact-bubble.sphere-icon {
    background-color: var(--bubble-color, rgba(22, 27, 34, 0.6)) !important;
    background-image: none !important;
}

.bubble-initial {
    color: white;
    font-weight: bold;
    font-size: 1em;
    pointer-events: none;
}

/* Le badge lui-même */
.bubble-notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e5302a;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0d0101;
    box-shadow: 0 0 8px rgba(229, 48, 42, 0.7);
    z-index: 10;
}

.close-bubble {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--theme-danger);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 20;
    border: 1px solid var(--bg-base);
}

.active-contact-bubble:hover .close-bubble {
    display: flex;
}



#self-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    border-color: #58a6ff !important;
}

#btn-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    border: none;
    font-size: 22px;
    transition: transform 0.2s;
    outline: none;
    color: var(--theme-primary);
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 2px rgba(88, 166, 255, 0.3));
    margin: 0;
    padding: 0;
}

#btn-settings:hover {
    transform: rotate(45deg);
    filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.8));
    cursor: pointer;
}

.logout-mini {
    background: none;
    border: none;
    color: var(--chaos-red);
    cursor: pointer;
    font-size: 1.2rem;
    margin-bottom: 5px;
    opacity: 0.6;
}

.logout-mini:hover {
    opacity: 1;
    filter: drop-shadow(0 0 5px var(--chaos-red));
}

/* ─── Dropdown paramètres rapides (restauré) ─── */
#profile-dropdown {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 20px;
    width: 290px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    background: rgba(13, 17, 23, 0.82);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.28);
    border-radius: 12px;
    padding: 14px 14px 10px;
    z-index: 9999;
    box-shadow: 0 16px 48px rgba(0,0,0,0.65), 0 0 0 1px rgba(var(--theme-primary-rgb), 0.08), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ─── Profile dropdown — composants ─── */
.pd-header {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted, #8b949e);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    margin-bottom: 4px;
}
.pd-body { display: flex; flex-direction: column; }
.pd-group { padding: 12px 0; border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.1); }
.pd-group:last-of-type { border-bottom: none; padding-bottom: 4px; }
.pd-group-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--theme-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}
.pd-field-label {
    font-size: 0.67rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 10px 0 6px;
}
.pd-field-label:first-child { margin-top: 0; }
.pd-profile-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.pd-avatar-upload { position: relative; width: 52px; height: 52px; cursor: pointer; flex-shrink: 0; }
.pd-avatar-preview {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #161b22 center/cover no-repeat;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: bold; color: white;
    transition: opacity 0.2s;
    border: 2px solid rgba(var(--theme-primary-rgb), 0.3);
}
.pd-avatar-upload:hover .pd-avatar-preview { opacity: 0.65; }
.pd-avatar-pencil {
    position: absolute; bottom: 0; right: -3px;
    width: 20px; height: 20px;
    background: var(--theme-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; color: #0d1117;
    border: 2px solid rgba(13,17,23,0.9);
    transition: transform 0.15s;
}
.pd-avatar-upload:hover .pd-avatar-pencil { transform: scale(1.15); }

/* ── Éditeur d'avatar ───────────────────────────────────────────────────── */
.avatar-crop-overlay {
    position: fixed; inset: 0; z-index: 200000;
    background: rgba(0,0,0,0.75);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.avatar-crop-box {
    background: #161b22;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 24px 20px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    min-width: 320px;
}
.avatar-crop-title {
    font-size: 1.05rem; font-weight: 700; color: #e6edf3;
}
.avatar-crop-hint {
    font-size: 0.75rem; color: #484f58; text-align: center;
}
.avatar-crop-stage {
    border-radius: 12px; overflow: hidden;
    background: #0d1117;
    cursor: grab;
    line-height: 0;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07);
}
.avatar-crop-stage:active { cursor: grabbing; }
#avatar-crop-canvas { display: block; }
.avatar-crop-zoom-row {
    display: flex; align-items: center; gap: 10px; width: 100%;
}
.avatar-zoom-icon { color: #484f58; font-size: 0.85rem; flex-shrink: 0; }
.avatar-zoom-slider {
    flex: 1;
    -webkit-appearance: none; appearance: none;
    height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.12);
    outline: none; cursor: pointer;
}
.avatar-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--theme-primary, #ffb75e);
    cursor: pointer; box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
.avatar-zoom-slider::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%; border: none;
    background: var(--theme-primary, #ffb75e);
    cursor: pointer;
}
.avatar-crop-actions {
    display: flex; gap: 10px; width: 100%; justify-content: flex-end;
}
.pd-textarea {
    background: rgba(13,17,23,0.7);
    border: 1px solid rgba(255,255,255,0.08);
    color: #c9d1d9;
    border-radius: 8px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.84rem;
    width: 100%;
    box-sizing: border-box;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}
.pd-textarea:focus {
    outline: none;
    border-color: rgba(var(--theme-primary-rgb), 0.6);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.12);
}
.pd-row { display: flex; align-items: center; }
.pd-swatch-item {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; padding: 4px 0;
    border-radius: 6px;
    transition: background 0.15s;
}
.pd-swatch-item:hover { background: rgba(var(--theme-primary-rgb), 0.06); }
.pd-swatch {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.18);
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.2s;
    background: #58a6ff;
}
.pd-swatch-item:hover .pd-swatch {
    transform: scale(1.18);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.25);
}
.pd-swatch-label { font-size: 0.86rem; color: #c9d1d9; font-weight: 500; }
/* Accordéons */
.pd-accordion { margin-top: 10px; }
.pd-accordion:first-child { margin-top: 0; }
.pd-acc-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; background: transparent; border: none;
    cursor: pointer; padding: 4px 0; gap: 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.pd-acc-toggle:hover { background: rgba(var(--theme-primary-rgb), 0.06); }
.pd-acc-left { display: flex; align-items: center; gap: 8px; flex: 1; }
.pd-acc-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pd-acc-preview {
    width: 40px; height: 24px;
    border-radius: 4px;
    background: #1a1a2e center/cover no-repeat;
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.pd-acc-chevron {
    font-size: 0.68rem; color: #8b949e;
    transition: transform 0.22s ease;
}
.pd-accordion.open .pd-acc-chevron { transform: rotate(180deg); }
.pd-acc-body {
    max-height: 0; overflow: hidden;
    transition: max-height 0.28s ease, opacity 0.2s ease;
    opacity: 0;
}
.pd-accordion.open .pd-acc-body {
    max-height: 320px;
    opacity: 1;
}
.pd-acc-inner { padding-top: 8px; }

.pd-tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}
.pd-tile {
    border-radius: 6px;
    height: 40px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
    background-size: cover;
    background-position: center;
    display: flex; align-items: flex-end; justify-content: center;
    overflow: hidden;
}
.pd-tile:hover { transform: scale(1.05); box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.pd-tile.active {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 1px var(--theme-primary);
}
.pd-tile-label {
    font-size: 0.52rem;
    font-weight: 700;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 1px 4px rgba(0,0,0,1);
    padding: 0 3px 3px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}
.pd-tile-grid-banner .pd-tile { height: 36px; }
.pd-btn-sm {
    background: rgba(48,54,61,0.5);
    color: #8b949e;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    margin-top: 6px;
    transition: background 0.15s, color 0.15s;
}
.pd-btn-sm:hover { background: rgba(248,81,73,0.1); color: var(--theme-danger, #f85149); }
.pd-btn-save {
    background: var(--theme-primary);
    color: #0d1117;
    border: none;
    padding: 9px;
    border-radius: 7px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    font-size: 0.85rem;
    margin-top: 14px;
    transition: opacity 0.15s, transform 0.1s;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.04em;
}
.pd-btn-save:hover:not(:disabled) { opacity: 0.88; }
.pd-btn-save:active { transform: scale(0.98); }
.pd-btn-save:disabled { opacity: 0.6; cursor: default; }
.pd-btn-save.pd-saved { background: #3fb950; color: #fff; }
.pd-footer-btns { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.pd-btn-footer {
    background: transparent; color: #8b949e; border: none;
    padding: 8px 6px; border-radius: 6px; cursor: pointer;
    font-size: 0.83rem; text-align: left;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    display: flex; align-items: center; gap: 9px; width: 100%;
}
.pd-btn-footer:hover { background: rgba(48,54,61,0.6); color: #c9d1d9; }
.pd-btn-logout { color: var(--theme-danger, #f85149); }
.pd-btn-logout:hover { background: rgba(248,81,73,0.1); color: var(--theme-danger, #f85149); }

/* ─── Paramètres avancés — fenêtre flottante cyberpunk ─── */
.params-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 99000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* Fenêtre principale : glassmorphism + bordure thème */
.params-container {
    display: flex;
    width: min(960px, 100%);
    height: min(680px, 100%);
    background: rgba(13, 17, 23, 0.96);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(var(--theme-primary-rgb), 0.08),
        0 0 40px rgba(var(--theme-primary-rgb), 0.12),
        0 24px 60px rgba(0, 0, 0, 0.9);
    overflow: hidden;
}

/* ── Sidebar ── */
.params-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: rgba(22, 27, 34, 0.85);
    border-right: 1px solid rgba(var(--theme-primary-rgb), 0.15);
    display: flex;
    flex-direction: column;
    padding: 28px 8px 16px;
    overflow-y: auto;
}

.params-nav-label {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    color: var(--theme-primary);
    font-size: 0.62em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 6px 12px 8px;
    opacity: 0.85;
}

.params-nav-item {
    background: none;
    border: none;
    border-left: 2px solid transparent;
    color: var(--text-muted, #8b949e);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88em;
    text-align: left;
    padding: 9px 12px;
    border-radius: 0 6px 6px 0;
    width: 100%;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 9px;
}

.params-nav-item:hover {
    background: rgba(var(--theme-primary-rgb), 0.08);
    color: var(--text-main, #c9d1d9);
}

.params-nav-item.active {
    background: rgba(var(--theme-primary-rgb), 0.15);
    border-left-color: var(--theme-primary);
    color: var(--theme-primary);
    font-weight: 600;
}

.params-nav-subitem {
    padding-left: 30px;
    font-size: 0.82em;
    position: relative;
}

.params-nav-subitem::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
}

.params-nav-subitem i {
    display: none;
}

/* ── Formulaires inline (email / mdp) ── */
.params-inline-form {
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 14px;
    max-width: 320px;
}

.params-inline-form .cyber-input {
    padding: 7px 10px;
    font-size: 0.82em;
    width: 100%;
    box-sizing: border-box;
}

.params-inline-msg {
    font-size: 0.78em;
    min-height: 1em;
    margin: 0;
    color: #8b949e;
}

.params-nav-danger {
    color: var(--theme-danger, #f85149) !important;
    margin-top: 4px;
}
.params-nav-danger:hover {
    background: rgba(248, 81, 73, 0.12) !important;
    border-left-color: var(--theme-danger) !important;
    color: var(--theme-danger) !important;
}

.params-nav-divider {
    height: 1px;
    background: rgba(var(--theme-primary-rgb), 0.12);
    margin: 10px 12px;
}

.params-nav-close {
    background: none;
    border: none;
    border-left: 2px solid transparent;
    cursor: pointer;
    color: var(--text-muted, #8b949e);
    font-family: inherit;
    font-size: 0.82em;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-top: auto;
    border-radius: 0 6px 6px 0;
    width: 100%;
    transition: color 0.15s, background 0.15s;
}
.params-nav-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main, #c9d1d9);
}

.params-close-icon {
    font-size: 1.3em;
    line-height: 1;
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    color: var(--theme-primary);
}
.params-close-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Zone de contenu ── */
.params-main {
    flex: 1;
    overflow-y: auto;
    padding: 36px 40px 40px;
    background: transparent;
    /* Subtle scanline texture */
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(var(--theme-primary-rgb), 0.012) 2px,
        rgba(var(--theme-primary-rgb), 0.012) 4px
    );
}

.params-content-wrap {
    max-width: 560px;
}

.params-section-title {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    color: var(--theme-primary);
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.25);
    text-shadow: 0 0 12px rgba(var(--theme-primary-rgb), 0.4);
}

.params-subsection-title {
    color: var(--theme-primary);
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    opacity: 0.85;
}

/* ── Carte profil ── */
.params-profile-card {
    background: rgba(22, 27, 34, 0.7);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(var(--theme-primary-rgb), 0.06);
}

.params-profile-banner {
    height: 80px;
    background: rgba(var(--theme-primary-rgb), 0.3);
    position: relative;
    overflow: hidden;
}

.banner-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.params-profile-row {
    display: flex;
    align-items: flex-end;
    padding: 0 16px 14px;
}

.params-profile-avatar {
    width: 68px; height: 68px;
    border-radius: 50%;
    border: 3px solid rgba(var(--theme-primary-rgb), 0.5);
    box-shadow: 0 0 14px rgba(var(--theme-primary-rgb), 0.35);
    margin-top: -34px;
    background: rgba(var(--theme-primary-rgb), 0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5em; font-weight: bold; color: #fff;
    flex-shrink: 0;
}

.params-profile-info { margin-left: 14px; padding-bottom: 4px; }
.params-profile-pseudo {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    font-size: 0.9em;
    font-weight: 700;
    color: var(--theme-primary);
    text-shadow: 0 0 8px rgba(var(--theme-primary-rgb), 0.4);
    letter-spacing: 0.04em;
}

/* ── Rangées d'info ── */
.params-field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 0;
}

.params-field-label {
    color: var(--theme-primary);
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    opacity: 0.8;
}

.params-field-value {
    color: var(--text-main, #c9d1d9);
    font-size: 0.88em;
}

.params-field-divider {
    height: 1px;
    background: rgba(var(--theme-primary-rgb), 0.1);
}

.params-danger-zone {
    border: 1px solid rgba(var(--theme-danger-rgb), 0.35);
    background: rgba(var(--theme-danger-rgb), 0.06);
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 28px;
}

.params-danger-zone .params-subsection-title {
    color: var(--theme-danger);
    margin-top: 0;
    margin-bottom: 8px;
}

/* ── Toggles Notifications ── */
.notif-toggle-list { display: flex; flex-direction: column; gap: 0; }

.notif-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.notif-toggle-info { flex: 1; min-width: 0; }

.notif-toggle-label {
    color: var(--text-main, #c9d1d9);
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 3px;
}

.notif-toggle-desc {
    color: #6e7681;
    font-size: 0.78em;
    line-height: 1.4;
}

.cyber-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cyber-toggle input { opacity: 0; width: 0; height: 0; }

.cyber-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #30363d;
    border-radius: 24px;
    transition: background 0.2s;
    border: 1px solid rgba(255,255,255,0.08);
}

.cyber-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: #8b949e;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.cyber-toggle input:checked + .cyber-toggle-slider {
    background: rgba(var(--theme-primary-rgb), 0.25);
    border-color: var(--theme-primary);
}

.cyber-toggle input:checked + .cyber-toggle-slider::before {
    transform: translate(20px, -50%);
    background: var(--theme-primary);
    box-shadow: 0 0 6px var(--theme-primary);
}

/* ── Cartes Appareils ── */
.appareil-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.12);
    border-radius: 8px;
    padding: 12px 14px;
    transition: border-color 0.2s;
}

.appareil-card.appareil-current {
    border-color: rgba(var(--theme-primary-rgb), 0.4);
    background: rgba(var(--theme-primary-rgb), 0.06);
}

.appareil-icon {
    font-size: 1.4em;
    color: var(--theme-primary);
    opacity: 0.7;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.appareil-info { flex: 1; min-width: 0; }

.appareil-label {
    color: var(--text-main, #c9d1d9);
    font-size: 0.88em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.appareil-badge {
    background: rgba(var(--theme-primary-rgb), 0.2);
    color: var(--theme-primary);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.4);
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.appareil-meta {
    color: #6e7681;
    font-size: 0.75em;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appareil-revoke-btn {
    background: none;
    border: 1px solid rgba(248, 81, 73, 0.4);
    color: #f85149;
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 0.78em;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.appareil-revoke-btn:hover {
    background: rgba(248, 81, 73, 0.12);
    border-color: #f85149;
}

.btn-save-mini {
    background: #238636;
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}

.btn-save-mini:hover { background: #2ea043; }

/* ─── Lang picker (auth + settings) ─── */

.auth-lang-corner {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10020;
}

.settings-lang-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    position: relative;
    z-index: 99999 !important;
}

.settings-lang-row .lp-dropdown {
    left: 0 !important;
    right: auto !important;
    min-width: 170px !important;
    transform-origin: bottom left !important;
}

.lang-picker {
    position: relative;
    display: inline-block;
}

.lp-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-primary, #0d1117);
    border: 1px solid var(--border-subtle, #30363d);
    border-radius: 8px;
    color: var(--text-main, #c9d1d9);
    cursor: pointer;
    font-size: 0.88rem;
    font-family: inherit;
    padding: 5px 10px;
    transition: border-color 0.2s;
}

.lp-trigger:hover,
.lang-picker.is-open .lp-trigger {
    border-color: var(--theme-primary, #58a6ff);
    z-index: 9999;
}

.lp-flag { font-size: 1.15rem; line-height: 1; }

.lp-arrow {
    font-size: 0.65rem;
    color: var(--text-muted, #8b949e);
    transition: transform 0.2s;
}

.lang-picker.is-open .lp-arrow { transform: rotate(180deg); }

.lp-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-secondary, #161b22);
    border: 1px solid var(--border-subtle, #30363d);
    border-radius: 8px;
    padding: 4px;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 145px;
    z-index: 10010;
    box-shadow: 0 6px 24px rgba(0,0,0,.5);
}

#lp-settings .lp-dropdown {
    left: 0 !important;
    right: auto !important;
    min-width: 160px !important;
    top: auto !important;
    bottom: calc(100% + 6px) !important;
    transform-origin: bottom left !important;
}
/* Flèche inversée pour le picker de langue dans les paramètres (s'ouvre vers le haut) */
#lp-settings .lp-arrow { transform: rotate(180deg); }
#lp-settings.is-open .lp-arrow { transform: rotate(0deg); }

.lp-dropdown.lp-up {
    top: auto;
    bottom: calc(100% + 6px);
}

.lang-picker.is-open .lp-dropdown { display: flex; }

.lp-option {
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-main, #c9d1d9);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    padding: 7px 10px;
    text-align: left;
    transition: background 0.15s;
    white-space: nowrap;
}

.lp-option:hover {
    background: color-mix(in srgb, var(--theme-primary, #58a6ff) 12%, transparent);
}

.lp-option.active {
    color: var(--theme-primary, #58a6ff);
    font-weight: 600;
}

.dropdown-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-main);
}


#status-picker {
    display: none;
    position: fixed !important;
    background: rgba(22, 27, 34, 0.95);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 5px;
    z-index: 10005 !important;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

#status-picker::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -12px;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #30363d;
}

#status-picker::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -10px;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #2b2d31;
}

.status-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    transition: background 0.2s;
    font-size: 0.9em;
}

.status-item:hover {
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
}

.status-item:first-child { border-radius: 8px 8px 0 0; }
.status-item:last-child { border-radius: 0 0 8px 8px; }

.status-item.has-submenu { position: relative; justify-content: space-between; }
.status-arrow { font-size: 1.1em; opacity: 0.5; margin-left: auto; }

.status-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: rgba(22, 27, 34, 0.98);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 5px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7);
    z-index: 10006;
}
.status-item.has-submenu:hover .status-submenu { display: block; }

.status-sub-item {
    padding: 9px 14px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.88em;
    border-radius: 5px;
    transition: background 0.15s;
    white-space: nowrap;
}
.status-sub-item:hover { background: rgba(88,166,255,0.12); color: #58a6ff; }

#ext-profile-dropdown {
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    overflow: hidden;
}

#self-avatar { pointer-events: auto; }

/* ── Groupes de salons ───────────────────────────────────────────────────── */
.ch-groupe {
    margin-bottom: 2px;
}

.ch-groupe-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 6px 4px 8px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background 0.12s;
}

.ch-groupe-header:hover {
    background: rgba(255,255,255,0.04);
}

.ch-groupe-header.drop-hover {
    background: rgba(var(--theme-primary-rgb), 0.15);
    outline: 1px solid rgba(var(--theme-primary-rgb), 0.4);
}

.ch-chevron {
    font-size: 0.6rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    width: 10px;
    flex-shrink: 0;
}

.ch-chevron.collapsed {
    transform: rotate(-90deg);
}

.ch-groupe-name {
    flex: 1;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #6e7681;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.12s;
}

.ch-groupe-header:hover .ch-groupe-name,
.ch-groupe-header:hover .ch-chevron {
    color: #c9d1d9;
}

.ch-groupe-rename-input {
    flex: 1;
    background: rgba(var(--theme-primary-rgb), 0.1);
    border: 1px solid var(--theme-primary);
    border-radius: 4px;
    color: #f0f6fc;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 2px 6px;
    outline: none;
    min-width: 0;
}

.ch-groupe-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.12s;
    flex-shrink: 0;
}

.ch-groupe-header:hover .ch-groupe-menu-btn {
    opacity: 1;
}

.ch-groupe-menu-btn:hover {
    color: #c9d1d9;
    background: rgba(255,255,255,0.08);
}

.ch-groupe-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.2s ease;
}

.ch-groupe-body.collapsed {
    max-height: 0;
}

/* ── Items de salon ──────────────────────────────────────────────────────── */
.channel-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    min-height: 30px;
}

.channel-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.channel-item:hover .ch-icon,
.channel-item:hover .ch-name {
    color: #c9d1d9;
}

.channel-item.active {
    background: rgba(var(--theme-primary-rgb), 0.12);
}

.channel-item.active .ch-icon,
.channel-item.active .ch-name {
    color: var(--theme-primary);
}

.ch-icon {
    font-size: 0.85rem;
    color: #484f58;
    flex-shrink: 0;
    transition: color 0.12s;
    width: 14px;
    text-align: center;
}

.ch-name {
    flex: 1;
    font-size: 0.88rem;
    color: #6e7681;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.12s;
}

/* Drag & drop ─────────────────────────────────────────── */
[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; }

.channel-item.ch-dragging {
    opacity: 0.35;
}

.ch-drop-line {
    height: 2px;
    margin: 2px 4px;
    border-radius: 2px;
    background: var(--theme-primary);
    pointer-events: none;
}

/* ── Modale création salon/groupe (style Discord) ────────────────────────── */
.mcc-box { max-width: 480px; }

.mcc-types {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mcc-type-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid #30363d;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
}

.mcc-type-card input[type="radio"] { display: none; }

.mcc-type-card:hover {
    background: rgba(255,255,255,0.04);
    border-color: #484f58;
}

.mcc-type-card.selected {
    background: rgba(var(--theme-primary-rgb), 0.08);
    border-color: var(--theme-primary);
}

.mcc-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #8b949e;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.mcc-type-card.selected .mcc-type-icon {
    background: rgba(var(--theme-primary-rgb), 0.15);
    color: var(--theme-primary);
}

.mcc-type-info { flex: 1; min-width: 0; }

.mcc-type-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #c9d1d9;
    margin-bottom: 2px;
}

.mcc-type-desc {
    font-size: 0.78rem;
    color: #6e7681;
    line-height: 1.3;
}

.mcc-check {
    font-size: 0.8rem;
    color: var(--theme-primary);
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.mcc-type-card.selected .mcc-check { opacity: 1; }

/* ── Bouton + et séparateurs ─────────────────────────────────────────────── */
.channel-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin-top: 10px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.add-channel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.add-channel-btn:hover {
    color: var(--theme-success);
}

.cyber-separator {
    border: 0;
    border-top: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    margin: 0 10px;
}

#liste-salons {
    list-style: none;
    padding: 0 4px;
    margin: 0;
}

/* Style salons vocaux */

.vocal-members-list {
    margin-left: 25px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vocal-agent-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 4px 6px;
    margin: 2px 0;
    border-radius: 4px;
    transition: background 0.2s;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.vocal-agent-tag:hover {
    background: rgba(255, 255, 255, 0.05);
}
.vocal-agent-tag .vocal-pseudo {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vocal-agent-tag .live-badge,
.vocal-agent-tag .stream-badge-icone {
    flex-shrink: 0;
}

.mini-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 183, 94, 0.3);
}

.mini-avatar-chaos {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
    background-color: var(--theme-danger);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

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

/* Le contour dur pour la détection de voix (VAD) */
.is-speaking-border {
    border: 3px solid var(--theme-success) !important;
    box-shadow: 0 0 8px var(--theme-success) !important;
    transition: border 0.1s ease, box-shadow 0.1s ease;
}

.stream-video-element {
    width: 80%;
    max-width: 800px;
    margin: 20px auto;
    border-radius: 12px;
    border: 2px solid var(--theme-primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    display: block;
    z-index: 100;
}

/* Le badge pour signaler un stream en cours */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #da3633;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 3px 7px;
    border-radius: 4px;
    margin-left: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: pulse-live 2s infinite;
    white-space: nowrap;
}
.live-badge::before {
    content: '●';
    font-size: 8px;
    opacity: .85;
}

.live-badge:hover {
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(218,54,51,.6);
}

@keyframes pulse-live {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Vocal dans les mp */

#mp-call-banner {
    background: linear-gradient(
        rgba(var(--theme-primary-rgb), 0.15), 
        rgba(var(--theme-primary-rgb), 0.15)
    ), rgba(5, 5, 5, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Pour la compatibilité Safari */
    border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    box-shadow: 0 8px 32px rgba(var(--theme-primary-rgb), 0.15);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--theme-primary);
    z-index: 100;
}

#mp-call-banner .mp-call-info i {
    color: var(--theme-primary) !important;
    text-shadow: 0 0 8px rgba(255, 183, 94, 0.5);
}

/* Bouton Raccrocher rouge vif */
.hangup-btn {
    color: var(--theme-danger) !important;
}
.hangup-btn:hover {
    background: rgba(248, 81, 73, 0.2) !important;
}

/* Bouton Regarder le stream en évidence */
.watch-btn {
    color: var(--theme-success) !important;
}

.watch-btn:hover {
    background: rgba(63, 185, 80, 0.2) !important;
    box-shadow: 0 0 10px rgba(63, 185, 80, 0.4);
}

/* ==========================================================================
   MODALE DE CREATION DE SPHERE
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.modal-box {
    background: rgba(22, 27, 34, 0.9);
    border: 1px solid #30363d;
    border-radius: 12px;
    width: 400px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    max-height: calc(100dvh - 60px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-box h2 {
    color: var(--theme-primary);
    margin: 0;
    font-size: 1.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    padding-right: 4px;
}

.modal-body label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: -5px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-btn:hover {
    color: var(--theme-danger);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

.cyber-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid #30363d;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.cyber-btn:not(.btn-alt) {
    background: #238636;
    color: white;
    border-color: rgba(240, 246, 252, 0.1);
}

.cyber-btn:not(.btn-alt):hover {
    background: #2ea043;
    box-shadow: 0 0 12px rgba(46, 160, 67, 0.4);
}

.btn-alt {
    background: #21262d;
    color: var(--text-main);
}

.btn-alt:hover {
    background: #30363d;
}

#sphere-desc-input {
    resize: none;
}

.modal-body input, .modal-body textarea {
    background: var(--bg-base);
    border: 1px solid #30363d;
    color: white;
    padding: 10px;
    border-radius: 6px;
}

.choices-container {
    display: flex;
    gap: 15px;
    padding: 10px 0;
}

.choice-card {
    flex: 1;
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.choice-card:hover {
    background: #35373c;
    border-color: var(--theme-danger);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.2);
}

.choice-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.choice-card h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #ffffff;
}

.choice-card p {
    font-size: 0.85rem;
    color: #b5bac1;
    line-height: 1.3;
}

/* ==========================================================================
   Intérieur des Sphères
   ========================================================================== */


.hidden-input {
    display: none !important;
}

.welcome-area {
    margin-top: 0px;
}

.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    text-align: center;
    padding: 20px;
    padding-top: 50px;
    padding-right: 50px;
    padding-bottom: 100px;
    background: transparent !important;
}

.welcome-icon {
    font-size: 60px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 15px var(--theme-danger));
}

.welcome-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--theme-primary);
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 183, 94, 0.3);
}

.welcome-text {
    color: var(--text-main);
    font-style: italic;
    max-width: 400px;
    line-height: 1.5;
}

.welcome-hint {
    margin-top: 30px;
    padding: 10px 20px;
    border: 1px dashed rgba(255, 183, 94, 0.3);
    border-radius: 8px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    width: fit-content;    
    max-width: 40%;        
    margin-left: auto;     
    margin-right: auto; 
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.welcome-title, .welcome-text, .welcome-hint {
    margin: 10px 0;
    width: 80%;
}

#channels-column {
    position: fixed;
    left: 70px;
    top: 50px;
    bottom: 15px;
    width: 180px;
    background: linear-gradient(
        rgba(var(--theme-primary-rgb), 0.08), 
        rgba(var(--theme-primary-rgb), 0.08)
    ), rgba(5, 5, 5, 0.7);
    backdrop-filter: blur(15px) saturate(150%);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    border-radius: 0 15px 15px 0;
    z-index: 1000;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#channels-column.closed {
    left: -110px; 
}

.sidebar-toggle-tab {
    position: absolute;
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 50px;
    background: rgba(var(--theme-primary-rgb), 0.8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 0 10px 10px 0;
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    z-index: 2000;
    transition: background 0.3s;
}

#channels-column.closed .sidebar-toggle-tab i {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.sidebar-toggle-tab:hover {
    background: var(--theme-primary);
}

#channels-column,
.sidebar {
    overflow: visible !important; 
}

#liste-salons,
#liste-pseudos,
#dynamic-spheres-container,
.social-main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

#channels-column.closed .channel-header, 
#channels-column.closed #liste-salons {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

#content-wrapper {
    position: fixed !important;
    top: 50px;
    bottom: 0;
    left: 70px !important;
    right: 290px !important;
    width: auto !important;
    display: flex;
    flex-direction: column;
    z-index: 5;
    background: transparent !important;
    margin: 0 !important;
    overflow: visible;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#content-wrapper.full-width {
    right: 0px !important;
}

#content-wrapper.full-width .input-area {
    right: 20px !important;
}

/* Quand le panneau des salons est ouvert, on pousse le chat et l'input */
body.channels-open #content-wrapper {
    left: 270px !important;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
body.channels-open .input-area {
    left: 285px !important;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.channel-header {
    padding: 15px; 
    border-bottom: 1px solid #30363d;
}

.channel-header-sphere {
    padding: 12px 36px 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    margin-bottom: 6px;
    position: relative;
}

.channel-header-sphere .dropdown-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
}

#current-sphere-name {
    font-size: 13px;
    font-weight: 700;
    color: #f0f6fc;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
    letter-spacing: 0.02em;
}

/* Modale d'invitation dans une sphère */

/* La boîte de groupe pour l'input et le bouton */
.invite-input-group {
    display: flex !important;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    margin: 15px 0;
}

/* L'input du code */
#generated-invite-code {
    flex: 1;
    text-align: center;
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    color: var(--theme-primary);
    background: var(--bg-base);
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 10px;
    box-shadow: inset 0 0 10px rgba(255, 183, 94, 0.1);
    min-width: 0;
}

/* Le bouton Copier spécifique à cette modale */
.btn-copy-invite {
    width: 100px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
}


.dropdown-wrapper { position: relative; }

#sphere-dropdown {
    position: absolute;
    top: 40px;
    left: 10px;
    background: #111214;
    border: 1px solid var(--theme-primary);
    border-radius: 8px;
    width: 160px;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.cyber-dropdown {
    position: absolute;
    top: 30px;
    right: 0;
    width: 200px;
    background: #111214;
    border: 1px solid #3f4147;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 8px;
}

.dropdown-item {
    padding: 8px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    color: #dbdee1;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.dropdown-item:hover { background: var(--theme-primary); color: white; }
.dropdown-item.danger:hover { background: #f23f42; }


/* ==========================================================================
   STRUCTURE DU CHAT
   ========================================================================== */

.markdown-body code {
    background: #2b2d31;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

.markdown-body pre {
    background: #1e1f22;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
}

/* Empêche les paragraphes du markdown de créer des sauts de ligne géants */
.message-content.markdown-body p {
    margin: 0;
    display: inline;
}

/* Style pour les blocs de code */
.message-content.markdown-body pre {
    background: #1e1f22;
    padding: 8px;
    border-radius: 4px;
    margin-top: 5px;
    display: block;
}

#typing-indicator {
    height: 25px;
    bottom: 70px;
    left: 100px;
    line-height: 25px;
    padding: 5px 15px;
    padding-left: 15px;
    margin-top: -25px; 
    position: fixed !important;
    z-index: 5;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    z-index: 9999;
    display: block;
    pointer-events: none;
}

#chat-header {
    color: var(--theme-primary) !important;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    text-shadow: 0 0 10px rgba(255, 183, 94, 0.4);
}

#chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: transparent !important;
    width: 100%;
    height: 100%;
    position: relative;
}

#chat-header.header-general { color: var(--theme-primary) !important; }
#chat-header.header-private { color: var(--theme-primary) !important; font-style: italic; }

#chat-screen {
    position: relative;
    display: none; /* Changé en 'flex' par le JS */
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: transparent !important;
}


/* Conteneur principal qui prend le reste de l'écran */

#main-content-area, .private-messages-container {
    margin-left: 80px !important;
    margin-right: 220px !important;
    width: calc(100vw - 300px) !important;
}

.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}


/* Zone de chat centrale */

#messages {
    position: relative !important;
    top: 0px;
    left: 0;
    right: 0;
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    width: calc(100% - 15px) !important;
    max-width: 100% !important;
    list-style: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: transparent !important;
    padding: 10px 20px 100px 20px !important;
    height: calc(100vh - 220px) !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(88, 166, 255, 0.2) transparent;
    scrollbar-gutter: stable;
    pointer-events: auto !important;
    z-index: 10;
    box-sizing: border-box;
}


/* Messages privés */

.message-item, .private-messages-container, [class*="private"] {
    border-left: none !important;
    background: transparent !important;
}

.message-item:has(.message-reply-quote) .message-left {
    padding-top: 22px;
}

/* Footer et Input */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-base);
}

.input-area {
    margin: 10px 20px 20px 20px;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.2) !important;
    border-radius: 8px;
    padding: 10px;
    display: block !important;
    position: fixed !important;
    left: 85px !important;
    right: 300px !important;
    bottom: -10px !important;
    z-index: 200;
    height: auto;
}

/* Dégradé derrière l'input : l'input étant en verre dépoli (translucide), les
   messages défilaient en flou derrière. Rattaché au #content-wrapper (et non à
   l'input) → il colle au bord gauche de la zone de chat, s'arrête avant la
   gouttière de scrollbar de #messages (15px à droite), et suit automatiquement
   les décalages de layout (panneau salons, sidebar masquée). z-index entre
   #messages (10) et l'input (200) → masque les messages, sous la barre. */
#content-wrapper::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 92px;
    background: linear-gradient(to bottom, transparent 0, #000 22px);
    z-index: 20;
    pointer-events: none;
    display: none;
}
body.input-visible #content-wrapper::after {
    display: block;
}

.input-wrapper-inner {
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.input-container {
    flex: 1;
    min-width: 0;
    position: relative;
}

/* --- SYSTÈME DE RÉPONSE --- */
#reply-preview-banner {
    background: rgba(var(--theme-primary-rgb), 0.1);
    border-left: 3px solid var(--theme-primary);
    padding: 8px 15px;
    margin-bottom: 8px;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
}

/* Séparateur messages non lus */
.unread-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    list-style: none;
    pointer-events: none;
    user-select: none;
}

.unread-separator::before,
.unread-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(240, 192, 64, 0.5), transparent);
}

.unread-separator span {
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    color: #f0c040;
    background: rgba(240, 192, 64, 0.1);
    border: 1px solid rgba(240, 192, 64, 0.35);
    padding: 2px 9px;
    border-radius: 10px;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

#edit-preview-banner {
    background: rgba(240, 192, 64, 0.08);
    border-left: 3px solid var(--theme-warning, #f0c040);
    padding: 8px 15px;
    margin-bottom: 8px;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
}

.reply-close-btn {
    background: transparent;
    border: none;
    color: var(--theme-danger);
    cursor: pointer;
    font-size: 1.1rem;
}

/* La citation prend l'espace dispo → toggle + croix groupés à droite */
#reply-preview-banner .reply-preview-content { flex: 1; min-width: 0; }

/* Toggle « notifier la personne » (mention) sur la barre de réponse */
.reply-mention-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #30363d;
    color: #8b949e;
    cursor: pointer;
    font-family: 'Orbitron', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 999px;
    margin-right: 10px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.reply-mention-toggle:hover { color: #e6edf3; }
.reply-mention-toggle.actif {
    background: rgba(var(--theme-primary-rgb), 0.20);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    font-weight: 700;
}

/* La petite citation qui apparaît dans le chat */
.message-reply-quote {
    position: relative;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    user-select: none;
}

/* Le petit coude qui relie la citation à l'avatar ! */
.message-reply-quote::before {
    content: '';
    position: absolute;
    left: -40px; 
    top: 50%;
    width: 32px;
    height: 14px;
    border-left: 2px solid #4f545c;
    border-top: 2px solid #4f545c;
    border-top-left-radius: 6px;
    transform: translateY(-50%);
}

.reply-author-name {
    font-weight: 700;
    color: var(--text-main);
    opacity: 0.9;
}

.reply-text-preview {
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
}

/* Un petit effet lumineux quand on survole la citation */
.message-reply-quote:hover .reply-author-name,
.message-reply-quote:hover .reply-text-preview {
    color: #ffffff;
    opacity: 1;
}

/* --- LE MENU DE RÉACTIONS RAPIDES (v2) --- */
#quick-reaction-menu {
    position: absolute;
    background: var(--bg-surface);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 6px;
    display: flex;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    transition: opacity 0.2s, transform 0.2s;
    user-select: none;
}

.quick-react-btn {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: transform 0.1s, background 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-react-btn:hover {
    background: rgba(88, 166, 255, 0.15);
    transform: translateY(-3px) scale(1.1);
}

.react-separator {
    width: 1px;
    background: #30363d;
    margin: 2px 4px;
}

.quick-react-btn.plus-btn {
    color: #8b949e;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
}
.quick-react-btn.plus-btn:hover {
    color: var(--theme-primary, #58a6ff);
}
.quick-react-btn.plus-btn svg {
    display: block;
}

.message-reactions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding-bottom: 4px;
}
/* Vide (0 réaction) → zéro espace réservé (sinon ~12px gaspillés par
   message, surtout visible sur les messages à la chaîne). */
.message-reactions-container:empty { display: none; }

.reaction-badge {
    background: rgba(48, 54, 61, 0.6) !important;
    border: 1px solid #30363d !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-size: 0.95rem !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border 0.15s, transform 0.1s;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.reaction-badge:hover {
    background: rgba(var(--theme-primary-rgb), 0.1) !important;
    border-color: rgba(var(--theme-primary-rgb), 0.5) !important;
    transform: translateY(-2px); 
}

.reaction-badge.je-suis-dessus {
    background: rgba(var(--theme-primary-rgb), 0.15) !important;
    border-color: var(--theme-primary) !important;
}

.reaction-badge.je-suis-dessus .reaction-count {
    color: var(--theme-primary) !important;
}

.reaction-count {
    font-weight: bold;
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Barre d'actions façon Discord : ancrée en haut à droite du message,
   légèrement remontée pour chevaucher le bord supérieur de la bande. */
.message-actions-bar {
    position: absolute;
    right: 16px;
    top: -10px;
    background: var(--bg-surface);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 2px;
    display: flex;
    gap: 2px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    /* Le fond de la barre ne bloque ni la sélection de texte ni les clics
       sur le message en dessous — seuls les boutons restent interactifs. */
    pointer-events: none;
    user-select: none;
}

.message-actions-bar > * {
    pointer-events: all;
}

.message-item:hover .message-actions-bar {
    opacity: 1;
    visibility: visible;
}

/* Masquer toutes les barres d'action pendant une sélection de texte */
body.text-selecting .message-actions-bar {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* ── Inline edit (style Discord) ─────────────────────────────────────────── */
.message-item.en-edition .message-actions-bar { display: none; }
.inline-edit-container {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: 2px;
}
.inline-edit-textarea {
    width: 100%; box-sizing: border-box;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.5);
    border-radius: 8px;
    color: #e6edf3;
    font-size: 0.95rem; line-height: 1.5;
    padding: 6px 10px;
    resize: none; outline: none;
    font-family: inherit;
    min-height: 36px;
    transition: border-color 0.15s;
}
.inline-edit-textarea:focus {
    border-color: var(--theme-primary);
    background: rgba(255,255,255,0.09);
}
.inline-edit-hint {
    font-size: 0.75rem; color: #8b949e;
    display: flex; gap: 16px;
}
.inline-edit-btn {
    background: none; border: none; padding: 0;
    color: var(--theme-primary); cursor: pointer;
    font-size: 0.75rem; text-decoration: underline;
}
.inline-edit-btn:hover { opacity: 0.8; }

.action-bar-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    color: var(--text-muted);
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.action-bar-btn:hover {
    background: rgba(248, 81, 73, 0.15);
    color: var(--theme-primary);
}

.action-bar-btn.btn-quick-react {
    font-size: 1rem;
    transition: transform 0.1s ease, background 0.15s;
}
.action-bar-btn.btn-quick-react:hover {
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    transform: scale(1.3);
}

.action-bar-sep {
    width: 1px;
    background: #30363d;
    margin: 4px 2px;
    align-self: stretch;
}

/* --- LE GROS MENU EMOJIS --- */
#full-emoji-picker-container {
    position: absolute;
    z-index: 1001;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(var(--theme-primary-rgb), 0.4);
}

emoji-picker {
    --background: rgba(22, 27, 34, 0.85);
    --border-color: rgba(var(--theme-primary-rgb), 0.2);
    --input-border-color: var(--theme-primary);
    --indicator-color: var(--theme-primary);
    --hover-color: rgba(var(--theme-primary-rgb), 0.2);
    --num-columns: 8;
    width: 350px;
    height: 400px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Message bienvenue salons */

@keyframes pulse-glow {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.welcome-container div:first-child {
    animation: pulse-glow 3s infinite ease-in-out;
}

/* Custom Scrollbar pour Chrome/Edge/Safari */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--theme-primary);
    border-radius: 10px;
}

/* --- LE PANNEAU DES ÉPINGLES --- */
.side-panel-cyber {
    position: fixed;
    top: 0;
    right: -350px;
    width: 320px;
    height: 100vh;
    background: linear-gradient(
        rgba(var(--theme-primary-rgb), 0.08), 
        rgba(var(--theme-primary-rgb), 0.08)
    ), rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(15px);
    border-left: 1px solid rgba(var(--theme-primary-rgb), 0.3);
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.side-panel-cyber.open {
    right: 0;
}

.pins-header {
    padding: 20px;
    border-bottom: 1px dashed rgba(var(--theme-primary-rgb), 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pins-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.1em;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(var(--theme-primary-rgb), 0.4);
}

.pins-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

.pinned-msg-card {
    background: linear-gradient(90deg, rgba(var(--theme-primary-rgb), 0.08) 0%, var(--bg-surface) 100%);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--theme-primary);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pinned-msg-card:hover {
    transform: translateX(-3px);
    box-shadow: 0 5px 15px rgba(var(--theme-primary-rgb), 0.15);
    border-color: rgba(var(--theme-primary-rgb), 0.3);
}

.pinned-msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 8px;
    border-bottom: 1px dashed rgba(var(--theme-primary-rgb), 0.2);
    padding-bottom: 4px;
}

.pinned-action-bar {
    margin-top: 10px;
    text-align: right;
}

.btn-jump {
    background: transparent;
    border: 1px solid var(--theme-primary);
    color: var(--theme-primary);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: 0 0 5px rgba(var(--theme-primary-rgb), 0.1);
}

.btn-jump:hover {
    background: rgba(var(--theme-primary-rgb), 0.15);
    box-shadow: 0 0 12px rgba(var(--theme-primary-rgb), 0.4);
    text-shadow: 0 0 5px var(--theme-primary);
}

.btn-unpin {
    background: transparent;
    border: 1px solid #8b949e;
    color: #8b949e;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.btn-unpin:hover {
    border-color: var(--theme-danger, #f85149);
    color: var(--theme-danger, #f85149);
    box-shadow: 0 0 8px rgba(248, 81, 73, 0.3);
}

/* Flash de localisation quand on clique "Rejoindre" */
@keyframes msg-highlight-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(var(--theme-primary-rgb), 0.6); background: rgba(var(--theme-primary-rgb), 0.12); }
    60%  { box-shadow: 0 0 0 8px rgba(var(--theme-primary-rgb), 0); background: rgba(var(--theme-primary-rgb), 0.06); }
    100% { box-shadow: none; background: transparent; }
}
.msg-highlight {
    animation: msg-highlight-pulse 2s ease-out forwards;
    border-radius: 6px;
}

/* --- PANNEAU MODÉRATION : cartes de signalement --- */
.moderation-card {
    background: linear-gradient(90deg, rgba(248, 81, 73, 0.08) 0%, var(--bg-surface) 100%);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid #d29922;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.moderation-card:hover {
    transform: translateX(-3px);
    box-shadow: 0 5px 15px rgba(210, 153, 34, 0.2);
}

.mod-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(210, 153, 34, 0.25);
}

.mod-card-motif {
    color: #d29922;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85em;
}

.mod-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.mod-card-details {
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid #8b949e;
    padding: 6px 10px;
    margin: 8px 0;
    font-size: 0.85em;
    color: #c9d1d9;
    border-radius: 0 4px 4px 0;
}

.mod-card-message {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 10px;
    font-size: 0.9em;
    color: #c9d1d9;
    margin: 8px 0;
    word-wrap: break-word;
    max-height: 150px;
    overflow-y: auto;
}

.mod-card-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(var(--theme-primary-rgb), 0.15);
}

.mod-action-btn {
    background: transparent;
    border: 1px solid;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.mod-action-btn.mod-reject  { border-color: #8b949e; color: #8b949e; }
.mod-action-btn.mod-warn    { border-color: #d29922; color: #d29922; }
.mod-action-btn.mod-mute    { border-color: #58a6ff; color: #58a6ff; }
.mod-action-btn.mod-delete  { border-color: #f85149; color: #f85149; }

.mod-action-btn:hover {
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}
.mod-action-btn:hover i { color: #0d1117; }

/* ==========================================================================
   BARRE LATERALE DROITE - AGENTS DU CHAOS
   ========================================================================== */

/* --- ACTIVATION DU SCROLL POUR LES COLONNES --- */
#channels-column, 
.sidebar, 
#dynamic-spheres-container, 
.social-main-content {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Pour les colonnes principales */
#channels-column:hover ::-webkit-scrollbar-thumb,
.sidebar:hover ::-webkit-scrollbar-thumb,
.social-main-content:hover ::-webkit-scrollbar-thumb {
    background: #30363d;
}

/* Pour la zone des Sphères */
#dynamic-spheres-container:hover ::-webkit-scrollbar-thumb {
    background: var(--theme-primary);
}

.add-btn {
    margin: 15px auto !important;
}

#dynamic-spheres-container {
    width: 100%;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-primary) !important;
    box-shadow: 0 0 5px var(--theme-primary);
}

/* Style des agents dans la liste de droite */

/* Style pour "Moi" en haut de la liste */
.agent-item-moi {
    cursor: pointer;
    padding: 8px 12px;
    border-bottom: 1px solid #30363d;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Style pour les agents normaux */
.agent-item {
    cursor: pointer;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

/* On réutilise l'effet de hover ambré d'avant */
.agent-item:hover {
    background: rgba(255, 183, 94, 0.1);
    transform: translateX(-5px);
}

/* Le séparateur Hors-Ligne */
.agent-separator {
    list-style: none;
    pointer-events: none;
}

/* Bloc texte de l'agent : nom (ligne 1) + activité Spotify (ligne 2).
   flex:1 + min-width:0 → le nom prend toute la largeur dispo et tronque
   proprement au lieu d'être écrasé par les badges/icônes. */
.agent-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
    gap: 1px;
}

/* Nom de l'agent */
.agent-name {
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Activité « en écoute » Spotify, ligne secondaire lisible en entier */
.agent-activity {
    display: block;
    font-size: 0.72rem;
    line-height: 1.25;
    color: #1DB954;
    opacity: 0.92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

#liste-pseudos li {
    list-style: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    margin: 4px 8px;
    padding: 8px 12px;
    position: relative;
    color: #e6edf3;
    display: flex;
    align-items: center;
    gap: 10px;
}

#liste-pseudos li:not(:has(h4)):hover {
    background: rgba(255, 183, 94, 0.1);
    transform: translateX(-5px);
    cursor: pointer;
}

#liste-pseudos li:not(:has(h4)):hover::after {
    content: "Écrire";
    position: absolute;
    right: 105%;
    background: var(--chaos-orange);
    color: var(--bg-base);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: nowrap;
    font-weight: bold;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 183, 94, 0.3);
}

.user-sidebar-controls {
    position: relative;
    margin-top: auto;
    padding-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.sidebar-separator {
    width: 32px;
    border: none;
    border-top: 2px solid #30363d;
    margin-bottom: 20px;
    position: relative;
}

.user-sidebar-controls::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 4px;
    background: var(--chaos-orange);
    box-shadow: 0 0 12px var(--chaos-orange);
    border-radius: 1px;
    z-index: 1000;
}

.self-avatar-trigger {
    width: 48px;
    height: 48px;
    background: var(--couleur-agent, #58a6ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    z-index: 2;
    position: relative;
    border: 2px solid var(--bg-surface);
}

/* Le menu qui se déploie au survol de l'orbe */
.agent-orb-container {
    position: relative;
    width: 52px;
    height: 52px;
}

.main-agent-orb {
    width: 52px;
    height: 52px;
    background: var(--couleur-agent, var(--theme-primary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--bg-surface);
    z-index: 10;
    position: relative;
    font-weight: bold;
    color: var(--bg-surface);
    font-size: 1.2rem;
    overflow: visible !important;
}

.orb-menu-flyout {
    position: absolute;
    bottom: 58px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(22, 27, 34, 0.95);
    border: 1px solid #30363d;
    border-radius: 20px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
    backdrop-filter: blur(5px);
    z-index: 100;
}

.orb-menu-flyout::after {
    content: "";
    position: absolute;
    bottom: -40px;
    left: 0;
    width: 100%;
    height: 40px;
}

.agent-orb-container:hover .orb-menu-flyout {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    visibility: visible; 
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s;
}

.orb-menu-flyout.pinned {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

/* Survol du bouton raccrocher (au-dessus de l'avatar) : on NE veut PAS
   ouvrir le flyout. JS pose .flyout-suppressed pendant ce survol. Spécificité
   > règle de survol normale ; n'affecte pas l'état épinglé (.pinned, !important). */
.agent-orb-container.flyout-suppressed:hover .orb-menu-flyout {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}

.orb-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.orb-btn:hover { background: #21262d; color: var(--theme-primary); }
.orb-btn.disconnect:hover { color: var(--theme-danger); background: rgba(248, 81, 73, 0.1); }
.orb-btn.active-suppression { color: var(--theme-primary); }
.orb-btn#btn-suppression:not(.active-suppression) { color: var(--text-muted); opacity: 0.45; }

/* Popover de volume par utilisateur (clic droit / appui long sur un participant vocal) */
.volume-popover {
    position: fixed;
    background: rgba(20, 20, 25, 0.95);
    border: 1px solid var(--theme-primary);
    border-radius: 8px;
    padding: 12px 14px;
    z-index: 9999;
    min-width: 200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    user-select: none;
}
.volume-popover-title {
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    font-size: 0.95em;
    color: var(--theme-primary);
}
.volume-slider {
    width: 100%;
    accent-color: var(--theme-primary);
    cursor: pointer;
}
.volume-value {
    text-align: center;
    font-size: 0.85em;
    margin: 4px 0 8px;
    color: var(--text-muted);
}
.volume-reset {
    width: 100%;
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8em;
    transition: background 0.15s;
}
.volume-reset:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--theme-primary);
}
.vocal-agent-tag { cursor: context-menu; }

/* ============================================================
   APPEL MP — Bandeau v2 (gros avatars, gros boutons, zone stream)
   Visible uniquement quand on est dans le MP de l'appel.
   ============================================================ */
#mp-call-banner {
    display: none;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(30,32,40,0.45), rgba(20,22,28,0.30));
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(63, 185, 80, 0.30);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
    padding: 10px 18px;
    gap: 10px;
}
.mpc-stream-zone {
    display: none;
    width: 100%;
    max-height: 50vh;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(0,0,0,0.5);
    transition: max-height 0.3s ease;
}
.mpc-stream-zone.has-stream {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    justify-content: center;
}
.mpc-stream-zone video {
    max-width: 100%;
    max-height: 45vh;
    border-radius: 8px;
    background: #000;
}
.mpc-main-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.mpc-participants {
    display: flex;
    gap: -10px;
    align-items: center;
}
.mpc-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--theme-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    border: 2px solid rgba(63,185,80,0.6);
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: default;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.mpc-avatar + .mpc-avatar { margin-left: -12px; }
.mpc-avatar.mpc-avatar-remote { cursor: context-menu; }
.mpc-avatar.has-avatar .mpc-initial { display: none; }
.mpc-avatar.is-speaking-border {
    border-color: var(--theme-success);
    box-shadow: 0 0 14px 3px rgba(63, 185, 80, 0.7);
}
.mpc-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.mpc-lock { color: var(--theme-success); }
#mp-call-status {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mp-call-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.mpc-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.mpc-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}
.mpc-btn.hangup-btn {
    background: rgba(248, 81, 73, 0.18);
    color: #ff7b73;
    border-color: rgba(248,81,73,0.4);
}
.mpc-btn.hangup-btn:hover { background: rgba(248,81,73,0.35); color: #fff; }
.mpc-btn.watch-btn {
    background: rgba(63, 185, 80, 0.18);
    color: #7be38a;
    border-color: rgba(63,185,80,0.4);
    width: auto;
    border-radius: 22px;
    padding: 0 14px;
    gap: 6px;
}
.mpc-btn.watch-btn:hover { background: rgba(63,185,80,0.35); color: #fff; }
.mpc-rejoin-timer {
    font-family: monospace;
    color: var(--theme-primary);
    font-size: 0.9rem;
    margin-right: 4px;
    opacity: 0.8;
}

/* ============================================================
   MODAL APPEL ENTRANT (centré, au-dessus de tout)
   ============================================================ */
.incoming-call-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: icm-fade-in 0.2s ease;
}
.icm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
}
.icm-card {
    position: relative;
    background: linear-gradient(160deg, rgba(30,32,40,0.97), rgba(20,22,28,0.97));
    border: 1px solid var(--theme-primary);
    border-radius: 18px;
    padding: 28px 36px;
    min-width: 320px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6), 0 0 30px rgba(63,185,80,0.2);
    text-align: center;
    color: var(--text-primary);
}
.icm-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    margin: 0 auto 14px;
    background: var(--theme-primary);
    color: #fff;
    font-size: 2.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    border: 3px solid var(--theme-success);
    animation: icm-ring 1.5s ease-in-out infinite;
}
.icm-avatar.has-avatar #icm-initial { display: none; }
.icm-pseudo {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.icm-status {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 22px;
}
.icm-buttons {
    display: flex;
    gap: 28px;
    justify-content: center;
}
.icm-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.4rem;
    transition: transform 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icm-btn:hover { transform: scale(1.08); }
.icm-accept {
    background: var(--theme-success);
    box-shadow: 0 4px 18px rgba(63,185,80,0.5);
}
.icm-refuse {
    background: var(--theme-danger);
    box-shadow: 0 4px 18px rgba(248,81,73,0.5);
}
@keyframes icm-fade-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes icm-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0.6); }
    50%      { box-shadow: 0 0 0 14px rgba(63,185,80,0); }
}

/* ============================================================
   PASTILLE APPEL SORTANT (bas-droite)
   ============================================================ */
.outgoing-call-modal {
    position: fixed;
    inset: 0;
    z-index: 10100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    pointer-events: none;
}

.ocm-card {
    pointer-events: all;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 36px 24px;
    background: linear-gradient(160deg, #1a1f2e, #0d1117);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(var(--theme-primary-rgb), 0.1);
    backdrop-filter: blur(12px);
    animation: ocm-drop-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
    min-width: 220px;
    text-align: center;
}

@keyframes ocm-drop-in {
    from { transform: translateY(-30px) scale(0.92); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.ocm-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #2a3040;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    border: 3px solid rgba(var(--theme-primary-rgb), 0.5);
    animation: ocm-pulse 2s ease-in-out infinite;
}

.ocm-avatar.has-avatar span { display: none; }

@keyframes ocm-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--theme-primary-rgb), 0.4); }
    50%      { box-shadow: 0 0 0 10px rgba(var(--theme-primary-rgb), 0); }
}

.ocm-pseudo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-bright, #fff);
}

.ocm-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-muted, #8b949e);
}

.ocm-ring-icon {
    color: var(--theme-success);
    animation: ocm-ring 0.9s ease-in-out infinite;
}

@keyframes ocm-ring {
    0%, 100% { transform: rotate(-12deg); }
    50%      { transform: rotate(12deg); }
}

.ocm-dots span {
    animation: ocm-dot 1.4s ease-in-out infinite;
    opacity: 0;
}
.ocm-dots span:nth-child(1) { animation-delay: 0s; }
.ocm-dots span:nth-child(2) { animation-delay: 0.2s; }
.ocm-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ocm-dot {
    0%, 80%, 100% { opacity: 0; }
    40%           { opacity: 1; }
}

.ocm-cancel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    border: none;
    border-radius: 50px;
    background: rgba(248,81,73,0.18);
    color: #ff7b73;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-top: 4px;
}

.ocm-cancel:hover {
    background: rgba(248,81,73,0.38);
    color: #fff;
}

/* ============================================================
   BOUTON RACCROCHER au-dessus du self-avatar (visible en MP actif)
   ============================================================ */
.self-avatar-wrapper {
    position: relative;
    display: inline-block;
}
.self-hangup-btn {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(20,22,28,0.9);
    background: var(--theme-danger);
    color: #fff;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 0 14px rgba(248,81,73,0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: transform 0.15s, box-shadow 0.15s;
}
.self-hangup-btn:hover {
    transform: translateX(-50%) scale(1.15);
    box-shadow: 0 0 22px rgba(248,81,73,1);
}

/* Badges et Glow */
.status-badge-on-avatar {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid var(--bg-surface);
    z-index: 15;
}

.status-enligne { background: var(--theme-success); }
.status-occupe { background: var(--theme-danger); }
.status-absent { background: var(--theme-warning); }

/* L'aura lumineuse verdoyante 🟢 */
.vocal-glow {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 0px 0px rgba(63, 185, 80, 0);
    transition: box-shadow 0.5s ease;
    pointer-events: none;
    z-index: -1;
}

.is-vocal-active {
    box-shadow: 0 0 15px 5px rgba(63, 185, 80, 0.6);
    animation: breathing-glow 2s infinite alternate;
}

@keyframes breathing-glow {
    from { opacity: 0.6; transform: scale(1); }
    to { opacity: 1; transform: scale(1.05); }
}

.vocal-current-info {
    padding: 5px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.vocal-label { font-size: 0.6rem; color: var(--theme-success); font-weight: bold; }
.vocal-room { font-size: 0.8rem; color: #f0f6fc; }

/* Bulle « discussion du vocal » dans la liste des salons (visible quand on
   a rejoint ce vocal). Ouvre le fil dédié sans quitter l'audio. */
.channel-item.vocal { flex-wrap: wrap; }
.channel-item.vocal .ch-name { flex: 1; }
.vocal-chat-bubble {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid rgba(var(--theme-primary-rgb), 0.45);
    background: rgba(var(--theme-primary-rgb), 0.14);
    color: var(--theme-primary);
    cursor: pointer;
    display: none;            /* affiché par majBulleVocalRejoint() */
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    margin-left: 6px;
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.vocal-chat-bubble:hover {
    transform: scale(1.15);
    background: rgba(var(--theme-primary-rgb), 0.28);
    box-shadow: 0 0 8px rgba(var(--theme-primary-rgb), 0.5);
}

.role-crown {
    color: #ffd700;
    font-size: 0.8rem;
    margin-left: 5px;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.5));
    cursor: help;
}

.agent-item-moi .role-crown {
    animation: crown-glow 2s infinite alternate;
}

@keyframes crown-glow {
    from { opacity: 0.6; }
    to { opacity: 1; text-shadow: 0 0 5px #ffd700; }
}

.role-global {
    font-size: 0.85rem;
    margin-left: 4px;
    cursor: help;
}
.role-global-admin { filter: drop-shadow(0 0 3px rgba(248, 81, 73, 0.7)); }
.role-global-modo  { filter: drop-shadow(0 0 3px rgba(88, 166, 255, 0.6)); }

#chaos-sidebar-nav {
    position: fixed;
    left: 0px;
    top: 50%;
    transform: translateY(-50%);
    width: 70px;
    background: linear-gradient(
        rgba(var(--theme-primary-rgb), 0.05), 
        rgba(var(--theme-primary-rgb), 0.05)
    ), rgba(5, 5, 5, 0.5);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    border-radius: 12px;
    padding: 15px 0;
    z-index: 1005;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    margin-top: 40px;
}

.conv-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}


#chaos-sidebar-nav::-webkit-scrollbar { display: none; } /* Cache sur Chrome */

.sidebar {
    position: fixed !important;
    right: 5px;
    top: 40px;
    bottom: 5px;
    width: 280px;
    background: linear-gradient(
        rgba(var(--theme-primary-rgb), 0.06), 
        rgba(var(--theme-primary-rgb), 0.06)
    ), rgba(5, 5, 5, 0.6) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    border-radius: 12px;
    padding: 16px 14px;
    z-index: 900;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
}

.sidebar.collapsed {
    transform: translateX(105%);
}

.sidebar-separator {
    width: 50px;
    height: 2px;
    background: #30363d;
    margin: 5px 0;
    border-radius: 1px;
}

.header-area {
    position: fixed;
    top: 0;
    left: 0px;
    right: 260px;
    height: 35px;
    border-radius: 0 0 8px 8px !important;
    background: linear-gradient(
        rgba(var(--theme-primary-rgb), 0.05),
        rgba(var(--theme-primary-rgb), 0.05)
    ), rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000 !important;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.1);
    width: 100%;
    padding-left: 20px;
}


.nav-arrow {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 5px;
    z-index: 1000;
}

.nav-arrow:hover {
    color: var(--chaos-orange);
    transform: scale(1.2);
}



.sidebar h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--theme-primary), #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(var(--theme-primary-rgb), 0.4));
    text-transform: uppercase;
    margin-bottom: 5px;
    margin-left: 20px;
}

.sidebar h4 {
    all: unset;
    display: block;
    color: rgba(252, 228, 228, 0.3) !important;
    font-size: 10px !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 25px 0 10px 10px !important;
    font-family: 'Orbitron', sans-serif;
}

/* La base de la pastille */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

/* On cible les deux variantes pour être tranquille */
.status-dot.enligne { background-color: var(--theme-success); }
.status-dot.absent { background-color: #d29922; }
.status-dot.occupe { background-color: var(--theme-danger); }
.status-dot.invisible { background-color: var(--text-muted); }


.notif-badge {
    background-color: var(--theme-danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    box-shadow: 0 0 5px rgba(248, 81, 73, 0.5);
}

/* ==========================================================================
   MESSAGES ET CONTENU
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-system {
    animation: fadeIn 0.4s ease-out;
}


/* Survol d'un message : band neutre discret sur toute la largeur (repérer
   la ligne sur grand écran) + léger accent rouge à gauche. Volontairement
   « à peine plus clair ». */
/* Survol d'un message : bande simple, à peine plus claire, sur toute la
   largeur. !important nécessaire pour battre le « background: transparent
   !important » du reset .message-item (ligne ~2940). Pas de bordure. */
.message-item:hover {
    background: rgba(255, 255, 255, 0.055) !important;
}


#messages li {
    position: relative;
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    transition: background-color 0.2s;
}

#messages li:hover {
    background-color: rgba(255, 255, 255, 0.055);
}

/* Infos système (ex: X a rejoint le chat) */
#messages li[style*="italic"] {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Barre de défilement de la zone de messages */
#messages::-webkit-scrollbar {
    width: 4px;
}

#messages::-webkit-scrollbar-track {
    background: transparent; 
}

#messages::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: var(--chaos-orange);
}

#messages::-webkit-scrollbar-thumb:hover {
    background: var(--theme-primary);
    box-shadow: 0 0 10px var(--theme-primary);
}

.message-left {
    flex-shrink: 0;
    position: relative;
}

/* === #4 Messages à la chaîne (groupement façon Discord) === */
/* Heure (HH:MM) dans la gouttière de gauche, visible au survol d'un
   message groupé (l'en-tête est masqué). */
.message-hover-time {
    display: none;
    position: absolute;
    top: 3px;
    left: 0;
    width: 40px;
    text-align: center;
    font-size: 0.62rem;
    color: #8b949e;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
    user-select: none;
}
/* #messages dans le sélecteur : sinon `#messages li{padding:12px}` (ID,
   spécificité plus forte) écrasait ce padding → écart constant ~24px. */
#messages li.message-item.message-grouped {
    padding-top: 1px;
    padding-bottom: 1px;
}
/* La « tête » d'un groupe (non groupée) gardait son gros padding-bottom
   (#messages li = 12px + body 5px) → petit espace en trop juste après le
   1er message. Si elle est SUIVIE d'un message groupé, on resserre son
   dessous pour un espacement uniforme. (:has() déjà utilisé ailleurs.) */
#messages li.message-item:has(+ li.message-grouped) {
    padding-bottom: 1px;
}
#messages li.message-item:has(+ li.message-grouped) .message-body {
    padding-bottom: 0;
}
/* display:none (PAS visibility:hidden) : sinon l'avatar 40×40 réserve
   40px de HAUTEUR sur chaque ligne groupée = gros écart constant. On
   garde la gouttière de 40px de LARGE pour l'alignement + l'heure au survol. */
.message-item.message-grouped .message-avatar { display: none; }
.message-item.message-grouped .message-left { width: 40px; }
.message-item.message-grouped .message-header { display: none; }
/* Resserre la ligne groupée : on supprime le padding bas du corps pour
   donner l'illusion d'un bloc continu (façon Discord). */
.message-item.message-grouped .message-body { padding-bottom: 0; }
.message-item.message-grouped .message-hover-time { display: block; }
.message-item.message-grouped:hover .message-hover-time { opacity: 1; }

.avatar-clickable {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.avatar-clickable:hover {
    transform: scale(1.1);
}

.message-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--theme-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* === Carte Spotify mini (popover + profil étendu) === */
.spotify-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(29, 185, 84, 0.08);
    border: 1px solid rgba(29, 185, 84, 0.22);
    border-radius: 10px;
    padding: 9px 12px;
    margin: 0 15px 12px;
    text-decoration: none;
    cursor: default;
}
.spotify-mini-card.has-url { cursor: pointer; }
.spotify-mini-card.has-url:hover { background: rgba(29, 185, 84, 0.14); }
.spotify-mini-card-art {
    width: 42px;
    height: 42px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}
.spotify-mini-card-art-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 5px;
    background: rgba(29, 185, 84, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.spotify-mini-card-info {
    flex: 1;
    min-width: 0;
}
.spotify-mini-card-label {
    font-size: 10px;
    color: #1DB954;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-bottom: 2px;
}
.spotify-mini-card-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #f0f6fc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.spotify-mini-card-artist {
    font-size: 11px;
    color: #8b949e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* pop-username cliquable → profil étendu */
#pop-username { cursor: pointer; }
#pop-username:hover { text-decoration: underline; }

.popover-card {
    position: fixed;
    width: 280px;
    background: rgba(23, 28, 35, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 10000;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    color: white;
}

.popover-banner {
    height: 80px;
    background: linear-gradient(45deg, var(--theme-primary), var(--theme-primary)); /* Par défaut */
    background-size: cover;
    position: relative;
    overflow: hidden;
}

.popover-avatar-wrapper {
    margin-top: -40px;
    padding: 0 15px;
    display: flex;
    align-items: flex-end;
}

.popover-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #171c23;
    background-color: var(--theme-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

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

.message-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.message-author {
    color: var(--theme-primary);
    font-size: 14px;
    margin-right: 8px;
    font-weight: bold;
    cursor: pointer;
}
.message-author:hover { text-decoration: underline; }

.message-time {
    font-size: 11px;
    color: #768390;
    margin-left: 8px;
}

.message-text {
    color: #d1d5db;
    font-size: 15px;
    line-height: 1.5;
}

.safe-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: pre-wrap;
}

.message-text, .safe-text {
    color: #e6edf3 !important;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    display: block;
    margin-top: 4px;
}

.message-body {
    flex: 1;
    min-width: 0;
    padding-bottom: 5px;
}

.message-gif {
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
}

/* Bulles d'actions au survol */
.message-actions {
    position: absolute;
    right: 20px;
    top: -15px;
    background-color: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    display: none;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#messages li:hover .message-actions {
    display: flex;
    gap: 8px;
}

.message-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
}

.message-actions button:hover {
    background-color: #30363d;
}


/* ==========================================================================
   BOUTONS ET FORMULAIRES DE SAISIE
   ========================================================================== */
.cyber-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    color: white;
    transition: filter 0.2s;
}

.cyber-btn:hover {
    filter: brightness(1.2);
}

.btn-alt { background-color: #30363d; }

.cyber-btn.btn-danger {
    background: transparent !important;
    border: 1px solid var(--theme-danger) !important;
    color: var(--theme-danger) !important;
}

.cyber-btn.btn-danger:hover {
    background: var(--theme-danger) !important;
    color: #fff !important;
    box-shadow: 0 0 18px rgba(var(--theme-danger-rgb), 0.55);
    filter: none;
}

/* Bouton d'envoi : rond plein thémé + avion papier (norme actuelle, façon
   Telegram/WhatsApp). Cible tactile ≥ 44px → confort au pouce sur mobile.
   L'icône est sombre sur le rond clair : --theme-primary est désormais
   garanti lisible (cf. _couleurLisibleSurFond), donc contraste OK quel que
   soit le thème choisi. */
#btn-envoi {
    background: var(--theme-primary);
    color: #0d1117;
    border: none;
    padding: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
#btn-envoi:hover {
    transform: scale(1.08);
    filter: brightness(1.08);
    box-shadow: 0 0 12px rgba(var(--theme-primary-rgb), 0.55);
}
#btn-envoi:active { transform: scale(0.96); }
/* a11y clavier : focus toujours visible (passe d'accessibilité). */
#btn-envoi:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#btn-envoi i { line-height: 1; }

.btn-stop { background-color: var(--theme-danger); margin-top: 10px; }

.btn-alt:hover {
    background-color: var(--theme-danger) !important;
    color: white !important;
    border-color: var(--theme-danger) !important;
    box-shadow: 0 0 15px rgba(248, 81, 73, 0.6);
}

/* Bouton "Restaurer via QR" : action SÛRE (pas danger). Outline thémé,
   bordure pointillée, survol = teinte primaire douce — JAMAIS rouge.
   N'utilise pas .btn-alt (dont le :hover global passe en rouge danger). */
.btn-qr-restore {
    background: transparent !important;
    border: 1px dashed var(--theme-primary) !important;
    color: var(--theme-primary) !important;
    box-shadow: none !important;
    transition: background 0.15s, box-shadow 0.15s;
}
.btn-qr-restore:hover {
    background: rgba(var(--theme-primary-rgb), 0.14) !important;
    color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 12px rgba(var(--theme-primary-rgb), 0.35) !important;
}

#input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #30363d;
    background-color: var(--bg-base);
    color: white;
    outline: none;
    width: 100%;
    min-height: 40px;
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    font-family: var(--font-main);
    font-size: 0.93rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#input:empty::before {
    content: attr(data-placeholder);
    color: #8b949e;
    pointer-events: none;
}

#input img.twemoji,
#input img.chat-emoji-custom {
    height: 1.3em;
    width: auto;
    vertical-align: -0.25em;
    display: inline;
    margin: 0 0.05em;
    border: none;
    max-height: unset;
    cursor: text;
    pointer-events: none;
}

#input::-webkit-scrollbar {
    width: 4px;
}
#input::-webkit-scrollbar-thumb {
    background: rgba(var(--theme-primary-rgb), 0.4);
    border-radius: 4px;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
}

/* ==========================================================================
   PICKERS (GIF & EMOJI)
   ========================================================================== */

#gif-picker {
    display: none;
    position: absolute;
    bottom: 85px;
    left: 70px;
    z-index: 2000;
    background: rgba(22, 27, 34, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--theme-primary);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    width: 320px;
    height: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- LE CHAMP DE RECHERCHE DU MENU GIF --- */
.gif-search-container {
    padding: 10px;
    border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.3);
}

#gif-search-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #30363d;
    border-radius: 6px;
    color: var(--text-main);
    transition: border-color 0.2s;
}

#gif-search-input:focus {
    outline: none;
    border-color: var(--theme-primary);
}

/* --- LA MOSAÏQUE (RÉSULTATS) --- */
#gif-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-content: flex-start;
    padding: 10px;
}

/* Les carrés de la mosaïque */
#gif-results img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    border: 2px solid transparent;
}

#gif-results img:hover {
    transform: scale(1.05);
    border-color: var(--theme-primary);
}

/* --- LA BARRE DE SCROLL DU MENU GIF --- */
#gif-results::-webkit-scrollbar { 
    width: 8px; 
}
#gif-results::-webkit-scrollbar-track { 
    background: rgba(0, 0, 0, 0.2); 
    border-radius: 4px;
}
#gif-results::-webkit-scrollbar-thumb { 
    background: var(--theme-primary);
    border-radius: 4px; 
}
#gif-results::-webkit-scrollbar-thumb:hover { 
    background: var(--theme-primary);
}

/* --- LE BOUTON GIF DE LA BARRE D'OUTILS --- */
.gif-label {
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    color: var(--text-main);
    background: transparent;
    border: none;
}
.gif-label:hover {
    color: var(--theme-primary);
}

#chat-emoji-picker-container {
    position: absolute;
    bottom: 85px;
    left: 20px;
    z-index: 1001;
    background: rgba(22, 27, 34, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.6);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

#chat-picker {
    --num-columns: 8;
    --category-emoji-size: 1.1rem;
    width: 350px;
    height: 400px;
}

/* ==========================================================================
   VIDÉO ET PARTAGE
   ========================================================================== */
#video-container {
    display: none;
    background-color: #000;
    padding: 15px;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid #30363d;
}

#screen-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 2px solid var(--theme-primary);
}

/* Aligne bien les boutons à gauche du champ texte */
.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    filter: grayscale(1);
    transition: 0.2s;
}

.icon-btn:hover {
    filter: grayscale(0);
    transform: scale(1.1);
}

/* =========================================
   🔍 PANNEAU DE RECHERCHE (GLASSMORPHISM)
   ========================================= */

#search-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    /* Effet verre dépoli */
    background: rgba(13, 17, 23, 0.4); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    flex-shrink: 0;
    z-index: 10;
}

#search-panel.is-open {
    max-height: 80px;
    border-bottom-color: rgba(255, 255, 255, 0.05); /* Ligne très discrète */
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.search-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
}

.search-icon-lead {
    color: var(--theme-primary, #58a6ff); /* Prend la couleur du thème ! */
    font-size: 1.1rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--theme-primary) 50%, transparent));
}

/* Les champs de saisie façon "Pilule" */
#search-kw,
#search-author {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle, #30363d);
    border-radius: 20px;
    color: var(--text-main, #c9d1d9);
    font-size: 0.85rem;
    padding: 8px 16px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

#search-kw { flex: 2; min-width: 0; }
#search-author { flex: 1; min-width: 0; }

#search-kw:focus,
#search-author:focus {
    border-color: var(--theme-primary, #58a6ff);
    box-shadow: 0 0 8px color-mix(in srgb, var(--theme-primary) 40%, transparent), inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Les tags cliquables */
.search-chips {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.search-chip {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle, #30363d);
    border-radius: 20px;
    color: var(--text-muted, #8b949e);
    font-size: 0.78rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-chip:hover {
    border-color: var(--theme-primary, #58a6ff);
    color: var(--text-main);
    box-shadow: 0 0 8px color-mix(in srgb, var(--theme-primary) 30%, transparent);
}

.search-chip.active {
    border-color: var(--theme-primary, #58a6ff);
    background: color-mix(in srgb, var(--theme-primary, #58a6ff) 20%, transparent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 10px color-mix(in srgb, var(--theme-primary) 40%, transparent);
}

.search-close-btn {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid transparent;
    color: #f85149;
    cursor: pointer;
    font-size: 1rem;
    padding: 6px 10px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.search-close-btn:hover {
    background: #f85149;
    color: white;
    box-shadow: 0 0 10px rgba(248, 81, 73, 0.5);
}

.search-run-btn {
    background: transparent;
    border: 1px solid var(--theme-primary, #58a6ff);
    border-radius: 20px;
    color: var(--theme-primary, #58a6ff);
    font-size: 0.8rem;
    font-weight: bold;
    padding: 8px 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.search-run-btn:hover { 
    background: var(--theme-primary, #58a6ff);
    color: #000;
    box-shadow: 0 0 12px var(--theme-primary, #58a6ff);
}

#btn-search.search-active {
    color: var(--theme-primary, #58a6ff) !important;
    text-shadow: 0 0 8px var(--theme-primary, #58a6ff);
}

/* =========================================
   📋 PANNEAU LATÉRAL DES RÉSULTATS
   ========================================= */

#search-results-panel {
    position: fixed;
    top: 60px; /* Aligné sous le header */
    right: 0;
    bottom: 0;
    width: 350px;
    
    /* Le fameux verre dépoli ! */
    background: rgba(18, 22, 29, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    
    border-left: 1px solid color-mix(in srgb, var(--theme-primary) 30%, transparent);
    display: flex;
    flex-direction: column;
    z-index: 950;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Animation "rebond" ultra fluide */
    box-shadow: -8px 0 30px rgba(0,0,0,0.5);
}

#search-results-panel.is-open {
    transform: translateX(0);
}

.srp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.srp-title {
    font-size: 0.85rem;
    color: var(--theme-primary, #58a6ff);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.srp-close-btn {
    background: none;
    border: none;
    color: var(--text-muted, #8b949e);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
    transition: color 0.2s, transform 0.2s;
}

.srp-close-btn:hover { 
    color: white; 
    transform: scale(1.1);
}

.srp-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar futuriste pour les résultats */
.srp-list::-webkit-scrollbar { width: 4px; }
.srp-list::-webkit-scrollbar-thumb {
    background: var(--theme-primary, #58a6ff);
    border-radius: 4px;
}

.srp-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle, #30363d);
    border-radius: 10px;
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.srp-card:hover {
    border-color: var(--theme-primary, #58a6ff);
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 10px color-mix(in srgb, var(--theme-primary) 15%, transparent);
}

.srp-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 5px;
}

.srp-author {
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.srp-time {
    font-size: 0.75rem;
    color: #8b949e;
}

.srp-excerpt {
    font-size: 0.85rem;
    color: #c9d1d9;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Le bouton d'action dans la carte de résultat */
.srp-goto-btn {
    align-self: flex-end;
    margin-top: 5px;
    background: transparent;
    border: 1px solid var(--theme-primary);
    color: var(--theme-primary);
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.srp-goto-btn:hover {
    background: var(--theme-primary);
    color: #000;
    box-shadow: 0 0 8px var(--theme-primary);
}

/* Le surlignage des mots clés trouvés */
.search-mark {
    background: color-mix(in srgb, var(--theme-primary) 40%, transparent);
    color: #fff;
    padding: 0 3px;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 0 5px color-mix(in srgb, var(--theme-primary) 50%, transparent);
}

/* L'effet de "Flash" quand on clique sur "Aller au message" */
.search-flash {
    animation: flashHighlight 2s ease-out;
}

@keyframes flashHighlight {
    0% { background-color: color-mix(in srgb, var(--theme-primary) 60%, transparent); box-shadow: 0 0 15px var(--theme-primary); }
    100% { background-color: transparent; box-shadow: none; }
}

.srp-empty {
    text-align: center;
    color: #8b949e;
    font-style: italic;
    margin-top: 30px;
}

/* ─── Bouton scroll-to-bottom ─── */

#btn-scroll-bottom {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--bg-secondary, #161b22);
    border: 1px solid var(--border-subtle, #30363d);
    border-radius: 20px;
    color: var(--text-main, #c9d1d9);
    font-size: 0.85rem;
    padding: 6px 16px;
    cursor: pointer;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s, border-color 0.2s;
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
    white-space: nowrap;
}

#btn-scroll-bottom.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

#btn-scroll-bottom:hover {
    border-color: var(--theme-primary, #58a6ff);
    color: var(--theme-primary, #58a6ff);
}

/* Flash d'un message trouvé */

@keyframes search-flash {
    0%   { background: color-mix(in srgb, var(--theme-primary, #58a6ff) 28%, transparent); }
    70%  { background: color-mix(in srgb, var(--theme-primary, #58a6ff) 10%, transparent); }
    100% { background: transparent; }
}

#messages li.search-flash {
    animation: search-flash 2.2s ease-out forwards;
    border-radius: 6px;
}
/* ═══════════════════════════════════════════════════════
   MODALE GESTION DES RÔLES
═══════════════════════════════════════════════════════ */

.roles-modal-box {
    width: min(900px, 96vw);
    height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.roles-modal-box .modal-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

.roles-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 20px 0;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
    background: rgba(255,255,255,0.02);
}

.roles-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #8b949e;
    font-family: 'Orbitron', monospace;
    font-size: 0.78rem;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
}

.roles-tab.active {
    color: var(--theme-primary, #f0c040);
    border-bottom-color: var(--theme-primary, #f0c040);
}

.roles-panel-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    min-height: 0;
}

.roles-split {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* Colonne gauche : liste des rôles */
.roles-list-col {
    width: 200px;
    min-width: 180px;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.roles-create-btn {
    margin: 12px;
    padding: 7px 12px;
    background: rgba(var(--theme-primary-rgb, 240,192,64), 0.12);
    border: 1px dashed rgba(var(--theme-primary-rgb, 240,192,64), 0.4);
    color: var(--theme-primary, #f0c040);
    border-radius: 8px;
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.2s;
}

.roles-create-btn:hover {
    background: rgba(var(--theme-primary-rgb, 240,192,64), 0.22);
}

#roles-list {
    overflow-y: auto;
    flex: 1;
}

.role-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    border-radius: 6px;
    margin: 2px 6px;
    transition: background 0.15s;
    font-size: 0.85rem;
}

.role-list-item:hover { background: rgba(255,255,255,0.05); }
.role-list-item.active { background: rgba(var(--theme-primary-rgb,240,192,64),0.15); }

.role-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.role-list-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #c9d1d9;
}

/* Colonne droite : éditeur */
.roles-editor-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.roles-editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: #8b949e;
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
}

.roles-editor-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

.role-editor-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.role-name-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    padding: 7px 12px;
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.role-name-input:focus { border-color: var(--theme-primary, #f0c040); }
.role-name-input[readonly] { opacity: 0.6; cursor: default; }

.role-delete-btn {
    background: transparent;
    border: 1px solid #f8514940;
    color: #f85149;
    border-radius: 6px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85rem;
}
.role-delete-btn:hover { background: rgba(248,81,73,0.15); }

/* Permissions scrollables */
.perm-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
    min-height: 0;
}

.perm-category { margin-bottom: 20px; }

.perm-category-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.68rem;
    color: #8b949e;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #21262d;
}

.perm-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.perm-toggle:hover { background: rgba(255,255,255,0.03); padding: 8px 6px; }

.perm-label {
    font-size: 0.85rem;
    color: #c9d1d9;
}

/* Toggle switch */
.toggle-switch { position: relative; display: inline-flex; align-items: center; }

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
    display: block;
    width: 40px;
    height: 22px;
    background: #30363d;
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #8b949e;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider { background: rgba(var(--theme-primary-rgb,240,192,64),0.3); }
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(18px);
    background: var(--theme-primary, #f0c040);
}
.toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

.roles-editor-footer {
    padding: 14px 20px;
    border-top: 1px solid #30363d;
    flex-shrink: 0;
}

/* Panel membres */
.membres-roles-list {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: calc(88vh - 130px);
}

.membre-role-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid #21262d;
    border-radius: 8px;
    gap: 12px;
}

.membre-role-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.membre-role-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    color: #0d1117;
    flex-shrink: 0;
}

.membre-role-pseudo {
    font-size: 0.9rem;
    color: #e6edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-crown-badge { font-size: 0.9rem; }

.membre-role-select {
    background: rgba(255,255,255,0.06);
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    padding: 6px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    min-width: 140px;
    outline: none;
}

.membre-role-select.disabled-select { opacity: 0.5; cursor: not-allowed; }

/* Overlay de Drag & Drop */
#drop-zone-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: color-mix(in srgb, var(--theme-primary) 20%, transparent);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 9999;
    border: 4px dashed var(--theme-primary);
    pointer-events: none;
}

.drop-zone-content {
    text-align: center;
    color: white;
    font-family: 'Orbitron', sans-serif;
    text-shadow: 0 0 15px var(--theme-primary);
}

.drop-zone-content i {
    font-size: 4rem;
    margin-bottom: 20px;
}

#file-preview-banner {
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle, #30363d);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin: 0 10px;
    overflow: hidden;
}

.file-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    max-height: 130px;
    overflow-y: auto;
}

.file-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 5px 8px;
    max-width: 210px;
    min-width: 0;
}

.file-chip-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.file-chip-icon {
    font-size: 1.2rem;
    color: var(--theme-primary);
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.file-chip-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.file-chip-name {
    font-size: 0.81em;
    font-weight: 600;
    color: #c9d1d9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-chip-size {
    font-size: 0.72em;
    color: #8b949e;
}

.file-chip-del {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 0.75em;
    padding: 2px 5px;
    flex-shrink: 0;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.file-chip-del:hover {
    color: #f85149;
    background: rgba(248, 81, 73, 0.12);
}

/* Limiter la taille des images dans le chat */
.message-content img {
    display: block;
    max-width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 8px;
    cursor: zoom-in;
    border: 1px solid var(--border-subtle, #30363d);
}

/* --- LE LIGHTBOX --- */
#lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

#lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    object-fit: contain;
}

/* ========================================== */
/* E2EE Onboarding modal                      */
/* ========================================== */

.e2ee-mots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 15px 0;
    padding: 15px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
}

.e2ee-mot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.e2ee-mot-num {
    color: #8b949e;
    font-size: 0.75em;
    min-width: 18px;
    text-align: right;
}

.e2ee-mot-txt {
    color: var(--theme-primary);
    font-weight: bold;
}

.e2ee-verif-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.e2ee-verif-row .cyber-label {
    min-width: 80px;
    margin: 0;
}

.e2ee-verif-input {
    flex: 1;
    padding: 8px;
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.e2ee-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid #30363d;
    border-top-color: var(--theme-primary);
    border-radius: 50%;
    animation: e2ee-spin 1s linear infinite;
}

@keyframes e2ee-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .e2ee-mots-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   RESPONSIVE — MOBILE BOTTOM NAV (base, cachée sur desktop)
   ========================================================================== */

#mobile-bottom-nav {
    display: none;
}

#mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1990;
    backdrop-filter: blur(2px);
}

#mobile-overlay.visible {
    display: block;
}

/* ==========================================================================
   RESPONSIVE — MOBILE (≤ 768px)
   ========================================================================== */

@media (max-width: 768px) {

    /* ── Auth screen ──────────────────────────────────────────────────────── */
    .auth-container {
        flex-direction: column;
        overflow-y: auto;
        align-items: initial;
    }

    /* Panneau marque : hauteur fixe pour que le carousel absolu ne chevauche pas le logo */
    .auth-brand {
        flex: none;
        height: 230px;
        min-height: 230px;
        padding: 28px 24px 16px;
    }

    .auth-brand-title {
        font-size: 2.2rem;
    }

    /* La tagline est masquée sur mobile — le carousel la remplace */
    .auth-brand-tagline {
        display: none;
    }

    .auth-lorenz-bg {
        opacity: .2;
    }

    .auth-brand-carousel {
        bottom: 18px;
        left: 24px;
        right: 24px;
    }

    .auth-carousel-text {
        font-size: .78rem;
    }

    /* Panneau formulaire : flex:1 pour remplir l'espace restant sans vide */
    .auth-panel {
        flex: 1;
        width: 100%;
        border-left: none;
        border-image: none;
        border-top: 1px solid rgba(155,109,255,.3);
        justify-content: center;
        align-items: center;
        overflow-y: auto;
    }

    .auth-box {
        width: calc(100% - 32px);
        max-width: 380px;
        padding: 28px 20px;
        margin: 0;
    }

    /* ── Sidebar de navigation (sphères) : tiroir overlay depuis la gauche ── */
    #chaos-sidebar-nav {
        left: -80px !important;
        top: 0 !important;
        height: 100dvh !important;
        margin-top: 0 !important;
        padding-top: 55px !important;
        padding-bottom: 70px !important;
        border-radius: 0 12px 12px 0 !important;
        transform: none !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 2001 !important;
        overflow-y: auto;
        display: flex !important;
    }

    #chaos-sidebar-nav.mobile-open {
        left: 0 !important;
    }

    /* Icônes plus grandes et mieux espacées sur mobile */
    #chaos-sidebar-nav .sphere-icon,
    #chaos-sidebar-nav .home-chaos-btn {
        width: 52px !important;
        height: 52px !important;
        flex-shrink: 0;
    }

    #mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: linear-gradient(
            rgba(var(--theme-primary-rgb), 0.04),
            rgba(var(--theme-primary-rgb), 0.04)
        ), rgba(5, 5, 5, 0.92);
        backdrop-filter: blur(15px);
        border-top: 1px solid rgba(var(--theme-primary-rgb), 0.2);
        z-index: 1005;
        align-items: center;
        justify-content: space-around;
        padding: 0;
        /* safe area pour les téléphones avec encoche */
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mbn-btn {
        flex: 1;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 1.25rem;
        cursor: pointer;
        position: relative;
        transition: color 0.2s;
        -webkit-tap-highlight-color: transparent;
    }

    .mbn-btn.active,
    .mbn-btn:active {
        color: var(--theme-primary);
    }

    .mbn-icon {
        width: 22px;
        height: 22px;
    }

    .mbn-badge {
        position: absolute;
        top: 6px;
        right: calc(50% - 16px);
        background: var(--theme-danger);
        color: white;
        font-size: 0.58rem;
        min-width: 14px;
        height: 14px;
        border-radius: 7px;
        padding: 0 3px;
        line-height: 14px;
        text-align: center;
        font-weight: bold;
    }

    /* ── Colonne des salons : tiroir overlay depuis la gauche ─────────────── */
    #channels-column {
        left: -210px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 210px;
        z-index: 2000 !important;
        border-radius: 0 12px 12px 0;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Ouvert via la classe mobile-open (toggle JS dédié mobile) */
    #channels-column.mobile-open {
        left: 0 !important;
    }

    /* Masquer le tab de bascule (remplacé par le bouton bottom nav) */
    .sidebar-toggle-tab {
        display: none !important;
    }

    /* ── Sidebar droite (agents) : tiroir overlay depuis la droite ────────── */
    .sidebar {
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 280px !important;
        max-width: 85vw;
        border-radius: 0 !important;
        z-index: 2000 !important;
        transform: translateX(110%) !important;
    }

    /* Ouvert via la classe mobile-open (toggle JS dédié mobile) */
    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    /* ── Content wrapper : plein écran, espace pour bottom nav ───────────── */
    #content-wrapper {
        left: 0 !important;
        right: 0 !important;
        top: 35px !important;
        bottom: 60px !important;
    }

    /* Sur mobile : le content ne se pousse jamais (overlays) */
    body.channels-open #content-wrapper,
    body.channels-open .input-area {
        left: 0 !important;
    }

    #content-wrapper.full-width {
        right: 0 !important;
    }

    /* ── Header : pleine largeur ──────────────────────────────────────────── */
    .header-area {
        left: 0 !important;
        right: 0 !important;
        padding-left: 12px !important;
    }

    /* Masquer les flèches historique (trop petites sur mobile) */
    .history-controls {
        display: none !important;
    }

    /* ── Zone de saisie : au-dessus de la bottom nav ─────────────────────── */
    .input-area {
        left: 8px !important;
        right: 8px !important;
        bottom: 65px !important;
    }

    body.channels-open .input-area {
        left: 8px !important;
    }

    /* ── Liste des messages ───────────────────────────────────────────────── */
    #messages {
        height: calc(100dvh - 200px) !important;
        padding-bottom: 140px !important;
    }

    /* ── Layout principal ─────────────────────────────────────────────────── */
    .main-layout {
        height: calc(100dvh - 95px) !important;
    }

    /* ── Dashboard : colonne unique ───────────────────────────────────────── */
    .dash-grid {
        grid-template-columns: 1fr !important;
        overflow-y: auto;
        max-height: calc(100dvh - 120px);
    }

    /* ── Modales : pleine largeur + scroll si contenu dépasse l'écran ───── */
    .modal-overlay {
        align-items: flex-start !important;
        padding: 10px 0;
        overflow-y: auto;
    }
    .modal-box {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        max-height: none !important;
        flex-shrink: 0;
    }

    /* ── Panneau E2EE ─────────────────────────────────────────────────────── */
    .e2ee-setup-box {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        padding: 20px 14px !important;
    }

    /* ── Sphère sociale ───────────────────────────────────────────────────── */
    .friends-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── Header : titre tronqué ──────────────────────────────────────────── */
    #chat-header {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100vw - 180px);
        font-size: 0.82rem !important;
    }

    /* ── Header : boutons droite, réduire l'espacement ───────────────────── */
    .header-right-controls {
        gap: 8px !important;
        margin-right: 8px !important;
    }

    /* ── Panel profil/paramètres : pleine largeur mobile ─────────────────── */
    #profile-dropdown {
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        bottom: 70px !important;
        max-height: calc(100dvh - 140px) !important;
    }

    /* ── Sélecteur de statut : ancré en bas à droite ─────────────────────── */
    #status-picker {
        position: fixed !important;
        left: auto !important;
        right: 10px !important;
        top: auto !important;
        bottom: 75px !important;
        max-width: calc(100vw - 20px) !important;
    }

    /* ── Flyout orb : repositionné en bas pour mobile ────────────────────── */
    .orb-menu-flyout {
        bottom: auto !important;
        top: auto !important;
        left: 8px !important;
        right: 8px !important;
        transform: none !important;
        width: auto !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    /* ── Menus contextuels : contraindre dans le viewport ────────────────── */
    .cyber-dropdown,
    .sphere-ctx-menu,
    #sphere-dropdown {
        max-width: calc(100vw - 20px) !important;
        right: 10px !important;
        left: auto !important;
    }

    /* ── Safe area bottom pour les iPhones avec encoche ──────────────────── */
    #mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}
/* ===== BADGE DE SPHÈRE ===== */

/* Pill dans le header (toggle opt-in) */
#sphere-badge-zone {
    display: flex;
    align-items: center;
}
.sphere-badge-toggle {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid var(--badge-color, var(--theme-primary));
    color: var(--badge-color, var(--theme-primary));
    background: transparent;
    opacity: 0.45;
    transition: opacity 0.2s, background 0.2s;
    user-select: none;
}
.sphere-badge-toggle.actif {
    opacity: 1;
    background: color-mix(in srgb, var(--badge-color, var(--theme-primary)) 18%, transparent);
}
.sphere-badge-toggle:hover { opacity: 0.9; }

/* Pill dans les messages */
.msg-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-left: 5px;
    cursor: pointer;
    border: 1px solid var(--badge-color, #58a6ff);
    color: var(--badge-color, #58a6ff);
    background: color-mix(in srgb, var(--badge-color, #58a6ff) 15%, transparent);
    vertical-align: middle;
    transition: opacity 0.15s;
}
.msg-badge:hover { opacity: 0.75; }

/* Badge dans la liste des agents (pas de cursor pointer, taille réduite) */
.agent-badge {
    cursor: default;
    font-size: 0.6rem;
    padding: 1px 5px;
    margin-left: 4px;
    flex-shrink: 0;
}
.agent-badge:hover { opacity: 1; }

/* Indicateur "en écoute" Spotify dans la liste des agents (discret) */
.agent-spotify {
    margin-left: 5px;
    font-size: 0.8rem;
    flex-shrink: 0;
    cursor: default;
    opacity: 0.85;
}

/* === Section Connexions (Paramètres) === */
.connexion-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 16px;
    max-width: 460px;
}
.connexion-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.connexion-logo { font-size: 1.6rem; line-height: 1; }
.connexion-titre { font-weight: 700; color: #f0f6fc; }
.connexion-etat { font-size: 0.82rem; color: #8b949e; margin-top: 2px; }
.connexion-actions { display: flex; gap: 10px; }
.connexion-share {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: #c9d1d9;
    cursor: pointer;
}
.connexion-share input { accent-color: #1DB954; }

/* Bouton étoile dans la modale de tags */
.tag-star-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    color: #8b949e;
    line-height: 1;
    transition: color 0.15s;
}
.tag-star-btn.active { color: #e3b341; }
.tag-star-btn:hover { color: #e3b341; }

/* Popup info sphère (clic badge dans message) */
#badge-info-popup {
    position: fixed;
    z-index: 9999;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 14px 16px;
    min-width: 200px;
    max-width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: none;
}
.bip-icone {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin-bottom: 8px;
}
.bip-nom {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 6px;
}
.bip-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 8px;
}
.bip-desc {
    font-size: 0.8rem;
    color: #8b949e;
    line-height: 1.4;
}

/* =========================================
   🎙️ MESSAGES VOCAUX (enregistrement façon WhatsApp)
   ========================================= */

#btn-vocal {
    color: var(--theme-primary);
    filter: none;
    font-size: 19px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    touch-action: none; /* indispensable : on gère nous-mêmes le geste */
    user-select: none;
}
#btn-vocal:hover { filter: none; transform: scale(1.12); }
/* Halo CONTENU (pas d'anneau qui déborde sous la barre de saisie) :
   on pulse une lueur interne + un léger scale, rien ne sort du bouton. */
#btn-vocal.recording {
    color: #fff;
    background: var(--theme-danger);
    /* Pendant l'enregistrement (appui maintenu), le micro qui pulse passe
       AU-DESSUS de la surcouche grise (#voice-recorder, z-index 230) pour
       rester visible. En mode verrouillé, le JS masque le micro (les
       contrôles de la surcouche prennent le relais). */
    z-index: 235;
    animation: vr-pulse-glow 1.3s ease-in-out infinite;
}
@keyframes vr-pulse-glow {
    0%, 100% { box-shadow: 0 0 6px 0 rgba(var(--theme-danger-rgb), 0.55); transform: scale(1); }
    50%      { box-shadow: 0 0 11px 2px rgba(var(--theme-danger-rgb), 0.85); transform: scale(1.06); }
}

/* Rail du cadenas : flotte au-dessus du micro pendant l'appui */
#vr-lock-track {
    position: absolute;
    right: 14px;
    bottom: 52px;
    width: 40px;
    padding: 12px 0 10px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(20, 22, 28, 0.92);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 20px;
    z-index: 240;
    color: #8b949e;
    transition: transform 0.15s ease, background 0.15s ease;
}
#vr-lock-track.visible { display: flex; }
#vr-lock-track.armed {
    background: rgba(var(--theme-primary-rgb), 0.22);
    color: var(--theme-primary);
    transform: translateY(-4px);
}
#vr-lock-track #vr-lock-icon { font-size: 15px; }
#vr-lock-track .vr-chevron {
    font-size: 12px;
    animation: vr-chevron-bounce 1.1s infinite;
}
@keyframes vr-chevron-bounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50%      { transform: translateY(-4px); opacity: 1; }
}

/* Barre d'enregistrement : recouvre la zone de saisie */
#voice-recorder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 6px;
    background: rgba(20, 22, 28, 0.96);
    border-radius: 8px;
    z-index: 230;
    animation: vr-fade-in 0.15s ease;
}
@keyframes vr-fade-in { from { opacity: 0; } to { opacity: 1; } }

#vr-pulse {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--theme-danger);
    flex-shrink: 0;
    animation: vr-blink 1.1s infinite;
}
#voice-recorder.paused #vr-pulse { animation: none; opacity: 0.4; }
@keyframes vr-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }

#vr-timer {
    font-family: 'Orbitron', monospace;
    font-size: 0.95rem;
    color: #c9d1d9;
    min-width: 52px;
    flex-shrink: 0;
}
#vr-hint {
    flex: 1;
    color: #8b949e;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#voice-recorder.locked #vr-hint { color: var(--theme-primary); }

.vr-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #8b949e;
    font-size: 17px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}
.vr-btn:hover { transform: scale(1.12); }
.vr-trash:hover { color: var(--theme-danger); background: rgba(var(--theme-danger-rgb), 0.15); }
.vr-send { color: var(--theme-primary); }
.vr-send:hover { color: #fff; background: var(--theme-primary); }

/* En mode non-verrouillé : seuls poubelle/timer/hint visibles.
   Pause + envoi n'apparaissent qu'en mode mains libres (.locked). */
#voice-recorder #vr-pause,
#voice-recorder #vr-send { display: none; }
#voice-recorder.locked #vr-pause,
#voice-recorder.locked #vr-send { display: flex; }
#voice-recorder.locked #vr-trash { order: -1; }
/* Pause masquée si le navigateur ne sait pas mettre en pause (ex. iOS Safari) */
#voice-recorder.no-pause #vr-pause { display: none !important; }

/* Lecteur audio dans les messages */
.voice-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(var(--theme-primary-rgb), 0.10);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.25);
    border-radius: 18px;
    max-width: 340px;
}
.voice-bubble .voice-icon {
    color: var(--theme-primary);
    font-size: 18px;
    flex-shrink: 0;
}
.voice-bubble audio {
    height: 36px;
    flex: 1;
    min-width: 180px;
}
.voice-bubble .voice-dur {
    font-family: 'Orbitron', monospace;
    font-size: 0.78rem;
    color: #8b949e;
    flex-shrink: 0;
}
.voice-bubble.voice-loading,
.voice-bubble.voice-error {
    color: #8b949e;
    font-size: 0.85rem;
    font-style: italic;
}
.voice-bubble.voice-error { color: var(--theme-danger); }

/* Bouton "+" : joindre un fichier / image / vidéo */
#btn-attach {
    color: var(--theme-primary);
    filter: none;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#btn-attach:hover { filter: none; transform: scale(1.15); }

/* Vidéo dans le chat (comme les images : prévisualisation inline) */
.video-bubble {
    margin-top: 8px;
    max-width: 360px;
}
.message-video {
    display: block;
    width: 100%;
    max-height: 320px;
    border-radius: 8px;
    background: #000;
    border: 1px solid var(--border-subtle, #30363d);
}
.video-caption {
    margin-top: 6px;
    color: #c9d1d9;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}
.image-bubble { margin-top: 8px; max-width: 360px; }
.image-bubble .message-image { cursor: zoom-in; }
.file-bubble {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle, #30363d);
    max-width: 360px;
}
.file-bubble-icon { color: var(--theme-primary, #ffb75e); }
.file-bubble-name {
    flex: 1;
    color: #c9d1d9;
    font-size: 0.9rem;
    word-break: break-word;
}
.file-bubble-dl {
    color: var(--theme-primary, #ffb75e);
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}
.file-bubble-dl:hover { text-decoration: underline; }

/* === Menu du bouton "+" (Fichier / Sondage) === */
.attach-wrap { position: relative; display: inline-flex; }
#attach-menu {
    position: absolute;
    bottom: 130%;
    left: 0;
    flex-direction: column;
    gap: 2px;
    background: rgba(20, 22, 28, 0.98);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 10px;
    padding: 6px;
    z-index: 260;
    min-width: 210px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.attach-menu-item {
    background: none;
    border: none;
    color: #c9d1d9;
    text-align: left;
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 9px;
    transition: background 0.12s;
}
.attach-menu-item:hover { background: rgba(var(--theme-primary-rgb), 0.18); color: #fff; }

/* === Messages éphémères === */
#ephemere-picker {
    position: absolute;
    bottom: 130%;
    left: 0;
    flex-direction: column;
    gap: 4px;
    background: rgba(20, 22, 28, 0.98);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.45);
    border-radius: 12px;
    padding: 10px 8px 8px;
    z-index: 261;
    min-width: 160px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55);
}
.ephemere-picker-title {
    font-size: 0.78rem;
    color: var(--theme-primary);
    text-align: center;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    margin-bottom: 2px;
    font-weight: 600;
    letter-spacing: .04em;
}
.ephemere-dur-btn {
    background: rgba(var(--theme-primary-rgb), 0.1);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    color: #c9d1d9;
    border-radius: 7px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 0.88rem;
    text-align: center;
    transition: background 0.12s, color 0.12s;
}
.ephemere-dur-btn:hover { background: rgba(var(--theme-primary-rgb), 0.3); color: #fff; }
.ephemere-cancel { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #f87171; }
.ephemere-cancel:hover { background: rgba(239,68,68,0.28); color: #fff; }

/* Badge "armé" dans la barre d'input */
#ephemere-armed {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(var(--theme-primary-rgb), 0.15);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.4);
    border-radius: 20px;
    padding: 3px 10px 3px 8px;
    font-size: 0.8rem;
    color: var(--theme-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    align-self: center;
}
#ephemere-armed:hover { background: rgba(var(--theme-primary-rgb), 0.28); }
.ephemere-armed-close {
    background: none; border: none; color: inherit;
    cursor: pointer; padding: 0; line-height: 1; font-size: 1rem; opacity: .7;
}
.ephemere-armed-close:hover { opacity: 1; }

/* Badge countdown sur le message */
.ephemere-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #a0aec0;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 1px 8px;
    margin-top: 4px;
    opacity: 0.85;
}
.ephemere-countdown { font-variant-numeric: tabular-nums; }

/* === Flyout d'autocomplétion des mentions @ === */
.mention-flyout {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(20, 22, 28, 0.98);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 10px;
    padding: 6px;
    z-index: 270;
    max-height: 244px;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.mention-flyout-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}
.mention-flyout-item.actif,
.mention-flyout-item:hover {
    background: rgba(var(--theme-primary-rgb), 0.18);
}
.mention-flyout-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: #0d1117;
}
.mention-flyout-noms {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}
.mention-flyout-affiche {
    color: #f0f6fc;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mention-flyout-pseudo {
    color: #8b949e;
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mention-flyout-hint {
    padding: 6px 10px 2px;
    color: #6e7681;
    font-size: 0.72rem;
}

/* === Modale création de sondage === */
.sondage-option-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sondage-option-row .sondage-opt { flex: 1; }
.sondage-opt-del {
    background: none;
    border: 1px solid #30363d;
    color: #8b949e;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    cursor: pointer;
    transition: 0.12s;
}
.sondage-opt-del:hover { color: #fff; border-color: var(--theme-danger); background: rgba(var(--theme-danger-rgb), 0.2); }

/* === Champs de formulaire homogènes (input/textarea/select) ===
   .cyber-input n'était pas stylé → rendu navigateur natif "années 2000".
   Cette règle harmonise toutes les modales de l'app d'un coup. */
.cyber-input,
input.cyber-input,
textarea.cyber-input,
select.cyber-input {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.cyber-input::placeholder { color: #6e7681; }
.cyber-input:focus,
input.cyber-input:focus,
textarea.cyber-input:focus,
select.cyber-input:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.18);
}
textarea.cyber-input { resize: vertical; min-height: 60px; }
/* Select : on enlève le chevron natif et on en remet un propre, thémé */
select.cyber-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 36px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b949e' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
select.cyber-input option { background: #161b22; color: #e6edf3; }

/* === Sélecteur Choix unique / multiple (segmenté) === */
.sondage-mode-toggle {
    display: flex;
    gap: 6px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 4px;
}
.sondage-mode-toggle button {
    flex: 1;
    background: transparent;
    border: none;
    color: #8b949e;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.sondage-mode-toggle button.actif {
    background: rgba(var(--theme-primary-rgb), 0.20);
    color: var(--theme-primary);
    font-weight: 700;
}
.sondage-mode-toggle button:not(.actif):hover { color: #e6edf3; }
.sondage-add-opt {
    width: 100%;
    margin-top: 4px;
    border-style: dashed !important;
}

/* === Sondage rendu dans le chat === */
.chaos-poll {
    margin-top: 8px;
    max-width: 420px;
    background: rgba(var(--theme-primary-rgb), 0.06);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.22);
    border-radius: 12px;
    padding: 12px 14px;
}
.poll-question {
    font-weight: 700;
    color: #e6edf3;
    margin-bottom: 4px;
    word-break: break-word;
}
.poll-mode {
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8b949e;
    margin-bottom: 10px;
}
.poll-mode:empty { display: none; }
.poll-option {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 9px 12px;
    margin-bottom: 7px;
    cursor: pointer;
    color: #c9d1d9;
    font-size: 0.92rem;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
}
.poll-option:hover { border-color: rgba(var(--theme-primary-rgb), 0.6); }
.poll-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0%;
    background: rgba(var(--theme-primary-rgb), 0.20);
    transition: width 0.4s ease;
    z-index: 0;
}
.poll-opt-label { position: relative; z-index: 1; flex: 1; word-break: break-word; }
.poll-opt-count {
    position: relative;
    z-index: 1;
    font-family: 'Orbitron', monospace;
    font-size: 0.78rem;
    color: #8b949e;
    margin-left: 10px;
    flex-shrink: 0;
}
.poll-option.poll-chosen {
    border-color: var(--theme-primary);
    background: rgba(var(--theme-primary-rgb), 0.12);
}
.poll-option.poll-chosen .poll-opt-label { color: #fff; font-weight: 600; }
.poll-option.poll-leading .poll-fill { background: rgba(var(--theme-primary-rgb), 0.32); }
.poll-foot {
    margin-top: 4px;
    font-size: 0.78rem;
    color: #8b949e;
}
.poll-statut {
    margin-top: 6px;
    font-size: 0.76rem;
    color: var(--theme-primary);
}
.poll-statut:empty { display: none; }
/* Sondage clôturé : options figées, plus de survol cliquable */
.chaos-poll.poll-closed .poll-statut { color: #8b949e; }
.chaos-poll.poll-closed .poll-option {
    cursor: default;
    opacity: 0.85;
}
.chaos-poll.poll-closed .poll-option:hover { border-color: #30363d; background: rgba(255,255,255,0.04); }

.poll-anon-badge {
    font-size: 11px;
    color: #8b949e;
    padding: 0 2px 6px;
    display: none;
}
.chaos-poll .poll-anon-badge:not(:empty) { display: block; }

.poll-voters {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px 7px;
    flex-wrap: wrap;
}
.poll-voter-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--theme-primary-rgb), 0.35);
    object-fit: cover;
    cursor: default;
    flex-shrink: 0;
    transition: transform 0.12s;
    background: #30363d;
    display: inline-block;
    vertical-align: middle;
}
.poll-voter-avatar:hover { transform: scale(1.3); z-index: 2; position: relative; }
.poll-voter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(var(--theme-primary-rgb), 0.1);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.2);
    border-radius: 12px;
    padding: 1px 7px 1px 3px;
    font-size: 11px;
    color: #c9d1d9;
    cursor: default;
    flex-shrink: 0;
}
.poll-voter-chip img {
    width: 16px; height: 16px;
    border-radius: 50%;
    object-fit: cover;
    background: #30363d;
}
.poll-voter-overflow {
    font-size: 11px;
    color: #8b949e;
    background: #21262d;
    border-radius: 10px;
    padding: 2px 6px;
    flex-shrink: 0;
}

/* === Carte d'invitation de sphère (clic droit allié → inviter) === */
.sphere-invite-card {
    margin-top: 8px;
    max-width: 340px;
    background: #161b22;
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 6px 22px rgba(0,0,0,0.45);
}
.sic-head { display: flex; align-items: center; gap: 12px; }
.sic-icone {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.sic-icone-ph {
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--theme-primary-rgb), 0.18);
    color: var(--theme-primary);
    font-weight: 700;
    font-size: 1.2rem;
}
.sic-titre-wrap { min-width: 0; }
.sic-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--theme-primary);
    font-weight: 700;
}
.sic-nom {
    font-size: 1rem;
    font-weight: 700;
    color: #f0f6fc;
    word-break: break-word;
}
.sic-desc {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #c9d1d9;
    line-height: 1.4;
    word-break: break-word;
}
.sic-join {
    margin-top: 12px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: var(--theme-primary);
    color: #161b22;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}
.sic-join:hover { filter: brightness(1.12); transform: translateY(-1px); }
.sic-join:disabled { opacity: 0.6; cursor: default; transform: none; filter: none; }
.sic-secours {
    margin-top: 10px;
    font-size: 0.74rem;
    color: #8b949e;
    word-break: break-all;
}
.sic-lien { color: #58a6ff; text-decoration: none; }
.sic-lien:hover { text-decoration: underline; }
.sic-code { color: #8b949e; }

/* Tag « WEBHOOK » à côté de l'auteur d'un message posté via webhook */
.webhook-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(88, 166, 255, 0.18);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.45);
    vertical-align: middle;
}

/* === Soundboard (panneau + bouton + tuiles) === */
#btn-soundboard { color: var(--theme-primary); }
#soundboard-panel {
    position: fixed;
    left: 78px;
    bottom: 90px;
    width: 320px;
    max-height: 60vh;
    background: rgba(20, 22, 28, 0.97);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0,0,0,0.55);
    z-index: 9000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.sb-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #30363d;
}
.sb-title { font-weight: 700; color: var(--theme-primary); font-size: 0.95rem; }
.sb-close {
    background: none; border: none; color: #8b949e;
    font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.sb-close:hover { color: #fff; }
.sb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
}
.sb-empty { grid-column: 1 / -1; color: #8b949e; font-style: italic; font-size: 0.85rem; text-align: center; margin: 10px 0; }
.sb-tile {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid #30363d;
    border-radius: 10px;
    color: #c9d1d9;
    cursor: pointer;
    transition: border-color 0.12s, transform 0.08s, background 0.12s;
}
.sb-tile:hover { border-color: rgba(var(--theme-primary-rgb), 0.6); background: rgba(var(--theme-primary-rgb), 0.10); }
.sb-tile:active { transform: scale(0.96); }
.sb-tile-ic { font-size: 1.2rem; }
.sb-tile-lbl {
    font-size: 0.78rem; text-align: center;
    max-width: 100%; word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sb-tile-del {
    position: absolute; top: 4px; right: 6px;
    color: #8b949e; font-size: 0.95rem; line-height: 1;
    width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
.sb-tile-del:hover { color: #fff; background: var(--theme-danger); }
#soundboard-manage { padding: 10px 12px 12px; border-top: 1px solid #30363d; }
.sb-add-row { display: flex; gap: 6px; align-items: center; }
.sb-add-row input[type="text"] {
    flex: 1; min-width: 0;
    background: #0d1117; border: 1px solid #30363d; color: #c9d1d9;
    border-radius: 6px; padding: 6px 8px; font-size: 0.8rem;
}
.sb-add-btn { padding: 6px 10px; font-size: 0.78rem; flex-shrink: 0; }
.sb-msg { font-size: 0.76rem; color: #8b949e; min-height: 1em; margin: 6px 0 0; }

/* ======================================================================
   PASSE MOBILE — barre d'input décompressée (≤768px).
   La textarea reprend la priorité (flex:1 + min-width:0, posé sur
   .input-container) ; ici on resserre les écarts et on compacte les
   boutons en cibles tactiles pour qu'elle ne soit plus « ratatinée ».
   ====================================================================== */
@media (max-width: 768px) {
    /* Barre de saisie : collée aux bords, arrondie (pill) et sobre — norme
       des applis mobiles. */
    .input-area {
        margin: 0 !important;
        left: 2px !important;
        right: 2px !important;
        padding: 5px 6px !important;
        border-radius: 22px !important;
        border-color: rgba(255, 255, 255, 0.08) !important;
        background: rgba(255, 255, 255, 0.04) !important;
    }
    .input-wrapper-inner { gap: 6px; }
    .action-buttons { gap: 8px; }
    .action-buttons .icon-btn {
        font-size: 19px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        flex-shrink: 0;
    }
    #btn-vocal { width: 40px; height: 40px; flex-shrink: 0; }
    #btn-envoi { width: 42px; height: 42px; flex-shrink: 0; }
    /* 16px : empêche le zoom automatique d'iOS au focus du champ. */
    #input { font-size: 16px; border-radius: 18px; }

    /* (3) Paramètres avancés : plein écran + sidebar verticale → barre
       d'onglets horizontale à HAUTEUR FIXE (sinon les items se chevauchent).
       Le bouton × sort du flux (absolu haut-droite) pour ne plus recouvrir
       les onglets. Pur CSS, markup/JS intacts. */
    .params-overlay { padding: 0 !important; }
    .params-container {
        position: relative;
        width: 100% !important;
        height: 100dvh !important;
        max-width: none !important;
        border-radius: 0 !important;
        border: none !important;
        flex-direction: column !important;
    }
    .params-sidebar {
        width: 100% !important;
        height: 52px !important;
        min-height: 52px !important;
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 2px;
        padding: 0 54px 0 6px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex-shrink: 0;
        border-right: none !important;
        border-bottom: 1px solid rgba(var(--theme-primary-rgb), 0.2) !important;
        -webkit-overflow-scrolling: touch;
    }
    .params-sidebar .params-nav-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 2px;
        height: 100%;
    }
    .params-nav-label,
    .params-nav-divider { display: none !important; }
    .params-sidebar .params-nav-item {
        width: auto !important;
        height: 100% !important;
        white-space: nowrap;
        flex-shrink: 0;
        align-items: center;
        padding: 0 14px !important;
        margin: 0 !important;
        border-left: none !important;
        border-radius: 0 !important;
        border-bottom: 2px solid transparent !important;
    }
    .params-sidebar .params-nav-item.active {
        border-bottom-color: var(--theme-primary) !important;
        background: rgba(var(--theme-primary-rgb), 0.12) !important;
    }
    .params-nav-close {
        position: absolute !important;
        top: 8px;
        right: 8px;
        left: auto !important;
        width: auto !important;
        margin: 0 !important;
        height: 36px;
        z-index: 6;
        border-left: none !important;
        border-radius: 8px !important;
        padding: 0 10px !important;
        background: rgba(var(--theme-primary-rgb), 0.16) !important;
    }
    .params-main { padding: 18px 16px 28px !important; }
    .params-content-wrap { max-width: none !important; }
}

/* (b) P2 : pendant la saisie (#input focalisé) on escamote le micro vocal
   en douceur — on ne fait pas de vocal en tapant. La textarea (flex:1)
   récupère la place. Desktop + mobile. */
#btn-vocal {
    transition: opacity 0.15s ease, max-width 0.2s ease, margin 0.2s ease;
    max-width: 60px;
    overflow: hidden;
}
.input-area.is-composing #btn-vocal {
    opacity: 0;
    max-width: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* ======================================================================
   (b) Bouton fusionné Emoji+GIF : barre d'onglets commune. On réutilise
   les 2 pickers existants, juste remontés au-dessus de la barre + alignés.
   ====================================================================== */
#emojigif-tabs {
    position: absolute;
    bottom: 85px;
    left: 14px;
    z-index: 2001;
    display: none;
    gap: 6px;
    padding: 5px;
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.5);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}
#emojigif-tabs .egt-tab {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 7px;
    color: #c9d1d9;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
#emojigif-tabs .egt-tab:hover { background: rgba(var(--theme-primary-rgb), 0.18); }
#emojigif-tabs .egt-tab.active { background: var(--theme-primary); color: #0d1117; }
/* Pickers remontés juste au-dessus de la barre d'onglets, mêmes repères. */
#chat-emoji-picker-container { bottom: 134px !important; left: 14px !important; }
#gif-picker { bottom: 134px !important; left: 14px !important; }

/* Bouton "enregistrer" du nom d'affichage : petit, themé, discret —
   remplace le gros bouton gris « OK » pour s'harmoniser avec les
   lignes de champ des paramètres (PC + mobile). */
.params-save-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--theme-primary-rgb), 0.14);
    color: var(--theme-primary);
    border: 1px solid rgba(var(--theme-primary-rgb), 0.35);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, transform 0.1s;
}
.params-save-btn:hover { background: rgba(var(--theme-primary-rgb), 0.24); }
.params-save-btn:active { transform: scale(0.94); }

/* ==========================================================================
   BOUTONS EMOJI / GIF — RESPONSIVE
   Desktop : boutons séparés (#btn-emoji + #btn-gif)
   Mobile  : bouton fusionné (#btn-emojigif) avec onglets
   ========================================================================== */
#btn-emojigif { display: none; }

@media (max-width: 768px) {
    #btn-emoji, #btn-gif { display: none; }
    #btn-emojigif { display: inline-flex; }
}

/* ==========================================================================
   PICKERS EMOJI/GIF — DESKTOP
   Remplacement du bottom: 134px legacy (système onglets) par une position
   ancrée juste au-dessus de la barre d'input.
   Le triangle ::before relie visuellement le picker à son bouton.
   ========================================================================== */
@media (min-width: 769px) {
    #chat-emoji-picker-container {
        bottom: 70px !important;
        left: 44px !important;
    }
    #gif-picker {
        bottom: 70px !important;
        left: 100px !important;
    }

    /* Triangle pointant vers le bas (bouton emoji) */
    #chat-emoji-picker-container::before {
        content: '';
        position: absolute;
        bottom: -11px;
        left: 20px;
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 11px solid rgba(var(--theme-primary-rgb), 0.55);
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
    }

    /* Triangle pointant vers le bas (bouton GIF) */
    #gif-picker::before {
        content: '';
        position: absolute;
        bottom: -11px;
        left: 20px;
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 11px solid var(--theme-primary);
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Mode PiP (Picture-in-Picture vocal) — mini-fenêtre Electron
   On masque tout le shell de l'app principale et on ne montre que le conteneur
   #pip-container injecté par js/core/pip-mode.js.
   ═══════════════════════════════════════════════════════════════════════════ */
body.pip-mode > *:not(#pip-container):not(script):not(#boot-loader) {
    display: none !important;
}
body.pip-mode {
    background: #0d1117;
    overflow: hidden;
    margin: 0;
    padding: 0;
}
body.pip-mode #pip-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    color: #c9d1d9;
    font-family: 'Orbitron', system-ui, sans-serif;
}
body.pip-mode #pip-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    /* Zone draggable (Electron) */
    -webkit-app-region: drag;
    user-select: none;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}
body.pip-mode #pip-title {
    color: var(--theme-primary, #58a6ff);
}
body.pip-mode #pip-close-btn {
    /* Bouton non-draggable pour qu'on puisse cliquer dessus */
    -webkit-app-region: no-drag;
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 1em;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
}
body.pip-mode #pip-close-btn:hover {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
}
body.pip-mode #pip-participants {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: flex-start;
    justify-content: center;
}
body.pip-mode .pip-empty {
    color: #8b949e;
    font-size: .85em;
    text-align: center;
    padding: 24px 12px;
    width: 100%;
}

body.pip-mode .pip-participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 72px;
}

body.pip-mode .pip-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #58a6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    background: #21262d;
    flex-shrink: 0;
    transition: box-shadow .2s;
}

body.pip-mode .pip-avatar.is-speaking {
    box-shadow: 0 0 0 3px var(--theme-primary, #58a6ff);
}

body.pip-mode .pip-name {
    font-size: .72em;
    color: #c9d1d9;
    text-align: center;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Picker emojis custom (#custom-emoji-picker) ─────────────────────────── */
#custom-emoji-picker {
    position: absolute;
    bottom: 134px;
    left: 14px;
    width: 320px;
    max-height: 340px;
    overflow-y: auto;
    background: #161b22;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 12px;
    padding: 10px;
    z-index: 2001;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
#custom-emoji-picker::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 22px;
    width: 14px;
    height: 14px;
    background: #161b22;
    border-right: 1px solid rgba(255,255,255,.1);
    border-bottom: 1px solid rgba(255,255,255,.1);
    transform: rotate(45deg);
}
.cep-section { margin-bottom: 12px; }
.cep-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.cep-upload-btn {
    cursor: pointer;
    font-size: .85rem;
    color: var(--theme-primary);
    background: rgba(var(--theme-primary-rgb), .1);
    padding: 2px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.cep-upload-btn:hover { background: rgba(var(--theme-primary-rgb), .25); }
.cep-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cep-empty {
    font-size: .78rem;
    color: var(--text-muted);
    font-style: italic;
}
.cep-item {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    overflow: visible;
    cursor: pointer;
    transition: background .15s;
}
.cep-item:hover { background: rgba(255,255,255,.08); }
.cep-item img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    cursor: pointer;
}
.cep-del, .cep-save {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: .6rem;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
    border: none;
    padding: 0;
}
.cep-del  { background: #ef4444; color: #fff; }
.cep-save { background: #f59e0b; color: #000; right: 10px; }
.cep-item:hover .cep-del,
.cep-item:hover .cep-save { opacity: 1; }

/* emoji custom inline dans les messages */
/* Règle de base (input, flyouts, etc.) */
.chat-emoji-custom {
    height: 1.4em;
    width: auto;
    vertical-align: middle;
    object-fit: contain;
    border-radius: 3px;
    display: inline !important;
}

/* Spécificité 0-2-1 > .message-content img (0-1-1) → écrase border/cursor/etc. */
.message-content img.chat-emoji-custom {
    height: 1.4em;
    width: auto;
    vertical-align: -0.25em;
    object-fit: contain;
    border: none !important;
    border-radius: 3px;
    margin-top: 0 !important;
    max-height: unset !important;
    cursor: default !important;
    display: inline !important;
}

/* ── Autocomplete flyout emoji (:nom) ───────────────────────────────────── */
#emoji-flyout {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #161b22;
    border: 1px solid rgba(var(--theme-primary-rgb), 0.4);
    border-radius: 10px;
    z-index: 3000;
    box-shadow: 0 -6px 24px rgba(0,0,0,.5);
    padding: 4px;
}
.emoji-flyout-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-main);
    transition: background .1s;
}
.emoji-flyout-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}
.emoji-flyout-item:hover,
.emoji-flyout-item.active { background: rgba(var(--theme-primary-rgb), .2); }
.emoji-flyout-item span { font-family: monospace; opacity: .85; }

/* ── Formulaire d'upload inline dans le picker ──────────────────────────── */
.cep-upload-form {
    background: rgba(0,0,0,.3);
    border: 1px solid rgba(var(--theme-primary-rgb), .3);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.cep-upload-preview {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255,255,255,.05);
}
.cep-upload-nom {
    width: 100%;
    font-size: .82rem;
    padding: 6px 10px !important;
    text-align: center;
}
.cep-upload-actions {
    display: flex;
    gap: 8px;
}
.cep-upload-actions button {
    padding: 5px 14px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
}
.cep-upload-cancel { background: rgba(255,255,255,.1); color: var(--text-main); }
.cep-upload-cancel:hover { background: rgba(255,255,255,.18); }
.cep-upload-confirm { background: var(--theme-primary); color: #0d1117; }
.cep-upload-confirm:hover { filter: brightness(1.1); }
.cep-upload-confirm:disabled { opacity: .5; cursor: default; }
.cep-upload-hint { font-size: .7rem; color: var(--text-muted); }

/* ── Preview overlay long-press ─────────────────────────────────────────── */
#cep-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    cursor: pointer;
}
#cep-preview-overlay img {
    width: min(200px, 60vw);
    height: min(200px, 60vw);
    object-fit: contain;
    border-radius: 16px;
    background: rgba(255,255,255,.05);
}
.cep-preview-nom {
    font-family: monospace;
    font-size: 1rem;
    color: #fff;
    opacity: .85;
}

/* ── Twemoji — règle de base globale ─────────────────────────────────────── */
/* S'applique partout où Twemoji génère un <img class="twemoji">.
   Les contextes spécifiques (message-content, input, réactions…) surchargent. */
img.twemoji {
    display: inline-block;
    height: 1.3em;
    width: 1.3em;
    vertical-align: -0.2em;
    object-fit: contain;
    pointer-events: none;
    border: none !important;
    border-radius: 0 !important;
    max-height: unset !important;
    margin-top: 0 !important;
    cursor: default !important;
    filter: none !important;
    -webkit-filter: none !important;
    forced-color-adjust: none;
}

/* ── Emojis Twemoji dans les messages ───────────────────────────────────── */
.message-content img.twemoji,
.message-content img.emoji {
    display: inline !important;
    height: 1.4em;
    width: 1.4em;
    vertical-align: -0.3em;
    object-fit: contain;
    margin: 0 0.05em;
    cursor: pointer !important;
    pointer-events: auto !important;
}
.message-content.emoji-only img.twemoji {
    height: 2.2em;
    width: 2.2em;
}

/* ── Twemoji dans la barre rapide de réactions ───────────────────────────── */
.quick-react-btn img.twemoji {
    height: 1.8rem;
    width: 1.8rem;
    display: block;
    border-radius: 0 !important;
}

/* ── Twemoji dans la barre d'action des messages ─────────────────────────── */
.btn-quick-react img.twemoji {
    height: 1.15em;
    width: 1.15em;
    display: block;
    border-radius: 0 !important;
}

/* ── Twemoji dans les badges de réaction ─────────────────────────────────── */
.reaction-emoji img.twemoji {
    height: 1.1em;
    width: 1.1em;
    vertical-align: -0.15em;
    display: inline-block;
}

/* ==========================================================================
   STREAM VIEWER (salon)
   ========================================================================== */

#stream-viewer {
    display: none;
    flex-direction: column;
    background: #0d1117;
    border-bottom: 2px solid var(--theme-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    transition: max-height 0.3s ease;
    max-height: 70vh;
    flex-shrink: 0;
    position: relative;
}

#sv-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(var(--theme-primary-rgb, 88,166,255), 0.08);
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
}

#sv-icon { font-size: 1.1em; }

#sv-title {
    flex: 1;
    font-size: .9em;
    font-weight: 600;
    color: #e6edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sv-controls {
    display: flex;
    gap: 6px;
}

#sv-controls button {
    background: rgba(255,255,255,0.06);
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #8b949e;
    cursor: pointer;
    padding: 4px 10px;
    font-size: .8em;
    transition: background .15s, color .15s;
}
#sv-controls button:hover { background: rgba(255,255,255,0.12); color: #e6edf3; }

#sv-btn-pip:hover { color: #58a6ff; }
#sv-btn-fullscreen:hover { color: #3fb950; }
#sv-btn-leave { color: #da3633 !important; border-color: #da363344 !important; }
#sv-btn-leave:hover { background: rgba(218,54,51,0.18) !important; color: #ff6b6b !important; }

#sv-video-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
    min-height: 120px;
    position: relative;
}

#sv-close-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 60%);
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    z-index: 10;
}
#sv-btn-close-stream {
    background: #da3633;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    color: #fff;
    font-size: 1.3em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform .15s, background .15s, box-shadow .15s;
    box-shadow: 0 2px 12px rgba(0,0,0,.5);
}
#sv-btn-close-stream:hover {
    background: #f85149;
    transform: scale(1.12);
    box-shadow: 0 4px 18px rgba(218,54,51,.5);
}
.sv-tv-icon {
    position: relative;
    display: inline-flex;
}
.sv-tv-icon::after {
    content: '';
    position: absolute;
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    background: linear-gradient(135deg, transparent 42%, #fff 42%, #fff 58%, transparent 58%);
    border-radius: 2px;
}

#sv-video-wrap video {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 0;
    background: #000;
    display: block;
}

/* État réduit : seulement le header reste visible */
#stream-viewer.sv-collapsed {
    max-height: 42px;
    overflow: hidden;
}
#stream-viewer.sv-collapsed #sv-video-wrap {
    display: none;
}

/* ==========================================================================
   SCREEN PICKER MODAL (Electron)
   ========================================================================== */

#screen-picker-overlay {
    z-index: 25000;
}

#screen-picker-overlay .spm-box {
    width: 680px;
    max-width: calc(100vw - 40px);
    max-height: 82dvh;
}

#screen-picker-overlay .spm-box h2 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

#screen-picker-overlay .spm-body {
    overflow-y: auto;
}

.spm-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #30363d;
}

.spm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.spm-source-card {
    border: 2px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    background: #161b22;
}

.spm-source-card:hover {
    border-color: var(--theme-primary, #58a6ff);
    box-shadow: 0 0 12px rgba(var(--theme-primary-rgb, 88, 166, 255), 0.25);
    transform: translateY(-2px);
}

.spm-source-card.selected {
    border-color: var(--theme-primary, #58a6ff);
    box-shadow: 0 0 18px rgba(var(--theme-primary-rgb, 88, 166, 255), 0.45);
}

.spm-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #0d1117;
}

.spm-source-name {
    padding: 6px 8px;
    font-size: 0.72rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spm-source-card.selected .spm-source-name {
    color: var(--theme-primary, #58a6ff);
    font-weight: 600;
}

.spm-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 20px 0;
    grid-column: 1 / -1;
}

/* ==========================================================================
   IN-APP NOTIFICATIONS
   ========================================================================== */

#inapp-notif-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 340px;
}

.inapp-notif {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #161b22;
    border: 1px solid #30363d;
    border-left: 3px solid var(--theme-primary, #58a6ff);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity .22s ease, transform .22s ease;
    max-width: 340px;
}

.inapp-notif.ian-visible {
    opacity: 1;
    transform: translateX(0);
}

.inapp-notif.ian-out {
    opacity: 0;
    transform: translateX(30px);
}

.ian-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .95rem;
    color: #fff;
    background-size: cover;
    background-position: center;
}

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

.ian-titre {
    font-weight: 600;
    font-size: .88em;
    color: #e6edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ian-texte {
    font-size: .8em;
    color: #8b949e;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ian-close {
    background: none;
    border: none;
    color: #484f58;
    cursor: pointer;
    font-size: .85em;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color .15s;
}
.ian-close:hover { color: #e6edf3; }

/* ── Stream : indicateur sur le tag vocal ───────────────────────────────── */
.stream-badge-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(var(--theme-primary-rgb), 0.18);
    color: var(--theme-primary);
    font-size: .7em;
    cursor: pointer;
    margin-left: auto;
    transition: background .15s, transform .15s;
    flex-shrink: 0;
}
.stream-badge-icone:hover {
    background: rgba(var(--theme-primary-rgb), 0.35);
    transform: scale(1.15);
}
.vocal-agent-tag.is-streaming .vocal-pseudo {
    color: var(--theme-primary);
    font-weight: 600;
}

/* ── Stream : bouton et liste spectateurs ────────────────────────────────── */
#sv-btn-spectateurs {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
#sv-btn-spectateurs:hover { color: var(--theme-primary); }
#sv-spectateurs-list {
    padding: 6px 12px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid #30363d;
    font-size: .8em;
    color: #8b949e;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sv-spectateur-item {
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    padding: 2px 8px;
    color: #e6edf3;
}
