/* Shared dropdown appearance, based on the match opponent picker. */
:root {
  --dropdown-bg: var(--card-bg, #ffffff);
  --dropdown-text: var(--text-color, #1f1f1f);
  --dropdown-border: var(--border-color, rgba(0, 0, 0, 0.12));
  --dropdown-accent: var(--accent-color, #ff6b6b);
  --dropdown-accent-text: var(--accent-text-color, #1f1f1f);
}

html body select:not([multiple]):not([size]),
html body select[size="1"],
html body .opponent-search-input {
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--dropdown-border);
  border-radius: 8px;
  background-color: var(--content-bg, var(--dropdown-bg));
  color: var(--dropdown-text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

html body select:not([multiple]):not([size]),
html body select[size="1"] {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23777777' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

html body select:not(:disabled):is(:hover, :focus-visible),
html body .opponent-search-input:is(:hover, :focus-visible) {
  border-color: var(--dropdown-accent);
}

html body :is(.site-dropdown-menu, .opponent-dropdown, .nav-dropdown-menu,
  .gear-menu, .filter-menu, .emoji-picker-menu, .reaction-details-menu,
  .member-settings-menu, .member-role-menu, .visibility-settings-menu,
  .notification-menu, .notification-accept-options) {
  box-sizing: border-box;
  background: var(--dropdown-bg) !important;
  color: var(--dropdown-text);
  border: 1px solid var(--dropdown-border) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  font-family: inherit;
  font-size: 14px;
}

html body .site-dropdown-menu {
  position: fixed;
  z-index: 10000;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
}

html body .site-dropdown-menu[hidden] { display: none !important; }

html body :is(.site-dropdown-option, .opponent-option,
  .nav-dropdown-menu > a, .nav-dropdown-menu > button, .gear-menu > button,
  .member-settings-option, .notification-accept-option) {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin: 0 !important;
  padding: 12px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--dropdown-border) !important;
  border-radius: 0 !important;
  background: transparent;
  color: var(--dropdown-text);
  box-shadow: none !important;
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transform: none !important;
}

html body :is(.site-dropdown-option, .opponent-option,
  .nav-dropdown-menu > a, .nav-dropdown-menu > button, .gear-menu > button,
  .member-settings-option, .notification-accept-option):last-child { border-bottom: 0 !important; }

html body :is(.site-dropdown-option[aria-selected="true"], .opponent-option.selected) {
  background: color-mix(in srgb, var(--dropdown-accent) 15%, var(--dropdown-bg));
  font-weight: 600;
}

/* Text and outlines switch together; animating currentColor causes a light
   outline to flash before reaching the accent's contrasting text color. */
html body :is(.site-dropdown-option, .opponent-option,
  .nav-dropdown-menu > a, .nav-dropdown-menu > button, .gear-menu > button,
  .filter-menu label, .emoji-option, .member-settings-option,
  .member-role-option, .visibility-option, .notification-accept-option, .notification-link) {
  transition: background-color 0.2s !important;
}

/* Hover and keyboard navigation use the same accent fill in every menu. */
html body :is(.site-dropdown-option, .opponent-option,
  .nav-dropdown-menu > a, .nav-dropdown-menu > button, .gear-menu > button,
  .filter-menu label, .emoji-option, .member-settings-option,
  .member-role-option, .visibility-option, .notification-accept-option, .notification-link):not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible, .is-highlighted) {
  background: var(--dropdown-accent) !important;
  color: var(--dropdown-accent-text) !important;
  outline: 2px solid var(--dropdown-accent-text) !important;
  outline-offset: -2px !important;
  transform: none !important;
}

html body .site-dropdown-option[aria-disabled="true"] {
  color: var(--text-muted, #777);
  cursor: not-allowed;
}

html body .site-dropdown-group {
  padding: 8px 14px;
  color: var(--text-muted, #777);
  font-weight: 700;
}
