/* Hearth — one stylesheet, no external fonts or images. Dark by default. */

:root {
  color-scheme: dark;

  /* Surfaces, darkest to lightest */
  --bg-0: #111214;
  --bg-1: #1e1f22;
  --bg-2: #2b2d31;
  --bg-3: #313338;
  --bg-4: #383a40;
  --bg-hover: rgba(78, 80, 88, 0.3);
  --bg-active: rgba(78, 80, 88, 0.6);
  --bg-msg-hover: rgba(4, 4, 5, 0.07);
  --border: rgba(255, 255, 255, 0.06);

  /* Text */
  --text-0: #f2f3f5;
  --text-1: #dbdee1;
  --text-2: #b5bac1;
  --text-3: #949ba4;
  --text-4: #6d6f78;

  /* Accent: ember */
  --accent: #e8743b;
  --accent-hover: #d4652f;
  --accent-soft: rgba(232, 116, 59, 0.16);
  --on-accent: #ffffff;
  --link: #58a6ff;
  --danger: #e5484d;
  --danger-hover: #c93b40;
  --online: #3ba55c;
  --mention: #f0b232;
  /* "Saved." and the like: green that reads at 4.5:1 or more on every surface. */
  --saved: #6fd08c;
  --error-text: #ff9a9d;

  --radius: 8px;
  --radius-sm: 4px;
  /* The side columns' widths: what js/columns.js keeps for this device (ColumnWidths.Default at first). */
  --sidebar-w: 240px;
  --members-w: 260px;
  --jam-w: 340px;
  --header-h: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg-3);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.375;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

#app {
  height: 100%;
}

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

a:hover {
  text-decoration: underline;
}

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

h1, h2, h3 {
  margin: 0;
  color: var(--text-0);
}

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

.small {
  font-size: 0.8125rem;
}

.spacer {
  flex: 1;
}

.grow {
  flex: 1;
  min-width: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

/* ---------- Icons ---------- */

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

/* ---------- Buttons and inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-4);
  color: var(--text-0);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s;
}

.btn:hover {
  background: #45474e;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-1);
}

.btn-ghost:hover {
  background: var(--bg-hover);
}

.btn-ghost.danger {
  color: var(--danger);
}

/* A risky button is plain until it is pointed at: the red is for the button that goes ahead, in its question. */
.btn-ghost.risky:hover,
.btn-ghost.risky:focus-visible {
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.875rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex: none;
}

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

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

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}

/* Waiting for an answer (Go live until the agent is live or says why not): dimmed, not greyed out. */
.icon-btn.pending:disabled {
  opacity: 0.7;
  cursor: progress;
}

input,
select,
textarea {
  background: var(--bg-1);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--text-0);
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span,
.field > label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.hint {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.form-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(229, 72, 77, 0.15);
  color: #ff9a9d;
  font-size: 0.875rem;
}

.notice {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-0);
  font-size: 0.875rem;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-4);
  color: var(--text-2);
  font-size: 0.75rem;
  white-space: nowrap;
}

.pill-ok {
  background: rgba(59, 165, 92, 0.2);
  color: #7fdc9b;
}

/* A pill that switches something (the stream's tier). */
.pill-button {
  border: 0;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.pill-button:hover {
  background: var(--accent-soft);
  color: var(--text-0);
}

/* ---------- Boot and auth pages ---------- */

.boot {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-3);
}

.boot-mark {
  animation: glow 1.6s ease-in-out infinite alternate;
}

@keyframes glow {
  from { opacity: 0.6; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.auth-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 50% 120%, rgba(232, 116, 59, 0.18), transparent 60%),
    var(--bg-1);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--bg-3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-community {
  font-weight: 700;
  color: var(--text-0);
  font-size: 1.125rem;
}

.auth-title {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.auth-subtitle {
  margin: 0 0 20px;
  color: var(--text-2);
}

.auth-foot {
  margin: 20px 0 0;
  font-size: 0.875rem;
}

.auth-foot-more {
  margin-top: 8px;
}

/* The links to the privacy policy and the terms: the sign-in pages and Settings → About. */
.legal-links {
  display: flex;
  gap: 16px;
  margin: 20px 0 0;
  font-size: 0.8125rem;
}

.legal-links a {
  color: var(--text-3);
}

/* The privacy policy and the terms, pages the hub writes itself (Hearth.Server, Web/LegalPages.cs). */
.legal-body {
  height: auto;
  min-height: 100%;
  background: var(--bg-1);
}

.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-0);
  font-weight: 700;
  font-size: 1.125rem;
}

.legal {
  margin-top: 24px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--bg-3);
  line-height: 1.55;
}

.legal h1 {
  margin: 0 0 4px;
  font-size: 1.75rem;
  color: var(--text-0);
}

.legal h2 {
  margin: 28px 0 8px;
  font-size: 1.125rem;
  color: var(--text-0);
}

.legal-updated {
  margin: 0 0 20px;
  color: var(--text-3);
  font-size: 0.875rem;
}

.legal ul {
  padding-left: 22px;
}

.legal li + li {
  margin-top: 6px;
}

.legal code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  overflow-wrap: anywhere;
}

.legal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  font-size: 0.875rem;
}

.legal-foot a {
  color: var(--text-3);
}

@media (max-width: 600px) {
  .legal {
    padding: 20px 16px;
  }
}

/* The code a PC shows while it waits to be linked (the /link page). */
.pair-code {
  margin: 4px 0 20px;
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--text-0);
}

/* ---------- App shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--members-w);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  /* The columns' dividers sit against the shell, so a column's own scrolling does not move or clip them. */
  position: relative;
}

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

.scrim {
  display: none;
}

.only-mobile {
  display: none;
}

.conn-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  padding: 4px 12px;
  background: var(--mention);
  color: #1e1f22;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}

/* Reload, once reconnecting has gone on for a while. */
.conn-banner-reload {
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.conn-banner-reload:hover {
  background: rgb(0 0 0 / 0.08);
}

/* After a deploy: a thin line above the channel, calmer than the connection banner. */
.update-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 12px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  font-size: 0.8125rem;
}

/* On the sign-in, setup, invite and link pages: across the top, above the card. */
.auth-page .update-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

.update-bar-dot {
  color: var(--text-3);
}

.update-bar-reload {
  padding: 2px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.update-bar-reload:hover:not(:disabled) {
  background: var(--accent-soft);
  text-decoration: underline;
}

.update-bar-reload:disabled {
  color: var(--text-3);
  cursor: default;
}

/* A full touch target on phones; the bar grows with it. */
@media (pointer: coarse) and (hover: none) {
  .update-bar-reload {
    min-height: 44px;
    padding: 0 12px;
  }
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Member list: shown by default on wide screens, hidden on medium ones and where the channel
   starts without it; the header button's choice holds over both. */
@media (min-width: 1200px) {
  .shell.members-hidden {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .shell.members-hidden .members {
    display: none;
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  .shell:not(.members-shown) {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .shell:not(.members-shown) .members {
    display: none;
  }
}

/* Wide (the stage bar's button, while the stage is on screen; never on a phone, where both are
   drawers): the channel list and the member list hide, and the main area takes the window. */
.shell.stage-wide {
  grid-template-columns: minmax(0, 1fr);
}

.shell.stage-wide .sidebar,
.shell.stage-wide .members {
  display: none;
}

/* The columns' dividers (Components/ColumnDivider.razor), each inside its own column's element so
   it hides with it: dragged sideways, or moved with the arrow keys (Home and End: the narrowest and
   the widest), a double-click back to the default. js/columns.js sets the width and keeps it within
   ColumnWidths' least and most; the divider only straddles the column's edge. */
.column-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: 6px;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}

.column-divider[data-column="channels"] {
  left: calc(var(--sidebar-w) - 3px);
}

.column-divider[data-column="side"] {
  right: calc(var(--members-w) - 3px);
}

/* The Jam panel's own divider: also right where the panel is fixed over the page (769–1199 px),
   where the panel is the divider's containing block and is var(--jam-w) wide. */
.column-divider[data-column="jam"] {
  right: calc(var(--jam-w) - 3px);
}

.column-divider:hover,
.column-divider:focus-visible,
.column-divider[data-dragging] {
  background: var(--accent);
  outline: none;
}

html[data-resizing],
html[data-resizing] * {
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Sidebar ---------- */

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

.community {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--bg-1);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  flex: none;
}

.community-name {
  font-weight: 700;
  color: var(--text-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The Hearth's name opens its menu (HearthNameMenu): it fills the header up to the Hearths
   button, and the chevron after it turns up while the menu is open. */
.community .hearth-menu {
  flex: 1;
  min-width: 0;
}

.hearth-menu .icon-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  margin-left: -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-0);
  font: inherit;
  cursor: pointer;
}

.hearth-menu .icon-menu-btn:hover,
.hearth-menu .icon-menu-btn.open {
  background: var(--bg-hover);
}

.hearth-menu .icon-menu-btn .icon {
  width: 16px;
  height: 16px;
  color: var(--text-2);
  transform: rotate(180deg);
}

.hearth-menu .icon-menu-btn.open .icon {
  transform: none;
}

.hearth-menu .icon-menu-choices {
  left: 0;
  right: auto;
  min-width: 200px;
}

/* The Android app's Hearth sheet, at the header's end. */
.community .hubs-btn {
  margin-left: auto;
  margin-right: -8px;
}

.channel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
}

/* A newer Hearth app on the home Hearth (AppUpdateNotice): one quiet line under the channels. */
.app-update {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 6px 4px 6px 12px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.app-update .app-update-icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--accent);
}

.app-update-text {
  flex: 1;
  min-width: 0;
}

.app-update-get {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  cursor: pointer;
}

.app-update-get:hover {
  text-decoration: underline;
}

.app-update .app-update-close {
  width: 24px;
  height: 24px;
}

.app-update .app-update-close .icon {
  width: 14px;
  height: 14px;
}

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

.group-title {
  display: flex;
  align-items: center;
  padding: 6px 8px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.group-toggle {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
}

.group-toggle:hover {
  color: var(--text-1);
}

.group-chevron {
  width: 12px;
  height: 12px;
  transform: rotate(180deg);
}

.group-chevron.collapsed {
  transform: rotate(90deg);
}

.group-unread {
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--text-0);
}

.channel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 1px 0;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.channel:hover {
  background: var(--bg-hover);
  color: var(--text-1);
  text-decoration: none;
}

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

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

.channel-icon {
  color: var(--text-4);
}

.channel.active .channel-icon,
.channel.unread .channel-icon {
  color: var(--text-2);
}

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

.unread-dot {
  position: absolute;
  left: -8px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 0 4px 4px 0;
  background: var(--text-0);
}

button.channel {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
}

.voice-members {
  list-style: none;
  margin: 0 0 4px;
  padding: 0 0 0 28px;
}

.voice-member {
  color: var(--text-3);
  font-size: 0.875rem;
}

/* A person's row in the voice list and in the call's side pane (VoiceRow.razor). */
.voice-member-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 4px;
}

/* Avatar and name; for everyone but me it is the button that opens the just-for-me menu. */
.voice-member-who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 3px 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

button.voice-member-who {
  cursor: pointer;
}

/* The name only as wide as it is, so my own setting's icon sits right after it. */
.voice-member-who .voice-member-name {
  flex: 0 1 auto;
}

button.voice-member-who:hover,
button.voice-member-who[aria-expanded="true"] {
  background: var(--bg-hover);
  color: var(--text-1);
}

.voice-member .avatar,
.call-person .avatar {
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 80ms linear;
}

.voice-member.speaking .avatar,
.call-person.speaking .avatar {
  box-shadow: 0 0 0 2px var(--online);
}

.voice-member.speaking .voice-member-name,
.call-person.speaking .voice-member-name {
  color: var(--text-0);
}

/* Muted for me: still seen talking, but dimmed. */
.voice-member.silenced .avatar,
.call-person.silenced .avatar {
  opacity: 0.6;
}

.voice-member.speaking.silenced .avatar,
.call-person.speaking.silenced .avatar {
  box-shadow: 0 0 0 2px rgba(59, 165, 92, 0.45);
}

.voice-member.speaking.silenced .voice-member-name,
.call-person.speaking.silenced .voice-member-name {
  color: var(--text-2);
}

/* ♪ Jam (the jam player): a note in its circle, its name and the song playing, lined up with the people. */
.avatar.voice-jam-avatar {
  background: var(--bg-hover);
  color: var(--accent);
}

.voice-jam-avatar .icon {
  width: 14px;
  height: 14px;
}

.voice-jam .voice-member-name {
  flex: none;
  color: var(--accent);
  font-weight: 600;
}

.voice-jam-title {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* My own setting for this person, shown only to me (theirs, in red, is what everyone sees). */
.voice-local {
  display: inline-flex;
  flex: none;
  color: var(--text-3);
}

.voice-local .icon {
  width: 16px;
  height: 16px;
}

.voice-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.voice-menu {
  position: relative;
  z-index: 31;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color: var(--text-1);
}

.voice-menu-mute {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  font-weight: 500;
  cursor: pointer;
}

.voice-menu-mute input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.voice-menu-volume {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-menu-volume.off {
  opacity: 0.55;
}

.voice-menu-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.voice-menu-value {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.voice-menu-volume input {
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}

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

.voice-menu-note {
  margin: 0;
  color: var(--text-3);
  font-size: 0.75rem;
}

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

.voice-flag {
  width: 16px;
  height: 16px;
  color: var(--danger);
}

.voice-panel {
  position: relative; /* the device menu opens above it */
  flex: none;
  padding: 8px;
  border-top: 1px solid var(--border);
  background: #232428;
}

.voice-status {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

/* The call's status with More at its end. */
.voice-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.voice-connected {
  color: var(--online);
  font-size: 0.8125rem;
  font-weight: 700;
}

.voice-channel {
  color: var(--text-3);
  font-size: 0.75rem;
}

/* The controls' row: five tiles (four without a camera) that share the sidebar's width, so each
   stays whole and in reach, and Leave too, whatever the column's width. It reaches a little into
   the panel's padding so that the longest names, Unmute and Undeafen, fit at the default width. */
.voice-controls {
  display: flex;
  gap: 1px;
  margin: 6px -2px 0;
}

/* A call's control: the icon with its name under it. */
.call-btn {
  display: inline-flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  height: 44px;
  padding: 3px 1px 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 0.6875rem;
  line-height: 1.1;
  cursor: pointer;
}

.call-btn:hover {
  background: var(--bg-hover);
  color: var(--text-0);
}

.call-btn .icon {
  width: 20px;
  height: 20px;
}

.call-btn-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-btn[aria-disabled="true"] {
  color: var(--text-4);
}

/* Muted and deafened, the loudest thing in the row. */
.call-btn.on {
  background: var(--danger);
  color: #fff;
}

.call-btn.on:hover {
  background: var(--danger-hover);
  color: #fff;
}

/* Streaming: on the accent, with the LIVE tag by the channel's name. */
.call-btn.live {
  background: var(--accent);
  color: var(--on-accent);
}

.call-btn.live:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.call-btn.camera-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.call-btn.leave {
  background: rgba(229, 72, 77, 0.18);
  color: var(--danger);
}

.call-btn.leave:hover {
  background: var(--danger);
  color: #fff;
}

/* In the row a menu's button (Go live from a PC) takes a tile's share. */
.voice-controls .icon-menu {
  flex: 1 1 auto;
  min-width: 0;
}

.voice-controls .icon-menu .call-btn {
  width: 100%;
}

/* More, in the status line: the icon and its name side by side. */
.voice-status-line .call-btn {
  flex: none;
  flex-direction: row;
  gap: 3px;
  width: auto;
  height: 28px;
  padding: 0 6px;
}

.voice-status-line .call-btn .icon {
  width: 18px;
  height: 18px;
}

.call-live-tag {
  margin-left: 4px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* A channel list narrower than the names need drops them, and the tooltips stay. VoicePanel sets
   this from the column's width: a size container here would hold the row's menus and their
   full-window backdrops. */
.voice-controls.no-names .call-btn-label {
  display: none;
}

/* The Jam: a labelled line above the controls, lit while the channel has one. */
.jam-call-line {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
}

.jam-call-line .icon {
  width: 16px;
  height: 16px;
}

.jam-call-line:hover {
  background: var(--bg-hover);
}

.jam-call-line.live {
  color: var(--accent);
}

.jam-call-line.open {
  background: var(--accent);
  color: var(--on-accent);
}

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

.jam-call-open {
  opacity: 0.6;
}

/* Go live with no linked PC: pressing it says what to do, and offers Get the app, in a note the
   width of the panel (the button itself sits mid-row). */
.go-live-hint-wrap {
  display: inline-flex;
  flex: 1 1 auto;
  min-width: 0;
}

.go-live-hint {
  position: absolute;
  z-index: 31;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 4px);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color: var(--text-1);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.go-live-hint p {
  margin: 0 0 8px;
}

/* A phone's call: the bar above the composer in the voice panel's place, and the sheet. */
.call-bar-zone {
  display: none;
}

.call-sheet-scrim,
.call-sheet {
  display: none;
}

.call-bar-name {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-0);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

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

.call-bar-open {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

@media (max-width: 768px) {
  .voice-panel.voice-call {
    display: none;
  }

  .call-bar-zone {
    display: block;
    flex: none;
  }

  .call-bar-zone > .voice-error,
  .call-bar-zone > .voice-note,
  .call-bar-zone > .voice-ptt {
    margin: 0 12px 4px;
  }

  /* The song the call's Jam plays, above the bar; it opens the Jam. */
  .call-bar-zone > .jam-call-line {
    width: auto;
    min-height: 32px;
    margin: 0 8px 4px;
  }

  .call-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 8px 6px;
    padding: 2px 2px 2px 8px;
    border-radius: var(--radius);
    background: #232428;
  }

  .call-bar .call-btn {
    flex: 0 0 52px;
  }

  .call-bar-joining {
    min-height: 32px;
    padding-left: 12px;
    color: var(--text-3);
    font-size: 0.8125rem;
  }

  .call-sheet-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 17;
    background: rgba(0, 0, 0, 0.55);
  }

  .call-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 18;
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    padding: 4px 8px calc(8px + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
    background: var(--bg-2);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  }

  .call-sheet > * {
    flex: none;
  }

  .call-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 4px 8px 8px;
    flex: none;
  }

  /* In the sheet each control is a row with its full name. */
  .call-sheet .call-btn,
  .call-sheet .jam-call-line {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 48px;
    margin: 0;
    padding: 0 10px;
    font-size: 0.9375rem;
  }

  .call-sheet .call-btn .icon,
  .call-sheet .jam-call-line .icon {
    width: 22px;
    height: 22px;
  }

  .call-sheet .icon-menu,
  .call-sheet .go-live-hint-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .call-sheet .icon-menu-choices,
  .call-sheet .problem-status,
  .call-sheet .go-live-hint {
    position: static;
    width: auto;
    margin: 0 8px 6px;
    box-shadow: none;
  }

  .call-sheet .voice-menu-backdrop {
    display: none;
  }

  .call-row-chevron {
    margin-left: auto;
    opacity: 0.6;
  }
}

/* The call's cameras (CallCameras): a row of 16:9 tiles above the channel and the stage, which
   scrolls sideways when there are more than fit. */
.call-cameras {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}

.camera-tile {
  position: relative;
  flex: 0 0 auto;
  width: 240px;
  margin: 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-0);
}

.camera-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Your own preview, as a mirror shows you. */
.camera-tile.self .camera-video {
  transform: scaleX(-1);
}

.camera-name {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-0);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .camera-tile {
    width: 160px;
  }
}

.voice-error {
  margin: 0 0 6px;
  color: var(--danger);
  font-size: 0.8125rem;
}

.voice-note {
  margin: 4px 0 0;
  color: var(--mention);
  font-size: 0.75rem;
  line-height: 1.3;
}

/* Inside the desktop app, which has no voice yet: where voice works meanwhile. */
.voice-app-note {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
}

.voice-app-note p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-2);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.voice-app-note .icon-btn {
  grid-column: 3;
}

/* Push-to-talk: hold to talk, talking, or held while muted. */
.voice-ptt {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 0.75rem;
  line-height: 1.3;
}

.voice-ptt.talking {
  color: var(--online);
  font-weight: 700;
}

.voice-ptt.blocked {
  color: var(--danger);
}

/* The microphone and its device arrow sit together, with a gap so a slip does not mute. */
.voice-mic {
  display: inline-flex;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}

.icon-btn.voice-devices-btn {
  width: 16px;
  height: 44px;
}

@media (pointer: coarse) and (hover: none) {
  .icon-btn.voice-devices-btn {
    width: 26px;
  }
}

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

/* A button whose menu or panel is open (Voice devices, an icon menu) sits on the accent, as a
   checked toggle does in the apps. */
.icon-btn.voice-devices-btn.open,
.icon-btn.icon-menu-btn.open {
  background: var(--accent);
  color: var(--on-accent);
}

.icon-btn.voice-devices-btn.open:hover,
.icon-btn.icon-menu-btn.open:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.device-menu {
  position: absolute;
  z-index: 31;
  left: 8px;
  bottom: calc(100% - 4px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 300px;
  max-width: calc(100vw - 16px);
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color: var(--text-1);
}

.device-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.device-group legend {
  margin-bottom: 4px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.device-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
}

.device-option.missing {
  color: var(--text-3);
}

/* The chosen row in each group: its radio dot is all that marks it. */
.device-option input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

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

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

.device-menu-note {
  margin: 0;
  padding: 0 6px;
  color: var(--text-3);
  font-size: 0.75rem;
}

/* "More in Settings", the menu's last line, a link. */
.device-menu-more {
  align-self: flex-start;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.device-menu-more {
  text-decoration: underline;
}

/* In the phone's call sheet: part of the sheet, not a menu over it. */
.device-menu.device-menu-inline {
  position: static;
  flex: none;
  width: auto;
  max-width: none;
  max-height: none;
  overflow: visible;
  margin: 0 0 8px;
  padding: 6px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* An icon menu (IconMenu: Report a problem, Go live from): its choices are a device menu below the
   button (above it in the voice panel), and Report a problem's thanks or failure a bubble there. */
.icon-menu {
  position: relative;
  display: inline-flex;
}

.icon-menu-choices {
  top: calc(100% + 4px);
  right: 0;
  bottom: auto;
  left: auto;
  width: auto;
  min-width: 140px;
  gap: 1px;
}

.icon-menu-heading {
  margin-top: 6px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.icon-menu-choice {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.icon-menu-choice.danger {
  color: var(--danger);
}

/* A choice that is on or off: the check's place is kept while it is off, so the words line up. */
.icon-menu-check {
  display: inline-flex;
  flex: none;
  width: 16px;
  height: 16px;
}

.icon-menu-separator {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}

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

.icon-menu-choice:disabled {
  opacity: 0.55;
  cursor: default;
}

.problem-status {
  position: absolute;
  z-index: 31;
  top: calc(100% + 4px);
  right: 0;
  width: max-content;
  max-width: 220px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color: var(--text-1);
  font-size: 0.75rem;
  line-height: 1.3;
}

.problem-status.failed {
  color: var(--danger);
}

.icon-menu.above .icon-menu-choices,
.icon-menu.above .problem-status {
  top: auto;
  bottom: calc(100% + 4px);
}

/* Tooltips where a title alone does nothing on touch. */
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-0);
  color: var(--text-0);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 5;
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: #232428;
  flex: none;
}

.user-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.user-display {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-handle {
  font-size: 0.75rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Avatars ---------- */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.9375rem;
  flex: none;
  user-select: none;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

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

/* The member's picture, drawn over their initial; the initial stays underneath it. */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.av-0 { background: #c0582b; }
.av-1 { background: #3b7dd8; }
.av-2 { background: #2f9e6e; }
.av-3 { background: #8e5bd0; }
.av-4 { background: #c9437a; }
.av-5 { background: #b8892a; }
.av-6 { background: #3a9aa8; }
.av-7 { background: #6b7280; }

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

.presence.online {
  background: var(--online);
}

.presence.offline {
  background: var(--text-4);
}

.user-panel .presence {
  border-color: #232428;
}

/* ---------- Channel pane ---------- */

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

.channel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--header-h);
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--bg-1);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  flex: none;
  min-width: 0;
}

.channel-header-icon {
  color: var(--text-4);
  width: 22px;
  height: 22px;
}

.channel-header-name {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-header-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--bg-4);
  flex: none;
}

.channel-header-topic {
  color: var(--text-3);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.channel-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.channel-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* The message list, with the mini player in one of its corners (js/watch.js). */
.messages-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 16px 0 8px;
  overscroll-behavior: contain;
}

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

.channel-start-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--bg-4);
}

.channel-start-icon .icon {
  width: 36px;
  height: 36px;
  color: var(--text-0);
}

.channel-start h3 {
  font-size: 1.75rem;
  margin-bottom: 4px;
}

.channel-start p {
  margin: 0;
}

.history-loading {
  padding: 8px 16px;
  text-align: center;
  font-size: 0.875rem;
}

.day-divider {
  display: flex;
  align-items: center;
  margin: 24px 16px 8px;
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 600;
}

.day-divider::before,
.day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bg-4);
}

.day-divider-label {
  padding: 0 8px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.day-divider-label:hover {
  color: var(--text-1);
  text-decoration: underline;
}

.new-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 4px;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 700;
}

.new-divider::before {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--danger);
}

.new-divider + .msg-first {
  margin-top: 0;
}

.msg {
  position: relative;
  padding: 2px 48px 2px 72px;
  min-width: 0;
}

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

.msg-first {
  margin-top: 16px;
  min-height: 44px;
}

.day-divider + .msg-first {
  margin-top: 0;
}

.msg-avatar {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 40px;
  height: 40px;
  font-size: 1.125rem;
}

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

.msg-author {
  font-weight: 600;
  color: var(--text-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-time {
  font-size: 0.75rem;
  color: var(--text-3);
  white-space: nowrap;
}

.msg-gutter-time {
  position: absolute;
  left: 0;
  top: 5px;
  width: 72px;
  text-align: center;
  font-size: 0.6875rem;
  color: var(--text-3);
  visibility: hidden;
}

.msg:focus-within .msg-gutter-time {
  visibility: visible;
}

.msg-body {
  color: var(--text-1);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-body code {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-1);
  font-family: var(--mono);
  font-size: 0.85em;
}

.msg-body pre {
  margin: 6px 0;
  padding: 8px 10px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--bg-1);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.msg-body pre code {
  padding: 0;
  background: none;
  font-size: 0.875rem;
  white-space: pre;
}

.msg-edited {
  margin-left: 4px;
  font-size: 0.6875rem;
  color: var(--text-3);
}

.msg-actions {
  position: absolute;
  right: 16px;
  top: -16px;
  display: none;
  padding: 2px;
  border: 1px solid var(--bg-1);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.msg:focus-within .msg-actions {
  display: flex;
}

.msg-first .msg-actions {
  top: -12px;
}

/* Hidden until the keyboard reaches it, always there for a screen reader. */
.msg-sheet-open {
  position: absolute;
  right: 16px;
  bottom: 2px;
  z-index: 2;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-1);
  font-size: 0.75rem;
}

.msg-sheet-open:focus-visible {
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
}

.msg-sheet-open:focus-visible::after {
  content: attr(aria-label);
}

/* The strip's menu lies over the rest of the list. */
.msg-actions:has(.icon-menu-choices) {
  z-index: 31;
}

.msg-more .icon-menu-choices {
  min-width: 180px;
}

.msg-more .icon-menu-choice {
  gap: 10px;
  min-height: 34px;
  padding: 2px 10px;
}

.msg-more .icon-menu-choice:hover {
  background: var(--bg-active);
}

/* A message's actions as a sheet from the bottom of the screen. */
.msg-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  touch-action: none;
}

.msg-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--bg-2);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  animation: msg-sheet-up 0.15s ease-out;
}

.msg-sheet:focus {
  outline: none;
}

@keyframes msg-sheet-up {
  from { transform: translateY(32px); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}

.msg-sheet-preview {
  padding: 8px 12px;
  min-width: 0;
}

.msg-sheet-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.msg-sheet-author {
  overflow: hidden;
  font-weight: 600;
  color: var(--text-0);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-sheet-time {
  flex: none;
  font-size: 0.75rem;
  color: var(--text-3);
}

.msg-sheet-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-2);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.msg-sheet-quick {
  display: flex;
  padding: 4px 0;
}

.msg-sheet-emoji {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.msg-sheet-emoji.mine {
  background: var(--accent-soft);
}

.msg-sheet-add {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}

.msg-sheet-actions {
  display: flex;
  flex-direction: column;
}

.msg-sheet-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-1);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.msg-sheet-row:active {
  background: var(--bg-active);
}

.msg-sheet-row.danger {
  color: var(--danger);
}

.msg-sheet-separator {
  height: 1px;
  margin: 4px 12px;
  background: var(--border);
}

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

.msg-editor {
  margin: 4px 0;
}

.msg-editor-hint {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-3);
}

/* Touch: Save and Cancel under the text, full-size targets. */
.msg-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.msg-editor-actions .btn {
  min-height: 44px;
  padding: 0 16px;
}

.input-area {
  display: block;
  width: 100%;
  resize: none;
  max-height: 40vh;
  padding: 11px 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-4);
  color: var(--text-0);
  line-height: 1.375;
}

.input-area:focus {
  border: 0;
}

.new-pill {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 3;
}

.new-pill .icon {
  width: 16px;
  height: 16px;
}

/* Reserves its space whether anything shows or not, so the composer never jumps. */
.typing-line {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 16px;
  font-size: 0.8125rem;
  color: var(--text-2);
  flex: none;
}

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

/* Three dots that bounce in turn; off under prefers-reduced-motion (the global rule below). */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.typing-dots-sm span {
  width: 4px;
  height: 4px;
}

/* The footer's typists, overlapping slightly, a ring the page background's colour between them. */
.typing-avatars {
  display: inline-flex;
  flex: none;
}

.typing-avatar {
  margin-left: -6px;
  box-shadow: 0 0 0 2px var(--bg-3);
}

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

/* A channel other than the open one: the dots are the only sign someone is typing there. */
.channel-typing {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin-left: 4px;
  color: var(--text-3);
}

.composer {
  display: flex;
  flex-direction: column;
  margin: 0 16px;
  margin-bottom: max(16px, env(safe-area-inset-bottom));
  padding: 0;
  border-radius: var(--radius);
  background: var(--bg-4);
  flex: none;
  position: relative;
  min-width: 0;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
}

.composer .input-area {
  flex: 1;
  min-width: 0;
  padding-left: 4px;
}

.composer-add {
  flex: none;
  margin: 0 0 7px 6px;
}

/* The + sits at the composer's left edge: its menu opens rightwards. */
.composer-add .icon-menu-choices {
  right: auto;
  left: 0;
  min-width: 180px;
}

.composer-emoji {
  margin: 0 0 7px;
}

/* The members @ offers, over the messages just above the box. */
.composer-choices {
  position: absolute;
  z-index: 4;
  left: 0;
  bottom: calc(100% + 4px);
  display: flex;
  flex-direction: column;
  width: min(360px, 100%);
  padding: 4px;
  border: 1px solid var(--bg-1);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.composer-choice {
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-1);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.composer-choice.chosen {
  background: var(--bg-hover);
  color: var(--text-0);
}

/* The file input itself stays out of sight; the + menu's Attach files opens it. */
.composer-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Files waiting to go with the next message: a row of cards above the text. */
.composer-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 10px 10px 2px;
  list-style: none;
}

.composer-file {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  padding: 4px 4px 4px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.composer-file-preview,
.composer-file-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-1);
}

.composer-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}

.composer-file-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 180px;
  font-size: 0.8125rem;
}

.composer-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-0);
}

.composer-file-size {
  color: var(--text-3);
  font-size: 0.75rem;
}

.upload-line {
  color: var(--accent);
}

/* Dropping files on the channel: a frame over the whole pane while they are dragged in. */
.drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 18, 20, 0.75);
  pointer-events: none;
  z-index: 5;
}

.channel-pane[data-dragging] > .drop-overlay {
  display: flex;
}

.drop-overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 36px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--bg-3);
  color: var(--text-0);
  font-weight: 600;
  text-align: center;
}

.drop-overlay-box .icon {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

/* ---------- Attachments in messages ---------- */

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 2px;
  min-width: 0;
}

.att-image {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow: hidden;
  cursor: zoom-in;
}

.att-image img {
  display: block;
  max-width: 100%;
  height: auto;
}

.att-file {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 360px;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--bg-1);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-1);
}

.att-file:hover {
  text-decoration: none;
  background: var(--bg-4);
}

.att-file-icon {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--text-2);
}

.att-file-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.att-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--link);
}

.att-file-size {
  font-size: 0.75rem;
  color: var(--text-3);
}

.att-file-download {
  flex: none;
  color: var(--text-2);
}

/* A video plays in the message, its download under it. */
.att-video {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 480px;
  max-width: 100%;
  min-width: 0;
}

.att-video video {
  display: block;
  width: 100%;
  max-height: 360px;
  border-radius: var(--radius);
  background: #000;
}

.att-video .att-file {
  width: 100%;
}

.att-video-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-2);
}

/* A picture full size. */
.viewer-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.88);
  z-index: 60;
}

.viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.viewer:focus {
  outline: none;
}

/* Where the picture shows, zoomed and panned by js/zoom.js; a click on its empty part closes. */
.viewer-stage {
  position: relative;
  flex: 1;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}

.viewer-stage.can-pan {
  cursor: grab;
}

.viewer-image {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
}

/* Hidden until its first place is known, so it never shows at its own size first. */
.viewer-image:not(.placed) {
  visibility: hidden;
}

.viewer-zoom {
  flex: none;
  min-width: 52px;
  padding: 4px 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-1);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.viewer-zoom:hover {
  background: var(--bg-hover);
  color: var(--text-0);
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 640px;
  min-width: 0;
  color: var(--text-1);
  font-size: 0.875rem;
}

.viewer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--text-0);
}

.viewer-size {
  flex: none;
  color: var(--text-3);
}

.composer-send {
  margin: 0 6px 7px 0;
  color: var(--accent);
}

.composer-send:disabled {
  color: var(--text-4);
}

/* On a touch screen Enter is a newline and only this button sends: a full 44 px target, as tall
   as the one-line box. */
@media (pointer: coarse) and (hover: none) {
  .composer-send,
  .composer-emoji,
  .composer-add .icon-menu-btn {
    width: 44px;
    height: 44px;
    margin: 0 2px 0 0;
  }

  .composer-add {
    margin: 0 0 0 2px;
  }

  .composer-add .icon-menu-btn {
    margin: 0;
  }

  .composer-emoji {
    margin: 0;
  }

  .composer-choice {
    padding: 11px 8px;
  }

  .composer-file-remove {
    width: 40px;
    height: 40px;
  }
}

.composer-count {
  position: absolute;
  right: 84px;
  top: -18px;
  font-size: 0.75rem;
  color: var(--text-3);
}

.composer-count.over {
  color: var(--danger);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 4;
}

/* ---------- Jumps: the message landed on, the way back to the present ---------- */

.messages .msg.msg-flash {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.present-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 16px 2px;
  padding: 6px 6px 6px 14px;
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 0.875rem;
  flex: none;
}

.present-bar.has-news {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

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

.present-bar-jump .icon {
  width: 16px;
  height: 16px;
}

.present-bar.has-news .present-bar-jump {
  background: rgba(0, 0, 0, 0.22);
  color: var(--on-accent);
}

/* ---------- Catch-up: the offer on a busy channel, and the member's own summary ---------- */

.catchup-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 16px 2px;
  padding: 6px 6px 6px 14px;
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--text-1);
  font-size: 0.875rem;
  flex: none;
}

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

.catchup-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 16px 2px;
  padding: 8px 8px 10px 14px;
  max-height: 40vh;
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: inset 3px 0 0 var(--accent);
  font-size: 0.875rem;
  flex: none;
}

.catchup-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.catchup-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-0);
}

.catchup-only {
  flex: 1;
  min-width: 0;
  color: var(--text-3);
  font-size: 0.8125rem;
}

.catchup-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}

.catchup-status:empty {
  display: none;
}

.catchup-error {
  color: var(--danger);
}

.catchup-bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--text-1);
  line-height: 1.375;
}

.catchup-bullet + .catchup-bullet {
  margin-top: 4px;
}

.catchup-bullet-text {
  overflow-wrap: anywhere;
}

.catchup-jump {
  margin-left: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 0.8125rem;
  white-space: nowrap;
  cursor: pointer;
}

.catchup-jump:hover {
  text-decoration: underline;
}

/* ---------- Header: search field and menu ---------- */

.channel-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  width: 200px;
  transition: width 0.15s ease;
}

.channel-search:focus-within {
  width: 260px;
}

.channel-search-icon {
  position: absolute;
  left: 8px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.channel-search-input {
  width: 100%;
  height: 30px;
  padding: 4px 8px 4px 30px;
  font-size: 0.875rem;
}

.channel-search-close {
  display: none;
}

.header-menu-anchor {
  position: relative;
  flex: none;
}

.header-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.header-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 31;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.header-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-1);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.header-menu-item:hover,
.header-menu-item:focus-visible {
  background: var(--bg-hover);
  color: var(--text-0);
}

.header-menu-item .icon {
  width: 18px;
  height: 18px;
}

.icon.icon-more {
  stroke-width: 3;
}

/* ---------- Search results ---------- */

/* Wide screens: a column beside the messages. Narrower: over their right side (phones: all of it). */
.search-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  border-left: 1px solid var(--bg-1);
  background: var(--bg-2);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
}

@media (min-width: 1200px) {
  .search-panel {
    position: relative;
    flex: none;
    box-shadow: none;
  }
}

.search-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--bg-1);
  flex: none;
}

.search-panel-title {
  color: var(--text-0);
  font-weight: 600;
  font-size: 0.9375rem;
}

.search-results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.search-hits {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}

.search-hit:hover {
  background: var(--bg-4);
}

.search-hit-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 0.8125rem;
}

.search-hit-author {
  color: var(--text-0);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hit-channel {
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hit-time {
  margin-left: auto;
  color: var(--text-3);
  font-size: 0.75rem;
  white-space: nowrap;
}

.search-hit-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
}

/* A result's attachments, by name: a search finds file names too. */
.search-hit-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--text-2);
  min-width: 0;
}

.search-hit-file {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.search-hit-file .icon {
  width: 14px;
  height: 14px;
}

.search-hit mark {
  padding: 0 1px;
  border-radius: 2px;
  background: rgba(240, 178, 50, 0.35);
  color: var(--text-0);
}

.search-empty {
  margin: 0;
  padding: 16px;
  color: var(--text-2);
  text-align: center;
}

.search-help {
  padding: 8px 8px 0;
  color: var(--text-2);
  font-size: 0.875rem;
}

.search-help p {
  margin: 0 0 8px;
}

.search-help ul {
  margin: 0;
  padding-left: 18px;
}

.search-help li {
  margin-bottom: 4px;
}

.search-help code {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-1);
  font-family: var(--mono);
  font-size: 0.85em;
}

.search-more {
  display: flex;
  margin: 8px auto 4px;
}

/* Hover only where there is a real pointer: on touch screens :hover sticks after a tap, so
   there a tap focuses the message instead (:focus-within above). */
/* Touch screens have the long-press sheet instead of the strip, and a long press no longer selects
   text: Copy text is in the sheet. The message box under an edit stays selectable. */
@media (hover: none) {
  .msg:focus-within .msg-actions {
    display: none;
  }

  .msg {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  .msg textarea {
    -webkit-user-select: text;
    user-select: text;
  }

  .msg a,
  .msg img {
    -webkit-touch-callout: default;
  }
}

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

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

  .msg:hover .msg-actions {
    display: flex;
  }
}

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

.members {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 8px;
  background: var(--bg-2);
}

.members-title {
  padding: 0 8px;
  margin: 12px 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

/* The divider is the member list's first element, so the first title is the first of its kind. */
.members-title:first-of-type {
  margin-top: 0;
}

/* In a call the side pane shows the call in the members' place (InCallPane.razor): who is here,
   larger than in the voice list, with Live and Watch on a stream, and Ask to join at the foot.
   On a phone the pane is a drawer that keeps the members: the call bar has the call. */
.call-pane {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}

.call-people {
  list-style: none;
  margin: 0;
  padding: 0;
}

.call-person {
  color: var(--text-2);
}

.call-person .voice-member-who {
  gap: 10px;
  padding: 5px 8px;
}

.call-person .voice-member-name {
  color: var(--text-1);
  font-weight: 500;
}

.call-person .avatar {
  width: 32px;
  height: 32px;
  font-size: 0.875rem;
}

.call-person-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.call-person-tag.paused {
  background: var(--bg-4);
  color: var(--text-1);
}

.call-person-watch {
  flex: none;
  color: var(--accent);
  font-weight: 600;
}

.call-person-watch[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.call-person .voice-menu {
  margin: 4px 8px 8px;
}

.call-pane-foot {
  margin-top: auto;
  padding: 12px 0 0;
}

.call-pane-ask {
  width: 100%;
  justify-content: flex-start;
}

/* The pane's own hiding (.shell.members-hidden and the rest) outweighs this, so a pane the member
   hid stays hidden in a call. */
@media (min-width: 769px) {
  .members.in-call {
    display: flex;
    flex-direction: column;
  }

  .members.in-call .member-groups {
    display: none;
  }
}

@media (max-width: 768px) {
  .call-pane {
    display: none;
  }
}

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  min-width: 0;
}

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

.member.offline {
  opacity: 0.45;
}

.member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-1);
  font-weight: 500;
}

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

.member-about {
  font-size: 0.75rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The chat bot's tag, beside its name in the member list and on its messages. */
.bot-tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.role-badge {
  display: inline-flex;
}

.role-badge .icon {
  width: 14px;
  height: 14px;
}

.role-badge.owner {
  color: var(--mention);
}

.role-badge.admin {
  color: var(--accent);
}

/* ---------- Modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  z-index: 50;
}

.modal {
  width: 100%;
  max-height: 100%;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--bg-3);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal:focus {
  outline: none;
}

.modal-sm {
  max-width: 420px;
  padding: 20px;
}

.modal-title {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Settings: the dialog frame never scrolls; the section list and the content area scroll their own. */
.modal-settings {
  position: relative;
  display: flex;
  max-width: 860px;
  height: min(640px, 100%);
  overflow: hidden;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  width: 200px;
  padding: 0 8px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-2);
  flex: none;
}

/* The title and search stay put while a long list scrolls under them. */
.settings-nav-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 16px 0 8px;
  background: var(--bg-2);
}

.settings-nav-title {
  padding: 0 10px 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.settings-search {
  position: relative;
  display: flex;
  align-items: center;
}

.settings-search .icon {
  position: absolute;
  left: 8px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.settings-search input {
  width: 100%;
  padding: 6px 8px 6px 30px;
}

/* Owner's twelve rows, three captions and search fit the dialog: rows of about 34 px. */
.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.settings-caption {
  margin: 2px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.settings-tab {
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  font-weight: 500;
  cursor: pointer;
}

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

.settings-tab.active {
  background: var(--bg-active);
  color: var(--text-0);
}

.settings-body {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 28px;
}

.settings-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

/* A refusal or a "Saved." above a section stops short of the close button in the corner. */
.settings-body > .notice,
.settings-body > .form-error {
  margin: 0 24px 12px 0;
}

.settings-page-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 28px 16px 0;
}

.settings-back {
  display: none;
  flex: none;
  margin-left: -6px;
}

.settings-back.from-search {
  display: inline-flex;
}

.settings-page-title {
  font-size: 1.25rem;
}

.settings-scope {
  margin: 2px 0 0;
  font-size: 0.8125rem;
}

/* What Search settings found, in the place of the page. */
.settings-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-right: 28px;
}

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

.settings-result {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-0);
  text-align: left;
  cursor: pointer;
}

.settings-result:hover {
  background: var(--bg-hover);
}

.settings-result.active {
  background: var(--bg-active);
}

.settings-empty {
  margin: 0 28px 0 0;
}

/* The setting a result went to, for two seconds. */
.settings-found {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.settings-section h3 {
  margin: 20px 0 10px;
  font-size: 1rem;
}

.settings-section + .settings-section {
  margin-top: 20px;
}

.settings-order {
  margin-top: 12px;
}

/* A list page's New button, with Reorder beside it on Channels. */
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

/* What a New button opens, over the list. */
.settings-new {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.settings-reorder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.settings-reorder-head .hint {
  margin: 0;
}

/* A row that is one button: the row opens what it names. */
.settings-row-open {
  padding: 0;
}

.settings-row-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.settings-row-button:hover {
  background: var(--bg-hover);
}

/* A chevron drawn, not written, so it stays out of the row's accessible name. */
.settings-row-button::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-top: 2px solid var(--text-3);
  border-right: 2px solid var(--text-3);
  transform: rotate(45deg);
}

/* A channel's page: its one Save stays in view while the page scrolls. */
.channel-page-delete {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.settings-savebar {
  position: sticky;
  bottom: -24px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px -28px -24px;
  padding: 12px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
}

.settings-savebar > p {
  flex: 1;
  margin: 0;
}

.settings-section h3:first-child {
  margin-top: 0;
}

.settings-section > p {
  margin: 0 0 12px;
}

/* Settings -> Account: the member's own picture beside its buttons. */
.profile-picture {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  min-width: 0;
}

.settings-row.disabled > :not(.settings-answer) {
  opacity: 0.6;
}

/* An answer under the row, the form's Save or the field it is about: the row makes room for it on a line of its own. */
.settings-answer {
  margin: 4px 0 0;
  font-size: 0.875rem;
}

.settings-answer.saved {
  color: var(--saved);
}

.settings-answer.error {
  color: var(--error-text);
}

.settings-row:has(> .settings-answer) {
  flex-wrap: wrap;
}

.settings-row > .settings-answer {
  flex-basis: 100%;
  margin: 0;
}

/* What the section failed to load: over the top of the page, taking no room, so nothing moves when it comes. */
.settings-top {
  position: sticky;
  top: 0;
  height: 0;
  z-index: 3;
}

.settings-top-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 0.875rem;
}

.settings-top-line > span {
  flex: 1;
}

.settings-top-line.error {
  color: var(--error-text);
}

.settings-top-line.saved {
  color: var(--saved);
}

.settings-row-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.settings-row-main > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A bot being renamed: its two names on one line, wrapping when narrow, its picture buttons under them. */
.bot-edit {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-width: 0;
}

.bot-edit input {
  flex: 1 1 140px;
  min-width: 0;
}

/* Settings -> the chat bot: what it remembers, each note its own field that reads as text. */
.bot-notes {
  margin-bottom: 20px;
}

.bot-notes-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.bot-notes-head h4 {
  margin: 0;
  font-size: 0.9375rem;
}

.bot-notes-head .btn {
  margin-left: auto;
}

.bot-notes > p {
  margin: 0 0 8px;
}

.bot-note-lines {
  margin-bottom: 8px;
}

.settings-row.bot-note {
  padding: 2px 8px 2px 2px;
}

.bot-note .bot-note-text {
  flex: 1;
  min-width: 0;
  background: transparent;
  border-color: transparent;
}

.bot-note .bot-note-text:hover {
  border-color: var(--border);
}

.bot-note .bot-note-text:focus {
  background: var(--bg-1);
  border-color: var(--accent);
}

.bot-note-add {
  align-items: center;
}

/* Settings -> Streaming: a PC whose clock is off the hub's. */
.settings-row-main > .clock-off {
  color: #ff9a9d;
  white-space: normal;
}

.settings-row select {
  padding: 5px 8px;
}

.invite-link {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* Invite people's dialog: the link's options at the left, Done at the right. */
.invite-people .modal-actions {
  justify-content: space-between;
}

/* Numbered how-to steps (Settings -> Get the app). */
.steps {
  margin: 0 0 12px;
  padding-left: 1.5em;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.steps li {
  padding-left: 4px;
}

.steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.steps .hint {
  margin: 6px 0 0;
}

.step-action {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin-top: 8px;
}

/* A command to type, with its copy button (CommandLine.razor); on a phone the button goes below. */
.command-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.command-line .code-block {
  flex: 1 1 240px;
  min-width: 0;
  margin: 0;
}

.command-line .btn {
  flex: none;
}

/* Something for a few, folded away (Settings -> Streaming). */
.by-hand {
  margin: 0 0 12px;
}

.by-hand summary {
  cursor: pointer;
  width: fit-content;
  color: var(--text-2);
  font-size: 0.875rem;
}

.by-hand[open] summary {
  margin-bottom: 8px;
}

/* Settings -> Get the app: one button per app, this device's marked, the shown one lit. */
.app-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.app-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}

.app-choice:hover {
  background: var(--bg-hover);
}

.app-choice.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-0);
}

.app-choice > .icon {
  flex: none;
  width: 24px;
  height: 24px;
}

.app-choice-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.app-choice-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  font-weight: 600;
}

.app-choice-name .pill {
  font-weight: 400;
}

.app-steps > p {
  margin: 0 0 8px;
}

.icon-inline {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
}

.invite-link input {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.875rem;
}

/* A member's new reset link, under their row: the link and Copy, then the line about it. */
.settings-row.reset-link {
  flex-direction: column;
  align-items: stretch;
}

.settings-row.reset-link .invite-link {
  margin-top: 0;
}

.settings-row.reset-link .hint {
  margin: 0;
}

/* A password field and its Show button. */
.password-field {
  display: flex;
  gap: 8px;
}

.password-field input {
  flex: 1;
  min-width: 0;
}

/* The forms that make an account: the user name "Your name" gives, and what is wrong with a typed one. */
.sign-in-as {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

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

.field-error {
  font-size: 0.8125rem;
  color: #ff9a9d;
}

/* ---------- Phones: sidebars become drawers ---------- */

@media (max-width: 768px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The columns are drawers here: nothing to resize. */
  .column-divider {
    display: none;
  }

  .only-mobile {
    display: inline-flex;
  }

  .sidebar,
  .members {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 20;
    transition: transform 0.2s ease;
  }

  .sidebar {
    left: 0;
    width: min(86vw, 300px);
    transform: translateX(-100%);
  }

  .members {
    right: 0;
    width: min(80vw, 280px);
    transform: translateX(100%);
  }

  .shell.left-open .sidebar,
  .shell.right-open .members {
    transform: none;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.5);
  }

  .shell.left-open .scrim,
  .shell.right-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 15;
  }

  .channel-header {
    padding: 0 4px 0 4px;
    gap: 4px;
  }

  .channel-header-divider,
  .channel-header-topic {
    display: none;
  }

  /* Search: a button in the header; open, the field takes the whole header and the results
     the whole pane. */
  .channel-search {
    display: none;
  }

  .channel-header.searching > * {
    display: none;
  }

  .channel-header.searching > .channel-search-close {
    display: inline-flex;
  }

  .channel-header.searching > .channel-search {
    display: flex;
    flex: 1;
    width: auto;
  }

  .channel-search-input {
    height: 36px;
    font-size: 1rem; /* 16 px or more: phones do not zoom in on focus */
  }

  .search-panel {
    width: 100%;
    border-left: 0;
    box-shadow: none;
  }

  .search-panel-close {
    display: none; /* the header's back arrow closes it */
  }

  .pins-panel .search-panel-close {
    display: inline-flex; /* no back arrow for the pinned list: it closes itself */
  }

  .search-hit {
    padding: 10px 12px;
  }

  .present-bar,
  .catchup-bar,
  .catchup-panel {
    margin: 4px 8px 2px;
  }

  .msg {
    padding: 2px 12px 2px 58px;
  }

  .msg-avatar {
    left: 12px;
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .msg-gutter-time {
    width: 58px;
  }

  .msg-actions {
    right: 8px;
  }

  /* Bigger targets for fingers in the voice list and its menu. */
  .voice-member-who {
    padding: 6px 4px;
  }

  .voice-menu-mute {
    min-height: 36px;
  }

  .voice-menu-volume input,
  .volume-field input {
    height: 32px;
  }

  .device-option {
    min-height: 36px;
  }

  .composer {
    margin: 0 8px;
    margin-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .typing-line {
    padding: 0 12px;
  }

  .new-pill,
  .toast {
    bottom: 80px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal-settings {
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  /* A list that opens each section full screen, with a back arrow on the section. */
  .settings-nav {
    flex: 1;
    width: auto;
    padding: 0 8px 16px;
  }

  .settings-nav-head {
    padding: 12px 0 10px;
  }

  .settings-nav-title {
    padding: 4px 44px 10px 10px;
    font-size: 1.125rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-0);
  }

  .settings-search input {
    padding: 10px 10px 10px 32px;
  }

  .settings-tab {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    padding: 10px;
    font-size: 1rem;
  }

  /* A chevron drawn, not written, so it stays out of the row's accessible name. */
  .settings-tab::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 4px;
    border-top: 2px solid var(--text-3);
    border-right: 2px solid var(--text-3);
    transform: rotate(45deg);
  }

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

  .settings-caption {
    margin-top: 8px;
  }

  .modal-settings[data-view="list"] .settings-body,
  .modal-settings[data-view="page"] .settings-nav,
  .modal-settings[data-view="results"] .settings-sections {
    display: none;
  }

  .modal-settings[data-view="results"] .settings-nav {
    flex: none;
    padding-bottom: 0;
  }

  .settings-back {
    display: inline-flex;
  }

  .settings-page-head {
    margin-right: 40px;
  }

  /* The close button sits over the list here, not the results. */
  .settings-results,
  .settings-empty {
    margin-right: 0;
  }

  .settings-body {
    flex: 1;
    min-height: 0;
    padding: 12px 16px 16px;
  }

  .settings-savebar {
    bottom: -16px;
    margin: 16px -16px -16px;
    padding: 10px 16px;
  }

  .settings-close {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 2;
  }

  .settings-body > .notice,
  .settings-body > .form-error {
    margin-right: 32px;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-row {
    flex-wrap: wrap;
  }
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 48px 10px 16px;
  background: var(--danger);
  color: #fff;
  z-index: 1000;
}

#blazor-error-ui a {
  color: #fff;
  text-decoration: underline;
}

#blazor-error-ui .dismiss {
  position: absolute;
  right: 12px;
  top: 6px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

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

/* ---------- Game streams ---------- */

.live-badge {
  flex: none;
  padding: 1px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.live-badge:hover {
  background: var(--danger-hover);
}

/* A paused stream: the badge reads PAUSED, in grey. */
.live-badge.paused,
.live-badge.paused[aria-disabled="true"]:hover {
  background: var(--bg-4);
  color: var(--text-1);
}

/* Lighter than --bg-4 and still 5.9:1 against --text-1. */
.live-badge.paused:hover {
  background: #4e5058;
}

/* Four streams on the stage already: the badge says so in its tooltip and adds nothing. */
.live-badge[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.live-badge[aria-disabled="true"]:hover {
  background: var(--danger);
}

/* The main area: the stage, the channel, or the two side by side, the channel on the right
   (StageLayout.Area). Beside the stage the channel is as wide as its divider was dragged to
   (--side-w, which js/stage.js sets; 360 px at first), never narrower than 280 px nor wider than
   half the area, also when the window changes. */
.main-area {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.main-area.beside {
  grid-template-columns: minmax(0, 1fr) auto clamp(280px, var(--side-w, 360px), 50%);
}

/* The channel's own box (or Today's): what it shows over itself (a toast, the mini player) stays on
   its side of the divider. */
.main-channel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Dragged sideways, or moved with the arrow keys (Home and End: the narrowest and the widest). */
.stage-divider {
  width: 6px;
  margin: 0 -2px;
  z-index: 1;
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  background: var(--bg-1);
  background-clip: padding-box;
  cursor: col-resize;
  touch-action: none;
}

.stage-divider:hover,
.stage-divider:focus-visible,
.main-area[data-resizing] .stage-divider {
  background-color: var(--accent);
  outline: none;
}

.main-area[data-resizing] {
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
}

/* On a phone the channel is under the stage (.below), which takes the share of the area's height
   its divider was dragged to (--stage-split, which js/stage.js sets; half at first), at least
   180 px, and the chat at least 220 px: the chat wins where both do not fit (StageSplit). */
.main-area.below {
  grid-template-rows:
    max(0px, min(calc(100% - 220px), max(180px, calc(var(--stage-split, 0.5) * 100%))))
    auto
    minmax(0, 1fr);
}

/* Dragged up and down, or moved with the arrow keys: a bar with a grip, wide enough for a thumb. */
.main-area.below .stage-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 16px;
  margin: 0;
  border: 0;
  cursor: row-resize;
}

.main-area.below .stage-divider::before {
  content: "";
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-3);
}

.main-area.below .stage-divider:hover::before,
.main-area.below .stage-divider:focus-visible::before,
.main-area.below[data-resizing] .stage-divider::before {
  background: var(--on-accent);
}

.main-area.below[data-resizing] {
  cursor: row-resize;
}

/* Under the stage the channel's header has the channels button: the stage bar leaves its own out,
   and with one stream, whose tile has its own bar, the stage bar goes. */
.main-area.below .stage-channels,
.main-area.below .stream-stage-bar.single {
  display: none;
}

/* The stage: the main area while watching. A bar above a grid of up to four tiles. */
.stream-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--bg-0);
}

/* It takes the keyboard focus for its keys (StageKeys.cs), from a click on it or Tab; only the
   keyboard's focus shows, inside its edge. */
.stream-view:focus {
  outline: none;
}

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

/* Full screen the stage is the whole screen: the button that changes the page around it goes. */
.stream-view:fullscreen .stage-channels {
  display: none;
}

.stream-stage-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--header-h);
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  flex: none;
}

.stream-stage-count {
  min-width: 0;
  font-weight: 700;
  color: var(--text-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The channel beside the streams, and wide: on, they look pressed. */
.stage-toggle.active {
  background: var(--bg-active);
  color: var(--text-0);
}

.stream-stop-all {
  flex: none;
}

/* The channel beside the stage is laid out as on a phone: no topic, the search field a button
   that takes the whole header once open, and the search results and the pinned list over the
   messages. */
.channel-pane.beside .channel-header-divider,
.channel-pane.beside .channel-header-topic,
.channel-pane.beside .channel-search {
  display: none;
}

.channel-pane.beside .channel-search-open {
  display: inline-flex;
}

.channel-pane.beside .channel-header.searching > * {
  display: none;
}

.channel-pane.beside .channel-header.searching > .channel-search-close {
  display: inline-flex;
}

.channel-pane.beside .channel-header.searching > .channel-search {
  display: flex;
  flex: 1;
  width: auto;
}

.channel-pane.beside .search-panel {
  position: absolute;
  width: 100%;
  border-left: 0;
  box-shadow: none;
}

.channel-pane.beside .search-panel-close {
  display: none; /* the header's back arrow closes it */
}

.channel-pane.beside .pins-panel .search-panel-close {
  display: inline-flex;
}

/* The grid's room: a size container, so the grid follows the stage's own shape (two streams one
   above the other when it is taller than wide), not the window's. */
.stream-stage {
  flex: 1;
  min-height: 0;
  container: stage / size;
}

/* StageLayout (StageLayout.cs) decides, as data attributes for a wide stage and a tall one: the
   grid's equal columns (2–4) and rows (1–3), and each tile's rectangle, its start column (1–4) and
   row (1–3) and how many of each it spans (1–3). In Grid the columns are half-columns, every tile
   spans two, and a shorter row is centred; in Focus the focused tile spans three by three (three
   by two on a tall stage) and the others one each, in the strip on its right (or below it). One
   tile fills the stage. */
.stream-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 6px;
  height: 100%;
  padding: 6px;
}

.stream-grid[data-cols="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stream-grid[data-cols="4"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stream-grid[data-rows="2"] {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.stream-grid[data-rows="3"] {
  grid-template-rows: repeat(3, minmax(0, 1fr));
}

.stream-grid[data-tiles="1"] {
  padding: 0;
}

.stream-tile {
  grid-column: 1 / span 2;
  grid-row: 1 / span 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-0);
  container: tile / inline-size;
}

.stream-tile[data-col="2"] {
  grid-column-start: 2;
}

.stream-tile[data-col="3"] {
  grid-column-start: 3;
}

.stream-tile[data-col="4"] {
  grid-column-start: 4;
}

.stream-tile[data-row="2"] {
  grid-row-start: 2;
}

.stream-tile[data-row="3"] {
  grid-row-start: 3;
}

.stream-tile[data-col-span="1"] {
  grid-column-end: span 1;
}

.stream-tile[data-col-span="3"] {
  grid-column-end: span 3;
}

.stream-tile[data-row-span="2"] {
  grid-row-end: span 2;
}

.stream-tile[data-row-span="3"] {
  grid-row-end: span 3;
}

/* A narrow tile (four on a laptop, two or four on a phone, Focus's strip) keeps the name and the
   buttons in its strip: the badge and the size go first, and the gaps and the volume slider get
   smaller; then the tier and the volume slider go (the mute stays); in the narrowest (the strip
   below a phone's focused tile) full screen goes too, and Focus or full screen are a double click
   or a key away. More and Stop watching always stay. The name shrinks before any button. */
.stream-header .stream-title {
  min-width: 2em;
}

.stream-header .stream-tier {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@container tile (max-width: 420px) {
  .stream-header .live-badge,
  .stream-header .stream-size {
    display: none;
  }

  .stream-tile .stream-header {
    gap: 4px;
  }

  .stream-header .stream-volume {
    flex-basis: 48px;
  }
}

@container tile (max-width: 300px) {
  .stream-tile .stream-header {
    gap: 2px;
    padding-left: 8px;
  }

  .stream-header .stream-tier,
  .stream-header .stream-volume {
    display: none;
  }
}

@container tile (max-width: 170px) {
  .stream-tile .stream-header {
    padding-left: 6px;
    padding-right: 2px;
  }

  .stream-header .stream-fullscreen {
    display: none;
  }
}

/* The tile's own volume beside its mute (0–100 %, remembered per streamer), dimmed while muted. */
.stream-volume {
  width: 80px;
  min-width: 48px;
  flex: 0 1 80px;
  height: 24px;
  margin: 0 4px 0 -4px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}

.stream-volume.off {
  opacity: 0.55;
}

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

/* Among several (not full screen, where a tile is the whole screen): an edge round each tile. */
.stream-grid:not([data-tiles="1"]) .stream-tile:not(:fullscreen) {
  border-radius: var(--radius-sm);
  outline: 1px solid var(--border);
}

/* The focused tile, among several: the one the mini player shows (in Focus, the large one too). */
.stream-grid:not([data-tiles="1"]) .stream-tile.focused:not(:fullscreen) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@container stage (orientation: portrait) {
  .stream-grid[data-cols-portrait="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stream-grid[data-cols-portrait="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stream-grid[data-cols-portrait="4"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stream-grid[data-rows-portrait="1"] {
    grid-template-rows: minmax(0, 1fr);
  }

  .stream-grid[data-rows-portrait="2"] {
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .stream-grid[data-rows-portrait="3"] {
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  .stream-tile[data-col-portrait="1"] {
    grid-column-start: 1;
  }

  .stream-tile[data-col-portrait="2"] {
    grid-column-start: 2;
  }

  .stream-tile[data-col-portrait="3"] {
    grid-column-start: 3;
  }

  .stream-tile[data-col-portrait="4"] {
    grid-column-start: 4;
  }

  .stream-tile[data-row-portrait="1"] {
    grid-row-start: 1;
  }

  .stream-tile[data-row-portrait="2"] {
    grid-row-start: 2;
  }

  .stream-tile[data-row-portrait="3"] {
    grid-row-start: 3;
  }

  .stream-tile[data-col-span-portrait="1"] {
    grid-column-end: span 1;
  }

  .stream-tile[data-col-span-portrait="2"] {
    grid-column-end: span 2;
  }

  .stream-tile[data-col-span-portrait="3"] {
    grid-column-end: span 3;
  }

  .stream-tile[data-row-span-portrait="1"] {
    grid-row-end: span 1;
  }

  .stream-tile[data-row-span-portrait="2"] {
    grid-row-end: span 2;
  }

  .stream-tile[data-row-span-portrait="3"] {
    grid-row-end: span 3;
  }
}

/* A tile's strip above its picture, its one bar: LIVE, who, the size, the tier, sound and volume,
   full screen, More, Stop watching. A double click on it toggles Focus, so it selects no text. */
.stream-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 6px 0 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  flex: none;
  min-width: 0;
  user-select: none;
  -webkit-user-select: none;
}

.stream-title {
  font-weight: 700;
  color: var(--text-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-spacer {
  flex: 1;
}

/* A tile's More opens over the picture, under the strip and within the tile (whose edge clips
   what reaches past it, and which holds its menu as a size container does), and scrolls when the
   tile is shorter than its choices. Report a problem's thanks shows there too. */
.stream-header .stream-more {
  position: static;
}

.stream-more .icon-menu-choices,
.stream-more .problem-status {
  top: 44px;
  right: 6px;
}

.stream-more .icon-menu-choices {
  max-height: calc(100% - 52px);
}

/* One cell the picture's size: the <video>'s 100 % is that, also in a tile wider than the stream
   (two stacked beside the channel), where the picture is pillarboxed rather than cut off. */
.stream-picture {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  background: #000;
}

.stream-picture video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.stream-picture[hidden] {
  display: none;
}

.stream-tile:fullscreen .stream-header,
.stream-tile:fullscreen .stream-stats {
  display: none;
}

/* The desktop app's window full screen for the picture in it: the stage over the whole view, under
   menus and dialogs, its bar as when the stage is full screen in a browser. */
.stream-view-fill {
  position: fixed;
  inset: 0;
  z-index: 25;
}

.stream-view-fill .stage-channels {
  display: none;
}

/* Inside the desktop app, which draws the picture over this box: black, with nothing of the page
   on it (the picture would cover it). */
.stream-native-picture {
  width: 100%;
  height: 100%;
  background: #000;
}

.stream-overlay {
  position: absolute;
  margin: 0;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-1);
}

/* Inside the desktop app, which cannot watch yet: where to watch meanwhile. */
.stream-app-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 26rem;
  text-align: center;
}

.stream-app-note p {
  margin: 0;
}

/* A stream popped out into the browser's picture-in-picture window: its place says so, with Back. */
.stream-popped-out {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.stream-popped-out p {
  margin: 0;
}

/* The <video> the browser's picture-in-picture window shows (js/watch.js): on the page, so the
   window plays on whatever the page shows, and never seen there. */
.stream-floating {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Inside the desktop app, which plays the stream in a window of its own: that window's controls. */
.stream-native {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 34rem;
  padding: 16px;
  text-align: center;
  color: var(--text-1);
}

.stream-native p {
  margin: 0;
}

.stream-native-title {
  color: var(--text-0);
  font-weight: 600;
}

.stream-native-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.stream-native ~ .stream-overlay {
  bottom: 16px;
}

.stream-stats {
  padding: 4px 10px;
  flex: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The mini player: the stream in a corner of the page's list while a channel or Today is open (a
   channel's messages, a list's or chore channel's items, Today's). It sits over the channel's place
   (.main-channel), and js/watch.js keeps the list's insets there on it (--list-top, --list-right,
   --list-bottom, --list-left), so it stays clear of the header and of the composer or add box under
   the list. A strip with who and two buttons above a 16:9 picture (nothing drawn on it); dragged to
   another corner (js/watch.js sets data-corner, bottom right at first). Under the page's own
   pop-ups and toasts. */
.mini-player {
  position: absolute;
  right: calc(var(--list-right, 0px) + 12px);
  bottom: calc(var(--list-bottom, 0px) + 12px);
  z-index: 3;
  width: 320px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-0);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.mini-player[data-corner^="top"] {
  top: calc(var(--list-top, 0px) + 12px);
  bottom: auto;
}

.mini-player[data-corner$="left"] {
  left: calc(var(--list-left, 0px) + 12px);
  right: auto;
}

.mini-player[data-dragging] {
  cursor: grabbing;
  opacity: 0.85;
}

.mini-player-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 2px 0 8px;
  background: var(--bg-3);
  flex: none;
}

.mini-player-bar .live-badge {
  cursor: inherit;
}

.mini-player-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-0);
}

.mini-player-bar .icon-btn {
  width: 28px;
  height: 28px;
}

.mini-player .stream-picture {
  flex: none;
  aspect-ratio: 16 / 9;
  cursor: pointer;
}

.mini-player .stream-overlay {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.mini-player .stream-native {
  padding: 8px;
}

.mini-player .stream-app-note,
.mini-player .stream-popped-out {
  gap: 4px;
}

@media (max-width: 768px) {
  /* Room in a tile's strip for the streamer's name. */
  .stream-size {
    display: none;
  }

  .mini-player {
    width: 40%;
  }

  .mini-player-bar .live-badge {
    display: none;
  }
}

/* The Android app's picture-in-picture (js/pip.js sets the class on the root): while its window is
   a small floating picture, only the stream's picture shows, over the whole window, with nothing on
   it. Everything else keeps its place, hidden, so the page is as it was when the window is the app
   again (important: nothing that shows itself on touch screens, as a message's buttons do, shows
   through). The stream is on the stage then; with several streams there, the focused one's picture. */
html.pip body * {
  visibility: hidden !important;
}

html.pip .stream-view .stream-tile.focused .stream-picture,
html.pip .stream-view .stream-tile.focused .stream-picture * {
  visibility: visible !important;
}

html.pip .stream-view .stream-tile.focused .stream-picture {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

/* A size container is the containing block of what is fixed inside it: the stage and the tiles are
   none while the picture fills the window. */
html.pip .stream-stage,
html.pip .stream-tile {
  container-type: normal;
  overflow: visible;
}

html.pip .stream-view .stream-overlay {
  display: none;
}

/* A command breaks at spaces first, so a word or an address stays whole where it fits. */
.code-block {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--text-1);
  font-family: var(--mono);
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* ---------- Mentions and notifications ---------- */

.mention {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--text-0);
  font-weight: 500;
}

/* A message that mentions the viewer stands out, like a highlighted line. */
.msg.msg-mentioned {
  background: rgba(240, 178, 50, 0.08);
  box-shadow: inset 2px 0 0 var(--mention);
}

@media (hover: hover) {
  .device-option:hover {
    background: var(--bg-hover);
  }
}

@media (hover: hover) {
  .msg.msg-mentioned:hover {
    background: rgba(240, 178, 50, 0.12);
  }
}

.device-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.device-actions {
  display: flex;
  margin-bottom: 12px;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  cursor: pointer;
}

.choice input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.choice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-section .choice + .hint {
  margin-top: 10px;
}

.choice.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.choice input:disabled {
  cursor: not-allowed;
}

/* ---------- Private channels and groups ---------- */

/* Who can see this: Everyone or Only some groups, and the groups, members or managers to pick. */
.choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.choices .choice {
  padding: 6px 10px;
}

.field-label {
  flex-basis: 100%;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pick-list .choice {
  padding: 6px 10px;
}

.pick-table {
  width: 100%;
  max-width: 480px;
  border-collapse: collapse;
}

.pick-table th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
  text-align: center;
}

.pick-table td {
  padding: 4px 6px;
  border-top: 1px solid var(--bg-4);
}

.pick-table td + td {
  width: 88px;
  text-align: center;
}

.pick-table input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.settings-subhead {
  margin: 14px 0 8px;
  font-size: 0.875rem;
}

.group-row .settings-row-main .small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* One channel's settings, from Settings → Channels or the channel's menu. */
/* A private channel's header: "Private" beside the lock, naming who sees it on hover or a tap. */
.private-mark {
  position: relative;
  flex: none;
}

.private-pill {
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-4);
  color: var(--text-2);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.private-pill:hover {
  background: var(--accent-soft);
  color: var(--text-0);
}

.private-names {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color: var(--text-1);
  font-size: 0.875rem;
  white-space: normal;
}

/* Dragging a channel in the sidebar: where it lands. */
.channel[draggable="true"] {
  -webkit-user-drag: element;
}

.channel.drop-target {
  box-shadow: inset 0 2px 0 var(--accent);
}

/* ---------- Settings → Voice & video ---------- */

.audio-settings .field {
  max-width: 480px;
}

.device-missing {
  margin: 8px 0 0;
  color: var(--mention);
}

.level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin-top: 12px;
}

/* What is sent, -60 to 0 dBFS, after noise suppression. */
.level-meter {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-1);
}

.level-meter::-webkit-meter-bar {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-1);
}

.level-meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: var(--online);
  transition: none;
}

.level-meter::-moz-meter-bar {
  border-radius: 999px;
  background: var(--online);
}

.audio-settings .level-row + .hint {
  margin: 6px 0 0;
}

/* The sounds under the speakers, and push-to-talk's key right under the choice of mode. */
.audio-settings .audio-sounds,
.audio-settings .keybind-push-to-talk {
  margin-top: 12px;
}

/* More: the microphone's further tuning, folded at the end of the page. */
.audio-settings .voice-more {
  margin: 20px 0 0;
}

.audio-settings .studio-mic {
  margin: 8px 0 0;
}

/* Voice volume and input volume: the name and the value over the slider. */
.volume-field {
  margin-top: 12px;
}

.audio-settings h3 + .volume-field {
  margin-top: 0;
}

.volume-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.volume-value {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.volume-field input {
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}

.volume-field + .hint {
  margin-top: 6px;
}

/* ---------- Settings → Voice & video → How you talk ---------- */

.keybind-row {
  flex-wrap: wrap;
}

.keybind-row.capturing {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.keybind-row .settings-row-main > span.small {
  white-space: normal;
}

.keybind-conflict {
  color: var(--mention);
}

.keybind-prompt {
  color: var(--text-1);
}

.keybind-prompt.refused {
  color: #ff9a9d;
}

/* The key: what is bound, as keycaps; click it to bind another. */
.keybind-key {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 180px; /* one column of keys */
  min-height: 32px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--text-1);
  font-size: 0.875rem;
  cursor: pointer;
}

.keybind-key:hover {
  background: var(--bg-4);
}

.keybind-key:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.keybind-key[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.keybind-key kbd {
  padding: 1px 6px;
  border: 1px solid var(--bg-4);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-0);
  font-family: var(--font);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.keybind-plus {
  color: var(--text-3);
}

.keybind-waiting {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 768px) {
  .keybind-row .settings-row-main {
    flex-basis: 100%;
  }

  .keybind-key {
    flex: 1;
    width: auto;
  }
}

/* ---------- Replies and reactions ---------- */

/* The system's own colour emoji fonts, named so emoji draw in colour everywhere (nothing is fetched). */
.reaction-emoji,
.emoji-btn {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--font);
}

/* A reply's quote sits above the author's name, joined to the avatar by a thin spine. */
.msg-reply {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 20px;
  margin-bottom: 2px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.msg-has-reply .msg-avatar {
  top: 26px;
}

.msg-reply-spine {
  position: absolute;
  left: -36px;
  top: 10px;
  width: 30px;
  height: 14px;
  border-top: 2px solid var(--bg-4);
  border-left: 2px solid var(--bg-4);
  border-top-left-radius: 6px;
}

.msg-reply-quote {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.msg-reply-author {
  flex: none;
  font-weight: 600;
  color: var(--text-2);
}

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

.msg-reply-deleted {
  font-style: italic;
}

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

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

.reaction.mine {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-0);
}

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

.reaction-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.reaction-add {
  padding: 0 6px;
  color: var(--text-3);
  visibility: hidden;
}

.reaction-add .icon {
  width: 16px;
  height: 16px;
}

.msg:focus-within .reaction-add {
  visibility: visible;
}

@media (hover: hover) {
  .reaction:hover {
    border-color: var(--text-4);
  }

  .msg:hover .reaction-add {
    visibility: visible;
  }
}

/* Touch screens have no hover: the add button stays, and the targets grow for fingers. */
@media (hover: none) {
  .reaction-add {
    visibility: visible;
  }

  .reaction {
    height: 32px;
  }
}

/* "Replying to <name>" above the composer, joined to it. */
.composer-reply {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px;
  padding: 2px 4px 2px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-2);
  font-size: 0.8125rem;
  color: var(--text-2);
  flex: none;
}

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

.composer-reply strong {
  color: var(--text-0);
}

.composer-reply-cancel .icon {
  width: 16px;
  height: 16px;
}

.composer.composer-replying,
.composer.composer-replying .input-area {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* The reaction picker: docked above the composer, a sheet on phones. */
.emoji-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5;
}

.emoji-picker {
  position: absolute;
  right: 16px;
  bottom: 84px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: calc(100% - 32px);
  height: min(420px, calc(100% - 140px));
  border: 1px solid var(--bg-1);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.emoji-palette {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 4px;
}

.emoji-close {
  margin-left: auto;
}

.emoji-search {
  flex: none;
  margin: 4px 8px 8px;
}

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

.emoji-group-name {
  position: sticky;
  top: 0;
  padding: 6px 2px 4px;
  background: var(--bg-2);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
}

.emoji-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

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

@media (hover: hover) {
  .emoji-btn:hover {
    background: var(--bg-hover);
  }
}

.emoji-btn.mine {
  background: var(--accent-soft);
}

.emoji-note {
  padding: 12px 4px;
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .msg-reply-spine {
    left: -28px;
    width: 24px;
  }

  .composer-reply {
    margin: 0 8px;
  }

  .emoji-picker {
    left: 8px;
    right: 8px;
    bottom: 72px;
    width: auto;
    max-width: none;
    height: min(60vh, calc(100% - 120px));
  }
}

/* ---------- Pins, polls and reminders ---------- */

.channel-header-pins.active {
  background: var(--bg-active);
  color: var(--text-0);
}

/* A pinned message: a line above its text, and a thin accent on its left. */
.messages .msg.msg-pinned {
  box-shadow: inset 2px 0 0 var(--accent-soft);
}

.msg-pin-note {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 0.75rem;
}

.msg-pin-note .icon {
  width: 13px;
  height: 13px;
}

/* The "Pinned messages" panel reuses the search panel; each entry has Unpin beside it. */
.pin-item {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.pin-item .search-hit {
  flex: 1;
  min-width: 0;
}

.pin-item-by {
  color: var(--text-3);
  font-size: 0.75rem;
}

.pin-item-poll {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  vertical-align: -2px;
}

.search-panel-title .icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: -3px;
}

/* A poll inline in its message. */
.poll {
  max-width: 480px;
  margin: 4px 0 2px;
  padding: 12px;
  border: 1px solid var(--bg-1);
  border-radius: var(--radius);
  background: var(--bg-2);
}

.poll-question {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-0);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.poll-icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--accent);
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* An option is a button with its share drawn by a <progress> behind the text: the CSP allows no
   inline styles, so a width cannot be set in markup. */
.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  overflow: hidden;
  border: 1px solid var(--bg-4);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}

.poll-option:hover:not(:disabled) {
  border-color: var(--text-4);
}

.poll-option.mine {
  border-color: var(--accent);
}

.poll-option:disabled {
  cursor: default;
}

.poll-bar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}

.poll-bar::-webkit-progress-bar {
  background: transparent;
}

.poll-bar::-webkit-progress-value {
  background: var(--bg-hover);
}

.poll-bar::-moz-progress-bar {
  background: var(--bg-hover);
}

.poll-option.mine .poll-bar::-webkit-progress-value {
  background: var(--accent-soft);
}

.poll-option.mine .poll-bar::-moz-progress-bar {
  background: var(--accent-soft);
}

.poll-option-text {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.poll-check {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  vertical-align: -2px;
  color: var(--accent);
}

.poll-option-count {
  position: relative;
  flex: none;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.poll-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-3);
  font-size: 0.8125rem;
}

.poll-closed .poll-option {
  opacity: 0.85;
}

/* The new-poll dialog. */
.poll-dialog {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.poll-dialog-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.poll-dialog-options legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.poll-dialog-option {
  display: flex;
  align-items: center;
  gap: 4px;
}

.poll-dialog-option input {
  flex: 1;
}

.poll-dialog-add {
  align-self: flex-start;
}

/* "Remind me". */
.reminder-dialog {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reminder-dialog-about {
  margin: 0;
  color: var(--text-2);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.reminder-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reminder-pick {
  display: flex;
  gap: 10px;
}

.reminder-pick .field {
  flex: 1;
  min-width: 0;
}

/* The waiting reminders. */
.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.reminder-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.reminder-row-icon {
  flex: none;
  margin-top: 2px;
  color: var(--accent);
}

.reminder-row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.reminder-row-when {
  color: var(--text-0);
  font-weight: 600;
}

.reminder-row-note {
  color: var(--text-1);
}

.reminder-row-about {
  color: var(--text-3);
  font-size: 0.8125rem;
}

/* Reminders that went off: notices in the flow under the channel's header (or at the top of the
   main area with no channel open), so they cover no panel or button. */
.reminder-notices {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 16px 0;
  max-height: 40vh;
  overflow-y: auto;
}

.reminder-notice {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.reminder-notice-icon {
  flex: none;
  color: var(--accent);
}

.reminder-notice-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.reminder-notice-title {
  color: var(--text-0);
  font-weight: 700;
}

.reminder-notice-note {
  color: var(--text-0);
}

.reminder-notice-about {
  color: var(--text-2);
  font-size: 0.875rem;
}

.reminder-notice-late {
  color: var(--text-3);
  font-size: 0.8125rem;
}

.reminder-notice-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* A toast that says something worked, rather than what went wrong. */
.toast.toast-info {
  background: var(--bg-4);
  color: var(--text-0);
}

@media (max-width: 768px) {
  .poll {
    max-width: none;
  }

  .reminder-pick {
    flex-direction: column;
  }
}

/* ---------- Jam ---------- */

/* Under a voice channel whose jam plays: what it plays, for everyone. */
.jam-line {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0 0 2px;
  padding: 2px 8px 2px 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
}

button.jam-line {
  cursor: pointer;
}

button.jam-line:hover {
  background: var(--bg-hover);
}

.jam-line .jam-line-icon {
  width: 14px;
  height: 14px;
}

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

/* The panel: in the member list's place on wide screens, over the right of the page on medium
   ones, a sheet over the channel on phones. */
.jam-scrim {
  display: none;
}

.jam-panel {
  grid-column: -2 / -1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--bg-1);
  background: var(--bg-2);
}

.jam-panel:focus {
  outline: none;
}

@media (min-width: 1200px) {
  .shell.jam-open {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--jam-w);
  }

  .shell.jam-open .members {
    display: none;
  }

  .shell.stage-wide.jam-open {
    grid-template-columns: minmax(0, 1fr) var(--jam-w);
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  .jam-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 12;
    width: min(var(--jam-w), 100vw);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
  }
}

@media (max-width: 768px) {
  .jam-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 17;
    background: rgba(0, 0, 0, 0.55);
  }

  .jam-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 18;
    max-height: 88vh;
    max-height: 88dvh;
    border-left: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.jam-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-width: 0;
  height: var(--header-h);
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--bg-1);
}

.jam-head-icon {
  color: var(--accent);
}

.jam-head-title {
  font-size: 1rem;
  font-weight: 700;
}

.jam-head-channel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: 0.875rem;
}

.jam-head .icon-menu,
.jam-head .jam-back {
  flex: none;
}

.jam-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
}

.jam-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(240, 178, 50, 0.12);
  color: var(--mention);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.jam-refusal {
  margin: 0;
  color: var(--danger);
  font-size: 0.875rem;
  line-height: 1.35;
}

.jam-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.jam-empty p {
  margin: 0;
}

.jam-now-title {
  margin: 0;
  color: var(--text-0);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.jam-now-artist,
.jam-now-by {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.jam-now-by {
  color: var(--text-3);
}

.jam-now-time {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

/* The position bar: anyone drags it, and the song moves there for everyone. */
.jam-seek {
  flex: 1;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent);
}

.jam-clock {
  color: var(--text-2);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Skip, ♥ and the music's volume: under the song. More holds the rest. */
.jam-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

/* ♥: the member's own like; filled while they like the song. */
.icon-btn.jam-like {
  flex: none;
  width: 28px;
  height: 28px;
}

.jam-like .icon {
  width: 16px;
  height: 16px;
}

.jam-like.on {
  color: var(--danger);
}

.jam-like.on .icon path {
  fill: currentColor;
}

/* The empty box's lists: the newest songs, ♥ Favourites and the songs played earlier. */
.jam-tabs {
  display: flex;
  gap: 4px;
  margin: 8px 0 0;
}

.jam-tab {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.jam-tab.on {
  border-color: var(--accent);
  color: var(--text-0);
}

.jam-idle,
.jam-empty-line {
  margin: 0;
  font-size: 0.875rem;
}

.jam-section-title {
  margin: 0 0 6px;
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.jam-queue,
.jam-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jam-queue {
  counter-reset: jam;
}

.jam-results {
  margin-top: 4px;
}

.jam-track,
.jam-result {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 2px 4px 6px;
  border-radius: var(--radius-sm);
}

.jam-track::before {
  counter-increment: jam;
  content: counter(jam) ".";
  min-width: 1.4em;
  color: var(--text-3);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .jam-track:hover,
  .jam-result:hover {
    background: var(--bg-hover);
  }
}

.jam-track-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.jam-track-title,
.jam-track-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jam-track-title {
  color: var(--text-1);
  font-size: 0.875rem;
}

.jam-track-meta,
.jam-track-length {
  color: var(--text-3);
  font-size: 0.75rem;
}

.jam-track-length {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.icon-btn.jam-remove {
  width: 28px;
  height: 28px;
}

.jam-remove .icon {
  width: 16px;
  height: 16px;
}

.jam-from {
  margin: 6px 0 0;
  font-size: 0.75rem;
}

/* The music's one volume control for me (♪ Jam's per-person setting), beside Skip and ♥. */
.jam-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 140px;
  min-width: 0;
  color: var(--text-2);
}

.jam-volume .icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.jam-volume-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.jam-volume.off .jam-volume-slider {
  opacity: 0.5;
}

/* Add a song, under Up next: the page with the library's search. */
.jam-add-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.jam-add-open .icon {
  width: 16px;
  height: 16px;
}

.jam-full {
  margin: 6px 0 0;
  font-size: 0.75rem;
}

/* The library's search: a box with a magnifier in it; it searches as it is typed. */
.jam-add-form {
  position: relative;
  display: flex;
}

.jam-add-form .jam-add-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.jam-add-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding-left: 32px;
}

.jam-search-refusal {
  margin-top: 8px;
}

/* A found song's cover, small; a note where it has none. */
.jam-cover {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-1);
}

.jam-cover-none {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
}

.jam-cover-none .icon {
  width: 18px;
  height: 18px;
}

/* Settings → About: the open-source parts and their licence text. */
.licence-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.licence {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.licence-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.licence-name {
  font-weight: 600;
}

.licence-head .btn {
  margin-left: auto;
}

.licence-text {
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 320px;
  overflow: auto;
  margin: 6px 0 0;
}

.jam-add .jam-empty-line {
  margin-top: 8px;
}

.jam-result .jam-result-add {
  flex: none;
}

.jam-added {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--online);
  font-size: 0.8125rem;
}

.jam-added .icon {
  width: 16px;
  height: 16px;
}

/* Request a song: the offer under the library's results, its search, and the channel's requests. */
.jam-request-offer {
  margin: 8px 0 0;
  color: var(--text-3);
  font-size: 0.8125rem;
}

.jam-request-open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.jam-request-open:hover {
  text-decoration: underline;
}

.jam-request-form {
  gap: 6px;
  margin-top: 6px;
}

.jam-request-form .jam-request-search {
  flex: none;
  min-height: 38px;
}

.jam-request .jam-from {
  margin: 6px 0 0;
  font-size: 0.75rem;
}

/* A release's one line, "Daft Punk, Discovery · 327 MB": it wraps rather than hide its size. */
.jam-release .jam-track-title {
  white-space: normal;
  overflow-wrap: anywhere;
}

.jam-request-state {
  color: var(--text-2);
}

/* Full touch targets on phones and tablets. */
@media (pointer: coarse) and (hover: none) {
  .jam-head .icon-btn,
  .jam-controls .icon-btn,
  .icon-btn.jam-remove,
  .icon-btn.jam-like {
    width: 44px;
    height: 44px;
  }

  .jam-tab,
  .jam-add-open,
  .jam-add-input,
  .jam-request-form .jam-request-search,
  .jam-result .jam-result-add,
  .jam-empty .jam-start {
    min-height: 44px;
  }

  .jam-line {
    min-height: 32px;
  }
}

/* ---------- List channels ---------- */

.list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 0 8px;
}

.list-empty {
  margin: 0;
  padding: 16px;
}

.list-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 16px;
  color: var(--text-1);
  transition: background-color 0.3s;
}

/* Only a chore's row does something besides its circle: it opens the editor. */
.chore-item:hover {
  background: var(--bg-msg-hover);
}

/* The item just added, or the one already there. */
.list-item.found {
  background: var(--accent-soft);
}

/* The item in primary text, with who and when under it, smaller and secondary. */
.list-item-line {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1px 0;
  overflow-wrap: anywhere;
}

.list-item-meta {
  color: var(--text-3);
  font-size: 0.8125rem;
}

.list-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid var(--text-4);
  border-radius: 50%;
  background: none;
  color: transparent;
  cursor: pointer;
}

.list-check .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.list-check:hover,
.list-check:focus-visible {
  border-color: var(--online);
  color: var(--online);
}

/* Pressed: the circle fills while the hub answers, then the row goes. */
.list-check:active,
.list-check.done {
  border-color: var(--online);
  background: var(--online);
  color: #fff;
}

.list-said,
.list-undo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 8px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.list-add .composer-row {
  align-items: center;
}

.list-add .input-area {
  padding-left: 14px;
}

.list-add-btn {
  margin-right: 6px;
}

@media (pointer: coarse) and (hover: none) {
  .list-check {
    width: 32px;
    height: 32px;
  }

  .list-item {
    min-height: 44px;
  }
}

/* Ask to join (docs/voice.md): the picker and the banners. */
/* The picker's title, with its × in the top right corner. */
.ask-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ask-head .modal-title {
  margin-bottom: 0;
}

.ask-choices {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
}

.ask-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
}

.ask-choice.offline {
  color: var(--text-3);
}

.ask-everyone {
  font-weight: 600;
}

.voice-ask {
  align-items: flex-start;
}

/* The welcome strip over the chat: a card in the notices' look, with its close at the top right. */
.welcome-strip {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 16px 0;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-3);
}

.welcome-strip-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.welcome-strip-title {
  color: var(--text-0);
  font-weight: 700;
}

.welcome-strip-line {
  color: var(--text-0);
}

.welcome-strip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.welcome-strip-said {
  color: var(--text-2);
  font-size: 0.875rem;
}

.welcome-strip-close {
  flex: none;
  margin: -6px -6px 0 0;
}

/* ---------- Calendar channels ---------- */

/* The line above the chat: the calendar needs connecting again, or its copy is old. */
.calendar-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 16px;
  border-bottom: 1px solid var(--bg-1);
  background: var(--accent-soft);
  color: var(--text-1);
  font-size: 0.875rem;
  flex: none;
}

/* Upcoming: a column beside the messages; on a phone and beside the stage, a strip above them. */
.upcoming {
  flex: none;
  display: flex;
  flex-direction: column;
  width: 300px;
  min-height: 0;
  border-left: 1px solid var(--bg-1);
  background: var(--bg-2);
}

.upcoming-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--bg-1);
  flex: none;
}

.upcoming-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text-0);
  font-size: 0.9375rem;
  font-weight: 600;
}

.upcoming-fold {
  display: none;
}

.upcoming-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 8px 12px;
}

.upcoming-day {
  margin: 12px 8px 4px;
  color: var(--text-3);
  font-size: 0.8125rem;
  font-weight: 700;
}

.upcoming-events {
  margin: 0;
  padding: 0;
  list-style: none;
}

.upcoming-event {
  position: relative;
}

.upcoming-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}

.upcoming-line:hover,
.upcoming-line.active {
  background: var(--bg-hover);
  color: var(--text-0);
}

.upcoming-line-place {
  color: var(--text-3);
  font-size: 0.8125rem;
}

.upcoming-empty {
  margin: 12px 8px;
  font-size: 0.875rem;
}

.upcoming-link {
  margin: 12px 8px;
}

.upcoming-card-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.upcoming-card {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 31;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.upcoming-card:focus {
  outline: none;
}

.upcoming-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.upcoming-card-title {
  flex: 1;
  margin: 0;
  color: var(--text-0);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.upcoming-card-when,
.upcoming-card-place {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text-2);
  font-size: 0.875rem;
}

.upcoming-ask {
  align-self: flex-start;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .channel-body.has-upcoming {
    flex-direction: column;
  }
}

.channel-pane.beside .channel-body.has-upcoming {
  flex-direction: column;
}

@media (max-width: 768px) {
  .has-upcoming .upcoming {
    order: -1;
    width: auto;
    max-height: 40vh;
    border-left: 0;
    border-bottom: 1px solid var(--bg-1);
  }

  .has-upcoming .upcoming-fold {
    display: inline-flex;
  }

  .has-upcoming .upcoming.folded .upcoming-body {
    display: none;
  }
}

.channel-pane.beside .has-upcoming .upcoming {
  order: -1;
  width: auto;
  max-height: 40%;
  border-left: 0;
  border-bottom: 1px solid var(--bg-1);
}

.channel-pane.beside .has-upcoming .upcoming-fold {
  display: inline-flex;
}

.channel-pane.beside .has-upcoming .upcoming.folded .upcoming-body {
  display: none;
}

/* ---------- The builder channel ---------- */

/* The one line above the chat. */
.builder-notice {
  margin: 0;
  padding: 6px 16px;
  border-bottom: 1px solid var(--bg-1);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 0.875rem;
  flex: none;
}

/* The Builds list: the Upcoming column's layout, with a line per build. */
.builds-waiting {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 8px 8px 4px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-1);
  font-size: 0.875rem;
}

.builds-error {
  margin: 8px;
}

/* The four tabs over the list: To do, In progress, Done, Failed. */
.builds-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 8px 4px;
}

.builds-tab {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.builds-tab:hover {
  background: var(--bg-hover);
  color: var(--text-0);
}

.builds-tab.active {
  border-color: var(--accent);
  color: var(--text-0);
}

.builds-panel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

.build-earlier {
  color: var(--text-3);
  font-size: 0.75rem;
}

.build {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

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

.build-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.build-title {
  color: var(--text-0);
  overflow-wrap: anywhere;
}

.build-details {
  color: var(--text-3);
  font-size: 0.8125rem;
}

/* What the builder does now, under the title. */
.build-step {
  color: var(--text-2);
  font-size: 0.75rem;
}

.build-side {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

.build-chip {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-4);
  color: var(--text-2);
}

.build-chip.build-working {
  background: var(--accent-soft);
  color: var(--text-0);
}

.build-chip.build-waiting {
  background: rgba(240, 178, 50, 0.2);
  color: var(--mention);
}

.build-chip.build-done {
  background: rgba(59, 165, 92, 0.2);
  color: var(--online);
}

.build-chip.build-problem {
  background: rgba(229, 72, 77, 0.2);
  color: var(--danger);
}

/* Over without a change (filed, cancelled, expired): quieter than the rest. */
.build-chip.build-ended {
  background: var(--bg-3);
  color: var(--text-3);
}

.build-cancel {
  width: 24px;
  height: 24px;
}

/* Settings → Builder. */
.builder-warning {
  margin: 4px 0 0;
  color: var(--mention);
}

.builder-connection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
}

.builder-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-4);
}

.builder-connection.connected .builder-dot {
  background: var(--online);
}

.builder-new-token input {
  font-family: var(--mono);
}

/* Settings → Calendars, and a calendar channel's settings. */
.calendar-account-problem {
  color: var(--mention);
}

.calendar-link-buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 12px;
}

.calendar-picker .choice.disabled {
  opacity: 0.6;
}

.channel-reminders {
  gap: 10px;
}

.channel-reminder-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* "Before each event" has no switch: its name starts where the other rows' names do. */
.channel-reminder-name {
  padding-left: 36px;
  cursor: default;
}

.reminders-read {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
}

.reminders-read dt {
  color: var(--text-3);
}

.reminders-read dd {
  margin: 0;
}

/* ---------- Chore channels (the list pane with more on each line) ---------- */

/* What waits for the member: the red number on a row of the channel list (ChannelBadges). */
.channel-count {
  flex: none;
  min-width: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.group-count {
  margin-left: 6px;
}

.chore-group {
  margin: 12px 16px 4px;
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.chore-group:first-child {
  margin-top: 0;
}

.chore-group.overdue,
.chore-when.overdue {
  color: var(--danger);
}

/* The chore itself: a tap opens the editor. */
.chore-open {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.chore-sub {
  color: var(--text-3);
  font-size: 0.8125rem;
}

.chore-mine[aria-pressed="true"],
.chore-weekday[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-0);
}

.chore-every {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.chore-every input {
  width: 4.5em;
}

.chore-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chore-editor .modal-actions .chore-delete {
  margin-right: auto;
}

/* ---------- Today: the plans' page, in the chat's place (the list pane's rows) ---------- */

/* A part: Chores, Upcoming, Lists. */
.today-heading {
  margin: 16px 16px 4px;
  color: var(--text-1);
  font-size: 0.9375rem;
  font-weight: 700;
}

.today-part:first-child .today-heading {
  margin-top: 0;
}

/* Within a part: Overdue (in red) and Today, or a day. */
.today-sub {
  margin: 8px 16px 2px;
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 700;
}

.today-sub.overdue {
  color: var(--danger);
}

.today-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A row opens its channel at it; a chore's circle stays its own button. */
.today-open,
.today-item {
  display: flex;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.today-open {
  flex: 1;
  flex-direction: column;
  padding: 1px 0;
}

.today-open:hover,
.today-item:hover {
  text-decoration: none;
}

.today-item {
  align-items: center;
  gap: 10px;
  padding: 5px 16px;
  color: var(--text-1);
}

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

.today-event {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.today-list-icon {
  flex: none;
  color: var(--text-4);
}

.today-list-line {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.today-list-line .list-item-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-list.unread .today-list-name {
  color: var(--text-0);
  font-weight: 700;
}

.today-list.unread .today-list-icon {
  color: var(--text-2);
}

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

.today-empty {
  margin: 0;
  padding: 4px 16px 8px;
}

/* A part that failed to load, with Try again, above what the other channels gave. */
.today-failed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0 16px 4px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.today-waiting {
  display: flex;
  justify-content: center;
  padding: 8px;
}

.today-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: today-spin 0.8s linear infinite;
}

@keyframes today-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Direct messages: the sidebar section, New message, the member menu and the conversation ---- */

.group-title .group-add {
  margin-left: auto;
  width: 22px;
  height: 22px;
}

.group-title .group-add .icon {
  width: 14px;
  height: 14px;
}

.channel.direct {
  gap: 8px;
}

.direct-empty {
  margin: 2px 8px;
  font-size: 0.875rem;
  color: var(--text-4);
}

.direct-picker-list {
  max-height: min(60vh, 420px);
  margin: 0 0 12px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.direct-picker-member,
.member-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.direct-picker-member {
  min-height: 40px;
  padding: 6px 8px;
}

.direct-picker-member:hover,
.direct-picker-member:focus-visible {
  background: var(--bg-hover);
}

.member-anchor {
  position: relative;
}

.member-btn > .member {
  flex: 1;
}

.member-menu,
.msg-avatar-anchor .header-menu {
  left: 0;
  right: auto;
}

.msg-avatar-anchor {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 40px;
  height: 40px;
}

.msg-avatar-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.msg-avatar-btn .avatar {
  width: 40px;
  height: 40px;
  font-size: 1.125rem;
}

.channel-header-avatar {
  flex: none;
}

.channel-start-avatar {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  font-size: 1.75rem;
}

.direct-gone {
  margin: 0 16px 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-3);
  text-align: center;
}
