.ims-compact-select-trigger,
.ims-compact-select-menu {
  display: none;
}

@media (max-width: 620px) {
  select.ims-compact-select-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
  }

  .ims-compact-select-trigger {
    width: 100%;
    min-height: 44px;
    padding: 0 38px 0 12px;
    border: 1px solid var(--prototype-border, rgba(148, 163, 184, .28));
    border-radius: 8px;
    display: flex;
    align-items: center;
    position: relative;
    background: var(--compact-select-field, rgba(255, 255, 255, .035));
    color: var(--prototype-text, var(--text-color, inherit));
    font: inherit;
    text-align: left;
  }

  .ims-compact-select-trigger::after {
    content: "";
    width: 8px;
    height: 8px;
    position: absolute;
    right: 14px;
    top: calc(50% - 6px);
    border-right: 2px solid var(--prototype-cyan, #00c8f0);
    border-bottom: 2px solid var(--prototype-cyan, #00c8f0);
    transform: rotate(45deg);
    transition: transform .16s ease, top .16s ease;
  }

  .ims-compact-select-trigger[aria-expanded="true"]::after {
    top: calc(50% - 2px);
    transform: rotate(225deg);
  }

  .ims-compact-select-trigger:focus-visible {
    outline: 3px solid rgba(0, 200, 240, .34);
    outline-offset: 2px;
  }

  .ims-compact-select-trigger:disabled {
    opacity: .55;
    cursor: not-allowed;
  }

  .ims-compact-select-menu {
    z-index: 4000;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    position: fixed;
    border: 1px solid var(--prototype-border-strong, rgba(148, 163, 184, .38));
    border-radius: 10px;
    display: block;
    background: var(--prototype-overlay, var(--compact-select-menu, #0d162e));
    color: var(--prototype-text, var(--text-color, #f8fafc));
    box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
    scrollbar-width: thin;
    animation: ims-compact-select-open .14s ease both;
  }

  .ims-compact-select-menu[hidden] {
    display: none;
  }

  .ims-compact-select-option {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    display: flex;
    align-items: center;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
  }

  .ims-compact-select-option + .ims-compact-select-option {
    border-top: 1px solid rgba(255, 255, 255, .055);
  }

  .ims-compact-select-option[aria-selected="true"] {
    background: rgba(0, 200, 240, .12);
    color: var(--prototype-cyan, #00c8f0);
  }

  .ims-compact-select-option:disabled {
    opacity: .45;
  }

  @keyframes ims-compact-select-open {
    from { opacity: 0; transform: translateY(-3px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .ims-compact-select-menu { animation: none; }
  .ims-compact-select-trigger::after { transition: none; }
}
