:root {
  color-scheme: dark;
  --bg-0: #121418;
  --bg-1: #191c22;
  --bg-2: #21252d;
  --bg-3: #2a2f39;
  --hover: #353b47;
  --line: #2c313b;
  --text: #e7e9ee;
  --text-2: #a4acba;
  --text-3: #76808f;
  --accent: #3ecf9b;
  --accent-ink: #062218;
  --danger: #f0616d;
  --danger-ink: #2a0508;
  --live: #f0616d;
  --warn-bg: #3a2f14;
  --warn-text: #f3d68a;
  --shadow: 0 12px 40px rgb(0 0 0 / 45%);
  --name-l: 72%;
  --avatar-l: 40%;
  --radius: 10px;
  --sidebar-w: 264px;
  --members-w: 232px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg-0: #e9ecf1;
    --bg-1: #ffffff;
    --bg-2: #f3f5f8;
    --bg-3: #e3e7ee;
    --hover: #d2d8e1;
    --line: #dadfe7;
    --text: #1b1f27;
    --text-2: #515a69;
    --text-3: #7b8494;
    --accent: #0f9d6c;
    --accent-ink: #ffffff;
    --danger: #d43c4a;
    --danger-ink: #ffffff;
    --live: #d43c4a;
    --warn-bg: #fff3cf;
    --warn-text: #6a4d00;
    --shadow: 0 12px 40px rgb(20 30 50 / 18%);
    --name-l: 34%;
    --avatar-l: 44%;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-1);
  color: var(--text);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a {
  color: var(--accent);
}

.sprite {
  display: none;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.tiny {
  width: 15px;
  height: 15px;
}

.icon.muted,
.muted {
  color: var(--text-3);
}

.icon.hide {
  display: none;
}

.spacer {
  flex: 1;
}

/* ───────────── buttons & fields ───────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-3);
  font-weight: 600;
}

.btn:hover:not(:disabled) {
  background: var(--hover);
}

.btn.primary:hover:not(:disabled),
.btn.danger:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn.primary,
.btn.primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

.btn.danger,
.btn.danger:hover:not(:disabled) {
  background: var(--danger);
  border-color: transparent;
  color: var(--danger-ink);
}

.btn.subtle {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn.subtle:hover:not(:disabled) {
  background: var(--bg-3);
  color: var(--text);
}

.btn.tiny-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-3);
  color: var(--text);
}

.channel.active .icon-btn:hover:not(:disabled) {
  background: var(--hover);
}

.icon-btn.small {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.icon-btn.small .icon {
  width: 16px;
  height: 16px;
}

.icon-btn.off,
.icon-btn.danger {
  color: var(--danger);
}

.icon-btn.on,
.icon-btn.accent {
  color: var(--accent);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field > span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-0);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.check input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.form-error {
  margin-bottom: 12px;
  color: var(--danger);
  font-size: 14px;
}

.hint {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 13px;
}

/* ───────────── login ───────────── */

.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-0);
  overflow: auto;
}

.login-card {
  width: min(380px, 100%);
  padding: 32px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-1);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 30px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 4px 0 24px;
  color: var(--text-2);
}

.login-card .btn {
  width: 100%;
  height: 44px;
}

.login-status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

/* ───────────── layout ───────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.app.members-open {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--members-w);
}

.backdrop {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-0);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  height: 52px;
  flex: none;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.channels {
  flex: 1;
  min-height: 0;
  padding: 8px 8px 16px;
  overflow-y: auto;
}

.channels h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.channel {
  display: flex;
  align-items: center;
  margin-top: 2px;
  border-radius: 8px;
  color: var(--text-2);
}

.channel:hover {
  background: var(--bg-2);
  color: var(--text);
}

.channel.active {
  background: var(--bg-3);
  color: var(--text);
}

.channel.unread {
  color: var(--text);
  font-weight: 650;
}

.channel.joined .channel-main > .icon {
  color: var(--accent);
}

.channel-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font-weight: inherit;
  text-align: left;
}

.channel-main .icon {
  width: 18px;
  height: 18px;
  color: var(--text-3);
}

.channel-name,
.vc-name,
.member-name,
.me-name,
.tile-name,
.voice-channel-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-name {
  flex: 1;
}

.channel .dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
}

.channel .count {
  flex: none;
  padding: 0 7px;
  border-radius: 9px;
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.channel.active .count {
  background: var(--bg-1);
}

.channel-del {
  margin-right: 4px;
  opacity: 0;
}

.channel:hover .channel-del,
.channel-del:focus-visible {
  opacity: 1;
}

.channel-del:hover:not(:disabled) {
  color: var(--danger);
}

@media (hover: none) {
  .channel-del {
    opacity: 0.6;
  }
}

.vc-users {
  margin: 2px 0 6px 26px;
}

.vc-user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 14px;
}

.vc-user.adjustable {
  cursor: pointer;
}

.vc-user.adjustable:hover,
.vc-user.adjustable:focus-visible {
  background: var(--bg-2);
  color: var(--text);
}

.vc-volume {
  flex: none;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tile-name.adjustable {
  cursor: pointer;
}

.tile-name.adjustable:hover,
.tile-name.adjustable:focus-visible {
  text-decoration: underline;
}

.volume-pop {
  position: fixed;
  z-index: 60;
  width: 240px;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-1);
  box-shadow: var(--shadow);
}

.volume-pop[hidden] {
  display: none;
}

.volume-pop-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.volume-pop-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.volume-pop-head output {
  flex: none;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.volume-pop input {
  display: block;
  width: 100%;
  height: 18px;
  accent-color: var(--accent);
}

.vc-name {
  flex: 1;
}

.vc-user .icon {
  color: var(--text-3);
}

.vc-user.speaking .avatar {
  box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--accent);
}

.vc-user.speaking {
  color: var(--text);
}

.live {
  flex: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--live);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.voice-panel {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 8px 8px 8px 14px;
  border-top: 1px solid var(--line);
}

.voice-panel-info {
  display: grid;
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  text-align: left;
}

.voice-status {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.voice-panel.pending .voice-status {
  color: var(--warn-text);
}

.voice-channel-name {
  color: var(--text-2);
  font-size: 13px;
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 10px 8px 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg-0);
}

.me-name {
  flex: 1;
  margin: 0 6px 0 10px;
  font-weight: 650;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--hue, 200) 48% var(--avatar-l));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}

.user-panel .avatar,
.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 12.5px;
}

.avatar.xs {
  width: 22px;
  height: 22px;
  font-size: 9.5px;
}

.avatar.xl {
  width: 84px;
  height: 84px;
  font-size: 30px;
}

/* ───────────── main column ───────────── */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  flex: none;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line);
}

.view-title {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.only-narrow {
  display: none;
}

.banner {
  flex: none;
  padding: 8px 16px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.view {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

/* ───────────── chat ───────────── */

.messages {
  flex: 1;
  min-height: 0;
  padding: 8px 0 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
}

.messages:focus-visible {
  outline: none;
}

.chat-note {
  padding: 32px 16px;
  color: var(--text-3);
  text-align: center;
}

.chat-start {
  display: grid;
  gap: 4px;
  padding: 28px 16px 12px;
  color: var(--text-2);
}

.chat-start strong {
  color: var(--text);
  font-size: 24px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.load-older {
  display: flex;
  margin: 8px auto;
}

.day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 16px 4px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.day::before,
.day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.msg {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  padding: 1px 16px 1px 12px;
}

.msg:hover {
  background: var(--bg-2);
}

.msg.head {
  margin-top: 12px;
  padding-top: 3px;
}

.msg-gutter {
  display: flex;
  justify-content: center;
}

time.msg-gutter {
  align-self: start;
  padding-top: 4px;
  color: var(--text-3);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  visibility: hidden;
}

.msg.cont:hover time.msg-gutter {
  visibility: visible;
}

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.author {
  min-width: 0;
  overflow: hidden;
  color: hsl(var(--hue, 200) 62% var(--name-l));
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-meta time {
  flex: none;
  color: var(--text-3);
  font-size: 12px;
}

.msg-text {
  grid-column: 2;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.jump {
  position: absolute;
  right: 20px;
  bottom: 92px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 17px;
  background: var(--accent);
  box-shadow: var(--shadow);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
}

.jump .icon {
  width: 16px;
  height: 16px;
}

.typing {
  flex: none;
  height: 20px;
  padding: 0 20px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex: none;
  margin: 2px 16px 16px;
  margin-bottom: max(16px, env(safe-area-inset-bottom));
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
}

.composer:focus-within {
  border-color: var(--accent);
}

.composer textarea {
  flex: 1;
  min-width: 0;
  height: 34px;
  max-height: 200px;
  padding: 6px 0;
  border: 0;
  outline: 0;
  background: none;
  line-height: 22px;
  resize: none;
}

.composer-count {
  align-self: center;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ───────────── voice stage ───────────── */

.notice {
  flex: none;
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 14px;
}

.stage {
  display: grid;
  flex: 1;
  grid-auto-rows: minmax(170px, 1fr);
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 12px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.stage.solo {
  grid-template-columns: minmax(0, 720px);
  justify-content: center;
}

.stage-empty {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  color: var(--text-3);
}

.stage.has-focus {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}

.stage.has-focus .tile {
  flex: 0 0 190px;
  height: 112px;
}

.stage.has-focus .tile.focused {
  flex: 0 0 100%;
  height: calc(100% - 124px);
  min-height: 220px;
  order: -1;
}

.stage.has-focus .tile:not(.focused) .avatar.xl {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.stage.has-focus .tile:not(.focused) .volume,
.stage.has-focus .tile:not(.focused) .volume + *,
.stage.has-focus .tile.user .tile-bar .icon.muted {
  display: none;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--bg-2);
}

.tile.user.speaking {
  border-color: var(--accent);
}

.tile.screen {
  background: #000;
  cursor: zoom-in;
}

.tile.screen.focused {
  cursor: zoom-out;
}

.tile-meter {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  max-width: calc(100% - 16px);
  padding: 2px 8px;
  overflow: hidden;
  border-radius: 6px;
  background: rgb(0 0 0 / 60%);
  color: #e6e8ec;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.tile-meter div + div {
  color: #b9c0cc;
  font-size: 11px;
  font-weight: 500;
}

.tile-meter:empty {
  display: none;
}

.tile.screen.resting video {
  opacity: 0.35;
}

.tile.screen:fullscreen {
  border: 0;
  border-radius: 0;
  cursor: default;
}

.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tile-center {
  display: grid;
  flex: 1;
  place-content: center;
  place-items: center;
  gap: 10px;
  min-height: 0;
}

.tile-state,
.tile-status {
  color: var(--text-3);
  font-size: 13px;
}

.tile-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #b9c0cc;
  pointer-events: none;
}

.tile-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 38px;
  margin-top: auto;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 600;
}

.tile.screen .tile-bar {
  background: linear-gradient(transparent, rgb(0 0 0 / 75%));
  color: #fff;
}

.tile.screen .tile-bar .icon-btn {
  color: #e6e8ec;
}

.tile.screen .tile-bar .icon-btn:hover {
  background: rgb(255 255 255 / 18%);
}

.tile-bar .icon.tiny {
  color: var(--danger);
}

.tile-bar .icon.tiny.muted {
  color: var(--text-3);
}

.volume {
  width: 84px;
  height: 18px;
  accent-color: var(--accent);
}

.voice-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex: none;
  padding: 10px 16px 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.ctl {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text);
}

.ctl .icon {
  width: 23px;
  height: 23px;
}

.ctl:hover:not(:disabled) {
  background: var(--hover);
}

.ctl.off,
.ctl.off:hover:not(:disabled) {
  background: var(--text);
  color: var(--danger);
}

.ctl.on,
.ctl.on:hover:not(:disabled) {
  background: var(--accent);
  color: var(--accent-ink);
}

.ctl.hangup,
.ctl.hangup:hover:not(:disabled) {
  width: 68px;
  border-radius: 26px;
  background: var(--danger);
  color: #fff;
}

.ctl.off:hover:not(:disabled),
.ctl.on:hover:not(:disabled),
.ctl.hangup:hover:not(:disabled) {
  filter: brightness(1.08);
}

/* ───────────── music of the call ───────────── */

.music-panel {
  flex: none;
  width: min(760px, calc(100% - 32px));
  margin: 0 auto 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-1);
}

.music-panel[hidden] {
  display: none;
}

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

.music-now .icon-btn {
  flex: none;
}

.music-info {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
}

.music-title {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-sub {
  overflow: hidden;
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-progress {
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--bg-3);
}

.music-progress[hidden] {
  display: none;
}

.music-progress div {
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 1s linear;
}

.music-volume {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.music-volume .icon {
  width: 18px;
  height: 18px;
}

.music-volume input {
  width: 96px;
  height: 18px;
  accent-color: var(--accent);
}

.music-queue {
  max-height: 132px;
  margin: 10px 0 0;
  padding: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  list-style: none;
  counter-reset: track;
}

.music-queue[hidden] {
  display: none;
}

.music-queue li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0 3px 4px;
  font-size: 14px;
  counter-increment: track;
}

.music-queue li::before {
  flex: none;
  width: 1.6em;
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  content: counter(track);
}

.music-q-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-q-meta {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-hint {
  margin: 8px 4px 0;
  color: var(--text-2);
  font-size: 13px;
}

.music-hint[hidden] {
  display: none;
}

.music-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.music-add .btn {
  flex: none;
}

.music-add input[type='url'] {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--bg-0);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.music-add input[type='url']:focus-visible {
  border-color: var(--accent);
}

@media (max-width: 800px) {
  .music-volume input {
    width: 64px;
  }

  .music-add {
    flex-wrap: wrap;
  }

  .music-add input[type='url'] {
    flex-basis: 100%;
    order: -1;
  }

  .music-add .btn {
    flex: 1;
  }
}

/* ───────────── members ───────────── */

.members {
  display: none;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
  background: var(--bg-0);
  border-left: 1px solid var(--line);
}

.app.members-open .members {
  display: block;
}

.members h2 {
  padding: 14px 8px 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 8px;
  border-radius: 8px;
}

.member:hover {
  background: var(--bg-2);
}

.member-name {
  flex: 1;
  font-weight: 600;
}

.you {
  color: var(--text-3);
  font-weight: 400;
}

/* ───────────── dialogs, overlay, toasts ───────────── */

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-1);
  box-shadow: var(--shadow);
  color: var(--text);
}

.dialog::backdrop {
  background: rgb(0 0 0 / 55%);
}

.dialog h2 {
  margin-bottom: 16px;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.dialog p {
  color: var(--text-2);
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-0);
}

.overlay-card {
  display: grid;
  gap: 12px;
  justify-items: center;
  max-width: 420px;
  text-align: center;
}

.overlay-card h2 {
  font-size: 22px;
}

.overlay-card p {
  color: var(--text-2);
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: grid;
  gap: 8px;
  justify-items: end;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--bg-3);
  box-shadow: var(--shadow);
  font-size: 14px;
  transition: opacity 0.3s;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.leaving {
  opacity: 0;
}

.noscript {
  padding: 40px;
  text-align: center;
}

/* ───────────── narrow screens ───────────── */

@media (max-width: 800px) {
  .app,
  .app.members-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .only-narrow {
    display: inline-grid;
  }

  .sidebar,
  .members {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: min(86vw, 320px);
    box-shadow: var(--shadow);
    transition: transform 0.18s ease-out;
  }

  .sidebar {
    left: 0;
    transform: translateX(-105%);
  }

  .members {
    right: 0;
    display: block;
    transform: translateX(105%);
  }

  .app.drawer-open .sidebar,
  .app.members-open .members {
    transform: none;
  }

  .app.drawer-open .backdrop,
  .app.members-open .backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    background: rgb(0 0 0 / 50%);
  }

  .stage {
    grid-auto-rows: minmax(140px, 1fr);
    padding: 10px;
  }

  .stage.has-focus .tile {
    flex-basis: 130px;
    height: 84px;
  }

  .stage.has-focus .tile.focused {
    height: calc(100% - 96px);
  }

  .volume {
    width: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ───────────── accounts & administration ───────────── */

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

.login-switch {
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
}

.app:not(.is-admin) .admin-only {
  display: none;
}

.tag {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tag.good {
  color: var(--accent);
}

.tag.bad {
  background: var(--danger);
  color: var(--danger-ink);
}

.tag.quiet {
  color: var(--text-3);
}

.msg {
  position: relative;
}

.msg-del {
  position: absolute;
  top: 2px;
  right: 12px;
  background: var(--bg-1);
  box-shadow: 0 0 0 1px var(--line);
  opacity: 0;
}

.msg:hover .msg-del,
.msg-del:focus-visible {
  opacity: 1;
}

.msg-del:hover:not(:disabled) {
  color: var(--danger);
}

@media (hover: none) {
  .msg-del {
    opacity: 0.6;
  }
}

.section-title {
  margin: 22px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
}

.dialog-head + section .section-title {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.dialog-actions.start {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 4px;
}

.danger-text,
.btn.subtle.danger-text {
  color: var(--danger);
}

.form-error.good {
  color: var(--accent);
}

.dialog.wide {
  width: min(720px, calc(100vw - 32px));
}

.search-results {
  display: grid;
  gap: 2px;
  max-height: min(52vh, 460px);
  margin: 0 0 12px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.search-results:empty {
  display: none;
}

.search-hit {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.search-hit:hover,
.search-hit:focus-visible {
  background: var(--bg-2);
}

.search-meta {
  overflow: hidden;
  color: var(--text-3);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-meta strong {
  color: var(--text);
}

.search-text {
  overflow-wrap: anywhere;
}

.search-text mark {
  padding: 0 1px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: inherit;
}

.settings-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-tab {
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.settings-tab:hover {
  background: var(--bg-2);
  color: var(--text);
}

.settings-tab.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
}

/* Every page is as tall as the longest one is likely to be, so the dialog does not jump between them. */
.settings-panels {
  min-height: 400px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}

.settings-panel > :first-child {
  margin-top: 0;
}

.settings-panel .check + .field,
.settings-panel .hint + .check {
  margin-top: 12px;
}

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

.dialog-actions.settings-logout {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-row input {
  flex: 1;
  min-width: 0;
  height: 18px;
  accent-color: var(--accent);
}

.field > .range-row,
.range-row output {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.range-row output {
  flex: none;
  width: 3.5em;
  text-align: right;
}

@media (max-width: 800px) {
  .settings-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .settings-tabs {
    flex-direction: row;
    overflow-x: auto;
  }

  .settings-tab {
    flex: none;
    white-space: nowrap;
  }

  .settings-panels {
    min-height: 0;
    max-height: none;
  }

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

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-head h2 {
  margin-bottom: 0;
}

.invite-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 8px;
}

.invite-form .field {
  flex: 1 1 150px;
  margin-bottom: 0;
}

.invite-form .btn {
  height: 42px;
}

.admin-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.admin-empty {
  color: var(--text-3);
  font-size: 14px;
}

.invite-row,
.account-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}

.invite-row.fresh {
  border-color: var(--accent);
}

.invite-link {
  flex: 1 1 220px;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-0);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.invite-meta {
  flex: 1 1 100%;
  color: var(--text-3);
  font-size: 12.5px;
}

.account-info {
  display: grid;
  gap: 3px;
  flex: 1 1 140px;
  min-width: 0;
}

.account-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-text);
}

.admin-notice .hint {
  flex: 1 1 100%;
  margin-top: 0;
  color: inherit;
  opacity: 0.85;
}

.secret {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-0);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  user-select: all;
}

.section-title + .hint {
  margin: 0 0 14px;
}

/* ───────────── replies, edits, reactions, images, mentions ───────────── */

.msg-body {
  min-width: 0;
}

.msg-tools {
  position: absolute;
  top: -14px;
  right: 12px;
  z-index: 1;
  display: flex;
  gap: 1px;
  padding: 2px;
  border-radius: 9px;
  background: var(--bg-1);
  box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgb(0 0 0 / 18%);
  opacity: 0;
  pointer-events: none;
}

.msg.head .msg-tools {
  top: -10px;
}

.msg:hover .msg-tools,
.msg:focus-within .msg-tools {
  opacity: 1;
  pointer-events: auto;
}

.msg-tools .msg-del {
  position: static;
  background: none;
  box-shadow: none;
  opacity: 1;
}

/* Touch screens have no hover: tapping a message shows its buttons. */
@media (hover: none) {
  .msg-tools,
  .msg:focus-within .msg-tools {
    display: none;
  }

  .msg.show-tools .msg-tools {
    position: static;
    display: flex;
    grid-column: 2;
    justify-self: start;
    margin: 4px 0 2px;
    opacity: 1;
    pointer-events: auto;
  }

  .msg.show-tools {
    background: var(--bg-2);
  }
}

.msg.mentions-me {
  background: color-mix(in srgb, var(--warn-bg) 55%, transparent);
  box-shadow: inset 3px 0 0 var(--warn-text);
}

.msg.editing,
.msg.replying {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.msg.flash {
  animation: flash 1.2s ease-out;
}

@keyframes flash {
  from {
    background: color-mix(in srgb, var(--accent) 30%, transparent);
  }
}

.mention {
  padding: 0 3px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.mention.me {
  background: color-mix(in srgb, var(--warn-text) 28%, transparent);
  color: var(--warn-text);
}

.edited {
  color: var(--text-3);
  font-size: 11.5px;
  user-select: none;
}

.msg-reply {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-bottom: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.msg-reply:hover .msg-reply-text {
  color: var(--text);
}

.msg-reply .icon {
  flex: none;
  color: var(--text-3);
}

.msg-reply .author {
  flex: none;
  max-width: 40%;
  font-weight: 600;
}

.msg-reply-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px;
}

.msg-file {
  display: block;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-3);
  cursor: zoom-in;
}

.msg-file img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-file.unsized {
  min-width: 64px;
  min-height: 64px;
}

.msg-file.unsized img {
  width: auto;
  height: auto;
  max-width: min(400px, 100%);
  max-height: 300px;
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 2px;
}

.reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.reaction:hover {
  border-color: var(--text-3);
}

.reaction.mine {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
}

.reaction-emoji {
  font-size: 15px;
  line-height: 1;
}

.reaction.add {
  padding: 0 6px;
  opacity: 0;
}

.msg:hover .reaction.add,
.reaction.add:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .reaction.add {
    opacity: 1;
  }
}

.emoji-picker {
  position: fixed;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(6, 36px);
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-1);
  box-shadow: var(--shadow);
}

.emoji-picker[hidden] {
  display: none;
}

.emoji {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.emoji:hover,
.emoji:focus-visible {
  background: var(--hover);
}

/* the composer and what sits on top of it */

.composer-wrap {
  position: relative;
  flex: none;
  margin: 2px 16px 16px;
  margin-bottom: max(16px, env(safe-area-inset-bottom));
}

.composer-wrap .composer {
  margin: 0;
  padding-left: 6px;
}

.compose-context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -6px;
  padding: 6px 8px 12px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 13px;
}

.compose-context[hidden],
.attachments[hidden],
.mention-popup[hidden],
.drop-hint[hidden] {
  display: none;
}

.compose-context-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-context-text strong {
  color: var(--text);
}

.compose-context-quote {
  margin-left: 8px;
  color: var(--text-3);
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  list-style: none;
}

.attachment {
  position: relative;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg-3);
}

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

.attachment.uploading img {
  opacity: 0.45;
}

.attachment-status {
  position: absolute;
  inset: auto 0 0;
  padding: 3px 4px;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  font-size: 11px;
  text-align: center;
}

.attachment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  background: var(--bg-1);
  box-shadow: 0 0 0 1px var(--line);
}

.drop-hint {
  position: absolute;
  inset: 8px;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-1) 86%, transparent);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
}

.mention-popup {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 20;
  max-height: 264px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-1);
  box-shadow: var(--shadow);
  list-style: none;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  cursor: pointer;
}

.mention-item.active,
.mention-item:hover {
  background: var(--hover);
}

.mention-item-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-item-note {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12px;
}

/* unread mentions, offline members */

.channel .badge {
  flex: none;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.member.clickable {
  cursor: pointer;
}

.member.offline .avatar,
.member.offline .member-name {
  opacity: 0.5;
}

.member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* image viewer, sign-in language switch */

.dialog.image-dialog {
  width: auto;
  max-width: min(96vw, 1400px);
  padding: 10px;
}

.image-dialog img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  margin: 0 auto;
  border-radius: 8px;
  cursor: zoom-out;
}

.image-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.image-bar .btn {
  text-decoration: none;
}

.image-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-lang {
  margin: 10px 0 0;
  font-size: 13px;
  text-align: center;
}

/* ───────────── profile pictures and status ───────────── */

.avatar {
  position: relative;
  overflow: hidden;
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.lg {
  width: 64px;
  height: 64px;
  font-size: 23px;
}

.avatar.group {
  background: var(--bg-3);
  color: var(--text-2);
}

.avatar-wrap {
  position: relative;
  display: inline-grid;
  flex: none;
}

.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg-0);
  border-radius: 50%;
  background: var(--text-3);
}

.avatar.xs + .status-dot {
  width: 10px;
  height: 10px;
}

.status-dot.online {
  background: var(--accent);
}

.status-dot.idle {
  background: #e3a72f;
}

.status-dot.dnd {
  background: var(--danger);
}

.status-dot.offline {
  background: var(--text-3);
}

.status-dot.inline {
  position: static;
  display: inline-block;
  margin-right: 8px;
  border: 0;
  width: 10px;
  height: 10px;
}

.me-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  margin-right: 4px;
  padding: 2px 6px 2px 2px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  text-align: left;
}

.me-box:hover {
  background: var(--bg-2);
}

.me-text,
.member-text {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.me-box .me-name {
  margin: 0;
}

.me-note,
.member-note {
  min-width: 0;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member {
  height: auto;
  min-height: 44px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.profile-edit {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0 12px;
}

.profile-edit-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dialog.profile-dialog {
  width: min(360px, calc(100vw - 32px));
}

.profile-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.profile-card .avatar-wrap {
  margin-bottom: 6px;
}

.profile-name {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
}

.profile-status {
  display: flex;
  align-items: center;
  color: var(--text-2);
  font-size: 14px;
}

.profile-note {
  overflow-wrap: anywhere;
  color: var(--text);
}

.profile-card .dialog-actions {
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
}

.author.clickable,
.msg-gutter.clickable {
  cursor: pointer;
}

.author.clickable:hover {
  text-decoration: underline;
}

/* ───────────── private conversations ───────────── */

.channel.dm .channel-main {
  height: 38px;
}

.channel.dm .channel-main .icon.call-on {
  color: var(--accent);
}

.channel-empty {
  padding: 4px 8px 0;
  color: var(--text-3);
  font-size: 13px;
}

.people-list {
  display: grid;
  gap: 2px;
  max-height: min(46vh, 340px);
  margin: 0 0 12px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.person:hover {
  background: var(--bg-2);
}

.person input {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--accent);
}

.person:has(input:disabled) {
  opacity: 0.5;
  cursor: default;
}

.msg.sys {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 6px 20px;
  color: var(--text-2);
  font-size: 14px;
}

.msg.sys .icon {
  color: var(--accent);
}

.msg.sys time {
  color: var(--text-3);
  font-size: 12px;
}

.ring {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-1));
}

.ring[hidden] {
  display: none;
}

.ring-text {
  flex: 1;
  min-width: 120px;
  font-weight: 650;
}

.banner.update {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-1));
  color: var(--text);
}

/* ───────────── camera ───────────── */

.tile video.tile-cam {
  object-fit: cover;
  background: #000;
}

.tile video.tile-cam.mirror {
  transform: scaleX(-1);
}

.tile video[hidden] {
  display: none;
}

.tile.user.has-cam {
  cursor: zoom-in;
}

.tile.user.has-cam.focused {
  cursor: zoom-out;
}

.tile.user.has-cam.focused video.tile-cam {
  object-fit: contain;
}

.tile.user.has-cam .tile-bar {
  margin-top: auto;
  background: linear-gradient(transparent, rgb(0 0 0 / 65%));
  color: #fff;
}

.tile.user.has-cam .tile-center {
  visibility: hidden;
}

/* ───────────── message formatting ───────────── */

.msg-text code,
.compose-context-quote code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.9em;
}

.msg-text pre.code-block {
  max-width: 100%;
  margin: 4px 0;
  padding: 8px 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-0);
  white-space: pre;
}

.msg-text pre.code-block code {
  padding: 0;
  background: none;
  font-size: 13px;
}

.msg-text blockquote {
  margin: 2px 0;
  padding: 1px 0 1px 10px;
  border-left: 3px solid var(--text-3);
  color: var(--text-2);
}

.spoiler {
  border-radius: 4px;
  background: var(--text-3);
  cursor: pointer;
}

.spoiler .spoiler-text {
  visibility: hidden;
}

.spoiler.shown {
  background: color-mix(in srgb, var(--text-3) 22%, transparent);
  cursor: auto;
}

.spoiler.shown .spoiler-text {
  visibility: visible;
}

.dialog .hint + .field {
  margin-top: 12px;
}

/* the formatting buttons that show over selected text in the message box */

.format-bar {
  position: absolute;
  z-index: 25;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-1);
  box-shadow: var(--shadow);
}

.format-bar[hidden] {
  display: none;
}

.format-bar button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
}

.format-bar button:hover {
  background: var(--hover);
  color: var(--text);
}

.format-bar button[aria-pressed='true'] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.format-bar .icon {
  width: 17px;
  height: 17px;
}

/* a copy of the message box that is never seen: it tells where on the screen the selected text is */
.input-mirror {
  position: fixed;
  top: 0;
  left: 0;
  visibility: hidden;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
}
