.select {
  position: relative;
}

.select select {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  opacity: 0;
}

.select__trigger {
  display: flex;
  gap: var(--space-10);
  align-items: center;
  text-align: left;
  cursor: pointer;
}

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

.select__trigger:focus-visible,
.select.is-open .select__trigger {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select__chevron {
  display: flex;
  flex: none;
  color: var(--muted);
  transition: transform var(--duration);
}

.select.is-open .select__chevron {
  display: flex;
  color: var(--primary-text);
  transform: rotate(180deg);
}

.select__panel {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 100%;
  max-height: var(--sheet-max-height);
  margin: 0;
  padding: 0 0 env(safe-area-inset-bottom);
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 0;
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition:
    transform var(--duration-sheet) ease-out,
    overlay var(--duration-sheet) allow-discrete,
    display var(--duration-sheet) allow-discrete;
}

.select__panel:popover-open {
  display: flex;
  flex-direction: column;
  transform: none;
}

.select__panel::backdrop {
  background: var(--scrim);
}

@starting-style {
  .select__panel:popover-open {
    transform: translateY(100%);
  }
}

.select__head {
  flex: none;
  border-bottom: 1px solid var(--border-soft);
}

.select__title {
  margin: 0;
  padding: var(--space-6) var(--space-16) var(--space-10);
  font-weight: 700;
}

.select__list {
  flex: 1;
  margin: 0;
  padding: var(--space-4) 0;
  overflow: auto;
  list-style: none;
  overscroll-behavior: contain;
}

.select__empty {
  margin: 0;
  padding: var(--space-12) var(--space-16);
  color: var(--muted);
}

@media (width >= 720px) {
  .select__panel {
    inset: auto;
    width: auto;
    max-height: 340px;
    padding: 0;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: none;
    transition: none;
  }

  .select__panel::backdrop {
    background: none;
  }

  .select__head {
    padding-top: var(--space-10);
  }

  .select__title,
  .select__panel:not(.select__panel--search) .select__head {
    display: none;
  }

  .select__option {
    min-height: var(--control-height-sm);
    padding-inline: var(--space-12);
  }
}
