.field {
  position: relative;

  &.is-options {
    padding-right: 48px;
  }
}

.field_input {
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  color: inherit;
  background: var(--surface-ui-regular);
  border: none;
  border-radius: var(--radius);

  &[role="spinbutton"] {
    padding-inline-end: 23px;
    text-align: right;
  }

  &[aria-invalid] {
    color: var(--danger);
    background: var(--surface-ui-danger);

    &:focus {
      outline-color: var(--danger);
    }
  }

  &.is-warning {
    background: var(--surface-ui-warning);
  }

  .field.is-options & {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

.field_control {
  position: absolute;
  right: 0;
  width: 22px;
  height: 50%;
  background: transparent;
  border: none;

  &.is-increase {
    top: 0;
    transform: rotate(180deg);
  }

  &.is-decrease {
    bottom: 0;
  }
}

.field_control::before {
  position: absolute;
  top: 1px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  content: "";
  background: var(--surface-1);
  border-radius: 0 0 6px 6px;

  :hover& {
    background: var(--surface-ui-accent);
  }
}

.field_control::after {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  content: "";
  background: url(./decrease.svg);

  @media (prefers-color-scheme: dark) {
    filter: invert(1);
  }
}

.field_hotkey {
  position: absolute;
  inset-inline-start: -24px;
  top: 10px;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: bold;
  line-height: 16px;
  color: var(--text-note);
  text-align: center;
  text-transform: uppercase;
  border: 1px solid var(--text-note);
  border-bottom-width: 2px;
  border-radius: 2px;

  @media (width < 830px) {
    display: none;
  }
}

.field_options {
  position: absolute;
  top: 0;
  right: 0;
  width: 46px;
  height: 100%;
}

.field_select {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  appearance: none;
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  opacity: 0%;
}

.field_button {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--accent);
  background: var(--surface-ui-accent);
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);

  .field_select:focus + & {
    outline: var(--accent) solid 3px;
  }

  .field_select:hover + & {
    color: var(--text-badge);
    background: var(--accent);
  }

  .field_select:not(:focus-visible):focus + & {
    outline: none;
  }
}

.field_button > svg {
  width: 16px;
  height: 16px;
}
