:root {
  color-scheme: dark;
  --bg: #10141b;
  --rail: #0b0e14;
  --sidebar: #171d27;
  --panel: #1d2430;
  --ink: #eef3f8;
  --muted: #93a0b4;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #3ee0a2;
  --accent-ink: #06281c;
  --blue: #8eb4ff;
  --danger: #ff6d7a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --font: "Avenir Next", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden, [hidden] { display: none !important; }

.auth {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 460px);
}
.auth-brand {
  padding: 72px;
  background-color: #10151e;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
}
.mark {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: transparent url("/thiscord-icon.png") center / contain no-repeat;
}
.auth-brand h1 { margin: 0; font-size: 56px; letter-spacing: -0.04em; }
.auth-brand p { margin: 0; max-width: 460px; color: var(--muted); font-size: 18px; line-height: 1.5; }
.auth-card {
  margin: auto 48px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab, .ghost, .primary, .icon-btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: transparent;
}
.tab.is-on { background: rgba(255, 255, 255, 0.06); }
form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #10151d;
  border-radius: 10px;
  padding: 12px 14px;
}
textarea { resize: vertical; min-height: 44px; max-height: 160px; }
button.nav-toggle { display: none; }
.ghost { background: rgba(255, 255, 255, 0.05); }
.hint, .form-error, .sub { color: var(--muted); font-size: 13px; }
.form-error { min-height: 1.2em; color: var(--danger); margin: 0; }

.shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 76px 260px minmax(0, 1fr) 232px;
}
#rail {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  overflow: auto;
}
.server-btn, .home-btn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 18px;
  background: #222a36;
  color: var(--ink);
  font-weight: 700;
}
.server-btn.is-on, .home-btn.is-on, .channel.is-on {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 16px;
}
.rail-spacer { flex: 1; }
#sidebar, #members { background: var(--sidebar); display: flex; flex-direction: column; min-height: 0; }
#side-head, #topbar, #account, #voice-dock {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
#account { border-bottom: 0; border-top: 1px solid var(--line); }
#voice-dock {
  position: fixed;
  z-index: 6;
  left: 92px;
  right: 248px;
  bottom: 14px;
  background: #171d27;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
body:has(#voice-dock:not([hidden])) #main { padding-bottom: 96px; }
#side-list, #transcript, #members { overflow: auto; min-height: 0; }
#side-list { flex: 1; padding: 8px; }
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 14px 8px 6px;
}
.channel, .member, .dm {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
.channel:hover, .member:hover, .dm:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink); }
.channel small, .who { margin-left: auto; color: var(--blue); font-size: 12px; }
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #141a23; }
#transcript { flex: 1; }
#topbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
#composer { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--line); }
.message-privacy-banner { margin: 0; padding: 7px 20px; color: #f2c579; background: #302a25; border-top: 1px solid #5a4630; font-size: 12px; line-height: 1.35; }
#composer textarea { flex: 1; }
.message { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 10px 20px; }
.message header { display: flex; gap: 8px; align-items: baseline; }
.message strong { font-size: 15px; }
.message time, .meta { color: var(--muted); font-size: 12px; }
.message p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.message a { color: var(--blue); }
.avatar, .avatar-sm {
  width: 40px; height: 40px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 700; color: #08110d;
}
.avatar-sm { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.avatar, .avatar-sm { flex: none; overflow: hidden; }
.avatar img, .avatar-sm img { display: block; width: 100%; height: 100%; object-fit: cover; }
.compact { padding-top: 2px; }
.compact .avatar { visibility: hidden; height: 0; }
.member { display: flex; }
.members-head { padding: 16px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
#account { display: flex; align-items: center; gap: 10px; }
#account .account-identity { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; margin: -5px; padding: 5px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; }
#account .account-identity:hover { background: #ffffff12; }
#account .whoami { flex: 1; min-width: 0; }
#account strong, #account span { display: block; overflow: hidden; text-overflow: ellipsis; }
#account span { color: var(--muted); font-size: 12px; }
.dock { display: grid; gap: 8px; }
.dock-actions, .stage-tools, .inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.icon { width: 18px; height: 18px; flex: none; }
.icon-btn, .icon-text, .home-btn, .server-btn, .channel, .dm, .passkey, .top-title, .members-head, .section-label, .passkey-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.icon-btn { width: 36px; height: 36px; justify-content: center; padding: 0; background: #10151d; border: 1px solid var(--line); }
.home-btn, .server-btn { justify-content: center; }
.channel, .dm { width: 100%; }
.channel-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.top-title { gap: 10px; min-width: 0; }
.top-title .icon { color: var(--muted); }
.members-head { display: flex; }
#composer .icon-btn { width: 44px; height: 44px; }
.passkey-login { width: 100%; justify-content: center; margin-top: 8px; }
.settings {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 24px;
}
.settings-card {
  width: min(640px, 100%);
  max-height: min(820px, 100%);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.settings-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 18px 0;
}
.settings-card h2, .security-block h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.security { display: grid; gap: 14px; padding: 18px; }
.security-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.passkey, .code-grid { display: flex; align-items: center; gap: 8px; }
.passkey { justify-content: space-between; background: #10151d; border-radius: 10px; padding: 8px 8px 8px 12px; }
.passkey strong { display: inline-flex; align-items: center; gap: 8px; }
.code-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.code-grid code, .secret {
  font-family: var(--mono);
  background: #10151d;
  border-radius: 8px;
  padding: 8px;
}
.qr { background: white; border-radius: 12px; padding: 8px; width: fit-content; }
.qr svg { display: block; width: 180px; height: 180px; }
#voice-dock .dock { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#voice-dock strong { display: inline-flex; align-items: center; gap: 8px; }
.icon-btn.is-hot { background: var(--danger); color: white; border-color: transparent; }
.icon-btn.is-live { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.voice-room, .empty {
  margin: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}
.voice-room h2, .empty h2 { margin: 0 0 8px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.pill {
  display: flex; align-items: center; gap: 8px;
  background: #10151d; border-radius: 999px; padding: 6px 10px 6px 6px;
}
.stage {
  margin: 16px 16px 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.tile {
  position: relative;
  background: #07090d;
  border-radius: 16px;
  overflow: hidden;
  min-height: 220px;
  border: 1px solid var(--line);
}
.tile video { width: 100%; height: 320px; object-fit: contain; background: black; display: block; }
.tile video.camera-video { object-fit: cover; transform: scaleX(-1); }
#call-banner {
  position: fixed; z-index: 8; top: 72px; right: 18px;
  width: min(410px, calc(100vw - 36px)); display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 14px 16px;
  border: 1px solid #62ddb18c; border-radius: 16px;
  background: #172735f5; box-shadow: 0 20px 60px #0009; backdrop-filter: blur(16px);
}
#call-banner[hidden] { display: none; }
.call-banner-copy { display: grid; gap: 4px; min-width: 0; }
.call-banner-copy strong { font-size: 13px; line-height: 1.35; }
#call-banner .inline-actions { flex: none; }
#call-banner { color: #f5f7fb; }
#call-banner .call-banner-copy small { color: #b9cbd4; }
#call-banner .ghost { color: #f5f7fb; }
.dm-call-panel {
  margin: 16px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid #62ddb166; border-radius: 14px;
  background: #62ddb111;
}
.dm-call-panel .inline-actions { margin-left: auto; }
.tile figcaption {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  background: rgba(8, 10, 14, 0.78);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}
code, .mono { font-family: var(--mono); }
.modal {
  position: fixed; inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
  display: grid; place-items: center;
  padding: 24px;
}
.dialog {
  width: min(440px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--panel);
  border-radius: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.device-verification-row { display: grid; gap: 10px; margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.device-verification-row .secret { display: block; font-size: 11px; line-height: 1.5; }
.device-verification-row button { justify-self: start; }
.legacy-plaintext { color: #f2c579; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: grid; gap: 8px; }
.toast {
  background: #222a36;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  max-width: 320px;
  box-shadow: var(--shadow);
}

@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px 24px; min-height: 240px; }
  .auth-brand h1 { font-size: 40px; }
  .auth-card { margin: 0 16px 24px; }
  .shell { grid-template-columns: 64px minmax(0, 1fr); }
  #sidebar, #members { display: none; }
  button.nav-toggle { display: inline-flex; }
  #sidebar.is-open, #members.is-open { display: flex; position: fixed; inset: 0 0 0 64px; z-index: 4; }
  #voice-dock { left: 72px; right: 8px; }
  .tile video { height: 200px; }
}

/* Refined theme and interaction states */
:root {
  --bg: #0e1118;
  --rail: #0b0e14;
  --sidebar: #151b25;
  --panel: #1b2330;
  --ink: #f2f5fa;
  --muted: #a9b6c5;
  --line: #ffffff19;
  --accent: #57dfb3;
  --accent-ink: #06271e;
  --blue: #aec2ff;
  --danger: #ff8e9a;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}
html, body { min-width: 320px; }
body { font-size: 14px; }
button { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid #b7ffe4;
  outline-offset: 2px;
}
::selection { background: #57dfb35c; color: white; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 40; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px 14px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.skip-link:focus { transform: none; }
body:has(#shell[hidden]) .skip-link { display: none; }

.auth { min-height: 100dvh; grid-template-columns: minmax(0, 1fr) minmax(370px, 470px); }
.auth-brand {
  background-image:
    linear-gradient(0deg, #080e18f2 0%, #09111cd9 20%, #0a13245c 63%, #0b152630 100%),
    url("/thiscord-login-bg.webp");
  background-position: center, 60% center;
  background-size: cover;
  background-repeat: no-repeat;
  border-right: 1px solid var(--line);
}
.auth-brand h1 { font-size: clamp(48px, 5vw, 70px); line-height: 1; letter-spacing: -.055em; }
.auth-brand p { font-size: clamp(16px, 1.4vw, 20px); }
.mark { box-shadow: 0 15px 38px #57dfb340; }
.auth-card { border-radius: 22px; }
.tabs { padding: 4px; border-radius: 12px; background: #0e151f; }
.tab { flex: 1; color: var(--muted); }
.tab.is-on { background: #2b3543; color: var(--ink); box-shadow: 0 1px 5px #0004; }
.tab:hover { color: var(--ink); }
label { font-weight: 600; }
input, textarea, select { min-width: 0; border-color: #ffffff27; background: #101721; }
input:hover, textarea:hover, select:hover { border-color: #ffffff40; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #8a98a9; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.primary:hover { background: #82ecc9; }
.primary:active, .ghost:active, .icon-btn:active { transform: translateY(1px); }
.ghost { border: 1px solid #ffffff16; background: #ffffff0c; }
.ghost:hover { border-color: #ffffff30; background: #ffffff1a; }
.auth-card form > .primary { min-height: 44px; }
.auth-card .hint { margin: 0; }

.shell { height: 100dvh; grid-template-columns: 76px 268px minmax(0, 1fr) 240px; overflow: hidden; }
#rail { border-right: 1px solid var(--line); scrollbar-width: thin; }
.server-btn, .home-btn { position: relative; flex: none; border: 1px solid var(--line); transition: border-radius .15s ease, background .15s ease, transform .15s ease; }
.home-btn { padding: 0; border: 0; background: transparent; }
.home-btn img { display: block; width: 100%; height: 100%; object-fit: contain; }
.home-btn.is-on { background: transparent; box-shadow: 0 0 0 2px var(--accent); }
.unread-dot { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border: 2px solid var(--rail); border-radius: 50%; background: var(--accent); }
.unread-count { flex: none; min-width: 20px; margin-left: auto; padding: 2px 5px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; text-align: center; }
.server-btn:hover, .home-btn:hover { border-radius: 14px; background: #344153; transform: translateY(-1px); }
.server-btn.is-on, .home-btn.is-on { border-color: transparent; }
#sidebar { border-right: 1px solid var(--line); }
#members { border-left: 1px solid var(--line); }
#side-head { position: relative; display: grid; gap: 8px; min-height: 60px; padding: 17px 16px; }
#side-head .drawer-close { position: absolute; top: 12px; right: 12px; }
.drawer-close { display: none; }
#side-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; letter-spacing: -.02em; }
#side-head .sub { margin: 0; }
#side-head:has([data-action="new-dm"]) { align-items: center; flex-wrap: wrap; }
#side-head [data-action="new-dm"] { padding: 7px 9px; font-size: 12px; }
#side-list, #transcript, #members { scrollbar-color: #4d5a69 transparent; scrollbar-width: thin; }
#side-list { padding-top: 12px; }
#side-list > .sub { margin: 12px; }
.section-label { font-size: 11px; font-weight: 750; letter-spacing: .09em; }
.section-label .icon-btn { width: 26px; height: 26px; border-color: transparent; background: transparent; }
.section-label .icon-btn:hover { background: #ffffff17; }
.channel, .member, .dm { min-width: 0; min-height: 38px; font-weight: 600; }
.channel.is-on, .dm.is-on { background: #57dfb327; color: #d8fff0; }
.channel.is-on .icon { color: var(--accent); }
.channel-label, .dm span:last-child, .member span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-label .icon { color: #8b9bab; }

#main { background: #1a212c; }
#topbar { min-height: 60px; padding: 10px 20px; background: #1b2330; }
.top-title > div { min-width: 0; }
.top-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; letter-spacing: -.02em; }
.top-title .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#transcript { padding: 20px 0; overscroll-behavior: contain; }
.message { position: relative; grid-template-columns: 40px minmax(0, 1fr); padding: 8px 24px; }
.message:hover { background: #ffffff07; }
.message header { flex-wrap: wrap; gap: 4px 9px; }
.message p { overflow-wrap: anywhere; color: #e0e8f1; line-height: 1.5; }
.message a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.message a:hover { color: #d5dfff; }
.compact { padding-top: 2px; padding-bottom: 2px; }
.avatar, .avatar-sm { flex: none; }
#composer { display: grid; gap: 10px; padding: 14px 20px 18px; background: #1b2330; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.composer-row textarea { flex: 1; min-width: 0; }
#composer textarea { background: #293543; border-color: transparent; }
#composer textarea:focus { border-color: var(--accent); }
#composer .icon-btn { width: 44px; height: 44px; flex: none; }
#composer-attachments { display: flex; flex-wrap: wrap; gap: 8px; }
#composer-attachments[hidden] { display: none; }
.pending-attachment { display: flex; align-items: center; gap: 8px; max-width: min(100%, 280px); padding: 5px 7px; border: 1px solid var(--line); border-radius: 10px; background: #24313f; }
.pending-attachment img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.pending-attachment .icon { color: var(--muted); }
.pending-attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.pending-attachment button { flex: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.pending-attachment button:hover { color: var(--ink); }
.message-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.message-image { display: block; width: fit-content; max-width: min(100%, 420px); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #111923; }
.message-image img { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.message-file { display: flex; align-items: center; gap: 10px; width: min(100%, 360px); padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #25313f; color: var(--ink); text-decoration: none; }
.message-file:hover { border-color: var(--accent); background: #2d3e4b; }
.message-file span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-file small { margin-left: auto; flex: none; color: var(--muted); }
.link-preview { display: flex; flex-direction: column; gap: 6px; width: min(100%, 430px); margin-top: 8px; overflow: hidden; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; background: #23303d; color: var(--ink); text-decoration: none; }
.link-preview:hover { border-color: var(--accent); background: #2b3b49; }
.link-preview-content { display: grid; gap: 3px; padding: 11px 13px; }
.link-preview .site { color: var(--accent); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.link-preview strong { font-size: 14px; overflow-wrap: anywhere; }
.link-preview .description { color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.link-preview-thumb { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #222c39, #4c3338); }
.link-preview-thumb.no-image { aspect-ratio: auto; height: 86px; background: linear-gradient(125deg, #5a242d, #aa3137); }
.link-preview-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.link-preview-play { position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: 28px; text-shadow: 0 2px 12px #000; }
.icon-btn { border: 1px solid var(--line); }
.icon-btn:hover { background: #2d3b4b; border-color: #ffffff37; }
.primary.icon-btn { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.primary.icon-btn:hover { background: #82ecc9; }
#account { padding: 11px 10px; background: #111923; }
#account .icon-btn { width: 32px; height: 32px; }
.members-head { font-size: 11px; font-weight: 750; letter-spacing: .09em; }
#members .member { width: calc(100% - 16px); margin: 0 8px 2px; }
#members > .sub { margin: 14px 18px; }

.date-divider { display: flex; align-items: center; gap: 12px; margin: 20px 24px 12px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.date-divider::before, .date-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.message-actions { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.message-actions .icon-btn { width: 28px; height: 28px; background: #24303d; }
.message-actions .icon-btn:hover, .message-actions .icon-btn:focus-visible { background: #365064; border-color: #ffffff48; }
.reaction-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.reaction { min-width: 34px; min-height: 27px; padding: 3px 8px; border: 1px solid #ffffff28; border-radius: 8px; background: #25313f; color: var(--ink); font-size: 12px; }
.reaction:hover, .reaction.is-on { border-color: var(--accent); background: #57dfb327; }
.reaction-picker { display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #111923; box-shadow: var(--shadow); }
.reaction-picker button { min-width: 30px; min-height: 30px; padding: 3px; border: 0; border-radius: 7px; background: transparent; }
.reaction-picker button:hover { background: #ffffff19; }
.message-editor { display: grid; gap: 8px; margin-top: 8px; }
.message-editor textarea { min-height: 74px; }
.message-editor .inline-actions { justify-content: flex-end; }
.message.is-editing { background: #57dfb310; }
.history-button { display: block; margin: 8px auto 18px; }
@media (hover: hover) {
  .message-actions { position: absolute; z-index: 2; top: -13px; right: 18px; gap: 3px; margin: 0; padding: 3px; border: 1px solid #ffffff29; border-radius: 10px; background: #182331; box-shadow: 0 7px 22px #0005; opacity: 0; pointer-events: none; }
  .message:hover .message-actions, .message:focus-within .message-actions { opacity: 1; pointer-events: auto; }
}

.search-dialog { width: min(680px, 100%); max-height: min(80dvh, 740px); display: flex; flex-direction: column; gap: 14px; }
.search-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.search-head h2 { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.search-form input { min-width: 0; }
.search-form .primary { min-height: 43px; }
.search-results { display: grid; align-content: start; gap: 7px; min-height: 84px; max-height: 50dvh; overflow: auto; padding-right: 3px; scrollbar-width: thin; }
.search-results > .sub { margin: 8px 2px; }
.search-result { display: grid; gap: 6px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #ffffff08; color: var(--ink); text-align: left; }
.search-result:hover, .search-result:focus-visible { border-color: #57dfb378; background: #57dfb319; }
.search-result .meta { color: var(--muted); }
.search-result span:last-child { overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-height: 1.45; }
.danger-action { background: #bf4b5c; color: white; }
.danger-action:hover { background: #d65b6c; }

#voice-dock { left: 92px; right: 256px; padding: 10px 14px; border-color: #ffffff30; background: #151e2af2; backdrop-filter: blur(16px); }
#voice-dock .dock-actions { flex-wrap: nowrap; }
body:has(#voice-dock:not([hidden])) #main { padding-bottom: 86px; }
.voice-room, .empty { background: #ffffff06; }
.voice-room { max-width: 780px; }
.voice-room h2, .empty h2 { font-size: 22px; letter-spacing: -.03em; }
.stage { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.tile { margin: 0; }
.settings, .modal { background: #05080db8; backdrop-filter: blur(5px); }
.settings-card, .dialog { border-color: #ffffff26; border-radius: 20px; }
.security-block { background: #ffffff05; }
.code-grid code, .secret { min-width: 0; overflow-wrap: anywhere; }
.dialog .inline-actions { justify-content: flex-end; }
.toast { border-color: #ffffff29; background: #263442; }

/* User settings */
.settings-card { width: min(960px, 100%); height: min(780px, calc(100dvh - 48px)); max-height: none; display: flex; flex-direction: column; overflow: hidden; }
.settings-card > header { flex: none; min-height: 84px; padding: 17px 22px; border-bottom: 1px solid var(--line); }
.settings-card > header h2 { font-size: 20px; letter-spacing: -.035em; }
.settings-eyebrow { display: block; margin-bottom: 3px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.settings-layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 0; flex: 1; }
#settings-nav { display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 20px 12px; border-right: 1px solid var(--line); background: #111923; }
.settings-nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 43px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; text-align: left; }
.settings-nav-item:hover { background: #ffffff12; color: var(--ink); }
.settings-nav-item.is-on { background: #57dfb321; color: #c2ffe8; }
.settings-nav-item.is-on .icon { color: var(--accent); }
#settings-body { min-width: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #4d5a69 transparent; }
.settings-content { display: grid; align-content: start; gap: 18px; max-width: 680px; margin: 0 auto; padding: 28px 30px 36px; }
.settings-heading h2 { margin: 0 0 5px; font-size: 27px; letter-spacing: -.045em; }
.settings-heading .sub { margin: 0; line-height: 1.45; }
.settings-group { display: grid; gap: 15px; padding: 19px 21px; border: 1px solid var(--line); border-radius: 15px; background: #ffffff05; }
.settings-group h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.settings-group > .sub { margin: -9px 0 1px; line-height: 1.45; }
.settings-field { display: grid; gap: 5px; min-width: 0; color: var(--ink); }
.settings-field select { margin-top: 5px; }
.field-title { display: block; color: var(--ink); font-size: 13px; font-weight: 750; }
.field-description { display: block; color: var(--muted); font-size: 12px; font-weight: 450; line-height: 1.45; }
.settings-range { gap: 8px; }
.range-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.range-top output { color: var(--accent); font-size: 12px; font-weight: 800; white-space: nowrap; }
.settings-range input { width: 100%; height: 22px; margin: 3px 0 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); cursor: pointer; }
.settings-range input:disabled { opacity: .4; cursor: not-allowed; }
.settings-toggle { position: relative; display: flex; align-items: center; gap: 18px; min-height: 42px; color: var(--ink); cursor: pointer; }
.settings-toggle .setting-copy { flex: 1; min-width: 0; }
.settings-toggle .field-description { margin-top: 3px; }
.settings-toggle input { position: absolute; right: 0; width: 42px; height: 25px; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { width: 42px; height: 25px; flex: none; border: 1px solid #ffffff32; border-radius: 999px; background: #536171; transition: background .15s ease; pointer-events: none; }
.switch-track::after { content: ""; display: block; width: 17px; height: 17px; margin: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px #0005; transition: transform .15s ease; }
.settings-toggle input:checked + .switch-track { border-color: var(--accent); background: var(--accent); }
.settings-toggle input:checked + .switch-track::after { transform: translateX(17px); }
.settings-toggle input:focus-visible + .switch-track { outline: 2px solid #b7ffe4; outline-offset: 3px; }
.settings-dependent { display: grid; gap: 15px; padding-top: 4px; }
.settings-key-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.key-capture { min-width: 106px; padding: 7px 11px; font-family: var(--mono); font-size: 12px; }
.settings-dependent > .field-description { margin: -8px 0 0; }
.mic-test { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #101822; }
.mic-test-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mic-test-actions strong { font-size: 13px; }
.mic-test-actions button { padding: 7px 10px; font-size: 12px; }
.mic-test-meter { height: 10px; overflow: hidden; border-radius: 999px; background: #ffffff16; }
.mic-test-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #57dfb3, #8eb4ff); transition: width .08s linear; }
.mic-test .sub { margin: 0; }
.audio-warning { display: grid; gap: 10px; padding: 11px 13px; border: 1px solid #ff8e9a66; border-radius: 10px; background: #ff8e9a14; color: var(--danger); font-size: 12px; line-height: 1.45; }
.audio-warning button { justify-self: start; color: var(--ink); }
.dock-info { display: grid; gap: 2px; min-width: 0; }
.dock-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-info small { color: var(--muted); font-size: 11px; }
.pill.has-volume { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; min-width: min(250px, 100%); padding: 8px 10px; border-radius: 12px; }
.pill.has-volume .sub { grid-column: 2; margin: 0; }
.peer-volume { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; grid-column: 1 / -1; width: 100%; margin-top: 4px; font-size: 11px; }
.peer-volume output { color: var(--accent); font-weight: 750; }
.peer-volume input { grid-column: 1 / -1; width: 100%; height: 18px; margin: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
#settings-body > .security { max-width: 680px; margin: 0 auto; padding: 0 30px 36px; }
#settings-body > .settings-heading { max-width: 680px; margin: 0 auto; padding: 28px 30px 2px; }
#settings-body > .settings-loading { padding: 28px 30px; }
.about-brand { display: flex; align-items: center; gap: 17px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 16% 20%, #3ee0a227, transparent 55%), var(--panel); }
.about-brand img { flex: none; object-fit: contain; filter: drop-shadow(0 8px 12px #0005); }
.about-brand-copy { display: grid; gap: 3px; }
.about-brand-copy strong { font-size: 25px; letter-spacing: -.045em; }
.about-version-row { display: flex; justify-content: space-between; gap: 18px; font-size: 13px; }
.about-version-row strong { overflow-wrap: anywhere; text-align: right; }
.about-note { margin: 0 4px; line-height: 1.5; }

/* Profile and friends */
.profile-preview { display: flex; align-items: center; gap: 15px; min-width: 0; padding: 20px; border: 1px solid #70ebc741; border-radius: 16px; background: linear-gradient(125deg, #3ee0a21b, #8eb4ff0a); }
.profile-preview .avatar { width: 58px; height: 58px; border-radius: 18px; font-size: 23px; }
.profile-preview-copy { min-width: 0; display: grid; gap: 2px; }
.profile-preview-copy strong { overflow-wrap: anywhere; font-size: 19px; }
.profile-preview-copy p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-avatar-actions, .profile-code-row, .profile-save-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.profile-upload { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 9px 14px; border-radius: 10px; color: var(--ink); cursor: pointer; font-size: 14px; }
.profile-upload input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; cursor: pointer; }
.profile-upload:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-code { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #0d1620; color: #c4ffe9; font: 700 16px var(--mono); letter-spacing: .07em; user-select: all; }
.profile-field { display: grid; gap: 7px; color: var(--ink); }
.profile-field input, .profile-field textarea { margin-top: 1px; }
.profile-field textarea { min-height: 88px; }
.profile-color-field input { width: 72px; height: 46px; padding: 5px; cursor: pointer; }
.profile-form { gap: 17px; }
.profile-save-status { min-width: 0; overflow-wrap: anywhere; }
.friends-entry { margin-bottom: 4px; }
.friends-entry .unread-count { margin-left: auto; }
.sidebar-empty { margin: 10px; line-height: 1.4; }
.friends-view { width: min(900px, 100%); min-height: 100%; margin: 0 auto; padding: 26px 30px 48px; }
.friends-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.friends-heading h1 { margin: 0 0 4px; font-size: 27px; letter-spacing: -.045em; }
.friends-heading p { margin: 0; }
.friends-tabs { display: flex; gap: 5px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.friend-tab { flex: none; padding: 10px 15px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 700; white-space: nowrap; }
.friend-tab:hover { color: var(--ink); background: #ffffff0b; }
.friend-tab.is-on { color: var(--accent); border-color: var(--accent); }
.friends-content { display: grid; align-content: start; gap: 18px; padding-top: 23px; }
.friends-content > .sub { margin: 0; line-height: 1.5; }
.friends-search-input { width: min(100%, 520px); }
.friend-list, .friend-section { display: grid; align-content: start; gap: 10px; }
.friend-section h2 { margin: 0 0 5px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.friend-section + .friend-section { margin-top: 15px; }
.friend-section > .sub { margin: 0 0 8px; }
.friend-card { display: flex; align-items: center; gap: 13px; min-width: 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 15px; background: #ffffff07; }
.friend-card .avatar { width: 44px; height: 44px; border-radius: 15px; }
.friend-card-details { flex: 1; min-width: 0; }
.friend-card-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 9px; }
.friend-card-name strong { overflow-wrap: anywhere; }
.friend-bio { margin: 4px 0 0; max-width: 48ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.friend-card-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.friend-card-actions button { padding: 8px 11px; white-space: nowrap; font-size: 12px; }
.friend-status { padding: 18px 3px; }
.friend-empty { display: grid; justify-items: start; gap: 9px; padding: 35px 25px; border: 1px dashed #ffffff30; border-radius: 16px; background: #ffffff04; }
.friend-empty h3, .friend-empty p { margin: 0; }
.friend-empty h3 { font-size: 17px; }
.friend-empty p { line-height: 1.5; }
.new-dm-dialog { width: min(540px, 100%); }
.new-dm-dialog > .sub { margin: 0 0 15px; }
.new-dm-results { display: grid; gap: 6px; min-height: 75px; max-height: min(420px, 50dvh); overflow: auto; margin-top: 12px; }
.new-dm-results > .sub { margin: 12px 0; }
.new-dm-results > .primary { justify-self: start; }
.new-dm-choice { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #ffffff08; text-align: left; }
.new-dm-choice:hover, .new-dm-choice:focus-visible { border-color: #3ee0a270; background: #3ee0a21a; }
.new-dm-choice-copy { display: grid; gap: 2px; min-width: 0; }
.new-dm-choice-copy strong, .new-dm-choice-copy .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

:root[data-density="compact"] .message { padding-top: 4px; padding-bottom: 4px; }
:root[data-density="compact"] .message.compact { padding-top: 1px; padding-bottom: 1px; }
:root[data-density="compact"] .date-divider { margin-top: 12px; margin-bottom: 6px; }
#transcript .message p { font-size: var(--chat-font-size, 16px); }
:root[data-reduced-motion="true"] *, :root[data-reduced-motion="true"] *::before, :root[data-reduced-motion="true"] *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f4f7; --rail: #e6edf2; --sidebar: #f7f9fb; --panel: #ffffff;
  --ink: #182632; --muted: #5d6e7d; --line: #24334220;
  --blue: #2858a6; --danger: #bc334c; --shadow: 0 22px 55px #24334224;
}
:root[data-theme="light"] .auth-brand { color: #f2f5fa; }
:root[data-theme="light"] .auth-brand p { color: #d9e5f0; }
:root[data-theme="light"] .tabs { background: #ebf0f4; }
:root[data-theme="light"] .tab.is-on { background: white; }
:root[data-theme="light"] input, :root[data-theme="light"] textarea, :root[data-theme="light"] select { border-color: #24334233; background: #f6f9fb; }
:root[data-theme="light"] .ghost { border-color: #24334228; background: #2433420d; }
:root[data-theme="light"] .ghost:hover, :root[data-theme="light"] .channel:hover, :root[data-theme="light"] .member:hover, :root[data-theme="light"] .dm:hover { background: #24334217; }
:root[data-theme="light"] .icon-btn { background: #edf2f5; }
:root[data-theme="light"] .icon-btn:hover { background: #e0e8ed; }
:root[data-theme="light"] .server-btn { background: #e5ebf0; }
:root[data-theme="light"] .server-btn:hover, :root[data-theme="light"] .home-btn:hover { background: #dae5e9; }
:root[data-theme="light"] .channel.is-on, :root[data-theme="light"] .dm.is-on { background: #34b88924; color: #12533e; }
:root[data-theme="light"] #main { background: #fff; }
:root[data-theme="light"] #topbar, :root[data-theme="light"] #composer { background: #f8fafc; }
:root[data-theme="light"] .message-privacy-banner { color: #754c13; background: #fff7e7; border-color: #ead8b8; }
:root[data-theme="light"] #composer textarea { background: #edf2f5; }
:root[data-theme="light"] #account, :root[data-theme="light"] #settings-nav { background: #edf2f5; }
:root[data-theme="light"] .settings-nav-item { color: #344a5b; }
:root[data-theme="light"] .settings-nav-item .icon { color: #506677; }
:root[data-theme="light"] .settings-nav-item.is-on { background: #ccefe0; color: #124b39; }
:root[data-theme="light"] .settings-nav-item.is-on .icon { color: #106d4b; }
:root[data-theme="light"] .settings-nav-item:hover { background: #dce7eb; color: #142d3e; }
:root[data-theme="light"] .settings-nav-item.is-on:hover { background: #bee8d7; color: #124b39; }
:root[data-theme="light"] .settings-eyebrow, :root[data-theme="light"] .range-top output, :root[data-theme="light"] .peer-volume output { color: #0b7651; }
:root[data-theme="light"] .settings-group, :root[data-theme="light"] .security-block, :root[data-theme="light"] .voice-room, :root[data-theme="light"] .empty { background: #f8fafc; }
:root[data-theme="light"] .mic-test, :root[data-theme="light"] .passkey, :root[data-theme="light"] .pill { background: #edf2f5; }
:root[data-theme="light"] .mic-test-meter { background: #24334219; }
:root[data-theme="light"] .switch-track { border-color: #24334233; }
:root[data-theme="light"] .message p { color: #223440; }
:root[data-theme="light"] .message:hover { background: #24334208; }
:root[data-theme="light"] .message-actions .icon-btn, :root[data-theme="light"] .reaction, :root[data-theme="light"] .reaction-picker, :root[data-theme="light"] .code-grid code, :root[data-theme="light"] .secret { background: #edf2f5; }
:root[data-theme="light"] .message-actions { background: #fff; }
:root[data-theme="light"] #voice-dock { background: #ffffffee; }
:root[data-theme="light"] .toast { background: #f3f7fa; }
:root[data-theme="light"] .profile-preview { background: linear-gradient(125deg, #34b88919, #8eb4ff14); border-color: #34b88955; }
:root[data-theme="light"] .profile-code { background: #edf5f0; color: #13573f; }
:root[data-theme="light"] .friend-card, :root[data-theme="light"] .new-dm-choice { background: #f8fafc; }
:root[data-theme="light"] .friend-empty { border-color: #24334235; background: #f8fafc; }
:root[data-theme="light"] .friend-tab:hover { background: #2433420c; }

@media (max-width: 700px) {
  .settings-card { height: calc(100dvh - 20px); }
  .settings-card > header { min-height: 68px; padding: 12px 16px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #settings-nav { flex-direction: row; gap: 4px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  #settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-item { width: auto; flex: none; min-height: 38px; padding: 8px 10px; white-space: nowrap; font-size: 12px; }
  .settings-nav-item .icon { width: 16px; height: 16px; }
  .settings-content { padding: 20px 16px 28px; }
  #settings-body > .security { padding: 0 16px 28px; }
  #settings-body > .settings-heading { padding: 20px 16px 2px; }
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 76px 268px minmax(0, 1fr); }
  #sidebar { display: flex; }
  #members { display: none; }
  button.nav-toggle { display: inline-flex; }
  button[data-action="toggle-channels"].nav-toggle { display: none; }
  #main:has(+ #members[hidden]) button[data-action="toggle-members"].nav-toggle { display: none; }
  #members.is-open { display: flex; position: fixed; z-index: 5; inset: 0 0 0 auto; width: min(300px, calc(100vw - 76px)); box-shadow: var(--shadow); }
  #members .drawer-close { display: inline-flex; margin-left: auto; }
  #voice-dock { right: 14px; }
}
@media (max-width: 780px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { min-height: 235px; padding: 30px 26px; gap: 12px; }
  .auth-brand h1 { font-size: 46px; }
  .auth-brand p { font-size: 16px; }
  .auth-card { width: min(460px, calc(100% - 32px)); margin: 24px auto; }
  .shell { grid-template-columns: 64px minmax(0, 1fr); }
  #sidebar { display: none; }
  button[data-action="toggle-channels"].nav-toggle { display: inline-flex; }
  #sidebar.is-open { display: flex; position: fixed; z-index: 5; inset: 0 auto 0 64px; width: min(300px, calc(100vw - 64px)); box-shadow: var(--shadow); }
  #side-head { padding-right: 56px; }
  #side-head .drawer-close { display: inline-flex; }
  #members.is-open { width: min(300px, calc(100vw - 64px)); }
  #voice-dock { left: 72px; right: 8px; bottom: 8px; }
  #topbar { padding-inline: 14px; }
  #composer { padding: 12px 14px; }
  .message { padding-inline: 16px; }
  .friends-view { padding: 20px 16px 40px; }
}
@media (max-width: 480px) {
  .auth-brand { min-height: 205px; padding: 25px 22px; }
  .auth-brand h1 { font-size: 42px; }
  .auth-card { padding: 20px; }
  .shell { grid-template-columns: 56px minmax(0, 1fr); }
  #rail { padding-inline: 4px; }
  .server-btn, .home-btn { width: 44px; height: 44px; }
  #sidebar.is-open { left: 56px; width: calc(100vw - 56px); }
  #members.is-open { width: calc(100vw - 56px); }
  #topbar { min-height: 56px; }
  #topbar .inline-actions { gap: 4px; }
  #topbar .nav-toggle { width: 34px; height: 34px; padding: 0; font-size: 0; }
  #voice-dock { left: 62px; right: 6px; padding: 8px; }
  #voice-dock .dock { align-items: flex-start; flex-direction: column; gap: 6px; }
  #voice-dock .dock-actions { justify-content: space-between; width: 100%; }
  #voice-dock .icon-btn { flex: 1; }
  body:has(#voice-dock:not([hidden])) #main { padding-bottom: 116px; }
  .message { grid-template-columns: 32px minmax(0, 1fr); gap: 9px; padding-inline: 12px; }
  .message .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
  .voice-room, .empty { margin: 12px; padding: 18px; }
  .stage { margin: 12px; }
  .settings, .modal { padding: 10px; }
  .settings-card, .dialog { border-radius: 15px; }
  .code-grid { grid-template-columns: 1fr; }
  .search-dialog { max-height: calc(100dvh - 20px); padding: 16px; }
  .search-form { grid-template-columns: minmax(0, 1fr); }
  .search-results { max-height: 55dvh; }
  .message-actions { flex-wrap: wrap; }
  .friends-heading { align-items: flex-start; }
  .friends-heading .icon-text { font-size: 0; padding: 9px; }
  .friends-heading .icon-text .icon { width: 18px; height: 18px; }
  .friend-card { align-items: flex-start; flex-wrap: wrap; padding: 12px; }
  .friend-card-details { flex-basis: calc(100% - 60px); }
  .friend-card-actions { width: 100%; justify-content: flex-start; padding-left: 57px; }
  .profile-code-row .profile-code { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Server profiles */
.server-icon { display: grid; place-items: center; width: 100%; height: 100%; border-radius: inherit; overflow: hidden; color: #06281c; font-weight: 800; font-size: 18px; line-height: 1; }
.server-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.server-icon-large { width: 76px; height: 76px; flex: none; border-radius: 23px; font-size: 30px; }
.server-head-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.server-head-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-head-title .icon-btn { width: 30px; height: 30px; flex: none; }
.server-description { margin: 0; font-size: 12px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.server-settings-dialog { width: min(560px, 100%); display: grid; gap: 15px; }
.server-settings-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.server-settings-heading h2 { margin: 3px 0 0; }
.server-settings-preview { display: flex; align-items: center; gap: 17px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #ffffff08; }
.server-settings-preview strong { display: block; font-size: 19px; overflow-wrap: anywhere; }
.server-settings-preview p { margin: 5px 0 0; }
.server-settings-dialog .profile-avatar-actions { margin-bottom: -8px; }
.server-settings-dialog > .field-description { margin: 0; }
.server-settings-dialog .profile-field textarea { min-height: 90px; }
.server-settings-dialog .profile-field input[type="color"] { width: 74px; height: 44px; padding: 5px; cursor: pointer; }
.server-settings-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 3px; }
.server-save-status { flex: 1; min-width: 130px; }
