.ivyn-select-host {
  position: relative;
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}

.ivyn-select-host[data-layout="fill"] {
  display: flex;
  width: 100%;
}

.ivyn-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  padding: 0 !important;
}

.ivyn-select-trigger {
  box-sizing: border-box;
  display: inline-flex;
  width: 100%;
  min-width: 132px;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 13px;
  border: 1px solid #d8e5d8;
  border-radius: 14px;
  background: #fbfdf9;
  color: #203b2c;
  font: 500 13px/1.3 "DM Sans", sans-serif;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.ivyn-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ivyn-select-chevron {
  flex: 0 0 auto;
  color: #4e8960;
  font-size: 17px;
  line-height: 1;
  transition: transform 160ms ease;
}

.ivyn-select-trigger:hover,
.ivyn-select-host.is-open .ivyn-select-trigger {
  border-color: #79a987;
  background: #f0f7ef;
}

.ivyn-select-trigger:focus-visible {
  outline: 2px solid #9cc9f2;
  outline-offset: 2px;
}

.ivyn-select-host.is-open .ivyn-select-chevron {
  transform: rotate(180deg);
}

.ivyn-select-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 7px);
  left: 0;
  display: grid;
  width: max(100%, 168px);
  max-height: min(300px, calc(100vh - 28px));
  gap: 3px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #d8e5d8;
  border-radius: 17px;
  background: #fbfdf9;
  box-shadow: 0 14px 34px rgb(22 45 29 / 18%);
  transform-origin: top left;
  animation: ivyn-select-menu-in 140ms ease-out both;
}

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

.ivyn-select-option {
  min-height: 38px;
  padding: 8px 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #294333;
  font: 500 13px/1.35 "DM Sans", sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background-color 130ms ease, color 130ms ease;
}

.ivyn-select-option:hover,
.ivyn-select-option:focus-visible {
  outline: 0;
  background: #eaf3e8;
  color: #183c29;
}

.ivyn-select-option[aria-selected="true"] {
  background: #9cc9f2;
  color: #17251d;
  font-weight: 700;
}

.ivyn-select-option:disabled {
  opacity: .48;
  cursor: not-allowed;
}

/* The dashboard keeps its dark green controls while the dropdown stays rounded. */
html[data-theme="dark"] .ivyn-select-trigger,
html[data-theme="dark"] .ivyn-select-menu {
  border-color: #405b49;
  background: #17251d;
  color: #edf4ee;
}

html[data-theme="dark"] .ivyn-select-trigger:hover,
html[data-theme="dark"] .ivyn-select-host.is-open .ivyn-select-trigger {
  border-color: #76a98a;
  background: #1d3024;
}

html[data-theme="dark"] .ivyn-select-option {
  color: #e6efe8;
}

html[data-theme="dark"] .ivyn-select-option:hover,
html[data-theme="dark"] .ivyn-select-option:focus-visible {
  background: #294532;
  color: #fff;
}

html[data-theme="dark"] .ivyn-select-option[aria-selected="true"] {
  background: #9cc9f2;
  color: #17251d;
}

/* Keep the controls sized like their original fields. */
.analytics-select-wrap .ivyn-select-host { width: 142px; }
.analytics-interval-wrap .ivyn-select-host { width: 114px; flex: 0 0 auto; }
.analytics-select-wrap .ivyn-select-trigger,
.analytics-interval-wrap .ivyn-select-trigger { min-height: 42px; border-radius: 999px; background: #17251d; color: #edf4ee; }
.analytics-select-wrap .ivyn-select-menu,
.analytics-interval-wrap .ivyn-select-menu { border-color: #405b49; border-radius: 17px; background: #17251d; }
.analytics-select-wrap .ivyn-select-option,
.analytics-interval-wrap .ivyn-select-option { color: #e6efe8; }
.analytics-select-wrap .ivyn-select-option:hover,
.analytics-interval-wrap .ivyn-select-option:hover,
.analytics-select-wrap .ivyn-select-option:focus-visible,
.analytics-interval-wrap .ivyn-select-option:focus-visible { background: #294532; color: #fff; }
.analytics-select-wrap .ivyn-select-option[aria-selected="true"],
.analytics-interval-wrap .ivyn-select-option[aria-selected="true"] { background: #9cc9f2; color: #17251d; }
.analytics-interval-wrap { position: relative; }
.analytics-interval-wrap .ivyn-select-menu { right: 0; left: auto; }

.focus-session-duration .ivyn-select-host { width: 148px; }
.focus-session-duration .ivyn-select-trigger { min-width: 0; min-height: 34px; padding: 6px 9px; border-radius: 9px; font-size: 11px; font-weight: 600; }
.pricing-exam-picker .ivyn-select-host { min-width: 190px; }
.pricing-exam-picker .ivyn-select-trigger { min-height: 42px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.material-studio-controls .ivyn-select-host,
.flashcards-toolbar .ivyn-select-host { width: 100%; }
.material-studio-controls .ivyn-select-trigger,
.flashcards-toolbar .ivyn-select-trigger { min-height: 42px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.settings-field .ivyn-select-host,
.university-field .ivyn-select-host,
.essay-field .ivyn-select-host,
.placement-field .ivyn-select-host,
.admin-field .ivyn-select-host { width: 100%; }

@keyframes ivyn-select-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 780px) {
  .analytics-select-wrap .ivyn-select-host { width: 100%; }
  .analytics-select-wrap .ivyn-select-trigger { width: 100%; }
}

@media (max-width: 700px) {
  .pricing-exam-picker .ivyn-select-host { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ivyn-select-trigger,
  .ivyn-select-chevron,
  .ivyn-select-option { transition: none; }
  .ivyn-select-menu { animation: none; }
}
