.dropdown {
  position: relative;
  display: block;
  min-width: 0;
}

.dropdown > select[data-dropdown-value] {
  position: absolute;
  inset: 0;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dropdown-trigger::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin: -3px 2px 0 0;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
}

.dropdown-trigger:hover,
.dropdown-trigger[aria-expanded="true"] {
  border-color: var(--control-hover);
}

.dropdown-trigger[aria-disabled="true"] {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  cursor: default;
}

.dropdown-list {
  position: fixed;
  z-index: 90;
  inset: auto;
  margin: 0;
  padding: 0.25rem;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
}

.dropdown-list:not([hidden]) {
  display: block;
}

.dropdown-group {
  display: block;
  padding-top: 0.25rem;
}

.dropdown-group-title {
  display: block;
  padding: 0.35rem 0.65rem 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.dropdown-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.dropdown-option[aria-selected="true"] {
  color: var(--blue);
}

.dropdown-option[aria-selected="true"]::after {
  content: "";
  flex: none;
  width: 5px;
  height: 9px;
  margin-right: 3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.dropdown-option[aria-disabled="true"] {
  color: var(--muted);
  cursor: default;
}

.dropdown-option[data-dropdown-active],
.dropdown-option:hover:not([aria-disabled="true"]) {
  background: var(--surface-hover);
}
