:root {
  --bg-darkest: #1e1f22;
  --bg-dark: #2b2d31;
  --bg: #313338;
  --bg-hover: #3a3c42;
  --bg-active: #404249;
  --bg-input: #383a40;
  --text: #dbdee1;
  --text-strong: #f2f3f5;
  --text-muted: #949ba4;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --link: #00a8fc;
  --danger: #f23f43;
  --success: #23a55a;
  --warning: #f0b232;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* While the server's theme stylesheet loads (theme.ts). */
.theme-loading #root {
  visibility: hidden;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, 'Segoe UI', 'Noto Sans', sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-darkest);
  border: none;
  border-radius: 4px;
  padding: 10px;
  outline: none;
}

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

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

/* ---------- Login ---------- */

.login-screen {
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--accent);
}

.login-card {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 32px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);
}

.login-card h1 {
  margin: 0 0 8px;
  text-align: center;
  color: var(--text-strong);
  font-size: 24px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.login-card label input {
  font-size: 15px;
  font-weight: 400;
  text-transform: none;
  color: var(--text);
}

.login-card label .muted {
  text-transform: none;
  font-weight: 400;
}

.primary {
  background: var(--accent);
  color: white;
  padding: 10px;
  border-radius: 4px;
  font-weight: 600;
}
.primary:hover {
  background: var(--accent-hover);
}
.primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.link {
  color: var(--link);
  font-size: 14px;
}

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

/* ---------- Layout ---------- */

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 240px 1fr 240px;
}

.sidebar,
.members {
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-header,
.chat-header {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-weight: 600;
  color: var(--text-strong);
  border-bottom: 1px solid var(--bg-darkest);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 8px 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.icon {
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  padding: 0 4px;
}
.icon:hover {
  color: var(--text-strong);
}

.ghost {
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 4px;
}
.ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ---------- Channels ---------- */

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}
/* A voice channel's row and its members stack in a column as wide as the
   list, so a long name is cut short rather than widening the list. */
.voice-channel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.channel:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.channel.active {
  background: var(--bg-active);
  color: var(--text-strong);
}

.channel-input {
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 4px;
}

.hash {
  color: var(--text-muted);
  font-size: 20px;
  font-weight: 400;
  margin-right: 6px;
}
.channel .hash {
  margin-right: 0;
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #232428;
}

.user-panel-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.conn {
  font-size: 12px;
  font-weight: 400;
}
.conn-online {
  color: var(--success);
}
.conn-connecting {
  color: var(--warning);
}
.conn-offline {
  color: var(--danger);
}

/* ---------- Chat ---------- */

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

/* Drag handles on the panels' inner edges, over the bezels. */
.app {
  position: relative;
}
.panel-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 30;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}
.panel-resizer.sidebar {
  left: calc(var(--sidebar-w, 260px) - 4px);
}
.panel-resizer.members {
  right: calc(var(--members-w, 232px) - 4px);
}
.panel-resizer:hover,
.panel-resizer.dragging {
  background: linear-gradient(90deg, transparent 3px, var(--accent) 3px 5px, transparent 5px);
  opacity: 0.6;
}
body.resizing-panel {
  cursor: col-resize;
  user-select: none;
}
/* Narrow windows and phones use the fixed layout. */
@media (max-width: 900px) {
  .panel-resizer {
    display: none;
  }
}

.error-banner {
  background: var(--danger);
  color: white;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.message-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.channel-start {
  padding: 16px;
}
.channel-start h2 {
  margin: 0 0 4px;
  color: var(--text-strong);
}
.channel-start p {
  margin: 0;
}

.message {
  display: flex;
  gap: 16px;
  padding: 4px 16px;
  margin-top: 12px;
  position: relative;
}
.message.grouped {
  margin-top: 0;
  padding-top: 2px;
  padding-bottom: 2px;
  padding-left: 72px;
}
.message:hover {
  background: #2e3035;
}

.message-hover-time {
  display: none;
  position: absolute;
  left: 0;
  width: 64px;
  text-align: right;
  font-size: 11px;
  line-height: 22px;
  color: var(--text-muted);
}
.message.grouped:hover .message-hover-time {
  display: block;
}

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

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.author {
  font-weight: 600;
  color: var(--text-strong);
}

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

.message-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.composer {
  padding: 0 16px 24px;
}

.composer textarea {
  width: 100%;
  resize: none;
  background: var(--bg-input);
  border-radius: 8px;
  padding: 11px 16px;
  max-height: 240px;
  display: block;
}

/* ---------- Members ---------- */

.members {
  padding: 0 8px;
  overflow-y: auto;
}

.member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text);
}
.member:hover {
  background: var(--bg-hover);
}
.member.offline {
  opacity: 0.4;
}

.avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  color: white;
  user-select: none;
}
.member .avatar,
.user-panel .avatar {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

/* A profile picture fills the avatar's circle. */
.avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.profile-picture {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-picture .avatar {
  width: 48px;
  height: 48px;
  font-size: 20px;
}

.presence-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 3px solid var(--bg-dark);
  box-sizing: content-box;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 200px 1fr;
  }
  .members {
    display: none;
  }
}

/* ---------- Step 2: actions, editing, attachments, embeds ---------- */

.small {
  font-size: 12px;
}

.badge {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

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

.chat {
  position: relative;
}

.message-actions {
  display: none;
  position: absolute;
  top: -14px;
  right: 16px;
  background: var(--bg);
  border: 1px solid var(--bg-darkest);
  border-radius: 6px;
  padding: 2px;
  z-index: 1;
}
.message:hover .message-actions {
  display: flex;
}
.message-actions button {
  display: grid;
  place-items: center;
  padding: 5px;
  border-radius: 4px;
  color: var(--text-muted);
}
.message-actions button:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
}
.message-actions button.danger:hover {
  color: var(--danger);
}

.message.editing {
  background: #2e3035;
}
.message-body {
  flex: 1;
}

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

.edit-box textarea {
  width: 100%;
  resize: none;
  background: var(--bg-input);
  border-radius: 8px;
  padding: 10px 14px;
  display: block;
  margin-top: 4px;
}
.edit-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0;
}
.edit-hint button {
  color: var(--link);
  padding: 0;
}
.edit-hint button:hover {
  text-decoration: underline;
}

.attachment {
  margin-top: 6px;
  max-width: 520px;
}
.attachment-image {
  display: block;
  max-width: min(100%, 400px);
  max-height: 300px;
  border-radius: 6px;
  cursor: zoom-in;
}
.attachment-video {
  display: block;
  max-width: 100%;
  max-height: 340px;
  border-radius: 6px;
  background: black;
}

.file-card {
  background: var(--bg-dark);
  border: 1px solid var(--bg-darkest);
  border-radius: 6px;
  padding: 10px 12px;
  width: 420px;
  max-width: 100%;
}
.file-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-card audio {
  width: 100%;
  margin-top: 8px;
}
.file-icon {
  color: var(--text-muted);
  display: grid;
}
.file-info {
  flex: 1;
  min-width: 0;
}
.file-name {
  color: var(--link);
  text-align: left;
  padding: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.file-name:hover {
  text-decoration: underline;
}
.file-size {
  font-size: 12px;
}

.embed {
  margin-top: 6px;
  max-width: 440px;
  background: var(--bg-dark);
  border-left: 4px solid var(--bg-darkest);
  border-radius: 4px;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.embed-site {
  font-size: 12px;
  color: var(--text-muted);
}
.embed-title {
  font-weight: 600;
}
.embed-description {
  font-size: 14px;
  color: var(--text);
  white-space: pre-line;
}
.embed-image {
  margin-top: 6px;
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
  cursor: zoom-in;
  align-self: flex-start;
}

/* Composer with uploads */

.composer-box {
  display: flex;
  align-items: flex-start;
  background: var(--bg-input);
  border-radius: 8px;
}
.composer-box textarea {
  flex: 1;
  background: transparent;
  padding-left: 4px;
}
.composer-attach {
  padding: 10px 8px 10px 14px;
}

.pending-uploads {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  background: var(--bg-input);
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid var(--bg);
}
.pending-uploads + .composer-box {
  border-radius: 0 0 8px 8px;
}
.pending {
  position: relative;
  flex-shrink: 0;
  width: 160px;
  background: var(--bg-dark);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pending.failed {
  outline: 1px solid var(--danger);
}
.pending img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
}
.pending .file-icon {
  height: 90px;
  place-items: center;
}
.pending-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-status {
  font-size: 12px;
  min-height: 16px;
}
.pending-status .error {
  font-size: 12px;
}
.pending-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
}
.pending-remove:hover {
  color: var(--danger);
}
.progress {
  height: 6px;
  margin-top: 5px;
  border-radius: 3px;
  background: var(--bg-darkest);
  overflow: hidden;
}
.progress div {
  height: 100%;
  background: var(--accent);
  transition: width 0.15s;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgb(88 101 242 / 0.85);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 600;
  color: white;
  pointer-events: none;
  z-index: 10;
}

/* Modal, lightbox, context menu */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.7);
  display: grid;
  place-items: center;
  z-index: 100;
}
.modal {
  width: 440px;
  max-width: calc(100vw - 32px);
  /* Never taller than the window: a long dialog (Settings) scrolls inside. */
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border-radius: 8px;
  padding: 20px;
}
.modal h2 {
  margin: 0 0 8px;
  color: var(--text-strong);
  font-size: 20px;
}
.modal p {
  margin: 0 0 12px;
}
.modal-quote {
  background: var(--bg-dark);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 12px;
  max-height: 160px;
  overflow: hidden;
  white-space: pre-wrap;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-actions .primary {
  padding: 8px 18px;
}
.primary.danger {
  background: var(--danger);
}
.primary.danger:hover {
  background: #c03537;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 100;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 90vw;
  max-height: 82vh;
  cursor: default;
}
.lightbox-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  cursor: default;
}
.lightbox-actions a,
.lightbox-actions button {
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.context-menu {
  position: fixed;
  min-width: 180px;
  background: #111214;
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 8px 16px rgb(0 0 0 / 0.4);
  z-index: 50;
}
.context-menu-title {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
}
.context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: 3px;
  font-size: 14px;
}
.context-menu button:hover {
  background: var(--accent);
  color: white;
}

/* ---------- Step 3: voice ---------- */

.channel-icon {
  display: grid;
  color: var(--text-muted);
}
.channel.joined {
  color: var(--text-strong);
}
.channel.joined .channel-icon {
  color: var(--success);
}

.voice-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 30px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-muted);
}
.voice-member:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.voice-member .avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 0.1s;
}
.voice-member.speaking .avatar {
  box-shadow: 0 0 0 2px var(--bg-dark), 0 0 0 4px var(--success);
}
.voice-member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-member-name.unreachable {
  color: var(--danger);
}
.voice-member-icons {
  display: flex;
  color: var(--text-muted);
}
.voice-member-icons svg {
  width: 16px;
  height: 16px;
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
}
.volume-row input {
  flex: 1;
  accent-color: var(--accent);
}
.volume-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 6px;
  min-height: 24px;
}
.volume-foot button {
  font-size: 12px;
  padding: 2px 6px;
}

.voice-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 8px 12px;
  background: #232428;
  border-bottom: 1px solid var(--bg-dark);
}
.voice-bar-info {
  flex: 1;
  min-width: 0;
}
.voice-bar-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}
.voice-bar-status.warn {
  color: var(--warning);
}
.voice-bar-status.bad {
  color: var(--danger);
}
.voice-bar-channel {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.icon-button:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
}
.icon-button.active-off {
  color: var(--danger);
}

.user-panel {
  gap: 4px;
}
.user-panel .avatar {
  margin-right: 4px;
}
.user-panel-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 8px 0 20px;
}
.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}
.settings-form select,
.perm-add select {
  font: inherit;
  font-size: 14px;
  text-transform: none;
  font-weight: 400;
  color: var(--text);
  background: var(--bg-darkest);
  border: none;
  border-radius: 4px;
  padding: 10px;
}
.modal-actions.spread {
  justify-content: space-between;
}
.danger-text {
  color: var(--danger);
}

/* ---------- Step 4: push-to-talk ---------- */

.ptt-pill {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--bg-active);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}
.ptt-pill.on {
  background: var(--success);
  color: white;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}
.segmented {
  display: flex;
  background: var(--bg-darkest);
  border-radius: 4px;
  padding: 3px;
}
.segmented button {
  flex: 1;
  padding: 7px;
  border-radius: 3px;
  font-size: 14px;
  color: var(--text-muted);
}
.segmented button.selected {
  background: var(--bg-active);
  color: var(--text-strong);
}
.keybind {
  text-align: left;
  background: var(--bg-darkest);
  border-radius: 4px;
  padding: 10px;
  font-size: 14px;
}
.keybind.recording {
  outline: 2px solid var(--accent);
  color: var(--text-muted);
}
.hint {
  margin: 0;
}

/* ---------- Step 5: screen sharing ---------- */

.live-pill {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
button.live-pill:disabled {
  opacity: 0.6;
  cursor: default;
}
button.live-pill:not(:disabled):hover {
  filter: brightness(1.15);
}

.modal:has(.source-grid) {
  width: 720px;
}
.share-portal-hint {
  margin: 12px 0 18px;
}
.share-tabs {
  margin: 8px 0 12px;
}
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding: 2px;
}
.source {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border-radius: 6px;
  background: var(--bg-dark);
  outline: 2px solid transparent;
  text-align: left;
}
.source:hover {
  background: var(--bg-hover);
}
.source.selected {
  outline-color: var(--accent);
}
.source > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: black;
  border-radius: 4px;
}
.source-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  min-width: 0;
}
.source-name img {
  width: 16px;
  height: 16px;
}
.source-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 8px;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: black;
}
.stage-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 16px;
  background: var(--bg-darkest);
}
.stage-hint {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
@media (max-width: 700px) {
  .stage-hint {
    display: none;
  }
}
.stage-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--bg-active);
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.stage-back:hover,
.stage-back.active {
  background: var(--accent);
  color: white;
}
.chat-header-feeds {
  margin-left: auto;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .chat-header-feeds ~ .chat-header-members {
    margin-left: 4px;
  }
}
@media (max-width: 360px) {
  .chat-header-feeds span {
    display: none;
  }
}
.stage-title {
  flex: 1;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-strong);
}
.stage-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.stage-volume input {
  width: 100px;
  accent-color: var(--accent);
}
.stage-video {
  position: relative;
  flex: 1;
  min-height: 0;
}
.stage-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage-waiting {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

/* ---------- Cameras and the call view ---------- */

.icon-button.active-on {
  color: var(--success);
}
button.voice-bar-info {
  text-align: left;
  border-radius: 4px;
}
button.voice-bar-info:hover .voice-bar-channel {
  color: var(--text);
  text-decoration: underline;
}
.camera-badge {
  display: flex;
  flex-shrink: 0;
  color: var(--text-muted);
}
.camera-badge svg {
  width: 16px;
  height: 16px;
}
button.camera-badge:not(:disabled):hover {
  color: var(--text-strong);
}
button.camera-badge:disabled {
  cursor: default;
}

/* ---------- Step 6: unread, mentions, typing, updates ---------- */

.channel .channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel.unread {
  color: var(--text-strong);
  font-weight: 600;
}
/* A light at the end of a text channel with new messages (mentions show their count instead). */
.channel-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-strong);
}
.channel-delete {
  display: none;
  place-items: center;
  margin-left: auto;
  color: var(--text-muted);
  border-radius: 3px;
}
.channel-delete svg {
  width: 14px;
  height: 14px;
}
.channel-delete:hover {
  color: var(--danger);
}
.channel:hover .channel-delete {
  display: grid;
}
/* No hover on touch screens, so always show it there. */
@media (hover: none) {
  .channel .channel-delete {
    display: grid;
  }
}

.mention-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.mention {
  padding: 0 2px;
  border-radius: 3px;
  background: rgb(88 101 242 / 0.3);
  color: #c9cdfb;
  font-weight: 500;
}
.message.mentioned {
  background: rgb(240 178 50 / 0.08);
  box-shadow: inset 2px 0 0 var(--warning);
}
.message.mentioned:hover {
  background: rgb(240 178 50 / 0.12);
}

.new-divider {
  display: flex;
  align-items: center;
  margin: 12px 16px 0;
  height: 0;
  border-top: 1px solid var(--danger);
  position: relative;
}
.new-divider span {
  position: absolute;
  right: 0;
  top: -9px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}

.composer {
  position: relative;
  padding-bottom: 4px;
}
.typing-line {
  height: 20px;
  padding: 0 16px 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.suggest {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 100%;
  margin-bottom: 8px;
  padding: 6px;
  background: var(--bg-dark);
  border-radius: 8px;
  box-shadow: 0 8px 16px rgb(0 0 0 / 0.3);
  z-index: 5;
}
.suggest-title {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}
.suggest button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: 4px;
}
.suggest button.selected {
  background: var(--bg-active);
  color: var(--text-strong);
}

.update-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--success);
  color: white;
  font-size: 14px;
}
.update-banner button {
  padding: 4px 10px;
  border-radius: 4px;
  background: rgb(0 0 0 / 0.2);
  font-weight: 600;
}
.update-banner .ghost {
  background: none;
  color: white;
}

.settings-form label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  text-transform: none;
  font-weight: 400;
  font-size: 14px;
  color: var(--text);
}
.settings-form label.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.sensitivity {
  position: relative;
  height: 22px;
}
.sensitivity-track {
  position: absolute;
  inset: 7px 0;
  border-radius: 4px;
  background: var(--bg-darkest);
  overflow: hidden;
}
.sensitivity-below {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(240, 178, 50, 0.35);
}
.sensitivity-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--text-muted);
  opacity: 0.7;
  transition: width 40ms linear;
}
.sensitivity-fill.open {
  background: var(--success);
  opacity: 1;
}
.sensitivity input[type='range'] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  appearance: none;
}
.sensitivity input[type='range']::-webkit-slider-runnable-track {
  background: transparent;
  height: 22px;
}
.sensitivity input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 22px;
  border-radius: 3px;
  background: var(--text-strong);
  box-shadow: 0 0 0 1px var(--bg-darkest);
  cursor: pointer;
}
.sensitivity.disabled .sensitivity-fill.open {
  background: var(--text-muted);
  opacity: 0.7;
}
.sensitivity.disabled input[type='range']::-webkit-slider-thumb {
  display: none;
}

.update-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.secondary {
  background: var(--bg-active);
  color: var(--text-strong);
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}
.secondary:hover:not(:disabled) {
  filter: brightness(1.15);
}
.secondary:disabled {
  opacity: 0.6;
  cursor: default;
}
.error-text {
  color: var(--danger);
}

/* ---------- Web and phones ---------- */

html,
body,
#root {
  /* The visible height on phones, excluding the browser's own bars. */
  height: 100dvh;
}

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

.composer-send {
  display: none;
  padding: 10px 14px 10px 8px;
}

.mobile-only {
  display: none;
}

/* Touch screens: no hover, so actions show on tap and stay big enough to hit. */
@media (hover: none) {
  .composer-send {
    display: block;
  }
  .message.tapped .message-actions {
    display: flex;
  }
  .message-actions button {
    padding: 8px;
  }
  .message-hover-time {
    display: none;
  }
}

/* Phones: one panel at a time (channels, chat or members), like Discord's app. */
@media (max-width: 700px) {
  .app {
    display: block;
    position: relative;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  .sidebar,
  .chat,
  .members {
    height: 100%;
  }
  .app:not(.panel-nav) .sidebar,
  .app:not(.panel-chat) .chat,
  .app:not(.panel-members) .members {
    display: none;
  }
  /* aside: the members panel's drag handle shares the class. */
  .app.panel-members aside.members {
    display: flex;
  }
  .mobile-only {
    display: grid;
  }

  .chat-header {
    gap: 4px;
    padding: 0 8px;
  }
  .chat-header .hash {
    margin-left: 4px;
    margin-right: 2px;
  }
  .chat-header-members {
    margin-left: auto;
  }
  .members-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    flex-shrink: 0;
    padding: 0 0 0 8px;
    font-weight: 600;
    color: var(--text-strong);
  }

  /* Taller rows to tap. */
  .channel {
    padding: 10px 8px;
  }
  .member {
    padding: 8px;
  }
  .icon-button {
    width: 40px;
    height: 40px;
  }
  .user-panel {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .composer {
    padding: 0 8px;
  }
  /* The typing line sits under the composer, above the home indicator. */
  .typing-line {
    height: auto;
    min-height: 20px;
    padding: 2px 12px calc(4px + env(safe-area-inset-bottom));
  }
  .message {
    gap: 12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .message.grouped {
    padding-left: 64px;
  }
  /* 16px stops iOS from zooming in when a field is focused. */
  input,
  textarea,
  select {
    font-size: 16px;
  }

  .login-card {
    padding: 24px;
  }
  .lightbox img {
    max-width: 100vw;
  }
}

/* Desktop app downloads (web version) */

.download-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.download-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.download-links a.primary {
  padding: 8px 14px;
  font-size: 14px;
}
.desktop-download p {
  margin: 0;
}
.desktop-download.compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-active);
}

/* ---------- Direct messages ---------- */

.member:not(.self) {
  cursor: pointer;
}
.member .mention-badge {
  margin-left: auto;
}
.member .badge + .mention-badge {
  margin-left: 6px;
}

.dm-window {
  position: absolute;
  right: 16px;
  bottom: 80px;
  z-index: 20;
  width: 360px;
  height: min(480px, calc(100% - 140px));
  min-height: 240px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--bg-darkest);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.5);
  overflow: hidden;
}
.dm-window.minimized {
  height: auto;
  min-height: 0;
  width: 260px;
}
.dm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--bg-darkest);
  flex-shrink: 0;
}
.dm-window.minimized .dm-header {
  cursor: pointer;
  border-bottom: 0;
}
.dm-header .avatar {
  width: 32px;
  height: 32px;
  font-size: 14px;
}
.dm-header .presence-dot {
  width: 8px;
  height: 8px;
  border-width: 2px;
}
.dm-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-window .message-scroll {
  padding: 8px 0;
}
.dm-window .message {
  gap: 10px;
  padding-left: 10px;
  padding-right: 10px;
}
/* Line up with the text beside the avatar: 10px + 40px avatar + 10px gap. */
.dm-window .message.grouped {
  padding-left: 60px;
}
.dm-window .channel-start {
  padding: 8px 12px;
}
.dm-window .channel-start h2 {
  font-size: 18px;
}
.dm-window .composer {
  padding-left: 8px;
  padding-right: 8px;
}
.dm-window .typing-line {
  padding: 0 10px 4px;
}
.dm-lock {
  display: flex;
  color: var(--text-muted);
}
.dm-locked {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
.dm-locked-icon svg {
  width: 32px;
  height: 32px;
}
.dm-locked p {
  margin: 0;
}
.dm-locked .primary {
  padding: 8px 18px;
}
.dm-notice {
  margin: 0 8px 6px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--bg-dark);
  color: var(--text-muted);
  font-size: 12px;
}
.sealed-note {
  color: var(--text-muted);
  font-style: italic;
}
.modal-input {
  width: 100%;
  margin-bottom: 12px;
}
.dm-window .drop-overlay {
  font-size: 16px;
  text-align: center;
  padding: 16px;
}

.chat-header-members {
  position: relative;
}
.unread-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

/* Phones: the conversation takes over the chat panel. */
@media (max-width: 700px) {
  .dm-window:not(.minimized) {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    z-index: 40;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  .dm-window .typing-line {
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }
  .dm-window.minimized {
    right: 8px;
    bottom: 76px;
    width: 220px;
  }
  .dm-header {
    padding: 8px;
    min-height: 48px;
  }
}

.stage-header .icon-button {
  flex-shrink: 0;
}

/* Plugins (server/src/plugins.rs): a header button each, and the page over the chat. */
.chat-header-plugin {
  margin-left: 6px;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .chat-header-plugin span {
    display: none;
  }
}
.plugin-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: none;
  background: var(--bg);
}

.sfx-row.disabled {
  opacity: 0.5;
}

/* ---------- Layout shared with server themes ----------
   Structure only (sizes, spacing, grids). A server theme (theme.ts) adds its
   look on top; the plain look's colours and controls follow below. */

.tri-field {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 16px 16px 8px;
}
.tri {
  position: absolute;
  pointer-events: none;
}
.tri.dragging {
  z-index: 10;
}
.tri-field.freeform {
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.tri-field.freeform.panning {
  cursor: grabbing;
}
.tri-field.rearranging .tri-screen {
  cursor: grabbing;
}
.drop-slot {
  position: absolute;
}
.drop-slot.down {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.drop-slot.up {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.tri-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
}
.tri.down .tri-screen {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.tri.up .tri-screen {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.tri-screen {
  touch-action: none;
  user-select: none;
}
.tri-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tri.rect .tri-screen video {
  object-fit: contain;
}
.ascii-video {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  white-space: pre;
  pointer-events: none;
}
.tri-screen canvas.tube {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  visibility: hidden;
}
.tri-screen canvas.tube.ready {
  visibility: visible;
}
.tri-screen video.mirror {
  transform: scaleX(-1);
}
.tri-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tri.down .tri-empty {
  justify-content: flex-start;
  padding-top: calc(var(--w) * 0.2);
}
.tri.rect .tri-empty {
  justify-content: center;
}
.tri.up .tri-empty {
  justify-content: flex-end;
  padding-bottom: calc(var(--w) * 0.2);
}
.tri-empty .avatar {
  width: calc(var(--w) * 0.2);
  height: calc(var(--w) * 0.2);
}
.tri-picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tri-plate {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 62%;
  padding: 2px 8px;
  white-space: nowrap;
}
.tri.down .tri-plate {
  top: calc(clamp(6px, calc(var(--w) * 0.045), 18px) / 2 + 4px);
}
.tri.rect .tri-plate,
.tri.up .tri-plate {
  bottom: calc(clamp(6px, calc(var(--w) * 0.045), 18px) / 2 + 4px);
}
.tri-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.tri-plate svg {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}
.lamp {
  position: static;
  flex-shrink: 0;
  width: 0.55em;
  height: 0.55em;
}
.console {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 28px);
  height: 64px;
  flex-shrink: 0;
  padding: 0 16px;
}
@media (max-width: 700px) {
  .tri-field {
    margin: 8px 4px 4px;
  }
  .console {
    height: 48px;
  }
}
.nx {
  display: inline-flex;
  gap: 0.08em;
  vertical-align: middle;
  flex-shrink: 0;
}
.nx i {
  position: relative;
  width: 0.8em;
  height: 1.28em;
  display: grid;
  place-items: center;
}
.nx i span {
  position: relative;
}
.nx i.sep {
  width: 0.32em;
}
.lamp {
  position: static;
  display: inline-block;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
}
.tg {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 0;
  flex-shrink: 0;
}
.tg .sw {
  width: 16px;
  height: 24px;
  position: relative;
}
input.fader {
  width: 110px;
  height: 22px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  flex-shrink: 1;
  min-width: 60px;
}
.hbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 7px 9px;
}
.hbtn svg {
  width: 13px;
  height: 13px;
}
.live-pill {
  padding: 1px 5px;
}
.primary {
  padding: 10px 16px;
}
.ghost {
  padding: 9px 14px;
}
.secondary {
  padding: 8px 12px;
}
.app {
  grid-template-columns: var(--sidebar-w, 260px) minmax(0, 1fr) var(--members-w, 232px);
}
.members {
  padding: 0;
  overflow: hidden;
}
.sidebar-header,
.chat-header,
.members-header {
  height: 52px;
}
.sidebar-header {
  justify-content: space-between;
  padding: 0 12px;
}
.nameplate {
  padding: 6px 11px;
}
.section-title {
  padding: 12px 4px 4px;
}
.channel-list {
  margin: 10px;
  padding: 6px 8px 10px 28px;
}
.channel {
  position: relative;
  gap: 9px;
  padding: 5px 6px;
}
.joined-dot {
  width: 7px;
  height: 7px;
  margin-left: auto;
  flex-shrink: 0;
}
.mention-badge {
  min-width: 0;
  height: auto;
  padding: 0;
  margin-left: auto;
}
.channel-input {
  margin: 2px 0 4px;
}
.voice-member {
  gap: 8px;
  padding: 2px 6px 2px 34px;
}
.voice-member .lamp {
  width: 8px;
  height: 8px;
}
.voice-member-icons svg {
  width: 14px;
  height: 14px;
}
.camera-badge {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 16px;
}
.camera-badge svg {
  width: 12px;
  height: 12px;
}
.user-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  margin: 0 10px 10px;
  padding: 10px;
}
.voice-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 0 9px;
}
.voice-bar-info {
  display: grid;
  min-width: 0;
  text-align: left;
}
.voice-bar-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-bar-channel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ptt-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 4px;
  vertical-align: 1px;
}
.voice-ping {
  display: grid;
  justify-items: end;
  gap: 3px;
  margin-left: auto;
}
.voice-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  padding-bottom: 9px;
}
.push-button {
  display: grid;
  padding: 0;
}
.push-button.wide {
  flex: 1;
  min-width: 0;
}
.push-button.wide .face {
  overflow: hidden;
}
.push-button .face {
  height: 28px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.push-button .face svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.push-button .face .lamp {
  width: 7px;
  height: 7px;
}
.push-button:active .face {
  translate: 0 1px;
}
.leave-button {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 0;
}
.jewel-button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}
.jewel-button svg {
  width: 12px;
  height: 12px;
}
.user-panel-me {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-panel .avatar {
  width: 34px;
  height: 34px;
  margin-right: 0;
}
.user-panel-name {
  display: grid;
  /* Narrower than its text when the panel is: the lines end in an ellipsis. */
  grid-template-columns: minmax(0, 1fr);
}
.user-panel-name .conn {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.knob-button {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 0;
}
.knob-button svg {
  width: 15px;
  height: 15px;
}
.chat-header {
  gap: 10px;
}
.stage-back {
  padding: 7px 10px;
  gap: 7px;
}
.stage-back .lamp {
  width: 7px;
  height: 7px;
}
.update-banner button {
  padding: 5px 9px;
}
.chat > .message-scroll {
  margin: 14px 14px 0;
}
.mention {
  padding: 0 4px;
}
.composer {
  padding: 10px 14px 0;
}
.composer-attach svg {
  width: 26px;
  height: 26px;
  padding: 4px;
}
.composer-send {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  margin-right: 8px;
  padding: 6px 9px;
}
.composer-send svg {
  width: 13px;
  height: 13px;
}
.typing-line {
  padding: 4px 18px;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.members-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  flex-shrink: 0;
}
.members-title {
  margin-right: auto;
}
.members-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 10px;
  padding: 2px 8px 10px;
}
.members-list .section-title {
  padding: 12px 2px 6px;
}
.member {
  gap: 10px;
  padding: 4px 2px;
  min-width: 0;
}
.member-avatar {
  position: relative;
  flex-shrink: 0;
}
.member .avatar {
  width: 30px;
  height: 30px;
}
.member-avatar .lamp {
  position: absolute;
  right: -3px;
  bottom: -3px;
}
.member-text {
  display: grid;
  min-width: 0;
  flex: 1;
}
.member-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  padding: 1px 4px;
  margin-left: 6px;
  vertical-align: 2px;
}
.modal {
  padding: 22px 26px 20px;
}
.modal.wide {
  width: 780px;
  max-width: calc(100vw - 32px);
}
.modal > h2:first-child {
  display: table;
  margin: 0 auto 16px;
  padding: 7px 14px;
}
.settings-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  align-items: start;
}
.settings-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.settings-section {
  padding-bottom: 6px;
}
.settings-col .settings-section ~ .settings-section {
  margin-top: 8px;
}
.sfx-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sfx-row > svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.sfx-row input.fader {
  flex: 1;
}
.update-row .nx {
  margin-left: 4px;
}
.segmented {
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.segmented button {
  padding: 9px 12px;
}
.download-links a.secondary {
  padding: 8px 12px;
}
.download-links svg {
  width: 14px;
  height: 14px;
}
.share-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.golive {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.golive i {
  width: 30px;
  height: 30px;
}
.golive:disabled {
  cursor: default;
}
.volume-row input.fader {
  flex: 1;
}
.stage-header {
  min-height: 52px;
  gap: 10px;
  padding: 6px 12px 6px 16px;
}
.stage-title {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-hint {
  flex: 1;
}
.stage-spacer {
  flex: 1;
}
.stage-volume {
  gap: 8px;
}
.stage-volume > svg {
  width: 16px;
  height: 16px;
}
.stage-volume input.fader {
  width: 110px;
}
/* Bezels (features.bezels) are SVG over each screen. */
.bezel-frame {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}
.tri.rect .tri-screen video {
  padding: var(--b);
}
.tri.down .tri-plate {
  top: calc(var(--b) + 4px);
}
.tri.rect .tri-plate,
.tri.up .tri-plate {
  bottom: calc(var(--b) + 4px);
}
.tri-plate .lamp {
  width: 0.55em;
  height: 0.55em;
}
.stage-video {
  display: grid;
  place-items: center;
  margin: 16px;
}
.stream-screen {
  position: relative;
}
.stage-video .stream-screen video {
  position: absolute;
  object-fit: contain;
}
.stream-ascii {
  position: absolute;
  overflow: hidden;
}
.console {
  height: 80px;
  gap: clamp(10px, 2vw, 22px);
  padding: 0 18px;
}
.running-time {
  padding: 6px 8px;
}
.console-switches {
  display: flex;
  gap: 14px;
}
.tube-strength {
  display: grid;
  justify-items: center;
  gap: 2px;
}
.tube-strength input.fader {
  width: 80px;
  min-width: 56px;
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .settings-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .share-options {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .user-panel {
    margin: 0 8px calc(8px + env(safe-area-inset-bottom));
    padding-bottom: 10px;
  }
  .channel-list {
    margin: 8px;
  }
  .channel {
    padding: 9px 6px;
  }
  .members-list {
    margin: 8px;
  }
  .chat > .message-scroll {
    margin: 8px 8px 0;
  }
  .composer {
    padding: 8px 8px 0;
  }
  .hbtn span {
    display: none;
  }
  .stage-volume input.fader {
    width: 70px;
  }
  .console {
    height: 60px;
    padding: 0 10px;
    gap: 10px;
    justify-content: space-between;
  }
  .stage-video {
    margin: 8px;
  }
  .modal {
    padding: 18px 16px 16px;
  }
}
/* Phones: the call console's switches smaller and closer together. */
@media (max-width: 440px) {
  .console-switches {
    gap: 6px;
  }
  :where(:root:not([data-base='none'])) .console .tg {
    padding: 4px 6px;
    font-size: 11px;
  }
}
.chat-header-scratch {
  margin-left: auto;
  flex-shrink: 0;
}
.chat-header-scratch ~ .chat-header-feeds {
  margin-left: 0;
}
@media (max-width: 520px) {
  .chat-header-scratch span {
    display: none;
  }
}
.board-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.board-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  text-align: left;
}
.board-card-preview {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.board-card-preview svg {
  width: 100%;
  height: 100%;
}
.board-pinboard .board-card-preview svg {
  transform: scale(0.7);
}
.scratch {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.scratch-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  min-height: 52px;
}
.scratch-board-name {
  white-space: nowrap;
}
.scratch-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  align-self: stretch;
}
.scratch-empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
}
.scratch-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  margin-bottom: -9px;
}
.scratch-tab {
  display: flex;
  align-items: baseline;
  gap: 6px;
  max-width: 180px;
  padding: 6px 12px 9px;
  flex-shrink: 0;
}
.scratch-tab.active {
  padding-bottom: 13px;
}
.scratch-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scratch-tab.new {
  padding: 5px 9px 8px;
  align-items: center;
}
.scratch-tab.new svg {
  width: 16px;
  height: 16px;
}
.scope-selector {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: center;
}
.scope-step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
}
.scope-step svg {
  width: 14px;
  height: 14px;
}
.scope-readout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  min-width: 0;
}
.scope-title {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scope-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 36px;
  z-index: 40;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.scope-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 4px 8px;
}
.scratch-pin-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: center;
  min-width: 0;
}
.scratch-pin-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scratch-body {
  flex: 1;
  min-height: 0;
  display: flex;
}
.scratch-tools {
  width: 100px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 10px;
  overflow-y: auto;
}
.tool-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.tool {
  display: grid;
  place-items: center;
  height: 36px;
}
.tool svg {
  width: 20px;
  height: 20px;
}
.tool-group.swatches {
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
}
.swatch {
  position: relative;
  width: 22px;
  height: 22px;
  cursor: pointer;
}
.swatch.custom input {
  position: absolute;
  inset: 0;
  cursor: pointer;
}
.tool-group.size {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
}
.tool-group.size input {
  width: 100%;
  padding: 0;
}
.scratch-stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  container-type: size;
  display: grid;
  place-items: center;
  padding: 18px;
}
.scratch-sheet {
  position: relative;
  width: min(100cqw, 100cqh * 16 / 9);
  aspect-ratio: 16 / 9;
}
.scratch-sheet canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.scratch-live {
  cursor: crosshair;
  touch-action: none;
}
.scratch-live.tool-text {
  cursor: text;
}
.scratch-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.scratch-text {
  position: absolute;
  min-width: 160px;
  padding: 0;
  resize: none;
  overflow: hidden;
}
.scratch-present {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 60%;
  pointer-events: none;
}
.scratch-present-user {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 2px;
}
.scratch-present-user .avatar {
  width: 20px;
  height: 20px;
}
.board-phosphor .scratch-sheet {
  overflow: hidden;
}
.scratch-wall {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  align-content: start;
  gap: 34px 26px;
  padding: 34px 28px;
}
.wall-sheet {
  position: relative;
}
.wall-sheet:hover {
  z-index: 1;
}
.wall-sheet-face {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 8px 8px 10px;
  text-align: left;
}
.wall-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}
.wall-sheet-title {
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wall-pin {
  position: absolute;
  z-index: 1;
  top: -8px;
  left: calc(50% - 8px);
  width: 16px;
  height: 16px;
}
.wall-unpin {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  place-items: center;
  width: 26px;
  height: 26px;
}
.wall-sheet:hover .wall-unpin {
  display: grid;
}
@media (hover: none) {
  .wall-unpin {
    display: grid;
  }
}
.wall-new {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  min-height: 160px;
}
@media (max-width: 700px) {
  .board-picker {
    grid-template-columns: minmax(0, 1fr);
  }
  .scratch-body {
    flex-direction: column-reverse;
  }
  .scratch-tools {
    width: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 8px;
  }
  .tool-group {
    grid-template-columns: none;
    grid-auto-flow: column;
  }
  .tool-group.swatches {
    grid-template-columns: none;
  }
  .tool {
    width: 38px;
  }
  .tool-group.size {
    grid-auto-flow: column;
    align-items: center;
  }
  .tool-group.size input {
    width: 90px;
  }
  .scratch-stage {
    padding: 8px;
  }
  .scratch-board-name {
    display: none;
  }
}

/* ---------- The plain look ----------
   Themes build on it, unless theirs is a complete look of its own
   ("base": "none" in theme.json, which theme.ts marks as data-base). :where
   keeps the specificity unchanged. */

/* Nixie readouts are plain numbers until a theme lights them. */
:where(:root:not([data-base='none'])) .nx {
  display: inline-flex;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
:where(:root:not([data-base='none'])) .nx,
:where(:root:not([data-base='none'])) .nx i {
  gap: 0;
}
:where(:root:not([data-base='none'])) .nx i {
  display: inline;
  width: auto;
  height: auto;
  font-style: normal;
}

:where(:root:not([data-base='none'])) .lamp {
  display: inline-block;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-active);
}
:where(:root:not([data-base='none'])) .lamp.amber {
  background: var(--warning);
}
:where(:root:not([data-base='none'])) .lamp.green {
  background: var(--success);
}
:where(:root:not([data-base='none'])) .lamp.red {
  background: var(--danger);
}
:where(:root:not([data-base='none'])) .lamp.flicker {
  animation: plain-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes plain-pulse {
  to {
    opacity: 0.4;
  }
}

/* Switches are plain toggle buttons. */
:where(:root:not([data-base='none'])) .tg {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  flex-shrink: 0;
}
:where(:root:not([data-base='none'])) .tg .sw {
  display: none;
}
:where(:root:not([data-base='none'])) .tg:hover:not(:disabled) {
  color: var(--text-strong);
  background: var(--bg-active);
}
:where(:root:not([data-base='none'])) .tg.on {
  color: #fff;
  background: var(--accent);
}
:where(:root:not([data-base='none'])) .user-panel-me .tg {
  padding: 4px 6px;
  font-size: 11px;
}
:where(:root:not([data-base='none'])) .user-panel-me .tg:not(.on) {
  color: #fff;
  background: var(--danger);
}
:where(:root:not([data-base='none'])) .user-panel-me .tg.on {
  color: var(--text-muted);
  background: var(--bg-hover);
}

:where(:root:not([data-base='none'])) input.fader {
  width: 110px;
  min-width: 60px;
  flex-shrink: 1;
  margin: 0;
  padding: 0;
  background: none;
  accent-color: var(--accent);
}
:where(:root:not([data-base='none'])) input[type='range'] {
  accent-color: var(--accent);
}

:where(:root:not([data-base='none'])) .hbtn {
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
}
:where(:root:not([data-base='none'])) .hbtn:hover,
:where(:root:not([data-base='none'])) .hbtn.on {
  color: var(--text-strong);
  background: var(--bg-active);
}

:where(:root:not([data-base='none'])) .live-pill {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--danger);
  border-radius: 3px;
}

:where(:root:not([data-base='none'])) .primary {
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
}
:where(:root:not([data-base='none'])) .primary:hover {
  background: var(--accent-hover);
}
:where(:root:not([data-base='none'])) .ghost {
  color: var(--text);
  border: 1px solid var(--bg-active);
  border-radius: 4px;
}
:where(:root:not([data-base='none'])) .ghost:hover {
  background: var(--bg-hover);
}
:where(:root:not([data-base='none'])) .secondary {
  font-weight: 600;
  color: var(--text-strong);
  background: var(--bg-active);
  border-radius: 4px;
}
:where(:root:not([data-base='none'])) .secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

/* User panel */
:where(:root:not([data-base='none'])) .user-panel {
  background: var(--bg-darkest);
}
:where(:root:not([data-base='none'])) .voice-bar,
:where(:root:not([data-base='none'])) .voice-controls {
  border-bottom: 1px solid var(--bg-hover);
}
:where(:root:not([data-base='none'])) .vtube {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--success);
}
:where(:root:not([data-base='none'])) .vtube.warn {
  background: var(--warning);
}
:where(:root:not([data-base='none'])) .vtube.bad {
  background: var(--danger);
}
:where(:root:not([data-base='none'])) .voice-bar-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}
:where(:root:not([data-base='none'])) .voice-ping {
  font-size: 10px;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .ptt-pill {
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--bg-active);
  border-radius: 3px;
}
:where(:root:not([data-base='none'])) .ptt-pill.on {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
:where(:root:not([data-base='none'])) .push-button .face {
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-hover);
}
:where(:root:not([data-base='none'])) .push-button:hover .face {
  background: var(--bg-active);
}
:where(:root:not([data-base='none'])) .push-button.live .face {
  color: var(--danger);
}
:where(:root:not([data-base='none'])) .leave-button {
  display: grid;
  justify-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .jewel-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--danger);
}
:where(:root:not([data-base='none'])) .jewel-button svg {
  width: 13px;
  height: 13px;
}
:where(:root:not([data-base='none'])) .knob-button {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .knob-button:hover {
  color: var(--text-strong);
  background: var(--bg-hover);
}
:where(:root:not([data-base='none'])) .knob-button svg {
  width: 18px;
  height: 18px;
}

/* Sign in */
:where(:root:not([data-base='none'])) .login-screen {
  background: var(--bg-darkest);
}
:where(:root:not([data-base='none'])) .paper {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 32px;
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);
}
:where(:root:not([data-base='none'])) .paper-head {
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
}
:where(:root:not([data-base='none'])) .paper-org {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
:where(:root:not([data-base='none'])) .paper-form-no {
  font-size: 12px;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .paper-head h1 {
  margin: 0;
  font-size: 24px;
  color: var(--text-strong);
}
:where(:root:not([data-base='none'])) .paper-fields {
  display: grid;
  gap: 16px;
}
:where(:root:not([data-base='none'])) .paper-field {
  display: grid;
  gap: 6px;
}
:where(:root:not([data-base='none'])) .paper-field > span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .paper-field small {
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .paper-error {
  margin-top: 14px;
  color: var(--danger);
}
:where(:root:not([data-base='none'])) .paper-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
:where(:root:not([data-base='none'])) .paper-link {
  padding: 0;
  font-size: 13px;
  color: var(--link);
}
:where(:root:not([data-base='none'])) .paper-link:hover {
  text-decoration: underline;
}
:where(:root:not([data-base='none'])) .paper-submit {
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
}
:where(:root:not([data-base='none'])) .paper-submit:hover:not(:disabled) {
  background: var(--accent-hover);
}
:where(:root:not([data-base='none'])) .paper-submit:disabled {
  opacity: 0.6;
}

/* Call view */
:where(:root:not([data-base='none'])) .stage {
  background: var(--bg-darkest);
}
:where(:root:not([data-base='none'])) .tri-screen {
  border-radius: 8px;
  background: #000;
}
:where(:root:not([data-base='none'])) .tri.speaking .tri-screen {
  box-shadow: 0 0 0 3px var(--success);
}
:where(:root:not([data-base='none'])) .tri-empty {
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .tri-plate {
  color: #fff;
  background: rgb(0 0 0 / 0.6);
  border-radius: 4px;
}
:where(:root:not([data-base='none'])) .drop-slot {
  border: 2px dashed var(--bg-active);
  border-radius: 8px;
}
:where(:root:not([data-base='none'])) .console {
  background: var(--bg-dark);
  border-top: 1px solid var(--bg-darkest);
}
:where(:root:not([data-base='none'])) .running-time {
  font-size: 15px;
  color: var(--text-strong);
}
:where(:root:not([data-base='none'])) .signal-text {
  font-size: 13px;
  color: var(--warning);
}
:where(:root:not([data-base='none'])) .signal-text.connected {
  color: var(--success);
}
:where(:root:not([data-base='none'])) .signal-text.reconnecting {
  color: var(--danger);
}
/* ASCII mode covers the (still playing) video. */
:where(:root:not([data-base='none'])) .ascii-video {
  background: #000;
  color: var(--text-strong);
}
:where(:root:not([data-base='none'])) .tube-strength {
  font-size: 11px;
  color: var(--text-muted);
}

:where(:root:not([data-base='none'])) .board-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  text-align: left;
  border-radius: 8px;
  background: var(--bg-dark);
}
:where(:root:not([data-base='none'])) .board-card:hover {
  background: var(--bg-hover);
}
:where(:root:not([data-base='none'])) .board-card-preview svg {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 3;
}
:where(:root:not([data-base='none'])) .board-card-name {
  font-weight: 600;
  color: var(--text-strong);
}
:where(:root:not([data-base='none'])) .board-card-blurb {
  font-size: 13px;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .tool {
  border-radius: 4px;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .tool:hover {
  color: var(--text-strong);
  background: var(--bg-hover);
}
:where(:root:not([data-base='none'])) .tool.active {
  color: #fff;
  background: var(--accent);
}
:where(:root:not([data-base='none'])) .scratch-tab {
  border-radius: 4px;
  color: var(--text-muted);
}
:where(:root:not([data-base='none'])) .scratch-tab:hover {
  color: var(--text-strong);
  background: var(--bg-hover);
}
:where(:root:not([data-base='none'])) .scratch-tab.active {
  color: var(--text-strong);
  background: var(--bg-active);
}
:where(:root:not([data-base='none'])) .swatch {
  position: relative;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4);
}
:where(:root:not([data-base='none'])) .swatch.custom {
  background: conic-gradient(#f44, #fd4, #4f8, #4df, #84f, #f4d, #f44);
}
:where(:root:not([data-base='none'])) .swatch.custom::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--swatch);
}
:where(:root:not([data-base='none'])) .swatch.custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

:where(:root:not([data-base='none'])) .swatch.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text-strong);
}

/* A moderator dragging someone over a voice channel to move them there. */
.voice-channel.drop-target > .channel {
  outline: 1px dashed currentColor;
  outline-offset: -2px;
}

/* Muted by a moderator. */
.voice-member-icons .server-muted {
  display: inline-flex;
  color: #e5484d;
}

/* ---- Channel permissions and roles ---- */

/* The gear sits just before the trash can. */
.channel-perms + .channel-delete {
  margin-left: 2px;
}
.channel-perms:hover {
  color: var(--text-strong);
}
.channel-lock {
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  color: var(--text-muted);
}
.channel-lock svg {
  width: 12px;
  height: 12px;
}
.channel-lock + .channel-perms {
  margin-left: 4px;
}
.channel.locked .channel-name {
  opacity: 0.6;
}
/* Allowed to listen but not talk. */
.voice-member-icons .suppressed {
  display: inline-flex;
  opacity: 0.6;
}

.composer-locked {
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  color: var(--text-muted);
  font-size: 14px;
}
.composer-locked svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.member-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}
.role-chip {
  padding: 0 5px;
  border: 1px solid var(--border, currentColor);
  border-radius: 3px;
  font-size: 10px;
  line-height: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}
.context-menu button.check::before {
  content: '';
  display: inline-block;
  width: 14px;
}
.context-menu button.check.on::before {
  content: '✓';
}

.perm-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 14px;
}
.perm-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 2px;
}
.perm-table th:first-child {
  text-align: left;
}
.perm-table td {
  padding: 4px 2px;
  border-top: 1px solid var(--border, rgba(127, 127, 127, 0.2));
  text-align: center;
}
.perm-table td:first-child {
  text-align: left;
  overflow-wrap: anywhere;
}
.perm-who {
  display: flex;
  align-items: center;
  gap: 6px;
}
.perm-who .muted {
  font-size: 11px;
}
.perm-toggle {
  min-width: 34px;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
}
.perm-toggle.allow {
  background: #2f9e5a;
  color: white;
}
.perm-toggle.deny {
  background: #d23b3f;
  color: white;
}
.perm-remove {
  color: var(--text-muted);
}
.perm-add {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.perm-add select {
  flex: 1;
  min-width: 160px;
}
.perm-legend {
  font-size: 12px;
}
.role-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.role-row input {
  flex: 1;
  min-width: 0;
}
.role-row .muted.small {
  min-width: 72px;
}
.row-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

/* ---- Several servers (desktop app) ---- */

/* A quiet button before the nameplate; it lights up when another server
   has unread messages or our call. */
.server-switch {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  color: var(--text-muted);
  opacity: 0.55;
  flex-shrink: 0;
}
.server-switch:hover,
.server-switch.open {
  opacity: 1;
  color: var(--text-strong);
}
.server-switch.lit {
  opacity: 0.9;
}
.server-switch.lit::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-strong);
}
.server-switch + .nameplate {
  margin-left: 6px;
  margin-right: auto;
}

.server-list {
  top: 52px;
  left: 8px;
  width: 280px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 68px);
  overflow-y: auto;
  z-index: 60;
}
.server-list .server-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.server-list .server-item.current {
  background: rgb(127 127 127 / 0.18);
}
.server-initial {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgb(127 127 127 / 0.25);
  font-weight: 700;
}
.server-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.server-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-sub {
  font-size: 12px;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-call {
  color: #3ba55d;
}
.server-badge {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e5484d;
  color: white;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.server-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* The desktop app's resource usage panel (Settings → App). */
.usage-meter {
  position: fixed;
  right: 12px;
  bottom: 12px;
  /* Over dialogs too: it's watching the app, not part of it. */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  min-width: 250px;
  background: rgb(0 0 0 / 0.72);
  border: 1px solid var(--bg-active);
  border-radius: 6px;
  color: var(--text);
  font: 12px/1.3 ui-monospace, 'DejaVu Sans Mono', monospace;
  pointer-events: none;
}
.usage-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.usage-label {
  width: 52px;
  color: var(--text-muted);
}
.usage-value {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}
.usage-sub {
  color: var(--text-muted);
  font-size: 10px;
}
.usage-spark {
  flex-shrink: 0;
}
.usage-spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}

/* The desktop app's "any colour" popover for the scratchpad (it has no colour input). */
.color-picker-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.color-picker {
  /* In the layer, which fills the window. */
  position: absolute;
  width: 220px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #111214;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgb(0 0 0 / 0.4);
}
.color-square {
  position: relative;
  height: 140px;
  border-radius: 4px;
  background-image: linear-gradient(to top, #000, rgb(0 0 0 / 0)), linear-gradient(to right, #fff, rgb(255 255 255 / 0));
  cursor: crosshair;
}
.color-square-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  box-sizing: border-box;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5);
  pointer-events: none;
}
.color-hue {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  cursor: pointer;
}
.color-hue-thumb {
  position: absolute;
  top: -3px;
  width: 10px;
  height: 18px;
  margin-left: -5px;
  box-sizing: border-box;
  border: 2px solid white;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5);
  pointer-events: none;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-preview {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.2);
}
.color-hex {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-family: ui-monospace, 'DejaVu Sans Mono', monospace;
}

/* The desktop app's media player: the web app has the browser's own
   <video controls> and <audio controls>, which these follow (Chromium's dark
   controls). */
.media-player.video {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  border-radius: 6px;
  overflow: hidden;
}
.media-player.video .attachment-video {
  border-radius: 0;
}
.media-controls {
  color: white;
  font: 14px/1 Roboto, 'Segoe UI', system-ui, sans-serif;
}
.media-player.video .media-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 40px 12px 8px;
  background: linear-gradient(to bottom, rgb(0 0 0 / 0), rgb(0 0 0 / 0.7));
}
/* While it plays, only while the pointer is over it. */
.media-player.video:not(:hover) .media-controls.playing {
  opacity: 0;
}
.media-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.media-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}
.media-button:hover {
  background: rgb(255 255 255 / 0.15);
}
.media-button svg {
  width: 20px;
  height: 20px;
}
.media-time {
  margin: 0 8px 0 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.media-spacer {
  flex: 1;
}
.media-timeline,
.media-volume-slider {
  position: relative;
  height: 16px;
  cursor: pointer;
}
.media-player.video .media-timeline {
  margin: 0 4px;
}
.media-player.audio .media-timeline {
  flex: 1;
  margin: 0 8px;
}
.media-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: rgb(255 255 255 / 0.3);
}
.media-buffered,
.media-played {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
}
.media-buffered {
  background: rgb(255 255 255 / 0.4);
}
.media-played {
  background: white;
}
.media-thumb {
  position: absolute;
  top: 2px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: white;
  opacity: 0;
}
.media-timeline:hover .media-thumb,
.media-volume:hover .media-thumb {
  opacity: 1;
}
.media-volume {
  display: flex;
  align-items: center;
}
/* The volume slider opens beside the speaker on hover. */
.media-volume-slider {
  width: 0;
  overflow: hidden;
}
.media-volume:hover .media-volume-slider {
  width: 52px;
  margin: 0 8px 0 2px;
  overflow: visible;
}
.media-more {
  position: relative;
}
.media-menu {
  position: absolute;
  right: 0;
  bottom: 36px;
  z-index: 5;
  min-width: 150px;
  padding: 6px 0;
  border-radius: 6px;
  background: #292a2d;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.5);
}
.media-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 16px;
  background: none;
  color: white;
  font: inherit;
  text-align: left;
}
.media-menu button:hover {
  background: rgb(255 255 255 / 0.1);
}
.media-player.audio {
  margin-top: 8px;
}
.media-player.audio .media-controls {
  display: flex;
  align-items: center;
  height: 54px;
  padding: 0 10px;
  border-radius: 27px;
  background: #363737;
}
.media-player.audio .media-menu {
  bottom: 40px;
}
.media-error {
  margin-top: 4px;
  font-size: 13px;
  color: var(--danger);
}
/* Fullscreen: the video fills the screen, its controls along the bottom. */
.media-player.video.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  border-radius: 0;
  background: black;
}
.media-player.video.fullscreen .attachment-video {
  max-width: 100%;
  max-height: 100%;
}
/* What the memory is holding, under its total. */
.usage-breakdown {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 330px;
  margin: -2px 0 4px;
}
.usage-part {
  display: grid;
  grid-template-columns: 78px 58px minmax(0, 1fr);
  gap: 8px;
  font-size: 11px;
}
.usage-part-label {
  padding-left: 10px;
  color: var(--text-muted);
}
.usage-part-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.usage-part-detail {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

/* ---- Custom statuses (status.tsx) ---- */

/* Under someone's name. The padding (taken back by the margin, except on the
   right, which Blitz would count as overflow) leaves room inside the clipped
   box for glows and waves. */
.member-status {
  --status-color: var(--text-muted);
  display: block;
  min-width: 0;
  padding: 3px 5px;
  margin: -3px 0 -3px -5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 16px;
  color: var(--status-color);
}
.status-placeholder {
  font-style: italic;
  opacity: 0.6;
}
.user-panel-name {
  cursor: pointer;
}

/* Fonts, from the server's /status-fonts/fonts.css; each nudged to about the
   same height. */
.member-status.status-font-handwritten {
  font-family: 'cf-status-handwritten', cursive;
  font-size: 15px;
}
.member-status.status-font-script {
  font-family: 'cf-status-script', cursive;
  font-size: 11.5px;
}
.member-status.status-font-typewriter {
  font-family: 'cf-status-typewriter', monospace;
  font-size: 12.5px;
}
.member-status.status-font-elegant {
  font-family: 'cf-status-elegant', serif;
  font-size: 13px;
}
.member-status.status-font-comic {
  font-family: 'cf-status-comic', fantasy;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.member-status.status-font-scifi {
  font-family: 'cf-status-scifi', sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.member-status.status-font-pixel {
  font-family: 'cf-status-pixel', monospace;
  font-size: 8px;
}
.member-status.status-font-terminal {
  font-family: 'cf-status-terminal', monospace;
  font-size: 16px;
}
.member-status.status-font-gothic {
  font-family: 'cf-status-gothic', serif;
  font-size: 14px;
}
.member-status.status-font-spooky {
  font-family: 'cf-status-spooky', fantasy;
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* Effects that stay still. */
.member-status.status-fx-glow {
  text-shadow: 0 0 4px currentColor, 0 0 10px currentColor;
}
.member-status.status-fx-neon {
  --status-color: var(--accent);
  color: #fff;
  text-shadow: 0 0 2px var(--status-color), 0 0 6px var(--status-color), 0 0 12px var(--status-color);
}
.member-status.status-fx-pop {
  text-shadow: 1px 1px 0 rgb(0 0 0 / 0.7), 2px 2px 0 rgb(0 0 0 / 0.35);
}
.member-status.status-fx-outline {
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 2px 2px 0 #000;
}
.member-status.status-fx-glitch {
  text-shadow: -1px 0 rgb(255 40 100 / 0.85), 1px 0 rgb(0 220 255 / 0.85);
}
.status-fx-wave .status-ch,
.status-fx-glitch.member-status {
  display: inline-block;
}
.status-fx-glitch.member-status {
  max-width: 100%;
  vertical-align: top;
}

/* Effects that move: always, on the member pointed at, or never (Settings),
   and always in the status dialog. */
:root[data-status-motion='always'] .status-fx-neon,
:root[data-status-motion='hover'] .member:hover .status-fx-neon,
.status-live .status-fx-neon {
  animation: status-flicker 4s linear infinite;
}
:root[data-status-motion='always'] .status-fx-glitch,
:root[data-status-motion='hover'] .member:hover .status-fx-glitch,
.status-live .status-fx-glitch {
  animation: status-glitch 3s steps(1) infinite;
}
:root[data-status-motion='always'] .status-fx-rainbow .status-ch,
:root[data-status-motion='hover'] .member:hover .status-fx-rainbow .status-ch,
.status-live .status-fx-rainbow .status-ch {
  animation: status-rainbow 4.8s linear infinite;
}
:root[data-status-motion='always'] .status-fx-wave .status-ch,
:root[data-status-motion='hover'] .member:hover .status-fx-wave .status-ch,
.status-live .status-fx-wave .status-ch {
  animation: status-wave 1.6s ease-in-out infinite;
}
:root[data-status-motion='always'] .status-fx-pulse,
:root[data-status-motion='hover'] .member:hover .status-fx-pulse,
.status-live .status-fx-pulse {
  animation: status-pulse 2.4s ease-in-out infinite;
}
@keyframes status-flicker {
  0%,
  18%,
  22%,
  25%,
  53%,
  57%,
  100% {
    opacity: 1;
  }
  20%,
  24%,
  55% {
    opacity: 0.55;
  }
}
@keyframes status-glitch {
  0%,
  100% {
    transform: none;
    text-shadow: -1px 0 rgb(255 40 100 / 0.85), 1px 0 rgb(0 220 255 / 0.85);
  }
  88% {
    transform: translateX(1px);
    text-shadow: -3px 0 rgb(255 40 100 / 0.85), 2px 0 rgb(0 220 255 / 0.85);
  }
  91% {
    transform: translateX(-1px);
    text-shadow: 2px 0 rgb(255 40 100 / 0.85), -2px 0 rgb(0 220 255 / 0.85);
  }
  94% {
    transform: none;
    text-shadow: -1px 0 rgb(255 40 100 / 0.85), 1px 0 rgb(0 220 255 / 0.85);
  }
}
/* Keep in step with RAINBOW in status.tsx. */
@keyframes status-rainbow {
  0%,
  100% {
    color: #ff5c5c;
  }
  16.667% {
    color: #ffb347;
  }
  33.333% {
    color: #ffe74c;
  }
  50% {
    color: #5ee67a;
  }
  66.667% {
    color: #4cc9ff;
  }
  83.333% {
    color: #9b7bff;
  }
}
@keyframes status-wave {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-3px);
  }
}
@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* The status dialog. */
.status-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}
.status-preview {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--bg-dark);
}
.status-preview .member {
  pointer-events: none;
}
.status-editor label {
  position: relative;
}
.status-count {
  position: absolute;
  right: 0;
  top: 0;
  font-weight: 400;
  text-transform: none;
}
.status-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.status-choice {
  padding: 5px 9px;
  border: 1px solid var(--border, rgb(127 127 127 / 0.3));
  border-radius: 4px;
  background: var(--bg-darkest);
  color: var(--text);
}
.status-choice:hover {
  background: var(--bg-hover);
}
.status-choice.selected {
  border-color: var(--accent);
  background: var(--bg-active);
}
.status-choice .member-status {
  display: inline-block;
  vertical-align: middle;
  max-width: none;
}
.status-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.status-swatch {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  background: var(--swatch, var(--text-muted));
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4);
  cursor: pointer;
}
.status-swatch.selected {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text-strong);
}
/* "No colour": the theme's, crossed through. */
.status-swatch.default::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 3px;
  bottom: 3px;
  width: 2px;
  margin-left: -1px;
  background: var(--bg);
  transform: rotate(45deg);
}
.status-swatch.custom {
  background: conic-gradient(#f44, #fd4, #4f8, #4df, #84f, #f4d, #f44);
}
.status-swatch.custom.selected {
  background: var(--swatch);
}
.status-swatch.custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.status-current {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-current .member-status {
  flex: 1;
  margin: -3px 0;
}
/* desktop-next has no colour picker: its custom swatch opens a box for one. */
.status-hex {
  width: 110px;
  font-family: ui-monospace, 'DejaVu Sans Mono', monospace;
}
