:root {
    color-scheme: dark;
    --fond: #070512;
    --panneau: #120b22;
    --carte: #1a1030;
    --ligne: #3a2a58;
    --texte: #f7f4ff;
    --discret: #c4b6de;
    --accent: #5dfff2;
    --accent_rose: #ff4df2;
    --accent_texte: #04211e;
    --bot: #10343a;
    --membre: #341428;
    --danger: #ff8eae;
    --ombre: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    color: var(--texte);
    font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
    background: var(--fond);
    -webkit-text-size-adjust: 100%;
}

button, input, textarea {
    font: inherit;
    color: inherit;
}

button {
    min-height: 36px;
    background: var(--carte);
    color: var(--accent);
    border: 1px solid var(--ligne);
    border-radius: 12px;
    padding: 6px 10px;
    cursor: pointer;
}

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

.bouton_plein, .carte_login button, #bouton_envoyer {
    background: var(--accent);
    color: var(--accent_texte);
    border-color: var(--accent);
    font-weight: 700;
}

.ecran_login {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    background:
        radial-gradient(700px 320px at 0% 0%, rgba(255, 77, 242, 0.2), transparent 60%),
        radial-gradient(600px 280px at 100% 0%, rgba(93, 255, 242, 0.14), transparent 55%),
        var(--fond);
}

.carte_login, .dialogue {
    width: min(440px, 100%);
    background: var(--panneau);
    border: 1px solid var(--accent);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--ombre);
}

.carte_login h1, .dialogue h2, .barre h1 {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--accent);
}

.carte_login p, .meta, .vide { color: var(--discret); }

.vide { margin: 24px 16px; text-align: center; }

input, textarea {
    width: 100%;
    min-width: 0;
    font-size: 16px;
    background: #090612;
    border: 1px solid var(--ligne);
    border-radius: 12px;
    padding: 8px 10px;
    outline: none;
}

input:focus, textarea:focus { border-color: var(--accent_rose); }

.erreur {
    color: var(--danger);
    margin: 0;
    overflow-wrap: anywhere;
}

.appli {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
}

.colonne, .fil {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--panneau);
}

.fil { display: none; }

.appli.vue_fil .colonne { display: none; }
.appli.vue_fil .fil { display: flex; }

.barre {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--ligne);
    background: #0d0818;
}

.barre h1, #bouton_import, #bouton_sync, #bouton_retour {
    white-space: nowrap;
}

.barre h1 {
    overflow: hidden;
    text-overflow: ellipsis;
}

.fil_barre { grid-template-columns: auto minmax(0, 1fr) auto; }

.titre_groupe { min-width: 0; }

#titre_fil, #sous_titre_fil, .nom, .apercu, .quand {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#titre_fil { color: var(--accent); font-size: 1rem; }
#sous_titre_fil { color: var(--discret); font-size: 0.8rem; }

.outils {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.liste, .messages {
    min-height: 0;
    overflow: auto;
}

.liste { flex: 1; padding: 0 8px 12px; }

.conversation, .membre {
    width: 100%;
    text-align: left;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 0 0 8px;
    padding: 10px;
    color: var(--texte);
    background: var(--carte);
    border: 1px solid var(--ligne);
}

.conversation.actif {
    border-color: var(--accent_rose);
    background: #3a1634;
}

.identite { min-width: 0; }

.avatar, .pastille_lettre {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #241538;
    border: 1px solid var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.apercu, .quand, .meta_message { color: var(--discret); font-size: 0.85rem; }

.quand { max-width: 5.5rem; text-align: right; }

.pastille {
    min-width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    background: var(--accent_rose);
    color: #1a0416;
    font-size: 0.75rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    padding: 0 6px;
}

.messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.messages > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.plus_ancien { align-self: center; }

.bulle {
    max-width: 92%;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--membre);
    border: 1px solid #ff4df266;
}

.bulle.bot {
    align-self: flex-end;
    background: var(--bot);
    border-color: #5dfff266;
}

.bulle.supprime { opacity: 0.7; font-style: italic; }

.entete_message {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
}

.actions_message, .reactions, .emojis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.actions_message button, .reactions button { min-height: 40px; }

.contenu_message, .contenu_message p, .embed p, .embed div {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.contenu_message h1, .contenu_message h2, .contenu_message h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    line-height: 1.3;
}

.contenu_message pre, .contenu_message code {
    font-size: 0.85em;
    white-space: pre-wrap;
}

.citation {
    margin: 4px 0;
    padding-left: 8px;
    border-left: 3px solid var(--accent);
    color: var(--discret);
}

.reponse {
    display: grid;
    gap: 2px;
    width: 100%;
    margin: 0 0 6px;
    padding: 4px 8px;
    text-align: left;
    min-height: 0;
    border-left: 3px solid var(--accent);
    background: rgba(0, 0, 0, 0.28);
}

.reponse span, .cite_composeur {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--discret);
    font-size: 0.8rem;
}

.spoiler {
    background: #14101c;
    color: transparent;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}

.spoiler.ouvert {
    color: inherit;
    background: #2a2044;
    user-select: text;
}

.surligne { outline: 2px solid var(--accent); }

.action_icone {
    min-height: 32px;
    min-width: 32px;
    padding: 2px 8px;
}

.bulle a { color: var(--accent); overflow-wrap: anywhere; }

.embed {
    margin-top: 8px;
    padding: 8px 10px;
    border-left: 3px solid var(--accent);
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
}

.composeur {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--ligne);
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: #0d0818;
}

.ligne_saisie {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    align-items: end;
}

#bouton_envoyer { grid-column: 1 / -1; }

.ligne_saisie textarea {
    resize: vertical;
    min-height: 40px;
    max-height: 120px;
}

.piece input { display: none; }

.piece span {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--accent_rose);
    color: var(--accent_rose);
    background: var(--carte);
    cursor: pointer;
    font-size: 1.15rem;
}

.bandeau {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    color: var(--accent);
}

.bandeau span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.champ_dialogue { margin: 0; }

dialog {
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    margin: auto;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
}

.dialogue {
    max-height: calc(100dvh - 24px);
}

.dialogue .barre { padding-top: 12px; }

.dialogue .liste { max-height: 50dvh; }

dialog::backdrop { background: rgba(0, 0, 0, 0.72); }

.accueil_lya {
    position: relative;
    align-items: center;
    text-align: center;
}

.fermer_popup {
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 36px;
    padding: 0;
}

.coeur_violet {
    margin: 12px 0 0;
    font-size: 72px;
    line-height: 1;
    color: #9b5cff;
}

.message_lya {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

@media (min-width: 700px) {
    .ligne_saisie { grid-template-columns: 36px minmax(0, 1fr) auto; }
    #bouton_envoyer { grid-column: auto; }
    .bulle { max-width: min(640px, 92%); }
}

@media (min-width: 900px) {
    .appli { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
    .colonne,
    .fil,
    .appli.vue_fil .colonne,
    .appli.vue_fil .fil { display: flex; }
    .colonne { border-right: 1px solid var(--ligne); }
    #bouton_retour { display: none !important; }
    .fil_barre { grid-template-columns: minmax(0, 1fr) auto; }
    #bouton_sync { justify-self: end; }
    .barre { padding-top: 12px; }
}
