:root {
    color-scheme: dark;
    --bg: #1e1f22;
    --bg-soft: #2b2d31;
    --panel: #2b2d31;
    --panel-solid: #313338;
    --panel-2: #383a40;
    --panel-3: #404249;
    --text: #f2f3f5;
    --muted: #a6a9b0;
    --soft: #dbdee1;
    --line: rgba(255, 255, 255, .09);
    --brand: #6366f1;
    --brand-hot: #ec4899;
    --cyan: #22d3ee;
    --green: #22c55e;
    --amber: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 28px 90px rgba(0, 0, 0, .42);
    --shadow-soft: 0 14px 42px rgba(0, 0, 0, .22);
    --surface-glass: rgba(255, 255, 255, .055);
    --surface-hover: rgba(99, 102, 241, .14);
    --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
}

body.ui-large { font-size: 16px; }
body.ui-xlarge { font-size: 17px; }

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(99, 102, 241, .16), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(34, 211, 238, .18), transparent 28%),
        radial-gradient(circle at 18% 80%, rgba(236, 72, 153, .11), transparent 28%);
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; }

::selection {
    background: rgba(99, 102, 241, .42);
    color: white;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .38) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .28);
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, .44);
    background-clip: padding-box;
}

button,
.server-pill,
.channel-row,
.friend-card,
.icon-button {
    touch-action: manipulation;
}

button,
input,
select,
textarea,
.channel-row,
.message,
.admin-user-row,
.discover-card,
.modal-card {
    min-width: 0;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button {
    user-select: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid rgba(34, 211, 238, .72);
    outline-offset: 2px;
}

.landing {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.hero {
    min-height: 78vh;
    padding: 24px clamp(18px, 5vw, 76px) 58px;
}

.topbar, .hero-grid, .auth-panel {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 900;
    text-decoration: none;
}

.brand span, .server-pill {
    position: relative;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--brand), var(--brand-hot));
    color: white;
    font-weight: 950;
    box-shadow: 0 14px 32px rgba(99, 102, 241, .32);
}

.server-pill.has-unread::before,
.server-pill.has-ping::before {
    content: "";
    position: absolute;
    left: -8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--soft);
}

.server-pill.has-ping::before {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}

.ghost-link {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .04);
    color: var(--soft);
    text-decoration: none;
    font-weight: 800;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(390px, 548px);
    gap: clamp(28px, 5vw, 66px);
    align-items: center;
    padding-top: clamp(54px, 9vh, 92px);
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    max-width: 680px;
    font-size: clamp(58px, 9vw, 118px);
    line-height: .88;
}

h2, h3 { margin: 0; }

.hero-copy p:not(.eyebrow) {
    max-width: 640px;
    margin: 22px 0 0;
    color: var(--soft);
    font-size: 18px;
    line-height: 1.75;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.landing-feature-grid {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 34px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.landing-feature-grid article {
    min-height: 150px;
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
}

.landing-feature-grid strong {
    font-size: 18px;
}

.landing-feature-grid span {
    color: var(--soft);
    line-height: 1.6;
}

.primary-button, .secondary-button, .danger-button, .send-button {
    min-height: 44px;
    border-radius: var(--radius);
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-weight: 900;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, filter .16s ease;
}

.compact {
    min-height: 38px;
    padding: 0 13px;
    font-size: 13px;
}

.primary-button {
    background: linear-gradient(135deg, var(--brand), #8b5cf6 52%, var(--brand-hot));
    box-shadow: 0 18px 36px rgba(99, 102, 241, .28);
}

.secondary-button {
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--line);
}

.danger-button { background: linear-gradient(135deg, var(--danger), #fb7185); }
.send-button { background: linear-gradient(135deg, var(--brand), #7c3aed); }
.primary-button:hover, .secondary-button:hover, .danger-button:hover, .send-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}
.secondary-button:hover {
    border-color: rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .12);
}
.primary-button:active, .secondary-button:active, .danger-button:active, .send-button:active, .icon-button:active {
    transform: translateY(0);
}
.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.send-button:disabled,
.icon-button:disabled {
    opacity: .48;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.preview-window {
    min-height: 456px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: var(--radius);
    overflow: hidden;
    display: grid;
    grid-template-columns: 76px 180px 1fr;
    background: rgba(12, 15, 25, .86);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.preview-sidebar {
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(6, 8, 14, .72);
}

.preview-sidebar span {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: linear-gradient(145deg, #29324d, #151b2c);
}

.preview-sidebar span:first-child {
    background: linear-gradient(145deg, var(--brand), var(--brand-hot));
}

.preview-channels, .preview-chat {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.preview-channels {
    background: rgba(18, 22, 35, .9);
    color: var(--muted);
}

.preview-channels b { color: white; margin-bottom: 10px; }
.preview-channels span {
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-radius: var(--radius);
}
.preview-channels span:nth-child(2) { background: rgba(255, 255, 255, .08); color: white; }

.preview-chat {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .03), transparent),
        rgba(13, 16, 27, .92);
}

.preview-message {
    width: 100%;
    height: 58px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, #232b42, #171d2d);
}

.preview-message.short { width: 72%; }

.preview-call {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.preview-call span {
    min-height: 104px;
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(99, 102, 241, .24), rgba(34, 211, 238, .14));
    border: 1px solid var(--line);
}

.preview-chat strong {
    margin-top: auto;
    padding: 14px;
    border-radius: var(--radius);
    background: rgba(34, 197, 94, .13);
    color: #9af7bc;
    border: 1px solid rgba(34, 197, 94, .24);
}

.auth-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    padding: 20px clamp(18px, 5vw, 76px) 76px;
}

.invite-landing {
    display: grid;
    align-content: start;
    min-height: 100vh;
    padding: 24px clamp(16px, 5vw, 76px);
}

.invite-preview-card {
    width: min(720px, 100%);
    margin: clamp(34px, 8vh, 82px) auto;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(43, 45, 49, .92);
    box-shadow: var(--shadow);
}

.invite-preview-banner {
    min-height: 210px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--server-banner), #fff 12%), var(--server-banner)),
        var(--server-banner);
    background-size: cover;
    background-position: center;
}

.invite-preview-body {
    position: relative;
    display: grid;
    gap: 14px;
    padding: 28px;
}

.invite-preview-icon {
    width: 86px;
    height: 86px;
    margin-top: -70px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--radius);
    border: 6px solid var(--panel);
    color: white;
    font-size: 28px;
    font-weight: 950;
}

.invite-preview-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.invite-preview-body h1 {
    font-size: clamp(34px, 6vw, 58px);
    line-height: 1;
}

.invite-preview-body p {
    max-width: 620px;
    color: var(--soft);
    line-height: 1.6;
}

.legal-page {
    padding: 24px clamp(18px, 5vw, 76px) 80px;
}

.legal-card {
    width: min(860px, 100%);
    margin: 46px auto 0;
    display: grid;
    gap: 16px;
    padding: clamp(22px, 4vw, 40px);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .07);
    box-shadow: var(--shadow);
}

.legal-card h1 {
    margin: 0;
    font-size: clamp(36px, 6vw, 68px);
}

.legal-card p {
    margin: 0;
    color: var(--soft);
    line-height: 1.65;
}

.landing-footer {
    position: relative;
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 22px 0 34px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

.landing-footer div,
.landing-footer nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.landing-footer strong {
    color: var(--text);
}

.landing-footer a {
    color: var(--soft);
    text-decoration: none;
    font-weight: 800;
}

.auth-card {
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--radius);
    padding: 28px;
    background: rgba(17, 21, 34, .76);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .26);
    backdrop-filter: blur(18px);
}

.form-stack {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(13, 16, 27, .82);
    color: var(--text);
    outline: none;
    padding: 13px 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:hover, select:hover, textarea:hover {
    background: rgba(18, 22, 35, .9);
    border-color: rgba(255, 255, 255, .14);
}

input::placeholder,
textarea::placeholder {
    color: rgba(166, 169, 176, .72);
}

input[readonly] {
    color: var(--soft);
    background: rgba(255, 255, 255, .045);
    cursor: default;
}

input[type="range"] {
    accent-color: var(--brand);
    min-height: 38px;
    padding-inline: 0;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(99, 102, 241, .7);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}

textarea { min-height: 94px; resize: vertical; }

.app-shell {
    position: relative;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: 72px clamp(248px, 22vw, 300px) minmax(0, 1fr);
    overflow: hidden;
    background: #313338;
}

.server-rail {
    background: #1e1f22;
    border-right: 1px solid rgba(0, 0, 0, .25);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 0;
}

.server-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.server-pill {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 8px 20px rgba(0, 0, 0, .2);
    transition: border-radius .16s ease, transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.server-pill:hover, .server-pill.active {
    border-radius: 18px;
    transform: translateY(-1px);
    filter: brightness(1.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 12px 26px rgba(0, 0, 0, .26);
}

.server-pill img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: inherit;
}

.server-pill.add {
    background: linear-gradient(145deg, #16a34a, #15803d);
    color: #ddffe9;
    font-size: 24px;
}

.server-pill.join {
    background: linear-gradient(145deg, #26324d, #1a2032);
    color: #dce5ff;
    font-size: 18px;
}

.channel-panel {
    background: #2b2d31;
    border-right: 1px solid rgba(0, 0, 0, .22);
    display: grid;
    grid-template-rows: 64px minmax(0, 1fr) auto auto;
    backdrop-filter: blur(18px);
}

.channel-panel header, .chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, .22);
}

.mini-actions {
    display: flex;
    gap: 6px;
}

#serverName, #channelName {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.verified-badge {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    font-size: 11px;
    font-weight: 950;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, .22);
}

.user-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(88, 101, 242, .18);
    color: #dfe3ff;
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0;
}

.user-badge.official { background: linear-gradient(135deg, #5865f2, #22d3ee); color: white; }
.user-badge.team { background: rgba(34, 197, 94, .2); color: #9af7bc; }
.user-badge.gold { background: rgba(245, 158, 11, .22); color: #ffe0a3; }
.user-badge.blue { background: rgba(59, 130, 246, .22); color: #bfdbfe; }
.user-badge.green { background: rgba(34, 197, 94, .2); color: #bbf7d0; }
.user-badge.pink { background: rgba(236, 72, 153, .2); color: #fbcfe8; }
.user-badge.purple { background: rgba(168, 85, 247, .22); color: #e9d5ff; }
.user-badge.cyan { background: rgba(6, 182, 212, .2); color: #cffafe; }

.inline-badges,
.profile-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.profile-badges {
    margin: 0 0 8px;
}

.friend-card .inline-badges {
    justify-content: center;
    margin-left: 0;
}

.chat-header {
    background: #313338;
    backdrop-filter: blur(18px);
}

.chat-header > div:first-child {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-channel-toggle {
    display: none;
    flex: 0 0 auto;
}

#channelType {
    color: var(--cyan);
    font-weight: 900;
}

.icon-button {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    display: inline-grid;
    place-items: center;
    background: rgba(255, 255, 255, .04);
    color: var(--muted);
    border: 1px solid transparent;
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}

.icon-button:hover, .icon-button.active {
    color: white;
    background: rgba(99, 102, 241, .18);
    border-color: rgba(99, 102, 241, .28);
    transform: translateY(-1px);
}

.channel-list {
    overflow: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.channel-search {
    height: 44px;
    margin-bottom: 12px;
    background: #1e1f22;
    border-color: rgba(255, 255, 255, .05);
    font-weight: 800;
}

.server-mini-profile {
    margin: 0 0 14px;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .045);
}

.server-mini-banner {
    min-height: 76px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--server-banner), #fff 13%), var(--server-banner)),
        var(--server-banner);
    background-size: cover;
    background-position: center;
}

.server-mini-meta {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
}

.server-mini-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--radius);
    color: white !important;
    font-size: 13px;
    font-weight: 950;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13);
}

.server-mini-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.server-mini-meta strong,
.server-mini-meta small {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-mini-meta small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.server-mini-tags,
.invite-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 10px 10px;
}

.server-mini-tags span,
.invite-tags span {
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(99, 102, 241, .16);
    color: #cfd5ff;
    font-size: 11px;
    font-weight: 850;
}

.server-mini-actions {
    display: flex;
    gap: 8px;
    padding: 0 10px 10px;
}

.category-title {
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    margin: 16px 8px 7px;
}

.channel-row {
    width: 100%;
    min-height: 44px;
    border-radius: var(--radius);
    padding: 0 11px;
    color: #b5bac1;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    text-align: left;
    min-width: 0;
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.channel-row em {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(34, 197, 94, .16);
    color: #9af7bc;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
}

.voice-presence {
    display: grid;
    gap: 6px;
    margin: 4px 0 8px 28px;
}

.voice-presence div {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    color: var(--muted);
}

.voice-presence .avatar,
.voice-presence .avatar-wrap {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

.voice-presence .status-dot {
    width: 10px;
    height: 10px;
    border-width: 2px;
}

.channel-row:hover, .channel-row.active {
    background: #3f4248;
    color: white;
    border-color: rgba(255, 255, 255, .07);
}

.channel-row:hover {
    transform: translateX(1px);
}

.channel-row.has-unread {
    color: var(--text);
    font-weight: 850;
}

.friend-row strong {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}

.unread-dot.ping {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}

.friend-row.has-unread .avatar-wrap::before,
.friend-row.has-unread .group-avatar::before,
.friend-card.has-unread .avatar-wrap::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}

.friend-row.has-ping .avatar-wrap::before,
.friend-row.has-ping .group-avatar::before,
.friend-card.has-ping .avatar-wrap::before {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}

.channel-row[draggable="true"] {
    cursor: grab;
}

.channel-row.dragging {
    opacity: .52;
    outline: 1px solid rgba(99, 102, 241, .5);
}

.channel-row .avatar-wrap,
.channel-row .avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.channel-row span {
    color: var(--cyan);
    font-weight: 900;
}

.group-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #5865f2, #22c55e);
    color: white !important;
    font-size: 12px;
    font-weight: 950;
}

.voice-card {
    margin: 12px;
    padding: 13px;
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(34, 197, 94, .13), rgba(99, 102, 241, .1));
    border: 1px solid rgba(255, 255, 255, .1);
}

.voice-card.is-hidden {
    display: none;
}

.voice-card span { font-weight: 850; }
.voice-card small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.user-strip {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 32px 32px 32px 32px;
    gap: 7px;
    align-items: center;
    padding: 12px;
    background: #232428;
    border-top: 1px solid rgba(0, 0, 0, .24);
}

.self-profile-button {
    min-width: 0;
    min-height: 0;
    padding: 0;
    border-radius: var(--radius);
    background: transparent;
    color: inherit;
    text-align: left;
}

.self-profile-button:hover {
    background: rgba(255, 255, 255, .075);
}

.self-name-button {
    display: grid;
    gap: 2px;
}

.mobile-user-strip {
    display: none;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    font-weight: 950;
    color: white;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
    overflow: hidden;
}

.avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
}

.avatar img,
#selfAvatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.status-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 3px solid #111827;
    background: #6b7280;
}

.status-dot.online, .mini-dot.online, .status-text.online { background: var(--green); }
.status-dot.idle, .mini-dot.idle, .status-text.idle { background: var(--amber); }
.status-dot.dnd, .mini-dot.dnd, .status-text.dnd { background: var(--danger); }
.status-dot.offline, .mini-dot.offline, .status-text.offline { background: #6b7280; }

.mini-dot, .status-text {
    display: inline-block;
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.status-text {
    margin-right: 7px;
}

.user-strip strong, .member strong {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-strip small, .member small { color: var(--muted); }

.chat-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: 64px minmax(0, 1fr);
    overflow: hidden;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.header-actions #muteButton,
.header-actions #deafenButton,
.header-actions #cameraButton,
.header-actions #screenButton,
.header-actions #leaveVoiceButton {
    display: none !important;
}

.search-input {
    width: clamp(120px, 16vw, 220px);
    min-height: 38px;
    padding: 0 12px;
    background: rgba(255, 255, 255, .055);
}

.content-grid {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(360px, 1fr) clamp(280px, 24vw, 360px);
    overflow: hidden;
    align-items: stretch;
}

.message-area {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, auto) minmax(0, 1fr) minmax(68px, auto);
    max-width: 1120px;
    width: 100%;
    justify-self: center;
    overflow: hidden;
    align-self: stretch;
}

.messages {
    display: block;
    visibility: visible;
    overflow: auto;
    padding: clamp(14px, 2vw, 24px);
    min-height: 0;
    height: 100%;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.messages:empty::before {
    content: "Chat wird geladen ...";
    display: grid;
    place-items: center;
    min-height: 160px;
    color: var(--muted);
}

.message {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 13px;
    padding: 9px 0;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: background .15s ease, border-color .15s ease;
}

.message:hover {
    background: rgba(255, 255, 255, .035);
    border-color: rgba(255, 255, 255, .04);
}

.message.pinned {
    background: rgba(245, 158, 11, .07);
}

.message.deleted {
    opacity: .66;
}

.system-message {
    grid-template-columns: 34px minmax(0, 1fr);
    margin: 8px 0;
    padding: 12px;
    border: 1px solid rgba(99, 102, 241, .2);
    background: rgba(99, 102, 241, .1);
}

.render-error-message {
    border-color: rgba(248, 113, 113, .26);
    background: rgba(248, 113, 113, .1);
}

.system-message > div:first-child {
    display: grid;
    place-items: center;
    color: var(--cyan);
}

.system-message p {
    margin: 4px 0;
    color: var(--soft);
    white-space: pre-wrap;
}

.message-body {
    color: #e6eaf5;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-body a,
.system-message a {
    color: #8fb2ff;
    font-weight: 850;
    text-decoration: none;
}

.message-body a:hover,
.system-message a:hover {
    text-decoration: underline;
}

.mention-chip {
    min-height: 24px;
    margin: 0 2px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(88, 101, 242, .22);
    color: #cfd5ff;
    font: inherit;
    font-weight: 900;
    vertical-align: baseline;
}

.mention-chip:hover {
    background: rgba(88, 101, 242, .36);
    color: white;
}

.invite-message-card {
    width: min(520px, 100%);
    margin-top: 10px;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(28, 31, 42, .72);
    box-shadow: 0 18px 38px rgba(0, 0, 0, .24);
    backdrop-filter: blur(18px);
}

.invite-message-banner {
    height: 126px;
    background-size: cover;
    background-position: center;
}

.invite-message-body {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 16px;
}

.invite-message-icon {
    width: 66px;
    height: 66px;
    margin-top: -50px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 18px;
    border: 5px solid rgba(28, 31, 42, .95);
    color: white;
    font-size: 21px;
    font-weight: 950;
}

.invite-message-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.invite-message-body h4 {
    margin: 0;
    color: white;
    font-size: 21px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.verified-mark {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #3ba55d;
    color: white;
    font-size: 12px;
    vertical-align: 2px;
}

.invite-message-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.invite-message-tags span {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: #d5daf0;
    font-size: 12px;
    font-weight: 850;
}

.invite-message-body p {
    margin: 0;
    color: var(--soft);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.invite-message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    min-width: 0;
}

.invite-message-actions .primary-button {
    flex: 1 1 170px;
    min-width: min(170px, 100%);
    background: linear-gradient(135deg, #248046, #3ba55d);
    box-shadow: 0 14px 26px rgba(35, 165, 90, .24);
}

.attachments {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.attachment {
    width: min(420px, 100%);
    max-width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    color: var(--text);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.attachment img,
.attachment video {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    background: rgba(0, 0, 0, .28);
}

.attachment audio {
    width: 100%;
    min-width: 0;
    padding: 10px;
}

.voice-attachment {
    padding: 10px;
    display: grid;
    gap: 8px;
    background: linear-gradient(135deg, rgba(34, 197, 94, .14), rgba(99, 102, 241, .1));
}

.voice-attachment strong {
    color: var(--text);
}

.voice-attachment audio {
    width: 100%;
    min-width: 0;
    padding: 0;
}

.voice-attachment a {
    padding: 0;
    color: #b7c2ff;
    font-size: 12px;
    font-weight: 850;
}

.attachment span,
.attachment a {
    display: block;
    padding: 9px 11px;
    color: var(--soft);
    overflow-wrap: anywhere;
}

.file-attachment {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    min-height: 54px;
    padding: 0;
    text-decoration: none;
}

.file-attachment strong {
    display: grid;
    place-items: center;
    height: 100%;
    background: rgba(99, 102, 241, .18);
}

.file-attachment span {
    color: var(--text);
}

.meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta time {
    color: var(--muted);
    font-size: 12px;
}

.meta small {
    color: var(--muted);
    font-size: 12px;
}

.pin-label {
    color: #ffd166;
}

.message-actions, .message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
    min-width: 0;
}

.message-actions {
    opacity: 0;
    transition: opacity .16s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-actions button, .reaction {
    max-width: 100%;
    min-height: 26px;
    border-radius: var(--radius);
    padding: 0 8px;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: 800;
}

.message-actions button:hover, .reaction:hover, .reaction.active {
    background: rgba(99, 102, 241, .18);
    color: white;
}

.pin-board {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(245, 158, 11, .22);
    background: rgba(245, 158, 11, .08);
}

.pin-board strong {
    color: #ffd166;
}

.pin-board span {
    color: var(--soft);
    overflow-wrap: anywhere;
}

.incoming-call {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, auto);
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(34, 197, 94, .28);
    background: rgba(34, 197, 94, .11);
}

.incoming-call small {
    display: block;
    margin-top: 2px;
    color: var(--soft);
}

.composer {
    position: sticky;
    z-index: 8;
    bottom: 0;
    align-self: end;
    margin: 8px 16px 16px;
    width: auto;
    max-width: calc(100% - 32px);
    min-height: 52px;
    height: 52px;
    max-height: 52px;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 42px 42px minmax(0, 1fr) 94px;
    gap: 10px;
    align-items: center;
    padding: 7px;
    border-radius: var(--radius);
    background: rgba(42, 45, 54, .96);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 18px 54px rgba(0, 0, 0, .24);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

#voiceMessageButton.recording {
    background: rgba(239, 68, 68, .22);
    color: white;
    border-color: rgba(239, 68, 68, .42);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}

.composer input {
    min-height: 38px;
    height: 38px;
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.composer:focus-within {
    border-color: rgba(99, 102, 241, .42);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .1), 0 18px 54px rgba(0, 0, 0, .24);
}

.composer.composer-disabled {
    opacity: .82;
    background: rgba(255, 255, 255, .045);
}

.composer.composer-disabled input {
    color: var(--muted);
}

.right-panel {
    min-width: 0;
    min-height: 0;
    border-left: 1px solid var(--line);
    background: #2b2d31;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
}

.profile-panel {
    min-height: 0;
    display: grid;
    grid-template-rows: 184px minmax(0, auto) auto;
    overflow: auto;
    overscroll-behavior: contain;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 160px),
        #2b2d31;
}

.profile-banner {
    position: relative;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--banner), #fff 16%), var(--banner)),
        var(--banner);
    background-size: cover;
    background-position: center;
}

.profile-buttons {
    position: absolute;
    right: 14px;
    top: 14px;
    max-width: calc(100% - 28px);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    overflow: hidden;
}

.profile-buttons .icon-button {
    flex: 0 0 38px;
}

.profile-card {
    position: relative;
    margin: -54px 16px 16px;
    padding: 72px 18px 18px;
    border-radius: var(--radius);
    background: #313338;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: var(--shadow-soft), 0 1px 0 rgba(255, 255, 255, .04) inset;
    min-width: 0;
    display: grid;
    gap: 10px;
    overflow: visible;
}

.profile-card.gradient-profile {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--profile-a), #fff 8%), var(--profile-b)),
        #313338;
    border: 1px solid rgba(255, 255, 255, .12);
}

.profile-card.gradient-profile section,
.profile-card.gradient-profile .profile-row,
.profile-card.gradient-profile .profile-status-line {
    background: rgba(255, 255, 255, .09);
    backdrop-filter: blur(12px);
}

.profile-avatar {
    position: absolute;
    left: 18px;
    top: -44px;
}

.profile-avatar .avatar,
.profile-avatar .avatar-wrap {
    width: 88px;
    height: 88px;
    font-size: 28px;
    border-radius: 50%;
}

.profile-avatar .status-dot {
    width: 20px;
    height: 20px;
    border-width: 4px;
}

.profile-card h2 {
    margin: 0;
    font-size: 26px;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.profile-sub {
    color: var(--soft);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.profile-status-line {
    width: fit-content;
    max-width: 100%;
    min-height: 30px;
    margin-top: 10px;
    padding: 0 11px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid var(--line);
    color: var(--soft);
}

.profile-status-line strong {
    font-size: 13px;
}

.profile-card section {
    margin-top: 8px;
    padding: 14px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .065);
    border: 1px solid rgba(255, 255, 255, .07);
}

.profile-card section strong {
    display: block;
    margin-bottom: 8px;
}

.profile-card section p {
    margin: 0;
    color: var(--soft);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.profile-bio {
    min-height: 112px;
}

.profile-facts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    background: rgba(255, 255, 255, .045) !important;
}

.profile-facts div {
    display: grid;
    gap: 3px;
}

.profile-facts span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.profile-facts strong {
    margin: 0 !important;
    color: var(--text);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.profile-row {
    width: 100%;
    min-height: 50px;
    margin-top: 10px;
    padding: 0 14px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .065);
    border: 1px solid rgba(255, 255, 255, .065);
    color: var(--text);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    font-weight: 900;
    text-align: left;
    overflow: hidden;
}

.profile-row {
    overflow-wrap: anywhere;
}

.profile-row > span {
    flex: 0 0 auto;
}

.profile-row:hover {
    background: rgba(99, 102, 241, .15);
    border-color: rgba(99, 102, 241, .24);
}

.profile-row.active {
    background: rgba(88, 101, 242, .22);
    border: 1px solid rgba(88, 101, 242, .36);
}

.profile-row.active span {
    transform: rotate(90deg);
}

.profile-details {
    display: none;
    gap: 10px;
    margin-top: 10px;
    max-width: 100%;
    min-width: 0;
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(15, 17, 23, .28);
    border: 1px solid var(--line);
}

.profile-details.show {
    display: grid;
}

.profile-details > strong {
    color: var(--text);
    font-size: 13px;
}

.profile-detail-row {
    width: 100%;
    min-height: 54px;
    border-radius: var(--radius);
    padding: 9px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    text-align: left;
    border: 1px solid rgba(255, 255, 255, .07);
}

.profile-detail-row:hover {
    background: rgba(99, 102, 241, .2);
    border-color: rgba(99, 102, 241, .35);
}

.profile-detail-row > span:last-child {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.profile-detail-row strong,
.profile-detail-row small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-detail-row small {
    color: var(--muted);
    font-size: 12px;
}

.profile-details p {
    margin: 0;
    padding: 8px 2px;
    color: var(--muted);
}

.server-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .1) inset;
}

.server-dot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-head {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid rgba(99, 102, 241, .24);
    border-radius: var(--radius);
    background: rgba(99, 102, 241, .1);
}

.group-head strong {
    font-size: 18px;
}

.group-head span {
    color: var(--soft);
    overflow-wrap: anywhere;
}

.full-profile {
    align-self: end;
    min-height: 52px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: transparent;
    color: var(--soft);
    font-weight: 900;
}

.home-profile {
    margin: 16px;
    padding: 18px;
}

.video-stage {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
    overflow: auto;
    border-bottom: 1px solid var(--line);
}

.call-stage-head {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 2px 10px;
}

.call-stage-head strong {
    display: block;
}

.call-stage-head small {
    color: var(--muted);
}

.call-stage-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stream-volume {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .055);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.stream-volume input {
    width: 92px;
    min-height: 0;
    padding: 0;
    accent-color: var(--cyan);
}

.call-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.center-stage {
    min-height: clamp(150px, 24vh, 240px);
    max-height: 34vh;
    margin: 16px 16px 0;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background:
        linear-gradient(135deg, rgba(99, 102, 241, .16), transparent 42%),
        rgba(255, 255, 255, .045);
}

.video-tile {
    position: relative;
    min-height: 134px;
    border-radius: var(--radius);
    overflow: hidden;
    background: linear-gradient(145deg, #090b12, #151b2c);
    border: 1px solid var(--line);
}

.video-tile.avatar-tile {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
}

.video-tile.speaking {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .22);
}

.video-tile.screen-tile {
    grid-column: span 2;
    min-height: 180px;
    border-color: rgba(99, 102, 241, .45);
}

.video-tile.focused {
    grid-column: 1 / -1;
    min-height: min(62vh, 620px);
    border-color: rgba(34, 211, 238, .65);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}

.video-stage.has-focused-tile .video-tile:not(.focused) {
    min-height: 92px;
    opacity: .78;
}

.tile-avatar .avatar,
.tile-avatar .avatar-wrap {
    width: 70px;
    height: 70px;
    font-size: 24px;
}

.tile-name {
    color: var(--soft);
    font-weight: 900;
}

.hidden-audio {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-tile.focused video,
.video-tile.screen-tile video {
    object-fit: contain;
    background: #05070d;
}

.server-info {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(99, 102, 241, .22);
    background: rgba(99, 102, 241, .09);
}

.server-info strong {
    color: white;
}

.server-info p {
    margin: 0;
    color: var(--soft);
    line-height: 1.55;
    white-space: pre-wrap;
}

.video-tile span {
    position: absolute;
    left: 9px;
    bottom: 9px;
    border-radius: var(--radius);
    padding: 5px 8px;
    background: rgba(0, 0, 0, .62);
    font-size: 12px;
}

.empty-stage {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 166px;
    color: var(--muted);
    border: 1px dashed rgba(255, 255, 255, .14);
    border-radius: var(--radius);
}

.voice-center-copy {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 220px;
    text-align: center;
    color: var(--soft);
}

.voice-center-copy h2 {
    color: var(--text);
    font-size: clamp(28px, 4vw, 48px);
}

.compact-voice-chat {
    min-height: 156px;
    margin-bottom: 10px;
    border: 1px solid rgba(88, 101, 242, .18);
    border-radius: var(--radius);
    background: rgba(88, 101, 242, .08);
    padding: 18px;
}

.compact-voice-chat h2 {
    font-size: clamp(22px, 3vw, 34px);
}

.compact-voice-chat small {
    color: var(--muted);
    font-weight: 850;
}

.voice-chat-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin: 0 auto 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(35, 165, 90, .14);
    color: #86efac;
    font-size: 12px;
    font-weight: 950;
}

.members {
    min-height: 0;
    overflow: auto;
    padding: 16px;
}

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

.home-board {
    min-height: 100%;
    display: grid;
    align-content: start;
    gap: 18px;
}

.admin-board {
    display: grid;
    gap: 18px;
}

.admin-board > section {
    display: grid;
    gap: 12px;
}

.admin-hero {
    padding: clamp(20px, 4vw, 30px);
    border-radius: var(--radius);
    border: 1px solid rgba(99, 102, 241, .26);
    background:
        linear-gradient(135deg, rgba(99, 102, 241, .18), transparent 48%),
        rgba(255, 255, 255, .045);
}

.admin-hero h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 42px);
}

.admin-hero p {
    color: var(--soft);
}

.admin-list {
    display: grid;
    gap: 10px;
}

.admin-announce-form {
    display: grid;
    gap: 10px;
}

.admin-announce-form textarea {
    min-height: 118px;
}

.muted-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.report-card textarea {
    min-height: 132px;
}

.report-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.report-reasons button {
    min-height: 34px;
    padding: 0 10px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    color: var(--text);
    font-weight: 850;
}

.report-reasons button:hover {
    border-color: rgba(99, 102, 241, .34);
    background: rgba(99, 102, 241, .18);
}

.admin-card,
.admin-user-row {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    box-shadow: var(--shadow-soft);
}

.audit-row {
    display: grid;
    gap: 3px;
    padding: 9px 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .045);
}

.audit-row small {
    color: var(--muted);
}

.friend-picker-list {
    max-height: min(54vh, 520px);
    overflow: auto;
    display: grid;
    gap: 8px;
}

.friend-pick-row {
    display: grid !important;
    grid-template-columns: 22px 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .045);
}

.friend-pick-row input {
    width: 18px;
    height: 18px;
}

.friend-pick-row strong,
.friend-pick-row small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-pick-row small {
    color: var(--muted);
}

.action-card {
    width: min(560px, calc(100vw - 28px));
}

.action-hero {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(99, 102, 241, .24);
    background: rgba(99, 102, 241, .12);
}

.action-hero > span {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--brand), var(--brand-hot));
    color: white;
    font-size: 22px;
    font-weight: 950;
}

.action-hero strong,
.action-hero p {
    display: block;
    margin: 0;
}

.action-hero p {
    margin-top: 4px;
    color: var(--soft);
    line-height: 1.45;
}

.server-create-card {
    width: min(980px, calc(100vw - 28px));
}

.server-create-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
    gap: 14px;
}

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

.template-card {
    position: relative;
    min-height: 142px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    color: var(--text);
    display: grid;
    align-content: start;
    gap: 8px;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.template-card:hover {
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, .32);
    background: rgba(99, 102, 241, .11);
}

.template-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.template-card > span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .08);
}

.template-card small {
    color: var(--muted);
    line-height: 1.35;
}

.template-card.active {
    border-color: rgba(99, 102, 241, .55);
    background: rgba(99, 102, 241, .16);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.server-create-preview {
    min-width: 0;
    align-self: stretch;
}

.server-create-preview .server-mini-profile {
    position: sticky;
    top: 12px;
}

.group-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.admin-card p,
.admin-card small,
.admin-user-row small {
    color: var(--soft);
}

.admin-card blockquote {
    margin: 0;
    padding: 10px;
    border-left: 3px solid var(--brand);
    background: rgba(0, 0, 0, .16);
    color: var(--text);
    overflow-wrap: anywhere;
}

.official-chat-lock {
    align-self: end;
    margin: 10px 18px 18px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(88, 101, 242, .12);
    color: var(--soft);
    font-size: 13px;
    font-weight: 800;
}

.admin-user-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
}

.admin-server-row {
    grid-template-columns: 40px minmax(220px, 1fr) minmax(360px, auto);
}

.admin-server-row .quick-actions {
    justify-content: end;
    margin: 0;
}

.discover-board {
    display: grid;
    gap: 18px;
}

.discover-hero,
.discover-section {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .045);
}

.discover-hero {
    display: grid;
    gap: 10px;
    padding: clamp(18px, 4vw, 30px);
    background:
        linear-gradient(135deg, rgba(99, 102, 241, .18), transparent 52%),
        rgba(255, 255, 255, .045);
}

.discover-hero h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
}

.discover-hero p {
    max-width: 720px;
    margin: 0;
    color: var(--soft);
    line-height: 1.5;
}

.discover-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.discover-search-row span {
    color: var(--muted);
    font-weight: 850;
}

.discover-section {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.discover-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.discover-section-head h3 {
    margin: 0;
    font-size: 18px;
}

.discover-section-head p {
    margin: 4px 0 0;
    color: var(--muted);
    line-height: 1.4;
}

.discover-section-head > span {
    min-width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(99, 102, 241, .16);
    color: #dce2ff;
    font-weight: 950;
}

.discover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.discover-card {
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(24, 25, 31, .72);
    box-shadow: var(--shadow-soft);
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.discover-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, .3);
    background: rgba(32, 35, 46, .82);
}

.discover-banner {
    position: relative;
    min-height: 104px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--server-banner), #fff 14%), var(--server-banner)),
        var(--server-banner);
    background-size: cover;
    background-position: center;
}

.discover-icon {
    position: absolute;
    left: 14px;
    bottom: -22px;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--radius);
    border: 4px solid #1f2026;
    color: white;
    font-weight: 950;
}

.discover-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.discover-body {
    display: grid;
    gap: 10px;
    padding: 30px 14px 14px;
}

.discover-body h4 {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 16px;
}

.discover-body p {
    min-height: 42px;
    margin: 0;
    color: var(--soft);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.discover-meta,
.discover-tags,
.discover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.discover-meta span,
.discover-tags span {
    border-radius: 999px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, .065);
    color: var(--soft);
    font-size: 12px;
    font-weight: 850;
}

.discover-tags span {
    background: rgba(99, 102, 241, .16);
    color: #d7dcff;
}

.discover-actions {
    margin-top: 2px;
}

.cover-board {
    display: grid;
    gap: 18px;
}

.cover-hero {
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .05);
}

.cover-banner {
    min-height: clamp(150px, 25vh, 260px);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--server-banner), #fff 12%), var(--server-banner)),
        var(--server-banner);
    background-size: cover;
    background-position: center;
}

.cover-body {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.cover-body .server-mini-icon {
    margin-top: -48px;
    width: 78px;
    height: 78px;
    border: 5px solid var(--panel-solid);
}

.cover-body h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(28px, 4vw, 46px);
}

.cover-body p,
.cover-grid p {
    color: var(--soft);
    line-height: 1.6;
}

.cover-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.cover-grid article {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .045);
}

.cover-list-title {
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

.cover-row {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    text-align: left;
}

.cover-row:hover {
    background: rgba(99, 102, 241, .16);
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.permission-toggle {
    display: grid !important;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .045);
    min-height: 76px;
    transition: border-color .16s ease, background .16s ease;
}

.permission-toggle:hover {
    border-color: rgba(99, 102, 241, .32);
    background: rgba(99, 102, 241, .1);
}

.permission-toggle input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.permission-toggle strong,
.permission-toggle small {
    display: block;
}

.permission-toggle small {
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.4;
}

.home-board > section:first-child {
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(99, 102, 241, .18), transparent 44%),
        rgba(255, 255, 255, .045);
    box-shadow: var(--shadow-soft);
}

.home-board h2 {
    max-width: 760px;
    font-size: clamp(26px, 4vw, 44px);
    line-height: 1.04;
}

.home-board p:not(.eyebrow) {
    max-width: 680px;
    color: var(--soft);
    line-height: 1.65;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.friend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.request-list {
    display: grid;
    gap: 10px;
}

.request-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(99, 102, 241, .24);
    background: rgba(99, 102, 241, .12);
    box-shadow: var(--shadow-soft);
}

.request-row.muted {
    border-color: var(--line);
    background: rgba(255, 255, 255, .045);
}

.request-row small {
    color: var(--muted);
}

.friend-card {
    position: relative;
    min-height: 126px;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    color: var(--text);
    text-align: left;
    display: grid;
    align-content: start;
    gap: 8px;
    box-shadow: var(--shadow-soft);
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.friend-card:hover {
    background: rgba(99, 102, 241, .16);
    border-color: rgba(99, 102, 241, .28);
    transform: translateY(-1px);
}

.friend-card .avatar {
    width: 44px;
    height: 44px;
}

.friend-card .avatar-wrap {
    width: 44px;
    height: 44px;
}

.friend-card small {
    color: var(--muted);
    display: flex;
    align-items: center;
}

.friend-card strong {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.friend-card.has-unread {
    border-color: rgba(34, 197, 94, .28);
    background: rgba(34, 197, 94, .08);
}

.friend-card.has-ping {
    border-color: rgba(239, 68, 68, .32);
    background: rgba(239, 68, 68, .08);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stats-row div {
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    box-shadow: var(--shadow-soft);
}

.stats-row strong {
    display: block;
    font-size: 28px;
}

.stats-row span {
    color: var(--muted);
    font-size: 13px;
}

.empty-state, .empty-list {
    color: var(--muted);
    border: 1px dashed rgba(255, 255, 255, .14);
    border-radius: var(--radius);
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 120px;
    padding: 18px;
}

.empty-list {
    margin: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.45;
}

.member {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px 0;
}

.member:hover {
    background: rgba(255, 255, 255, .045);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 5px;
    padding: 3px 7px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--role), transparent 78%);
    color: var(--role);
    font-size: 11px;
    font-weight: 900;
}

.role-list {
    display: grid;
    gap: 8px;
}

.server-member-role-list {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.member-role-row {
    min-height: 58px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .055);
    border: 1px solid var(--line);
}

.server-profile-locked input:disabled,
.server-profile-locked select:disabled,
.server-profile-locked textarea:disabled,
.server-roles-locked input:disabled {
    opacity: .68;
    cursor: not-allowed;
}

.member-role-row strong,
.member-role-row small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-role-row small {
    color: var(--muted);
}

.role-pill {
    max-width: 150px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--role-bg);
    color: #fff;
    font-size: 12px;
    font-weight: 950;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-admin-list {
    display: grid;
    gap: 8px;
}

.channel-admin-row {
    min-height: 44px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .055);
    border: 1px solid var(--line);
}

.channel-admin-row span {
    color: var(--cyan);
    font-weight: 950;
    text-align: center;
}

.channel-admin-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-row {
    min-height: 42px;
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .055);
    border: 1px solid var(--line);
}

.role-editor-card {
    width: min(900px, calc(100vw - 28px));
}

.role-row span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.role-row small {
    color: var(--muted);
}

.role-choice-list,
.badge-grid {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.role-choice,
.badge-choice {
    min-height: 54px;
    display: grid;
    grid-template-columns: 22px 18px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.role-choice:hover,
.badge-choice:hover {
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, .3);
    background: rgba(99, 102, 241, .11);
}

.badge-choice {
    grid-template-columns: 22px minmax(0, 1fr);
}

.role-choice:has(input:checked),
.badge-choice:has(input:checked) {
    border-color: rgba(88, 101, 242, .55);
    background: rgba(88, 101, 242, .16);
}

.role-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.role-choice strong,
.role-choice small {
    display: block;
}

.role-choice small {
    color: var(--muted);
}

.role-assign-card {
    max-width: 520px;
}

.role-assign-user {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    margin: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .055);
}

.role-assign-user strong,
.role-assign-user small {
    display: block;
    min-width: 0;
}

.role-assign-user small {
    color: var(--muted);
    line-height: 1.35;
}

.badge-choice span {
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 950;
}

.badge-choice.official span { background: linear-gradient(135deg, #5865f2, #22d3ee); color: white; }
.badge-choice.team span { background: rgba(34, 197, 94, .2); color: #9af7bc; }
.badge-choice.gold span { background: rgba(245, 158, 11, .22); color: #ffe0a3; }
.badge-choice.blue span { background: rgba(59, 130, 246, .22); color: #bfdbfe; }
.badge-choice.green span { background: rgba(34, 197, 94, .2); color: #bbf7d0; }
.badge-choice.pink span { background: rgba(236, 72, 153, .2); color: #fbcfe8; }
.badge-choice.purple span { background: rgba(168, 85, 247, .22); color: #e9d5ff; }
.badge-choice.cyan span { background: rgba(6, 182, 212, .2); color: #cffafe; }

.context-menu {
    position: fixed;
    z-index: 50;
    width: min(260px, calc(100vw - 20px));
    max-height: min(430px, calc(100dvh - 20px));
    display: none;
    padding: 7px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(20, 24, 39, .94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    overflow: auto;
    overscroll-behavior: contain;
}

.context-menu.show {
    display: grid;
    gap: 4px;
}

.context-menu button {
    display: flex;
    align-items: center;
    min-height: 34px;
    border-radius: var(--radius);
    padding: 8px 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.context-menu button:hover {
    background: rgba(99, 102, 241, .2);
}

.context-menu hr {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
}

.home-self {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.home-self .avatar,
.home-self .avatar-wrap {
    width: 48px;
    height: 48px;
}

.home-dashboard {
    gap: 14px;
}

.home-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.home-metrics div {
    min-width: 0;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .06);
}

.home-metrics strong {
    display: block;
    font-size: 22px;
    line-height: 1;
}

.home-metrics span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-alert {
    min-height: 44px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px 11px;
    border-radius: var(--radius);
    border: 1px solid rgba(245, 158, 11, .24);
    background: rgba(245, 158, 11, .12);
    color: var(--text);
    text-align: left;
}

.home-alert strong {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(245, 158, 11, .22);
    color: #ffd166;
}

.home-alert span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-panel-section {
    display: grid;
    gap: 10px;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.home-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.home-action-grid button {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .055);
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
    text-align: left;
}

.home-action-grid button:hover,
.home-online-list button:hover {
    background: rgba(99, 102, 241, .18);
}

.home-action-grid span {
    width: 20px;
    color: var(--cyan);
    text-align: center;
    font-weight: 950;
}

.home-online-list {
    display: grid;
    gap: 6px;
}

.home-online-list button {
    min-width: 0;
    min-height: 44px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .045);
    color: var(--text);
    text-align: left;
}

.home-online-list .avatar,
.home-online-list .avatar-wrap {
    width: 34px;
    height: 34px;
    font-size: 12px;
}

.home-online-list b,
.home-online-list small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-online-list small {
    color: var(--muted);
    font-size: 12px;
}

.home-online-list p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.danger-row {
    color: #fecaca;
}

.suspended-screen {
    position: fixed;
    z-index: 80;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, .94), rgba(39, 17, 35, .94)),
        var(--bg);
}

.suspended-screen[hidden] {
    display: none;
}

.suspended-card {
    width: min(560px, 100%);
    display: grid;
    gap: 14px;
    padding: clamp(22px, 4vw, 34px);
    border-radius: var(--radius);
    border: 1px solid rgba(239, 68, 68, .28);
    background: rgba(17, 21, 34, .96);
    box-shadow: var(--shadow);
}

.suspended-card h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
}

.suspended-card p {
    margin: 0;
    color: var(--soft);
    line-height: 1.55;
}

.suspended-card small {
    color: var(--muted);
}

.is-suspended .app-shell,
.is-suspended .modal,
.is-suspended .context-menu {
    pointer-events: none;
    filter: blur(2px);
}

.compact-mode .channel-row {
    min-height: 32px;
}

.compact-mode .message {
    padding: 5px 0;
}

.compact-mode .member {
    padding: 5px 0;
}

.modal {
    width: min(1080px, calc(100% - 32px));
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 28px);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    overflow: hidden;
}

.modal::backdrop { background: rgba(0, 0, 0, .72); }

.modal-card {
    max-height: calc(100dvh - 28px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 180px),
        rgba(17, 21, 34, .96);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    overflow: hidden;
}

.modal-card > :not(header):not(footer) {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.modal-card h2 {
    margin: 0;
}

.modal-card header, .modal-card footer {
    position: sticky;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .025);
    backdrop-filter: blur(16px);
}

.modal-card header {
    top: 0;
}

.modal-card header h2 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-card footer {
    bottom: 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-layout {
    min-height: 0;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    overflow: auto;
}

.settings-preview {
    min-width: 0;
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100%;
    padding: 16px;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, .035);
}

.settings-preview-title {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
}

.settings-preview-title span {
    color: var(--text);
    font-size: 13px;
    font-weight: 950;
    text-transform: uppercase;
}

.settings-preview-title small {
    color: var(--muted);
    font-weight: 800;
}

.settings-preview-title small.unsaved {
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, .14);
    color: #ffd166;
    border: 1px solid rgba(245, 158, 11, .24);
}

.settings-preview-banner {
    min-height: 94px;
    border-radius: var(--radius) var(--radius) 0 0;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--banner), #fff 16%), var(--banner)),
        var(--banner);
    background-size: cover;
    background-position: center;
    border: 1px solid var(--line);
    border-bottom: 0;
}

.settings-preview-card {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 48px 14px 14px;
    border-radius: 0 0 var(--radius) var(--radius);
    background: #313338;
    border: 1px solid var(--line);
}

.settings-preview-card.gradient-profile {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--profile-a), #fff 8%), var(--profile-b)),
        #313338;
}

.settings-preview-avatar {
    position: absolute;
    left: 14px;
    top: -30px;
}

.settings-preview-avatar .avatar,
.settings-preview-avatar .avatar-wrap {
    width: 62px;
    height: 62px;
    border-radius: 50%;
}

.settings-preview-card > strong {
    font-size: 20px;
}

.settings-preview-card > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--soft);
    font-size: 13px;
    font-weight: 850;
}

.settings-preview-card p {
    margin: 0;
    color: var(--soft);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.settings-grid {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    align-content: start;
    overflow: auto;
}

.server-settings-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
    overflow: auto;
}

.server-emoji-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.server-emoji-presets button {
    min-height: 34px;
    padding: 0 10px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .055);
    color: var(--text);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
}

.server-emoji-presets button:hover {
    border-color: rgba(99, 102, 241, .34);
    background: rgba(99, 102, 241, .18);
}

.settings-section {
    min-width: 0;
    display: grid;
    gap: 13px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.settings-section h3 {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 950;
}

.settings-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.settings-section input,
.settings-section select,
.settings-section textarea,
.settings-fields input,
.settings-fields select,
.settings-fields textarea {
    width: 100%;
    max-width: 100%;
}

.settings-fields.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
    min-width: 0;
}

input[type="file"] {
    padding: 10px;
    border-style: dashed;
    background: rgba(255, 255, 255, .04);
}

.gradient-presets {
    display: grid;
    grid-template-columns: repeat(6, minmax(28px, 1fr));
    gap: 8px;
}

.gradient-presets button {
    min-height: 34px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, .16);
    background: linear-gradient(135deg, var(--a), var(--b));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
    transition: transform .16s ease, border-color .16s ease, filter .16s ease;
}

.gradient-presets button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, .36);
    filter: brightness(1.08);
}

.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; }
.check input { width: auto; }

.app-shell,
.channel-panel,
.chat-panel,
.content-grid,
.message-area,
.messages,
.right-panel,
.profile-panel,
.modal-card,
.settings-grid,
.server-settings-grid,
.server-create-layout,
.discover-grid,
.cover-grid,
.admin-board,
.home-board {
    min-width: 0;
    min-height: 0;
}

.message > div,
.message .meta,
.message-body,
.system-message p,
.profile-card,
.profile-details,
.profile-detail-row,
.profile-row,
.settings-section,
.admin-card,
.admin-user-row,
.discover-card,
.server-mini-profile,
.invite-message-card,
.request-row,
.friend-card,
.channel-row,
.member,
.home-alert,
.home-action-grid button {
    min-width: 0;
}

.message-body,
.system-message p,
.profile-sub,
.profile-card p,
.profile-row,
.channel-row strong,
.friend-row strong,
.member strong,
.admin-card,
.admin-user-row,
.discover-card p,
.cover-body p,
.cover-grid p,
.server-info p,
.home-alert span {
    overflow-wrap: anywhere;
}

.quick-actions,
.discover-actions,
.server-mini-actions,
.invite-message-actions,
.group-head-actions,
.call-stage-actions,
.report-reasons,
.home-action-grid {
    max-width: 100%;
}

.quick-actions > *,
.discover-actions > *,
.server-mini-actions > *,
.invite-message-actions > *,
.group-head-actions > *,
.call-stage-actions > *,
.report-reasons > * {
    min-width: 0;
}

.messages {
    overflow-anchor: auto;
}

.profile-card img,
.discover-card img,
.server-mini-profile img {
    object-fit: cover;
}

/* DisTalk interface rebuild */
.app-shell {
    grid-template-columns: 76px clamp(260px, 22vw, 316px) minmax(0, 1fr);
    background:
        linear-gradient(135deg, rgba(99, 102, 241, .08), transparent 34%),
        linear-gradient(180deg, #25272d, #1f2025);
}

.server-rail {
    padding: 14px 10px;
    background: rgba(18, 20, 27, .96);
    border-right: 1px solid rgba(255, 255, 255, .065);
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .28);
}

.server-list {
    width: 100%;
    align-items: center;
    padding-block: 2px;
}

.server-pill {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 10px 24px rgba(0, 0, 0, .24);
}

.server-pill:hover,
.server-pill.active {
    border-radius: 14px;
    border-color: rgba(255, 255, 255, .18);
}

.server-pill.active::after {
    content: "";
    position: absolute;
    left: -11px;
    width: 4px;
    height: 28px;
    border-radius: 999px;
    background: #fff;
}

.channel-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 190px),
        rgba(38, 40, 47, .96);
    border-right: 1px solid rgba(255, 255, 255, .075);
}

.channel-panel header,
.chat-header {
    min-height: 64px;
    border-bottom: 1px solid rgba(255, 255, 255, .075);
}

.channel-panel header {
    background: rgba(31, 33, 40, .82);
}

.chat-header {
    background: rgba(45, 48, 57, .9);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .045);
}

.mini-actions,
.header-actions {
    flex-wrap: nowrap;
}

.channel-list {
    padding: 14px 12px 18px;
}

.channel-search {
    height: 42px;
    border-radius: 10px;
    background: rgba(15, 17, 23, .76);
}

.category-title {
    margin: 18px 8px 8px;
    letter-spacing: .04em;
}

.channel-row {
    min-height: 42px;
    border-radius: 10px;
    padding: 0 10px;
}

.channel-row:hover,
.channel-row.active {
    background: rgba(255, 255, 255, .075);
    border-color: rgba(255, 255, 255, .08);
}

.channel-row.active {
    box-shadow: inset 3px 0 0 var(--brand);
}

.server-mini-profile,
.profile-card,
.admin-card,
.admin-user-row,
.discover-card,
.cover-hero,
.cover-grid article,
.settings-section,
.invite-message-card,
.friend-card,
.request-row {
    border-color: rgba(255, 255, 255, .105);
    background: rgba(255, 255, 255, .055);
    box-shadow: var(--shadow-soft);
}

.content-grid {
    grid-template-columns: minmax(0, 1fr) clamp(300px, 25vw, 380px);
    background: rgba(34, 36, 43, .72);
}

.message-area {
    max-width: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 220px),
        rgba(43, 45, 54, .72);
}

.messages {
    padding: clamp(18px, 2.4vw, 30px);
}

.message {
    padding: 10px 8px;
}

.message:hover {
    background: rgba(255, 255, 255, .045);
}

.composer {
    margin: 10px 18px 18px;
    max-width: calc(100% - 36px);
    min-height: 56px;
    height: 56px;
    max-height: 56px;
    grid-template-columns: 42px 42px minmax(0, 1fr) minmax(78px, 96px);
    background: rgba(31, 34, 43, .96);
    border-color: rgba(255, 255, 255, .12);
}

.right-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 180px),
        rgba(39, 41, 49, .96);
}

.profile-panel {
    grid-template-rows: 170px minmax(0, auto) auto;
    background: transparent;
}

.profile-card {
    margin-inline: 14px;
    border-radius: 14px;
}

.profile-row,
.profile-detail-row,
.home-action-grid button,
.permission-toggle,
.role-row,
.member-role-row,
.cover-row {
    border-radius: 10px;
}

.home-board,
.admin-board,
.discover-board,
.cover-board {
    width: min(1180px, 100%);
    margin-inline: auto;
}

.home-board > section:first-child,
.admin-hero,
.discover-hero {
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, .18), transparent 44%),
        linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .035));
}

#settingsDialog,
#serverSettingsDialog {
    width: min(1240px, calc(100vw - 20px));
}

.settings-sidebar {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
    border-right: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(99, 102, 241, .1), transparent 210px),
        rgba(255, 255, 255, .03);
}

.settings-sidebar .settings-preview {
    position: sticky;
    top: 0;
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
}

.settings-nav {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 8px;
}

.settings-nav a {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 0 11px;
    border-radius: 10px;
    color: var(--soft);
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    border: 1px solid transparent;
}

.settings-nav a:hover,
.settings-nav a:focus-visible {
    color: var(--text);
    background: rgba(99, 102, 241, .14);
    border-color: rgba(99, 102, 241, .22);
}

.settings-grid {
    gap: 16px;
    padding: 18px;
}

.settings-section {
    border-radius: 14px;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .035));
}

.settings-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.settings-section h3::before {
    content: "";
    width: 7px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--cyan), var(--brand));
}

.settings-fields {
    gap: 14px;
}

.server-settings-grid {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(300px, .75fr);
    align-items: start;
}

.server-settings-grid > .wide {
    grid-column: 2 / -1;
}

.server-settings-sidebar {
    position: sticky;
    top: 18px;
    grid-row: 1 / span 4;
    min-width: 0;
    display: grid;
    gap: 10px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .105);
    background:
        linear-gradient(135deg, rgba(34, 211, 238, .12), transparent 52%),
        rgba(255, 255, 255, .05);
    box-shadow: var(--shadow-soft);
}

.server-settings-sidebar strong {
    font-size: 18px;
}

.server-settings-sidebar span {
    color: var(--soft);
    line-height: 1.45;
    font-size: 13px;
}

.modal-card {
    border-radius: 16px;
}

.modal-card header {
    min-height: 62px;
}

.modal-card footer {
    background: rgba(17, 21, 34, .82);
}

.toast {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) translateY(18px);
    max-width: min(520px, calc(100% - 28px));
    padding: 12px 16px;
    border-radius: var(--radius);
    background: rgba(25, 31, 48, .96);
    border: 1px solid var(--line);
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
    box-shadow: var(--shadow);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

body.light {
    color-scheme: light;
    --bg: #f5f7fb;
    --bg-soft: #eef2f8;
    --panel: rgba(255, 255, 255, .92);
    --panel-solid: #ffffff;
    --panel-2: #edf1f8;
    --panel-3: #e1e7f2;
    --text: #121722;
    --muted: #626b7c;
    --soft: #394254;
    --line: rgba(18, 23, 34, .12);
}

body.light .app-shell { background: linear-gradient(135deg, #eef2f8, #ffffff); }
body.light .server-rail { background: rgba(236, 240, 248, .92); }
body.light .channel-panel, body.light .right-panel, body.light .chat-header { background: rgba(255, 255, 255, .82); }
body.light input, body.light select, body.light textarea { background: rgba(255, 255, 255, .9); }
body.light .composer { background: rgba(237, 241, 248, .96); }
body.light .modal-card { background: rgba(255, 255, 255, .96); }
body.light .profile-panel { background: #f1f4fa; }
body.light .profile-card,
body.light .profile-card section,
body.light .profile-row {
    background: rgba(255, 255, 255, .82);
}
body.light .settings-sidebar,
body.light .server-settings-sidebar,
body.light .settings-section,
body.light .admin-card,
body.light .admin-user-row,
body.light .discover-card,
body.light .server-mini-profile {
    background: rgba(255, 255, 255, .78);
}
body.light .context-menu {
    background: rgba(255, 255, 255, .94);
}

/* ── Theme: Ocean (blau/cyan) ── */
body[data-theme="ocean"] {
    --brand: #0ea5e9;
    --brand-hot: #0284c7;
    --surface-hover: rgba(14, 165, 233, .14);
}
body[data-theme="ocean"]::before {
    background:
        linear-gradient(120deg, rgba(14, 165, 233, .16), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(6, 182, 212, .18), transparent 28%),
        radial-gradient(circle at 18% 80%, rgba(14, 165, 233, .11), transparent 28%);
}
body.light[data-theme="ocean"]::before {
    background:
        linear-gradient(120deg, rgba(14, 165, 233, .10), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(6, 182, 212, .12), transparent 28%);
}

/* ── Theme: Aurora (grün/teal) ── */
body[data-theme="aurora"] {
    --brand: #10b981;
    --brand-hot: #059669;
    --surface-hover: rgba(16, 185, 129, .14);
}
body[data-theme="aurora"]::before {
    background:
        linear-gradient(120deg, rgba(16, 185, 129, .16), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(6, 182, 212, .18), transparent 28%),
        radial-gradient(circle at 18% 80%, rgba(52, 211, 153, .11), transparent 28%);
}
body.light[data-theme="aurora"]::before {
    background:
        linear-gradient(120deg, rgba(16, 185, 129, .10), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(6, 182, 212, .12), transparent 28%);
}

/* ── Theme: Sunset (orange/amber) ── */
body[data-theme="sunset"] {
    --brand: #f59e0b;
    --brand-hot: #d97706;
    --surface-hover: rgba(245, 158, 11, .14);
}
body[data-theme="sunset"]::before {
    background:
        linear-gradient(120deg, rgba(245, 158, 11, .16), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(239, 68, 68, .18), transparent 28%),
        radial-gradient(circle at 18% 80%, rgba(251, 191, 36, .11), transparent 28%);
}
body.light[data-theme="sunset"]::before {
    background:
        linear-gradient(120deg, rgba(245, 158, 11, .10), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(239, 68, 68, .12), transparent 28%);
}

/* ── Theme: Cosmic (lila/pink) ── */
body[data-theme="cosmic"] {
    --brand: #a78bfa;
    --brand-hot: #c084fc;
    --surface-hover: rgba(167, 139, 250, .14);
}
body[data-theme="cosmic"]::before {
    background:
        linear-gradient(120deg, rgba(167, 139, 250, .16), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(236, 72, 153, .18), transparent 28%),
        radial-gradient(circle at 18% 80%, rgba(192, 132, 252, .11), transparent 28%);
}
body.light[data-theme="cosmic"]::before {
    background:
        linear-gradient(120deg, rgba(167, 139, 250, .10), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(236, 72, 153, .12), transparent 28%);
}

/* ── Theme: Nord (kühles blau-grau) ── */
body[data-theme="nord"] {
    --brand: #81a1c1;
    --brand-hot: #88c0d0;
    --surface-hover: rgba(129, 161, 193, .14);
}
body[data-theme="nord"]::before {
    background:
        linear-gradient(120deg, rgba(129, 161, 193, .16), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(136, 192, 208, .18), transparent 28%),
        radial-gradient(circle at 18% 80%, rgba(129, 161, 193, .11), transparent 28%);
}
body.light[data-theme="nord"]::before {
    background:
        linear-gradient(120deg, rgba(129, 161, 193, .10), transparent 30%),
        radial-gradient(circle at 76% 8%, rgba(136, 192, 208, .12), transparent 28%);
}

@media (max-width: 1120px) {
    .content-grid { grid-template-columns: minmax(0, 1fr); }
    .right-panel { display: none; }
    .cover-grid { grid-template-columns: 1fr; }
    .admin-server-row { grid-template-columns: 40px minmax(0, 1fr); }
    .admin-server-row .quick-actions { grid-column: 1 / -1; justify-content: start; }
    .server-settings-grid {
        grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    }
    .server-settings-grid > .wide {
        grid-column: 2;
    }
}

@media (max-width: 1040px) {
    .hero-grid, .auth-panel, .landing-feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 64px minmax(220px, 280px) minmax(0, 1fr);
    }
    .search-input {
        display: none;
    }
    .header-actions .secondary-button:not(#addFriendButton),
    .header-actions #headerServerSettingsButton {
        display: none !important;
    }
    .chat-header > div:first-child {
        flex: 1 1 auto;
    }
    .header-actions {
        flex: 0 0 auto;
    }
}

@media (max-width: 760px) {
    .hero { padding-inline: 16px; }
    .hero-grid { padding-top: 38px; }
    .preview-window {
        grid-template-columns: 58px 126px 1fr;
        min-height: 340px;
    }
    .preview-channels, .preview-chat { padding: 14px; }
    .preview-call { grid-template-columns: 1fr; }
    .preview-call span { min-height: 58px; }
    .auth-panel { grid-template-columns: 1fr; padding-inline: 16px; }
    .app-shell {
        grid-template-columns: 62px minmax(0, 1fr);
        height: 100dvh;
        min-height: 100dvh;
    }
    .server-rail { padding-inline: 8px; }
    .channel-panel {
        position: fixed;
        z-index: 60;
        left: 62px;
        top: 0;
        bottom: 0;
        width: min(320px, calc(100vw - 70px));
        height: auto;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto auto;
        border-radius: var(--radius);
        border: 1px solid rgba(255, 255, 255, .12);
        box-shadow: var(--shadow);
        transform: translateX(calc(-100% - 14px));
        transition: transform .18s ease;
        will-change: transform;
    }
    body.mobile-channels-open .channel-panel {
        transform: translateX(0);
    }
    body.mobile-channels-open .app-shell::after {
        content: "";
        position: fixed;
        z-index: 55;
        inset: 0;
        left: 62px;
        background: rgba(0, 0, 0, .34);
        backdrop-filter: blur(2px);
        pointer-events: none;
    }
    .chat-panel {
        grid-column: 2;
        min-width: 0;
        width: 100%;
    }
    .mobile-channel-toggle { display: inline-grid; }
    .chat-header {
        padding-inline: 10px;
        min-height: 58px;
    }
    .header-actions { gap: 4px; }
    .header-actions {
        max-width: 46vw;
        justify-content: flex-end;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .header-actions::-webkit-scrollbar { display: none; }
    .chat-header .icon-button,
    .chat-header .compact {
        width: 34px;
        min-width: 34px;
        height: 34px;
        padding-inline: 0;
    }
    .danger-button { padding-inline: 10px; }
    .messages {
        display: block;
        padding: 16px;
        min-height: 0;
        max-width: 100%;
    }
    .message-area {
        min-height: 0;
        grid-template-rows: minmax(0, auto) minmax(0, 1fr) minmax(62px, auto);
    }
    .composer {
        grid-template-columns: 38px 38px minmax(0, 1fr) 44px;
        margin: 10px 10px calc(82px + env(safe-area-inset-bottom));
        max-width: calc(100% - 20px);
        height: 52px;
        max-height: 52px;
    }
    .send-button {
        grid-column: auto;
        min-width: 0;
        padding: 0;
        font-size: 0;
    }
    .send-button::before {
        content: "➤";
        font-size: 16px;
    }
    .modal { width: min(100% - 16px, 1080px); }
    .modal-card {
        max-height: calc(100dvh - 16px);
    }
    .modal-card > :not(header):not(footer) {
        max-width: 100%;
    }
    .modal-card header,
    .modal-card footer {
        padding: 12px;
    }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-sidebar {
        position: static;
        grid-template-rows: auto auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .settings-preview {
        position: static;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .settings-sidebar .settings-preview {
        border-bottom: 0;
    }
    .settings-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }
    .settings-nav::-webkit-scrollbar { display: none; }
    .settings-nav a {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .settings-grid,
    .server-settings-grid,
    .server-create-layout,
    .settings-fields,
    .settings-fields.three,
    .permission-grid {
        grid-template-columns: 1fr;
    }
    .server-settings-grid > .wide,
    .server-settings-sidebar {
        grid-column: 1;
        grid-row: auto;
    }
    .server-settings-sidebar {
        position: static;
    }
    .server-create-preview .server-mini-profile {
        position: static;
    }
    .member-role-row {
        grid-template-columns: 36px minmax(0, 1fr);
    }
    .member-role-row .role-pill,
    .member-role-row button {
        grid-column: 2;
        justify-self: start;
    }
    .video-tile.screen-tile { grid-column: span 1; }
    .incoming-call,
    .request-row,
    .admin-user-row {
        grid-template-columns: 40px minmax(0, 1fr);
    }
    .incoming-call .quick-actions,
    .request-row .quick-actions,
    .admin-user-row .quick-actions {
        grid-column: 1 / -1;
        justify-content: start;
    }
    .mobile-user-strip {
        position: fixed;
        z-index: 30;
        left: 70px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        min-height: 58px;
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr) 34px 34px 34px 34px;
        gap: 6px;
        align-items: center;
        padding: 8px;
        border-radius: var(--radius);
        border: 1px solid rgba(255, 255, 255, .12);
        background: rgba(35, 36, 40, .96);
        box-shadow: var(--shadow);
    }
    .mobile-user-strip strong,
    .mobile-user-strip small {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-user-strip small { color: var(--muted); }
    .mobile-user-strip .icon-button {
        width: 34px;
        height: 34px;
    }
    .messages { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
    .profile-buttons {
        right: 10px;
        top: 10px;
        gap: 6px;
    }
    .profile-buttons .icon-button {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }
}

@media (max-width: 520px) {
    .app-shell {
        grid-template-columns: 58px minmax(0, 1fr);
    }
    .channel-panel {
        left: 58px;
        width: min(312px, calc(100vw - 64px));
    }
    body.mobile-channels-open .app-shell::after {
        left: 58px;
    }
    .server-pill {
        width: 42px;
        height: 42px;
    }
    .brand span {
        width: 42px;
        height: 42px;
    }
    .chat-panel {
        min-width: 0;
        width: 100%;
    }
    .chat-header {
        min-height: 56px;
        gap: 6px;
    }
    #channelName,
    #serverName {
        max-width: 52vw;
    }
    .composer {
        grid-template-columns: 36px 36px minmax(0, 1fr) 40px;
        gap: 7px;
        margin-inline: 8px;
        max-width: calc(100% - 16px);
    }
    .composer input {
        font-size: 16px;
        min-width: 0;
    }
    .message {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 9px;
    }
    .message-area,
    .content-grid,
    .messages {
        min-width: 0;
        max-width: 100vw;
    }
    .modal-card footer button {
        flex: 1 1 140px;
    }
    .stats-row,
    .cover-grid {
        grid-template-columns: 1fr;
    }
    .context-menu {
        width: min(280px, calc(100vw - 16px));
    }
    .quick-actions,
    .discover-actions,
    .report-reasons {
        gap: 7px;
    }
    .quick-actions button,
    .discover-actions button,
    .report-reasons button {
        flex: 1 1 128px;
    }
    .profile-card {
        margin-inline: 10px;
        padding-inline: 14px;
    }
    .profile-row,
    .profile-detail-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .invite-message-actions .primary-button,
    .invite-message-actions button {
        flex-basis: 100%;
    }
}

@media (hover: none) {
    .message-actions {
        opacity: 1;
    }

    .template-card:hover,
    .discover-card:hover,
    .friend-card:hover {
        transform: none;
    }
}

/* ── Keyframe Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); }
    50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

@keyframes pulse-dot-dnd {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

@keyframes pulse-dot-idle {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .5); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes ping-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(18px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Skeleton Loading Shimmer ── */
.skeleton {
    border-radius: var(--radius);
    background: linear-gradient(90deg, rgba(255, 255, 255, .04) 25%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
}

.skeleton-line {
    height: 14px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.skeleton-line:last-child {
    width: 62%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    flex: 0 0 auto;
}

.skeleton-message {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 13px;
    padding: 9px 0;
    align-items: start;
}

.skeleton-message-body {
    display: grid;
    gap: 6px;
    padding-top: 4px;
}

.skeleton-message-body .skeleton-line {
    margin-bottom: 0;
}

.skeleton-message-body .skeleton-line:first-child {
    width: 38%;
}

.skeleton-channel {
    height: 42px;
    border-radius: 10px;
    margin-bottom: 6px;
}

/* ── Message Appear Animation (subtle, only on fresh insert) ── */
@keyframes messageIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.message {
    animation: messageIn .12s ease-out both;
}

.message:nth-child(1) { animation-delay: 0s; }
.message:nth-child(2) { animation-delay: .01s; }
.message:nth-child(3) { animation-delay: .02s; }
.message:nth-child(n+4) { animation-delay: .03s; }

/* ── Status Dot Pulse ── */
.status-dot.online {
    animation: pulse-dot 2.4s ease-in-out infinite;
}

.status-dot.dnd {
    animation: pulse-dot-dnd 2.4s ease-in-out infinite;
}

.status-dot.idle {
    animation: pulse-dot-idle 2.4s ease-in-out infinite;
}

.mini-dot.online {
    animation: pulse-dot 2.4s ease-in-out infinite;
}

/* ── Unread / Ping Badge Animation ── */
.channel-row em {
    animation: ping-badge 2s ease-in-out infinite;
}

.unread-dot {
    animation: ping-badge 2.4s ease-in-out infinite;
}

.server-pill.has-ping {
    animation: ping-badge 2s ease-in-out infinite;
}

/* ── Modal Dialog Animation ── */
.modal[open] {
    animation: modalIn .2s ease-out both;
}

.modal::backdrop {
    animation: fadeIn .18s ease-out both;
}

/* ── Toast Improvements ── */
.toast {
    z-index: 100;
    bottom: 24px;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    backdrop-filter: blur(16px);
}

.toast.show {
    animation: toastIn .22s ease-out both;
}

.toast.toast-success {
    border-color: rgba(34, 197, 94, .35);
    background: rgba(22, 40, 28, .96);
    box-shadow: 0 12px 40px rgba(34, 197, 94, .18);
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, .35);
    background: rgba(40, 22, 22, .96);
    box-shadow: 0 12px 40px rgba(239, 68, 68, .18);
}

.toast.toast-info {
    border-color: rgba(99, 102, 241, .35);
    background: rgba(22, 24, 40, .96);
    box-shadow: 0 12px 40px rgba(99, 102, 241, .18);
}

body.light .toast.toast-success {
    background: rgba(240, 253, 244, .96);
    color: #166534;
    border-color: rgba(34, 197, 94, .3);
}

body.light .toast.toast-error {
    background: rgba(254, 242, 242, .96);
    color: #991b1b;
    border-color: rgba(239, 68, 68, .3);
}

body.light .toast.toast-info {
    background: rgba(238, 242, 255, .96);
    color: #4338ca;
    border-color: rgba(99, 102, 241, .3);
}

/* ── Refined Transitions & Hover Glows ── */
.server-pill {
    transition: border-radius .18s ease, transform .18s ease, filter .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.server-pill:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 12px 26px rgba(0, 0, 0, .26), 0 0 20px rgba(99, 102, 241, .12);
}

.primary-button, .secondary-button, .danger-button, .send-button {
    position: relative;
    overflow: hidden;
}

.primary-button::after, .secondary-button::after, .danger-button::after, .send-button::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .18), transparent 60%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.primary-button:hover::after, .secondary-button:hover::after, .danger-button:hover::after, .send-button:hover::after {
    opacity: 1;
}

.icon-button {
    position: relative;
    overflow: hidden;
}

.icon-button::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .15), transparent 60%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.icon-button:hover::after {
    opacity: 1;
}

/* ── Composer Focus Glow ── */
.composer:focus-within {
    border-color: rgba(99, 102, 241, .5);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .1), 0 0 30px rgba(99, 102, 241, .06), 0 18px 54px rgba(0, 0, 0, .24);
}

/* ── Message Hover Refinements ── */
.message:hover {
    background: rgba(255, 255, 255, .045);
    border-color: rgba(255, 255, 255, .06);
}

.message:has(.message-actions:hover) {
    background: rgba(255, 255, 255, .055);
}

/* ── Card Hover Glows ── */
.friend-card:hover,
.discover-card:hover,
.server-mini-profile:hover {
    box-shadow: var(--shadow-soft), 0 0 24px rgba(99, 102, 241, .08);
}

/* ── Scrollbar Refinements ── */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .28) transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .22);
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
    transition: background .2s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, .4);
    background-clip: padding-box;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

/* ── Smooth Scroll for Messages ── */
.messages {
    scroll-behavior: smooth;
}

/* ── Avatar Hover Effect ── */
.avatar img {
    transition: transform .2s ease, filter .2s ease;
}

.avatar:hover img {
    transform: scale(1.05);
    filter: brightness(1.08);
}

.server-pill img {
    transition: transform .2s ease, filter .2s ease;
}

.server-pill:hover img {
    transform: scale(1.06);
    filter: brightness(1.1);
}

/* ── Online Member List dot animation ── */
.member .status-dot.online,
.member .status-dot.dnd,
.member .status-dot.idle {
    animation-duration: 3s;
}

/* ── Context menu animation ── */
.context-menu.show {
    animation: slideUp .12s ease-out both;
}

/* ── Settings section refinements ── */
.settings-section {
    transition: border-color .2s ease, box-shadow .2s ease;
}

.settings-section:hover {
    border-color: rgba(255, 255, 255, .16);
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, .035);
}

/* ── Role/Badge choice row animation ── */
.role-choice,
.badge-choice {
    transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.role-choice:hover,
.badge-choice:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, .1);
}

/* ── Template card hover refinements ── */
.template-card {
    transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.template-card:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, .1);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

.theme-select optgroup { font-style: normal; color: var(--soft); padding: 4px 0; }
.theme-select option { padding: 4px 8px; }
