/* Menus share one spacing scale, one control height, and retained actions. */
dialog:not(.image-viewer):not(#runnerDialog, #screenShareDialog) {
  padding: 20px;
  border-radius: 14px;
}
dialog .dialog-heading {
  min-height: 36px;
  margin: 0 0 12px;
  flex-shrink: 0;
}
dialog:not(:where(#runnerDialog, .image-viewer)) h2,
dialog .dialog-heading h2 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
}
dialog .dialog-heading h2 {
  margin: 0;
}
dialog .dialog-heading .icon-button {
  margin: 0 -4px 0 0;
}
dialog .dialog-heading .menu-back {
  margin: 0;
}
dialog .dialog-heading > .section-heading {
  flex: 1;
  min-width: 0;
}
dialog
  :where(
    button,
    select,
    input:not([type='checkbox']):not([type='range']):not([type='radio']):not([type='color'])
  ) {
  min-height: 36px;
  border-radius: 8px;
  font-size: 13px;
}
dialog :is(.primary, .subtle-button, .danger-subtle) {
  padding: 8px 12px;
  font-weight: 550;
}
dialog select {
  margin-bottom: 0;
}
dialog :is(button, a, input, select, summary):focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 3px;
}
dialog :is(.icon-button, .compact-icon) {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  flex-shrink: 0;
}
dialog h3 {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--theme-quiet);
}
dialog .field-help,
.menu-feedback {
  font-size: 12px;
  line-height: 1.5;
  color: var(--theme-quiet);
}
.menu-tabs {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  background: var(--theme-soft);
  border: 1px solid var(--ui-divider);
  border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.menu-tabs [role='tab'] {
  flex: 1;
  min-width: max-content;
  border: 0;
  background: transparent;
  padding: 7px 8px;
  color: var(--theme-quiet);
  white-space: nowrap;
}
.menu-tabs [role='tab']:focus-visible {
  outline-offset: -2px;
}
.menu-tabs [aria-selected='true'] {
  background: var(--theme-surface);
  color: var(--theme-ink);
  box-shadow: 0 1px 4px var(--theme-shade);
  font-weight: 600;
}
.menu-panel > h3:first-child,
.menu-panel > .section-heading:first-child h3 {
  margin-top: 4px;
}
.menu-panel {
  outline-offset: -2px;
}
.setting-row,
.toggle-row,
.range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 8px 0;
  margin: 0;
  border-bottom: 1px solid var(--ui-divider);
  font-size: 13px;
  font-weight: 400;
}
.setting-row > :is(label, span) {
  flex: 1;
  margin: 0;
  min-width: 0;
}
.setting-row select {
  width: min(200px, 52%);
}
.setting-row > button {
  flex-shrink: 0;
}
.range-row input[type='range'] {
  flex: 1;
  min-width: 0;
  width: auto;
  accent-color: var(--theme-accent);
  padding: 0;
}
.range-row output {
  width: 4ch;
  flex-shrink: 0;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--theme-quiet);
}
dialog input[role='switch'] {
  appearance: none;
  position: relative;
  width: 32px;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--theme-line);
  border-radius: 12px;
  background: var(--theme-line);
  cursor: pointer;
  flex-shrink: 0;
}
dialog input[role='switch']::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: var(--theme-surface);
  transition: transform 120ms;
}
dialog input[role='switch']:checked {
  background: var(--theme-accent);
  border-color: var(--theme-accent);
}
dialog input[role='switch']:checked::before {
  transform: translateX(12px);
  background: var(--theme-on-accent);
}
dialog input[role='switch']:disabled {
  opacity: 0.45;
}
.setting-status {
  height: 28px;
  overflow: auto;
  font-size: 12px;
  color: var(--theme-warn);
}
.setting-status p {
  font-size: 12px;
  margin: 4px 0 0;
}
.menu-feedback {
  height: 32px;
  overflow: auto;
  margin: 8px 0 0;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-heading h3 {
  flex: 1;
}
.section-heading h2 {
  margin: 0;
}
dialog .info-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  background: transparent;
  border: 0;
  color: var(--theme-quiet);
}
.info-button .ui-icon {
  width: 16px;
  height: 16px;
}
.menu-help {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(320px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid var(--theme-line);
  border-radius: 10px;
  background: var(--theme-surface);
  color: var(--theme-ink);
  box-shadow: 0 8px 32px var(--theme-shade);
  font-size: 12px;
  line-height: 1.6;
  max-height: calc(100dvh - 24px);
  overflow: auto;
}
.menu-help p {
  margin: 6px 0 0;
  font-size: 12px;
}
.menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
  gap: 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ui-divider);
  border-radius: 0;
  text-decoration: none;
  text-align: left;
  font-size: 13px;
  color: var(--theme-ink);
}
.menu-link:hover {
  color: var(--theme-link);
  background: transparent;
}
.menu-link [data-ui-icon] {
  color: var(--theme-quiet);
  flex-shrink: 0;
}
.menu-link .ui-icon,
.external-link .ui-icon {
  width: 16px;
  height: 16px;
}
.external-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#accountTitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#accountDialog {
  height: min(420px, calc(100dvh - 32px));
}
.account-dialog-body {
  scrollbar-gutter: stable;
}
.account-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
}
.account-dialog-footer > button {
  width: auto;
  flex-shrink: 0;
}
.account-dialog-footer .menu-feedback {
  flex: 1;
  margin: 0;
}
#accountDialog .panel-feedback {
  height: 36px;
}
.account-link-result {
  height: 36px;
}
.account-link-result p {
  margin: 8px 0;
}
#accountOrigin {
  flex: 1;
  width: auto;
  min-width: 0;
}
#profileAudio {
  border-top: 1px solid var(--ui-divider);
  margin-top: 16px;
}
#profileAudio h3 {
  margin: 10px 0 4px;
}
#profileAudio .range-row {
  border: 0;
  gap: 10px;
}
#profileAudio .section-heading {
  height: 32px;
}
#userProfile .profile-footer {
  margin-top: 4px;
}
#participants .participant-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  width: 100%;
}
#participants .participant-label {
  flex: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
#themeDialog {
  height: min(640px, calc(100dvh - 32px));
}
#themeDialog .theme-library-heading {
  margin-bottom: 4px;
}
#themeDialog .theme-feedback {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding-top: 0;
}
#themeChoices {
  margin-bottom: 0;
}
.appearance-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}
.appearance-footer .theme-actions {
  flex-shrink: 0;
  margin: 0;
}
#themeCards {
  gap: 10px;
}
.theme-card img {
  height: 86px;
}
#customThemeDialog {
  height: min(640px, calc(100dvh - 32px));
}
.custom-preview-content,
.custom-theme-preview {
  min-height: 120px;
}
.theme-upload-feedback {
  height: 32px;
  align-items: center;
}
.theme-upload-feedback > p {
  max-height: 32px;
}
#customThemeFields {
  scrollbar-gutter: stable;
}
#inviteDialog {
  height: min(360px, calc(100dvh - 32px));
}
#inviteDialog > p {
  flex: 0 0 36px;
  margin: 0 0 8px;
}
.invite-action-area {
  flex: 1;
  height: auto;
  min-height: 0;
  justify-content: center;
}
#inviteDialog .panel-feedback {
  height: 36px;
}
.invite-expiry {
  height: 32px;
}
#voiceDialog {
  height: min(420px, calc(100dvh - 32px));
}
#voiceForm {
  margin-top: 8px;
  gap: 12px;
  overflow: hidden;
}
#voiceForm > .channel-form-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.channel-form-body > .channel-form-field {
  flex-shrink: 0;
}
#voiceForm .channel-form-actions {
  margin-top: 0;
}
#voiceFormFeedback {
  flex: 1 0 32px;
  min-height: 32px;
  margin: 0;
  overflow: auto;
}
#textDialog {
  height: min(340px, calc(100dvh - 32px));
}
#textNameHelp {
  flex-shrink: 0;
}
#textFormFeedback {
  flex-basis: 0;
}
.channel-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.channel-field-heading label {
  flex: 1;
  width: auto;
}
#adminDialog {
  height: min(520px, calc(100dvh - 32px));
}
#adminFeedback {
  flex-shrink: 0;
}
.admin-list {
  margin: 0;
}
#adminConfirm {
  height: min(340px, calc(100dvh - 32px));
}
#deleteMessageDialog {
  height: min(340px, calc(100dvh - 32px));
}
@media (max-width: 700px), (pointer: coarse) {
  dialog:not(.image-viewer):not(#runnerDialog, #screenShareDialog) {
    padding: 16px;
  }
  dialog
    :where(
      button,
      select,
      input:not([type='checkbox']):not([type='range']):not([type='radio']):not([type='color'])
    ) {
    min-height: 44px;
  }
  dialog :is(.icon-button, .compact-icon) {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
  dialog
    :where(
      select,
      input:not([type='checkbox']):not([type='range']):not([type='radio']):not([type='color']),
      textarea
    ) {
    font-size: 16px;
  }
  dialog .info-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .menu-tabs {
    gap: 0;
  }
  .menu-tabs [role='tab'] {
    padding-inline: 4px;
    font-size: 12px;
  }
  #settingsDialog {
    top: 12px;
    max-height: calc(100dvh - 24px);
  }
  #profileAudio .section-heading {
    height: 44px;
  }
  .sound-setting {
    min-height: 48px;
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog input[role='switch']::before,
  #microphoneLevel {
    transition: none;
  }
}
