:root {
  color-scheme: dark;
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --bg-deep: #121214;
  --bg-rail: #121214;
  --bg-side: #121214;
  --bg-main: #1a1a1e;
  --bg-raised: #242429;
  --bg-hover: #242429;
  --bg-input: #121214;
  --text: #f2f3f5;
  --text-muted: #b5bac1;
  --text-faint: #949ba4;
  --brand: #5865f2;
  --brand-hover: #4752c4;
  --green: #23a559;
  --yellow: #f0b232;
  --red: #da373c;
  --border: rgba(255, 255, 255, 0.08);
  --rail-width: 72px;
  --sidebar-width: 264px;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #1a1b1e transparent;
}

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

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

*::-webkit-scrollbar-thumb {
  min-height: 40px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: #1a1b1e;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #111214;
  background-clip: padding-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #00a8fc;
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr) 240px;
  grid-template-rows: 32px minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
}

.app-titlebar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 100px;
  font-size: 12px;
  font-weight: 650;
}

.app-wordmark {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
}

.workspace-title,
.server-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.user-panel {
  position: absolute;
  z-index: 4;
  left: 8px;
  bottom: 8px;
  width: calc(var(--rail-width) + var(--sidebar-width) - 16px);
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
}

.profile-tip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 8;
  display: grid;
  width: min(270px, calc(100vw - 24px));
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid rgba(88, 101, 242, 0.7);
  border-radius: 8px;
  background: #2b2d31;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 12px;
}

.profile-tip::after {
  position: absolute;
  right: 24px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(88, 101, 242, 0.7);
  border-bottom: 1px solid rgba(88, 101, 242, 0.7);
  background: #2b2d31;
  content: "";
  transform: rotate(45deg);
}

.profile-tip > span {
  color: var(--text-muted);
  line-height: 1.35;
}

.profile-tip-close {
  position: absolute;
  top: 5px;
  right: 7px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.profile-tip-close:hover {
  color: var(--text);
}

.profile-tip-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.profile-tip-actions button {
  padding: 5px 8px;
  border: 0;
  border-radius: 4px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.profile-tip-actions button:hover {
  background: var(--brand-hover);
}

.app-shell:not(.voice-active) .voice-connection-bar {
  display: none;
}

.channels-toggle,
.navigation-scrim {
  display: none;
}

.server-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  background: var(--bg-rail);
  border-right: 1px solid rgba(0, 0, 0, 0.18);
}

.server-list {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.server-avatar {
  display: block;
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  object-fit: cover;
}

.participant-avatar img,
.message-avatar img,
.profile-avatar img {
  display: block;
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
  aspect-ratio: 1;
  border-radius: 50% !important;
  object-fit: cover;
}

/* User avatars stay circular; only server icons use rounded squares. */
.participant-avatar,
.message-avatar,
.profile-avatar {
  overflow: hidden;
  border-radius: 50%;
}

.me-profile-button {
  padding: 0;
  border: 0;
  cursor: pointer;
}

.me-profile-button:hover {
  filter: brightness(1.12);
}

.me-avatar {
  display: grid;
  overflow: hidden;
  place-items: center;
  background: #5865f2;
}

.me-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.me-dialog {
  color-scheme: light;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #fff;
  border-radius: 16px;
  background: #f5f6f7;
  color: #303943;
  box-shadow: 0 24px 80px #0009;
}
.me-dialog::backdrop { background: #000b; }
.me-dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.me-dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px; border-bottom: 1px solid #dfe3e6; background: #fff;
}
.me-dialog-header .eyebrow { color: #77818b; font-size: 10px; letter-spacing: .12em; }
.me-dialog-header h2 { margin: 4px 0 0; font-size: 25px; letter-spacing: -.6px; }
.me-dialog-header .icon-button { display: grid; place-items: center; width: 36px; height: 36px; color: #65717c; }
.me-dialog-header .icon-button:hover { background: #e8edef; }
.me-editor { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 0; overflow-y: auto; }
.me-preview-stage {
  display: flex; min-height: 460px; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; border-right: 1px solid #dfe3e6;
  background: radial-gradient(ellipse at 50% 42%, #fff 0%, #edf1f2 65%, #e5eaed 100%);
}
.me-preview.me-avatar {
  width: 210px; height: 328px; overflow: visible; border-radius: 0; background: none;
}
.me-preview-label { margin: 12px 0 5px; color: #39444e; font-size: 19px; font-weight: 700; }
.me-preview-caption { color: #7a858e; font-size: 12px; }
.me-workbench { min-width: 0; background: #f8f9fa; }
.me-tabs {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 16px;
  background: #fff; border-bottom: 1px solid #dfe3e6;
}
.me-tab {
  border: 1px solid transparent; border-radius: 7px; padding: 8px 10px;
  background: transparent; color: #67737d; font-size: 12px; font-weight: 650; cursor: pointer;
}
.me-tab:hover { background: #edf1f3; }
.me-tab[aria-selected="true"] { background: #e3f5f6; border-color: #64bbc4; color: #16717e; }
.me-feature-panel { padding: 20px 24px; }
.me-feature-panel fieldset { padding: 0; margin: 0 0 20px; border: 0; min-width: 0; }
.me-feature-panel legend { padding: 0; margin-bottom: 12px; color: #414d58; font-size: 13px; font-weight: 700; }
.me-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.me-choice {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; padding: 6px; border: 2px solid #dfe4e7; border-radius: 9px;
  background: #fff; color: #626f79; cursor: pointer; font-size: 11px;
}
.me-choice:hover { border-color: #9ac9cd; }
.me-choice:has(input:checked) { border-color: #2b9dab; background: #eefafb; color: #1d7380; box-shadow: 0 0 0 1px #2b9dab; }
.me-choice:has(input:focus-visible) { outline: 2px solid #126fce; outline-offset: 3px; }
.me-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.me-choice-art { display: block; width: 68px; height: 68px; overflow: hidden; }
.me-choice-art svg { display: block; width: 100%; height: 100%; }
.me-choice > span:last-child { margin-top: 5px; }
.me-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.me-swatch { width: 34px; height: 34px; min-width: 34px; padding: 3px; border-radius: 50%; }
.me-swatch > span { display: block; width: 24px; height: 24px; margin: 0 !important; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px #0001; }
.me-color-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; color: #626f79; font-size: 12px; }
.me-color-field input { width: 42px; height: 32px; padding: 2px; border: 1px solid #cbd4da; border-radius: 6px; background: #fff; cursor: pointer; }
.me-range-field { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 14px; align-items: center; margin-top: 16px; color: #626f79; font-size: 12px; }
.me-range-field input { width: 100%; accent-color: #2b9dab; }
.me-dialog-actions {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 12px;
  padding: 16px 24px; border-top: 1px solid #dfe3e6; background: #fff;
}
.me-use-toggle { display: flex; align-items: center; gap: 8px; color: #626f79; font-size: 12px; cursor: pointer; }
.me-use-toggle input { width: 18px; height: 18px; accent-color: #278c99; }
.me-save-actions { display: flex; gap: 8px; }
.me-dialog-actions .button { min-height: 38px; padding: 8px 20px; background: #e9edef; color: #47545e; border: 0; border-radius: 7px; }
.me-dialog-actions .button.primary { background: #278c99; color: #fff; }
.me-dialog-actions .button:hover { filter: brightness(.95); }
@media (max-width: 640px) {
  .me-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
  .me-dialog form { max-height: calc(100dvh - 18px); }
  .me-dialog-header { padding: 14px 18px; }
  .me-dialog-header h2 { font-size: 21px; }
  .me-editor { grid-template-columns: 1fr; }
  .me-preview-stage { min-height: 220px; padding: 12px; border-right: 0; border-bottom: 1px solid #dfe3e6; }
  .me-preview.me-avatar { width: 115px; height: 180px; }
  .me-preview-label { margin: 3px 0 0; font-size: 14px; }
  .me-preview-caption { display: none; }
  .me-tabs { padding: 10px; gap: 2px; }
  .me-tab { padding: 7px 9px; font-size: 11px; }
  .me-feature-panel { padding: 16px; }
  .me-choice-art { width: 58px; height: 58px; }
  .me-dialog-actions { padding: 12px; gap: 8px; }
  .me-dialog-actions .button { padding: 8px 12px; }
  .me-use-toggle { font-size: 11px; }
}

.server-icon {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #313338;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  place-items: center;
  overflow: visible;
  cursor: pointer;
  text-decoration: none;
  transition: border-radius 160ms ease, background 160ms ease, transform 160ms ease;
}

.server-icon:hover,
.server-icon.active {
  border-radius: 16px;
  background: var(--brand);
  transform: translateY(-1px);
}

.server-icon.active {
  box-shadow: none;
}

.server-icon.add-server {
  color: var(--green);
}

.server-icon.add-server:hover {
  color: white;
  background: var(--green);
}

.invite-dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-main);
  color: var(--text);
  box-shadow: 0 20px 60px #0008;
}
.invite-dialog::backdrop { background: #000a; }
.dev-stats { display: grid; grid-template-columns: 1fr auto; gap: 12px 20px; }
.dev-stats dt { color: var(--text-muted); }
.dev-stats dd { margin: 0; text-align: right; }
.dev-visitors { display: grid; gap: 10px; max-height: 240px; overflow-y: auto; }
.dev-visitor { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.dev-visitor code { overflow-wrap: anywhere; font-size: 12px; color: var(--text-muted); user-select: all; }
.dev-visitor button { justify-self: start; }
.invite-dialog h2 { margin: 0 0 16px; font-size: 22px; }
.invite-dialog p { color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.invite-dialog .invite-notice { padding: 12px; border-left: 3px solid var(--yellow); background: #f0b23212; color: var(--text); }
.invite-dialog .invite-hint { font-size: 12px; }
.invite-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.invite-actions a { display: inline-flex; align-items: center; text-decoration: none; }

.server-icon:disabled {
  cursor: default;
  opacity: 0.65;
}

.rail-divider {
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: #35363c;
}

.channel-sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  background: var(--bg-side);
  padding-bottom: 76px;
}

.voice-active .channel-sidebar,
.voice-active .server-rail {
  padding-bottom: 126px;
}

.server-header,
.chat-header {
  height: 48px;
  flex: 0 0 48px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.server-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  cursor: default;
  color: var(--text);
}

.channel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 8px;
}

.channel-group + .channel-group {
  margin-top: 22px;
}

.channel-group h2,
.member-group h3 {
  margin: 0 8px 5px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.channel-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
}

.channel-row.selected {
  background: rgba(78, 80, 88, 0.6);
  color: var(--text);
}

.channel-hash,
.voice-glyph {
  color: var(--text-faint);
  font-size: 20px;
  font-weight: 500;
}

.sidebar-voice-members {
  display: grid;
  gap: 2px;
  margin: 4px 0 0 28px;
}

.sidebar-person {
  overflow: hidden;
  padding: 4px 6px;
  color: var(--text-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-person.speaking {
  color: var(--green);
}

.voice-connection-bar {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  background: #232428;
  color: var(--text-muted);
  border-top: 1px solid rgba(0, 0, 0, 0.18);
}

.voice-connection-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.voice-connection-copy > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.voice-connection-copy strong,
.voice-connection-copy span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-connection-copy strong {
  color: var(--green);
  font-size: 12px;
}

.voice-connection-copy span:last-child {
  font-size: 10px;
}

.voice-connection-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-faint);
}

.voice-connection-dot.connected {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(35, 165, 89, 0.16);
}

.voice-connection-dot.connecting {
  background: var(--yellow);
}

.voice-connection-dot.error {
  background: var(--red);
}

.voice-connection-copy strong:not(:empty) {
  color: var(--text-muted);
}

.voice-connection-dot.connected + div strong {
  color: var(--green);
}

.profile-bar {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 53px;
  padding: 7px 8px;
  background: #232428;
  border-top: 1px solid rgba(0, 0, 0, 0.18);
}

.profile-avatar,
.participant-avatar,
.system-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-weight: 750;
}

.profile-avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.profile-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.profile-copy strong,
.profile-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.profile-name-input {
  width: 100%;
  min-width: 0;
  padding: 2px 4px;
  border: 1px solid #5865f2;
  border-radius: 3px;
  outline: none;
  background: #1e1f22;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.profile-copy span {
  color: var(--text-muted);
  font-size: 11px;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.profile-action {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
}

.profile-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.profile-action:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.profile-action.muted,
.profile-action.disconnect-action:hover:not(:disabled) {
  color: #ed4245;
}

.profile-action[aria-pressed="true"] {
  background: #ed4245;
  color: white;
}

.profile-action:disabled {
  cursor: default;
  opacity: 0.45;
}

.voice-channel-list,
.text-channel-list,
.category-channel-list {
  display: grid;
  gap: 2px;
}

.channel-category-title {
  margin: 16px 8px 5px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.channel-category-title:first-child {
  margin-top: 0;
}

.voice-channel-list .empty-list {
  margin: 7px 8px;
}

.chat-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--bg-main);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}

.header-channel-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  object-fit: contain;
  opacity: 0.8;
}

.header-title {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  gap: 12px;
}

.header-title strong,
.header-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-title span {
  color: var(--text-muted);
  font-size: 12px;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 210px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot,
.mini-dot {
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-faint);
}

.status-dot {
  width: 8px;
  height: 8px;
}

.mini-dot {
  width: 7px;
  height: 7px;
}

.connection-pill.connected .status-dot,
.mini-dot.connected {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(35, 165, 89, 0.15);
}

.connection-pill.connecting .status-dot,
.mini-dot.connecting {
  background: var(--yellow);
}

.connection-pill.error .status-dot,
.mini-dot.error {
  background: var(--red);
}

.icon-button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(78, 80, 88, 0.45);
}

.members-toggle {
  display: none;
  padding: 6px 9px;
}

.chat-scroll {
  min-height: 180px;
  flex: 1;
  overflow-y: auto;
  padding: 28px clamp(20px, 4vw, 48px) 22px;
}

.room-intro,
.system-message,
.consent-notice {
  display: none;
}

.message-list {
  display: grid;
  align-content: start;
  gap: 16px;
  max-width: 900px;
  min-height: 100%;
  margin: 0 auto 0 0;
}

.chat-message {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
}

.message-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-weight: 750;
}

.message-content {
  margin: 3px 0 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-content a {
  color: #00a8fc;
  text-decoration: none;
}

.message-content a:hover {
  text-decoration: underline;
}

.message-image {
  display: block;
  width: auto;
  max-width: min(480px, 100%);
  height: auto;
  max-height: 420px;
  margin-top: 8px;
  border-radius: 6px;
  object-fit: initial;
  background: transparent;
}

.message-composer {
  display: flex;
  gap: 8px;
  margin: 0 clamp(20px, 4vw, 48px) 20px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg-raised);
}

.message-composer input {
  min-width: 0;
  flex: 1;
  height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.message-composer button {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-size: 18px;
}

.message-composer button:hover {
  color: var(--text);
}

.room-intro {
  max-width: 820px;
  margin: max(0px, 5vh) auto 0 0;
}

.room-icon {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50%;
  background: #41434a;
  color: white;
  font-size: 34px;
}

.room-intro h1 {
  margin: 14px 0 7px;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.1;
}

.room-intro p,
.system-message p,
.consent-notice p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.system-message {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  margin-top: 34px;
}

.system-avatar {
  width: 40px;
  height: 40px;
  background: #eb459e;
}

.message-heading {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0;
}

.message-heading strong {
  color: var(--text);
}

.message-heading span {
  color: var(--text-faint);
  font-size: 11px;
}

.consent-notice,
.error-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 13px 14px;
  border-radius: 8px;
}

.consent-notice {
  border: 1px solid rgba(240, 178, 50, 0.35);
  background: rgba(240, 178, 50, 0.08);
}

.notice-icon {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: #1e1f22;
  font-weight: 800;
}

.consent-notice p {
  margin-top: 3px;
  font-size: 13px;
}

.error-banner {
  position: relative;
  z-index: 5;
  justify-content: space-between;
  margin: 10px 18px 0;
  border: 1px solid rgba(218, 55, 60, 0.7);
  background: #4b2529;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  color: #ffd7d8;
  font-size: 13px;
}

.error-banner[hidden],
[hidden] {
  display: none !important;
}

.error-banner button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.voice-controls {
  display: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 16px clamp(20px, 4vw, 48px) 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.26);
  background: #2b2d31;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
}

.voice-controls.access-gate {
  display: block;
  padding-block: 12px;
}

.voice-controls.access-gate > :not(.join-fields),
.voice-controls.access-gate .join-fields > :first-child {
  display: none;
}

.voice-controls.access-gate .join-fields {
  display: block;
  margin: 0;
}

.voice-heading,
.discord-state,
.primary-actions,
.voice-actions,
.level-row {
  display: flex;
  align-items: center;
}

.voice-heading {
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.voice-heading h2,
.member-header h2 {
  margin: 0;
  font-size: 18px;
}

.discord-state {
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.join-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 13px;
}

.join-fields label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.join-fields input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
}

.join-fields input:disabled {
  color: var(--text-faint);
  opacity: 0.7;
}

.primary-actions,
.voice-actions {
  gap: 8px;
  margin-top: 12px;
}

.button,
.control-button {
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 650;
  transition: background 120ms ease, transform 80ms ease, opacity 120ms ease;
}

.button:active:not(:disabled),
.control-button:active:not(:disabled) {
  transform: translateY(1px);
}

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

.button {
  padding: 8px 16px;
}

.button.primary {
  background: var(--brand);
  color: white;
}

.button.primary:hover:not(:disabled) {
  background: var(--brand-hover);
}

.button.danger {
  background: rgba(218, 55, 60, 0.15);
  color: #ffb6b8;
}

.button.danger:hover:not(:disabled) {
  background: var(--red);
  color: white;
}

.control-button {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  background: #383a40;
  color: var(--text-muted);
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.control-button:hover:not(:disabled) {
  background: #404249;
  color: var(--text);
}

.control-button[aria-pressed="true"] {
  background: rgba(35, 165, 89, 0.18);
  color: #65e59b;
}

.control-button.muted,
.control-button.hold-button[aria-pressed="true"] {
  background: rgba(218, 55, 60, 0.2);
  color: #ffb6b8;
}

.audio-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 13px;
}

.level-row {
  gap: 9px;
  color: var(--text-muted);
  font-size: 11px;
}

.level-row > span {
  flex: 0 0 72px;
}

.meter {
  height: 5px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: #1e1f22;
}

.meter-fill {
  display: block;
  width: var(--level, 0%);
  height: 100%;
  border-radius: inherit;
  transition: width 70ms linear;
}

.meter-fill.local {
  background: var(--green);
}

.meter-fill.remote {
  background: var(--brand);
}

.voice-hint {
  margin: 11px 0 0;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.4;
}

.member-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-side);
}

.member-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 11px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.16);
}

.panel-close {
  display: none;
  width: 32px;
  height: 32px;
  font-size: 21px;
}

.member-group {
  padding: 13px 8px 5px;
}

.participant-list {
  display: grid;
  gap: 2px;
}

.participant {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}

.participant:hover {
  background: rgba(78, 80, 88, 0.3);
  color: var(--text);
}

.participant-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  background: #4e5058;
  font-size: 11px;
  transition: border-color 100ms ease;
}

.participant.speaking .participant-avatar {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(35, 165, 89, 0.18);
}

.participant-copy {
  min-width: 0;
}

.participant-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.participant-name strong {
  overflow: hidden;
  color: inherit;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-tag {
  flex: 0 0 auto;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--brand);
  color: white;
  font-size: 8px;
  font-weight: 800;
}

.participant-meta {
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-state {
  display: flex;
  gap: 5px;
  color: var(--text-faint);
  font-size: 11px;
}

.participant-meter {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--bg-side);
  border-radius: 50%;
  background: color-mix(in srgb, var(--green) var(--level, 0%), #4e5058);
}

.empty-list,
.inline-error {
  margin: 8px;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.4;
}

.inline-error {
  color: #ffb6b8;
}

.member-footer {
  margin-top: auto;
  padding: 15px 16px;
  color: var(--text-faint);
  font-size: 11px;
}

.panel-scrim {
  display: none;
}

.server-rail {
  gap: 8px;
  padding: 12px 0 76px;
  overflow-y: auto;
  background: var(--bg-rail);
}

.server-icon {
  background: var(--bg-raised);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.channel-sidebar,
.member-panel {
  background: var(--bg-side);
}

.server-header,
.chat-header {
  height: 48px;
  flex-basis: 48px;
}

.server-header {
  padding: 0 18px;
  font-size: 15px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.channel-scroll {
  padding: 16px 8px;
}

.channel-category-title {
  margin: 18px 8px 6px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.channel-row {
  min-height: 34px;
  padding: 6px 10px;
  color: #b5bac1;
  font-size: 15px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}

.channel-row:hover {
  background: var(--bg-hover);
  color: #dbdee1;
}

.channel-row.selected {
  background: #2c2c32;
  color: #f2f3f5;
}

.channel-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  object-fit: contain;
  opacity: 0.8;
}

.channel-row.selected .channel-icon,
.channel-row:hover .channel-icon {
  opacity: 1;
}

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

.voice-channel-members {
  display: grid;
  gap: 2px;
  margin: -2px 8px 7px 38px;
}

.voice-channel-member {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 2px 4px;
  border-radius: 4px;
  color: #949ba4;
  font-size: 12px;
  line-height: 22px;
}

.voice-channel-member:hover {
  background: #35373c;
  color: #dbdee1;
}

.voice-channel-member > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-channel-member-avatar {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.voice-channel-member-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voice-channel-preview {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  flex: 0 1 auto;
  gap: 4px;
  margin-left: auto;
  padding-left: 6px;
}

.voice-preview-names {
  max-width: 120px;
  overflow: hidden;
  color: #949ba4;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-preview-avatar {
  display: block;
  width: 20px;
  height: 20px;
  margin-left: -4px;
  border: 2px solid #2b2d31;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  object-fit: cover;
  text-align: center;
}

.voice-preview-avatar:first-child {
  margin-left: 0;
}

.voice-preview-count {
  margin-left: 4px;
  color: #b5bac1;
  font-size: 11px;
  font-weight: 650;
}

.chat-panel {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-top: 0;
  border-bottom: 0;
  border-radius: 8px 0 0 0;
}

.chat-header {
  gap: 12px;
  padding: 0 16px;
  background: var(--bg-main);
}

.header-title strong {
  font-size: 16px;
  font-weight: 700;
}

.connection-pill {
  padding: 6px 10px;
  background: var(--bg-side);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-scroll {
  min-height: 0;
  padding: 16px 0;
}

.message-list {
  max-width: none;
  gap: 16px;
}

.chat-message {
  padding: 2px 16px;
  transition: background 120ms ease;
}

.chat-message:hover {
  background: rgba(4, 4, 5, 0.08);
}

.message-heading {
  min-height: 18px;
}

.message-heading strong {
  font-size: 16px;
}

.message-content {
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.375;
}

.message-composer {
  margin: 0 16px 16px;
  max-width: none;
  min-height: 56px;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--bg-raised);
}

.message-composer button img,
.icon-button img,
.error-banner button img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.message-composer button {
  display: grid;
  width: 32px;
  place-items: center;
}

.member-panel {
  border-left: 1px solid rgba(4, 4, 5, 0.2);
}

.member-header {
  min-height: 48px;
  padding: 10px 16px;
}

.member-group {
  padding: 16px 8px 4px;
}

.member-group h3 {
  font-size: 12px;
  text-transform: none;
}

.participant-meta:empty {
  display: none;
}

.profile-bar,
.voice-connection-bar {
  background: transparent;
  border-top: 0;
}

.profile-bar {
  min-height: 56px;
  padding: 8px 10px;
}

.profile-action {
  border-radius: 6px;
}

.profile-action img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.profile-action:hover:not(:disabled) {
  background: #35373c;
}

.members-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.members-toggle[aria-expanded="true"] {
  color: var(--text);
  background: var(--bg-hover);
}

@media (min-width: 881px) {
  .members-hidden {
    grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
  }

  .members-hidden .member-panel {
    display: none;
  }
}

.server-icon {
  position: relative;
}

.server-icon.active {
  transform: none;
  box-shadow: none;
}

.server-icon.active::before {
  position: absolute;
  top: 6px;
  left: -14px;
  z-index: 2;
  width: 4px;
  height: 32px;
  border-radius: 0 5px 5px 0;
  background: #ffffff;
  content: "";
}

@media (max-width: 1120px) {
  .app-shell {
    --rail-width: 64px;
    --sidebar-width: 220px;
  }

  .header-title span {
    display: none;
  }
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
  }

  .member-panel {
    position: fixed;
    z-index: 20;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 86vw);
    transform: translateX(100%);
    box-shadow: -16px 0 34px rgba(0, 0, 0, 0.35);
    transition: transform 180ms ease;
  }

  .members-open .member-panel {
    transform: translateX(0);
  }

  .panel-close,
  .members-toggle {
    display: inline-grid;
    place-items: center;
  }

  .panel-scrim {
    position: fixed;
    z-index: 19;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.52);
  }

  .members-open .panel-scrim {
    display: block;
  }

  .connection-pill {
    max-width: 140px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 32px minmax(0, 1fr) auto;
  }

  .server-rail,
  .channel-sidebar {
    position: fixed;
    top: 32px;
    bottom: 0;
    z-index: 21;
    visibility: hidden;
  }

  .server-rail {
    left: 0;
    width: var(--rail-width);
  }

  .channel-sidebar {
    left: var(--rail-width);
    width: var(--sidebar-width);
    padding-bottom: 16px;
  }

  .channels-open .server-rail,
  .channels-open .channel-sidebar {
    visibility: visible;
  }

  .channels-toggle {
    display: grid;
    padding: 6px;
    place-items: center;
  }

  .channels-open .navigation-scrim {
    display: block;
    position: fixed;
    z-index: 20;
    inset: 32px 0 0;
    border: 0;
    background: rgba(0, 0, 0, 0.6);
  }

  .user-panel {
    position: static;
    grid-row: 3;
    width: auto;
    margin: 0 8px 8px;
  }

  .chat-panel {
    grid-row: 2;
    border-radius: 0;
  }

  .chat-header {
    padding: 0 10px;
  }

  .header-title span,
  .header-channel-icon {
    display: none;
  }

  .connection-pill {
    max-width: 118px;
  }

  .connection-pill #connectionStatus {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-scroll {
    padding: 16px 0 12px;
  }

  .message-composer {
    margin: 0 10px 10px;
  }

  .room-intro {
    margin-top: 0;
  }

  .system-message {
    margin-top: 24px;
  }

  .voice-connection-bar {
    padding: 7px 10px;
  }

  .voice-controls {
    max-height: 57dvh;
    overflow-y: auto;
    margin: 0;
    padding: 13px 16px;
  }

  .join-fields,
  .audio-levels {
    grid-template-columns: 1fr;
  }

  .voice-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .hold-button {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
