select {
  width: 100%;
  border: 1px solid var(--field-line);
  border-radius: 0.75rem;
  background: var(--ground);
  color: var(--text);
  padding: 0.8rem 0.9rem;
}

select:focus {
  outline: 2px solid var(--signature-text);
  outline-offset: 2px;
}

.optional-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rooms-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 0.8rem;
}

.icon-button {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--field-line);
  border-radius: 0.6rem;
  background: var(--raised);
  color: var(--text);
  place-items: center;
  font-size: 1.25rem;
  line-height: 1;
}

.room-header {
  grid-row: 1;
  grid-column: 1;
}

.empty-state,
.message-list {
  grid-row: 2;
  grid-column: 1;
}

.composer-wrap {
  grid-row: 3;
  grid-column: 1;
}

.room-dialog {
  width: min(32rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.room-dialog::backdrop {
  background: var(--scrim-strong);
  backdrop-filter: blur(3px);
}

.room-dialog form {
  padding: 1.5rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-header h2 {
  margin: 0;
}

/* The message a moderator is about to act on, quoted in the dialog. */
.moderation-dialog h2 { margin: 0; }
.moderation-quote {
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-left: 3px solid var(--signature-text);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--raised);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.moderation-quote strong { color: var(--text); }

code {
  border-radius: 0.25rem;
  background: var(--raised);
  padding: 0.08rem 0.3rem;
}

#load-older-button {
  align-self: center;
}

/* The attach control is a paperclip inside the message field. */
.composer-field {
  position: relative;
  display: grid;
  min-width: 0;
}

.composer-field textarea {
  padding-right: 2.9rem;
  padding-left: 2.9rem;
}

/* The emoji button mirrors the attach button in the field's right corner. */
.emoji-button {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--text-muted);
  place-items: center;
}

.emoji-button:hover,
.emoji-button[aria-expanded="true"] {
  background: var(--raised);
  color: var(--text);
}

.emoji-picker {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  z-index: 30;
  display: grid;
  width: min(22rem, calc(100vw - 2rem));
  gap: 0.5rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.emoji-search {
  padding: 0.5rem 0.7rem;
}

.emoji-scroll {
  max-height: 16rem;
  overflow-y: auto;
}

.emoji-section h3 {
  margin: 0.4rem 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.emoji-option {
  padding: 0.25rem 0;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1.4;
}

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

.emoji-empty {
  margin: 0.5rem 0;
  color: var(--text-muted);
  text-align: center;
}

.attachment-button {
  position: absolute;
  bottom: 0.4rem;
  left: 0.4rem;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.55rem;
  color: var(--text-muted);
  cursor: pointer;
  place-items: center;
}

.attachment-button:hover,
.composer-field:has(input[type="file"]:focus-visible) .attachment-button {
  background: var(--raised);
  color: var(--text);
}

.composer-field:has(input[type="file"]:focus-visible) .attachment-button {
  outline: 2px solid var(--signature-text);
  outline-offset: 2px;
}

.composer-field:has(input[type="file"]:disabled) .attachment-button {
  cursor: wait;
  opacity: 0.65;
}

/* A selected file is shown below the field; the row takes no space otherwise. */
form:has(.attachment-selection > button:not(.hidden)) .attachment-button {
  color: var(--signature-text);
}

.attachment-selection {
  display: flex;
  min-width: 0;
  grid-column: 1 / -1;
  align-items: center;
  gap: 0.65rem;
}

.attachment-selection:has(> button.hidden) {
  margin-top: -0.75rem;
}

.attachment-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card {
  display: grid;
  width: min(34rem, 100%);
  gap: 0.65rem;
  margin-top: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--raised);
}

.attachment-preview {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 24rem;
  border-radius: 0.55rem;
  object-fit: contain;
}

.attachment-details {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.attachment-download {
  overflow: hidden;
  color: var(--signature-text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-metadata {
  color: var(--text-muted);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

/* Shared by dialogs on every page, such as Report message in the chat. */
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.danger-button {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--error);
  border-radius: 0.75rem;
  background: transparent;
  color: var(--error);
  font: inherit;
  cursor: pointer;
}

.danger-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--error) 10%, transparent);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Google and Twitch buttons carry their logo before the text. The doubled
   class outranks a.secondary-button and similar display rules. */
.has-provider-icon.has-provider-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}
.provider-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}

/* Ban and mute dialogs: the length as chips, a custom length, and checkboxes. */
.duration-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.duration-choices legend { margin-bottom: 0.4rem; padding: 0; font-weight: 700; }
.duration-choices .duration-chip {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
}
.duration-chip:has(input:checked) { border-color: var(--signature-text); background: var(--raised); font-weight: 700; }
.duration-chip input { margin: 0; accent-color: var(--signature-text); }
.duration-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.duration-custom.hidden { display: none; }
.duration-custom input,
.duration-custom select { width: auto; flex: none; }
.duration-custom input { width: 6rem; }
.moderation-dialog .check-row { display: flex; align-items: flex-start; gap: 0.55rem; font-weight: 400; }
.check-row input { margin-top: 0.25rem; accent-color: var(--signature-text); }
