﻿:root {
  color-scheme: dark;
  --bg: #313338;
  --panel: #2b2d31;
  --rail: #1e1f22;
  --hover: #35373c;
  --selected: #404249;
  --surface: #232428;
  --surface-deep: #111214;
  --raised: #383a40;
  --row-hover: #2e3035;
  --button: #4e5058;
  --button-hover: #6d6f78;
  --control-hover: #45474f;
  --text: #f2f3f5;
  --body-text: #dbdee1;
  --muted: #b5bac1;
  --subtle: #969da6;
  --accent-dark: #10ceb5;
  --accent-dark-ink: #073b33;
  --accent-light: #006d5c;
  --accent: var(--accent-dark);
  --accent-ink: var(--accent-dark-ink);
  --accent-hover-mix: #fff;
  --accent-hover: color-mix(in srgb, var(--accent) 85%, var(--accent-hover-mix));
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-faint: color-mix(in srgb, var(--accent) 6%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 35%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 22%, transparent);
  --selection: color-mix(in srgb, var(--accent) 30%, var(--bg));
  --avatar-bg: color-mix(in srgb, var(--accent) 24%, var(--panel));
  --avatar-ink: var(--text);
  --green: #43b581;
  --line: #ffffff10;
  --border: #ffffff26;
  --scrollbar: #1a1b1e;
  --danger: #f23f42;
  --danger-fill: #da373c;
  --danger-hover: #a1282c;
  --danger-ink: #fff;
  --danger-text: #ff9a9b;
  --danger-soft: #f23f4219;
  --danger-border: #f23f4255;
  --overlay: #000b;
  --shadow: #0008;
  --drawer-shadow: #0004;
  --header-shadow: #1e1f2280;
  --header-shadow-soft: #00000010;
  --media-bg: #111214;
  --message-font-size: 16px;
  --message-name-size: 15px;
  --content-font-size: 14px;
  --message-avatar-size: 40px;
  --message-row-padding: 8px;
  --message-row-gap: 16px;
  --font-display: "Unbounded", "Manrope", "Segoe UI", sans-serif;
  font-family: "Manrope", "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fff;
  --panel: #f0f2f5;
  --rail: #e3e8ef;
  --surface: #e9edf3;
  --surface-deep: #e3e8ef;
  --raised: #edf1f6;
  --hover: #e3e8ef;
  --row-hover: #f0f3f7;
  --selected: #d5deea;
  --button: #e0e6ef;
  --button-hover: #cad4e2;
  --control-hover: #dce4ef;
  --text: #17212f;
  --body-text: #263448;
  --muted: #465366;
  --subtle: #526174;
  --accent: var(--accent-light);
  --accent-ink: #fff;
  --accent-hover-mix: #000;
  --green: #187347;
  --line: #17212f1c;
  --border: #17212f33;
  --scrollbar: #aab5c4;
  --danger-text: #a32135;
  --danger-soft: #bd273a0d;
  --danger-border: #bd273a55;
  --overlay: #11182780;
  --shadow: #17212f33;
  --drawer-shadow: #17212f33;
  --header-shadow: #17212f1c;
  --header-shadow-soft: #17212f08;
}
:root[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #111827;
  --panel: #0c1320;
  --rail: #070d17;
  --surface: #0a111d;
  --surface-deep: #060b13;
  --raised: #1b273b;
  --hover: #1b273b;
  --row-hover: #172134;
  --selected: #293951;
  --button: #2c3c53;
  --button-hover: #3b506e;
  --control-hover: #344862;
  --text: #f1f5fc;
  --body-text: #dce5f3;
  --muted: #b4c3d8;
  --subtle: #9aaec9;
  --line: #bdd6ff14;
  --border: #bdd6ff2e;
  --scrollbar: #30435f;
  --header-shadow: #0008;
}
:root[data-accent="turquoise"] { --accent-dark: #10ceb5; --accent-dark-ink: #073b33; --accent-light: #006d5c; }
:root[data-accent="blue"] { --accent-dark: #80b3ff; --accent-dark-ink: #071b37; --accent-light: #285bc4; }
:root[data-accent="violet"] { --accent-dark: #bea3ff; --accent-dark-ink: #251248; --accent-light: #7141c6; }
:root[data-accent="rose"] { --accent-dark: #ff9ebb; --accent-dark-ink: #3a1224; --accent-light: #a82c5b; }
:root[data-accent="amber"] { --accent-dark: #f2c66b; --accent-dark-ink: #322100; --accent-light: #7d5100; }
:root[data-text-size="small"] { --message-font-size: 14px; --message-name-size: 14px; --content-font-size: 13px; }
:root[data-text-size="normal"] { --message-font-size: 16px; --message-name-size: 15px; --content-font-size: 14px; }
:root[data-text-size="large"] { --message-font-size: 18px; --message-name-size: 16px; --content-font-size: 16px; }
:root[data-density="compact"] { --message-avatar-size: 28px; --message-row-padding: 4px; --message-row-gap: 10px; }
:root[data-density="comfortable"] { --message-avatar-size: 40px; --message-row-padding: 8px; --message-row-gap: 16px; }
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
html, body { width: 100%; height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; border: 0; cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, a { touch-action: manipulation; }
a { color: var(--accent); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
::selection { background: var(--selection); color: var(--text); }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* Server rail and channels. */
.app { display: grid; grid-template-columns: 72px 240px minmax(0, 1fr) 240px; height: 100dvh; min-height: 0; width: 100%; overflow: hidden; }
.app.members-hidden { grid-template-columns: 72px 240px minmax(0, 1fr); }
.app.members-hidden .members { display: none; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0; background: var(--rail); overflow-y: auto; overflow-x: hidden; }
.server-list { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; flex-shrink: 0; }
.server-list:empty { display: none; }
.server-list .server { padding: 0; font-size: 15px; line-height: 1; }
.brand { position: relative; display: block; flex-shrink: 0; width: 48px; height: 48px; border-radius: 16px; padding: 0; background: transparent; }
.brand img { display: block; width: 100%; height: 100%; border-radius: inherit; }
.brand::before, .server.selected::before { content: ""; position: absolute; width: 4px; height: 36px; background: var(--text); border-radius: 0 4px 4px 0; left: -12px; top: 6px; }
.brand::before { height: 8px; top: 20px; }
.brand.selected::before, .app[data-view="friends"] .brand::before { height: 36px; top: 6px; }
.rail-line { width: 32px; height: 2px; flex-shrink: 0; background: var(--border); border-radius: 2px; }
.server, .rail-invite { position: relative; display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; background: var(--bg); color: var(--text); font-size: 17px; font-weight: 600; }
.server.selected, .server:hover { background: var(--accent); color: var(--accent-ink); border-radius: 16px; }
.rail-invite { color: var(--accent); }
.rail-invite:hover { background: var(--accent); color: var(--accent-ink); border-radius: 16px; }
.sidebar { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); }
.community { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; align-content: center; flex-shrink: 0; height: 48px; padding: 0 12px 0 16px; gap: 1px 8px; box-shadow: 0 1px 0 var(--header-shadow), 0 2px 0 var(--header-shadow-soft); z-index: 1; }
.community strong { font-size: 16px; font-weight: 650; }
.community-caption { color: var(--subtle); font-size: 10px; }
#community-name { grid-column: 1; grid-row: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; font-size: 14px; }
#community-caption { grid-column: 1; grid-row: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
#open-server-settings { grid-column: 2; grid-row: 1 / 3; width: 32px; height: 32px; background: transparent; }
#open-server-settings:not(:disabled):hover { background: var(--selected); color: var(--text); }
#open-server-settings svg { width: 18px; height: 18px; }
.sidebar-actions { padding: 12px 8px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.invite-small, .create-room-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; border-radius: 4px; padding: 8px 10px; background: transparent; color: var(--muted); text-align: left; font-weight: 500; font-size: 14px; }
.invite-small svg, .create-room-button svg { width: 20px; height: 20px; }
.invite-small:hover, .create-room-button:hover { background: var(--hover); color: var(--text); }
.invite-small.active, .invite-small[aria-pressed="true"] { background: var(--selected); color: var(--text); }
.create-room-button { color: var(--accent); }
.create-room-button:hover { background: var(--accent-soft); color: var(--accent); }
.channel-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.dm-sidebar { padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.dm-sidebar .channels-title { align-items: center; text-transform: uppercase; }
.dm-sidebar-empty { margin: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dm-conversation { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 52px; padding: 7px 8px; border-radius: 5px; text-align: left; color: var(--muted); background: transparent; }
.dm-conversation:hover { color: var(--text); background: var(--hover); }
.dm-conversation.active { color: var(--text); background: var(--selected); }
.dm-conversation .avatar { flex-shrink: 0; width: 32px; height: 32px; font-size: 11px; }
.dm-conversation-info { flex: 1; min-width: 0; }
.dm-conversation-info strong, .dm-conversation-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-conversation-info strong { font-size: 13px; font-weight: 700; }
.dm-conversation-info small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.unread-badge { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 19px; min-height: 19px; padding: 1px 5px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; line-height: 1.3; }
.dm-call-event { color: var(--accent); font-weight: 700; }
#open-friends .unread-badge { margin-left: auto; }
.dm-view { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.dm-heading { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dm-heading > div { min-width: 0; }
.dm-heading .dm-contact { flex: 1; }
.dm-call-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dm-call-actions .icon-button { width: 38px; height: 38px; background: var(--row-hover); color: var(--body-text); }
.dm-call-actions .icon-button:not(:disabled):hover { background: var(--selected); color: var(--accent); }
.dm-call-actions .icon-button svg { width: 20px; height: 20px; }
.dm-heading strong, .dm-heading small { display: block; overflow-wrap: anywhere; }
.dm-heading strong { color: var(--text); font-size: 18px; }
.dm-heading small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.dm-heading .chat-badge { flex-shrink: 0; }
.dm-history-actions { display: flex; justify-content: center; flex-shrink: 0; gap: 12px; background: var(--panel); }
.dm-history-actions .text-button { margin: 0; padding: 8px 12px; font-size: 12px; }
.dm-notice, #dm-error { margin: 8px 20px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.dm-notice { color: var(--muted); }
.dm-view .chat-empty .avatar { margin-bottom: 16px; }
.server-invites-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px; }
.server-invite-row, .invite-friend-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.server-invite-row > .avatar, .invite-friend-row > .avatar { flex-shrink: 0; }
.server-invite-info { flex: 1; min-width: 100px; overflow-wrap: anywhere; }
.server-invite-info strong, .server-invite-info small, .server-invite-info > span { display: block; }
.server-invite-info strong { color: var(--text); font-size: 15px; }
.server-invite-info small, .server-invite-info > span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.server-invite-row .friend-actions { margin-left: auto; }
#invite-dialog { width: min(560px, calc(100vw - 32px)); }
#invite-server-name { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.invite-friends-list { margin: 10px 0 18px; }
.invite-friend-row > button { flex-shrink: 0; max-width: 100%; }
#invite-link-details { padding: 12px 0; border-top: 1px solid var(--line); }
#invite-link-details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
#invite-link-details summary:hover { color: var(--text); }
#invite-link-details input { margin-top: 12px; }
@media (max-width: 760px) {
  .dm-heading { padding: 12px 16px; }
  .dm-heading strong { font-size: 16px; }
  .dm-heading .chat-badge { display: none; }
  .dm-call-actions { gap: 4px; }
  .dm-call-actions .icon-button { width: 36px; height: 36px; }
  .server-invites-list { padding: 10px 16px; }
  .server-invite-row .friend-actions { flex-basis: 100%; margin-left: 0; }
  .server-invite-row .friend-actions button { flex: 1; }
  .invite-friend-row { gap: 10px; }
  .invite-friend-row > button { font-size: 12px; }
  .dm-notice, #dm-error { margin: 8px 16px; }
}
.channels-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 8px 6px; color: var(--subtle); font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.channels-title span { font-size: 11px; font-weight: 500; }
.channels { display: flex; flex-direction: column; gap: 2px; }
.channels:empty::after { content: "—"; display: block; margin: 2px 10px 8px; color: var(--subtle); }
.channel { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 8px; border-radius: 4px; background: transparent; color: var(--subtle); text-align: left; font-size: 15px; }
.channel-row { display: flex; align-items: center; min-width: 0; border-radius: 4px; }
.channel-row:hover, .channel-row:focus-within { background: var(--hover); }
.channel-row > .channel { flex: 1; min-width: 0; width: auto; }
.channel[data-room] { padding-left: 12px; }
.channel[data-room].in-call { color: var(--accent); }
.channel-delete, .channel-settings { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; margin-right: 4px; padding: 2px; border-radius: 4px; background: transparent; color: var(--subtle); opacity: 0; pointer-events: none; }
.channel-delete svg, .channel-settings svg { width: 20px; height: 20px; }
.channel-row:hover .channel-delete, .channel-row:focus-within .channel-delete,
.channel-row:hover .channel-settings, .channel-row:focus-within .channel-settings { opacity: 1; pointer-events: auto; }
.channel-delete:not(:disabled):hover, .channel-delete:focus-visible { background: var(--danger-soft); color: var(--danger-text); }
.channel-settings:not(:disabled):hover, .channel-settings:focus-visible { background: var(--selected); color: var(--text); }
.server-empty { display: grid; gap: 12px; padding: 18px 8px; color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.server-empty p { margin: 0; }
.server-empty strong { color: var(--text); }
.server-empty .primary { width: 100%; font-size: 13px; }
.channel:hover { background: var(--hover); color: var(--body-text); }
.channel.active { background: var(--selected); color: var(--text); }
.channel svg { color: var(--subtle); width: 21px; height: 21px; }
.channel.active svg { color: var(--body-text); }
.channel.in-call svg { color: var(--accent); }
.channel-name, .channel > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel small { margin-left: auto; flex-shrink: 0; font-size: 11px; color: var(--subtle); }
.channel.active small { color: var(--muted); }
.channel b { width: 21px; flex-shrink: 0; color: var(--subtle); text-align: center; font-size: 24px; line-height: 1; font-weight: 400; }
.sidebar-bottom { margin-top: auto; flex-shrink: 0; background: var(--surface); }
.connection { display: flex; align-items: center; gap: 7px; padding: 10px 12px 6px; color: var(--green); font-size: 12px; min-width: 0; }
#connection-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--green); }
#call-dock { padding: 4px 8px 10px; border-bottom: 1px solid var(--line); }
#voice-return { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; background: transparent; color: var(--accent); padding: 5px 4px; font-size: 13px; }
#voice-return:hover { text-decoration: underline; }
#voice-return svg { width: 16px; height: 16px; }
#call-room-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#call-dock .voice-controls { gap: 6px; justify-content: stretch; }
#call-dock .icon-button { flex: 1; height: 34px; background: var(--row-hover); }
#call-dock .icon-button:hover { background: var(--selected); }
.call-volume { display: grid; grid-template-columns: 26px minmax(70px, 1fr) 26px 40px; align-items: center; gap: 5px; }
#call-dock .call-volume { margin: 2px 0 9px; }
.call-volume button { width: 26px; height: 26px; padding: 0; border-radius: 4px; background: var(--row-hover); color: var(--text); font-size: 18px; line-height: 1; }
.call-volume button:not(:disabled):hover { background: var(--selected); }
.call-volume input { width: 100%; min-width: 0; accent-color: var(--accent); }
.call-volume output { color: var(--subtle); font-size: 11px; text-align: right; }
.profile { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; min-height: 58px; background: transparent; text-align: left; }
.profile:hover { background: var(--panel); }
.profile > span:nth-child(2) { min-width: 0; }
.profile strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 650; max-width: 146px; }
.profile small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }
.profile-edit { margin-left: auto; color: var(--muted); width: 19px; height: 19px; }
.profile-row { display: flex; align-items: center; gap: 4px; padding-right: 8px; background: var(--surface); }
.profile-row .profile { flex: 1; min-width: 0; width: auto; }
.profile-row .profile-edit { display: none; }
#open-app-settings { width: 34px; height: 34px; background: transparent; }
#open-app-settings:not(:disabled):hover { background: var(--selected); color: var(--text); }
.avatar { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-ink); font-size: 13px; font-weight: 600; user-select: none; }
.self-avatar { background: var(--accent); color: var(--accent-ink); }
.self-avatar.speaking { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.microphone-status { display: grid; gap: 6px; margin: 0 2px 9px; padding: 7px 6px; border: 1px solid transparent; border-radius: 4px; color: var(--subtle); font-size: 11px; line-height: 1.4; }
#microphone-label { min-width: 0; overflow-wrap: anywhere; }
.microphone-meter { height: 4px; overflow: hidden; border-radius: 4px; background: var(--control-hover); }
#microphone-level { display: block; width: clamp(0%, calc(var(--mic-level, 0) * 100%), 100%); height: 100%; border-radius: inherit; background: var(--subtle); }
.microphone-status.speaking { color: var(--accent); border-color: var(--accent-border); background: var(--accent-faint); }
.microphone-status.speaking #microphone-level { background: var(--accent); }

/* Header, voice room and video stage. */
main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); overflow: hidden; }
.topbar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 48px; flex-shrink: 0; padding: 0 16px; box-shadow: 0 1px 0 var(--header-shadow), 0 2px 0 var(--header-shadow-soft); z-index: 1; }
.topbar > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar svg { color: var(--subtle); }
.topbar strong { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-divider { height: 24px; width: 1px; flex-shrink: 0; background: var(--line); }
.header-description { font-size: 13px; color: var(--muted); }
.header-actions { flex-shrink: 0; }
#chat-search { width: 164px; height: 26px; padding: 4px 8px; font-size: 12px; }
.topbar .icon-button { width: 32px; height: 32px; flex-shrink: 0; background: transparent; }
.topbar .icon-button:hover { background: var(--selected); }
.topbar .icon-button[aria-pressed="true"] svg { color: var(--text); }
#mobile-nav-toggle, #nav-backdrop { display: none; }
.main-scroll { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.voice-section { padding: 28px 28px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.room-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.room-heading h1 { margin: 0 0 8px; font-size: 27px; line-height: 1.2; font-weight: 700; letter-spacing: -.5px; overflow-wrap: anywhere; }
.room-heading p { margin: 0; color: var(--muted); font-size: var(--content-font-size); line-height: 1.5; }
.voice-stage { background: var(--surface); border-radius: 8px; padding: 18px 20px 20px; }
.stage-top { display: flex; justify-content: space-between; gap: 12px; color: var(--subtle); font-size: 12px; }
.stage-top > span:first-child { display: flex; align-items: center; gap: 7px; color: var(--muted); }
#call-expand { min-height: auto; margin-left: auto; padding: 0; font-size: 12px; }
.voice-people { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 24px; min-height: 240px; padding: 28px 0; }
.empty-voice { text-align: center; max-width: 360px; }
.empty-orb { display: grid; place-items: center; width: 80px; height: 80px; margin: 0 auto 20px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
.empty-orb svg { width: 36px; height: 36px; }
.empty-voice strong { display: block; font-size: 18px; font-weight: 600; }
.empty-voice p { margin: 8px 0 0; color: var(--subtle); font-size: 14px; line-height: 1.5; }
.voice-person { width: 110px; padding: 10px 8px; border: 2px solid transparent; border-radius: 12px; text-align: center; }
.voice-person .avatar { width: 76px; height: 76px; margin: 0 auto; font-size: 27px; border: 3px solid var(--button); }
.voice-person.speaking { border-color: var(--accent); background: var(--accent-faint); box-shadow: 0 0 0 3px var(--accent-ring); }
.voice-person.speaking .avatar { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.voice-person.speaking small { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.voice-person strong { display: block; margin-top: 12px; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-person small { display: block; margin-top: 4px; font-size: 11px; color: var(--subtle); }
.member.speaking { background: var(--accent-faint); }
.member.speaking .avatar { box-shadow: 0 0 0 2px var(--accent); }
.member.speaking small { color: var(--accent); font-weight: 700; }
.voice-controls, .join-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }
.primary { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 38px; padding: 9px 16px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 600; line-height: 1.35; }
.primary:not(:disabled):hover { background: var(--accent-hover); }
.primary svg { width: 19px; height: 19px; }
.primary svg:last-child:not(:first-child) { margin-left: 6px; }
.secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 14px; border-radius: 4px; background: var(--button); color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.4; }
.secondary:not(:disabled):hover { background: var(--button-hover); }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border-radius: 4px; background: var(--raised); color: var(--muted); }
.icon-button:not(:disabled):hover { background: var(--control-hover); color: var(--text); }
.icon-button svg { width: 20px; height: 20px; }
.icon-button[aria-pressed="true"], #call-dock .icon-button[aria-pressed="true"] { color: var(--danger-text); background: var(--danger-soft); }
.danger, .primary.danger, #call-dock .danger { background: var(--danger-fill); color: var(--danger-ink); }
.danger:not(:disabled):hover, .primary.danger:not(:disabled):hover, #call-dock .danger:hover { background: var(--danger-hover); }
.stage-hint { color: var(--subtle); font-size: 11px; line-height: 1.5; margin: 4px 4px 9px; }
.media-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.media-toolbar { position: sticky; top: 0; z-index: 2; margin-bottom: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.media-toolbar .media-controls { margin: 0; }
.media-toolbar .screen-status, .media-toolbar .screen-support-hint { margin: 8px auto 0; }
.media-controls button { font-size: 13px; }
.media-controls button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.expanded-call-controls { display: none; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.expanded-volume { width: min(360px, 100%); margin-right: 8px; }
.screen-status { margin: 0 auto 12px; padding: 8px 12px; border: 1px solid var(--accent-border); border-radius: 6px; background: var(--accent-faint); color: var(--accent); text-align: center; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.screen-support-hint { max-width: 56ch; margin: 0 auto 14px; color: var(--subtle); text-align: center; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; margin: 0 0 20px; }
.video-tile { margin: 0; background: var(--surface-deep); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.video-tile video { display: block; width: 100%; aspect-ratio: 16/9; object-fit: contain; background: var(--media-bg); }
.video-tile figcaption { padding: 10px 12px; font-size: 13px; overflow-wrap: anywhere; }
.video-tile button { width: 100%; padding: 8px; background: var(--hover); color: var(--muted); font-size: 12px; }
.video-tile button:hover { background: var(--selected); color: var(--text); }
.video-grid, .video-tile button { scroll-margin-top: 180px; }
.video-grid:has(.video-tile[data-kind="screen"]) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); align-items: start; }
.video-tile[data-kind="screen"] { grid-column: 1 / -1; order: -1; border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-soft); }
.video-tile[data-kind="screen"] video { max-height: min(62dvh, 680px); }
.video-tile[data-kind="screen"] figcaption { color: var(--text); font-weight: 600; background: var(--accent-faint); }
.video-grid:has(.video-tile[data-kind="screen"]) .video-tile[data-kind="camera"] { width: 100%; max-width: 280px; justify-self: start; }
.voice-stage:has(.video-tile[data-kind="screen"]) .voice-people { min-height: 0; padding: 20px 0; gap: 14px; }
.voice-stage:has(.video-tile[data-kind="screen"]) .voice-person { width: 84px; }
.voice-stage:has(.video-tile[data-kind="screen"]) .voice-person .avatar { width: 44px; height: 44px; font-size: 16px; }
.voice-stage:has(.video-tile[data-kind="screen"]) .voice-person strong { margin-top: 8px; font-size: 12px; }
.video-tile video:fullscreen { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; object-fit: contain; }

/* Conversation: the log scrolls, the composer stays within reach. */
.chat-section { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.chat-heading { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 14px; gap: 12px; }
.chat-heading > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-heading strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hash { color: var(--subtle); font-size: 24px; font-weight: 400; }
.chat-subtitle { color: var(--subtle); font-size: 12px; margin-left: 8px; }
.chat-badge { color: var(--subtle); font-size: 10px; letter-spacing: .5px; }
.messages { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 0 8px; overscroll-behavior: contain; }
.chat-empty { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; min-height: 100%; padding: 32px 20px; text-align: left; }
.empty-hash { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--selected); color: var(--text); font-size: 48px; margin-bottom: 16px; line-height: 1; }
.chat-empty strong { display: block; font-size: 26px; line-height: 1.3; font-weight: 700; margin: 0 0 8px; }
.chat-empty p { color: var(--subtle); font-size: 14px; line-height: 1.6; margin: 0; }
.message-row { display: flex; gap: var(--message-row-gap); margin: 0; padding: var(--message-row-padding) 20px; }
.message-row:hover { background: var(--row-hover); }
.message-row .avatar { width: var(--message-avatar-size); height: var(--message-avatar-size); margin-top: 2px; font-size: 13px; }
.message-content { min-width: 0; flex: 1; }
.message-meta { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 9px; row-gap: 2px; }
.message-meta strong { color: var(--text); font-size: var(--message-name-size); font-weight: 600; overflow-wrap: anywhere; }
.message-meta time { color: var(--subtle); font-size: 11px; }
.message-content p { margin: 3px 0 0; color: var(--body-text); font-size: var(--message-font-size); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { display: flex; align-items: center; flex-shrink: 0; gap: 6px; margin: 4px 16px 0; padding: 5px 8px 5px 12px; border-radius: 8px; background: var(--raised); }
.composer:focus-within { box-shadow: 0 0 0 1px var(--accent-border); }
.composer input { width: 100%; min-width: 0; padding: 10px 4px; background: transparent; border: 0; color: var(--text); font-size: var(--message-font-size); }
.composer input:focus-visible { outline: none; }
.composer input::placeholder { color: var(--subtle); }
.composer button { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 4px; background: transparent; color: var(--muted); }
.composer button:not(:disabled):hover { background: var(--control-hover); color: var(--accent); }
.composer-hint { display: flex; justify-content: space-between; gap: 12px; margin: 7px 20px 12px; color: var(--subtle); font-size: 11px; line-height: 1.3; flex-shrink: 0; }

.members { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 64px 8px 16px; background: var(--panel); overflow-y: auto; }
.members-heading { display: flex; align-items: center; gap: 6px; margin: 0 8px 10px; color: var(--subtle); font-size: 11px; font-weight: 650; letter-spacing: .25px; text-transform: uppercase; }
.members-heading span::before { content: "— "; }
.member { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 6px 8px; border-radius: 4px; }
.member:hover { background: var(--hover); }
.member .avatar { position: relative; width: 32px; height: 32px; font-size: 12px; }
.member .avatar::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border: 3px solid var(--panel); border-radius: 50%; background: var(--green); }
.member > div { min-width: 0; }
.member strong { display: block; color: var(--muted); font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member small { display: block; margin-top: 1px; color: var(--subtle); font-size: 11px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-members { padding: 4px 8px; color: var(--subtle); font-size: 13px; line-height: 1.6; }

/* Friends occupy the same main pane as conversations. */
.friends-view { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.friends-toolbar { display: flex; align-items: center; flex-shrink: 0; gap: 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); overflow-x: auto; }
#friends-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; padding-right: 18px; border-right: 1px solid var(--line); }
#friends-title svg { width: 20px; height: 20px; color: var(--subtle); }
.friends-tabs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.friends-toolbar button { min-height: 28px; padding: 5px 9px; border-radius: 4px; background: transparent; color: var(--muted); font-size: 14px; white-space: nowrap; }
.friends-toolbar button:hover { background: var(--hover); color: var(--text); }
.friends-toolbar button.active, .friends-toolbar button[aria-pressed="true"] { background: var(--selected); color: var(--text); }
.friends-toolbar button[data-friends-filter="add"] { background: var(--accent); color: var(--accent-ink); }
.friends-toolbar button[data-friends-filter="add"]:hover { background: var(--accent-hover); }
.friends-toolbar button[data-friends-filter="add"].active, .friends-toolbar button[data-friends-filter="add"][aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
#pending-friends-count { display: inline-block; padding: 0 4px; margin-left: 3px; background: var(--rail); border-radius: 4px; font-size: 11px; }
#add-friend-form { min-height: 0; overflow-y: auto; padding: 24px 28px; border-bottom: 1px solid var(--line); }
#add-friend-form h2 { margin: 0 0 9px; font-size: 18px; font-weight: 650; }
#add-friend-form label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
#add-friend-form p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.friend-request-input { display: flex; align-items: center; gap: 12px; padding: 8px; background: var(--rail); border: 1px solid var(--surface-deep); border-radius: 6px; }
.friend-request-input:focus-within { border-color: var(--accent); }
.friend-request-input input { border: 0; padding: 7px; min-width: 0; flex: 1; background: transparent; }
.friend-request-input input:focus-visible { outline: none; }
.friend-request-input .primary { margin: 0; flex-shrink: 0; font-size: 13px; min-height: 32px; padding: 7px 12px; }
#friends-error { flex-shrink: 0; margin: 16px 24px 0; }
#friends-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 24px; }
.friends-list-title, .friends-count { margin: 4px 10px 14px; color: var(--subtle); font-size: 12px; font-weight: 650; text-transform: uppercase; }
.friend-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 10px; min-height: 72px; border-top: 1px solid var(--line); }
.friend-row:hover { border-radius: 8px; background: var(--hover); border-color: transparent; }
.friend-info { min-width: 0; flex: 1; }
.friend-info strong, .friend-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-info strong { font-size: 15px; font-weight: 600; }
.friend-info small { margin-top: 3px; font-size: 12px; color: var(--subtle); }
.friend-status { font-size: 12px; color: var(--subtle); }
.friend-avatar { position: relative; }
.friend-avatar.online::after { content: ""; position: absolute; width: 12px; height: 12px; border: 3px solid var(--bg); background: var(--green); right: -1px; bottom: -1px; border-radius: 50%; }
.friend-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.friend-actions button { min-height: 32px; padding: 6px 10px; border-radius: 4px; font-size: 12px; }
.friend-actions .icon-button { border-radius: 50%; width: 36px; height: 36px; padding: 8px; background: var(--panel); }
.friend-actions .icon-button:hover { color: var(--accent); background: var(--rail); }
.friends-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 100%; padding: 36px 20px; color: var(--subtle); text-align: center; }
.friends-empty > svg { width: 104px; height: 104px; padding: 22px; border-radius: 50%; color: var(--accent); background: var(--accent-faint); stroke-width: 1.3; margin-bottom: 16px; }
.friends-empty strong, .friends-empty h2 { color: var(--body-text); font-size: 20px; font-weight: 600; margin: 0; }
.friends-empty p { max-width: 340px; font-size: 14px; line-height: 1.6; margin: 0; }
.friends-empty .primary { margin-top: 12px; }

/* Account, registration and confirmation dialogs. */
dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 40px); margin: auto; overflow-y: auto; padding: 28px; border: 0; border-radius: 8px; background: var(--bg); color: var(--text); box-shadow: 0 12px 64px var(--shadow); }
dialog::backdrop { background: var(--overlay); }
dialog h2 { margin: 0 0 12px; font-size: 24px; font-weight: 650; letter-spacing: -.4px; line-height: 1.3; }
dialog p { margin: 10px 0 16px; color: var(--muted); font-size: var(--content-font-size); line-height: 1.6; }
dialog label { display: block; margin: 20px 0 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
input, select { padding: 11px 12px; border: 1px solid var(--border); border-radius: 3px; background: var(--rail); color: var(--text); font-size: 14px; min-width: 0; }
input::placeholder { color: var(--subtle); }
dialog input { width: 100%; }
input:read-only { color: var(--subtle); }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
input[type="range"] { padding: 0; accent-color: var(--accent); }
select { font-size: 13px; max-width: 100%; color-scheme: inherit; }
dialog .primary { width: 100%; margin-top: 20px; }
dialog small { display: block; margin-top: 10px; color: var(--subtle); font-size: 12px; line-height: 1.55; }
dialog .field-hint { margin-top: 7px; text-align: left; font-weight: 400; }
#screen-quality { width: 100%; }
#screen-share-dialog .settings-toggle { margin-bottom: 8px; }
#screen-audio-hint { margin: 0; color: var(--subtle); font-size: 12px; line-height: 1.6; }
.auth-brand { display: flex; align-items: center; justify-content: space-between; font-size: 26px; font-weight: 750; letter-spacing: -.8px; margin-bottom: 20px; }
.auth-brand img { display: block; width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0; }
.auth-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 5px; background: var(--rail); margin: 0 0 24px; }
.auth-tabs button { flex: 1; background: transparent; border-radius: 3px; padding: 9px 10px; color: var(--muted); font-size: 14px; }
.auth-tabs button:hover { background: var(--hover); }
.auth-tabs button.active { background: var(--selected); color: var(--text); }
#auth-dialog { width: min(456px, calc(100% - 32px)); }
#auth-description { margin-bottom: 22px; }
#auth-submit { margin-top: 22px; min-height: 42px; }
#auth-form[aria-busy="true"] .primary { opacity: .7; cursor: progress; }
.password-field { position: relative; }
.password-field input { padding-right: 88px; }
.password-field button { position: absolute; right: 7px; top: 6px; bottom: 6px; padding: 0 8px; background: var(--panel); color: var(--muted); border-radius: 3px; font-size: 11px; }
.password-field button:hover { background: var(--selected); color: var(--text); }
.text-button { background: transparent; color: var(--accent); padding: 6px 0; font-size: 13px; text-align: left; }
.text-button:not(:disabled):hover { text-decoration: underline; }
#forgot-password { display: block; margin: 6px 0 0; }
.form-error { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--danger-border); border-radius: 4px; background: var(--danger-soft); color: var(--danger-text) !important; font-size: 13px !important; line-height: 1.5 !important; overflow-wrap: anywhere; }
.language-control { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
dialog .language-control label { margin: 0; color: var(--subtle); font-size: 12px; font-weight: 400; }
.language-control select { width: auto; max-width: 65%; padding: 7px 10px; font-size: 12px; }
.code-help { color: var(--subtle); font-size: 13px; line-height: 1.6; }
#auth-code { text-align: center; font-size: 26px; letter-spacing: 9px; font-variant-numeric: tabular-nums; padding-left: 21px; }
.code-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 10px; }
.code-actions button { font-size: 12px; }
#code-description, #account-contact, #incoming-caller, #incoming-room { overflow-wrap: anywhere; }
#account-display-name { color: var(--text); font-size: 18px; font-weight: 600; margin-bottom: 4px; }
#account-contact { font-size: 13px; margin-top: 0; }
.password-settings { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.password-settings summary { cursor: pointer; color: var(--text); font-size: 14px; font-weight: 600; }
.password-settings[open] summary { color: var(--accent); }
#account-saved { color: var(--green); font-size: 13px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.dialog-actions .primary { margin: 0; flex: 1; }
.dialog-actions .secondary { flex-shrink: 0; }

/* Server and channel preferences share the dialog's single scroll area. */
#server-settings-dialog { width: min(620px, calc(100% - 32px)); }
#server-settings-dialog h3 { margin: 26px 0 10px; color: var(--text); font-size: 16px; font-weight: 700; }
dialog .settings-toggle { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0; font-size: 13px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.settings-toggle input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; margin: 1px 0 0; }
.settings-toggle > span { min-width: 0; }
#server-settings-members { min-width: 0; }
.server-member-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; padding: 14px 0; border-bottom: 1px solid var(--line); }
.server-member-info { flex: 1 1 160px; min-width: 0; }
.server-member-info strong, .server-member-info small { display: block; overflow-wrap: anywhere; }
.server-member-info strong { font-size: 14px; font-weight: 650; }
.server-member-info small { margin-top: 4px; color: var(--subtle); font-size: 12px; }
.server-member-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: 0; max-width: 100%; margin-left: auto; }
.server-member-actions button { min-width: 0; max-width: 100%; padding: 8px 10px; font-size: 12px; overflow-wrap: anywhere; }
#open-delete-room { width: 100%; min-height: 38px; margin-top: 20px; padding: 10px 14px; border-radius: 4px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
#kick-member-dialog p { overflow-wrap: anywhere; }

#logout { background: var(--button); color: var(--text); }
#logout:hover { background: var(--button-hover); }
.delete-account-button { margin-top: 18px; color: var(--danger-text); }
.confirm-delete { display: flex !important; gap: 10px; align-items: flex-start; line-height: 1.6; font-size: 13px; font-weight: 400; }
.confirm-delete input { margin-top: 2px; }
.invite-note { font-size: 12px !important; }
#room-kind { width: 100%; }
.sound-settings { border: 1px solid var(--border); border-radius: 5px; padding: 14px; margin: 24px 0 0; min-width: 0; }
.sound-settings legend { color: var(--text); font-size: 13px; font-weight: 600; padding: 0 5px; }
dialog .sound-switch { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; font-size: 13px; font-weight: 400; }
.sound-settings > label { margin-top: 0; }
.sound-volume { display: flex; align-items: center; gap: 14px; }
.sound-volume input { min-width: 0; width: 100%; }
.sound-volume output { font-size: 12px; min-width: 34px; color: var(--muted); }
.sound-settings small { text-align: left; font-size: 11px; }
#incoming-call-dialog, #outgoing-call-dialog { text-align: center; }
#incoming-caller { font-size: 23px; font-weight: 650; color: var(--text); margin: 22px 0 8px; }
#incoming-room { color: var(--accent); }
#outgoing-call-user { font-size: 23px; font-weight: 650; color: var(--text); margin: 22px 0 8px; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%); max-width: min(580px, calc(100% - 32px)); padding: 12px 18px; background: var(--surface-deep); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 32px var(--shadow); color: var(--text); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
#audio-container { display: none; }

/* Appearance settings use the same live theme as the rest of the app. */
.app-settings-dialog { width: min(780px, calc(100% - 32px)); height: min(780px, calc(100dvh - 40px)); max-height: calc(100dvh - 40px); padding: 0; overflow: hidden; }
.app-settings-dialog[open] { display: flex; flex-direction: column; }
.settings-header { display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; gap: 16px; padding: 24px; }
.settings-header > div { min-width: 0; }
.settings-header strong { display: block; margin-bottom: 6px; color: var(--subtle); font-size: 12px; font-weight: 600; }
.settings-header h2 { margin: 0; font-size: 22px; }
.settings-header p { margin: 8px 0 0; }
.settings-header button { flex-shrink: 0; }
#close-app-settings { font-size: 26px; line-height: 1; font-weight: 400; }
.settings-tabs { display: flex; flex-shrink: 0; gap: 8px; overflow-x: auto; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.settings-tabs button { flex-shrink: 0; padding: 14px 12px; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.settings-tabs button:hover { background: var(--hover); color: var(--text); }
.settings-tabs button[aria-selected="true"], .settings-tabs button[aria-pressed="true"], .settings-tabs button.active { border-bottom-color: var(--accent); color: var(--accent); }
.settings-panel { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding: 24px; overscroll-behavior: contain; }
.settings-panel h3 { margin: 0 0 14px; color: var(--text); font-size: 16px; font-weight: 700; }
.settings-panel h3:not(:first-child) { margin-top: 24px; }
.settings-panel p { overflow-wrap: anywhere; }
.settings-panel > .primary { width: auto; max-width: 100%; }
.settings-panel .sound-settings { margin: 0; padding: 0; border: 0; }
.settings-panel .sound-settings legend { padding: 0; margin-bottom: 18px; font-size: 16px; }
.sound-previews { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 24px; }
.sound-previews button { flex: 1 1 220px; min-width: 0; max-width: 100%; font-size: 13px; overflow-wrap: anywhere; }
.settings-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, 45%); align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.settings-row label { min-width: 0; margin: 0; font-size: var(--content-font-size); font-weight: 600; overflow-wrap: anywhere; }
.settings-row small { margin-top: 5px; font-weight: 400; }
.settings-row select { width: 100%; max-width: 100%; }
.theme-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.theme-options button { display: flex; flex-direction: column; align-items: stretch; gap: 9px; min-width: 0; padding: 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 13px; line-height: 1.4; text-align: left; overflow-wrap: anywhere; }
.theme-options button:hover { background: var(--hover); color: var(--text); }
.theme-options button[aria-pressed="true"], .theme-options button.selected, .theme-options button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--accent); }
.theme-swatch { position: relative; display: block; width: 100%; height: 66px; overflow: hidden; border-radius: 4px; border: 1px solid var(--border); background: var(--swatch-bg); }
.theme-swatch::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 24%; background: var(--swatch-panel); }
.theme-swatch::after { content: ""; position: absolute; top: 13px; left: 34%; right: 10%; height: 5px; border-radius: 4px; background: var(--swatch-text); box-shadow: 0 13px 0 color-mix(in srgb, var(--swatch-text) 40%, transparent), 0 26px 0 color-mix(in srgb, var(--swatch-text) 20%, transparent); }
[data-theme-option="dark"] { --swatch-bg: #313338; --swatch-panel: #1e1f22; --swatch-text: #f2f3f5; }
[data-theme-option="light"] { --swatch-bg: #fff; --swatch-panel: #e3e8ef; --swatch-text: #465366; }
[data-theme-option="midnight"] { --swatch-bg: #111827; --swatch-panel: #070d17; --swatch-text: #b4c3d8; }
[data-theme-option="system"] { --swatch-bg: linear-gradient(90deg, #fff 50%, #111827 50%); --swatch-panel: #697a90; --swatch-text: #8ca0b7; }
.accent-options { display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px; }
.accent-options button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 38px; min-height: 38px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.accent-options button::before { content: ""; width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; background: var(--swatch-accent); box-shadow: inset 0 0 0 1px var(--border); }
.accent-options button:hover { background: var(--hover); color: var(--text); }
.accent-options button[aria-pressed="true"], .accent-options button.selected, .accent-options button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); color: var(--accent); }
[data-accent-option="turquoise"] { --swatch-accent: #10ceb5; }
[data-accent-option="blue"] { --swatch-accent: #80b3ff; }
[data-accent-option="violet"] { --swatch-accent: #bea3ff; }
[data-accent-option="rose"] { --swatch-accent: #ff9ebb; }
[data-accent-option="amber"] { --swatch-accent: #f2c66b; }
.settings-preview { min-width: 0; margin-top: 24px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.settings-preview > strong { display: block; margin-bottom: 14px; color: var(--subtle); font-size: 12px; font-weight: 600; }
.settings-preview .message-row { padding: var(--message-row-padding) 0; }
.settings-preview p { color: var(--body-text); font-size: var(--message-font-size); line-height: 1.55; }
.settings-preview .message-content p { margin: 3px 0 0; }
.settings-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 8px 16px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--panel); }
.settings-footer small, .settings-footer p { margin: 0; color: var(--subtle); font-size: 12px; line-height: 1.5; }

/* Rounded geometric display lettering, with a calmer face for conversations. */
.auth-brand, .community strong, .room-heading h1, dialog h2,
.chat-empty strong, .friends-empty h2, #add-friend-form h2 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.auth-brand { gap: 12px; }
.auth-brand, .community strong { text-transform: lowercase; }

@media (min-width: 1500px) {
  .voice-section { padding: 36px 40px; }
  .voice-people { min-height: 320px; }
}
@media (max-width: 1250px) {
  #friends-title { display: none; }
  .friends-toolbar { padding: 14px 20px; }
  .friends-tabs { gap: 5px; }
  .friends-toolbar button { font-size: 13px; }
}
@media (max-width: 1100px) {
  .app, .app.members-hidden { grid-template-columns: 72px 240px minmax(0, 1fr); }
  .members, #toggle-members { display: none; }
  .header-description { display: none; }
  .voice-section { padding: 24px; }
}
@media (max-width: 760px) {
  :root:not([data-density="compact"]) { --message-avatar-size: 34px; --message-row-gap: 12px; }
  .app, .app.members-hidden { display: grid; grid-template-columns: minmax(0, 1fr); height: 100dvh; }
  main { grid-column: 1; grid-row: 1; width: 100%; }
  .rail { position: fixed; top: 0; bottom: 0; left: 0; width: 64px; z-index: 41; transform: translateX(-310px); visibility: hidden; padding-top: 12px; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 64px; width: 240px; z-index: 40; transform: translateX(-310px); visibility: hidden; box-shadow: 12px 0 32px var(--drawer-shadow); }
  .app.nav-open .rail, .app.nav-open .sidebar { transform: translateX(0); visibility: visible; }
  .app.nav-open #nav-backdrop { display: block; position: fixed; inset: 0; width: 100%; height: 100%; padding: 0; z-index: 30; border-radius: 0; background: var(--overlay); }
  .rail .brand, .rail .server, .rail .rail-invite { width: 44px; height: 44px; }
  .channel-delete, .channel-settings { opacity: 1; pointer-events: auto; width: 36px; height: 36px; }
  .brand::before, .server.selected::before { left: -10px; }
  .members { display: none; }
  #mobile-nav-toggle { display: grid; }
  .topbar { height: 52px; padding: 0 12px; gap: 8px; }
  .topbar > div { gap: 8px; }
  .topbar strong { font-size: 15px; }
  .header-divider, .header-description { display: none; }
  #chat-search { width: 120px; }
  .voice-section { padding: 22px 16px; }
  .room-heading { margin-bottom: 20px; }
  .room-heading h1 { font-size: 24px; }
  .room-heading p { font-size: var(--content-font-size); }
  .voice-stage { padding: 14px 12px 16px; }
  .stage-top { font-size: 11px; flex-wrap: wrap; gap: 7px; }
  .voice-people { min-height: 225px; padding: 28px 0; gap: 20px; }
  .voice-person { width: 90px; }
  .voice-person .avatar { width: 64px; height: 64px; font-size: 23px; }
  .empty-voice strong { font-size: 17px; }
  .empty-voice p { font-size: 13px; }
  .media-controls { gap: 7px; }
  .media-controls button { padding: 8px 10px; font-size: 12px; }
  .chat-heading { padding: 10px 16px; }
  .chat-subtitle, .chat-badge { display: none; }
  .message-row { padding: var(--message-row-padding) 16px; gap: var(--message-row-gap); }
  .message-row .avatar { width: var(--message-avatar-size); height: var(--message-avatar-size); font-size: 12px; }
  .chat-empty { padding: 24px 16px; }
  .chat-empty strong { font-size: 23px; }
  .composer { margin: 4px 12px 0; padding-left: 10px; }
  .composer input { font-size: var(--message-font-size); }
  .composer-hint { margin: 6px 16px max(12px, env(safe-area-inset-bottom)); font-size: 10px; }
  .friends-toolbar { padding: 12px; overflow-x: auto; }
  .friends-tabs { gap: 4px; }
  .friends-toolbar button { font-size: 12px; padding: 6px 8px; }
  #add-friend-form { padding: 22px 16px; }
  .friend-request-input { flex-wrap: wrap; }
  .friend-request-input input { width: 100%; flex-basis: 100%; }
  .friend-request-input .primary { width: 100%; }
  #friends-list { padding: 10px 12px 20px; }
  .friend-row { gap: 10px; flex-wrap: wrap; padding: 12px 8px; }
  .friend-actions { flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .friend-actions button { padding: 6px 8px; font-size: 11px; }
  .friends-empty { padding: 32px 12px; }
  .friends-empty strong, .friends-empty h2 { font-size: 19px; }
  .friends-empty p { font-size: 13px; }
  dialog { padding: 24px; max-height: calc(100dvh - 24px); width: calc(100% - 24px); }
  #auth-dialog { width: calc(100% - 24px); }
  #server-settings-dialog { width: min(620px, calc(100% - 24px)); }
  .app-settings-dialog { width: calc(100% - 24px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); padding: 0; }
  .settings-header { gap: 12px; padding: 18px 16px; }
  .settings-header h2 { font-size: 19px; }
  .settings-tabs { padding: 0 12px; gap: 4px; }
  .settings-tabs button { padding: 12px 10px; font-size: 13px; }
  .settings-panel { padding: 20px 16px; }
  .settings-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .theme-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .accent-options { gap: 8px; }
  .accent-options button { flex: 1 1 auto; font-size: 12px; }
  .settings-preview { padding: 12px; }
  .settings-footer { padding: 12px 16px; }
  .server-member-info, .server-member-actions { flex-basis: 100%; }
  .server-member-actions { justify-content: flex-start; margin-left: 0; }
  dialog h2 { font-size: 23px; }
  dialog input, dialog select { font-size: 16px; }
  .language-control select { font-size: 13px; }
  .dialog-actions { gap: 8px; }
  .dialog-actions button { padding-left: 12px; padding-right: 12px; font-size: 13px; }
  .toast { bottom: max(16px, env(safe-area-inset-bottom)); }
}
@media (hover: none), (pointer: coarse) {
  .channel-delete, .channel-settings { opacity: 1; pointer-events: auto; width: 36px; height: 36px; }
}
@media (max-height: 520px) {
  .sidebar { overflow-y: auto; }
  .sidebar-actions { flex-shrink: 0; }
  .channel-list { flex: none; min-height: 104px; overflow: visible; }
  .sidebar-bottom { margin-top: 0; }
}
.app.call-expanded { display: grid; grid-template-columns: minmax(0, 1fr); }
.app.call-expanded > .rail, .app.call-expanded > .sidebar, .app.call-expanded > .members,
.app.call-expanded main > .topbar { display: none; }
.app.call-expanded main { grid-column: 1; grid-row: 1; width: 100%; height: 100dvh; }
.app.call-expanded .main-scroll, .app.call-expanded .voice-section { height: 100%; overflow: hidden; }
.app.call-expanded .voice-section { padding: 0; }
.app.call-expanded .room-heading { display: none; }
.app.call-expanded .voice-stage { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 16px 20px; border-radius: 0; }
.app.call-expanded .voice-people { flex: 1; min-height: 0; }
.app.call-expanded .voice-stage:has(.video-grid:not([hidden])) .voice-people { flex: 0 0 auto; min-height: 84px; padding: 10px 0; }
.app.call-expanded .video-grid { flex: 1; min-height: 0; margin-bottom: 8px; overflow: auto; }
.app.call-expanded .video-tile[data-kind="screen"] video { height: min(72dvh, 900px); max-height: none; }
.app.call-expanded .expanded-call-controls { display: flex; }
.app.call-expanded .join-actions { display: none; }
@media (prefers-reduced-motion: no-preference) {
  button, a { transition: background-color .15s ease, color .15s ease, border-radius .15s ease; }
  .rail, .sidebar { transition: transform .2s ease, visibility .2s ease; }
  .voice-person { animation: appear .2s ease-out; }
  @keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
}
:root[data-reduce-motion="true"],
:root[data-reduce-motion="true"] *,
:root[data-reduce-motion="true"] *::before,
:root[data-reduce-motion="true"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
