/* ── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #111118;
    --bg-sidebar:  #16161f;
    --bg-pane:     #1a1a24;
    --bg-input:    #22222e;
    --bg-hover:    #2a2a38;
    --bg-active:   #33334a;
    --border:      #2e2e40;
    --text:        #d8d8e0;
    --text-muted:  #7a7a90;
    --text-dim:    #555568;
    --accent:      #5b8af5;
    --accent-dim:  #3a5ea0;
    --danger:      #e05050;
    --success:     #40b060;
    --radius:      6px;
    --font-ui:     system-ui, -apple-system, sans-serif;
    --font-mono:   "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

html[data-theme="light"] {
    --bg:          #f0f0f5;
    --bg-sidebar:  #e4e4ec;
    --bg-pane:     #ffffff;
    --bg-input:    #f0f0f4;
    --bg-hover:    #dcdce6;
    --bg-active:   #cbcbd8;
    --border:      #ccccda;
    --text:        #1a1a2e;
    --text-muted:  #5e5e78;
    --text-dim:    #9898aa;
    --accent:      #3b6fd6;
    --accent-dim:  #5b8af5;
    --danger:      #cc2e2e;
    --success:     #28884a;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.45;
    overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
select { cursor: pointer; }

/* ── Views ────────────────────────────────────────────────────────── */
.view { height: 100%; }
[hidden] { display: none !important; }

/* ── Login ────────────────────────────────────────────────────────── */
#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: var(--bg-pane);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 36px;
    width: 340px;
    text-align: center;
}
.login-card h1 {
    font-size: 28px;
    letter-spacing: 1px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.login-icon {
    height: 38px;
    vertical-align: middle;
}
.login-card .subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
}
#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#login-form input:not([type="checkbox"]) { width: 100%; }
#login-form button {
    background: var(--accent);
    color: #fff;
    padding: 10px;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background 0.15s;
}
#login-form button:hover { background: var(--accent-dim); }
#login-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
}
.status {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 12px;
}
.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    margin: -2px 0 2px;
}
.remember-label input {
    width: 16px; height: 16px; cursor: pointer;
    margin: 0; flex-shrink: 0; accent-color: var(--accent);
}
.toggle-link {
    margin-top: 16px;
    font-size: 13px;
}
.toggle-link a { color: var(--text-muted); }
.toggle-link a:hover { color: var(--accent); }

/* ── Topbar ───────────────────────────────────────────────────────── */
#topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 42px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
}
.topbar-title {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
}
.topbar-user {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 13px;
}
.icon-btn {
    background: none;
    color: var(--text-muted);
    font-size: 18px;
    padding: 4px 6px;
    border-radius: 4px;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ── Top-level tabs ───────────────────────────────────────────────── */
#top-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-sidebar);
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
}
.top-tab {
    padding: 8px 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    position: relative;
}
.top-tab:hover { color: var(--text); background: var(--bg-hover); }
.top-tab.active {
    color: var(--text);
    font-weight: 600;
    border-bottom-color: var(--accent);
}
/* Keyword MDI windows */
.kw-mdi-win {
    position: absolute;
    background: var(--bg-primary);
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    min-width: 200px;
    min-height: 120px;
    z-index: 10;
}
.kw-mdi-win.kw-mdi-focused {
    z-index: 20;
    border-color: var(--accent);
    box-shadow: 0 8px 40px rgba(79,195,247,0.2);
}
.kw-mdi-titlebar {
    background: #1e1e2e;
    border-bottom: 1px solid #333;
    border-radius: 8px 8px 0 0;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}
.kw-mdi-titlebar span {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #ccc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kw-mdi-btn {
    width: 20px; height: 20px;
    border: none; border-radius: 4px;
    font-size: 12px; line-height: 20px;
    text-align: center; cursor: pointer;
    margin-left: 4px; padding: 0;
    color: #aaa; background: transparent;
}
.kw-mdi-btn:hover { background: #333; color: #fff; }
.kw-mdi-btn.kw-close:hover { background: #c62828; color: #fff; }
.kw-mdi-body {
    flex: 1;
    overflow: auto;
    border-radius: 0 0 8px 8px;
}
.kw-mdi-body iframe {
    width: 100%; height: 100%; border: none;
}
.kw-mdi-resize {
    position: absolute; right: 0; bottom: 0;
    width: 14px; height: 14px;
    cursor: nwse-resize;
    opacity: 0.4;
}
.kw-mdi-resize::after {
    content: ""; position: absolute; right: 2px; bottom: 2px;
    width: 8px; height: 8px;
    border-right: 2px solid #888; border-bottom: 2px solid #888;
}
/* Keyword taskbar tabs */
.kw-taskbar-tab {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 4px;
    font-size: 11px; color: #aaa; background: #1e1e2e;
    border: 1px solid #333; cursor: pointer; white-space: nowrap;
    flex-shrink: 0;
}
.kw-taskbar-tab:hover { background: #252540; color: #fff; }
.kw-taskbar-tab.kw-tb-active { background: #252540; color: #fff; border-color: var(--accent); }
.kw-taskbar-tab .kw-tb-close {
    font-size: 13px; color: #666; cursor: pointer; margin-left: 2px; line-height: 1;
}
.kw-taskbar-tab .kw-tb-close:hover { color: #c62828; }
.top-tab.tab-drag-over {
    border-bottom-color: var(--accent);
    background: var(--bg-hover);
    box-shadow: inset 0 -2px 0 var(--accent);
}
.top-tab[draggable] { cursor: grab; }
.top-tab[draggable]:active { cursor: grabbing; }
.badge {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 6px;
    min-width: 16px;
    text-align: center;
}

/* ── App layout ───────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    height: calc(100% - 42px - 38px);
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    min-width: 180px;
    max-width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#sidebar-panes {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
/* ── Sidebar panes (collapsible, draggable) ──────────────────────── */
.sidebar-pane {
    border-bottom: 1px solid var(--border);
}
.sidebar-pane.drag-over { border-top: 2px solid var(--accent); }
.sidebar-pane-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: var(--bg-sidebar);
    transition: background 0.1s;
}
.sidebar-pane-header:hover { background: var(--bg-hover); }
.pane-drag {
    cursor: grab;
    font-size: 13px;
    opacity: 0.4;
    flex-shrink: 0;
    line-height: 1;
}
.pane-drag:active { cursor: grabbing; }
.pane-title { flex: 1; font-weight: 600; }
.pane-badge {
    font-size: 10px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    padding: 0 5px;
    min-width: 14px;
    text-align: center;
    line-height: 16px;
}
.pane-badge:empty { display: none; }
.pane-toggle {
    background: none; border: none; color: var(--text-muted);
    font-size: 8px; cursor: pointer; padding: 2px;
    transition: transform 0.2s;
}
.sidebar-pane.collapsed .pane-toggle { transform: rotate(-90deg); }
.sidebar-pane.collapsed .sidebar-pane-body { display: none; }
.sidebar-pane-body { max-height: 200px; overflow-y: auto; }
.sidebar-pane-body .item-list { padding: 2px 4px; }

/* ── Sidebar section (legacy compat) ─────────────────────────────── */
.sidebar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section h3 {
    padding: 10px 14px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.item-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 2px 6px;
}
.item-list li {
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-list li:hover { background: var(--bg-hover); }
.item-list li.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.item-list li.self { color: var(--accent); }

.room-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: 8px;
}
.room-type-badge {
    font-size: 10px;
    color: var(--accent);
    opacity: 0.7;
}

/* ── Sidebar backdrop (mobile only) ───────────────────────────────── */
.sidebar-backdrop {
    display:none; position:absolute; inset:0; z-index:9;
    background:rgba(0,0,0,0.4);
}

/* ── Tab panels (main content) ────────────────────────────────────── */
.tab-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-pane);
    flex-shrink: 0;
}
.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    text-align: center;
    line-height: 1.8;
}

/* ── Sub-tab bar (room tabs, PM tabs) ─────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 2px;
    padding: 4px 8px 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0;
}
.tab-btn {
    padding: 6px 14px;
    border-radius: 6px 6px 0 0;
    background: var(--bg-pane);
    color: var(--text-muted);
    font-size: 12px;
    border: 1px solid var(--border);
    border-bottom: none;
    white-space: nowrap;
    transition: background 0.1s;
}
.tab-btn:hover { background: var(--bg-hover); color: var(--text); }
.tab-btn.active {
    background: var(--bg-pane);
    color: var(--text);
    font-weight: 600;
    border-color: var(--accent);
}
.tab-btn.unread { color: var(--accent); font-weight: 700; }
.tab-close {
    margin-left: 6px;
    font-size: 14px;
    opacity: 0.5;
}
.tab-close:hover { opacity: 1; color: var(--danger); }

/* ── Pane ─────────────────────────────────────────────────────────── */
.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-pane);
}
.pane-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    flex-shrink: 0;
}
.pane-header .muted { font-weight: 400; font-size: 12px; color: var(--text-muted); }
.sm-btn {
    background: var(--bg-hover);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 0;
}
.sm-btn:hover { background: var(--bg-active); color: var(--text); }
.pane-header .sm-btn { margin-left: auto; }

/* ── Room body (chat + right pane) ────────────────────────────────── */
.room-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.room-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Room right pane ─────────────────────────────────────────────── */
.room-right-pane {
    width: 200px;
    min-width: 200px;
    border-left: 1px solid var(--border);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.room-right-icon {
    display: flex;
    justify-content: center;
    padding: 16px 12px 8px;
}
.room-right-icon img {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
}
.room-right-icon .room-icon-default {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}
.room-right-name {
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    padding: 0 12px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.room-right-about {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 12px 10px;
    max-height: 60px;
    overflow-y: auto;
    line-height: 1.4;
}
.room-right-divider {
    height: 1px;
    background: var(--border);
    margin: 0 12px;
}
.room-right-members-header {
    padding: 10px 12px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.room-right-members {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 0 6px 8px;
}
.room-right-members li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-right-members li:hover { background: var(--bg-hover); }
.room-right-members li.self { color: var(--accent); }

@media (max-width: 800px) {
    .room-right-pane { display: none; }
}

/* ── Messages ─────────────────────────────────────────────────────── */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    scroll-behavior: smooth;
}
.msg {
    padding: 3px 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.msg-time {
    color: var(--text-dim);
    font-size: 11px;
    margin-right: 6px;
}
.msg-user {
    font-weight: 600;
    margin-right: 6px;
}
.msg-system {
    color: var(--text-muted);
    font-style: italic;
}
.msg-self .msg-user { color: var(--accent); }
.msg-body { color: var(--text); display:inline; }
.msg-body div, .msg-body p { display:block; }
.msg-body b, .msg-body strong { color: var(--text); font-weight: 700; }
.msg-body i, .msg-body em { color: var(--text-muted); }
.msg-body a { color: var(--accent); }
.msg-body img { max-width: 300px; max-height: 200px; border-radius: 4px; margin: 4px 0; display: block; }
.msg-body video { max-width: 400px; max-height: 300px; border-radius: 4px; margin: 4px 0; }

/* Message background */
.msg-body [data-msgbg="1"] {
    padding: 6px 10px;
    border-radius: 4px;
    margin: 2px 0;
}

/* Code blocks */
.msg-body [data-codeblock="1"],
.msg-body code {
    font-family: var(--font-mono);
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}
.msg-body pre {
    font-family: var(--font-mono);
    background: var(--bg-input);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    margin: 4px 0;
    border: 1px solid var(--border);
}

/* Spoilers */
.spoiler-hidden {
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.15s;
}
.spoiler-revealed {
    border-radius: 3px;
}

/* Alignment */
.msg-body p[align="center"],
.msg-body p[style*="text-align:center"],
.msg-body p[style*="text-align: center"] { text-align: center; }
.msg-body p[align="right"],
.msg-body p[style*="text-align:right"],
.msg-body p[style*="text-align: right"] { text-align: right; }

/* Blockquote */
.msg-body blockquote {
    border-left: 3px solid var(--accent-dim);
    margin: 4px 0 4px 4px;
    padding: 4px 10px;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-radius: 0 4px 4px 0;
}

/* Tables */
.msg-body table {
    border-collapse: collapse;
    margin: 4px 0;
    font-size: 12px;
}
.msg-body th, .msg-body td {
    border: 1px solid var(--border);
    padding: 4px 8px;
}
.msg-body th { background: var(--bg-hover); font-weight: 600; }

/* External link overlay */
.link-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.link-confirm-box {
    background: var(--bg-pane);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 28px;
    max-width: 420px;
    text-align: center;
}
.link-confirm-box p { margin-bottom: 8px; font-size: 13px; }
.link-confirm-url {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    word-break: break-all;
    margin: 8px 0 16px;
}
.link-confirm-btns { display: flex; gap: 10px; justify-content: center; }
.link-confirm-btns button {
    padding: 8px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13px;
}
.link-confirm-go { background: var(--accent); color: #fff; }
.link-confirm-go:hover { background: var(--accent-dim); }
.link-confirm-cancel { background: var(--bg-hover); color: var(--text); }
.link-confirm-cancel:hover { background: var(--bg-active); }

/* ── Send form ────────────────────────────────────────────────────── */
.send-form {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.send-form input { flex: 1; }
.send-form button {
    background: var(--accent);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-weight: 600;
}
.send-form button:hover { background: var(--accent-dim); }

/* ── Buddy List ───────────────────────────────────────────────────── */
.buddy-add-bar {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
.buddy-add-bar input { width: 180px; padding: 4px 10px; font-size: 13px; }
.buddy-section {
    padding: 0 8px;
    overflow-y: auto;
}
.buddy-section h3 {
    padding: 10px 8px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}
.buddy-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.buddy-item:hover { background: var(--bg-hover); }
.buddy-status {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.buddy-status.online { background: var(--success); }
.buddy-status.offline { background: var(--text-dim); }
.buddy-mood {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: auto;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.buddy-remove {
    color: var(--text-dim);
    font-size: 14px;
    padding: 2px 4px;
    cursor: pointer;
    opacity: 0;
}
.buddy-item:hover .buddy-remove { opacity: 0.6; }
.buddy-remove:hover { color: var(--danger); opacity: 1; }
.buddy-layout { flex:1; display:flex; overflow:hidden; }
.buddy-lists { flex:1; overflow-y:auto; min-width:0; }
.sidebar-resize-handle {
    width:5px; cursor:col-resize; background:transparent; flex-shrink:0;
    transition:background 0.15s;
}
.sidebar-resize-handle:hover, .sidebar-resize-handle.dragging {
    background:var(--accent, #5c6bc0);
}
.buddy-sidebar {
    width:240px; min-width:160px; max-width:50%; border-left:1px solid var(--border);
    background:var(--bg-sidebar); overflow-y:auto; padding:12px;
}
.buddy-sidebar-avatar { width:80px; height:80px; border-radius:10px; object-fit:cover; display:block; margin:0 auto 8px; }
.buddy-sidebar-name { font-weight:700; font-size:15px; text-align:center; margin-bottom:4px; }
.buddy-sidebar-mood { font-size:12px; text-align:center; color:var(--text-muted); margin-bottom:4px; }
.buddy-sidebar-gaming { font-size:11px; text-align:center; color:#9C27B0; margin-bottom:4px; }
.buddy-sidebar-away { font-size:11px; color:#FF9800; text-align:center; margin-bottom:6px; }
.buddy-sidebar-away-msg { font-size:11px; padding:6px 8px; margin-top:4px; background:rgba(255,152,0,0.08); border:1px solid rgba(255,152,0,0.25); border-radius:var(--radius); text-align:left; color:var(--text); word-wrap:break-word; overflow-wrap:break-word; max-height:120px; overflow-y:auto; }
.buddy-sidebar-away-msg img { max-width:100%; border-radius:4px; }
.buddy-sidebar-profile { font-size:12px; line-height:1.5; margin-top:8px; border-top:1px solid var(--border); padding-top:8px; max-height:200px; overflow-y:auto; }
.buddy-sidebar-profile img { max-width:100%; border-radius:4px; }
.buddy-item.away .buddy-status { background:var(--danger) !important; }
.buddy-gaming-text { font-size:10px; color:#9C27B0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:120px; }
@media (max-width:700px) { .buddy-sidebar { display:none; } }

/* ── Forums ───────────────────────────────────────────────────────── */
.forum-section { padding: 0 16px 16px; }
.forum-section h3 {
    padding: 12px 0 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

/* Forum grid */
.forum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    padding: 12px 16px;
}
.forum-grid-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px 14px;
    background: var(--bg-pane);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}
.forum-grid-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent-dim);
}
.forum-icon {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
}
.forum-icon-default {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
}
.forum-grid-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.forum-grid-meta {
    font-size: 11px;
    color: var(--text-dim);
}
.forum-grid-owner {
    font-size: 11px;
    color: var(--text-muted);
}

/* Forum detail header (categories view) */
.forum-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.forum-detail-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.forum-detail-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}
.forum-detail-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Category cards */
.forum-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-pane);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 0 16px 4px;
    cursor: pointer;
    transition: background 0.1s;
}
.forum-card:hover { background: var(--bg-hover); }
.forum-card-name { font-weight: 500; }
.forum-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.forum-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.forum-card-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
}
.forum-cat-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Forum posts & threads */
.forum-post-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.forum-post-item:hover { background: var(--bg-hover); }
.forum-post-title { font-weight: 500; }
.forum-post-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Avatars ─────────────────────────────────────────────────────── */
.avatar {
    display: inline-block;
    border-radius: 50%;
    vertical-align: middle;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-default {
    text-align: center;
    color: #fff;
    font-weight: 600;
}

#forums-list-view {
    flex: 1;
    display: flex;
    overflow: hidden;
}
.forums-main {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
}
.forums-right-pane {
    width: 260px;
    min-width: 260px;
    border-left: 1px solid var(--border);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.forums-right-pane h3 {
    padding: 12px 14px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.forums-recent-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 6px 8px;
}
.forums-recent-item {
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.forums-recent-item:last-child { border-bottom: none; }
.forums-recent-item:hover { background: var(--bg-hover); }
.forums-recent-title {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.forums-recent-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 800px) {
    .forums-right-pane { display: none; }
}
#forums-thread-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#forums-thread-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#forums-thread-posts {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
}

/* Forum post/reply cards */
.forum-post-card {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
    background: var(--bg-pane);
}
.forum-post-card.op {
    border-color: var(--accent-dim);
}
.forum-post-left {
    width: 130px;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    gap: 4px;
}
.forum-post-author {
    font-weight: 600;
    font-size: 12px;
    text-align: center;
    word-wrap: break-word;
    max-width: 100%;
    color: var(--accent);
}
.forum-post-stat {
    font-size: 10px;
    color: var(--text-muted);
}
.forum-post-date {
    font-size: 10px;
    color: var(--text-dim);
    text-align: center;
}
.forum-post-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.forum-post-right-header {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.forum-post-right-header .op-label {
    color: var(--accent);
}
.forum-post-right-header .reply-num {
    color: var(--text-muted);
    font-weight: 400;
}
.forum-post-body {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.6;
    font-family: var(--font-mono);
    flex: 1;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}
.forum-post-body a { color: var(--accent); }
.forum-post-body img { max-width: 100%; border-radius: 4px; margin: 4px 0; display: block; }
.forum-post-body video { max-width: 100%; border-radius: 4px; margin: 4px 0; }
.forum-post-body [data-msgbg="1"] { padding: 6px 10px; border-radius: 4px; margin: 2px 0; }
.forum-post-body [data-codeblock="1"],
.forum-post-body code { font-family: var(--font-mono); background: var(--bg-input); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.forum-post-body pre { font-family: var(--font-mono); background: var(--bg-input); padding: 10px 12px; border-radius: var(--radius); font-size: 12px; overflow-x: auto; white-space: pre-wrap; margin: 4px 0; border: 1px solid var(--border); }
.forum-post-body blockquote { border-left: 3px solid var(--accent-dim); margin: 4px 0 4px 4px; padding: 4px 10px; color: var(--text-muted); background: var(--bg-hover); border-radius: 0 4px 4px 0; }
.forum-post-body table { border-collapse: collapse; margin: 4px 0; font-size: 12px; }
.forum-post-body th, .forum-post-body td { border: 1px solid var(--border); padding: 4px 8px; }
.forum-post-body th { background: var(--bg-hover); font-weight: 600; }

@media (max-width: 600px) {
    .forum-post-left { width: 80px; min-width: 80px; }
    .forum-post-left .avatar, .forum-post-left .avatar-default { width: 36px !important; height: 36px !important; }
}

/* ── Email ────────────────────────────────────────────────────────── */
.email-actions { margin-left: auto; }
.email-folder-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.folder-tab {
    padding: 8px 20px;
    color: var(--text-muted);
    font-size: 13px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.folder-tab:hover { color: var(--text); }
.folder-tab.active {
    color: var(--text);
    font-weight: 600;
    border-bottom-color: var(--accent);
}

.email-list {
    flex: 1;
    overflow-y: auto;
}
.email-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
}
.email-row:hover { background: var(--bg-hover); }
.email-row.unread { font-weight: 600; }
.email-from { width: 120px; flex-shrink: 0; }
.email-subject { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-date { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.email-delete {
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
}
.email-delete:hover { color: var(--danger); }

.email-detail {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
#email-detail-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
#email-detail-body {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.email-compose {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
#email-compose-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 600px;
}
#email-compose-form textarea {
    min-height: 150px;
}
.email-compose-actions {
    display: flex;
    gap: 8px;
}

/* ── Settings ─────────────────────────────────────────────────────── */
.settings-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    overflow-y: auto;
}
.settings-form label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 6px;
}
.settings-form textarea { min-height: 120px; }
.settings-form select { max-width: 200px; }
.settings-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

/* ── Context menu ─────────────────────────────────────────────────── */
.ctx-menu {
    position:fixed; z-index:9999; background:var(--bg-pane); border:1px solid var(--border);
    border-radius:6px; padding:4px 0; min-width:160px; max-width:260px;
    box-shadow:0 4px 16px rgba(0,0,0,0.35); font-size:13px;
}
.ctx-item {
    padding:7px 14px; cursor:pointer; display:flex; align-items:center; gap:8px;
    color:var(--text); white-space:nowrap;
}
.ctx-item:hover { background:var(--bg-hover); }
.ctx-item.danger { color:var(--danger); }
.ctx-item.danger:hover { background:rgba(224,80,80,0.1); }
.ctx-sep { height:1px; background:var(--border); margin:4px 0; }
.ctx-sub { position:relative; }
.ctx-sub:hover > .ctx-submenu { display:block; }
.ctx-sub > .ctx-item::after { content:"▸"; margin-left:auto; font-size:10px; color:var(--text-dim); }
.ctx-submenu {
    display:none; position:absolute; left:100%; top:0;
    background:var(--bg-pane); border:1px solid var(--border); border-radius:6px;
    padding:4px 0; min-width:120px; box-shadow:0 4px 12px rgba(0,0,0,0.3);
}

/* ── Resize handles ──────────────────────────────────────────────── */
.resize-handle {
    width:5px; cursor:col-resize; background:transparent; flex-shrink:0;
    transition:background 0.15s; position:relative; z-index:5;
}
.resize-handle-h {
    height:5px; cursor:row-resize; background:transparent; flex-shrink:0;
    transition:background 0.15s;
}
.resize-handle-h:hover, .resize-handle-h.dragging {
    background:var(--accent, #5c6bc0);
}
.resize-handle:hover, .resize-handle.active { background:var(--accent); opacity:0.5; }
@media (max-width:600px) { .resize-handle { display:none; } }

/* ── Modal overlay ────────────────────────────────────────────────── */
.modal-overlay {
    position:fixed; inset:0; z-index:9998; background:rgba(0,0,0,0.55);
    display:flex; align-items:center; justify-content:center;
}
.modal-box {
    background:var(--bg-pane); border:1px solid var(--border); border-radius:12px;
    width:calc(100% - 32px); max-height:calc(100vh - 40px); overflow-y:auto;
    box-shadow:0 8px 32px rgba(0,0,0,0.4);
}
.modal-header {
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 18px; border-bottom:1px solid var(--border); font-size:15px; font-weight:600;
}
.modal-body { padding:14px 18px; display:flex; flex-direction:column; gap:10px; }
.modal-label { display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--text-muted); font-weight:500; }
.modal-label input, .modal-label select, .modal-label textarea { font-size:14px; }
.modal-check { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-muted); cursor:pointer; }
.modal-check input { width:16px; height:16px; cursor:pointer; }
.modal-footer {
    display:flex; justify-content:flex-end; gap:8px; padding:12px 18px;
    border-top:1px solid var(--border);
}

/* ── Room search bar ─────────────────────────────────────────────── */
.room-search-bar {
    display:flex; gap:8px; margin-bottom:10px; align-items:center;
}
.room-search-bar input {
    flex:1; padding:8px 12px; font-size:14px; border-radius:var(--radius);
    background:var(--bg-input); border:1px solid var(--border); color:var(--text);
}
.room-search-bar input:focus { border-color:var(--accent); }

/* ── Governance badges ────────────────────────────────────────────── */
.gov-badge {
    display:inline-block; font-size:10px; padding:1px 7px; border-radius:8px;
    vertical-align:middle; font-weight:600; letter-spacing:0.3px;
}
.gov-badge-sm {
    display:inline-block; font-size:11px; vertical-align:middle; margin-right:1px;
}
.gov-democratic { background:#2e6ca8; color:#fff; }
.gov-elected { background:#7e57c2; color:#fff; }
.gov-tyrant { background:#c62828; color:#fff; }
.gov-private { background:var(--bg-active); color:var(--text-muted); font-size:9px; }
.gov-locked { background:var(--bg-active); color:var(--danger); font-size:9px; }
.gov-role {
    font-size:11px; color:var(--text-muted); line-height:1.5; padding:0 0 1px;
}
.gov-role b { color:var(--text); }
.member-role {
    margin-left:auto; font-size:11px; flex-shrink:0; padding:1px 4px;
    border-radius:4px; line-height:1;
}
.role-internal { background:#ffd600; color:#333; font-weight:700; }
.role-host { background:#ff9800; color:#fff; font-weight:700; }
.role-guide { background:#4caf50; color:#fff; font-weight:700; }
.role-tyrant { background:#c62828; color:#fff; }
.role-prince { background:#e65100; color:#fff; }
.role-elected { background:#7e57c2; color:#fff; }

/* ── Room grid cards ──────────────────────────────────────────────── */
.room-grid-card {
    display:flex; flex-direction:column; align-items:center; gap:8px;
    padding:16px 10px 14px; background:var(--bg-pane); border:1px solid var(--border);
    border-radius:10px; cursor:pointer; text-align:center;
    transition:background 0.15s, border-color 0.15s;
}
.room-grid-card:hover { background:var(--bg-hover); border-color:var(--accent-dim); }
.room-grid-icon {
    width:56px; height:56px; border-radius:10px; object-fit:cover;
}
.room-grid-icon-default {
    display:flex; align-items:center; justify-content:center;
    width:56px; height:56px; border-radius:10px; color:#fff;
    font-size:22px; font-weight:700;
}
.room-grid-name {
    font-size:13px; font-weight:600; color:var(--text);
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%;
}
.room-grid-type {
    font-size:10px; text-transform:uppercase; letter-spacing:0.5px;
    padding:2px 8px; border-radius:8px; background:var(--bg-active); color:var(--text);
}
.room-grid-meta { font-size:11px; color:var(--text-dim); }

/* ── Emoji Reactions ──────────────────────────────────────────────── */
.msg-reactions { display:flex; gap:4px; flex-wrap:wrap; padding:2px 0 0; min-height:0; }
.react-badge {
    display:inline-flex; align-items:center; gap:3px; padding:1px 7px;
    border-radius:10px; font-size:12px; cursor:pointer; user-select:none;
    background:var(--bg-hover); border:1px solid var(--border);
    transition:background 0.1s;
}
.react-badge:hover { background:var(--bg-active); }
.react-mine { background:var(--accent-dim); border-color:var(--accent); color:#fff; }
.react-mine:hover { background:var(--accent); }
.react-hover-bar {
    position:fixed; z-index:100; display:none; gap:2px; align-items:center;
    background:var(--bg-pane); border:1px solid var(--border); border-radius:6px;
    padding:2px 4px; box-shadow:0 2px 8px rgba(0,0,0,0.3);
}
.react-hover-emoji {
    font-size:16px; cursor:pointer; padding:2px 4px; border-radius:4px;
    line-height:1; user-select:none;
}
.react-hover-emoji:hover { background:var(--bg-hover); }
.react-hover-plus {
    font-size:14px; font-weight:700; color:var(--text-muted);
    width:24px; text-align:center;
}
.react-picker {
    position:fixed; z-index:9999; background:var(--bg-pane); border:1px solid var(--border);
    border-radius:8px; padding:8px; box-shadow:0 4px 16px rgba(0,0,0,0.35);
    width:260px; display:grid; grid-template-columns:repeat(8,1fr); gap:2px;
    max-height:200px; overflow-y:auto;
}
.react-picker span {
    font-size:18px; cursor:pointer; padding:3px; text-align:center;
    border-radius:4px; line-height:1;
}
.react-picker span:hover { background:var(--bg-hover); }

/* ── Rich Text Toolbar ────────────────────────────────────────────── */
.rt-toolbar {
    display:flex; gap:2px; padding:3px 8px; flex-wrap:wrap; align-items:center;
    background:var(--bg-sidebar); border-bottom:1px solid var(--border); flex-shrink:0;
}
.rt-toolbar-sm { padding:2px 6px; }
.rt-btn {
    background:var(--bg-hover); color:var(--text-muted); border:1px solid var(--border);
    border-radius:3px; padding:2px 6px; font-size:12px; cursor:pointer; min-width:24px;
    text-align:center; line-height:1.3;
}
.rt-btn:hover { background:var(--bg-active); color:var(--text); }
.rt-color {
    width:22px; height:22px; border:1px solid var(--border); border-radius:3px;
    padding:0; cursor:pointer; background:none; vertical-align:middle;
}
.rt-select {
    padding:1px 4px; font-size:11px; border-radius:3px; background:var(--bg-input);
    color:var(--text); border:1px solid var(--border); cursor:pointer; max-width:90px;
}
.rt-font { max-width:110px; }
.rt-sep { width:1px; height:18px; background:var(--border); margin:0 3px; flex-shrink:0; }
.rt-editor {
    flex:1; min-height:32px; max-height:150px; overflow-y:auto; padding:6px 10px;
    font-family:var(--font-ui); font-size:14px; line-height:1.45; color:var(--text);
    outline:none; word-wrap:break-word; white-space:pre-wrap;
}
.rt-editor:empty::before {
    content:attr(data-placeholder); color:var(--text-dim); pointer-events:none;
}
.rt-editor:focus { border-color:var(--accent); }
.rt-editor img { max-width:300px; max-height:200px; border-radius:4px; display:inline; }
.rt-editor [data-codeblock="1"] {
    font-family:var(--font-mono); background:var(--bg-input); padding:1px 5px;
    border-radius:3px; font-size:12px;
}

/* ── Emoji Picker ────────────────────────────────────────────────── */
.emoji-picker {
    position:fixed; z-index:9999; background:var(--bg-pane); border:1px solid var(--border);
    border-radius:8px; padding:8px; box-shadow:0 4px 16px rgba(0,0,0,0.35);
    width:280px; max-height:250px; overflow-y:auto;
    display:grid; grid-template-columns:repeat(8,1fr); gap:2px;
}
.emoji-picker span {
    font-size:20px; cursor:pointer; padding:4px; text-align:center;
    border-radius:4px; line-height:1;
}
.emoji-picker span:hover { background:var(--bg-hover); }

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Social ───────────────────────────────────────────────────────── */
.social-list-layout { flex:1; display:flex; overflow:hidden; }
.social-main { flex:1; overflow-y:auto; min-width:0; }
.social-right-pane {
    width:250px; min-width:250px; border-left:1px solid var(--border);
    background:var(--bg-sidebar); display:flex; flex-direction:column; overflow:hidden;
}
.social-right-pane h3 {
    padding:12px 14px 8px; font-size:11px; text-transform:uppercase;
    letter-spacing:1px; color:var(--text-muted); flex-shrink:0;
}
#social-recent { flex:1; overflow-y:auto; padding:0 6px 8px; }
.social-blog-card {
    display:flex; align-items:center; gap:12px; padding:12px 16px;
    border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.1s;
}
.social-blog-card:hover { background:var(--bg-hover); }
.social-blog-info { flex:1; min-width:0; }
.social-blog-name { font-weight:600; font-size:14px; }
.social-blog-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }
#social-blog-view { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.social-blog-layout { flex:1; display:flex; overflow:hidden; }
.social-blog-main { flex:1; display:flex; flex-direction:column; overflow:hidden; min-width:0; }
.social-blog-header {
    display:flex; align-items:center; gap:16px; padding:16px;
    border-bottom:1px solid var(--border); flex-shrink:0;
}
.social-blog-header-info { flex:1; }
.social-blog-header-name { font-size:18px; font-weight:700; }
.social-blog-header-stats { font-size:12px; color:var(--text-muted); margin-top:4px; }
.social-blog-posts { flex:1; overflow-y:auto; padding:10px 14px; }
.social-blog-pagination {
    display:flex; align-items:center; justify-content:center; gap:12px;
    padding:8px 14px; border-top:1px solid var(--border); flex-shrink:0;
    font-size:12px; color:var(--text-muted);
}
.social-blog-right {
    width:260px; min-width:260px; border-left:1px solid var(--border);
    background:var(--bg-sidebar); overflow-y:auto;
}
.social-blog-section {
    padding:10px 12px; border-bottom:1px solid var(--border);
}
.social-blog-section:empty { display:none; }
.social-blog-section h4 {
    font-size:11px; text-transform:uppercase; letter-spacing:0.5px;
    color:var(--text-muted); margin:0 0 8px;
}
.social-blog-section .section-text {
    font-size:12px; line-height:1.5; max-height:150px; overflow-y:auto;
    color:var(--text);
}
.social-thumb-grid {
    display:flex; flex-wrap:wrap; gap:6px;
}
.social-thumb-grid img {
    width:56px; height:56px; object-fit:cover; border-radius:4px;
    border:1px solid var(--border); cursor:pointer;
}
.social-thumb-grid .thumb-icon {
    width:56px; height:56px; border-radius:4px; border:1px solid var(--border);
    display:flex; align-items:center; justify-content:center; font-size:20px;
    background:var(--bg-pane); cursor:pointer; text-decoration:none;
}
.social-thumb-grid .thumb-icon:hover { background:var(--bg-hover); }
.social-follower-item {
    display:flex; align-items:center; gap:8px; padding:4px 0;
    cursor:pointer; font-size:12px;
}
.social-follower-item:hover { color:var(--accent); }
.social-media-item {
    display:flex; align-items:center; gap:8px; padding:5px 4px;
    border-radius:4px; cursor:pointer; font-size:12px; color:var(--text);
    text-decoration:none;
}
.social-media-item:hover { background:var(--bg-hover); }
.social-media-icon { font-size:18px; flex-shrink:0; width:24px; text-align:center; }
.social-post-card {
    border:1px solid var(--border); border-radius:var(--radius);
    margin-bottom:10px; overflow:hidden; background:var(--bg-pane);
}
.social-post-header {
    display:flex; align-items:center; gap:10px; padding:10px 14px;
    border-bottom:1px solid var(--border); font-size:13px;
}
.social-post-author { font-weight:600; color:var(--accent); }
.social-post-time { font-size:11px; color:var(--text-dim); margin-left:auto; }
.social-post-body { padding:10px 14px; font-size:13px; line-height:1.5; }
.social-post-actions {
    display:flex; gap:12px; padding:6px 14px; border-top:1px solid var(--border);
    font-size:12px; color:var(--text-muted);
}
.social-post-actions span { cursor:pointer; }
.social-post-actions span:hover { color:var(--accent); }
.social-reply { margin-left:20px; border-left:2px solid var(--border); padding-left:12px; margin-bottom:8px; }
.social-post-votes {
    display:flex; gap:8px; padding:6px 14px; border-top:1px solid var(--border);
}
.vote-btn {
    background:none; border:1px solid var(--border); border-radius:4px;
    padding:2px 10px; font-size:12px; cursor:pointer; color:var(--text-muted);
    transition:background 0.1s, color 0.1s;
}
.vote-btn:hover { background:var(--bg-hover); color:var(--text); }
.vote-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.social-reply-form {
    display:flex; gap:6px; padding:6px 14px; border-top:1px solid var(--border);
}
.social-reply-form input {
    flex:1; padding:4px 8px; font-size:12px; border:1px solid var(--border);
    border-radius:var(--radius); background:var(--bg); color:var(--text);
}
.social-follow-btn { flex-shrink:0; margin-left:auto; }

/* ── Calls ────────────────────────────────────────────────────────── */
.calls-list { flex:1; overflow-y:auto; padding:12px 16px; }
.call-card {
    display:flex; align-items:center; gap:14px; padding:14px 16px;
    background:var(--bg-pane); border:1px solid var(--border);
    border-radius:var(--radius); margin-bottom:8px; cursor:pointer; transition:background 0.1s;
}
.call-card:hover { background:var(--bg-hover); }
.call-card-name { font-weight:600; font-size:14px; }
.call-card-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }
.call-card-join { margin-left:auto; }
.call-members-grid {
    flex:1; overflow-y:auto; padding:16px;
    display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:12px;
    align-content:start;
}
.call-member-card {
    display:flex; flex-direction:column; align-items:center; gap:6px;
    padding:12px 10px; background:var(--bg-pane); border:1px solid var(--border);
    border-radius:var(--radius); text-align:center; min-width:160px; position:relative;
}
.call-member-video-wrap {
    width:100%; max-width:240px; aspect-ratio:4/3; background:#111;
    border-radius:6px; overflow:hidden; display:none; position:relative;
}
.call-member-video-wrap.active { display:block; }
.call-member-video {
    width:100%; height:100%; object-fit:cover; display:block;
}
.call-member-name { font-size:13px; font-weight:500; }
.call-member-status { font-size:11px; color:var(--text-muted); }
.call-member-icons { display:flex; gap:6px; font-size:14px; }
.call-member-icons .on { color:var(--success); }
.call-member-icons .off { color:var(--text-dim); }
.call-controls {
    display:flex; gap:8px; padding:10px 16px; justify-content:center;
    align-items:center; flex-wrap:wrap;
    border-top:1px solid var(--border); flex-shrink:0;
}
.call-ctrl-group {
    display:flex; gap:6px; align-items:center; flex-wrap:wrap;
}
.call-ctrl-label {
    display:flex; align-items:center; gap:4px; font-size:11px;
    color:var(--text-muted); white-space:nowrap;
}
.call-ctrl-label input[type="range"] { width:60px; }
.call-ctrl-check {
    display:flex; align-items:center; gap:3px; font-size:11px;
    color:var(--text-muted); cursor:pointer; white-space:nowrap;
}
.call-ctrl-check input { width:13px; height:13px; cursor:pointer; }
.call-ptt-on { background:var(--success); color:#fff; }
.call-ptt-on:hover { background:#36a052; }
.call-ptt-held { background:#e8b800; color:#111; animation:ptt-pulse 0.6s infinite alternate; }
@keyframes ptt-pulse { from { opacity:0.85; } to { opacity:1; } }
.call-deafened { background:var(--danger); color:#fff; }
.call-member-card { cursor:pointer; transition:all 0.2s; }
.call-member-card.blocked { opacity:0.5; border-color:var(--danger); }
.call-members-grid.has-focus .call-member-card { display:none; }
.call-members-grid.has-focus .call-member-card.focused {
    display:flex; grid-column:1/-1; min-width:100%; max-width:100%;
}
.call-members-grid.has-focus .call-member-card.focused .call-member-video-wrap {
    max-width:100%; aspect-ratio:16/9;
}
.call-member-card.focused { border-color:var(--accent); }
.call-member-video:fullscreen,
.call-local-preview:fullscreen,
.call-member-video-wrap:fullscreen {
    width:100vw; height:100vh; object-fit:contain; background:#000;
}
.call-member-popup {
    position:fixed; z-index:1000; background:var(--bg-pane); border:1px solid var(--border);
    border-radius:8px; padding:12px 14px; width:220px; box-shadow:0 4px 16px rgba(0,0,0,0.3);
}
.call-popup-header {
    display:flex; align-items:center; justify-content:space-between; margin-bottom:10px;
    font-weight:600; font-size:13px;
}
.call-popup-x {
    background:none; color:var(--text-muted); font-size:18px; padding:0 4px;
    cursor:pointer; border:none;
}
.call-popup-x:hover { color:var(--danger); }
.call-popup-btns { display:flex; gap:6px; margin-top:8px; }
.call-popup-btns .sm-btn { flex:1; text-align:center; font-size:11px; }
.call-popup-btns .sm-btn.active-block { background:var(--danger); color:#fff; }

/* ── Games ────────────────────────────────────────────────────────── */
.games-list { flex:1; overflow-y:auto; padding:12px 16px; }
.game-card {
    display:flex; align-items:center; gap:14px; padding:14px 16px;
    background:var(--bg-pane); border:1px solid var(--border);
    border-radius:var(--radius); margin-bottom:8px; cursor:pointer; transition:background 0.1s;
}
.game-card:hover { background:var(--bg-hover); }
.game-card-type {
    font-size:10px; text-transform:uppercase; letter-spacing:0.5px;
    padding:2px 8px; border-radius:8px; background:var(--bg-active); color:var(--text);
}
.game-card-name { font-weight:600; font-size:14px; }
.game-card-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }
.game-card-info { flex:1; }
.game-card-join { margin-left:auto; }
.game-move-history {
    flex-shrink:0; padding:4px 14px; font-size:11px; color:var(--text-muted);
    border-bottom:1px solid var(--border); max-height:36px; overflow-x:auto;
    overflow-y:hidden; white-space:nowrap; font-family:var(--font-mono);
}
.game-room-layout { flex:1; display:flex; overflow:hidden; }
.game-board-area { flex:1; display:flex; align-items:center; justify-content:center; overflow:auto; min-width:0; }
.game-sidebar {
    width:220px; min-width:220px; border-left:1px solid var(--border);
    background:var(--bg-sidebar); display:flex; flex-direction:column; overflow:hidden;
}
.game-sidebar h3 {
    padding:10px 14px 6px; font-size:11px; text-transform:uppercase;
    letter-spacing:1px; color:var(--text-muted); flex-shrink:0;
}

/* ── Pinboard ────────────────────────────────────────────────────── */
.pinboard-main-area { display:flex; flex:1; min-height:0; overflow:hidden; }
.pinboard-board-area { flex:1; overflow:auto; min-width:0; }
.pinboard-canvas {
    width:1200px; height:900px; position:relative; background:#d2b48c;
    background-image:repeating-linear-gradient(45deg,transparent,transparent 35px,rgba(0,0,0,0.02) 35px,rgba(0,0,0,0.02) 70px);
}
.pinboard-canvas.placement-mode { cursor:crosshair; }
.pinboard-editor {
    width:280px; min-width:240px; border-left:1px solid var(--border);
    padding:10px; overflow-y:auto; flex-shrink:0;
    display:flex; flex-direction:column; gap:5px; font-size:12px;
}
.pinboard-editor h3 { margin:0 0 2px; font-size:14px; }
.pinboard-editor label { font-size:11px; font-weight:600; margin-bottom:1px; }
.pinboard-editor input[type="text"],.pinboard-editor input[type="number"],.pinboard-editor textarea {
    width:100%; box-sizing:border-box; padding:4px 6px; font-size:12px;
    border:1px solid var(--border); border-radius:4px; background:var(--bg-input,#1e1e2e); color:var(--text);
}
.pinboard-editor textarea { resize:vertical; min-height:50px; }
.pin-editor-preview {
    border:1px dashed var(--border); border-radius:6px; min-height:50px;
    padding:4px; display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.pin-item {
    position:absolute; cursor:pointer; transition:box-shadow 0.15s;
    border-radius:6px; overflow:hidden; transform-origin:center center;
}
.pin-item:hover { box-shadow:0 4px 16px rgba(0,0,0,0.4); z-index:10; }
.pin-item img { display:block; max-width:100%; }
.pin-info { opacity:0; transition:opacity 0.2s; pointer-events:none; }
.pin-item:hover .pin-info { opacity:1; }
.pin-info {
    display:flex; justify-content:space-between; align-items:center;
    padding:3px 6px; font-size:11px; background:rgba(0,0,0,0.55); color:#fff;
}
.pin-link-indicator {
    position:absolute; bottom:2px; right:2px; font-size:10px;
    background:rgba(0,0,0,0.5); color:#fff; border-radius:3px; padding:1px 4px;
}
.pin-delete {
    position:absolute; top:2px; right:2px; width:18px; height:18px;
    background:rgba(200,40,40,0.8); color:#fff; border-radius:50%;
    font-size:13px; line-height:18px; text-align:center; cursor:pointer; display:none;
}
.pin-item:hover .pin-delete { display:block; }
.pin-ghost { position:absolute; pointer-events:none; opacity:0.5; z-index:1000; }
.pin-ctx-menu {
    position:fixed; z-index:9999; background:var(--bg-pane,#1e1e2e);
    border:1px solid var(--border); border-radius:6px;
    box-shadow:0 4px 16px rgba(0,0,0,0.3); padding:4px 0; min-width:140px;
}
.pin-ctx-item { padding:5px 14px; cursor:pointer; font-size:12px; color:var(--text); }
.pin-ctx-item:hover { background:var(--accent); color:#fff; }
.pin-ctx-item.danger { color:var(--danger,#e53935); }
.pin-ctx-sep { height:1px; background:var(--border); margin:3px 0; }

/* ── File Sharing ────────────────────────────────────────────────── */
.files-shares { flex:1; overflow-y:auto; padding:12px 16px; }
.file-share-card {
    display:flex; align-items:center; gap:14px; padding:14px 16px;
    background:var(--bg-pane); border:1px solid var(--border);
    border-radius:var(--radius); margin-bottom:8px; cursor:pointer; transition:background 0.1s;
}
.file-share-card:hover { background:var(--bg-hover); }
.file-share-name { font-weight:600; font-size:14px; }
.file-share-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }
.files-breadcrumb {
    display:flex; gap:4px; padding:10px 16px; font-size:12px;
    border-bottom:1px solid var(--border); flex-shrink:0; flex-wrap:wrap;
}
.files-breadcrumb span { cursor:pointer; color:var(--accent); }
.files-breadcrumb span:hover { text-decoration:underline; }
.files-breadcrumb .sep { color:var(--text-dim); cursor:default; }
.files-listing { flex:1; overflow-y:auto; }
.file-row {
    display:flex; align-items:center; gap:12px; padding:8px 16px;
    border-bottom:1px solid var(--border); cursor:pointer; font-size:13px;
}
.file-row:hover { background:var(--bg-hover); }
.file-icon { font-size:16px; flex-shrink:0; width:24px; text-align:center; }
.file-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-size { font-size:11px; color:var(--text-muted); flex-shrink:0; }
.file-dl { color:var(--accent); font-size:12px; padding:2px 8px; cursor:pointer; flex-shrink:0; }
.file-dl:hover { text-decoration:underline; }

.file-item {
    display:flex; align-items:center; gap:8px; padding:6px 10px;
    border-bottom:1px solid var(--border); cursor:pointer; font-size:12px;
}
.file-item:hover { background:var(--bg-hover); }
.files-sub-tab.active { border-bottom-color:var(--accent) !important; color:var(--accent); }
.badge { font-size:9px; padding:1px 5px; border-radius:8px; background:var(--accent); color:#fff; }

/* ── Jump to Present ──────────────────────────────────────────────── */
.jump-to-present {
    position:absolute; bottom:8px; right:12px; z-index:100;
    background:var(--accent); color:#fff; border:none; border-radius:16px;
    padding:5px 14px; font-size:11px; font-weight:700; cursor:pointer;
    opacity:0.9; transition:opacity 0.15s; box-shadow:0 2px 8px rgba(0,0,0,0.3);
}
.jump-to-present:hover { opacity:1; }

/* ── Poll Cards ──────────────────────────────────────────────────── */
.poll-card { background:var(--bg-pane); border:1px solid var(--border); border-radius:8px; padding:10px 12px; margin:6px 0; }
.poll-card-header { font-weight:700; font-size:13px; margin-bottom:4px; }
.poll-card-creator { font-size:10px; color:var(--text-muted); margin-bottom:6px; }
.poll-option-row { display:flex; align-items:center; gap:6px; margin:3px 0; cursor:pointer; }
.poll-option-row:hover { background:var(--bg-hover); border-radius:4px; }
.poll-bar-track { flex:1; height:18px; background:var(--bg-input,#252540); border-radius:3px; overflow:hidden; position:relative; }
.poll-bar-fill { height:100%; background:var(--accent); border-radius:3px; transition:width 0.3s; }
.poll-bar-label { position:absolute; left:6px; top:1px; font-size:11px; color:#fff; mix-blend-mode:difference; }
.poll-count { font-size:11px; color:var(--text-muted); min-width:40px; text-align:right; }
.poll-footer { font-size:10px; color:var(--text-muted); margin-top:6px; display:flex; justify-content:space-between; }

/* ── Video Card ──────────────────────────────────────────────────── */
.video-card { display:flex; gap:8px; padding:8px; border:1px solid var(--border); border-radius:8px; background:var(--bg-pane); margin:4px 0; align-items:center; }
.video-card .video-icon { font-size:28px; }
.video-card .video-info { flex:1; }
.video-card .video-info b { font-size:13px; }
.video-card .video-meta { font-size:10px; color:var(--text-muted); }
.video-card .video-play { color:var(--accent); cursor:pointer; font-weight:bold; text-decoration:none; }
.video-card .video-play:hover { text-decoration:underline; }

/* ── Drop Zone ───────────────────────────────────────────────────── */
.drop-zone-overlay {
    position:absolute; inset:0; z-index:50; background:rgba(66,165,245,0.15);
    border:3px dashed var(--accent); border-radius:8px;
    display:flex; align-items:center; justify-content:center;
    font-size:16px; font-weight:bold; color:var(--accent); pointer-events:none;
}

/* ── Governance ──────────────────────────────────────────────────── */
.gov-vote-card { background:var(--bg-pane); border:1px solid var(--border); border-radius:6px; padding:8px; margin:4px 0; font-size:11px; }
.gov-vote-card h4 { margin:0 0 4px; font-size:12px; }
.gov-vote-btns { display:flex; gap:6px; margin-top:6px; }
.gov-vote-btns button { flex:1; padding:4px; font-size:11px; border-radius:4px; cursor:pointer; border:1px solid var(--border); }
.gov-vote-btns .vote-yes { background:#66bb6a; color:#fff; border-color:#66bb6a; }
.gov-vote-btns .vote-no { background:#ef5350; color:#fff; border-color:#ef5350; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .social-right-pane, .social-blog-right, .forums-right-pane, .game-sidebar { display:none; }
    .room-right-pane { display:none; }
}
@media (max-width: 600px) {
    /* ── Layout ── */
    .sidebar { position:absolute; z-index:10; height:calc(100% - 42px - 38px); }
    .sidebar:not(.open) { margin-left:-220px; }

    /* ── Tab bar: scrollable, larger touch targets ── */
    #top-tabs { overflow-x:auto; -webkit-overflow-scrolling:touch; }
    .top-tab { padding:10px 14px; font-size:12px; flex-shrink:0; min-height:44px; }

    /* ── Headers ── */
    .panel-header { flex-wrap:wrap; gap:6px; padding:8px 12px; }
    .panel-header h2 { font-size:14px; }
    .panel-header div { width:100%; }
    .pane-header { padding:6px 10px; }

    /* ── Buttons: 44px min touch target ── */
    .sm-btn { min-height:36px; padding:8px 14px; font-size:13px; }

    /* ── Inputs: 16px font prevents iOS zoom ── */
    input, textarea, select { font-size:16px; }
    .send-form { padding:6px 10px; }
    .send-form input { font-size:16px; min-height:40px; }
    .send-form button { min-height:40px; padding:8px 16px; }

    /* ── Messages ── */
    .messages { padding:8px 10px; font-size:13px; }

    /* ── Forums ── */
    .forum-grid { grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:10px; padding:10px 12px; }
    .forum-grid-card { padding:12px 8px 10px; }
    .forum-icon, .forum-icon-default { width:52px; height:52px; font-size:20px; }
    .forum-post-card { flex-direction:column; }
    .forum-post-left {
        width:100%; min-width:100%; flex-direction:row; padding:8px 12px;
        border-right:none; border-bottom:1px solid var(--border); gap:10px;
    }

    /* ── Calls: stack controls, larger touch targets ── */
    .call-members-grid { grid-template-columns:1fr 1fr; padding:8px; gap:8px; }
    .call-member-card { min-width:0; padding:8px 6px; }
    .call-member-video-wrap { max-width:100%; }
    .call-controls { gap:6px; padding:8px 10px; flex-wrap:wrap; justify-content:center; }
    .call-controls .sm-btn { min-height:40px; font-size:13px; }
    .call-ctrl-group { width:100%; justify-content:center; }
    .call-ctrl-label { font-size:12px; }
    .call-ctrl-label input[type="range"] { width:80px; height:24px; }
    .call-ctrl-check { font-size:12px; }
    .call-ptt-on, .call-ptt-held { min-width:60px; font-size:14px; font-weight:700; }
    .call-member-popup { width:calc(100vw - 32px); left:16px !important; }
    /* Hide screen share on mobile (not supported) */
    #call-screen-btn { display:none; }

    /* ── Games ── */
    .game-room-layout { flex-direction:column; }
    .game-board-area { min-height:200px; overflow:auto; -webkit-overflow-scrolling:touch; }
    .game-sidebar { display:flex !important; max-height:180px; min-width:100%; border-left:none; border-top:1px solid var(--border); }

    /* ── Buddy list ── */
    .buddy-item { padding:8px 10px; min-height:40px; }
    .buddy-add-bar input { width:140px; }

    /* ── Email ── */
    .email-row { padding:10px 12px; font-size:13px; min-height:44px; }
    .email-from { width:80px; }

    /* ── Files ── */
    .files-breadcrumb { padding:8px 12px; }
    .file-row { padding:10px 12px; min-height:44px; }

    /* ── Settings ── */
    .settings-form { padding:12px; }

    /* ── Misc ── */
    .link-confirm-box { margin:16px; padding:20px; }
    .pinboard-canvas { touch-action:pan-x pan-y; }

    /* ── Login card: full width on mobile ── */
    .login-card { width:calc(100vw - 32px); max-width:340px; padding:28px 20px; }

    /* ── Safe areas for notched phones ── */
    #topbar { padding-left:max(16px, env(safe-area-inset-left)); padding-right:max(16px, env(safe-area-inset-right)); }
    .send-form { padding-bottom:max(6px, env(safe-area-inset-bottom)); }
    .call-controls { padding-bottom:max(8px, env(safe-area-inset-bottom)); }

    /* ── Sidebar panes: compact on mobile ── */
    .sidebar-pane-body { max-height:150px; }
    .sidebar-pane-header { padding:8px 10px; min-height:40px; }
    .pane-drag { display:none; }
    .sidebar-resize-handle { display:none; }

    /* ── Sidebar backdrop: dim content when sidebar is open ── */
    .sidebar.open ~ .sidebar-backdrop { display:block; }

    /* ── Streams: stack columns vertically ── */
    #streams-columns { flex-direction:column !important; gap:8px !important; overflow-y:auto !important; }
    .stream-col { min-height:120px; }
    #stream-room-body { flex-direction:column !important; }
    #stream-chat-sidebar { width:100% !important; max-width:100% !important; min-width:0 !important; max-height:250px; border-left:none !important; border-top:1px solid var(--border); }
    #stream-stage { min-height:200px; }
    #stream-webcam-row { max-height:100px !important; min-height:60px !important; }
    #stream-controls { flex-wrap:wrap; justify-content:center; }

    /* ── PM profile pane: below chat on mobile ── */
    #pm-profile-pane { display:none !important; }
    #pm-profile-resize { display:none !important; }

    /* ── Buddy sidebar: hidden on mobile (already at 700px) ── */
    #buddy-sidebar-resize { display:none; }

    /* ── Room right pane: hidden on mobile ── */
    #resize-right { display:none; }

    /* ── Create stream modal: full-width ── */
    .modal-dialog { width:calc(100vw - 32px) !important; max-width:100% !important; }

    /* ── Prevent body scroll when focused on input (iOS keyboard) ── */
    body { overscroll-behavior:none; }
}

/* ── Touch-friendly PTT hold button on mobile ── */
@media (pointer: coarse) {
    .call-ptt-on, .call-ptt-held {
        min-width:70px; min-height:44px; font-size:15px; font-weight:700;
        border-radius:8px; touch-action:none;
    }
    .call-ptt-held { transform:scale(1.05); }
    /* Larger sliders for finger control */
    input[type="range"] { height:28px; }
    /* Larger checkboxes */
    .call-ctrl-check input { width:18px; height:18px; }
    /* Better tap targets for item lists */
    .item-list li { min-height:40px; padding:8px 10px; }
}

/* ── Keyword Desktop Favorites ─────────────────────────────────── */
.kw-fav {
    position:absolute;
    display:flex;flex-direction:column;align-items:center;justify-content:flex-start;
    cursor:grab;user-select:none;border-radius:6px;overflow:hidden;
    transition:box-shadow 0.15s;
}
.kw-fav:hover { box-shadow:0 0 12px rgba(100,180,255,0.25); }
.kw-fav-icon {
    display:flex;align-items:center;justify-content:center;
    border-radius:4px;overflow:hidden;pointer-events:none;
}
.kw-fav-icon img { width:100%;height:100%;object-fit:cover;pointer-events:none; }
.kw-fav-label {
    font-size:9px;color:#ccc;text-align:center;overflow:hidden;text-overflow:ellipsis;
    white-space:nowrap;width:100%;padding:0 2px;pointer-events:none;margin-top:2px;
}
.kw-fav.selected { outline:2px solid #42a5f5;outline-offset:1px; }
.kw-fav-ctx {
    position:fixed;background:#1e1e2e;border:1px solid #333;border-radius:6px;
    padding:4px 0;min-width:120px;z-index:10000;box-shadow:0 4px 16px rgba(0,0,0,0.5);
}
.kw-fav-ctx div {
    padding:5px 14px;font-size:12px;color:#ccc;cursor:pointer;
}
.kw-fav-ctx div:hover { background:#2a2a3e;color:#fff; }

/* ── Streams ─────────────────────────────────────────────────────── */
.stream-card-list { flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.stream-card {
    display:flex; gap:10px; align-items:center; padding:8px 10px;
    border:1px solid var(--border); border-radius:8px;
    cursor:pointer; transition:background 0.15s;
}
.stream-card:hover { background:var(--bg-hover); }
.stream-card-icon {
    width:42px; height:42px; border-radius:6px; object-fit:cover; flex-shrink:0;
    display:flex; align-items:center; justify-content:center; font-size:20px;
    background:linear-gradient(135deg,#1a237e,#4a148c); color:#fff;
}
.stream-card-icon img { width:100%; height:100%; border-radius:6px; object-fit:cover; }
.stream-card-info { flex:1; min-width:0; }
.stream-card-name { font-weight:600; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stream-card-meta { font-size:11px; color:var(--text-muted); }
.stream-card-badge { font-size:10px; padding:1px 6px; border-radius:4px; }
.stream-card-badge.private { background:rgba(244,67,54,0.15); color:#ef5350; }
.stream-chat-msg { padding:2px 0; word-wrap:break-word; }
.stream-chat-msg .msg-user { color:var(--accent); font-weight:600; margin-right:4px; }
.stream-chat-msg .msg-time { color:var(--text-dim); font-size:10px; margin-right:4px; }
.stream-chat-msg.system { color:var(--text-muted); font-style:italic; font-size:11px; }
.stream-member-icons { margin-left:auto; font-size:11px; opacity:0.7; }
.stream-tile {
    background:#000; border-radius:4px; overflow:hidden; position:relative;
    display:flex; align-items:center; justify-content:center; min-width:120px;
}
.stream-tile img, .stream-tile video { max-width:100%; max-height:100%; object-fit:contain; }
.stream-tile-label {
    position:absolute; bottom:2px; left:4px; font-size:10px; color:#fff;
    background:rgba(0,0,0,0.6); padding:1px 5px; border-radius:3px;
}
/* Modal overlay for create dialog */
.modal-overlay {
    position:absolute; inset:0; background:rgba(0,0,0,0.5); display:flex;
    align-items:center; justify-content:center; z-index:50;
}
.modal-dialog {
    background:var(--bg-pane); border:1px solid var(--border); border-radius:10px;
    padding:16px 20px; max-width:90%;
}
