@layer select {
  .select-stage {
    min-height: 650px;
    align-items: flex-start;
  }

  .select-showcase {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 36px 28px;
    width: 100%;
    max-width: 760px;
  }

  .select-example {
    min-width: 0;
    display: grid;
    align-content: start;
    justify-items: start;
    gap: 10px;
  }

  .select-caption {
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
  }

  .select-hint {
    color: var(--muted-foreground);
    font-size: 12px;
    line-height: 1.4;
  }

  .select-root {
    position: relative;
    width: 192px;
  }

  .select-root > summary {
    list-style: none;
  }

  .select-root > summary::-webkit-details-marker {
    display: none;
  }

  .select-trigger,
  .select-native {
    width: 192px;
    height: 32px;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    background: transparent;
    color: var(--foreground);
    font-size: 14px;
    line-height: 20px;
  }

  .select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 8px 5px 10px;
    text-align: start;
    white-space: nowrap;
    cursor: default;
    user-select: none;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
  }

  .select-trigger > span,
  .select-trigger-value {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .select-placeholder {
    color: var(--muted-foreground);
  }

  .select-trigger:hover:not(:disabled),
  .select-native:hover:not(:disabled) {
    background: color-mix(in srgb, var(--input) 30%, transparent);
  }

  .select-trigger:focus-visible,
  .select-native:focus-visible,
  .select-root[open] > .select-trigger {
    border-color: var(--ring);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
  }

  .select-trigger:disabled {
    cursor: not-allowed;
    opacity: 0.5;
  }

  .select-trigger--small {
    width: 86px;
    height: 28px;
    border-radius: min(var(--radius), 8px);
  }

  .select-chevron {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--muted-foreground);
    transition: transform 150ms ease;
  }

  .select-root[open] .select-chevron {
    transform: rotate(180deg);
  }

  .select-content {
    z-index: 20;
    min-width: 144px;
    overflow: scroll;
    border-radius: var(--radius);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--foreground) 10%, transparent), var(--shadow-sm);
  }

  .select-content--interactive {
    position: absolute;
    inset-block-start: calc(100% + 5px);
    inset-inline-start: 0;
    width: 192px;
    transform-origin: top;
    animation: select-content-in 100ms ease-out;
  }

  .select-content--static {
    position: relative;
    width: 192px;
  }

  .select-group {
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 4px;
  }

  .select-list-group {
    padding: 4px;
  }

  .select-label {
    display: block;
    width: 100%;
    margin: 0;
    padding: 4px 6px;
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 400;
    line-height: 20px;
  }

  .select-group > .select-label {
    float: none;
  }

  .select-item {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 28px;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 4px 32px 4px 6px;
    color: var(--popover-foreground);
    font-size: 14px;
    line-height: 20px;
    cursor: default;
    outline: none;
    user-select: none;
  }

  .select-item:hover,
  .select-item:focus-within,
  .select-item--highlighted {
    background: var(--accent);
    color: var(--accent-foreground);
  }

  .select-item--disabled {
    pointer-events: none;
    opacity: 0.5;
  }

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

  .select-check {
    position: absolute;
    inset-inline-end: 8px;
    width: 16px;
    height: 16px;
    display: none;
  }

  .select-item input:checked ~ .select-check,
  .select-check--visible {
    display: block;
  }

  .select-separator {
    height: 1px;
    margin: 4px -1px;
    background: var(--border);
  }

  .select-value {
    display: none;
  }

  .select-root:has(#fruit-apple:checked) .select-placeholder,
  .select-root:has(#fruit-banana:checked) .select-placeholder,
  .select-root:has(#fruit-blueberry:checked) .select-placeholder,
  .select-root:has(#fruit-grapes:checked) .select-placeholder,
  .select-root:has(#fruit-pineapple:checked) .select-placeholder {
    display: none;
  }

  .select-root:has(#fruit-apple:checked) .select-value--apple,
  .select-root:has(#fruit-banana:checked) .select-value--banana,
  .select-root:has(#fruit-blueberry:checked) .select-value--blueberry,
  .select-root:has(#fruit-grapes:checked) .select-value--grapes,
  .select-root:has(#fruit-pineapple:checked) .select-value--pineapple {
    display: inline;
  }

  .select-open-composition {
    display: grid;
    gap: 6px;
  }

  .select-open-composition > .select-trigger {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
    border-color: var(--ring);
  }

  .select-state-list,
  .select-field {
    display: grid;
    gap: 7px;
  }

  .select-state-list {
    gap: 18px;
  }

  .select-field-label {
    color: var(--foreground);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
  }

  .select-native-wrap {
    position: relative;
    display: inline-grid;
    width: 192px;
  }

  .select-native {
    appearance: none;
    padding: 5px 32px 5px 10px;
    outline: none;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
  }

  .select-native-wrap > .select-chevron {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-end: 8px;
    pointer-events: none;
  }

  .select-inline-states {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .select-inline-states .select-trigger:not(.select-trigger--small) {
    width: 138px;
  }

  .select-field--invalid .select-native {
    border-color: var(--destructive);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 20%, transparent);
  }

  .select-error {
    color: var(--destructive);
    font-size: 12px;
    line-height: 1.35;
  }

  [dir="rtl"] > .select-trigger {
    width: 160px;
    padding-inline: 10px 8px;
  }

  @media (prefers-color-scheme: dark) {
    .select-trigger,
    .select-native {
      background: color-mix(in srgb, var(--input) 30%, transparent);
    }

    .select-trigger:hover:not(:disabled),
    .select-native:hover:not(:disabled) {
      background: color-mix(in srgb, var(--input) 50%, transparent);
    }

    .select-field--invalid .select-native {
      border-color: color-mix(in srgb, var(--destructive) 50%, transparent);
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 40%, transparent);
    }
  }

  @media (max-width: 860px) {
    .select-showcase {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .select-example--states {
      grid-column: 1 / -1;
    }
  }

  @media (max-width: 520px) {
    .select-stage {
      min-height: 0;
    }

    .select-showcase {
      grid-template-columns: minmax(0, 1fr);
      gap: 32px;
    }

    .select-example--states {
      grid-column: auto;
    }
  }

  @keyframes select-content-in {
    from { opacity: 0; transform: translateY(-2px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}
