:root {
    --bg-servers: #1e1f22;
    --bg-sidebar: #2b2d31;
    --bg-chat: #313338;
    --bg-panel: #232428;
    --bg-input: #383a40;
    --bg-floating: #111214;
    --bg-popover: #2b2d31;
    --bg-hover: rgba(78, 80, 88, 0.3);
    --bg-msg-hover: #2e3035;
    --bg-selected: rgba(78, 80, 88, 0.6);
    --text-normal: #dbdee1;
    --text-strong: #f2f3f5;
    --text-muted: #949ba4;
    --text-faint: #80848e;
    --blurple: #5865f2;
    --blurple-hover: #4752c4;
    --green: #23a55a;
    --yellow: #f0b232;
    --red: #f23f43;
    --red-hover: #da373c;
    --link: #00a8fc;
    --divider: #3f4147;
    --mention-bg: rgba(250, 168, 26, 0.1);
    --mention-bar: #f0b232;
    --mention-pill: rgba(88, 101, 242, 0.3);
    --elevation: 0 1px 0 rgba(4, 4, 5, .2), 0 1.5px 0 rgba(6, 6, 7, .05), 0 2px 0 rgba(4, 4, 5, .05);
    --shadow-high: 0 8px 16px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg-chat);
    color: var(--text-normal);
    font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    overflow: hidden;
}

button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.icon { display: block; flex-shrink: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar { width: 16px; }
.messages::-webkit-scrollbar-thumb { border: 4px solid var(--bg-chat); border-radius: 8px; background: #1a1b1e; min-height: 40px; }
.messages::-webkit-scrollbar-track { background: var(--bg-sidebar); border: 4px solid var(--bg-chat); border-radius: 8px; }

.app { display: flex; height: 100vh; height: 100dvh; }

/* ---------- Barre des serveurs ---------- */
.servers {
    width: 72px;
    flex-shrink: 0;
    background: var(--bg-servers);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    overflow-y: auto;
}

.server-item { position: relative; width: 72px; display: flex; justify-content: center; }

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-chat);
    color: var(--text-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: border-radius .15s ease-out, background-color .15s ease-out, color .15s ease-out;
}

.server-icon:hover, .server-item.active .server-icon { border-radius: 16px; background: var(--blurple); color: #fff; }
.server-icon.add { color: var(--green); }
.server-icon.add:hover { background: var(--green); color: #fff; }

.pill {
    position: absolute;
    left: 0;
    top: 4px;
    width: 4px;
    height: 40px;
    background: #fff;
    border-radius: 0 4px 4px 0;
}

.servers-separator { width: 32px; height: 2px; border-radius: 1px; background: #35363c; }

/* ---------- Salons ---------- */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
}

.server-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-strong);
    box-shadow: var(--elevation);
    flex-shrink: 0;
}

.channel-list { flex: 1; overflow-y: auto; padding: 16px 8px 0 8px; }

.category {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 0 4px 2px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.channel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 8px;
    margin-bottom: 2px;
    border-radius: 4px;
    color: var(--text-faint);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.channel .icon { color: var(--text-faint); }
.channel .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel:hover { background: var(--bg-hover); color: var(--text-normal); }
.channel.unread { color: var(--text-strong); font-weight: 600; }
.channel.unread::before {
    content: "";
    position: absolute;
    left: -8px;
    width: 8px;
    height: 8px;
    border-radius: 0 4px 4px 0;
    background: #fff;
}
.channel.active { background: var(--bg-selected); color: #fff; }
.channel.active::before { display: none; }

.badge {
    background: var(--red);
    color: #fff;
    border-radius: 8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-panel {
    height: 52px;
    flex-shrink: 0;
    background: var(--bg-panel);
    padding: 0 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-chip {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 0;
    padding: 2px 4px 2px 2px;
    margin-left: -2px;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
}

.user-chip:hover { background: var(--bg-hover); }
.user-info { flex: 1; min-width: 0; line-height: 1.2; }
.user-name { font-size: 14px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-status { font-size: 12px; color: var(--text-muted); }

.icon-btn {
    background: none;
    border: 0;
    padding: 6px;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { color: var(--text-normal); background: var(--bg-hover); }
.icon-btn.on { color: var(--text-strong); }
.icon-btn.small { padding: 2px; }

/* ---------- Avatars et statuts ---------- */
.avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 17px;
    user-select: none;
}

.avatar.small { width: 32px; height: 32px; font-size: 14px; }
.avatar.tiny { width: 16px; height: 16px; font-size: 9px; }
.avatar.big { width: 80px; height: 80px; font-size: 34px; }

.status {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid var(--bg-panel);
    background: var(--green);
}

.members .status { border-color: var(--bg-sidebar); }
.avatar.big .status { width: 24px; height: 24px; border-width: 5px; border-color: var(--bg-floating); right: 0; bottom: 0; }

.status.idle { background: var(--yellow); }
.status.idle::after {
    content: "";
    position: absolute;
    width: 62%;
    height: 62%;
    top: -1px;
    left: -1px;
    border-radius: 50%;
    background: inherit;
    background: var(--bg-panel);
}
.members .status.idle::after { background: var(--bg-sidebar); }
.status.dnd { background: var(--red); }
.status.dnd::after {
    content: "";
    position: absolute;
    left: 20%;
    right: 20%;
    top: 50%;
    height: 3px;
    margin-top: -1.5px;
    border-radius: 2px;
    background: var(--bg-panel);
}
.members .status.dnd::after { background: var(--bg-sidebar); }
.status.offline, .status.invisible { background: #80848e; }
.status.offline::after, .status.invisible::after {
    content: "";
    position: absolute;
    inset: 25%;
    border-radius: 50%;
    background: var(--bg-panel);
}
.members .status.offline::after { background: var(--bg-sidebar); }

.bot-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--blurple);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    height: 15px;
    padding: 0 4px 0 2px;
    border-radius: 3px;
    vertical-align: 1px;
    line-height: 15px;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ---------- Discussion ---------- */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-chat); }

.chat-header {
    height: 48px;
    flex-shrink: 0;
    padding: 0 8px 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--elevation);
    z-index: 2;
}

.header-hash { color: var(--text-faint); }
.chat-header h1 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.header-divider { width: 1px; height: 24px; margin: 0 8px; background: var(--divider); flex-shrink: 0; }
.topic { flex: 1; min-width: 0; font-size: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-tools { display: flex; gap: 8px; margin-left: auto; }
.mobile-only { display: none; }

.chat-body { flex: 1; min-height: 0; display: flex; }

.messages-wrap { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }

.messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 16px;
}

.welcome { margin-top: auto; padding: 16px 16px 8px; }

.welcome-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #41434a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome h2 { margin: 8px 0; font-size: 32px; font-weight: 700; color: var(--text-strong); }
.welcome p { margin: 0; color: var(--text-muted); }

.day-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px 16px 8px;
    height: 0;
    border-top: 1px solid var(--divider);
}

.day-divider span {
    background: var(--bg-chat);
    padding: 2px 4px;
    margin-top: -1px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 13px;
}

/* Messages */
.message {
    position: relative;
    padding: 2px 48px 2px 72px;
    min-height: 22px;
    line-height: 1.375;
}

.message:hover, .message.menu-open { background: var(--bg-msg-hover); }
.message.first { margin-top: 17px; min-height: 44px; }
.message.mentioned { background: var(--mention-bg); }
.message.mentioned::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--mention-bar);
}
.message.mentioned:hover { background: rgba(250, 168, 26, 0.08); }
.message.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: rgba(88, 101, 242, .25); } }

.message > .avatar { position: absolute; left: 16px; top: 2px; cursor: pointer; }
.message.has-reply > .avatar { top: 24px; }

.message-header { display: flex; align-items: center; gap: 6px; line-height: 22px; flex-wrap: wrap; }
.author { font-weight: 500; color: var(--text-strong); cursor: pointer; }
.author:hover { text-decoration: underline; }
.timestamp { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-left: 2px; }

.side-time {
    position: absolute;
    left: 0;
    width: 72px;
    text-align: center;
    top: 4px;
    font-size: 11px;
    color: var(--text-muted);
    visibility: hidden;
}

.message:hover .side-time { visibility: visible; }

.content {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    color: var(--text-normal);
}

.content.jumbo { font-size: 48px; line-height: 1.2; }
.content a { color: var(--link); text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content code.inline {
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    padding: 0 .2em;
    font-size: 85%;
    font-family: Consolas, "Andale Mono WT", Monaco, monospace;
}
.content pre {
    margin: 6px 0 0;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    padding: 8px;
    max-width: 90%;
    overflow-x: auto;
    white-space: pre-wrap;
}
.content pre code { font-family: Consolas, "Andale Mono WT", Monaco, monospace; font-size: 14px; line-height: 1.125rem; }
.content .quote { border-left: 4px solid #4e5058; padding: 0 8px 0 12px; margin: 2px 0; }
.content .mention {
    background: var(--mention-pill);
    color: #c9cdfb;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 500;
    cursor: pointer;
}
.content .mention:hover { background: var(--blurple); color: #fff; }
.content .spoiler {
    background: #1e1f22;
    color: transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 0 2px;
    transition: background-color .1s;
}
.content .spoiler * { visibility: hidden; }
.content .spoiler:hover { background: #18191c; }
.content .spoiler.revealed { background: rgba(255, 255, 255, .1); color: inherit; cursor: auto; }
.content .spoiler.revealed * { visibility: visible; }

.edited { font-size: 10px; color: var(--text-muted); margin-left: 4px; user-select: none; }

.attachment-img {
    display: block;
    margin-top: 6px;
    max-width: min(400px, 100%);
    max-height: 350px;
    border-radius: 8px;
    cursor: zoom-in;
    background: #2b2d31;
}

/* Réponse */
.reply-context {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.125rem;
    color: var(--text-muted);
    cursor: pointer;
    min-width: 0;
}

.reply-context::before {
    content: "";
    position: absolute;
    left: -38px;
    top: 50%;
    width: 33px;
    height: 13px;
    border-left: 2px solid #4e5058;
    border-top: 2px solid #4e5058;
    border-top-left-radius: 6px;
}

.reply-context .reply-author { font-weight: 500; flex-shrink: 0; opacity: .9; }
.reply-context .reply-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.reply-context:hover .reply-text { color: var(--text-strong); }
.reply-context.missing { font-style: italic; cursor: default; }

/* Réactions */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; }

.reaction {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 6px;
    border-radius: 8px;
    background: #2b2d31;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}

.reaction:hover { background: #393c41; border-color: #4e5058; }
.reaction.me { background: rgba(88, 101, 242, .15); border-color: var(--blurple); color: #c9cdfb; }
.reaction .emoji { font-size: 16px; line-height: 1; }

/* Barre d'actions au survol */
.msg-actions {
    position: absolute;
    right: 14px;
    top: -16px;
    display: none;
    background: var(--bg-chat);
    border: 1px solid #26282c;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
    padding: 2px;
    z-index: 1;
}

.message:hover .msg-actions, .message.menu-open .msg-actions { display: flex; }
.msg-actions button {
    background: none;
    border: 0;
    border-radius: 4px;
    padding: 5px;
    color: #b5bac1;
    cursor: pointer;
    display: flex;
}
.msg-actions button:hover { background: var(--bg-hover); color: var(--text-strong); }
.msg-actions button.danger { color: var(--red); }
.msg-actions .quick { font-size: 16px; line-height: 20px; width: 30px; justify-content: center; padding: 5px 0; }

/* Modification en place */
.edit-box { margin: 4px 0; }
.edit-box textarea {
    width: 100%;
    background: var(--bg-input);
    border: 0;
    border-radius: 8px;
    padding: 11px 16px;
    color: var(--text-normal);
    font: inherit;
    line-height: 1.375;
    resize: none;
    outline: 0;
}
.edit-hint { font-size: 12px; color: var(--text-normal); padding-top: 4px; }
.edit-hint a { color: var(--link); cursor: pointer; }

/* ---------- Zone de saisie ---------- */
.composer { position: relative; padding: 0 16px; flex-shrink: 0; }

.composer-box {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 0 6px 0 0;
    display: flex;
    align-items: flex-start;
}

.reply-banner + .attachment + .composer-box,
.reply-banner:not([hidden]) ~ .composer-box { border-top-left-radius: 0; border-top-right-radius: 0; }

.composer-btn { padding: 10px 12px 10px 16px; color: #b5bac1; }
#emojiBtn { padding: 10px 6px; }
.composer-btn:hover { background: none; color: var(--text-strong); }

.composer textarea {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    resize: none;
    color: var(--text-normal);
    font: inherit;
    line-height: 1.375;
    max-height: 50vh;
    padding: 11px 0;
}

.composer textarea::placeholder { color: #6d6f78; }

.reply-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2b2d31;
    border-radius: 8px 8px 0 0;
    padding: 6px 12px 6px 16px;
    font-size: 14px;
    color: var(--text-muted);
}
.reply-banner b { color: var(--text-normal); font-weight: 600; }

.attachment {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border-bottom: 1px solid #2b2d31;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
}
.attachment img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; background: #2b2d31; }
.attachment span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment .icon-btn { color: var(--red); }
.attachment:not([hidden]) + .composer-box { border-top-left-radius: 0; border-top-right-radius: 0; }

.composer-footer { height: 24px; display: flex; align-items: center; font-size: 12px; gap: 12px; }
.typing { flex: 1; min-width: 0; color: var(--text-normal); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.typing b { font-weight: 700; }
.typing-dots { display: inline-flex; gap: 2px; margin-right: 4px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-normal); animation: typing 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.composer-error { color: var(--red); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Suggestions (commandes / mentions) */
.suggestions {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: calc(100% + 8px);
    background: var(--bg-popover);
    border-radius: 8px;
    box-shadow: var(--shadow-high);
    padding: 8px 0;
    max-height: 340px;
    overflow-y: auto;
    z-index: 5;
}

.suggestions h4 {
    margin: 0;
    padding: 4px 12px 8px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 0 8px;
    border-radius: 4px;
    cursor: pointer;
}
.suggestion.active { background: var(--bg-selected); }
.suggestion .cmd { color: var(--text-strong); font-weight: 600; white-space: nowrap; }
.suggestion .args { color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.suggestion .desc { color: var(--text-muted); font-size: 14px; margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Glisser-déposer */
.drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(88, 101, 242, .85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 6;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    pointer-events: none;
}
.drop-overlay.show { display: flex; }
.drop-overlay div { border: 2px dashed rgba(255, 255, 255, .7); border-radius: 12px; padding: 48px 64px; }

/* ---------- Membres ---------- */
.members {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    overflow-y: auto;
    padding: 0 8px 20px;
}
.members.hidden { display: none; }

.members h3 {
    margin: 0;
    padding: 24px 8px 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--text-muted);
}

.member {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 8px;
    border-radius: 4px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
}
.member:hover { background: var(--bg-hover); }
.member .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.member.offline { opacity: .3; }
.member.offline:hover { opacity: 1; }
.member .member-sub { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.member-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.member-line { display: flex; align-items: center; gap: 4px; min-width: 0; }

/* ---------- Popovers ---------- */
.popover {
    position: fixed;
    z-index: 20;
    background: var(--bg-popover);
    border-radius: 8px;
    box-shadow: var(--shadow-high), 0 0 0 1px rgba(0, 0, 0, .15);
}

.emoji-picker { width: 352px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; height: 380px; max-height: calc(100vh - 80px); }
.emoji-search { padding: 12px; box-shadow: var(--elevation); }
.emoji-search input {
    width: 100%;
    background: #1e1f22;
    border: 0;
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--text-normal);
    font: inherit;
    font-size: 14px;
    outline: 0;
}
.emoji-scroll { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.emoji-scroll h5 { margin: 12px 4px 4px; font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-grid button {
    background: none;
    border: 0;
    font-size: 26px;
    line-height: 1;
    padding: 4px 0;
    border-radius: 4px;
    cursor: pointer;
}
.emoji-grid button:hover { background: var(--bg-hover); }

/* ---------- Fenêtres ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 16px;
    animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } }

.modal {
    width: 440px;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    background: var(--bg-chat);
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    animation: pop .15s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

.modal h2 { margin: 0 0 8px; text-align: center; font-size: 24px; color: var(--text-strong); }
.modal p { margin: 0 0 20px; text-align: center; color: #b5bac1; }
.modal .left { text-align: left; }
.modal h2.left { font-size: 20px; }
.modal label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: #b5bac1; margin-bottom: 8px; }
.modal input {
    background: #1e1f22;
    border: 0;
    border-radius: 3px;
    padding: 10px;
    color: var(--text-normal);
    font: inherit;
    outline: 0;
    margin-bottom: 20px;
}
.modal .hint { font-size: 12px; margin: 12px 0 0; text-align: left; color: var(--text-muted); }

.profile-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-floating);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.preview-name { font-size: 20px; font-weight: 700; color: var(--text-strong); word-break: break-word; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.swatch {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.swatch.selected { box-shadow: 0 0 0 2px var(--bg-chat), 0 0 0 4px #fff; }

.status-options { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.status-option {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #2b2d31;
    border: 0;
    border-radius: 4px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    color: var(--text-normal);
}
.status-option:hover { background: #393c41; }
.status-option.selected { background: rgba(88, 101, 242, .2); box-shadow: inset 0 0 0 1px var(--blurple); }
.status-option .status { position: relative; right: auto; bottom: auto; border-color: #2b2d31; }
.status-option.selected .status, .status-option:hover .status { border-color: transparent; }
.status-option .status::after { background: #2b2d31 !important; }
.status-option small { display: block; color: var(--text-muted); font-size: 12px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #2b2d31;
    margin: 20px -24px -24px;
    padding: 16px 24px;
    border-radius: 0 0 8px 8px;
}

.btn-primary, .btn-danger {
    color: #fff;
    border: 0;
    border-radius: 3px;
    padding: 10px 20px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color .17s ease;
}
.btn-primary { background: var(--blurple); }
.btn-primary:hover { background: var(--blurple-hover); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: var(--red-hover); }
.btn-link { background: none; border: 0; color: #fff; font-size: 14px; cursor: pointer; padding: 10px 16px; }
.btn-link:hover { text-decoration: underline; }

.confirm-preview {
    border-radius: 4px;
    box-shadow: 0 0 0 1px #1e1f22, 0 2px 10px rgba(0, 0, 0, .2);
    padding: 8px 0;
    max-height: 240px;
    overflow: hidden;
    pointer-events: none;
}
.confirm-preview .message { margin-top: 0; padding-right: 16px; }
.confirm-preview .msg-actions { display: none !important; }

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 32px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%);
    background: var(--bg-floating);
    color: var(--text-strong);
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: var(--shadow-high);
    z-index: 50;
    font-size: 14px;
    font-weight: 500;
    animation: pop .15s ease-out;
}

/* ---------- Arcade ---------- */
.arcade {
    width: 560px;
    max-width: 100%;
    max-height: 100%;
    background: var(--bg-chat);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: pop .15s ease-out;
}

.arcade-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 16px;
    color: var(--text-strong);
    box-shadow: var(--elevation);
}
.arcade-header h2 { margin: 0; font-size: 18px; flex: 1; }

.arcade-tabs { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; background: #2b2d31; }
.arcade-tabs button {
    background: none;
    border: 0;
    border-radius: 4px;
    padding: 6px 10px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
}
.arcade-tabs button:hover { background: var(--bg-hover); color: var(--text-normal); }
.arcade-tabs button.active { background: var(--bg-selected); color: #fff; }

.arcade-stage { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }

.game-bar { width: 100%; display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 14px; }
.game-bar b { color: var(--text-strong); }
.game-canvas { max-width: 100%; border-radius: 8px; background: #1e1f22; touch-action: none; display: block; }
.game-wrap { position: relative; max-width: 100%; }
.game-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(30, 31, 34, .85);
    border-radius: 8px;
    text-align: center;
    padding: 16px;
    color: var(--text-strong);
}
.game-overlay h3 { margin: 0; font-size: 22px; }
.game-overlay p { margin: 0; color: var(--text-muted); }
.game-msg { min-height: 20px; font-size: 14px; color: var(--text-muted); text-align: center; }
.game-msg.win { color: var(--green); font-weight: 600; }

.dpad { display: none; grid-template-columns: repeat(3, 48px); gap: 4px; }
.dpad button { height: 44px; background: #2b2d31; border: 0; border-radius: 6px; color: var(--text-strong); font-size: 18px; cursor: pointer; }
.dpad button:active { background: var(--blurple); }
@media (pointer: coarse) { .dpad { display: grid; } }

.ttt { display: grid; grid-template-columns: repeat(3, 96px); gap: 6px; }
.ttt button {
    height: 96px;
    background: #2b2d31;
    border: 0;
    border-radius: 8px;
    font-size: 48px;
    font-weight: 800;
    cursor: pointer;
    color: var(--text-strong);
    transition: background-color .1s;
}
.ttt button:hover:enabled { background: #393c41; }
.ttt button.x { color: #5865f2; }
.ttt button.o { color: #eb459e; }
.ttt button.win { background: rgba(35, 165, 90, .3); }

.memory { display: grid; grid-template-columns: repeat(4, 76px); gap: 8px; }
.card {
    height: 76px;
    border: 0;
    border-radius: 8px;
    font-size: 36px;
    cursor: pointer;
    background: var(--blurple);
    color: transparent;
    transition: transform .2s, background-color .2s;
}
.card:hover { transform: translateY(-2px); }
.card.open, .card.done { background: #2b2d31; color: inherit; transform: rotateY(180deg); }
.card.open span, .card.done span { display: inline-block; transform: rotateY(180deg); }
.card.done { opacity: .5; cursor: default; }

.board { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.board-card { background: #2b2d31; border-radius: 8px; padding: 12px; }
.board-card h4 { margin: 0 0 8px; color: var(--text-strong); font-size: 15px; }
.board-card ol { margin: 0; padding-left: 0; list-style: none; font-size: 14px; }
.board-card li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; color: var(--text-normal); }
.board-card li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card .empty { color: var(--text-muted); font-size: 14px; }

/* ---------- Petits écrans ---------- */
@media (max-width: 1100px) {
    .members { display: none; }
    .members.shown { display: block; position: absolute; right: 0; top: 48px; bottom: 0; z-index: 8; box-shadow: -4px 0 12px rgba(0, 0, 0, .3); }
    .chat { position: relative; }
}

@media (max-width: 760px) {
    .mobile-only { display: flex; }
    .header-divider, .topic { display: none; }
    .chat-header { padding-left: 8px; }
    .chat-header h1 { flex: 1; overflow: hidden; text-overflow: ellipsis; }
    .servers, .sidebar { position: fixed; top: 0; bottom: 0; z-index: 25; transform: translateX(-320px); transition: transform .2s ease; }
    .servers { left: 0; }
    .sidebar { left: 72px; }
    .app.nav-open .servers, .app.nav-open .sidebar { transform: none; }
    .nav-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 24; display: none; }
    .app.nav-open .nav-scrim { display: block; }
    .message { padding-right: 12px; }
    .msg-actions { right: 8px; }
    .welcome h2 { font-size: 26px; }
    .ttt { grid-template-columns: repeat(3, 80px); }
    .ttt button { height: 80px; }
    .memory { grid-template-columns: repeat(4, 64px); }
    .card { height: 64px; font-size: 30px; }
}
