.musi-notchselect {
  /* Tokens: cambia estos valores para adaptar el desplegable */
  --musi-bg: #f4f1ea;
  --musi-fg: #0d0d0d;
  --musi-accent: #ff4d1f; /* color de la ficha, del punto y de la opción elegida */
  --musi-icon: #ffffff; /* color de la flecha */
  --musi-size: 1rem; /* todo el campo escala con este tamaño */
  --musi-width: 13em;
  --musi-chip: 1.7em; /* lado de la ficha de la flecha */
  --musi-chip-radius: 0.85em; /* redondeo de la ficha: 0 = cuadrada */
  --musi-notch-gap: 0.3em; /* aire entre la ficha y la mordida */
  --musi-shadow: 0; /* intensidad de la sombra: 0 = sin sombra */
  --musi-duration: 0.45s;
  --musi-stagger: 0.04s; /* retraso entre una opción y la siguiente */
  --musi-ease: cubic-bezier(0.65, 0, 0.35, 1);

  /* Medidas internas */
  --musi-bite: calc(var(--musi-chip) + var(--musi-notch-gap)); /* sitio de la mordida del botón: el texto lo esquiva */
  --musi-dot: calc(var(--musi-chip) * 0.36); /* lado del punto de la lista */
  --musi-dot-gap: calc(var(--musi-notch-gap) * 0.8);

  position: relative;
  display: inline-block;
  width: min(100%, var(--musi-width));
  color: var(--musi-fg);
  /* Inter es opcional: si tu sitio no la carga, se usa la fuente del sistema */
  font: 300 var(--musi-size) / 1.3 "Inter", system-ui, sans-serif;
}

/* Las siluetas: un SVG de fondo para el botón y otro para la lista; el
   script dibuja sus contornos */
.musi-notchselect__shape {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--musi-bg);
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / calc(0.08 * var(--musi-shadow))))
    drop-shadow(0 8px 12px rgb(0 0 0 / calc(0.22 * var(--musi-shadow))));
}

/* ---------- Botón ---------- */
.musi-notchselect__button {
  position: relative;
  isolation: isolate;
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 1.05em calc(var(--musi-bite) + 1.2em) 1.05em 1.5em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  outline: none;
}

.musi-notchselect[data-musi-notch="left"] .musi-notchselect__button {
  padding-inline: calc(var(--musi-bite) + 1.2em) 1.5em;
}

/* Sin script no hay siluetas dibujadas: botón y lista son rectángulos redondeados */
.musi-notchselect:not([data-musi-ready]) :is(.musi-notchselect__button, .musi-notchselect__panel) {
  border-radius: 0.9em;
  background: var(--musi-bg);
}

.musi-notchselect__button:focus-visible {
  outline: 2px solid var(--musi-accent);
  outline-offset: 4px;
  border-radius: 0.9em;
}

/* Ventana que recorta el valor cuando rueda */
.musi-notchselect__window {
  display: block;
  overflow: hidden;
}

.musi-notchselect__value {
  display: block;
  white-space: nowrap;
}

/* ---------- Mordida y ficha del botón ----------
   El hueco: una caja pegada al costado, centrada a lo alto. Su relleno es
   el aire entre la ficha y el borde curvo de la mordida. */
.musi-notchselect__slot {
  position: absolute;
  top: calc(50% - var(--musi-chip) / 2 - var(--musi-notch-gap));
  right: 0;
  padding: var(--musi-notch-gap) 0 var(--musi-notch-gap) var(--musi-notch-gap);
  pointer-events: none;
}

.musi-notchselect[data-musi-notch="left"] .musi-notchselect__slot {
  right: auto;
  left: 0;
  padding: var(--musi-notch-gap) var(--musi-notch-gap) var(--musi-notch-gap) 0;
}

/* La ficha también es la ventana que recorta la flecha cuando se hunde */
.musi-notchselect__chip {
  display: grid;
  place-items: center;
  width: var(--musi-chip);
  height: var(--musi-chip);
  overflow: hidden;
  border-radius: var(--musi-chip-radius);
  background: var(--musi-accent);
  color: var(--musi-icon);
}

.musi-notchselect__chip svg {
  width: 55%;
  height: 55%;
  transition: rotate var(--musi-duration) var(--musi-ease);
}

/* En hover la flecha se hunde y vuelve a entrar desde arriba */
.musi-notchselect__button:hover .musi-notchselect__chip svg {
  animation: musi-notchselect-dip var(--musi-duration) var(--musi-ease);
}

.musi-notchselect__button[aria-expanded="true"] .musi-notchselect__chip svg {
  rotate: 180deg;
}

@keyframes musi-notchselect-dip {
  45% {
    translate: 0 130%;
  }
  45.01% {
    translate: 0 -130%;
  }
}

/* ---------- Lista ----------
   Otra placa, debajo del botón. Cerrada es invisible y está un poco más
   arriba; al abrir baja a su sitio. */
.musi-notchselect__panel {
  position: absolute;
  top: calc(100% + 0.45em);
  right: 0;
  left: 0;
  z-index: 10;
  isolation: isolate;
  padding: 0.5em 0;
  opacity: 0;
  translate: 0 -0.6em;
  visibility: hidden;
  transition:
    opacity var(--musi-duration) var(--musi-ease),
    translate var(--musi-duration) var(--musi-ease),
    visibility 0s var(--musi-duration);
}

.musi-notchselect__button[aria-expanded="true"] ~ .musi-notchselect__panel {
  opacity: 1;
  translate: 0 0;
  visibility: visible;
  transition-delay: 0s;
}

.musi-notchselect__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Cada opción entra desde abajo, una tras otra (--musi-i lo pone el script) */
.musi-notchselect__option {
  padding: 0.55em calc(var(--musi-dot) + var(--musi-dot-gap) + 1.1em) 0.55em 1.5em;
  cursor: pointer;
  outline: none;
  opacity: 0;
  translate: 0 0.6em;
  transition:
    opacity var(--musi-duration) var(--musi-ease),
    translate var(--musi-duration) var(--musi-ease),
    text-indent var(--musi-duration) var(--musi-ease),
    color 0.2s ease-out;
}

.musi-notchselect[data-musi-notch="left"] .musi-notchselect__option {
  padding-inline: calc(var(--musi-dot) + var(--musi-dot-gap) + 1.1em) 1.5em;
}

.musi-notchselect__button[aria-expanded="true"] ~ .musi-notchselect__panel .musi-notchselect__option {
  opacity: 0.55;
  translate: 0 0;
  transition-delay: calc(var(--musi-i, 0) * var(--musi-stagger)), calc(var(--musi-i, 0) * var(--musi-stagger)), 0s, 0s;
}

/* La opción señalada (donde está la mordida) se enciende y da un paso */
.musi-notchselect__button[aria-expanded="true"] ~ .musi-notchselect__panel .musi-notchselect__option:is(:hover, :focus) {
  opacity: 1;
  text-indent: 0.35em;
}

.musi-notchselect__button[aria-expanded="true"] ~ .musi-notchselect__panel .musi-notchselect__option[aria-selected="true"] {
  color: var(--musi-accent);
  opacity: 1;
}

/* ---------- Mordida y punto de la lista ----------
   El hueco va pegado al costado de la lista. --musi-pos (la pone el script,
   cuadro a cuadro) es su posición a lo alto de ella. */
.musi-notchselect__mark {
  position: absolute;
  top: 0;
  right: 0;
  padding: var(--musi-dot-gap) 0 var(--musi-dot-gap) var(--musi-dot-gap);
  translate: 0 var(--musi-pos, 0px);
  pointer-events: none;
}

.musi-notchselect[data-musi-notch="left"] .musi-notchselect__mark {
  right: auto;
  left: 0;
  padding: var(--musi-dot-gap) var(--musi-dot-gap) var(--musi-dot-gap) 0;
}

.musi-notchselect__dot {
  display: block;
  width: var(--musi-dot);
  height: var(--musi-dot);
  border-radius: calc(var(--musi-chip-radius) * 0.36);
  background: var(--musi-accent);
}

@media (prefers-reduced-motion: reduce) {
  .musi-notchselect__chip svg,
  .musi-notchselect__panel,
  .musi-notchselect__option {
    transition: none;
  }
  .musi-notchselect__button:hover .musi-notchselect__chip svg {
    animation: none;
  }
}
