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

* {
  box-sizing: border-box;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.channel {
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}
.channel:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.channel.active {
  background: var(--bg-active);
  color: var(--text-strong);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.small {
  font-size: 12px;
}

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

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

.chat {
  position: relative;
}

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

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

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

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

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

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

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

/* Composer with uploads */

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

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

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

/* Modal, lightbox, context menu */

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

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

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

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

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

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

.volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
}
.volume-row input {
  flex: 1;
  accent-color: var(--accent);
}

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

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

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

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

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

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

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

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

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

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

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: black;
}
.stage-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 16px;
  background: var(--bg-darkest);
}
.stage-title {
  flex: 1;
  font-weight: 600;
  color: var(--text-strong);
}
.stage-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.stage-volume input {
  width: 100px;
  accent-color: var(--accent);
}
.stage-video {
  position: relative;
  flex: 1;
  min-height: 0;
}
.stage-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage-waiting {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

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

.channel .channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel.unread {
  color: var(--text-strong);
  font-weight: 600;
  position: relative;
}
.channel.unread::before {
  content: '';
  position: absolute;
  left: -8px;
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--text-strong);
}
.mention-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

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

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

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

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

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

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

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

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

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

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

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

.mobile-only {
  display: none;
}

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

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

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

  /* Taller rows to tap. */
  .channel {
    padding: 10px 8px;
  }
  .member {
    padding: 8px;
  }
  .icon-button {
    width: 40px;
    height: 40px;
  }

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

  .login-card {
    padding: 24px;
  }
  .modal {
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
  .lightbox img {
    max-width: 100vw;
  }
}

/* Desktop app downloads (web version) */

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